/* ============================================================
   TICK IT · Component styles
   Class-based system. React wrappers in ds-components.jsx.
   ============================================================ */

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--t-14);
  line-height: var(--lh-snug);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; padding: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--p-100); color: var(--p-900); }

/* ── Typography utilities ──────────────────────────────── */
.t-h1 { font-size: var(--t-28); font-weight: var(--fw-semi); line-height: var(--lh-tight); letter-spacing: -0.02em; }
.t-h2 { font-size: var(--t-20); font-weight: var(--fw-semi); line-height: var(--lh-tight); letter-spacing: -0.01em; }
.t-h3 { font-size: var(--t-16); font-weight: var(--fw-semi); line-height: var(--lh-snug); }
.t-h4 { font-size: var(--t-14); font-weight: var(--fw-semi); line-height: var(--lh-snug); }
.t-body { font-size: var(--t-14); }
.t-sm   { font-size: var(--t-13); }
.t-xs   { font-size: var(--t-12); }
.t-eyebrow {
  font-size: var(--t-11);
  font-weight: var(--fw-semi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.t-mono { font-family: var(--font-mono); font-size: var(--t-12); }
.t-mute { color: var(--fg-muted); }
.t-soft { color: var(--fg-soft); }
.t-num  { font-variant-numeric: tabular-nums; }

/* ── Layout primitives ─────────────────────────────────── */
.row    { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.col    { display: flex; flex-direction: column; gap: var(--s-2); }
.grow   { flex: 1 1 0; min-width: 0; }
.sep    { height: 1px; background: var(--border); }
.vsep   { width: 1px; background: var(--border); align-self: stretch; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 32px;
  padding: 0 var(--s-3);
  font-size: var(--t-13);
  font-weight: var(--fw-medium);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(31,115,183,0.25); }

.btn-md { height: 32px; padding: 0 var(--s-3); font-size: var(--t-13); }
.btn-sm { height: 26px; padding: 0 var(--s-2); font-size: var(--t-12); border-radius: var(--r-sm); }
.btn-lg { height: 38px; padding: 0 var(--s-4); font-size: var(--t-14); }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 26px; }
.btn-icon.btn-lg { width: 38px; }

/* Primary */
.btn-primary {
  background: var(--primary);
  color: var(--fg-on-primary);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); border-color: var(--primary-active); }

/* Default / secondary */
.btn-default {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-default:hover { background: var(--surface-hover); }
.btn-default:active { background: var(--bg-strong); }

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--fg-soft);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--fg); }
.btn-ghost:active { background: var(--bg-strong); }

/* Danger */
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--red-700); border-color: var(--red-700); }

/* Link */
.btn-link {
  color: var(--link);
  height: auto;
  padding: 0;
  font-weight: var(--fw-medium);
  background: transparent;
  border: none;
}
.btn-link:hover { text-decoration: underline; }

/* Button group */
.btn-group { display: inline-flex; align-items: stretch; }
.btn-group .btn { border-radius: 0; border-right-width: 0; }
.btn-group .btn:first-child { border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.btn-group .btn:last-child  { border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); border-right-width: 1px; }
.btn-group .btn.is-active   { background: var(--primary); color: white; border-color: var(--primary); position: relative; z-index: 1; }

/* Segmented control (different — inset) */
.seg {
  display: inline-flex;
  background: var(--bg-strong);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 0;
}
.seg-item {
  padding: 4px var(--s-2);
  font-size: var(--t-12);
  font-weight: var(--fw-medium);
  color: var(--fg-muted);
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  cursor: pointer;
}
.seg-item:hover { color: var(--fg); }
.seg-item.is-active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--border-strong);
}

