.msg {
  --msg-raised: #242424;
  --msg-quiet: #bdbab4;
  --msg-rule: #41403d;
  min-width: 0;
  color: var(--cohort-ink);
  color-scheme: dark;
}
.msg-assist { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.msg [hidden] { display: none !important; }
.msg h2, .msg h3, .msg p { margin: 0; }
.msg-heading { margin-bottom: 1.35rem; }
.msg-heading h2 { font-size: clamp(1.65rem,3.6vw,2.35rem); line-height: 1.15; letter-spacing: -.045em; font-weight: 650; }
.msg-heading p { margin-top: .4rem; color: var(--msg-quiet); }
.msg-layout {
  display: grid;
  grid-template-columns: minmax(15rem, .43fr) minmax(0, 1fr);
  min-height: 31rem;
  overflow: hidden;
  background: var(--cohort-panel);
  border: 1px solid var(--msg-rule);
  border-radius: .95rem;
}
.msg-directory {
  min-width: 0;
  max-height: min(47rem, 79vh);
  overflow-y: auto;
  border-right: 1px solid var(--msg-rule);
}
.msg-index-section { padding: 1.1rem .7rem; }
.msg-index-section + .msg-index-section { border-top: 1px solid var(--msg-rule); }
.msg-index-section h3 { padding: .12rem .48rem .7rem; font-size: 1rem; line-height: 1.25; letter-spacing: -.02em; }
.msg-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 4.5rem;
  gap: .68rem;
  padding: .5rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  color: var(--cohort-ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.msg-row:hover { background: #282828; }
.msg-row[aria-current] { border-color: #796746; background: #302a20; }
.msg-avatar {
  display: inline-grid;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid #575349;
  border-radius: 50%;
  background: #2b2926;
  color: var(--cairos-gold);
  font-weight: 600;
  font-size: .85rem;
}
.msg-row-copy { flex: 1; min-width: 0; }
.msg-row-copy strong, .msg-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row-copy strong { font-size: .94rem; line-height: 1.35; }
.msg-preview { margin-top: .12rem; color: var(--msg-quiet); font-size: .82rem; }
.msg-row time { flex: 0 1 4rem; text-align: right; font-size: .71rem; color: var(--msg-quiet); }
.msg-empty-note { color: var(--msg-quiet); font-size: .9rem; line-height: 1.5; }
.msg-index-section .msg-empty-note { padding: 0 .48rem .15rem; }
.msg-thread { min-width: 0; display: flex; flex-direction: column; background: #171717; }
.msg-welcome { max-width: 33rem; margin: auto; padding: 2rem; text-align: center; }
.msg-welcome h3 { font: 400 clamp(1.85rem,3vw,2.75rem)/1.12 var(--sh-display); letter-spacing: -.045em; }
.msg-welcome p { margin-top: .65rem; color: var(--msg-quiet); }
.msg-thread-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.msg-person { display: flex; gap: .8rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--msg-rule); }
.msg-person h3 { font-size: 1.16rem; letter-spacing: -.025em; line-height: 1.3; }
.msg-person div { min-width: 0; overflow-wrap: anywhere; }
.msg-person p { color: var(--msg-quiet); font-size: .87rem; margin-top: .1rem; }
.msg-person h3:focus { outline: 0; }
.msg-log {
  display: flex;
  flex: 1 1 22rem;
  flex-direction: column;
  align-items: flex-start;
  gap: .9rem;
  min-height: 8rem;
  max-height: clamp(16rem, 43vh, 31rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.12rem 1.25rem;
}
.msg-entry { max-width: min(75%, 42rem); }
.msg-entry.msg-own { align-self: flex-end; }
.msg-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .55rem; margin-bottom: .24rem; color: var(--msg-quiet); font-size: .78rem; }
.msg-meta strong { color: var(--cohort-ink); font-weight: 550; overflow-wrap: anywhere; }
.msg-own .msg-meta { justify-content: flex-end; }
.msg-body { display: block; width: fit-content; padding: .59rem .82rem; border-radius: .65rem; background: #303030; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 1.0625rem; line-height: 1.5; }
.msg-own .msg-body { margin-left: auto; background: #faf9f6; color: #171717; }
.msg-compose { padding: .9rem 1.25rem 1.05rem; margin-top: auto; border-top: 1px solid var(--msg-rule); }
.msg-compose label { display: block; font-size: .89rem; font-weight: 600; }
.msg-compose textarea {
  width: 100%; min-height: 3rem; max-height: 9.2rem; resize: vertical; display: block;
  margin: .35rem 0 .55rem; padding: .57rem .75rem;
  background: #111; color: var(--cohort-ink); border: 1px solid #74716a; border-radius: .45rem;
  font: 400 1.0625rem/1.5 var(--sh-sans); field-sizing: content;
}
.msg-actions { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.msg-actions button {
  flex: none; min-height: 3rem; padding: .56rem 1rem; border: 0; border-radius: .48rem;
  background: var(--cairos-gold); color: #171410; cursor: pointer; font: 650 .91rem/1.2 var(--sh-sans);
}
.msg-actions button:hover { background: #f4d69e; }
.msg-actions button:disabled { opacity: .52; cursor: default; }
.msg-send-status, .msg-status, .msg-thread-status { color: var(--msg-quiet); font-size: .9rem; }
.msg-status:not([hidden]) { margin: 0 0 1rem; }
.msg-thread-status:not([hidden]) { padding: .65rem 1.25rem; }
.msg-back, .msg-retry { border: 0; padding: .25rem; color: var(--cairos-gold); background: transparent; font: 600 .9rem/1.4 var(--sh-sans); text-decoration: underline; text-underline-offset: .23em; cursor: pointer; }
.msg-back { display: none; }
.msg-retry { margin-left: .45rem; min-height: 3rem; }
.msg :focus-visible { outline: 3px solid var(--cairos-gold); outline-offset: 2px; }
.msg-log:focus-visible { outline-offset: -3px; }
@media(max-width: 700px) {
  .msg-layout { display: block; min-height: auto; }
  .msg-directory { max-height: none; border: 0; }
  .msg-thread { display: none; }
  .msg-open .msg-directory { display: none; }
  .msg-open .msg-thread { display: flex; }
  .msg-back { display: block; width: fit-content; min-height: 3rem; padding: .5rem 1rem; }
  .msg-person { padding: .25rem 1rem .9rem; }
  .msg-log { min-height: 10rem; max-height: 48dvh; padding: 1rem; }
  .msg-compose { padding: .8rem 1rem 1rem; }

}
