/* Hallmark · macrostructure: Lobby Split-Rail · tone: utilitarian-editorial
 * genre: editorial · theme: Board Note (custom) · anchor hue: ink-blue
 * Hallmark · pre-emit critique: P5 H4 E5 S5 R5 V4
 *
 * vocabulary: paper surface, one highlighter accent (announcements only),
 * hand-taped note, continuous board writing. Attachments are described, not
 * previewed — a reference card is still writing on a page, a thumbnail wall
 * is not. The message menu borrows the OS context menu on purpose: it is the
 * one place where matching the platform beats matching the paper.
 */
@import url("tokens.css");

/* ------------------------------------------------------------------ base -- */

* { box-sizing: border-box; }

/* the hidden attribute must beat component display rules */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  /* no horizontal scroll at any viewport width */
  overflow-x: clip;
}

body {
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  max-width: 100%;
}

button {
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-md);
  padding: 9px 14px;
  white-space: nowrap; /* no clickable label wraps onto two lines */
  transition: background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out);
}

/* the focus ring appears instantly — its appearance is never animated */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------------------------------------- buttons --- */

.btn-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 600;
  border-color: transparent;
}
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-ghost {
  border-color: var(--color-line-strong);
  color: var(--color-ink-dim);
  background: var(--color-surface);
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-ink); }

.btn-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.btn-danger:hover { filter: brightness(.97); }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-md);
  color: var(--color-ink-dim);
  padding: 0;
}
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ----------------------------------------------------------- auth screen -- */

.auth-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--space-3xl) var(--space-lg) 56px;
  /* Notebook ruling, at the edge of visible: this is a classroom, and a sheet
     of paper is lined. The lines fade out where the card sits so they never
     compete with the form. One light pool on top, no gradient stacks. */
  background:
    radial-gradient(640px 320px at 50% -4%, var(--color-surface-2), transparent 70%),
    repeating-linear-gradient(
      to bottom,
      transparent 0 31px,
      color-mix(in srgb, var(--color-line) 78%, transparent) 31px 32px
    ),
    var(--color-paper);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px 26px 24px;
}

.brand-mark {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--color-accent);
  display: grid; place-items: center;
  color: var(--color-on-accent);
  font-family: var(--font-mono);
  font-size: 16px; font-weight: 700;
  letter-spacing: .02em;
  flex: 0 0 auto;
  /* the one object on the page that is allowed to be a sticker: slightly off
     square, with the little flat edge a real stamp has */
  transform: rotate(-4deg);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--color-accent-hover) 70%, #000);
  transition: transform var(--dur-base) var(--ease-fun);
}
.brand-row:hover .brand-mark { transform: rotate(-4deg) scale(1.08); }

.brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  min-width: 0;
}
.brand-row > div:last-child { min-width: 0; }
.brand-name {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub { font-size: 12.5px; color: var(--color-ink-faint); }

.auth-tabs {
  display: flex;
  gap: 2px;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-lg);
}
.auth-tabs button {
  flex: 1;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink-dim);
  border-radius: var(--radius-sm);
}
.auth-tabs button[aria-selected="true"] {
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.field { margin-bottom: var(--space-md); }
.field label,
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-dim);
  margin-bottom: var(--space-xs);
}
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.field input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.field .hint { font-size: 12px; color: var(--color-ink-faint); margin-top: var(--space-xs); }

.form-error {
  display: none;
  font-size: 13px;
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: var(--space-md);
}
.form-error.show { display: block; }

.auth-foot {
  margin-top: var(--space-lg);
  font-size: 12.5px;
  color: var(--color-ink-faint);
  text-align: center;
  line-height: 1.65;
}

.lang-switch { display: flex; justify-content: center; gap: var(--space-xs); margin-top: var(--space-lg); }
.lang-switch button {
  font-size: 12.5px;
  padding: 6px 12px;
  min-height: 34px;
  border-radius: var(--radius-pill);
  color: var(--color-ink-dim);
  border: 1px solid var(--color-line);
}
.lang-switch button:hover { border-color: var(--color-line-strong); color: var(--color-ink); }
.lang-switch button[aria-pressed="true"] {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border-color: transparent;
  font-weight: 600;
}

/* ----------------------------------------------------------------- shell -- */

