/* ============================================================
   Mitra Chat — Supervisor Console · design system
   World: ISP fiber support. Light = signal through glass.
   Depth: soft layered shadows + optical halo. Light mode.
   ============================================================ */

:root {
  /* — canvas & surfaces — */
  --canvas:        #F7F8F7;
  --canvas-grad:   none;
  --glass:         rgba(255,255,255,0.95);
  --glass-solid:   #FFFFFF;
  --inset:         #F0F2F5;
  --surface:       #FFFFFF;
  --thread-bg:    #E9EDF4;
  --chrome:        #D6CFE2;
  --rail-bg:      #D6CFE2;
  --rail-active:  #C6BCD9;
  --mine:         #DFF7D7;
  --mine-border:  rgba(31,168,85,0.16);

  /* — ink: graphite scale, not black — */
  --ink:        #111B21;
  --ink-soft:   #3B4A54;
  --ink-muted:  #667781;
  --ink-faint:  #8696A0;

  /* — action accent: violet — the brand colour for chrome, active, unread, send,
     and app actions. Kept clear of the optical-signal hues (teal --good, amber,
     red) AND of the green conversation voice, so "brand" never reads as "signal"
     or as "the customer's words". — */
  --accent:       #6E56CF;
  --accent-press: #5A45B5;
  --accent-tint:  rgba(110,86,207,0.10);
  --accent-tint-2: rgba(110,86,207,0.18);

  /* Compatibility aliases used by existing component rules. */
  --violet:        var(--accent);
  --violet-press:  var(--accent-press);
  --violet-tint:   var(--accent-tint);
  --violet-tint-2: var(--accent-tint-2);

  /* — human / operator chrome (queue status tag/chip): blue, part of the app — */
  --human:       var(--accent);
  --human-tint:  var(--accent-tint);

  /* — conversation voice: the green message register (bubbles + sender labels).
     Deliberately distinct from the blue chrome accent — green is the chat, blue
     is the app. Kept clear of the teal --good signal LED. — */
  --voice:       #1FA855;

  /* — optical signal: ONU status LEDs + 650nm fault locator — */
  --good:      #14B8A0;   /* healthy light in glass        */
  --marginal:  #E1A33D;   /* ONU warning LED               */
  --lost:      #E2564B;   /* fault-locator red · LOS       */
  --dark:      #ABA6B6;   /* no light · offline            */

  /* — lines: soft separators — */
  --line:        rgba(17,27,33,0.10);
  --line-soft:   rgba(17,27,33,0.06);
  --line-strong: rgba(17,27,33,0.16);

  /* — shadows: whisper-quiet, layered, cool — */
  --shadow-sm:    0 1px 2px rgba(17,27,33,0.06);
  --shadow-card:  0 1px 2px rgba(17,27,33,0.05), 0 10px 26px rgba(17,27,33,0.08);
  --shadow-float: 0 2px 6px rgba(17,27,33,0.07), 0 18px 50px rgba(17,27,33,0.14);
  --glow-violet:  0 8px 22px rgba(110,86,207,0.24);

  /* — radius: generous / calm — */
  --r-sm:   10px;
  --r-md:   16px;
  --r-lg:   22px;
  --r-pill: 999px;

  /* — type — */
  --sans: "General Sans", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;
}

/* — dark theme: same token names, dark surfaces; voices + signal LEDs kept — */
html[data-theme="dark"] {
  /* Surfaces: a soft, warm-cool dark with a violet undertone — deliberately NOT
     near-black. Neutral working panels are framed by violet brand chrome (the rail
     + the chat top bar), the dark sibling of the light lavender-rail / white-panel
     stack. Luminance climbs canvas → thread → surface → inset → glass-solid; the
     chrome sits apart by being chromatic, not by being darker. */
  --canvas:        #1A1822;   /* floor — soft, never black                          */
  --canvas-grad:
    radial-gradient(1200px 820px at 86% -16%, rgba(140,114,238,0.18) 0%, rgba(140,114,238,0) 60%),
    radial-gradient(1000px 700px at -6% 4%, rgba(116,146,236,0.09) 0%, rgba(116,146,236,0) 55%),
    linear-gradient(180deg, #201C2C 0%, #18151F 100%);
  --glass:         rgba(48,45,62,0.72);
  --glass-solid:   #322F42;   /* most-elevated: popovers, input card, field focus   */
  --inset:         #2B2838;   /* wells: search, segmented, customer bubble          */
  --surface:       #24222F;   /* panels — comfortable working surface, not black    */
  --thread-bg:     #1E1C28;   /* chat scroll + composer — a calm step under panels  */
  --chrome:        #271F4A;   /* chat top bar — clearly violet                      */
  --rail-bg:       #2C2253;   /* left rail — the richer brand violet                */
  --rail-active:   #3B2E6E;   /* lifted violet for rail hover / active              */
  --mine:          rgba(28,176,122,0.20);
  --mine-border:   rgba(28,176,122,0.34);

  --ink:        #EEEFF4;
  --ink-soft:   #CBCED9;
  --ink-muted:  #9398AB;
  --ink-faint:  #71768A;

  --accent:        #9A8AF2;
  --accent-press:  #B3A6F7;
  --accent-tint:   rgba(154,138,242,0.18);
  --accent-tint-2: rgba(154,138,242,0.30);

  --violet:        var(--accent);
  --violet-press:  var(--accent-press);
  --violet-tint:   var(--accent-tint);
  --violet-tint-2: var(--accent-tint-2);

  --human:       var(--accent-press);
  --human-tint:  var(--accent-tint);
  --voice:       #1FC08A;   /* emerald — balanced, not the neon mint it was        */

  --good:      #2DD4BF;
  --marginal:  #ECB45A;
  --lost:      #F06A5F;
  --dark:      #6F7388;

  --line:        rgba(255,255,255,0.10);
  --line-soft:   rgba(255,255,255,0.06);
  --line-strong: rgba(255,255,255,0.18);

  --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
  --shadow-card:  0 1px 2px rgba(0,0,0,0.35), 0 10px 26px rgba(0,0,0,0.45);
  --shadow-float: 0 2px 6px rgba(0,0,0,0.4), 0 18px 50px rgba(0,0,0,0.6);
  --glow-violet:  0 8px 26px rgba(154,138,242,0.42);

  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas) var(--canvas-grad) fixed;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--violet-tint-2); }

