/* Redslot Desk - interface styling.
   Direction: a clean, modern messaging tool (Telegram / Intercom / Linear feel).
   Inter typeface, a confident blue accent, a calm slate neutral scale.

   PALETTE — calm, low-chroma. One main, one quiet second, one warm third, two
   semantic. Colour is used sparingly and for meaning; slate carries the rest.
     MAIN   teal   --accent   send / active / selected / primary action / links
     SECOND blue   --accent2  internal chat, info highlights (used lightly)
     THIRD  amber  --warn     attention / notes / reminders / pending
     ALERT  red    --alert    waiting / urgent / unread / unassigned / danger
     GOOD   green  --good     success / on shift / solved
   Telegram blue + WhatsApp green are channel marks, kept apart on purpose. */
:root {
  /* MAIN — calm teal (primary actions, send, active, selected, links) */
  --accent: #0F766E;
  --accent-hover: #0C5F58;
  --accent-ink: #0B544E;
  --accent-soft: #ECF4F2;
  --accent-soft-2: #D4E8E4;

  /* SECOND — a quiet dusty blue, used sparingly (internal chat, info) */
  --accent2: #4C6FA8;
  --accent2-soft: #EDF1F8;

  /* ALERT — a restrained red (waiting, urgent, unread, unassigned, danger) */
  --alert: #CF4B46;
  --alert-hover: #B23B37;
  --alert-soft: #FBEDEC;
  --alert-line: #EFD2CF;

  /* GOOD — a muted green (success, on shift, solved) */
  --good: #2E7D5B;
  --good-ink: #256B4D;
  --good-soft: #E9F2EC;

  /* THIRD — a calm ochre amber (attention, notes, reminders, pending) */
  --warn: #B7791F;
  --warn-ink: #996313;
  --warn-soft: #FAF3E4;

  /* Neutral slate scale */
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --faint: #6F7D91;            /* was #94A3B8: too faint on white (21 Nov) */
  --line: #E6EBF1;
  --line-2: #CFD8E3;
  --row-line: #EEF2F7;
  --app-bg: #F6F8FB;
  --chat-bg: #F7F9FC;
  --panel: #FFFFFF;

  /* Dark sidebar */
  --sidebar: #0F1623;
  --sidebar-2: #1A2234;
  --sidebar-panel: #222D43;
  --sidebar-line: #27324A;
  --sidebar-ink: #9AA7BD;
  --sidebar-faint: #647089;

  /* Bubbles — three clearly different, all soft:
     player = soft teal tint (left), agent = plain white (right), note = amber (right) */
  --bubble-in: #FFFFFF;
  --bubble-player: #E6F1EF;
  --bubble-player-line: #CDE5E0;
  --note-bg: #FAEBCC;
  --note-line: #E6CF93;
  --note-ink: #8A6316;

  /* Channels */
  --tg: #229ED9;
  --wa: #22C55E;

  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --bubble-radius: 18px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 12px 34px rgba(15, 23, 42, 0.16);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--app-bg);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; letter-spacing: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

h1, h2, h3 { letter-spacing: -0.018em; }