.shell {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.rail {
  background: var(--color-surface);
  border-right: 1px solid var(--color-line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.rail-head { padding: var(--space-lg) var(--space-lg) var(--space-md); border-bottom: 1px solid var(--color-line); }
.rail-head .brand-row { margin: 0; }

.lobby-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: calc(100% - 24px);
  margin: var(--space-md) var(--space-md) var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
  font-size: 14.5px;
  text-align: left;
}
.lobby-item svg { flex: 0 0 auto; }
.lobby-item .count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: .9;
}

.rail-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  padding: var(--space-xs) 22px var(--space-2xs);
}

.presence-list { list-style: none; margin: 0; padding: 0 var(--space-md); overflow-y: auto; flex: 1; }
.presence-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-ink-dim);
  min-height: 40px;
}
.presence-list li:hover { background: var(--color-surface-2); color: var(--color-ink); }
.presence-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-list .badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}
.presence-empty { font-size: 13px; color: var(--color-ink-faint); padding: var(--space-xs) 22px var(--space-lg); }

.rail-foot {
  border-top: 1px solid var(--color-line);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.who { min-width: 0; flex: 1; }
.who .n {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.who .u {
  font-size: 12px; color: var(--color-ink-faint);
  font-family: var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.avatar {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
  color: var(--color-avatar-ink);
  letter-spacing: .02em;
  user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }

/* ------------------------------------------------------------------ main -- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--color-paper);
  position: relative;
}

.topbar {
  height: 60px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-xl);
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
}
.topbar h1 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.topbar .sub {
  font-size: 12.5px; color: var(--color-ink-faint);
  font-variant-numeric: tabular-nums;
}
.topbar .spacer { flex: 1; }

/* the one decorative moment: a note taped to the board */
.announcement {
  position: relative;
  margin: var(--space-md) var(--space-xl) 0;
  padding: 12px 16px 12px 40px;
  border-radius: 3px;
  background: var(--color-marker-soft);
  border: 1px solid var(--color-marker-edge);
  color: var(--color-on-marker);
  font-size: 13.5px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transform: rotate(-.4deg);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--color-on-marker) 12%, transparent);
}
.announcement::before {
  /* washi tape */
  content: "";
  position: absolute;
  top: -7px; left: 22px;
  width: 56px; height: 15px;
  background: var(--color-tape);
  opacity: .78;
  border-left: 1px solid color-mix(in srgb, var(--color-tape) 70%, #ffffff);
  border-right: 1px solid color-mix(in srgb, var(--color-tape) 70%, #ffffff);
  transform: rotate(-1.6deg);
}
.announcement svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
/* an announcement is user-written and can be one 300-character unbroken string.
 * Without the wrap it runs off the right edge; without the height cap it grows
 * tall enough at 240px to push the composer out of the viewport entirely.
 * A pinned note may be long — it may not eat the room.
 */
.announcement {
  max-height: min(30dvh, 200px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.announcement-body, #announcement-body {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-lg) var(--space-xl) var(--space-sm);
  display: flex;
  flex-direction: column;
  scrollbar-gutter: stable;
}

/* conversations read top-down like board writing — no bottom-pinning gap */

.msg {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 3px 8px 3px 6px;
  border-radius: var(--radius-sm);
  position: relative;
  /* a message lands rather than appears: the small overshoot is the only
     playful motion in the room, and it happens once per message */
  animation: msg-in var(--dur-slow) var(--ease-fun);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px) scale(.994); }
  to { opacity: 1; transform: none; }
}
.msg:hover { background: color-mix(in srgb, var(--color-surface) 62%, transparent); }
.msg:not(.grouped) { margin-top: var(--space-md); }
.msg .avatar { width: 32px; height: 32px; }
.msg.grouped .avatar-slot::after {
  content: "";
  width: 32px;
}

.msg-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: 1px;
}
.msg.grouped .msg-head { display: none; }
.msg-author { font-size: 14px; font-weight: 650; }
.msg.mine .msg-author { color: var(--color-accent); }
.msg-time {
  font-size: 12px;
  color: var(--color-ink-faint);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.msg-body {
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg-body a { color: var(--color-accent); text-underline-offset: 2px; }
.msg.tombstone .msg-body { color: var(--color-ink-faint); font-style: italic; }

.msg-del {
  position: absolute;
  top: 1px; right: 6px;
  font-size: 12px;
  color: var(--color-danger);
  padding: 3px 8px;
  min-height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-danger-soft);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.msg:hover .msg-del,
.msg-del:focus-visible { opacity: 1; }

.tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  align-self: center;
}

.day-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) var(--space-2xs) var(--space-2xs);
  font-size: 12px;
  color: var(--color-ink-faint);
  font-weight: 600;
  letter-spacing: .02em;
}
.day-divider::before,
.day-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-line); }