/* subtle scrollbars */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.14); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,0.24); background-clip: content-box; }
html[data-theme="dark"] *::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); background-clip: content-box; }
html[data-theme="dark"] *::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); background-clip: content-box; }
/* tooltip: in dark the ink token flips to near-white, making the dark tooltip unreadable; pin to a dark surface */
html[data-theme="dark"].rail-collapsed [data-tip]:hover::after { background: var(--inset); }

/* ============================================================ LAYOUT */
/* rail is always icon-only — fixed 68px column */
.app { display: grid; grid-template-columns: 68px 1fr; height: 100vh; }

.rail { display: flex; flex-direction: column; align-items: center;
  padding: 18px 12px; gap: 4px; background: var(--rail-bg); border-right: 1px solid var(--line);
  color: var(--ink-soft);
}
/* dark: the violet chrome gets a soft top→bottom gradient so the rail reads as a
   lit surface with depth, not a flat slab. */
html[data-theme="dark"] .rail {
  background: linear-gradient(180deg, #312657 0%, #281F49 100%);
}
.isp-chip {
  margin-left: auto; font-size: 11px; font-weight: 500; color: var(--ink-soft);
  background: var(--glass-solid); border: 1px solid var(--line-soft);
  padding: 3px 9px; border-radius: var(--r-pill); box-shadow: var(--shadow-sm);
}
.nav { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-foot { margin-top: auto; padding-top: 12px; }
.op-wrap { position: relative; }
.op { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm);
  width: 100%; transition: background .14s ease; }
.op:hover { background: var(--rail-active); }
.op[aria-expanded="true"] { background: var(--rail-active); }
.op-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; line-height: 1; color: #fff; flex: none;
  background: var(--accent-press); /* fallback where color-mix() is unsupported */
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 74%, #fff), var(--accent-press));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28); }
.op-name { font-size: 13px; font-weight: 600; }
.op-role { font-size: 11px; color: var(--ink-muted); }
.op-chevron { width: 14px; height: 14px; margin-left: auto; color: var(--ink-faint);
  flex: none; transition: transform .18s ease; transform: rotate(180deg); }
.op[aria-expanded="true"] .op-chevron { transform: rotate(0deg); }

/* operator popover — a small account card that floats wider than the narrow icon rail.
   Grows out of the avatar (bottom-left origin) so it reads as belonging to it. */
@keyframes op-pop-in {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.op-popover { position: absolute; bottom: calc(100% + 10px); left: 0; width: 224px;
  background: var(--glass-solid); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-float);
  padding-bottom: 4px; overflow: hidden; z-index: 200;
  transform-origin: bottom left; animation: op-pop-in .16s cubic-bezier(.16,1,.3,1); }
.op-popover[hidden] { display: none; }
/* account card header: name/role only — the avatar already sits in the rail just
   below the popover, so repeating it here is redundant. */
.op-pop-head { padding: 14px 16px 12px; }
.op-pop-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.op-pop-name { font-size: 14px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-pop-sub { font-size: 12px; line-height: 1.2; color: var(--ink-muted); }
.op-pop-sep { height: 1px; background: var(--line-soft); margin: 0 0 4px; }
.op-pop-item { display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px; font-size: 13px; color: var(--ink-soft);
  transition: background .12s ease, color .12s ease; }
.op-pop-item .ico { width: 16px; height: 16px; flex: none; color: var(--ink-muted);
  transition: color .12s ease; }
/* neutral items lean on the brand violet; logout leans destructive-red — the two
   menu rows shouldn't feel identical. */
.op-pop-item:hover { background: var(--accent-tint); color: var(--ink); }
.op-pop-item:hover .ico { color: var(--accent); }
.op-pop-item:active { background: var(--accent-tint-2); }
.op-pop-logout:hover { background: color-mix(in srgb, var(--lost) 12%, transparent); color: var(--lost); }
.op-pop-logout:hover .ico { color: var(--lost); }
.op-pop-logout:active { background: color-mix(in srgb, var(--lost) 20%, transparent); }

/* ---- main: three floating glass panels ---- */
.main { display: grid; grid-template-columns: 320px minmax(0,1fr) 288px;
  gap: 12px; padding: 14px 14px 14px 2px; min-width: 0; }

/* ============================================================ INBOX (Operator) */
.inbox { display: flex; flex-direction: column; height: 100vh; min-width: 0; }
/* Conversas and Contexto are equal-width side panels framing the conversation. */
.inbox-body { flex: 1; display: grid; grid-template-columns: 340px minmax(0,1fr) 340px;
  min-width: 0; min-height: 0; }

/* WhatsApp-style flush columns: solid surfaces divided by hairlines, no floating
   cards. Selectors are doubled (.panel.x) to outrank the base .panel card rule,
   which is defined later in the file — otherwise its radius/shadow/glass win. */
.panel.queue-panel, .panel.thread-panel, .panel.context-panel {
  background: var(--surface); border: none; border-radius: 0; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.panel.queue-panel  { border-right: 1px solid var(--line); }
.panel.thread-panel { border-right: 1px solid var(--line); }
/* empty chat area (no conversation selected) keeps the thread background, not white */
.panel.thread-panel.placeholder-panel { background: var(--thread-bg); }

/* queue-live is a polled fragment wrapper — make it grid-transparent so the
   inner .queue-panel becomes the direct grid child and stretches to full height */
.queue-live { display: contents; }

/* queue search */
/* search reads as an inset well (slate-100) on the near-white panel, lifting to white on focus */
.queue-search { display: flex; align-items: center; gap: 7px; margin-top: 8px;
  background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 7px 10px; transition: border-color .14s ease, background .14s ease; }
.queue-search:focus-within { border-color: var(--line-strong); background: var(--glass-solid); }
.queue-search .ico { width: 13px; height: 13px; color: var(--ink-faint); flex: none; }
.queue-search input { flex: 1; border: none; outline: none; background: none; font: inherit;
  font-size: 12.5px; color: var(--ink); }
.queue-search input::placeholder { color: var(--ink-faint); }

/* ============================================================ QUEUE TOGGLE */
/* Segmented control over the three human-state groups. The active segment expands
   to show its label (so you always know what's selected) as a raised white chip;
   inactive segments stay compact (icon + count). No tooltips. Active state is
   driven by [data-filter] on .inbox, so it survives every queue-fragment swap. */
.seg { display: flex; gap: 3px; margin-top: 10px; padding: 3px;
  background: var(--inset); border: 1px solid var(--line-soft); border-radius: var(--r-pill); }
.seg-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 4px; border: none; background: none; border-radius: calc(var(--r-pill) - 3px);
  color: var(--ink-muted); cursor: pointer; transition: color .14s ease, background .14s ease, box-shadow .14s ease; }
.seg-btn .ico { width: 15px; height: 15px; flex: none; }
.seg-n { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.seg-btn:hover { color: var(--ink-soft); }
/* active segment = a raised white chip (icon + count; no tooltip, no label). */
.inbox[data-filter="handoff_requested"] .seg-btn[data-filter-status="handoff_requested"],
.inbox[data-filter="human_active"]      .seg-btn[data-filter-status="human_active"],
.inbox[data-filter="bot_active"]        .seg-btn[data-filter-status="bot_active"] {
  background: var(--glass-solid); color: var(--ink); box-shadow: var(--shadow-sm);
}
/* Show only the active group's cards (and its empty-state). Both carry data-status. */
.inbox[data-filter="handoff_requested"] [data-status]:not([data-status="handoff_requested"]),
.inbox[data-filter="human_active"]      [data-status]:not([data-status="human_active"]),
.inbox[data-filter="bot_active"]        [data-status]:not([data-status="bot_active"]) { display: none; }
.queue-empty { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--ink-muted); }
.queue-empty--all { display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 56px 16px; color: var(--ink-faint); }
.qe-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--inset); color: var(--ink-faint); }
.qe-icon .ico { width: 22px; height: 22px; }
.panel {
  background: var(--glass); backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.panel-head { padding: 18px 20px 12px; }
.panel-head-row { display: flex; align-items: flex-start; justify-content: space-between; }
.panel-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.panel-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
/* '+ conversa' placeholder — affordance only (initiating not wired yet, em breve). */
.newconv-btn { padding: 5px; border-radius: var(--r-sm); color: var(--ink-faint); cursor: default; }
.newconv-btn .ico { width: 16px; height: 16px; display: block; }

/* ============================================================ QUEUE */
/* Inset rows with breathing room — selection is a floating rounded highlight
   (macOS-sidebar register), never a full-bleed block. No dividers; whitespace
   separates rows. The list shares the header's 20px side inset, so the selection
   highlight lines up flush with the search field + toggle above (no overhang). */
.queue { flex: 1; overflow: auto; padding: 6px 20px; display: flex; flex-direction: column; gap: 2px; }
.qcard {
  display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center;
  width: 100%; text-align: left; padding: 10px 10px; border-radius: 10px;
  transition: background .14s ease;
}
.qcard:hover { background: var(--rail-bg); }
/* in dark the rail is a deep violet (darker than the panel), so hovering to it
   reads as a dip; lift with a faint white wash instead. */
html[data-theme="dark"] .qcard:hover { background: rgba(255,255,255,0.045); }
/* selected = a whisper-faint inset rounded fill — present but never loud. */
.qcard.sel { background: #ECEFF3; }
html[data-theme="dark"] .qcard.sel { background: rgba(255,255,255,0.07); }
html[data-theme="dark"] .qcard.sel:hover { background: rgba(255,255,255,0.09); }
.qmain { min-width: 0; }
.who { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snip { color: var(--ink-muted); font-size: 12.5px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qmeta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.time { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

/* ---- avatar + optical signal as presence dot (the signature) ---- */
.avatar { position: relative; width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: var(--inset); }
.avatar .ico { width: 18px; height: 18px; color: var(--ink-faint); }
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
/* profile photo overlays the placeholder icon; on load it covers it, on error
   (no photo / fetch failed) JS adds .is-broken and the icon shows through. */
.avatar-photo { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%; }
.avatar-photo.is-broken { display: none; }

.signal { width: 11px; height: 11px; border-radius: 50%; flex: none; display: inline-block; }
.avatar .signal { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--glass-solid); }
.avatar.lg .signal { width: 13px; height: 13px; }
.signal--good     { background: radial-gradient(circle at 34% 32%, #79E6D6, var(--good));
  box-shadow: 0 0 0 3px rgba(20,184,160,0.12), 0 0 9px 1px rgba(20,184,160,0.50); }
.signal--marginal { background: radial-gradient(circle at 34% 32%, #F3CE8C, var(--marginal));
  box-shadow: 0 0 0 3px rgba(225,163,61,0.12), 0 0 9px 1px rgba(225,163,61,0.45); }
.signal--lost     { background: radial-gradient(circle at 34% 32%, #F0897E, var(--lost));
  box-shadow: 0 0 0 3px rgba(226,86,75,0.13), 0 0 10px 1px rgba(226,86,75,0.45);
  animation: pulse 2.6s ease-in-out infinite; }
.signal--dark     { background: var(--dark); opacity: .65; }
.signal--alert    { background: radial-gradient(circle at 34% 32%, #F3CE8C, var(--marginal));
  animation: pulse-alert 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(226,86,75,0.13), 0 0 8px 1px rgba(226,86,75,0.35); }
  50% { box-shadow: 0 0 0 3px rgba(226,86,75,0.16), 0 0 13px 2px rgba(226,86,75,0.55); } }
@keyframes pulse-alert { 0%,100% { box-shadow: 0 0 0 3px rgba(225,163,61,0.13), 0 0 8px 1px rgba(225,163,61,0.35); }
  50% { box-shadow: 0 0 0 3px rgba(225,163,61,0.22), 0 0 13px 2px rgba(225,163,61,0.55); } }

/* ---- tiny state tags ---- */
.tag { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; padding: 2px 7px;
  border-radius: var(--r-pill); white-space: nowrap; }
.tag-wait  { color: var(--accent); background: var(--accent-tint-2); }
.tag-you   { color: var(--human);  background: var(--human-tint); }
.tag-bot   { color: var(--ink-muted); background: var(--inset); }
.tag-risk  { color: var(--marginal); background: rgba(225,163,61,0.13); }

/* ============================================================ THREAD */
.thread-panel { padding: 0; }
.thread-head { display: flex; align-items: center; gap: 13px; padding: 16px 22px;
  background: var(--chrome); border-bottom: 1px solid var(--line-soft); }
/* dark: violet header gets the same lit gradient as the rail (its sibling chrome). */
html[data-theme="dark"] .thread-head {
  background: linear-gradient(180deg, #2C2350 0%, #251E44 100%); }
.thread-who { min-width: 0; flex: 1; }
.tw-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.tw-handle { font-family: var(--mono); font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500;
  color: var(--ink-soft); background: var(--glass-solid); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: var(--r-pill); }
.chip--ok { color: var(--good); background: rgba(20,184,160,0.10); border-color: rgba(20,184,160,0.25); }
html[data-theme="dark"] .chip--ok { background: rgba(45,212,191,0.14); border-color: rgba(45,212,191,0.30); }
.chip--muted { color: var(--ink-muted); background: var(--inset); }
.chip--mono { font-family: var(--mono); color: var(--ink-muted); }
.chip--signal { color: var(--ink-soft); }
.chip--signal .signal { width: 8px; height: 8px; }
.chip--state { font-weight: 600; }
.chip--state-human_active { color: var(--human); background: var(--human-tint); border-color: var(--accent-tint-2); }
.chip--state-handoff_requested { color: var(--accent); background: var(--accent-tint); border-color: var(--accent-tint-2); }
.chip--state-bot_active { color: var(--accent); background: var(--accent-tint); border-color: var(--accent-tint-2); }
.chip--state-closed { color: var(--ink-muted); background: var(--inset); }
.instrument { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none;
  padding: 7px 13px 7px 11px; background: var(--inset); border-radius: var(--r-pill); }
.instrument .rx { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.instrument .rx .unit { color: var(--ink-muted); }
.instrument .lbl { font-size: 10.5px; color: var(--ink-muted); margin-top: 1px; }

.thread-body { flex: 1; overflow: auto; padding: 22px 30px; display: flex; flex-direction: column; gap: 2px;
  background: var(--thread-bg); }
.thread-body::before { content: ""; margin-top: auto; }
/* grouped messages: one label per sender run, tight stacking, air between groups */
.msg-group { display: flex; flex-direction: column; margin-top: 16px; }
.msg-group:first-child { margin-top: 0; }
.msg-group.cliente { align-items: flex-start; }
.msg-group.zaulo, .msg-group.atendente { align-items: flex-end; }
.msg-group .msg { margin-top: 3px; }
.msg-group .msg:first-of-type { margin-top: 0; }
/* markdown inside bubbles */
.bubble strong { font-weight: 600; }
.bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble code { font-family: var(--mono); font-size: .92em; background: var(--inset);
  padding: 1px 5px; border-radius: 6px; }

/* day separator — calm centered hairline + pill */
.day-sep { display: flex; align-items: center; gap: 12px; margin: 18px 2px 6px; }
.day-sep::before, .day-sep::after { content: ""; height: 1px; flex: 1; background: var(--line-soft); }
.day-sep span { font-size: 11px; font-weight: 600; letter-spacing: .03em; color: var(--ink-muted);
  background: var(--inset); padding: 3px 12px; border-radius: var(--r-pill); }
.msg { max-width: 76%; display: flex; flex-direction: column; }
/* One uniform bubble shape for every voice — same rounded rectangle; only side +
   colour distinguish customer / bot / operator (no mirrored speech-bubble tail).
   The bubble is a wrapping flex row so the timestamp tucks at the bottom-right:
   inline for short messages, on its own corner line for long ones (WhatsApp). */
.msg .bubble { padding: 9px 13px; border-radius: 16px; font-size: 14px; color: var(--ink);
  display: flex; flex-wrap: wrap; align-items: flex-end; }
.btxt { min-width: 0; }
.btime { margin-left: auto; padding-left: 10px; font-family: var(--mono); font-size: 10px;
  color: var(--ink-faint); line-height: 1; white-space: nowrap; }
.send-fail, .send-pending { flex-basis: 100%; }

.msg.cliente { align-self: flex-start; }
.msg.cliente .bubble { background: var(--glass-solid); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm); }
/* dark: customer keeps the light recipe exactly — glass-solid surface + soft
   hairline + soft shadow, all token-driven — so it's the dark twin of the white
   incoming bubble. (No background override needed; the base rule's tokens adapt.) */

/* Outgoing voices share the Cliente bubble's lifted look (border + shadow); they
   differ only by hue — Zaulo = blue (the bot/app), Atendente = green (the human). */
.msg.zaulo { align-self: flex-end; }
.msg.zaulo .bubble { background: #E8F0FE; border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm); }
/* dark: same shape/lift as light, hue kept (blue) and darkened; light ink for read. */
html[data-theme="dark"] .msg.zaulo .bubble { background: #32497C; color: #F2F5FB; }

.msg.atendente { align-self: flex-end; }
.msg.atendente .bubble { background: var(--mine); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm); }
/* dark: the operator's green, kept in light's grass-green hue and darkened. */
html[data-theme="dark"] .msg.atendente .bubble { background: #2A6B43; color: #F1FBF4; }

/* timestamps sit on the darker fills — translucent white reads cleaner than ink-faint. */
html[data-theme="dark"] .msg.zaulo .btime,
html[data-theme="dark"] .msg.atendente .btime { color: rgba(255,255,255,0.6); }
html[data-theme="dark"] .msg.zaulo .bubble a,
html[data-theme="dark"] .msg.atendente .bubble a { color: #fff; }

.msg.system { align-self: center; max-width: 90%; }
.msg.system .bubble { display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  font-size: 12px; color: var(--ink-muted); background: transparent;
  border: 1px dashed var(--line-strong); border-radius: var(--r-pill); }
.msg.system .ico { width: 13px; height: 13px; }

/* ---- composer / takeover (DIA-style floating bar) ---- */
.composer { padding: 14px 18px 18px; position: relative;
  background: var(--thread-bg); border-top: none; }
.composer-card { background: var(--glass-solid); border: 1px solid var(--line-soft);
  border-radius: 18px; box-shadow: var(--shadow-float); padding: 7px; }
/* handoff prompt: minimal — just the centered CTA (state already shown in the queue). */
.assumir-bar { display: flex; justify-content: center; padding: 8px 4px 4px; }
.btn-primary { flex: none; background: var(--violet); color: #fff; font-weight: 600; font-size: 13.5px;
  padding: 11px 18px; border: none; border-radius: var(--r-sm); box-shadow: var(--glow-violet);
  cursor: pointer; transition: background .14s ease, transform .14s ease, box-shadow .14s ease; }
.btn-primary:hover { background: var(--violet-press); box-shadow: 0 10px 28px rgba(110,86,207,0.38); }
.btn-primary:active { transform: translateY(1px); }
/* the takeover CTA: pill + headset icon (you're about to put on the headset). */
.btn-assumir { display: inline-flex; align-items: center; gap: 8px; border-radius: var(--r-pill);
  padding: 11px 22px; font-size: 13.5px; }
.btn-assumir .ico { width: 16px; height: 16px; flex: none; }

/* ---- reply row ---- */
.reply { display: flex; align-items: flex-end; gap: 8px; padding: 4px 4px 4px 14px; }
.reply textarea { flex: 1; border: none; outline: none; background: none; font: inherit;
  color: var(--ink); padding: 10px 0; resize: none; overflow-y: hidden;
  min-height: 40px; max-height: 180px; line-height: 1.5; }
.reply textarea::placeholder { color: var(--ink-faint); }

/* icon-only send button */
/* Send button: a quiet round affordance — muted/idle while the field is empty,
   it fills with the operator's green (the message you're about to send) the moment
   there's text, with a gentle pop. The .has-text state is toggled in ui.js. */
.btn-send { flex: none; width: 40px; height: 40px; display: inline-flex; align-items: center;
  justify-content: center; border: none; border-radius: 50%;
  background: var(--inset); color: var(--ink-faint); cursor: default;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
/* the paper-plane's visual mass leans up-right; nudge to optically centre it. */
.btn-send .ico { width: 17px; height: 17px; transform: translate(-1px, 1px); }
.reply.has-text .btn-send { background: var(--voice); color: #fff; cursor: pointer;
  box-shadow: 0 4px 14px rgba(31,168,85,0.32); transform: scale(1.05); }
.reply.has-text .btn-send:hover { filter: brightness(0.96); }
.reply.has-text .btn-send:active { transform: scale(0.98); }

/* ---- encerrar atendimento — context panel footer ---- */
/* resolve action flows after the context with clear separation (not pinned). */
.ctx-close { margin-top: 24px; }
.close-form { display: flex; flex-direction: column; gap: 8px; }
.close-form input { width: 100%; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  outline: none; background: var(--inset); font: inherit; color: var(--ink);
  padding: 9px 12px; transition: border-color .14s ease, background .14s ease; }
.close-form input:focus { border-color: var(--line-strong); background: var(--glass-solid); }
.close-form input::placeholder { color: var(--ink-faint); }
/* resolve/close CTA — a solid filled pill, mirroring the blue "Assumir" button
   but in green (green = resolve/done). */
.btn-close { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  align-self: center; font-weight: 600; font-size: 13.5px; color: #fff;
  background: var(--voice); border: none; border-radius: var(--r-pill);
  padding: 11px 22px; cursor: pointer; box-shadow: 0 6px 18px rgba(31,168,85,0.26);
  transition: filter .14s ease, box-shadow .14s ease; }
.btn-close .ico { width: 16px; height: 16px; }
.btn-close:hover { filter: brightness(0.96); box-shadow: 0 10px 26px rgba(31,168,85,0.34); }
.btn-close:active { transform: translateY(1px); }

/* closed banner reuses the takeover shell, muted */
.closed-banner { display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.closed-banner .ico { width: 16px; height: 16px; color: var(--voice); }

/* inline send-status notes in the transcript (never hide a failure) */
.send-fail { margin-top: 6px; font-size: 11.5px; color: var(--lost); }
.send-pending { margin-top: 6px; font-size: 11.5px; color: var(--ink-muted); }
.send { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--violet); color: #fff; box-shadow: var(--glow-violet); flex: none; }
.send:hover { background: var(--violet-press); }
.send .ico { width: 18px; height: 18px; }

/* ============================================================ CONTEXT */
/* Header: title + identification badge. */
.ctx-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.id-badge { flex: none; display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: var(--r-pill); }
.id-badge .id-ico { width: 13px; height: 13px; }
.id-badge--ok { color: var(--voice); background: rgba(31,168,85,0.12); }
.id-badge--no { color: var(--ink-muted); background: var(--inset); padding-left: 10px; }

.ctx-body { flex: 1; overflow: auto; padding: 8px 20px 20px; }
.ctx-muted { color: var(--ink-faint); }

/* group label — spacing is the divider, no hairline clutter. */
.ctx-section-label { font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-muted); margin: 18px 0 4px; }
.ctx-body > .ctx-section-label:first-child { margin-top: 6px; }

.ctx-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; }
.ctx-row .k { color: var(--ink-muted); font-size: 12.5px; flex: none; }
.ctx-row .v { font-weight: 500; font-size: 12.5px; color: var(--ink-soft); min-width: 0;
  display: flex; align-items: center; gap: 7px; justify-content: flex-end; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-row .v.mono, .ctx-row .mono { font-family: var(--mono); font-size: 12px; }
.ctx-sig .signal { width: 9px; height: 9px; }

/* ONU section: severity-tinted readings; the Sinal row carries ONU + OLT inline. */
.dbm--good { color: #0E8C7D; }
.dbm--marginal, .dbm--bad { color: #B07A1E; }
.dbm--no_signal { color: #C8453B; }
.onu-sinal { gap: 6px; }
.onu-leg { font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .02em; color: var(--ink-faint); }
.onu-leg + .onu-leg, .v .onu-leg:not(:first-child) { margin-left: 4px; }

.ctx-empty { padding: 6px 0 2px; color: var(--ink-faint); font-size: 12.5px; line-height: 1.45; }

/* not-identified: a single calm icon (the badge already says "Não identificado"). */
.ctx-empty-state { display: flex; align-items: center; justify-content: center; padding: 52px 8px; }
.ces-icon { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--inset); color: var(--ink-faint); }
.ces-icon .ico { width: 28px; height: 28px; }
.ctx-note--plain { margin-top: 8px; background: var(--inset); border: none; color: var(--ink-muted); }

/* neutral inset card for the handoff reason. */
.ctx-note { margin-top: 18px; padding: 12px 14px; background: var(--inset);
  border: 1px solid var(--line-soft); border-radius: var(--r-md); font-size: 12.5px; color: var(--ink-soft); }
.ctx-note .lab { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-muted); margin-bottom: 4px; }

/* ============================================================ PERSONALIZAR (Manual editor) */
/* Focused single column on the canvas — a calm settings page, same clean language
   as the chat tab. */
.editor { height: 100vh; overflow: auto; background: var(--canvas) var(--canvas-grad) fixed; }
.editor-col { max-width: 680px; margin: 0 auto; padding: 26px 24px 64px; }

/* nome — the field hugs the name (snug for short, grows as typed), never a wide
   box with the name floating in empty space. */
.ed-name-input { font-family: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink);
  field-sizing: content; width: auto; min-width: 120px; max-width: 100%;
  margin-top: 12px; padding: 6px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .14s ease, box-shadow .14s ease; }
.ed-name-input::placeholder { color: var(--ink-faint); font-weight: 500; }
.ed-name-input:hover { border-color: var(--line-strong); }
.ed-name-input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint); }

.form-error { margin: 0 0 6px; padding: 10px 14px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; color: var(--lost);
  background: rgba(226,86,75,0.10); border: 1px solid rgba(226,86,75,0.22); }

/* guided section: title + helper + field */
.ed-sec { margin-top: 26px; }
.ed-sec--first { margin-top: 4px; }
.ed-sh { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.ed-sh .ico { width: 16px; height: 16px; color: var(--accent); flex: none; }
.ed-field { width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink); padding: 12px 14px;
  resize: vertical; line-height: 1.55; transition: border-color .14s ease, box-shadow .14s ease; }
.ed-field::placeholder { color: var(--ink-faint); }
.ed-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.ed-field--tall { min-height: 220px; }

/* anexos — uploaded .txt files as light, content-width chips + a quiet add link */
.ed-doc-error { display: flex; align-items: center; gap: 7px; margin-top: 12px; padding: 8px 11px;
  font-size: 12.5px; font-weight: 500; color: var(--lost); border-radius: var(--r-sm);
  background: rgba(226,86,75,0.10); }
.ed-doc-error .ico { width: 15px; height: 15px; flex: none; }
.ed-docs { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ed-doc { display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 6px 7px 6px 11px; border-radius: var(--r-pill); background: var(--inset); }
.ed-doc-ic { display: flex; flex: none; }
.ed-doc-ic .ico { width: 14px; height: 14px; color: var(--ink-muted); }
.ed-doc-name { font-size: 12.5px; font-weight: 500; color: var(--ink); min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.ed-doc-del { display: flex; flex: none; }
.ed-doc-del button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  border: none; background: none; border-radius: 50%; color: var(--ink-faint); cursor: pointer;
  transition: color .14s ease, background .14s ease; }
.ed-doc-del button:hover { color: var(--lost); background: rgba(226,86,75,0.12); }
.ed-doc-del .ico { width: 13px; height: 13px; }
.ed-upload { margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--accent); transition: color .14s ease; }
.ed-upload:hover { color: var(--accent-press); }
.ed-upload .ico { width: 15px; height: 15px; }

/* personality preset pills — click to insert their meaning into the field */
.ed-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ed-pill { font-size: 12.5px; font-weight: 500; color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 5px 14px; cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease,
    box-shadow .16s ease, transform .12s ease; }
.ed-pill:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.ed-pill:active { transform: translateY(1px); }
/* single-select: the chosen personality is outlined — crisp violet ring + violet
   bold text on the plain surface (no fill). */
.ed-pill.is-on { color: var(--accent); font-weight: 600; background: var(--surface);
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ed-pill.is-on:hover { color: var(--accent); background: var(--surface);
  border-color: var(--accent); }

/* ações permitidas — toggle card */
.ed-acts { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden; }
.ed-act { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line-soft); }
.ed-act:first-child { border-top: none; }
.ed-act-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-press); flex: none; }
.ed-act-ic .ico { width: 16px; height: 16px; }
.ed-act-main { flex: 1; min-width: 0; }
.ed-act-n { font-size: 13.5px; font-weight: 600; }
.ed-act-d { font-size: 11.5px; color: var(--ink-muted); margin-top: 1px; }
.ed-act.is-off { opacity: .6; }
.ed-act.is-off .ed-act-ic { background: var(--inset); color: var(--ink-faint); }
.req { color: var(--marginal); font-weight: 500; }

/* checkbox switch (violet when on) */
.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong);
  position: relative; flex: none; transition: background .14s ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .16s ease; }
.switch-field { flex: none; cursor: pointer; display: inline-flex; }
.switch-field input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-field input:checked + .switch { background: var(--accent); }
.switch-field input:checked + .switch::after { transform: translateX(16px); }
.switch-field--disabled { cursor: not-allowed; opacity: .5; }
/* locked-on: a security capability that is always active (disabled but clearly on) */
.switch-field--locked { cursor: not-allowed; }
.switch-field--locked .switch { background: var(--accent); opacity: .5; }

/* ============================================================ LOGIN */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 384px; background: var(--glass-solid);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  box-shadow: var(--shadow-float); padding: 38px 34px 34px;
}
/* pure-type wordmark — no icon (yet). Brand violet sits on the second word so the
   identity carries colour without an icon. It's the only thing above the form. */
.login-wordmark { font-size: 24px; font-weight: 700; letter-spacing: -0.03em;
  color: var(--ink); margin-bottom: 28px; }
.login-wordmark span { color: var(--accent); margin-left: 7px; }
.login-error {
  margin-bottom: 16px; padding: 10px 13px; border-radius: var(--r-sm); font-size: 12.5px;
  color: var(--lost); background: rgba(226,86,75,0.10); border: 1px solid rgba(226,86,75,0.20);
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
/* placeholder-style label: the label sits inside the empty field and gently fades
   out the moment the field is focused or filled — minimal, no static labels above. */
.field { position: relative; }
.field-input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 13px 14px; outline: none;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.field-label {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  font-size: 15px; color: var(--ink-faint); pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}
/* placeholder is a single space, so :placeholder-shown == empty field */
.field-input:focus + .field-label,
.field-input:not(:placeholder-shown) + .field-label {
  opacity: 0; transform: translateY(-50%) translateX(2px);
}
.field-input:focus { background: var(--glass-solid); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint-2); }
.login-form .btn-primary { margin-top: 8px; padding: 13px; font-size: 14px; }

/* ============================================================ PLACEHOLDERS */
.placeholder-panel { align-items: stretch; }
.placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 32px; color: var(--ink-muted);
}
.placeholder--sm { justify-content: flex-start; padding: 14px 20px; align-items: flex-start; text-align: left; }
.placeholder-ico { width: 40px; height: 40px; color: var(--ink-faint); margin-bottom: 4px; }
.placeholder-h { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.placeholder-s { font-size: 12.5px; color: var(--ink-muted); max-width: 260px; }

/* operator footer logout */
.logout-link { display: block; margin-top: 6px; padding: 6px 8px; font-size: 12px;
  color: var(--ink-muted); border-radius: var(--r-sm); transition: background .14s ease, color .14s ease; }
.logout-link:hover { background: var(--accent-tint); color: var(--ink-soft); }

/* ============================================================ SOLO PAGE (single panel) */
/* Auditoria + Configurações: one wide centered glass panel. */
.solo-main { grid-template-columns: minmax(0, 1fr); padding: 16px; }
.solo-main > .panel { max-width: 1040px; width: 100%; margin: 0 auto; }

/* shared status pill — calm dot + label, three tones */
.status-pill { flex: none; display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--inset); color: var(--ink-soft); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dark); }
.status--ok    { color: var(--good); background: rgba(20,184,160,0.10); }
.status--ok    .status-dot { background: var(--good); box-shadow: 0 0 7px 1px rgba(20,184,160,.45); }
.status--warn  { color: var(--marginal); background: rgba(225,163,61,0.12); }
.status--warn  .status-dot { background: var(--marginal); }
.status--muted { color: var(--ink-muted); background: var(--inset); }
.status--muted .status-dot { background: var(--ink-faint); }

/* ============================================================ AUDITORIA */
.audit-body { overflow: auto; padding: 4px 14px 16px; }
.audit-head-row, .audit-row {
  display: grid; grid-template-columns: 1.4fr 1.2fr 0.7fr 2fr 1fr;
  gap: 14px; align-items: center; padding: 11px 12px;
}
.audit-head-row { position: sticky; top: 0; background: var(--glass); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.ah { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.ah-time, .ar-time { text-align: right; }
.audit-row { border-top: 1px solid var(--line-soft); }
.audit-row:hover { background: var(--accent-tint); }
.ar { font-size: 12.5px; color: var(--ink-soft); min-width: 0; }
.ar-evt { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--ink); }
.evt-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--accent);
  box-shadow: 0 0 6px 1px rgba(110,86,207,.35); }
.audit-row[data-event="channel_send_failed"] .evt-dot,
.audit-row[data-event="agent_error"] .evt-dot { background: var(--lost); box-shadow: 0 0 6px 1px rgba(226,86,75,.4); }
.conv-ref { font-family: var(--mono); font-size: 12px; color: var(--ink-muted); }
.ar-payload { font-family: var(--mono); font-size: 11.5px; color: var(--ink-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-time { font-size: 11.5px; color: var(--ink-muted); }
.dash { color: var(--ink-faint); }

/* ============================================================ CONFIGURAÇÕES */
.settings-body { overflow: auto; padding: 4px 20px 22px; display: flex; flex-direction: column; gap: 26px; }
.set-group { display: flex; flex-direction: column; }
.set-h { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 6px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-soft); }
.set-row:first-of-type { border-top: none; }
.set-main { min-width: 0; flex: 1; }
.set-n { font-weight: 500; font-size: 13.5px; }
.set-d { font-size: 12px; color: var(--ink-muted); margin-top: 1px; }
.set-note { margin-top: 12px; padding: 12px 14px; background: var(--violet-tint);
  border: 1px solid var(--violet-tint-2); border-radius: var(--r-md);
  font-size: 12px; color: var(--ink-soft); line-height: 1.55; }

/* ============================================================ RAIL (always icon-only) */
.nav-item { display: grid; place-items: center; position: relative;
  width: 42px; height: 42px; border-radius: var(--r-md);
  color: var(--ink); transition: background .14s ease, color .14s ease; }
.nav-item .ico { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--rail-active); color: var(--ink); }
/* active: a subtle deeper-lavender chip (no stark white) + a crisp dark icon;
   the violet "you are here" bar at the edge carries the brand colour. */
.nav-item.active { background: var(--rail-active); color: var(--ink); }
.nav-item.active .ico { color: var(--ink); }
/* left accent bar — the "you are here" marker at the rail edge */
.nav-item.active::before { content: ""; position: absolute; left: -13px; top: 50%;
  transform: translateY(-50%); width: 3px; height: 22px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: 0 0 8px 1px rgba(110,86,207,.35); }

/* divider between nav groups */
.nav-sep { width: 24px; height: 1px; background: var(--line); margin: 6px 0; }
/* gallery placeholder — a clean bare icon tile, matching the nav items */
.gallery-soon-wrap { display: flex; justify-content: center;
  padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.gallery-soon { display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: var(--r-md); color: var(--ink); cursor: default;
  transition: background .14s ease, color .14s ease; }
.gallery-soon .ico { width: 20px; height: 20px; }
.gallery-soon:hover { background: var(--rail-active); color: var(--ink-muted); }
.nav-label, .op-text, .op-chevron { display: none; }
.op { justify-content: center; padding: 8px 0; }
.op-text { min-width: 0; flex: 1; }

/* "coming soon" nav tiles — same crisp icon weight as the active one (just no
   chip/bar), so the rail reads sharp and consistent on the lavender. */
.nav-item--soon { color: var(--ink); cursor: default; }
.nav-item--soon:hover { background: none; color: var(--ink); }

.theme-ico { display: inline-flex; }
.theme-ico--dark { display: none; }
html[data-theme="dark"] .theme-ico--light { display: none; }
html[data-theme="dark"] .theme-ico--dark  { display: inline-flex; }

/* tooltips — always visible since labels are always hidden */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%;
  transform: translateY(-50%); background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 8px;
  white-space: nowrap; box-shadow: var(--shadow-float); z-index: 80; pointer-events: none;
}
/* the rail's dark hover tooltips read as heavy/ugly — suppress them (icons + the
   active highlight carry the rail; data-tip stays for screen readers). */
.rail [data-tip]:hover::after { display: none; }

/* ============================================================ NEWMSG PILL */
.newmsg-pill {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(100% + 10px); /* float just above the composer, whatever its height */
  background: var(--accent, #6E56CF); color: #fff; border: none; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 13px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); z-index: 5;
}
.thread-panel { position: relative; }