/* ── Inputs ────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 32px;
  padding: 0 var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--t-13);
  color: var(--fg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--fg-faint); }
.input:hover { border-color: var(--n-300); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,115,183,0.18); }
.input.input-lg { height: 38px; font-size: var(--t-14); }
.input.input-sm { height: 26px; font-size: var(--t-12); }
.input.has-icon { padding-left: 30px; }

.input-wrap { position: relative; display: block; }
.input-wrap .input-ic {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--fg-faint); pointer-events: none;
}
.input-wrap .input-kbd {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px; background: var(--bg-strong); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--fg-muted);
}
.input.has-kbd { padding-right: 36px; }

textarea.input {
  height: auto;
  min-height: 80px;
  padding: var(--s-2) var(--s-3);
  line-height: var(--lh-snug);
  resize: vertical;
}

.label {
  display: block;
  font-size: var(--t-12);
  font-weight: var(--fw-medium);
  color: var(--fg-soft);
  margin-bottom: var(--s-1);
}
.label .req { color: var(--danger); margin-left: 2px; }
.help { font-size: var(--t-12); color: var(--fg-muted); margin-top: var(--s-1); }
.err  { font-size: var(--t-12); color: var(--danger); margin-top: var(--s-1); }

/* ── Badge / Tag ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 var(--s-2);
  font-size: var(--t-11);
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--r-sm);
  background: var(--n-100);
  color: var(--fg-soft);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-sm { height: 18px; padding: 0 6px; font-size: 10px; }
.badge-lg { height: 24px; padding: 0 var(--s-3); font-size: var(--t-12); }

.badge-neutral { background: var(--n-100); color: var(--fg-soft); }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger  { background: var(--danger-soft); color: var(--danger-text); }
.badge-violet  { background: var(--violet-50); color: var(--violet-600); }

/* Dot variant — adds a leading dot */
.badge-dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}

/* Outline variant */
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--fg-soft); }

/* Pill */
.badge-pill { border-radius: var(--r-pill); padding: 0 var(--s-2); }

/* ── Avatar ───────────────────────────────────────────── */
.av {
  width: 28px; height: 28px;
  border-radius: var(--r-pill);
  background: var(--n-200);
  color: var(--fg-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: var(--fw-semi);
  flex-shrink: 0;
  position: relative;
  user-select: none;
}
.av-xs { width: 18px; height: 18px; font-size: 9px; }
.av-sm { width: 22px; height: 22px; font-size: 10px; }
.av-md { width: 28px; height: 28px; }
.av-lg { width: 36px; height: 36px; font-size: 13px; }
.av-xl { width: 48px; height: 48px; font-size: 16px; }
.av-stack { display: inline-flex; }
.av-stack > .av { box-shadow: 0 0 0 2px var(--surface); margin-left: -8px; }
.av-stack > .av:first-child { margin-left: 0; }
.av-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--success); border: 2px solid var(--surface);
}