.empty-state {
  white-space: pre-line;
  text-align: center;
  color: var(--color-ink-faint);
  font-size: 14px;
  padding: 48px var(--space-lg) 64px;
  line-height: 1.9;
  /* an empty lobby reads centered in the pane, not stuck to its top edge */
  flex: 1;
  display: grid;
  place-content: center;
}

.scroll-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 92px;
  background: var(--color-surface);
  border: 1px solid var(--color-line-strong);
  box-shadow: var(--shadow-lift);
  border-radius: var(--radius-pill);
  font-size: 13px;
  padding: 8px 16px;
  color: var(--color-accent);
  font-weight: 600;
  z-index: 5;
}

.composer-wrap {
  flex: 0 0 auto;
  padding: var(--space-sm) var(--space-xl) var(--space-lg);
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-line);
  background: var(--color-surface);
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 14px;
  background: var(--color-surface);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.composer:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.composer textarea {
  flex: 1;
  border: 0;
  resize: none;
  max-height: 152px;
  min-height: 26px;
  padding: 6px 0;
  background: transparent;
  line-height: 1.5;
  font-size: 16px;
}
.composer textarea:focus { outline: none; }
.composer .send {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-on-accent);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.composer .send:disabled { opacity: .45; cursor: not-allowed; }
.composer .send:hover:not(:disabled) { background: var(--color-accent-hover); }
.composer .send:active:not(:disabled) { transform: translateY(1px); }
.composer .send svg { width: 17px; height: 17px; }

/* --- send button states: loading · error · success ------------------------ */
.composer .send[data-state="loading"] {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.composer .send[data-state="loading"] svg {
  animation: send-spin 900ms linear infinite;
}
@keyframes send-spin { to { transform: rotate(360deg); } }

.composer .send[data-state="error"] {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.composer .send[data-state="success"] {
  background: var(--color-ok);
  color: var(--color-avatar-ink);
  /* one bounce on arrival — the send button is the thing people press most */
  animation: send-pop var(--dur-slow) var(--ease-fun);
}
@keyframes send-pop {
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--color-ink-faint);
  padding: var(--space-xs) var(--space-2xs) 0;
}
.muted-note { color: var(--color-danger); }
.conn { display: inline-flex; align-items: center; gap: 6px; }
.conn .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-ok); }
.conn.offline .dot { background: var(--color-danger); }
.conn.offline { color: var(--color-danger); }

/* ----------------------------------------------------------------- admin -- */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--color-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
  z-index: 40;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--color-surface);
  border-left: 1px solid var(--color-line);
  box-shadow: var(--shadow-lift);
  transform: translateX(102%);
  transition: transform 220ms var(--ease-out);
  z-index: 41;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--color-line);
}
.drawer-head h2 { font-size: 16px; margin: 0; font-weight: 650; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-lg) var(--space-lg) 28px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.stat { background: var(--color-surface-2); border-radius: var(--radius-md); padding: 10px 12px; }
.stat .v {
  font-size: 19px; font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat .k { font-size: 11.5px; color: var(--color-ink-dim); margin-top: 1px; }

.tabs { display: flex; gap: var(--space-2xs); border-bottom: 1px solid var(--color-line); margin-bottom: var(--space-md); }
.tabs button {
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-ink-dim);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent;
}
.tabs button:hover { color: var(--color-ink); }
.tabs button[aria-selected="true"] { color: var(--color-accent); border-bottom-color: var(--color-accent); }

.search-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  background: var(--color-surface);
}
.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--color-line);
  flex-wrap: wrap;
}
.user-row:hover { background: var(--color-surface-2); }
.user-row .meta { min-width: 140px; flex: 1; }
.user-row .meta .n {
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.user-row .meta .s {
  font-size: 12px; color: var(--color-ink-faint);
  font-variant-numeric: tabular-nums;
}
.user-row .actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; justify-content: flex-end; }

.chip {
  font-size: 12px;
  padding: 5px 10px;
  min-height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-line-strong);
  color: var(--color-ink-dim);
  background: var(--color-surface);
}
.chip:hover { border-color: var(--color-accent); color: var(--color-accent); }
.chip.warn { color: var(--color-on-marker); background: var(--color-marker-soft); border-color: transparent; }
.chip.bad { color: var(--color-danger); background: var(--color-danger-soft); border-color: transparent; }

.pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  padding: 1px 6px; border-radius: var(--radius-pill); text-transform: uppercase;
}
.pill.admin { background: var(--color-accent-soft); color: var(--color-accent); }
.pill.banned { background: var(--color-danger-soft); color: var(--color-danger); }
.pill.muted { background: var(--color-marker-soft); color: var(--color-on-marker); }

.log-row {
  font-size: 12.5px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--color-line);
  display: flex;
  gap: var(--space-sm);
  align-items: baseline;
  flex-wrap: wrap;
}
.log-row .a { font-weight: 650; font-family: var(--font-mono); font-size: 12px; }
.log-row .t {
  color: var(--color-ink-faint); margin-left: auto;
  font-variant-numeric: tabular-nums;
}

textarea.pad {
  width: 100%;
  min-height: 84px;
  padding: 10px 12px;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  resize: vertical;
  font-size: 14px;
}
textarea.pad:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.toast-stack {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--space-xs);
  z-index: 60; pointer-events: none;
}
.toast {
  background: var(--color-toast);
  color: var(--color-on-toast);
  font-size: 13.5px;
  padding: 9px 15px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  animation: msg-in var(--dur-fast) var(--ease-out);
}

/* ------------------------------------------------------------- responsive - */

.rail-toggle { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail-width-mobile);
    z-index: 45;
    transform: translateX(-102%);
    transition: transform 220ms var(--ease-out);
    box-shadow: var(--shadow-lift);
  }
  .rail.open { transform: none; }
  .rail-toggle { display: inline-grid; }
  .messages { padding: var(--space-md) var(--space-md) var(--space-xs); }
  .composer-wrap { padding: var(--space-sm) var(--space-md) var(--space-md); }
  .topbar { padding: 0 var(--space-md); }
  .announcement { margin: var(--space-md) var(--space-md) 0; padding-left: 36px; }
  .scroll-pill { bottom: 88px; }
  .msg-del { opacity: 1; }
  .icon-btn { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================ attachments ============================= */
/* Files are described, never previewed: no thumbnails, no inline media — the
   lobby stays a page of writing with references attached to it. */

.attach-tray {
  margin-bottom: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px dashed var(--color-line-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}
.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  max-width: 100%;
  padding: 4px 6px 4px 8px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: 13px;
}
.attach-name {
  max-width: 22ch;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--color-ink);
}
.attach-size { color: var(--color-ink-faint); font-variant-numeric: tabular-nums; }
.attach-x {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink-faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.attach-x:hover { background: var(--color-danger-soft); color: var(--color-danger); }
.attach-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--color-ink-faint);
}
.compose-attach { flex: 0 0 auto; align-self: flex-end; margin-bottom: 2px; }

.file-ext {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}
.msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}
.file-card {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  max-width: min(100%, 320px);
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-ink);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.file-card:hover { border-color: var(--color-accent); background: var(--color-surface-2); }
.file-meta { display: grid; min-width: 0; line-height: 1.25; }
.file-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 600;
}
.file-size { font-size: 11px; color: var(--color-ink-faint); font-variant-numeric: tabular-nums; }

/* ============================ context menu ============================ */

.ctx-menu {
  position: fixed;
  z-index: 60;
  min-width: 176px;
  padding: 4px;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0 12px 32px var(--color-scrim), 0 2px 6px var(--color-scrim);
}
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.ctx-menu button:hover { background: var(--color-surface-2); }
.ctx-menu button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.ctx-menu button svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--color-ink-dim); }

/* ========================= superadmin transfer ======================== */

.badge-super {
  background: var(--color-marker-soft);
  color: var(--color-on-marker);
}
.tag-super {
  /* a filled highlighter mark, not tinted text: the badge has to be legible at
     10.5px uppercase, and marker-on-marker never was */
  background: var(--color-badge-super);
  color: var(--color-on-badge-super);
}
.transfer-seat {
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--color-marker-edge);
  background: var(--color-marker-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
}
.transfer-list { display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.transfer-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  text-align: left;
  cursor: pointer;
}
.transfer-row:hover { border-color: var(--color-line-strong); background: var(--color-surface-2); }
.transfer-row[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}
.transfer-row .meta { display: grid; min-width: 0; line-height: 1.3; }
.transfer-row .n { font-size: 14px; font-weight: 600; }
.transfer-row .s { font-size: 12px; color: var(--color-ink-faint); }
.row-note { color: var(--color-ink-faint); font-size: 13px; }