::selection { background: var(--accent-soft-2); }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 620px at 50% -20%, #1F2A44, #0F1623 62%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 384px; background: #fff; border-radius: 20px;
  padding: 40px 34px 34px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 32px 80px rgba(8, 14, 26, 0.5);
}
.login-logo { width: 52px; height: 52px; margin: 0 auto 18px; display: block; }
.login-card h1 { margin: 0; font-size: 23px; font-weight: 700; text-align: center; }
.login-card p { margin: 6px 0 22px; color: var(--muted); font-size: 14px; text-align: center; }
.login-card label { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.login-card input {
  border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px;
  font-size: 14.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error {
  background: var(--alert-soft); color: var(--alert-hover); border: 1px solid var(--alert-line);
  border-radius: 9px; padding: 10px 12px; font-size: 13px; margin-top: 10px;
}
.btn-primary {
  margin-top: 22px; border: none; background: var(--accent); color: #fff;
  border-radius: 10px; padding: 13px; font-size: 15px; font-weight: 600;
  transition: background .15s, transform .05s; box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }

/* ---------- App shell ---------- */
/* Fixed to the viewport so each column scrolls on its own and the composer
   stays pinned, instead of the whole page growing and scrolling. dvh keeps it
   right on mobile where the browser chrome changes the visible height. */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; position: relative; }

/* Sidebar */
.sidebar {
  width: 216px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; gap: 1px; padding: 15px 11px 12px;
  height: 100%; overflow-y: auto; transition: width .16s ease;
}
.brand { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 3px 9px 16px; }
.brand-logo { height: 26px; width: auto; align-self: flex-start; }
.brand-logo.mark { display: none; height: 28px; }
.brand-sub { color: var(--sidebar-faint); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding-left: 1px; }
.nav-collapse {
  position: absolute; top: 0; right: 2px; width: 26px; height: 26px; border: none;
  background: transparent; color: var(--sidebar-faint); border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s;
}
.nav-collapse svg { width: 17px; height: 17px; }
.nav-collapse:hover { background: var(--sidebar-2); color: #fff; }
.navtab {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 11px; border-radius: var(--radius-sm); text-decoration: none; color: var(--sidebar-ink);
  font-size: 13.5px; font-weight: 500; border: none; background: none; width: 100%; text-align: left;
  transition: background .12s, color .12s; position: relative;
}
.navtab:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.navtab.active { background: var(--sidebar-panel); color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.navtab .lhs { display: flex; align-items: center; gap: 11px; min-width: 0; }
.nic { width: 17px; height: 17px; flex-shrink: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; background: var(--sidebar-panel); color: #BCC8DC; flex-shrink: 0; }
.count.hot { background: var(--alert); color: #fff; }
.nav-sep { height: 1px; background: var(--sidebar-line); margin: 11px 9px; }
.nav-spacer { flex-grow: 1; min-height: 8px; }
.agent-card {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin-top: 4px;
  border-radius: var(--radius); background: var(--sidebar-2); border: 1px solid var(--sidebar-line);
}
.agent-card .av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex-shrink: 0; position: relative; }
.agent-card.on-shift .av { box-shadow: 0 0 0 2px var(--sidebar-2), 0 0 0 4px #4FB68C; }
.agent-card .name { color: #fff; font-weight: 600; font-size: 13px; }
.agent-card .status { font-size: 11px; font-weight: 500; }
.agent-card .status.on { color: #4FB68C; }
.agent-card .status.off { color: var(--sidebar-faint); }
.shift-btn { border: 1px solid var(--sidebar-line); background: transparent; color: #BCC8DC; border-radius: 7px; padding: 6px 11px; font-size: 12px; font-weight: 600; transition: background .12s, color .12s; flex-shrink: 0; }
.shift-btn:hover { background: var(--sidebar-panel); color: #fff; }

/* Collapsed rail — icons + badges only, label returns on hover via the native
   tooltip (title), which escapes the sidebar's scroll clip cleanly. */
.sidebar.collapsed { width: 64px; padding: 15px 8px 12px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .brand-logo.full,
.sidebar.collapsed .agent-card .ac-body,
.sidebar.collapsed .shift-btn { display: none; }
.sidebar.collapsed .brand-logo.mark { display: block; align-self: center; }
.sidebar.collapsed .brand { align-items: center; padding: 3px 0 14px; }
.sidebar.collapsed .nav-collapse { position: static; margin-top: 8px; }
.sidebar.collapsed .navtab { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .navtab .lhs { gap: 0; }
.sidebar.collapsed .nav-sep { margin: 10px 6px; }
.sidebar.collapsed .count {
  position: absolute; top: 2px; right: 6px; min-width: 15px; height: 15px; line-height: 13px;
  padding: 0 4px; font-size: 9.5px; border-radius: 999px; border: 1.5px solid var(--sidebar);
}
.sidebar.collapsed .agent-card { justify-content: center; padding: 8px; }

/* Conversation list */
.list {
  width: 372px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; height: 100%;
}
.list-head { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--line); }
.list-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-title-row h1 { margin: 0; font-size: 19px; font-weight: 700; }
.search { display: flex; align-items: center; gap: 9px; background: var(--row-line); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 12px; transition: border-color .15s, background .15s, box-shadow .15s; }
.search:focus-within { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: none; background: transparent; outline: none; font-size: 13.5px; width: 100%; color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip { border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 5px 13px; font-size: 12px; font-weight: 600; transition: all .12s; }
.chip:hover { border-color: var(--faint); background: #FAFBFD; }
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.rows { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.row { display: flex; align-items: center; gap: 11px; padding: 10px 14px 10px 13px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--row-line); background: var(--panel); border-left: 3px solid transparent; transition: background .1s; }
.row.edge-red { border-left-color: var(--alert); }
.row.edge-amber { border-left-color: var(--warn); }
.row:hover { background: #F8FAFD; text-decoration: none; }
.row.active { background: var(--accent-soft); border-left-color: var(--accent); }
.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #EEF2F8; color: var(--ink-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14.5px; }
.ch-dot { position: absolute; right: -4px; bottom: -4px; width: 21px; height: 21px; border-radius: 50%; border: 2.5px solid #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-xs); }
.row .avatar { width: 36px; height: 36px; font-size: 12.5px; }
.row-main { display: flex; flex-direction: column; gap: 3px; flex-grow: 1; min-width: 0; }
.row-bottom { display: flex; align-items: center; gap: 7px; min-width: 0; }
.row-bottom .row-preview { flex: 1; min-width: 0; }
.row-spacer { flex: 1; }
.row-src { font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; color: var(--faint); flex-shrink: 0; }
.row-snz { color: var(--faint); }
.row-more { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--row-line); border-radius: 5px; padding: 0 5px; flex-shrink: 0; }
.vip-ic { display: inline-flex; flex-shrink: 0; }
.vip-ic svg { width: 13px; height: 13px; }
.due-ic { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--alert); color: #fff; flex-shrink: 0; }
.due-ic svg { width: 10px; height: 10px; }
.row-wait { font-size: 12px; font-weight: 600; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.row-wait.w-calm { color: var(--muted); }
.row-wait.w-amber { color: var(--warn); font-weight: 700; }
.row-wait.w-red { color: var(--alert); font-weight: 700; }
.row-agent { width: 22px; height: 22px; border-radius: 50%; background: var(--row-line); color: var(--muted); font-size: 9.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.row-agent.me { background: var(--accent-soft-2); color: var(--accent-ink); }
.row-agent.none { background: transparent; border: 1.5px dashed var(--line-2); }
.row .badge { background: var(--accent); min-width: 20px; height: 20px; }
.rows.compact .row { padding-top: 6px; padding-bottom: 6px; }
.rows.compact .avatar-wrap { display: none; }
.rows.compact .row-main { gap: 1px; }
.rows.compact .row-name { font-size: 13.5px; }
.rows.compact .row-preview { font-size: 12.5px; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.row-time { font-size: 12px; font-weight: 500; flex-shrink: 0; color: var(--faint); }
.row-time.late { color: var(--alert); font-weight: 700; }
.rem-chip { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; font-size: 11px; font-weight: 700; color: #B45309; background: #FEF3C7; border-radius: 999px; padding: 1px 7px 1px 5px; }
.rem-chip.due { color: #fff; background: var(--alert); }
.rem-item { display: flex; align-items: flex-start; gap: 8px; background: #FFFBEB; border: 1px solid #FDE2A7; border-radius: var(--radius-sm); padding: 9px 11px; }
.rem-item.due { background: #FEF2F2; border-color: #FECACA; }
.rem-item svg { flex-shrink: 0; margin-top: 1px; }
.rem-body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.rem-when { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.rem-text { font-size: 12.5px; color: var(--muted); word-break: break-word; }
.rem-clear { border: none; background: none; color: var(--faint); font-size: 16px; line-height: 1; padding: 0 2px; cursor: pointer; }
.rem-clear:hover { color: var(--alert); }
.rating-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.rating-row:hover { border-color: var(--line-2); background: var(--row-line); }
.rating-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rating-name { font-weight: 650; font-size: 14px; color: var(--ink); }
.rating-sub { font-size: 12px; color: var(--muted); }
.rating-date { font-size: 12px; color: var(--faint); flex-shrink: 0; }
.act-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--row-line); font-size: 13.5px; }
.act-row:last-child { border-bottom: none; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--line-2); }
.act-dot.k-take, .act-dot.k-out { background: var(--accent); }
.act-dot.k-close, .act-dot.k-auto_close { background: #10B981; }
.act-dot.k-handover, .act-dot.k-edit_player { background: #0E7490; }
.act-dot.k-alert { background: var(--alert); }
.act-dot.k-rating { background: #E0A82E; }
.act-dot.k-note { background: #0EA5E9; }
.act-text { flex: 1; min-width: 0; color: var(--ink-2); }
.act-time { font-size: 12px; color: var(--faint); flex-shrink: 0; }
.desk-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--row-line); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px; font-size: 12.5px; color: var(--ink-2); }
.ds-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ds-dot.on { background: #10B981; }
.ds-dot.off { background: #F59E0B; }
.ds-main { font-weight: 700; color: var(--ink); }
.ds-sep { color: var(--faint); }
.collide { display: flex; align-items: center; gap: 7px; margin: 0 20px 6px; padding: 6px 11px; background: #FEF6E7; border: 1px solid #F6D58A; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #92610B; }
.collide-dot { width: 7px; height: 7px; border-radius: 50%; background: #E8A317; flex-shrink: 0; animation: collidePulse 1.4s ease-in-out infinite; }
@keyframes collidePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.mention { color: var(--accent); font-weight: 650; }
.mention.known { background: rgba(37, 99, 235, 0.12); border-radius: 5px; padding: 0 3px; }
.mention-pop { position: absolute; bottom: 100%; left: 14px; margin-bottom: 6px; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(15, 22, 35, 0.14); padding: 5px; display: flex; flex-direction: column; min-width: 150px; z-index: 20; }
.mention-pop button { text-align: left; border: none; background: none; padding: 7px 10px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.mention-pop button:hover { background: var(--row-line); color: var(--accent); }
.auto-toggles { display: flex; flex-direction: column; gap: 10px; }
.auto-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.auto-row input { margin-top: 3px; flex-shrink: 0; }
.auto-rowtext { display: flex; flex-direction: column; gap: 1px; }
.auto-title { font-weight: 650; font-size: 14px; color: var(--ink); }
.auto-sub { font-size: 12.5px; color: var(--muted); }
.auto-ta { width: 100%; border: 1px solid var(--line-2); border-radius: 9px; padding: 10px; font: inherit; font-size: 13.5px; line-height: 1.5; resize: vertical; color: var(--ink); }
.auto-ta:focus { outline: none; border-color: var(--accent); }
.state-pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 7px; }
.state-pill.st-pending { background: #FEF3C7; color: #92610B; }
.state-pill.st-hold { background: #E5E9F0; color: #475569; }
.state-pill.st-waiting { background: var(--accent2-soft); color: var(--accent2); }
.state-pill.st-solved { background: #DCFCE7; color: #15803D; }
.row-star { color: #E0A82E; font-size: 13px; flex-shrink: 0; }
.prio-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prio-dot.pr-urgent { background: #DC2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
.prio-dot.pr-high { background: #F59E0B; }
.prio-dot.pr-low { background: #CBD5E1; }
.star-btn { border: none; background: none; color: #E0A82E; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; flex-shrink: 0; }
.star-btn:not(.on) { color: var(--line-2); }
.follow-btn { border: none; background: none; color: var(--faint); cursor: pointer; padding: 2px; display: inline-flex; align-items: center; flex-shrink: 0; }
.follow-btn.on { color: var(--accent); }
.follow-btn:hover { color: var(--accent); }
/* Agent status: a dot on the avatar + a clickable status line in the card. */
.agent-card .av { position: relative; }
.status-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--sidebar-2); }
.agent-card .ac-body { border: none; background: none; text-align: left; cursor: pointer; padding: 0; min-width: 0; }
.agent-card .ac-body:hover .status { color: #fff; }
.pop-menu .st-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.status-tag { font-size: 11.5px; font-weight: 600; margin-left: 4px; }
/* Snippets picker */
.snip-row { display: flex; align-items: stretch; gap: 6px; }
.snip-ins { flex: 1; display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer; }
.snip-ins:hover { border-color: var(--accent); background: var(--accent-soft); }
.snip-title { font-weight: 650; font-size: 13.5px; color: var(--ink); }
.snip-prev { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-mini { border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; width: 34px; cursor: pointer; color: var(--muted); font-size: 13px; }
.icon-mini:hover { color: var(--ink); border-color: var(--faint); }
.snip-add { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
/* Blocklist */
.dnc-add { display: flex; gap: 8px; align-items: center; }
.dnc-add .auto-ta { margin: 0; }
.dnc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; }
.dnc-val { font-weight: 650; font-size: 13.5px; }
.dnc-kind { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-left: 4px; }
.dnc-reason { font-size: 11px; font-weight: 700; color: var(--alert); background: var(--alert-soft); border-radius: 999px; padding: 1px 7px; }
.tf-secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; font-weight: 700; letter-spacing: 2px; background: var(--row-line); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; word-break: break-all; }
/* Backlog + wallboard */
.back-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.wall-tile { background: var(--chat-bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; text-align: center; }
.wall-tile.warn { border-color: rgba(217,119,6,0.5); background: var(--warn-soft); }
.wall-tile.hot { border-color: var(--alert-line); background: var(--alert-soft); }
.wall-n { font-size: 34px; font-weight: 800; color: var(--ink); line-height: 1; }
.wall-l { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.wall-status { margin-top: 14px; font-size: 14px; font-weight: 600; }
.wall-team { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wall-agent { display: flex; align-items: center; gap: 7px; background: var(--chat-bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.wall-agent .wall-load { background: var(--accent); color: #fff; border-radius: 999px; min-width: 20px; text-align: center; font-size: 11.5px; padding: 1px 6px; }
/* Charts */
.chart { width: 100%; height: auto; margin-top: 6px; }
.ch-base { stroke: var(--line-2); stroke-width: 1; }
.ch-ax { fill: var(--faint); font-size: 10px; }
.ch-key { float: right; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; text-transform: none; }
.ch-sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: middle; margin-right: 3px; }
.hbars { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.hbar-row { display: flex; align-items: center; gap: 10px; }
.hbar-lbl { width: 92px; font-size: 12.5px; color: var(--ink-2); flex-shrink: 0; }
.hbar-track { flex: 1; background: var(--row-line); border-radius: 999px; height: 14px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; min-width: 2px; }
.hbar-val { width: 28px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--ink); }
/* Command palette */
.pal-input { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 15px; outline: none; background: var(--panel); color: var(--ink); }
.pal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pal-list { margin-top: 10px; max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.pal-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: none; background: none; border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.pal-item:hover, .pal-item.on { background: var(--accent-soft); color: var(--accent-ink); }
.pal-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.hdr-sel { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 12.5px; font-weight: 600; background: #fff; color: var(--ink-2); cursor: pointer; }
.hdr-sel:focus { outline: none; border-color: var(--accent); }
.state-sel.s-pending { border-color: #F6D58A; color: #92610B; background: #FFFBEB; }
.state-sel.s-on_hold { color: #475569; }
.state-sel.s-waiting { border-color: #CBD8EA; color: var(--accent2); background: var(--accent2-soft); }
.state-sel.s-solved { border-color: #BBF7D0; color: #15803D; background: #F0FDF4; }
.prio-sel.p-urgent { border-color: #FCA5A5; color: #B91C1C; background: #FEF2F2; }
.prio-sel.p-high { border-color: #FCD34D; color: #B45309; background: #FFFBEB; }
.pop-menu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,22,35,0.16); padding: 5px; min-width: 190px; display: flex; flex-direction: column; }
.pop-menu button { text-align: left; border: none; background: none; padding: 9px 11px; border-radius: 7px; font: inherit; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.pop-menu button:hover { background: var(--row-line); }
.pop-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.filter-menu .fl-check { display: inline-block; width: 16px; color: var(--accent); font-weight: 800; }
.filter-menu .fl-clear { color: var(--alert); font-weight: 600; }
.filter-btn { color: var(--ink-2); }
.snooze-bar { display: flex; align-items: center; gap: 8px; padding: 9px 22px; background: #F1F5F9; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); font-weight: 500; }
.linklike { border: none; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.mini-flag { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.mini-flag.snz { background: #E2E8F0; color: #475569; }
.mini-flag.spam { background: #FEE2E2; color: #B91C1C; }
.chip.chip-spam.active { background: var(--alert); color: #fff; border-color: var(--alert); }
.linked-chat { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 11px; cursor: pointer; }
.linked-chat:hover { border-color: var(--line-2); background: var(--row-line); }
.linked-ch { font-size: 11px; font-weight: 700; color: var(--muted); }
.linked-prev { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-toggle { border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.select-toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.row-check { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-right: 2px; color: #fff; font-size: 13px; font-weight: 800; }
.row-check.on { background: var(--accent); border-color: var(--accent); }
.row.row-selected { background: var(--accent-soft); }
.bulk-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 10px 14px; background: var(--sidebar); border-top: 1px solid var(--sidebar-line); }
.bulk-count { color: #fff; font-size: 12.5px; font-weight: 700; margin-right: 4px; }
.bulk-act { border: 1px solid var(--sidebar-line); background: var(--sidebar-2); color: #E6ECF6; border-radius: 7px; padding: 6px 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.bulk-act:hover { background: var(--sidebar-panel); color: #fff; }
.bulk-sel { border: 1px solid var(--sidebar-line); background: var(--sidebar-2); color: #E6ECF6; border-radius: 7px; padding: 6px 8px; font: inherit; font-size: 12.5px; font-weight: 600; }
.fmt-group { display: inline-flex; gap: 2px; margin-left: 4px; }
.fmt-btn { width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.fmt-btn:hover { background: var(--row-line); border-color: var(--line-2); }
.bubble a { color: inherit; text-decoration: underline; }
.macro-row { display: flex; align-items: center; gap: 6px; }
.macro-run { flex: 1; display: flex; flex-direction: column; gap: 2px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; }
.macro-run:hover { border-color: var(--accent); background: var(--accent-soft); }
.macro-name { font-weight: 650; font-size: 14px; color: var(--ink); }
.macro-steps { font-size: 12px; color: var(--muted); }
.undo-toast { display: flex; align-items: center; gap: 12px; }
.undo-btn { border: none; background: none; color: #7FD7CC; font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.bubble.out.recalled { opacity: 0.7; text-decoration: line-through; text-decoration-color: var(--faint); }
.bubble.out.recalled .meta { text-decoration: none; font-style: italic; }
.sched-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 11px; }
.sched-when { font-size: 12px; font-weight: 700; color: var(--accent); }
.sched-body { font-size: 12.5px; color: var(--ink-2); }
.chat-search { display: flex; align-items: center; gap: 8px; padding: 8px 20px; background: #F8FAFC; border-bottom: 1px solid var(--line); }
.chat-search input { flex: 1; border: none; background: none; outline: none; font: inherit; font-size: 13.5px; color: var(--ink); }
.chat-search-count { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.bubble mark { background: #FDE68A; color: inherit; border-radius: 3px; padding: 0 1px; }
.bubble.out mark { background: var(--accent-ink); color: #fff; }
.link-card { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; background: rgba(0,0,0,0.04); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--ink-2); max-width: 100%; }
.bubble.out .link-card { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); color: #fff; }
.link-host { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perf-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; background: var(--row-line); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.perf-settings label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.perf-settings input[type="number"] { width: 90px; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; font: inherit; }
.perf-check { flex-direction: row !important; align-items: center; gap: 8px !important; max-width: 280px; }
.perf-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.perf-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--faint); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.perf-table td { padding: 8px; border-bottom: 1px solid var(--row-line); color: var(--ink-2); }
.perf-table td.over-cap { color: var(--alert); font-weight: 700; }
.suggest-box { background: var(--accent-soft); border: 1px solid #C9E0DB; border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.suggest-h { font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--accent); }
.suggest-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.suggest-lbl { font-size: 12px; color: var(--muted); min-width: 64px; }
.suggest-chip { border: 1px solid #BFDCD6; background: #fff; color: var(--accent); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.suggest-chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.internal { display: flex; gap: 0; height: 62vh; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.int-side { width: 210px; flex-shrink: 0; background: var(--row-line); border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; }
.int-side-h { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); padding: 6px 8px; }
.int-chan { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: none; background: none; padding: 7px 8px; border-radius: 8px; cursor: pointer; font: inherit; }
.int-chan:hover { background: #fff; }
.int-chan.active { background: #fff; box-shadow: 0 1px 2px rgba(15,22,35,0.08); }
.int-ch-ic { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; background: var(--accent); color: #fff; }
.int-ch-ic.general { background: #334155; }
.int-ch-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.int-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.int-head-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.int-head-sub { font-size: 12px; color: var(--muted); }
.int-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.int-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 80%; }
.int-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.int-av { width: 26px; height: 26px; border-radius: 50%; background: var(--sidebar); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.int-bubble { background: var(--row-line); border-radius: 12px; padding: 7px 11px; display: flex; flex-direction: column; gap: 1px; }
.int-msg.me .int-bubble { background: var(--accent); color: #fff; }
.int-from { font-size: 11.5px; font-weight: 700; color: var(--accent); }
.int-text { font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.int-time { font-size: 10.5px; color: var(--faint); align-self: flex-end; margin-top: 2px; }
.int-msg.me .int-time { color: rgba(255,255,255,0.75); }
.int-msg.me .mention { color: #fff; text-decoration: underline; }
.int-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.int-msg.me .int-col { align-items: flex-end; }
.int-bubble { position: relative; }
.int-quote { border-left: 3px solid var(--accent); padding: 2px 8px; margin-bottom: 3px; font-size: 12px; opacity: 0.85; border-radius: 3px; background: rgba(37,99,235,0.08); }
.int-msg.me .int-quote { border-left-color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.14); }
.int-quote-from { font-weight: 700; margin-right: 5px; }
.int-tools { position: absolute; top: -12px; right: 6px; display: none; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; box-shadow: var(--shadow-sm); }
.int-msg:hover .int-tools { display: flex; }
.int-tool { border: none; background: none; cursor: pointer; font-size: 13px; padding: 2px 5px; border-radius: 6px; line-height: 1; }
.int-tool:hover { background: var(--row-line); }
.rx-row { display: flex; flex-wrap: wrap; gap: 4px; }
.rx { border: 1px solid var(--line-2); background: var(--panel); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.rx.mine { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.emoji-pop { flex-direction: row !important; gap: 2px; }
.emoji-opt { font-size: 18px; padding: 4px 6px !important; }
.int-replybar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 16px; background: var(--row-line); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.int-replybar .rb-x { border: none; background: none; cursor: pointer; color: var(--faint); font-size: 14px; }
.side-main { height: 56vh; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
/* The chat column splits: the player chat on top, the docked side chat below. */
.chat-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.side-dock { flex: 0 0 44%; min-height: 150px; display: flex; flex-direction: column; min-width: 0;
  border-top: 3px solid var(--warn); background: var(--warn-soft); }
.side-dock-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 18px; border-bottom: 1px solid var(--note-line); }
.side-dock-title { font-size: 13px; font-weight: 700; color: var(--note-ink); }
.side-dock-note { font-weight: 500; color: var(--muted); font-size: 11.5px; margin-left: 8px; }
.side-dock-x { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 15px; padding: 2px 6px; border-radius: 6px; }
.side-dock-x:hover { background: rgba(0,0,0,0.06); color: var(--ink); }
.side-dock .int-msgs { flex: 1; overflow-y: auto; padding: 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.side-dock .int-composer { padding: 10px 16px; border-top: 1px solid var(--note-line); }
.side-dock .int-composer textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13.5px; max-height: 90px; background: var(--panel); color: var(--ink); }
.side-dock .int-composer textarea:focus { outline: none; border-color: var(--accent); }
.int-composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.int-composer textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13.5px; max-height: 100px; }
.int-composer textarea:focus { outline: none; border-color: var(--accent); }
.row-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; letter-spacing: 0.01em; }
.brand-pill { font-size: 11px; font-weight: 700; color: var(--ink-2); background: var(--row-line); border-radius: 6px; padding: 2px 7px; }
.meta-muted { font-size: 11.5px; color: var(--muted); }
.unassigned { font-size: 11px; font-weight: 700; color: var(--alert); }
.badge { min-width: 19px; height: 19px; border-radius: 999px; background: var(--alert); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.empty { padding: 52px 24px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* Chat */
.chat { flex: 1 1 auto; min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; background: var(--chat-bg); }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.chat-head { display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.ch-title { display: flex; align-items: center; gap: 9px; }
.ch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-head .avatar { width: 42px; height: 42px; }
.chat-head .who { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 170px; }
.chat-head .who-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-head .who-name { font-weight: 700; font-size: 16px; }
.chat-head .who-sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.btn { border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: var(--radius-sm); padding: 8px 13px; font-size: 13px; font-weight: 600; transition: background .12s, border-color .12s; }
.btn:hover { background: #F6F8FB; border-color: var(--faint); }
.btn-dark { border: none; background: var(--accent); color: #fff; }
.btn-dark:hover { background: var(--accent-hover); border-color: transparent; }
/* Secondary-strong button: teal outline, so Send stays the only filled teal. */
.btn-outline { border: 1px solid var(--accent); background: transparent; color: var(--accent-ink); font-weight: 600; }
.btn-outline:hover { background: var(--accent-soft); border-color: var(--accent); }
.waiting { display: flex; align-items: center; gap: 9px; padding: 10px 22px; background: #F8FAFC; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.messages { flex-grow: 1; display: flex; flex-direction: column; gap: 12px; padding: 26px 24px; overflow-y: auto; min-height: 0; }
.daysep, .sysnote { align-self: center; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.daysep { background: #E8EDF3; border-radius: 999px; padding: 4px 13px; }
.bubble { max-width: 66%; padding: 10px 15px; line-height: 1.5; border-radius: var(--bubble-radius); font-size: 14px; white-space: pre-wrap; word-wrap: break-word; box-shadow: var(--shadow-xs); }
.bubble .meta { font-size: 11px; margin-top: 5px; color: var(--muted); font-weight: 500; }
/* Player messages are the highlighted (blue) bubble, agent replies are plain
   white, so the eye lands on what the player said. */
.bubble.in { align-self: flex-start; background: var(--bubble-player); border: 1px solid var(--bubble-player-line); color: var(--ink); border-radius: var(--bubble-radius) var(--bubble-radius) var(--bubble-radius) 5px; }
.bubble.in .meta { color: var(--muted); }
.bubble.in a { color: var(--accent-ink); text-decoration: underline; }
.bubble.in .attach-file { background: rgba(15,118,110,0.10); color: var(--ink); }
.bubble.out { align-self: flex-end; background: #fff; border: 1px solid var(--line-2); color: var(--ink); border-radius: var(--bubble-radius) var(--bubble-radius) 5px var(--bubble-radius); }
.bubble.out .meta { color: var(--muted); }
.bubble.out a { color: var(--accent); text-decoration: underline; }
/* Note stands apart from the white agent reply by its amber tint, not a bar. */
.bubble.note { align-self: flex-end; background: var(--note-bg); border: 1px solid var(--note-line); color: var(--ink); border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-xs); }
.bubble.note .meta { color: var(--note-ink); }

/* Quick reply preview card */
.preview {
  align-self: flex-end; width: 100%; max-width: 540px; background: #fff;
  border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 11px;
}
.preview-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preview-top .k { font-size: 12px; font-weight: 700; color: var(--accent-ink); }
.preview-text { margin: 0; font-size: 13.5px; line-height: 1.55; }
.preview-en { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); font-style: italic; }
.preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-send { border: none; background: var(--accent); color: #fff; border-radius: var(--radius-sm); padding: 9px 18px; font-size: 13px; font-weight: 600; transition: background .12s; }
.btn-send:hover { background: var(--accent-hover); }
.btn-ghost { border: none; background: transparent; color: var(--muted); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; font-weight: 600; }
.btn-ghost:hover { color: var(--ink); background: var(--row-line); }

/* Composer */
.composer { position: relative; padding: 14px 24px 20px; background: #fff; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 11px; }
.quickbar { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.suggest-bar { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.suggest-lede { font-size: 12px; font-weight: 600; color: var(--muted); }
.suggest-pill { height: 28px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 0 13px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.suggest-pill:hover { background: var(--accent-soft-2); }
.mode-btn { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 7px; padding: 6px 13px; font-size: 12px; font-weight: 600; transition: all .12s; }
.mode-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.qr-btn { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 7px; padding: 6px 12px; font-size: 12px; font-weight: 600; transition: background .12s; }
.qr-btn:hover { background: #F6F8FB; border-color: var(--line-2); }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer-input { flex-grow: 1; display: flex; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 11px 14px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.composer-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-input textarea { border: none; outline: none; resize: none; font-size: 14px; line-height: 1.5; width: 100%; color: var(--ink); max-height: 120px; background: transparent; }
.composer-input .ce { outline: none; font-size: 14px; line-height: 1.5; width: 100%; color: var(--ink); min-height: 21px; max-height: 120px; overflow-y: auto; word-break: break-word; white-space: pre-wrap; }
.composer-input .ce:empty:before { content: attr(data-ph); color: var(--faint); pointer-events: none; }
.composer-input .ce b, .composer-input .ce strong { font-weight: 700; }
.composer-input .ce i, .composer-input .ce em { font-style: italic; }
.composer-input .ce a { color: var(--accent); text-decoration: underline; }
.icon-btn { width: 46px; height: 46px; flex-shrink: 0; border: 1px solid var(--line-2); background: #fff; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; transition: background .12s, border-color .12s; }
.icon-btn:hover { background: #F6F8FB; border-color: var(--faint); }
.icon-btn.send { border: none; background: var(--accent); box-shadow: var(--shadow-sm); }
.icon-btn.send:hover { background: var(--accent-hover); }

/* Player card */
.card { width: 286px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--line); padding: 18px 18px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
/* Collapsible player card (like the left menu): hides to the right, with a thin
   reopen tab on the edge. */
.app.card-collapsed .card { display: none; }
.card-reopen { display: none; }
.app.card-collapsed .card-reopen {
  display: flex; align-items: center; justify-content: center;
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 22px; height: 60px; border: 1px solid var(--line); border-right: none;
  background: var(--panel); color: var(--muted); border-radius: 9px 0 0 9px;
  cursor: pointer; font-size: 15px; box-shadow: var(--shadow-sm); z-index: 20;
}
.app.card-collapsed .card-reopen:hover { color: var(--accent); }
.card-collapse-btn { color: var(--muted); }
.card-top { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.card-top .av { width: 54px; height: 54px; border-radius: 50%; background: #EEF2F8; color: var(--ink-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; }
.card-top .nm { font-weight: 700; font-size: 15.5px; }
.section-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--faint); text-transform: uppercase; margin-bottom: 6px; }
.kv { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; padding: 2px 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }
.note-item { background: #fff; border: 1px solid #E6CB8A; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; color: var(--ink-2); line-height: 1.5; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.note-item .note-body { flex: 1; min-width: 0; }
.note-item .note-meta { display: block; font-size: 11px; color: #9A6A12; font-weight: 700; margin-bottom: 2px; }
.note-del { border: none; background: none; color: var(--faint); font-size: 17px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
.note-del:hover { color: var(--alert); }
.add-note { border: 1px dashed var(--line-2); background: #fff; color: var(--ink-2); border-radius: var(--radius-sm); padding: 10px; font-size: 13px; font-weight: 600; transition: border-color .12s, background .12s; }
.add-note:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.card-actions { display: flex; gap: 9px; }
.card-actions .btn { flex: 1; text-align: center; }
.btn-danger { border: 1px solid var(--alert-line); background: #fff; color: var(--alert-hover); }
.btn-danger:hover { background: var(--alert-soft); border-color: var(--alert); }
.tag-select { border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--ink); background: #fff; }

/* Username in brackets after a name */
.uname { color: var(--muted); font-weight: 500; }

/* Unread rows stand out so a new player message is easy to spot */
.row.unread .row-name { font-weight: 700; }
.row.unread .row-preview { color: var(--ink-2); font-weight: 500; }
.row.unread:not(.active) { background: #F1F7F5; }
.row.unread:not(.active):hover { background: #E8F2EF; }

/* Inline click-to-edit on the player card */
.editable { cursor: text; border-radius: 6px; padding: 1px 6px; margin: -1px -6px; transition: background .12s; }
.editable:hover { background: var(--row-line); }
.editable:focus { outline: none; background: var(--row-line); }
.editable.empty { color: var(--faint); font-weight: 500; }
.card-top .nm.editable { padding: 2px 8px; }
.edit-input { border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 13.5px; font-weight: 600; text-align: right; max-width: 170px; margin-left: auto; outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.card-top .edit-input { text-align: center; margin: 0; }

/* Free-text tags (labels) on the player card */
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.label-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--row-line); color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 12px; font-weight: 600; }
.label-chip .chip-x { border: none; background: none; color: var(--faint); font-size: 15px; line-height: 1; padding: 0 2px; }
.label-chip .chip-x:hover { color: var(--alert); }
.chip-add { border: 1px dashed var(--line-2); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 600; }
.chip-add:hover { border-color: var(--accent); color: var(--accent-ink); }
.tag-add-input { border: 1px solid var(--accent); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12px; font-weight: 600; width: 118px; outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* Levels editor colour swatch */
.level-row { display: flex; align-items: center; gap: 8px; }
.level-color { width: 40px; height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: #fff; flex-shrink: 0; }

/* The Player card button only matters when the panel is hidden (narrow screens) */
.card-toggle { display: none; }

/* Back button + hamburger (mobile) */
.back-btn { display: none; width: 42px; height: 42px; border: none; background: transparent; align-items: center; justify-content: center; }
.hamburger { display: none; width: 40px; height: 40px; border: none; background: transparent; font-size: 20px; border-radius: var(--radius-sm); align-items: center; justify-content: center; color: var(--ink); }
.hamburger:hover { background: var(--row-line); }
.drawer-backdrop { display: none; }

/* Attachments in chat */
.attach-img { max-width: 230px; max-height: 230px; border-radius: 10px; display: block; margin-bottom: 5px; }
.attach-file { display: inline-flex; align-items: center; gap: 7px; background: rgba(15,23,42,0.05); border-radius: var(--radius-sm); padding: 7px 11px; margin-bottom: 5px; text-decoration: none; color: inherit; font-size: 13px; font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-pop); z-index: 60; }

kbd { font-family: var(--font); }

/* ---------- Unified toolbar controls ----------
   One height, font, radius and gap for the pills, selects and buttons across the
   list filters, the chat header and the composer toolbar, so the three rows read
   as one organised set instead of a jumble of sizes. */
.chat-head { gap: 8px; }
.filters { gap: 8px; }
.quickbar { gap: 8px; }
.btn, .hdr-sel, .qr-btn, .mode-btn, .chip, .tag-select, .select-toggle {
  height: 32px; font-size: 13px; font-weight: 600; line-height: 1;
}
.btn, .qr-btn, .mode-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 13px; border-radius: 8px;
}
.chip { display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; }
.hdr-sel, .tag-select { padding: 0 10px; border-radius: 8px; }
.select-toggle { display: inline-flex; align-items: center; padding: 0 14px; border-radius: 8px; }
.fmt-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.fmt-group { gap: 4px; }
/* Square icon buttons in the chat header (search, mask, more). */
.btn.btn-ic { width: 32px; padding: 0; font-size: 15px; }
.star-btn, .follow-btn { height: 32px; display: inline-flex; align-items: center; justify-content: center; }
/* A faint divider between button groups in the composer toolbar. */
.qb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; flex-shrink: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .card { display: none; }
  .card-toggle { display: inline-flex; }
  .app.show-card .card { display: flex; position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; box-shadow: -14px 0 44px rgba(15,23,42,0.18); }
}
@media (max-width: 860px) {
  /* On the mobile drawer the rail is always full width with labels, even if the
     agent left it collapsed on desktop. */
  .sidebar, .sidebar.collapsed {
    position: fixed; left: 0; top: 0; bottom: 0; width: 268px; z-index: 46; padding: 15px 11px 12px;
    transform: translateX(-100%); transition: transform .22s ease; display: flex;
  }
  .sidebar.collapsed .nav-label, .sidebar.collapsed .brand-sub,
  .sidebar.collapsed .brand-logo.full, .sidebar.collapsed .agent-card .ac-body,
  .sidebar.collapsed .shift-btn { display: block; }
  .sidebar.collapsed .brand-logo.mark { display: none; }
  .sidebar.collapsed .navtab { justify-content: space-between; padding: 7px 11px; }
  .sidebar.collapsed .count { position: static; border: none; height: auto; min-width: 20px; padding: 1px 7px; font-size: 11px; line-height: normal; }
  .sidebar.collapsed .nav-collapse { display: none; }
  .app.drawer .sidebar { transform: translateX(0); box-shadow: 0 0 56px rgba(8,14,26,0.55); }
  .app.drawer .drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(8,14,26,0.5); z-index: 45; }
  .list { width: 100%; }
  .app .chat { display: none; }
  .app.view-chat .list { display: none; }
  .app.view-chat .chat { display: flex; }
  .back-btn { display: flex; }
  .hamburger { display: flex; }
  .chat-head { padding-top: 16px; }
}

/* ---------- Dark mode ----------
   The whole app is driven by the palette tokens, so dark mode mostly redefines
   those tokens; the rest are targeted overrides for the surfaces that were hard
   -coded white. The dark sidebar already fit, so it stays. */
:root[data-theme="dark"] {
  --accent: #2FA99B; --accent-hover: #3FBFB0; --accent-ink: #7FD6CB;
  --accent-soft: rgba(47,169,155,0.16); --accent-soft-2: rgba(47,169,155,0.28);
  --accent2: #7D9BCB; --accent2-soft: rgba(125,155,203,0.16);

  --alert: #E06A64; --alert-hover: #EB817B; --alert-soft: rgba(224,106,100,0.16); --alert-line: rgba(224,106,100,0.45);
  --good: #44B07E; --good-ink: #5FD69E; --good-soft: rgba(68,176,126,0.16);
  --warn: #D9A33E; --warn-ink: #EDC173; --warn-soft: rgba(217,163,62,0.15);

  --ink: #E9EEF6; --ink-2: #C2CDDD; --muted: #93A0B5; --faint: #8190A6;
  --line: #273348; --line-2: #35455E; --row-line: #1A2334;
  --app-bg: #0A0F1A; --chat-bg: #0D1420; --panel: #141D2C; --panel-2: #1C2838;

  --bubble-in: #141D2C;
  --bubble-player: rgba(47,169,155,0.15); --bubble-player-line: rgba(47,169,155,0.32);
  --note-bg: #2A2512; --note-line: #4A3F18; --note-ink: #E7C878;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.45);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-pop: 0 14px 40px rgba(0,0,0,0.6);
}

/* Surfaces that were hard-coded white → the dark panel colour. */
:root[data-theme="dark"] .login-card,
:root[data-theme="dark"] .chip,
:root[data-theme="dark"] .row,
:root[data-theme="dark"] .rating-row,
:root[data-theme="dark"] .pop-menu,
:root[data-theme="dark"] .mention-pop,
:root[data-theme="dark"] .linked-chat,
:root[data-theme="dark"] .select-toggle,
:root[data-theme="dark"] .hdr-sel,
:root[data-theme="dark"] .fmt-btn,
:root[data-theme="dark"] .macro-run,
:root[data-theme="dark"] .sched-row,
:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .chat-head,
:root[data-theme="dark"] .composer,
:root[data-theme="dark"] .mode-btn,
:root[data-theme="dark"] .qr-btn,
:root[data-theme="dark"] .composer-input,
:root[data-theme="dark"] .icon-btn,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .add-note,
:root[data-theme="dark"] .btn-danger,
:root[data-theme="dark"] .tag-select,
:root[data-theme="dark"] .bubble.out,
:root[data-theme="dark"] .preview,
:root[data-theme="dark"] .auto-ta,
:root[data-theme="dark"] .suggest-chip,
:root[data-theme="dark"] .int-main { background: var(--panel); }

/* Hover / selected states. */
:root[data-theme="dark"] .row:hover,
:root[data-theme="dark"] .chip:hover,
:root[data-theme="dark"] .qr-btn:hover,
:root[data-theme="dark"] .icon-btn:hover,
:root[data-theme="dark"] .btn:hover,
:root[data-theme="dark"] .macro-run:hover,
:root[data-theme="dark"] .int-chan:hover,
:root[data-theme="dark"] .int-chan.active { background: var(--panel-2); }
:root[data-theme="dark"] .row.unread:not(.active) { background: #15233B; }
:root[data-theme="dark"] .row.unread:not(.active):hover { background: #1A2A46; }
:root[data-theme="dark"] .row.row-selected { background: var(--accent-soft); }
:root[data-theme="dark"] .search:focus-within { background: var(--panel); }

/* Native form controls that would otherwise render white. Status selects keep
   their own (more specific) colour rules. */
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select { background: var(--panel); color: var(--ink); }

/* Notes (amber) and bubbles. */
:root[data-theme="dark"] .bubble.note { background: var(--note-bg); border-color: var(--note-line); color: var(--ink); }
:root[data-theme="dark"] .note-item { background: var(--note-bg); border-color: var(--note-line); color: var(--ink-2); }
:root[data-theme="dark"] .note-item .note-meta { color: var(--note-ink); }

/* Soft status blocks. */
:root[data-theme="dark"] .chat-search,
:root[data-theme="dark"] .waiting { background: var(--panel-2); }
:root[data-theme="dark"] .snooze-bar { background: #20283A; color: var(--ink-2); }
:root[data-theme="dark"] .daysep { background: #223047; color: var(--ink-2); }
:root[data-theme="dark"] .suggest-box { background: var(--accent-soft); border-color: rgba(59,130,246,0.3); }
:root[data-theme="dark"] .collide { background: var(--warn-soft); border-color: rgba(245,158,11,0.4); color: var(--warn-ink); }
:root[data-theme="dark"] .rem-item { background: var(--warn-soft); border-color: rgba(245,158,11,0.35); }
:root[data-theme="dark"] .rem-item.due { background: var(--alert-soft); border-color: var(--alert-line); }
:root[data-theme="dark"] .rem-when { color: var(--ink); }
:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .card-top .av { background: #22304A; color: var(--ink-2); }

/* Icon strokes that were dark, so they stay visible on dark surfaces. The send
   button keeps its white icon on blue. */
:root[data-theme="dark"] .icon-btn:not(.send) svg { stroke: var(--ink-2); }
:root[data-theme="dark"] .search svg { stroke: var(--muted); }
:root[data-theme="dark"] .back-btn svg,
:root[data-theme="dark"] .hamburger svg { stroke: var(--ink); }

/* ---------- AI (on-demand drafting) ---------- */
.qr-btn.ai-btn { color: var(--accent-ink); border-color: var(--accent-soft-2); background: var(--accent-soft); }
.qr-btn.ai-btn:hover { border-color: var(--accent); }
.preview.ai-preview { border-color: var(--accent-soft-2); }
.preview .ai-wait { font-style: italic; }
.pop-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 7px 11px 4px; }
.tick-sp { display: inline-block; width: 1.05em; }
.tr-btn { display: block; margin-top: 6px; border: none; background: none; padding: 0; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--accent-ink); cursor: pointer; opacity: .8; }
.tr-btn:hover { opacity: 1; text-decoration: underline; }
.tr-btn:disabled { cursor: default; text-decoration: none; opacity: .6; }
.tr-en { margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--line-2); font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.tr-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; margin-right: 6px; vertical-align: 1px; }
.ai-summary { font-size: 13.5px; line-height: 1.65; background: var(--app-bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
:root[data-theme="dark"] .qr-btn.ai-btn { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--line-2); }
.ai-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.suggest-pill.ai-pill { border-style: dashed; background: transparent; }
.suggest-pill.ai-pill:hover { background: var(--accent-soft); }
.enh-btn { flex-shrink: 0; height: 46px; align-self: flex-end; border: 1px solid var(--accent-soft-2); background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.enh-btn:hover { border-color: var(--accent); }

/* ---------- 18 Nov: risk flags, follow-ups, custom fields, merge ---------- */
.risk-bar { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--alert-line); background: var(--alert-soft); color: var(--alert-hover); }
.risk-bar.amber { background: var(--warn-soft); color: var(--warn-ink); border-bottom-color: rgba(183,121,31,0.25); }
.risk-bar .risk-hint { color: inherit; opacity: 0.85; font-size: 12.5px; }
.row-risk { font-size: 12px; line-height: 1; flex-shrink: 0; }
.row-risk.red { color: var(--alert); }
.row-risk.amber { color: var(--warn); }
.flag-box { display: flex; flex-direction: column; gap: 6px; }
.flag-item { display: flex; gap: 8px; align-items: flex-start; border-radius: var(--radius-sm); padding: 9px 11px; background: var(--alert-soft); border: 1px solid var(--alert-line); color: var(--alert-hover); }
.flag-item.amber { background: var(--warn-soft); border-color: rgba(183,121,31,0.3); color: var(--warn-ink); }
.flag-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: 12.5px; }
.flag-main strong { font-size: 13px; }
.flag-note { color: var(--ink-2); font-style: italic; }
.flag-meta { font-size: 11px; opacity: 0.8; }
.flag-opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.flag-opt.red strong { color: var(--alert-hover); }
.flag-opt.amber strong { color: var(--warn-ink); }
.flag-opt input { margin-top: 3px; }
.rem-item .rem-text { color: var(--ink); font-weight: 600; }
.rem-item .rem-when { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.fu-tick { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--panel); cursor: pointer; padding: 0; }
.fu-tick:hover, .fu-tick.on { border-color: var(--accent); background: var(--accent-soft-2); }
.field-in { width: 58%; max-width: 170px; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 13px; text-align: right; background: transparent; color: var(--ink); }
.field-in:hover, .field-in:focus { border-color: var(--line-2); background: var(--panel); outline: none; }
.field-in::placeholder { color: var(--faint); }
.field-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field-row .fe-label { flex: 1; min-width: 140px; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; font: inherit; }
.field-row .fe-kind, .field-row .fe-opts { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; font: inherit; background: var(--panel); color: var(--ink); }
.field-row .fe-opts { flex-basis: 100%; }
.dupe-box { background: var(--warn-soft); border: 1px solid rgba(183,121,31,0.3); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.dupe-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.mp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; }
.bubble.note.whisper { background: var(--accent2-soft); border-color: rgba(76,111,168,0.35); }
.draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 12px; margin-bottom: 8px; font-size: 12.5px; border-radius: var(--radius-sm); background: var(--accent2-soft); border: 1px solid rgba(76,111,168,0.3); color: var(--ink-2); }
.draft-bar .draft-text { flex-basis: 100%; color: var(--muted); }
.draft-bar .draft-act { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.grp-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.grp-agents { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.grp-agent { display: inline-flex; gap: 5px; align-items: center; }
.link-card.rich { display: flex; align-items: flex-start; max-width: 340px; padding: 8px 10px; font-weight: 500; }
.link-card .link-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.link-card .link-title { font-weight: 700; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-card .link-desc { font-size: 11.5px; opacity: 0.8; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-card.rich .link-host { font-size: 11px; opacity: 0.7; font-weight: 600; }
.trg-slack { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.trg-slack .ok { color: var(--accent); font-weight: 700; }
.trg-slack input { flex: 1; min-width: 240px; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; font: inherit; }
.trg-card { display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.trg-card.off { opacity: 0.55; }
.trg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.trg-name { font-weight: 700; font-size: 14px; }
.trg-sum { font-size: 12.5px; color: var(--ink-2); }
.trg-btns { display: flex; gap: 6px; flex-shrink: 0; }
.trg-ed { display: flex; flex-direction: column; gap: 8px; }
.trg-ed > input, .trg-ed > select { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; font: inherit; background: var(--panel); color: var(--ink); }
.trg-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.trg-row select, .trg-row input, .trg-row textarea { border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 8px; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); }
.trg-row input[data-atext], .trg-row textarea { flex: 1; min-width: 200px; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(14px); }
.trg-row input[data-cv] { flex: 1; min-width: 200px; }
.sess-row { padding: 6px 0; border-bottom: 1px solid var(--row-line); font-size: 13px; }
.fc-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.fc-day { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12.5px; }
.fc-grid { border-collapse: collapse; font-size: 11px; width: 100%; }
.fc-grid th { font-weight: 600; color: var(--muted); padding: 3px 4px; text-align: center; }
.fc-grid tbody th { text-align: left; color: var(--ink-2); }
.fc-grid td { text-align: center; padding: 4px 2px; min-width: 24px; border: 1px solid var(--row-line); }
.fc-grid tr.fc-need td, .fc-grid tr.fc-need th { color: var(--faint); font-size: 10px; border-bottom: 2px solid var(--line); }
.fc-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 700px) { .fc-days { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); } }
.mini-flag.topic { background: var(--accent2-soft); color: var(--accent2); }
.row-mood { font-size: 12px; line-height: 1; flex-shrink: 0; }
.qa-set { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.qa-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .qa-cols { grid-template-columns: 1fr; } }
.qa-score { font-size: 15px; }
.qa-score.good { color: var(--accent); } .qa-score.mid { color: var(--warn); } .qa-score.low { color: var(--alert); }
.qa-bar { display: grid; grid-template-columns: 150px 1fr 28px; gap: 8px; align-items: center; font-size: 12.5px; padding: 4px 0; }
.qa-track { height: 8px; background: var(--row-line); border-radius: 999px; overflow: hidden; }
.qa-track span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.qa-rev { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.qa-crit { display: flex; flex-wrap: wrap; gap: 6px; }
.qa-crit span { font-size: 11px; background: var(--row-line); border-radius: 999px; padding: 2px 8px; color: var(--ink-2); }
/* folding side-menu groups */
.navgroup .grp-chev { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.6; transition: transform .15s; }
.navgroup.open .grp-chev { transform: rotate(180deg); }
.sidebar.collapsed .navgroup .grp-chev { display: none; }
.navgroup-items { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; margin: 2px 0 6px; border-left: 1px solid rgba(255,255,255,0.1); margin-left: 18px; }
.navgroup-items .navtab { padding-top: 7px; padding-bottom: 7px; }
.pop-menu button[data-fly] { display: flex; align-items: center; gap: 9px; }
.pop-menu button[data-fly] .nic { width: 16px; height: 16px; }

/* ---------- Calm pass 19 Nov: list header ---------- */
.list-head { padding: 14px 14px 11px; gap: 10px; }
.list-title-row h1 { font-size: 18px; }
.lh-tools { display: inline-flex; gap: 4px; }
.lh-ic { width: 30px; height: 30px; border: none; background: transparent; border-radius: 8px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.lh-ic svg { width: 17px; height: 17px; }
.lh-ic:hover { background: var(--row-line); color: var(--ink); }
.lh-ic.on { background: var(--accent-soft); color: var(--accent); }
.search { padding: 8px 11px; }

/* ---------- Calm pass 19 Nov: chat header ---------- */
.chat-head { padding: 10px 16px; gap: 6px; }
.chat-head .avatar { width: 36px; height: 36px; font-size: 13px; }
.chat-head .who { min-width: 0; flex: 1 1 auto; }
.chat-head .who-top { flex-wrap: nowrap; gap: 6px; }
.chat-head .who-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.who-mood { color: var(--alert); }
.ch-tools { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.ch-tools .hdr-sel { height: 30px; font-size: 12.5px; padding: 0 26px 0 10px; margin-right: 4px; }
.hd-ic { width: 32px; height: 32px; border: none; background: transparent; border-radius: 8px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1; }
.hd-ic svg { width: 17px; height: 17px; }
.hd-ic svg [stroke] { stroke: currentColor; }
.hd-ic:hover { background: var(--row-line); color: var(--ink); }
.hd-ic.on { color: var(--accent); background: var(--accent-soft); }
.hd-ic.star.on { color: #C99A2E; background: transparent; }
.hd-ic.prio-normal, .hd-ic-mini.prio-normal { color: var(--faint); }
.hd-ic.prio-low, .hd-ic-mini.prio-low { color: var(--line-2); }
.hd-ic.prio-high, .hd-ic-mini.prio-high { color: var(--warn); }
.hd-ic.prio-urgent, .hd-ic-mini.prio-urgent { color: var(--alert); }
.hd-ic-mini { display: inline-flex; width: 15px; height: 15px; margin-right: 8px; vertical-align: -2px; }
.hd-ic-mini svg { width: 15px; height: 15px; }
.chat-head .card-collapse-btn { font-size: 17px; }
.close-split { display: inline-flex; margin-left: 6px; }
.btn-close { height: 32px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 600; padding: 0 12px; border-radius: 8px 0 0 8px; white-space: nowrap; }
.btn-close:hover { background: var(--accent-hover); }
.btn-close.caret { border-radius: 0 8px 8px 0; padding: 0 7px; border-left: 1px solid rgba(255,255,255,0.35); }
.pop-h { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); padding: 7px 11px 3px; }
.pop-menu button.danger { color: var(--alert); }
.pop-menu button.cur { background: var(--row-line); font-weight: 600; }
.pop-menu button:disabled { opacity: .45; cursor: default; }
.kbd-hint { float: right; color: var(--faint); font-size: 11.5px; margin-left: 14px; }
.sib-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.sib-chip { border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); border-radius: 7px; padding: 2px 8px; font-size: 12px; }
.sib-chip:hover { border-color: var(--accent); }
.w-red { color: var(--alert); font-weight: 600; }

/* ---------- Calm pass 19 Nov: typing area ---------- */
.composer { padding: 10px 16px 14px; gap: 7px; }
.suggest-bar { margin: 0; gap: 7px; font-size: 12px; }
.suggest-lede { color: var(--faint); font-size: 11.5px; font-weight: 600; }
.suggest-pill { height: 24px; font-size: 12px; padding: 0 10px; }
.cbox { border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); transition: border-color .15s, box-shadow .15s, background .15s; }
.cbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cbox .ce { outline: none; font-size: 14px; line-height: 1.5; color: var(--ink); min-height: 42px; max-height: 38vh; overflow-y: auto; padding: 10px 13px 4px; word-break: break-word; white-space: pre-wrap; }
.cbox .ce:empty:before { content: attr(data-ph); color: var(--faint); pointer-events: none; }
.cbox .ce b, .cbox .ce strong { font-weight: 700; }
.cbox .ce i, .cbox .ce em { font-style: italic; }
.cbox .ce a { color: var(--accent); text-decoration: underline; }
.composer.is-note .cbox { background: var(--note-bg); border-color: var(--note-line); }
.composer.is-note .cbox:focus-within { box-shadow: 0 0 0 3px rgba(230,207,147,0.45); border-color: #D9B866; }
.ctool { display: flex; align-items: center; gap: 2px; padding: 4px 6px 6px 8px; }
.mode-tg { display: inline-flex; background: var(--row-line); border-radius: 7px; padding: 2px; }
.mode-tg button { border: none; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 5px; }
.mode-tg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-xs); }
.composer.is-note .mode-tg { background: rgba(138,99,22,0.12); }
.composer.is-note .mode-tg button.on { color: var(--note-ink); }
.ct-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.ct-ic { width: 30px; height: 30px; border: none; background: transparent; border-radius: 7px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.ct-ic svg { width: 17px; height: 17px; }
.ct-ic svg, .ct-ic svg * { stroke: currentColor; }
.ct-ic:hover { background: var(--row-line); color: var(--ink); }
.ct-ic.ai { color: var(--accent); }
.ct-grow { flex: 1; }
.ct-hint { font-size: 11px; color: var(--faint); margin-right: 8px; white-space: nowrap; }
.ct-send { width: 34px; height: 34px; border: none; border-radius: 9px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-xs); }
.ct-send svg { width: 17px; height: 17px; }
.ct-send:hover { background: var(--accent-hover); }
.composer.is-note .ct-send { background: #B7791F; }
.fmt-float { position: fixed; z-index: 70; display: flex; gap: 2px; background: var(--ink); border-radius: 8px; padding: 3px; box-shadow: var(--shadow-pop); }
.fmt-float button { width: 32px; height: 28px; border: none; background: transparent; color: #fff; border-radius: 6px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.fmt-float button:hover { background: rgba(255,255,255,0.14); }
.fmt-float svg { width: 15px; height: 15px; }
@media (max-width: 1100px) { .ct-hint { display: none; } }
.chat-main { container-type: inline-size; }
.cl-ic { display: none; font-weight: 700; }
@container (max-width: 640px) {
  .ch-tools .hdr-sel { max-width: 96px; padding-right: 20px; }
  .chat-head .who { min-width: 80px; }
  .cl-txt { display: none; }
  .cl-ic { display: inline; }
  .btn-close { padding: 0 11px; }
  .ct-hint { display: none; }
}
@container (max-width: 470px) {
  #chatsearchbtn, #starbtn { display: none; }
  .ch-tools .hdr-sel { max-width: 84px; font-size: 12px; }
}
@media (max-width: 1280px) { .list { width: 320px; } }

/* ---------- Calm pass 19 Nov: menu, pages, notepad ---------- */
.theme-ic { width: 28px; height: 28px; border: none; background: transparent; color: var(--sidebar-ink); border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.theme-ic .nic { width: 16px; height: 16px; }
.theme-ic:hover { background: var(--sidebar-2); color: #fff; }
.sidebar.collapsed .theme-ic { display: none; }
.ov-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ov-x { width: 30px; height: 30px; border: none; background: transparent; border-radius: 8px; color: var(--muted); font-size: 15px; }
.ov-x:hover { background: var(--row-line); color: var(--ink); }
.ov-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -2px 0 16px; overflow-x: auto; }
.ov-tabs button { border: none; background: transparent; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ov-tabs button:hover { color: var(--ink); }
.ov-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.acc-pw { display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.acc-pw .btn-send { align-self: flex-start; margin-top: 4px; }
.acc-err { background: var(--alert-soft); color: var(--alert-hover); border: 1px solid var(--alert-line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.overlay.gate { position: fixed; inset: 0; z-index: 90; background: radial-gradient(1200px 620px at 50% -20%, #1F2A44, #0F1623 62%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate-card { background: var(--panel); color: var(--ink); width: 100%; max-width: 420px; border-radius: 18px; padding: 30px; box-shadow: 0 32px 80px rgba(8,14,26,0.5); }
.gate-card h2 { margin: 6px 0 12px; font-size: 20px; }
.gate-logo { width: 40px; height: 40px; }
.gate-card .acc-pw { max-width: none; }
.sla-list { display: flex; flex-direction: column; }
.sla-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--row-line); }
.sla-l { flex: 1; display: flex; flex-direction: column; font-size: 13.5px; }
.sla-l .muted { font-size: 12px; }
.sla-v { font-size: 13px; color: var(--muted); white-space: nowrap; }
.sla-v input { width: 70px; border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 7px; font: inherit; background: var(--panel); color: var(--ink); }
.sw { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: background .15s; cursor: pointer; }
.sw span:before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: var(--shadow-xs); }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span:before { transform: translateX(14px); }
.np-panel { position: fixed; left: 226px; bottom: 16px; width: 340px; height: 420px; max-height: calc(100vh - 32px); z-index: 50; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.np-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.np-head strong { font-size: 14px; }
.np-state { flex: 1; font-size: 11.5px; color: var(--faint); }
.np-panel textarea { flex: 1; border: none; outline: none; resize: none; padding: 12px 14px; font: inherit; font-size: 13.5px; line-height: 1.55; background: var(--panel); color: var(--ink); }
.sidebar.collapsed ~ .np-panel, .app .sidebar.collapsed + * .np-panel { left: 74px; }
@media (max-width: 860px) { .np-panel { left: 8px; right: 8px; width: auto; bottom: 8px; height: 60vh; } }
.card { position: relative; }
.card-x { display: none; position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: none; background: var(--row-line); border-radius: 8px; color: var(--muted); font-size: 14px; z-index: 2; }
.card-x:hover { color: var(--ink); }
@media (max-width: 1180px) { .app.show-card .card-x { display: block; } }
.home { margin: auto; padding: 30px; max-width: 560px; width: 100%; display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.home-hi { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.home-tile { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.home-tile[data-hometab]:hover { border-color: var(--line-2); box-shadow: var(--shadow-xs); }
.home-tile:not([data-hometab]) { cursor: default; }
.home-n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.home-l { font-size: 12.5px; color: var(--muted); }
.home-tile.warn .home-n { color: var(--warn); }
.home-tile.hot .home-n { color: var(--alert); }
.home-go { border-radius: 10px; height: 40px; align-self: flex-start; padding: 0 16px; }
.home-calm { color: var(--muted); font-size: 13.5px; }
.home-keys { font-size: 12px; color: var(--faint); }
.home-keys kbd { background: var(--row-line); border-radius: 5px; padding: 1px 6px; font-family: inherit; font-size: 11.5px; color: var(--muted); }
.fl-n { float: right; color: var(--faint); font-size: 12px; margin-left: 12px; }
.agent-card .status, .agent-card .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card .ac-body { min-width: 0; flex: 1; }
@container (max-width: 560px) {
  .ch-title { flex-wrap: wrap; row-gap: 6px; }
  .ch-title .who { flex: 1 1 calc(100% - 60px); }
  .ch-tools { width: 100%; justify-content: flex-end; }
  #chatsearchbtn, #starbtn { display: inline-flex; }
  .ch-tools .hdr-sel { max-width: none; margin-right: auto; }
}
.pop-menu button { padding: 6px 11px; font-size: 13px; }
.ch-tools .hdr-sel { max-width: 150px; }
/* Phone: the typing box gets the full width, the toolbar sits under it. */
@media (max-width: 860px) {
  .composer { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .cbox .ce { max-height: 30vh; font-size: 16px; }
  .ct-hint { display: none; }
  .chat-head { padding: 8px 10px; }
  .list-head { padding: 10px 12px 9px; }
}
@media (max-width: 860px) { .list { width: 100%; } }
:root[data-theme="dark"] .btn-close { background: var(--accent); border-color: var(--accent); color: #fff; }
.dnc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.dnc-search { flex: 1 1 220px; }
.dnc-total { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dnc-addbox { display: flex; gap: 8px; margin-bottom: 10px; }
.dnc-addbox.col { flex-direction: column; align-items: flex-start; }
.dnc-addbox .auto-ta { flex: 1; }
.dnc-addbox.col .auto-ta { width: 100%; }
.dnc-list { display: flex; flex-direction: column; }
.dnc-list .dnc-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--row-line); background: none; border-radius: 0; }
.dnc-list .dnc-val { font-weight: 600; font-size: 13.5px; }
.dnc-meta { flex: 1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dnc-more { display: flex; gap: 12px; align-items: center; justify-content: flex-end; font-size: 12.5px; margin-top: 8px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.period-bar { display: inline-flex; background: var(--row-line); border-radius: 9px; padding: 3px; margin-bottom: 14px; }
.period-bar .seg { border: none; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 7px; }
.period-bar .seg.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-xs); }
.stile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stile { background: var(--chat-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stile-n { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stile-l { font-size: 11.5px; color: var(--muted); }
.stile-s { font-size: 11.5px; margin-top: 2px; }
.stile-s .up { color: var(--good); } .stile-s .down { color: var(--alert); } .stile-s .flat { color: var(--faint); }
.back-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.trg-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.trg-list { display: flex; flex-direction: column; gap: 6px; }
.trg-card { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.trg-card.off { opacity: .55; }
.trg-card .sw { margin-top: 2px; }
.trg-main { flex: 1; min-width: 0; }
.trg-name { font-weight: 600; font-size: 13.5px; }
.trg-sum { font-size: 12.5px; color: var(--ink-2); margin: 2px 0; }
.trg-ran { font-size: 11.5px; color: var(--faint); }
.trg-btns { display: flex; gap: 2px; }
.trg-conn { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.trg-conn summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.trg-conn .ok { color: var(--good); }
.trg-slack, .trg-hook { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.trg-slack input { flex: 1; min-width: 240px; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); }
.trg-hook code { background: var(--row-line); border-radius: 6px; padding: 4px 8px; font-size: 12px; word-break: break-all; }
.trg-ed { display: flex; flex-direction: column; gap: 14px; }
.trg-sec { display: flex; flex-direction: column; gap: 6px; }
.trg-ed input, .trg-ed select, .trg-ed textarea { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); }
.trg-ed #trg-name { max-width: 420px; }
.trg-when { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.trg-when select { max-width: 420px; }
.trg-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.trg-row.act { align-items: flex-start; }
.trg-ins { display: flex; gap: 6px; align-items: center; flex: 1; flex-wrap: wrap; font-size: 12.5px; }
.trg-ins textarea { flex: 1; min-width: 220px; }
.trg-ins select { max-width: 260px; }
.trg-op { font-size: 12.5px; color: var(--muted); }
.trg-num { width: 76px; }
.trg-time { width: 120px; }
.trg-days { display: inline-flex; gap: 6px; font-size: 12.5px; }
.trg-days label { display: inline-flex; gap: 3px; align-items: center; }
.trg-match { display: flex; gap: 16px; font-size: 13px; margin-bottom: 4px; }
.trg-cool { display: flex; gap: 8px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.trg-foot { display: flex; justify-content: flex-end; gap: 8px; }
.auto-sec { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; margin-bottom: 8px; background: var(--panel); }
.auto-sec[open] { padding-bottom: 12px; }
.auto-sec > summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
.auto-sec > summary::-webkit-details-marker { display: none; }
.auto-sec > summary:before { content: "›"; color: var(--faint); font-size: 16px; transition: transform .15s; width: 10px; }
.auto-sec[open] > summary:before { transform: rotate(90deg); }
.auto-peek { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--faint); }
.auto-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.auto-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.auto-num, .oh-times input { border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 7px; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); }
.oh-grid { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; align-items: center; font-size: 13px; }
.oh-day { display: flex; gap: 7px; align-items: center; }
.oh-times { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.auto-foot { display: flex; justify-content: flex-end; margin-top: 12px; position: sticky; bottom: -20px; background: var(--panel); padding: 10px 0; }
.sla-perf { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-top: 6px; }
.sla-p { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.sla-p-top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.sla-p-top .muted { font-size: 12px; }
.sla-pct { margin-left: auto; font-weight: 700; font-size: 16px; }
.sla-pct.good { color: var(--good); } .sla-pct.warn { color: var(--warn); } .sla-pct.bad { color: var(--alert); }
.sla-bar { height: 5px; background: var(--row-line); border-radius: 99px; overflow: hidden; }
.sla-bar span { display: block; height: 100%; background: var(--accent); }
.qa-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.qa-table-wrap { overflow-x: auto; }
.qa-table th, .qa-table td { white-space: nowrap; }
.qa-c.good { color: var(--good); } .qa-c.mid { color: var(--warn); } .qa-c.low { color: var(--alert); font-weight: 600; }
.qa-revs { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.qa-rev > summary { cursor: pointer; display: flex; gap: 10px; align-items: center; list-style: none; font-size: 13px; }
.qa-rev > summary::-webkit-details-marker { display: none; }
.qa-mood { font-size: 14px; }
.qa-when { margin-left: auto; font-size: 12px; }
.qa-crit { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.qa-crit b { color: var(--ink); }
.qa-crit .low b { color: var(--alert); } .qa-crit .mid b { color: var(--warn); }
.qa-note { font-size: 12.5px; margin: 3px 0; }
.sk-row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; margin-top: 4px; }
.sk-row label { display: inline-flex; gap: 6px; align-items: center; }
.ag-sub { display: block; font-size: 11.5px; color: var(--muted); }
.ag-warn { color: var(--warn); font-weight: 600; }
.ag-ok { color: var(--good); }
.qp { position: fixed; z-index: 55; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; max-height: 46vh; overflow: hidden; }
.qp-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--line); }
.qp-slash { color: var(--accent); font-weight: 700; }
.qp-head input { flex: 1; border: none; outline: none; font: inherit; font-size: 13.5px; background: transparent; color: var(--ink); padding: 4px 0; }
.qp-list { overflow-y: auto; padding: 4px; }
.qp-item { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: none; background: transparent; padding: 7px 9px; border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.qp-item strong { color: var(--ink); font-size: 13px; }
.qp-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qp-item.on, .qp-item:hover { background: var(--accent-soft); }
.vip-ic { margin-left: 1px; }
.vip-ic.risk-red { color: var(--alert); }
.vip-ic.risk-amber { color: var(--warn); }
.row-top { gap: 5px; }
/* Reply box: a touch smaller text, quieter placeholder */
.cbox .ce { font-size: 13.5px; min-height: 38px; padding: 9px 12px 3px; }
.cbox .ce:empty:before { font-size: 12.5px; }
.count.int { background: var(--accent2); color: #fff; }
.sidebar.collapsed .count.int { background: var(--accent2); }
.signin-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--chat-bg); font-size: 13.5px; }
.signin-box div { display: flex; justify-content: space-between; gap: 12px; }
.signin-pw { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.02em; }
.level-row { flex-wrap: wrap; }
.ic-cur { display: inline-flex; width: 18px; height: 18px; }
.ic-cur svg { width: 18px; height: 18px; }
.ic-pick { display: flex; gap: 3px; flex-basis: 100%; padding-left: 46px; }
.ic-pick button { width: 26px; height: 26px; border: 1px solid transparent; background: transparent; border-radius: 6px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.ic-pick button svg { width: 14px; height: 14px; }
.ic-pick button:hover { background: var(--row-line); }
.ic-pick button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tick { color: var(--faint); font-size: 11px; letter-spacing: -0.12em; margin-left: 2px; }
.tick.read { color: #3B82F6; }
.tick.fail { color: var(--alert); letter-spacing: 0; font-weight: 600; }
.chan-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.chan-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chan-name { font-weight: 700; font-size: 15px; }
.chan-st { font-size: 12.5px; font-weight: 600; }
.chan-st.ok { color: var(--good); } .chan-st.warn { color: var(--warn); } .chan-st.bad { color: var(--alert); }
.chan-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; }
.chan-qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.chan-qr img { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; }
.chan-steps { font-size: 13px; line-height: 1.7; padding-left: 18px; margin: 0; flex: 1; min-width: 200px; }
.guess { color: var(--faint); font-style: italic; }
.brand-guess { font-size: 12px; color: var(--muted); margin: -2px 0 2px; text-align: right; }
.filetray { display: flex; align-items: center; gap: 10px; margin: 8px 8px 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--chat-bg); }
.filetray img { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; }
.ft-ic { width: 40px; height: 40px; border-radius: 8px; background: var(--row-line); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.ft-ic svg { width: 18px; height: 18px; } .ft-ic svg * { stroke: currentColor; }
.ft-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.ft-txt strong { color: var(--ink); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-main.drop { outline: 2px dashed var(--accent); outline-offset: -8px; }
.attach-cap { margin-top: 6px; }
.attach-audio { width: 240px; max-width: 100%; height: 36px; display: block; }
.attach-video { max-width: 260px; max-height: 300px; border-radius: 10px; display: block; }

/* Closed chats: in the Closed filter and in search results */
.rows-div{padding:10px 14px 4px;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.row.row-closed .row-name,.row.row-closed .row-preview{opacity:.62}
.row.row-closed .avatar-wrap{opacity:.7}
.who-closed{color:var(--muted);font-weight:600}

/* ===== Phone pass (20 Nov): every page usable on a phone =====
   Pages open full screen with the title and ✕ always in reach, typing never
   zooms the page (iOS zooms into fields under 16px), and tap targets are at
   least 40px. */
.int-head { flex-direction: row; align-items: center; gap: 8px; }
.int-head-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.int-back { display: none; width: 36px; height: 36px; border: none; background: transparent; border-radius: 8px; color: var(--ink); align-items: center; justify-content: center; flex-shrink: 0; margin-left: -8px; }
.int-back svg { width: 20px; height: 20px; }
@media (max-width: 860px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea, [contenteditable="true"] { font-size: 16px !important; }
  .overlay { padding: 0 !important; align-items: stretch !important; }
  .overlay > .ov-panel { max-width: none !important; max-height: none !important; height: 100%; height: 100dvh; border-radius: 0 !important;
    padding: 0 14px calc(18px + env(safe-area-inset-bottom)) !important; }
  .ov-panel > .ov-head { position: sticky; top: 0; z-index: 5; background: var(--panel); margin: 0 -14px 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; border-bottom: 1px solid var(--line); }
  .ov-panel > .ov-head strong { font-size: 17px !important; }
  .ov-x { width: 40px; height: 40px; font-size: 18px; margin-right: -8px; }
  .ov-tabs { margin: -4px -14px 14px; padding: 0 8px; scrollbar-width: none; }
  .ov-tabs::-webkit-scrollbar { display: none; }
  .ov-tabs button { padding: 11px 12px; font-size: 14px; }
  /* Internal chat: channel list, then the conversation, one at a time */
  .internal { height: calc(100dvh - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border: none; border-radius: 0; margin: 0 -14px; }
  .int-side { width: 100%; border-right: none; background: transparent; padding: 4px 6px; }
  .int-chan { padding: 11px 10px; }
  .int-ch-ic { width: 34px; height: 34px; font-size: 12px; border-radius: 9px; }
  .int-ch-name { font-size: 15px; }
  .internal .int-main { display: none; }
  .internal.show-main .int-side { display: none; }
  .internal.show-main .int-main { display: flex; }
  .int-back { display: flex; }
  .int-head { padding: 8px 12px; }
  .int-msgs { padding: 12px; }
  .int-msg { max-width: 88%; }
  .int-composer { padding: 8px 10px; }
  .int-composer .send { width: 42px; height: 42px; flex-shrink: 0; }
  /* nothing may run off the right edge */
  .ov-panel select, .ov-panel input, .ov-panel textarea { max-width: 100%; min-width: 0; }
  .ov-panel table { display: block; overflow-x: auto; max-width: 100%; }
  .grp-top { flex-wrap: wrap; }
  .grp-top .grp-name { flex: 1 1 150px !important; }
  .ic-pick { flex-wrap: wrap; padding-left: 0; }
  .oh-grid { grid-template-columns: 1fr; gap: 4px; }
  .oh-times { padding: 0 0 8px 24px; }
  .oh-times input { width: 118px; }
  .auto-line { flex-wrap: wrap; }
  .auto-line .hdr-sel { max-width: 100%; }
  /* bigger tap targets for the buttons people use most */
  .ov-panel .btn, .ov-panel .btn-close { min-height: 40px; }
  .ov-panel .ct-ic, .ov-panel .int-tool { min-width: 36px; min-height: 36px; }
  .period-bar button, .pd-btn { min-height: 36px; }
  /* menus: finger-sized rows, never taller than the screen */
  .pop-menu { max-height: calc(100dvh - 16px); overflow-y: auto; }
  .pop-menu button { padding: 10px 14px; font-size: 15px; }
}

/* Your name card stays at the bottom of the menu, also when open groups make
   the menu taller than the screen (the rest scrolls behind it). */
.sidebar > .agent-card { position: sticky; bottom: 0; z-index: 3; flex-shrink: 0; box-shadow: 0 10px 0 6px var(--sidebar), 0 -14px 14px -6px var(--sidebar); }

/* Authenticator setup: the QR code to scan */
.tf-qr-wrap { display: flex; gap: 14px; align-items: center; margin: 8px 0 12px; }
.tf-qr { width: 180px; height: 180px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 4px; }
@media (max-width: 520px) { .tf-qr-wrap { flex-direction: column; align-items: flex-start; } }
.tf-secret { word-break: normal !important; overflow-wrap: normal !important; }

/* Automations: which channels each one runs on */
.auto-chrow { display: flex; align-items: flex-start; gap: 10px; }
.auto-chrow > .auto-row { flex: 1; min-width: 0; }
.ch-chips { display: inline-flex; gap: 3px; flex-shrink: 0; margin-top: 2px; vertical-align: middle; }
.ch-chips button { min-width: 34px; height: 24px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line-2); background: transparent; color: var(--faint); font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .03em; cursor: pointer; text-decoration: line-through; }
.ch-chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink, var(--accent)); text-decoration: none; }
@media (max-width: 860px) { .ch-chips button { min-width: 42px; height: 32px; font-size: 12px; } }

/* Messages always show on top, also over the sign-in steps */
.toast { z-index: 200; }
.tf-err { margin-top: 8px; color: var(--alert); font-size: 13px; line-height: 1.4; }

/* Our own question boxes and corner notices */
.ui-dlg-back { position: fixed; inset: 0; z-index: 150; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ui-dlg { background: var(--panel); color: var(--ink); width: 100%; max-width: 420px; border-radius: 14px; padding: 18px 18px 14px; box-shadow: 0 24px 60px rgba(8,14,26,.35); }
.ui-dlg-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.ui-dlg-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.ui-dlg-in { width: 100%; margin-top: 12px; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; font: inherit; background: var(--panel); color: var(--ink); resize: vertical; }
.ui-dlg-in:focus { outline: none; border-color: var(--accent); }
.ui-dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ui-dlg-yes { background: var(--accent); border-color: var(--accent); color: #fff; }
.ui-dlg-yes.danger { background: var(--alert); border-color: var(--alert); color: #fff; }
.ui-notice { position: fixed; top: 16px; right: 16px; z-index: 140; width: 320px; max-width: calc(100vw - 32px); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: 0 18px 44px rgba(8,14,26,.25); }
.ui-notice-t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.ui-notice-t::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.ui-notice-x { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.ui-notice-b { display: flex; gap: 8px; margin-top: 10px; }
@media (max-width: 860px) { .ui-dlg-btns .btn { min-height: 42px; flex: 1; } .ui-notice { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; } }

/* Hand over: pick a colleague */
.ho-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.ho-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 10px; font: inherit; color: var(--ink); cursor: pointer; }
.ho-row:hover { border-color: var(--line-2); background: var(--row-line); }
.ho-row.on { border-color: var(--accent); background: var(--accent-soft); }
.ho-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.ho-st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.av-mini { width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.row-handed { font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.ho-st .st-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* Card fields the desk filled from the chat */
.from-chat { font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; margin-left: 4px; letter-spacing: .02em; vertical-align: 1px; white-space: nowrap; }

/* Short messages and the select-text bar keep dark backing with light text in
   both themes (they used the text colour as background, which turns white in dark). */
.toast { background: #0F1623; color: #fff; }
.fmt-float { background: #0F1623; }
:root[data-theme="dark"] .toast { background: #2A3A54; color: #F1F5FB; border: 1px solid #3B4E6B; box-shadow: 0 12px 32px rgba(0,0,0,.45); }
:root[data-theme="dark"] .fmt-float { background: #2A3A54; border: 1px solid #3B4E6B; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toast { background: #2A3A54; color: #F1F5FB; border: 1px solid #3B4E6B; }
  :root:not([data-theme="light"]) .fmt-float { background: #2A3A54; border: 1px solid #3B4E6B; }
}
.resend { font-size: inherit; color: var(--alert); text-decoration: underline; margin-left: 2px; }


/* ---------- Section C batch 1 (21 Nov) ---------- */
/* Small list text a little larger and darker. */
.row-src { font-size: 11px; color: var(--muted); }
.row-time { font-size: 12px; color: var(--muted); }
.row-agent { font-size: 10px; color: var(--ink-2); }
.bubble .meta { font-size: 11.5px; }
/* Pop-up windows get a visible edge, and a darker backdrop in dark mode. */
.ov-panel { border: 1px solid var(--line); box-shadow: var(--shadow-pop); }
:root[data-theme="dark"] .overlay { background: rgba(0, 0, 0, 0.62) !important; }
:root[data-theme="dark"] .ov-panel { border-color: var(--line-2); }
/* Coloured "Add" buttons kept their colour only in light mode. */
:root[data-theme="dark"] .btn.btn-dark { background: var(--accent); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .btn.btn-dark:hover { background: var(--accent-hover); }
/* A channel that is not working: one thin red bar over the chat list. */
.chan-alert { background: var(--alert-soft); color: var(--alert); border-bottom: 1px solid var(--alert-line, var(--alert)); font-size: 12.5px; font-weight: 600; padding: 8px 14px; line-height: 1.4; }
.chan-alert .linklike { color: inherit; text-decoration: underline; font-weight: 700; margin-left: 4px; }

/* ---------- Section C batch 2 ---------- */
/* No coloured stripes on rows: a small flag for urgent / high, a soft background for the open chat. */
.row, .row.edge-red, .row.edge-amber, .row.active { border-left-color: transparent; }
.row-flag { display: inline-flex; flex-shrink: 0; }
.row-flag svg { width: 13px; height: 13px; }
.row-flag.urgent { color: var(--alert); }
.row-flag.high { color: var(--warn); }
.take-btn { height: 32px; padding: 0 12px; font-weight: 700; border-color: var(--accent); color: var(--accent-ink); flex-shrink: 0; }
.tm-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
/* Pages from the side menu fill the main area, next to the menu (C19). */
.overlay.ov-full { background: transparent !important; padding: 0 !important; align-items: stretch !important; justify-content: stretch !important; z-index: 35 !important; }
.overlay.ov-full > .ov-panel { max-width: none !important; max-height: none !important; height: 100%; border-radius: 0 !important;
  border: none; border-left: 1px solid var(--line); box-shadow: none; padding: 20px 28px !important; }
.overlay.ov-full > .ov-panel > [data-body], .overlay.ov-full > .ov-panel > .ov-tabs { max-width: 1180px; }
:root[data-theme="dark"] .overlay.ov-full { background: transparent !important; }
@media (max-width: 860px) { .overlay.ov-full > .ov-panel { padding: 0 14px calc(18px + env(safe-area-inset-bottom)) !important; } }
/* One way to save: "Unsaved changes" sits next to the Save button. */
.unsaved-tag { font-size: 12.5px; font-weight: 600; color: var(--warn); margin-right: 10px; }
.auto-foot { display: flex; align-items: center; justify-content: flex-end; }
/* Buttons that cannot be used look it. */
button:disabled, .btn:disabled, .btn-send:disabled, .btn-close:disabled, .chip:disabled, input:disabled, select:disabled, textarea:disabled {
  opacity: .45; cursor: not-allowed; filter: saturate(.4);
}
button:disabled:hover, .btn:disabled:hover, .btn-send:disabled:hover { transform: none; }
/* Phone and narrow chat (C20): back, avatar and name on one row, the tools on
   the next row without running off the left edge, bigger tap targets, and a dim
   background behind the player card. */
@container (max-width: 560px) {
  .ch-title .who { flex: 1 1 0; min-width: 0; }
  .ch-tools { flex-wrap: wrap; justify-content: flex-start; row-gap: 6px; }
  .ch-tools .hdr-sel { flex: 1 1 96px; max-width: 150px; margin-right: 2px; }
  .ch-tools .take-btn { margin-left: auto; }
}
@media (max-width: 860px) {
  .hd-ic { width: 40px; height: 40px; }
  .chat-head .avatar { width: 36px; height: 36px; }
  .back-btn { min-width: 40px; min-height: 40px; }
  .take-btn, .btn-close { height: 40px; }
}
@media (max-width: 1180px) {
  .app.show-card::after { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 29; }
}
@container (max-width: 470px) {
  /* Row 1: status, Take, Close. Row 2: the small tools. */
  .ch-tools .hdr-sel { order: 0; flex: 1 1 auto; max-width: none; }
  .ch-tools .take-btn { order: 1; margin-left: 0; }
  .ch-tools .close-split, .ch-tools #reopenbtn { order: 2; }
  .ch-tools .hd-ic { order: 3; }
  #chatsearchbtn { display: inline-flex; }
}
.ov-head .ov-pop { margin-left: auto; margin-right: 8px; height: 32px; font-size: 12.5px; }
.row-wait { display: inline-flex; align-items: center; gap: 3px; }
.wait-ic { width: 11px; height: 11px; flex-shrink: 0; }
/* Line icons instead of emoji (C24). */
.inl-ic { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; flex-shrink: 0; }
.st-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.st-dot.on { background: var(--good); }
.st-dot.off { background: var(--faint); }
.bubble.call-note { display: flex; flex-wrap: wrap; align-items: baseline; }
.bubble.call-note .meta { flex-basis: 100%; }
/* Checkboxes, radios and sliders in the desk colour, not the browser blue (C28). */
input[type="checkbox"], input[type="radio"], input[type="range"], progress { accent-color: var(--accent); }
.pg-sep { border-top: 1px solid var(--line); margin: 18px 0; }
/* Saved replies: a short title over a left-aligned preview (C26). */
.qr-item { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; text-align: left; height: auto !important; min-height: 0; }
.qr-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.qr-key { font-size: 12px; color: var(--muted); font-weight: 500; }
.qr-prev { font-size: 12.5px; color: var(--muted); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.app.no-chat .card { display: none !important; }
.ov-xls { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
.ov-head .ov-xls + .ov-pop, .ov-head .ov-pop + .ov-xls { margin-left: 0; }
/* Countries list (Player setup) */
.cc-head, .cc-row { display: grid; grid-template-columns: 16px 64px 1fr 120px 130px 28px; gap: 8px; align-items: center; }
.cc-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 6px; }
.cc-head span:first-child { grid-column: 1 / span 2; }
.cc-row { margin-bottom: 6px; }
.cc-row .auto-ta { margin: 0; }
.cc-plus { color: var(--muted); font-weight: 700; text-align: right; }
@media (max-width: 860px) {
  .cc-head { display: none; }
  .cc-row { grid-template-columns: 16px 70px 1fr 28px; padding-bottom: 8px; border-bottom: 1px solid var(--row-line); }
  .cc-row select { grid-column: 2 / span 2; }
}
/* Ready-made rules (Triggers page) */
.rcp-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--panel); }
.rcp-main { flex: 1; min-width: 0; }
.rcp-state { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.rcp-state.on { color: var(--good-ink, var(--good)); }
.trg-recipes { margin-top: 14px; }

/* ---------- Knowledge base ---------- */
.kb-intro { margin-top: 0; }
.kb-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.kb-side { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.kb-side-h { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 2px 8px 6px; }
.kb-cat { display: flex; justify-content: space-between; gap: 8px; text-align: left; border: none; background: transparent; color: var(--ink-2); padding: 7px 10px; border-radius: 8px; font: inherit; font-size: 13.5px; cursor: pointer; }
.kb-cat:hover { background: var(--row-line); }
.kb-cat.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.kb-n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.kb-cat-add { align-self: flex-start; margin: 8px 0 0 6px; }
.kb-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.kb-search { flex: 1; margin: 0; }
.kb-cat-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.kb-cat-tools { display: flex; gap: 12px; flex-shrink: 0; }
.kb-count { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.kb-row { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font: inherit; color: var(--ink); }
.kb-row:hover { border-color: var(--accent); }
.kb-row-top { display: flex; align-items: baseline; gap: 8px; }
.kb-title { font-weight: 600; font-size: 14px; }
.kb-chip { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.kb-pin { font-size: 12px; }
.kb-snip { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.kb-row mark, .kb-snip mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.kb-empty { color: var(--muted); font-size: 13px; padding: 16px 4px; line-height: 1.5; }
.kb-art { max-width: 760px; }
.kb-back { margin-bottom: 8px; }
.kb-art-title { font-size: 20px; margin: 4px 0 4px; }
.kb-meta { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.kb-text { font-size: 14px; line-height: 1.6; color: var(--ink); }
.kb-text h3 { font-size: 15px; margin: 18px 0 6px; }
.kb-text p { margin: 0 0 10px; }
.kb-text ul, .kb-text ol { margin: 0 0 10px; padding-left: 22px; }
.kb-text li { margin: 3px 0; }
.kb-text a { color: var(--accent-ink); }
.kb-kw { font-size: 12px; color: var(--muted); margin-top: 12px; }
.kb-art-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.kb-ed-row { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.kb-ed-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kb-ed-text { min-height: 300px; font-family: inherit; }
.kb-ed-prev { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; max-height: 420px; overflow: auto; }
@media (max-width: 860px) {
  .kb-wrap { grid-template-columns: 1fr; }
  .kb-side { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .kb-side-h { width: 100%; }
  .kb-cat { border: 1px solid var(--line); }
  .kb-ed-cols { grid-template-columns: 1fr; }
}
/* the panel next to a chat */
.kbp { position: fixed; right: 16px; top: 72px; bottom: 16px; width: 380px; max-width: calc(100vw - 32px); z-index: 56; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.kbp-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); }
.kbp-head svg { width: 16px; height: 16px; color: var(--accent-ink); }
.kbp-search { padding: 10px 12px 4px; }
.kbp-search .search { margin: 0; }
.kbp-body { flex: 1; overflow: auto; padding: 6px 12px 12px; }
.kbp-h { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 10px 2px 6px; }
.kbp-art .kb-art-title { font-size: 16px; }
.kbp-tools { position: sticky; bottom: -12px; background: var(--panel); display: flex; gap: 8px; padding: 10px 0 2px; border-top: 1px solid var(--line); margin-top: 10px; }
@media (max-width: 860px) { .kbp { top: auto; height: 75vh; right: 8px; left: 8px; width: auto; bottom: 8px; } }
/* The chat header never pushes Close off the edge: when the buttons do not fit
   next to the name (player card open, Take showing), they move to a second line. */
.ch-title { flex-wrap: wrap; row-gap: 6px; }
.ch-title .ch-tools { margin-left: auto; }
/* Team chat: threads about a player show the player's initials on a soft square. */
.int-ch-ic.side { background: var(--accent-soft-2); color: var(--accent-ink); border-radius: 8px; font-size: 11px; font-weight: 700; }
/* Pictures in knowledge base articles */
.kb-fig { margin: 12px 0 16px; }
.kb-fig img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); background: #fff; }
.kb-fig figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kbp .kb-fig img { max-width: 100%; }
.kb-ed-tools { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
/* Team chat: tags copied to DMs / General, removing player threads */
.int-composer { position: relative; }
.int-link { display: block; border: none; background: rgba(7,159,76,0.10); color: var(--accent); font: inherit; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; margin: 2px 0 5px; cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.int-link:hover { background: rgba(7,159,76,0.18); }
.int-hide { visibility: hidden; color: var(--muted); font-size: 12px; padding: 2px 5px; border-radius: 5px; line-height: 1; }
.int-chan:hover .int-hide, .int-hide:focus { visibility: visible; }
.int-hide:hover { background: rgba(0,0,0,0.07); color: var(--ink); }
@media (hover: none) { .int-hide { visibility: visible; } }