/* Tonal avatar variants — for color tokens */
.av-tone-1 { background: #FFE2D3; color: #9A3412; } /* warm */
.av-tone-2 { background: #DBEAFE; color: #1E40AF; } /* blue */
.av-tone-3 { background: #E0E7FF; color: #3730A3; } /* indigo */
.av-tone-4 { background: #DCFCE7; color: #166534; } /* green */
.av-tone-5 { background: #FEF3C7; color: #92400E; } /* amber */
.av-tone-6 { background: #FCE7F3; color: #9D174D; } /* pink */
.av-tone-7 { background: #E5E7EB; color: #374151; } /* gray */

/* ── Card / Panel ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.card-pad   { padding: var(--s-4); }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.card-header {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s-2);
}
.card-footer {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s-2);
}
.card-body { padding: var(--s-4); }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  padding: 0 var(--s-4);
}
.tab {
  padding: var(--s-3) var(--s-3);
  font-size: var(--t-13);
  font-weight: var(--fw-medium);
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s-2);
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--primary-text); border-bottom-color: var(--primary); font-weight: var(--fw-semi); }
.tab.is-disabled { color: var(--fg-faint); cursor: not-allowed; }

/* ── Table ────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-13); }
.tbl thead th {
  text-align: left;
  font-size: var(--t-11);
  font-weight: var(--fw-semi);
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.tbl tbody td {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  height: 40px;
}
.tbl tbody tr:hover td { background: var(--surface-hover); }
.tbl tbody tr.is-selected td { background: var(--primary-soft); }
.tbl tbody tr.is-unread td { font-weight: var(--fw-semi); }
.tbl .cb { width: 32px; }
.tbl .num { font-variant-numeric: tabular-nums; }

/* ── Nav (sidebar) ────────────────────────────────────── */
.nav-section { padding: var(--s-2) var(--s-2); }
.nav-eyebrow {
  font-size: var(--t-11);
  font-weight: var(--fw-semi);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--s-2) var(--s-3);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: 30px;
  padding: 0 var(--s-3);
  border-radius: var(--r-sm);
  color: var(--fg-soft);
  font-size: var(--t-13);
  font-weight: var(--fw-medium);
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-hover); color: var(--fg); text-decoration: none; }
.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: var(--fw-semi);
}
.nav-item.is-active .nav-ic { color: var(--primary); }
.nav-item .nav-ic { color: var(--fg-muted); flex-shrink: 0; }
.nav-item.is-active .nav-ic { color: var(--primary); }
.nav-item .nav-count {
  margin-left: auto;
  font-size: var(--t-11);
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}
.nav-item.is-active .nav-count { color: var(--primary-text); }
.nav-item .nav-dot {
  width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0;
}

/* ── App shell ────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  width: 100%;
  background: var(--bg);
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  height: var(--topbar-h);
  padding: 0 var(--s-3);
  display: flex; align-items: center; gap: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-mark {
  width: 26px; height: 26px;
  background: var(--primary);
  color: white;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-weight: var(--fw-bold);
  font-size: var(--t-14);
}
.sidebar-scroll { flex: 1; overflow: auto; }
.sidebar-foot {
  padding: var(--s-3);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s-2);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.topbar {
  height: var(--topbar-h);
  padding: 0 var(--s-4);
  display: flex; align-items: center; gap: var(--s-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.topbar .crumb { color: var(--fg-muted); font-size: var(--t-13); }
.topbar .crumb-sep { color: var(--fg-faint); padding: 0 4px; }
.content { flex: 1; overflow: auto; min-height: 0; }

/* ── Kbd ──────────────────────────────────────────────── */
.kbd {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  height: 18px;
}

/* ── Status pip (filled dot with optional label) ────── */
.pip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-12);
  color: var(--fg-soft);
}
.pip::before {
  content: ""; width: 8px; height: 8px; border-radius: 999px;
  background: var(--fg-muted);
}
.pip.pip-open::before    { background: var(--success); }
.pip.pip-progress::before{ background: var(--primary); }
.pip.pip-hold::before    { background: var(--warning); }
.pip.pip-closed::before  { background: var(--fg-faint); }
.pip.pip-urgent::before  { background: var(--danger); }

/* ── Toolbar ─────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.toolbar-sub { background: var(--surface-2); }

/* ── Filter chip (pill that holds an applied filter) ── */
.fchip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 var(--s-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--t-12);
  color: var(--fg-soft);
  white-space: nowrap;
}
.fchip .fchip-x { color: var(--fg-faint); cursor: pointer; }
.fchip .fchip-x:hover { color: var(--fg); }
.fchip.is-active { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--primary-text); }

/* ── Progress bar (thin) ─────────────────────────────── */
.progress { height: 4px; background: var(--bg-strong); border-radius: var(--r-pill); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); transition: width var(--t-base) var(--ease); }

/* ── Checkbox / radio (visual) ───────────────────────── */
.chk {
  width: 16px; height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  display: inline-grid; place-items: center;
  flex-shrink: 0;
}
.chk.is-checked  { background: var(--primary); border-color: var(--primary); color: white; }
.chk.is-progress { background: var(--warning); border-color: var(--warning); color: white; }
.chk.is-blocked  { background: var(--danger);  border-color: var(--danger);  color: white; }

/* ── Conversation message bubble ─────────────────────── */
.msg {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}
.msg + .msg { border-top: 1px solid var(--border); }
.msg-body {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
}
.msg-body.is-internal { background: var(--amber-50); border-color: var(--amber-100); }
.msg-body.is-out      { background: var(--surface); }
.msg-body.is-in       { background: var(--surface); border-left: 3px solid var(--primary); }

.msg-meta {
  display: flex; align-items: center; gap: var(--s-2);
  flex-wrap: wrap;
  font-size: var(--t-12);
  color: var(--fg-muted);
  margin-bottom: var(--s-2);
}
.msg-meta > * { min-width: 0; }
.msg-meta .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-sys {
  text-align: center;
  font-size: var(--t-12);
  color: var(--fg-muted);
  padding: var(--s-2);
  display: flex; align-items: center; gap: var(--s-2);
  justify-content: center;
}
.msg-sys::before, .msg-sys::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ── Email list row (inbox / message list) ───────────── */
.mrow {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border);
  cursor: default;
  display: block;
  position: relative;
  border-left: 3px solid transparent;
  background: var(--surface);
}
.mrow:hover { background: var(--surface-hover); }
.mrow.is-unread { background: var(--surface); }
.mrow.is-unread::before {
  content: "";
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--primary);
}
.mrow.is-unread { padding-left: var(--s-5); }
.mrow.is-selected { background: var(--primary-soft); border-left-color: var(--primary); }
.mrow .mrow-top { display: flex; align-items: center; gap: var(--s-2); }
.mrow .mrow-from { font-weight: var(--fw-semi); font-size: var(--t-13); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow.is-unread .mrow-from { font-weight: var(--fw-bold); }
.mrow .mrow-time { font-size: var(--t-11); color: var(--fg-muted); flex-shrink: 0; }
.mrow .mrow-subj { font-size: var(--t-13); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.mrow.is-unread .mrow-subj { font-weight: var(--fw-semi); }
.mrow .mrow-prev { font-size: var(--t-12); color: var(--fg-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Empty state ─────────────────────────────────────── */
.empty {
  padding: var(--s-7);
  text-align: center;
  color: var(--fg-muted);
}
.empty .empty-ic { color: var(--fg-faint); margin-bottom: var(--s-3); }
.empty .empty-title { font-size: var(--t-15); font-weight: var(--fw-semi); color: var(--fg); margin-bottom: var(--s-1); }

/* ── Dividers ────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: var(--s-2);
  color: var(--fg-faint);
  font-size: var(--t-11);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: var(--s-3) 0;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* ── Tooltip (very basic) ────────────────────────────── */
[data-tooltip] { position: relative; }

/* ── Scrollbar (cleaner thin) ────────────────────────── */
.scroll-clean::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-clean::-webkit-scrollbar-thumb {
  background: var(--n-200); border-radius: 999px;
}
.scroll-clean::-webkit-scrollbar-thumb:hover { background: var(--n-300); }

/* ── Channel chip on conversation tabs ──────────────── */
.ch-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: var(--s-3) var(--s-3);
  font-size: var(--t-13);
  font-weight: var(--fw-medium);
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.ch-tab.is-active { color: var(--primary-text); border-bottom-color: var(--primary); font-weight: var(--fw-semi); }
.ch-tab.is-future { opacity: 0.5; cursor: not-allowed; }
.ch-tab .ch-count {
  font-size: 10px;
  background: var(--bg-strong); color: var(--fg-muted);
  padding: 1px 6px; border-radius: var(--r-pill);
  font-weight: var(--fw-semi);
}
.ch-tab.is-active .ch-count { background: var(--primary-soft-2); color: var(--primary-text); }

/* ── Misc fine-tuning ────────────────────────────────── */
.surface { background: var(--surface); }
.bg      { background: var(--bg); }

/* Focus styles for accessibility */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:focus-visible, .input:focus-visible, .nav-item:focus-visible { outline: none; }

/* ── Modal overlay ───────────────────────────────────── */
.hidden { display: none !important; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal, 300);
  padding: var(--s-4);
}

/* ── Misc message body styles ────────────────────────── */
.msg-body { padding: var(--s-3); background: var(--surface); border: 1px solid var(--border); }
.msg-body.is-in  { background: var(--p-50, #eff6ff); border-color: var(--p-100, #dbeafe); }
.msg-body.is-out { background: var(--g-50, #f0fdf4); border-color: var(--g-100, #dcfce7); }
.msg-meta { display: flex; align-items: flex-start; gap: var(--s-2); margin-bottom: var(--s-2); }

/* ── Avatar sizes ────────────────────────────────────── */
.av-sm { width: 28px; height: 28px; font-size: 11px; }
.av-lg { width: 40px; height: 40px; font-size: 16px; }

/* ── Row utility ─────────────────────────────────────── */
.row { display: flex; align-items: center; }
