/* =============================================================================
   Continuous Legal AI Bridge - Light, professional, business-tool aesthetic
   Layout: TopBar | (PersonaRail | Chat | Canvas)
   ============================================================================= */

:root {
  /* Surfaces */
  --bg:        #f6f7fb;
  --surface:   #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #f1f3f8;
  --line:      #e5e8ef;
  --line-strong:#d4d9e3;
  --line-focus:#93c5fd;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);

  /* Text */
  --t-1: #0b1424;
  --t-2: #38415a;
  --t-3: #6b7388;
  --t-4: #9aa1b3;

  /* Accent - single indigo, no gradients */
  --acc:        #2563eb;
  --acc-hover:  #1d4ed8;
  --acc-soft:   #eff6ff;
  --acc-tint:   #dbeafe;
  --acc-ink:    #1e3a8a;

  --green:      #059669;
  --green-soft: #ecfdf5;
  --amber:      #b45309;
  --amber-soft: #fffbeb;
  --red:        #dc2626;
  --red-soft:   #fef2f2;
  --cyan:       #0891b2;

  /* Type scale */
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px;
  --fs-15: 15px; --fs-16: 16px; --fs-18: 18px; --fs-20: 20px;
  --fs-24: 24px; --fs-28: 28px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 140ms;
}

* { box-sizing: border-box; }
*::selection { background: var(--acc-soft); color: var(--acc-ink); }

html, body { margin: 0; padding: 0; height: 100%; }

/* Accessible focus rings - visible only on keyboard nav */
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }

/* Skip link (a11y) - hidden until focused */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--acc); color: white;
  padding: 8px 12px; border-radius: 0 0 6px 0;
  font-size: var(--fs-13); font-weight: 600;
  z-index: 10000;
}
.skip-link:focus { left: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: var(--fs-15);
  line-height: 1.55;
  color: var(--t-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
kbd {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--t-2);
}

/* ━━━ SHELL ━━━ */
.shell { height: 100vh; display: grid; grid-template-rows: auto 1fr; }

/* ━━━ TOP BAR ━━━ */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; display: grid; place-items: center; }
.as-logo-mark .lm-t { transform-origin: center; transform-box: fill-box; animation: lmFloatT 4s ease-in-out infinite; }
.as-logo-mark .lm-l { transform-origin: center; transform-box: fill-box; animation: lmFloatL 4s ease-in-out infinite .2s; }
.as-logo-mark .lm-r { transform-origin: center; transform-box: fill-box; animation: lmFloatR 4s ease-in-out infinite .4s; }
.as-logo-mark .lm-b { transform-origin: center; transform-box: fill-box; animation: lmFloatB 4s ease-in-out infinite .6s; }
@keyframes lmFloatT { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6px); } }
@keyframes lmFloatL { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-1.1px, -.8px); } }
@keyframes lmFloatR { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(1.1px, -.8px); } }
@keyframes lmFloatB { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(1.6px); } }
@media (prefers-reduced-motion: reduce) { .as-logo-mark .lm-t, .as-logo-mark .lm-l, .as-logo-mark .lm-r, .as-logo-mark .lm-b { animation: none; } }
.brand-stack { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-16); font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--t-1);
}
.brand-name .dot { color: var(--acc); }
.brand-sub { font-size: var(--fs-11); color: var(--t-3); font-weight: 500; }

.top-center { display: flex; justify-content: center; align-items: center; }
.agent-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 6px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: var(--fs-13);
  color: var(--t-2);
}
.agent-pill .ap-icon {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 5px;
  background: var(--acc);
  color: white;
  font-size: 11px; font-weight: 700;
}
.agent-pill .ap-name { font-weight: 600; color: var(--t-1); }
.agent-pill .ap-model {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-11);
  color: var(--t-3);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.top-right { display: flex; align-items: center; gap: 10px; }
.ctx-chip {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 9px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.15;
}
.ctx-label { font-size: 9px; letter-spacing: 0.14em; color: var(--t-4); font-weight: 700; }
.ctx-value { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-11); color: var(--t-2); }

/* ━━━ WORKSPACE: rail | chat | splitter | canvas ━━━ */
.workspace {
  display: grid;
  grid-template-columns: 82px minmax(320px, var(--chat-w, 38%)) 6px 1fr;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

/* Drag splitter between chat and canvas */
.splitter {
  cursor: col-resize;
  background: var(--line);
  position: relative;
  transition: background var(--t-fast);
}
.splitter::after {
  content: '';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 36px;
  border-radius: 2px;
  background: var(--line-strong);
  transition: background var(--t-fast);
}
.splitter:hover, .splitter.dragging { background: var(--acc-tint); }
.splitter:hover::after, .splitter.dragging::after { background: var(--acc); }

/* ━━━ PERSONA RAIL ━━━ */
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.rail-inner {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0 14px;
  scrollbar-width: none;
}
.rail-inner::-webkit-scrollbar { display: none; }
.rail-group {
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--t-4);
  font-weight: 700;
  padding: 16px 0 8px;
  text-align: center;
  margin: 6px 14px 2px;
  position: relative;
}
.rail-group::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 8px;
  height: 1px; background: var(--line);
}
.rail-group span {
  position: relative;
  background: var(--surface);
  padding: 0 6px;
}
.rail-group:first-child { margin-top: 0; padding-top: 6px; }
.rail-group:first-child::before { display: none; }
.persona-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 4px 10px;
  margin: 3px 8px;
  border-radius: 11px;
  transition: all var(--t-fast) var(--ease);
}
.persona-btn:hover { background: var(--surface-3); }
.persona-btn.active {
  background: var(--acc-soft);
}
.persona-btn.active .pb-icon {
  background: var(--acc);
  color: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.persona-btn.soon { opacity: 0.45; }
.pb-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--t-3);
  font-size: 14px; font-weight: 700;
  transition: all var(--t-fast) var(--ease);
  position: relative;
  overflow: hidden;
}
.pb-icon-svg svg { width: 22px; height: 22px; display: block; }
.persona-btn:hover .pb-icon { color: var(--acc); background: var(--acc-soft); transform: translateY(-1px); }
.persona-btn.active .pb-icon {
  background: var(--acc);
  color: white;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.18);
}
.persona-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px;
  background: var(--acc);
  border-radius: 0 3px 3px 0;
}
.persona-btn { position: relative; }
/* Chat-header & top-pill icons */
.agent-icon.pb-icon-svg svg { width: 22px; height: 22px; }
.agent-icon.live svg { color: white; }
.agent-pill .ap-icon.pb-icon-svg svg { width: 14px; height: 14px; color: white; }
.modal-icon-wrap.pb-icon-svg svg { width: 20px; height: 20px; color: white; }
.pb-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--t-3);
  text-align: center;
  line-height: 1.25;
  max-width: 68px;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.persona-btn.active .pb-label { color: var(--acc-ink); }

/* ══ Agent identity colors - PERMANENT: faded when idle, vibrant when selected ══ */
.persona-btn { --agent-c: var(--acc); }

/* Idle: every agent permanently wears its own color, faded/muted */
.persona-btn .pb-icon {
  transition: all 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
  background: color-mix(in srgb, var(--agent-c) 8%, var(--surface));
  color: color-mix(in srgb, var(--agent-c) 52%, #9aa1b3);
}
.persona-btn .pb-label { color: color-mix(in srgb, var(--agent-c) 30%, var(--t-3)); }

/* Hover: identity sharpens + gentle lift */
.persona-btn:hover .pb-icon {
  color: color-mix(in srgb, var(--agent-c) 90%, #0b1424);
  background: color-mix(in srgb, var(--agent-c) 14%, var(--surface));
  transform: translateY(-2px) scale(1.05);
}
.persona-btn:hover .pb-label { color: color-mix(in srgb, var(--agent-c) 75%, var(--t-1)); }

/* Active: solid identity color (slightly darkened for contrast), white glyph */
.persona-btn.active .pb-icon {
  background: color-mix(in srgb, var(--agent-c) 88%, #0b1424) !important;
  color: white;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--agent-c) 28%, transparent);
}
.persona-btn.active::before { background: var(--agent-c); }
.persona-btn.active .pb-label { color: color-mix(in srgb, var(--agent-c) 70%, var(--t-1)); }

/* Selection pop + expanding ring (one-shot) */
@keyframes pb-pop {
  0% { transform: scale(0.9); }
  55% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
@keyframes pb-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--agent-c) 38%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}
.persona-btn.just-selected .pb-icon {
  animation: pb-pop 340ms cubic-bezier(0.34, 1.56, 0.64, 1), pb-ring 480ms ease-out;
}

/* Agent header card entrance on switch */
@keyframes agent-in {
  from { opacity: 0.35; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.agent-card.agent-in { animation: agent-in 280ms var(--ease); }

/* Identity color flows into the active-agent surfaces (subtle) */
.agent-icon.live {
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 88%, #0b1424);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--active-agent-c, var(--acc)) 25%, transparent);
}
.agent-pill .ap-icon { background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 88%, #0b1424); }
.report-head-icon { background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 88%, #0b1424); }
.report-card.fresh { border-color: color-mix(in srgb, var(--active-agent-c, var(--acc)) 70%, var(--line-strong)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--active-agent-c, var(--acc)) 55%, transparent), var(--shadow-lg); }
.summary-label::before { background: var(--active-agent-c, var(--acc)); }
.modal-icon-wrap { background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 88%, #0b1424); }
/* Settings modal: calm fixed accent, never inherits the active-agent color */
.modal-icon-settings { background: var(--acc); color: #fff; }
.modal-icon-settings svg { display: block; }

/* ══ KPI chips in chat (under each tool result) ══ */
.kpi-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 1px 0 2px; }
.kpi-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 3px 9px;
  font-size: var(--fs-11);
  border: 1px solid color-mix(in srgb, var(--active-agent-c, var(--acc)) 30%, var(--line));
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 5%, var(--surface));
  border-radius: 6px;
  animation: fade-in 240ms var(--ease);
}
.kpi-chip .kc-l { color: var(--t-3); letter-spacing: 0.03em; text-transform: capitalize; }
.kpi-chip b {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; font-size: var(--fs-12);
  color: color-mix(in srgb, var(--active-agent-c, var(--acc)) 75%, var(--t-1));
}

/* ══ Export buttons - permanent subtle format identity, sharper on hover ══ */
.export-btn[data-export]::before {
  content: ''; width: 6px; height: 6px; border-radius: 2px;
  transition: opacity var(--t-fast);
}
.export-btn[data-export="csv"]::before  { background: #0891b2; opacity: 0.7; }
.export-btn[data-export="xlsx"]::before { background: #107c41; opacity: 0.7; }   /* Excel green */
.export-btn[data-export="pdf"]::before  { background: #b91c1c; opacity: 0.7; }   /* PDF red */

/* Idle: subtle tinted identity, always visible */
.export-btn[data-export="csv"]  { color: color-mix(in srgb, #0e7490 70%, var(--t-3)); border-color: color-mix(in srgb, #0891b2 28%, var(--line)); background: color-mix(in srgb, #0891b2 4%, var(--surface)); }
.export-btn[data-export="xlsx"] { color: color-mix(in srgb, #107c41 70%, var(--t-3)); border-color: color-mix(in srgb, #107c41 28%, var(--line)); background: color-mix(in srgb, #107c41 4%, var(--surface)); }
.export-btn[data-export="pdf"]  { color: color-mix(in srgb, #b91c1c 70%, var(--t-3)); border-color: color-mix(in srgb, #b91c1c 28%, var(--line)); background: color-mix(in srgb, #b91c1c 4%, var(--surface)); }

/* Hover: full-sharp format identity */
.export-btn[data-export="csv"]:hover  { color: #0e7490; border-color: #0891b2; background: #ecfeff; }
.export-btn[data-export="xlsx"]:hover { color: #107c41; border-color: #107c41; background: #ecfdf5; }
.export-btn[data-export="pdf"]:hover  { color: #b91c1c; border-color: #b91c1c; background: #fef2f2; }
.export-btn[data-export]:hover::before { opacity: 1; }

/* Flagship marker - small solid diamond on the icon corner (no gradient) */
.pb-flag {
  position: absolute;
  top: -3px; right: -3px;
  width: 10px; height: 10px;
  background: var(--amber);
  border: 2px solid var(--surface);
  border-radius: 3px;
  transform: rotate(45deg);
}
.persona-btn.flagship .pb-icon { overflow: visible; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.persona-btn.flagship:hover .pb-icon { box-shadow: inset 0 0 0 1.5px var(--acc); }
.persona-btn.flagship.active .pb-icon { box-shadow: 0 4px 10px rgba(37, 99, 235, 0.18); }

/* Tooltip on hover */
/* Body-level rail tooltip - fixed positioning, never clipped, above everything */
.rail-tip {
  position: fixed;
  display: none;
  max-width: 240px;
  background: var(--t-1);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 120ms var(--ease), transform 120ms var(--ease);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  border-left: 3px solid var(--tip-c, var(--acc));
}
.rail-tip.show { opacity: 1; transform: translateX(0); }
.rail-tip-name { font-size: var(--fs-13); font-weight: 600; letter-spacing: -0.01em; }
.rail-tip-desc { font-size: var(--fs-12); color: #c9d2e6; margin-top: 3px; line-height: 1.4; }

.rail-help {
  padding: 14px;
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--t-3);
  border-top: 1px solid var(--line);
  transition: all var(--t-fast);
}
.rail-help:not(:disabled):hover { color: var(--acc); background: var(--acc-soft); }
.rail-help:disabled { opacity: 0.35; cursor: not-allowed; }

/* ━━━ CHAT PANE ━━━ */
.chat-pane {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.chat-pane-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.agent-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.agent-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--t-3);
  font-size: 17px; font-weight: 700;
}
.agent-icon.live {
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 88%, #0b1424);
  color: white;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--active-agent-c, var(--acc)) 25%, transparent);
  transition: background 300ms var(--ease), box-shadow 300ms var(--ease);
}
.agent-text { min-width: 0; }
.agent-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-16); font-weight: 600;
  letter-spacing: -0.01em;
}
.agent-desc {
  font-size: var(--fs-12); color: var(--t-3);
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.chat-stream {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 16px 20px;
  display: flex; flex-direction: column;
  gap: 12px;
  min-height: 0;
}
/* Chat items keep their natural height - they don't shrink to fit. */
.chat-stream > * { flex: 0 0 auto; }

.empty-state { margin: auto; text-align: center; max-width: 340px; padding: 24px 16px; animation: fade-in 320ms var(--ease); }
.empty-orb {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--acc-soft);
  display: grid; place-items: center;
  border: 1px solid var(--line);
}
.empty-orb::before { content: ''; width: 20px; height: 20px; border-radius: 5px; background: var(--acc); transform: rotate(45deg); }
.empty-h { font-family: 'Space Grotesk', sans-serif; font-size: var(--fs-16); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; color: var(--t-1); }
.empty-p { font-size: var(--fs-12); color: var(--t-3); margin: 0; line-height: 1.55; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Messages */
.msg-user {
  align-self: flex-end;
  max-width: 92%;
  padding: 9px 13px;
  font-size: var(--fs-14);
  background: var(--acc);
  color: white;
  border-radius: 12px 12px 3px 12px;
  animation: fade-in 200ms var(--ease);
}
.msg-agent {
  align-self: flex-start;
  width: 100%;
  display: flex; flex-direction: column;
  gap: 8px;
  animation: fade-in 200ms var(--ease);
}

/* Reasoning */
.reasoning {
  background: var(--amber-soft);
  border-left: 2px solid var(--amber);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: var(--fs-13);
  color: #78350f;
  line-height: 1.5;
  white-space: pre-wrap;
}
.reasoning-label { font-size: 9px; letter-spacing: 0.16em; color: var(--amber); font-weight: 700; margin-bottom: 4px; }

/* Tool pill */
.tool-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-11);
  color: var(--t-2);
  align-self: flex-start;
  animation: fade-in 160ms var(--ease);
}
.tool-pill .tp-glyph { color: var(--acc); }
.tool-pill .status.ok { color: var(--green); }
.tool-pill .status.error { color: var(--red); }
.tool-pill .status.pending { color: var(--amber); }

/* Summary */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
  box-shadow: var(--shadow-sm);
}
.summary-label {
  font-size: 10px; letter-spacing: 0.16em;
  color: var(--acc); font-weight: 700;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.summary-label::before { content: ''; width: 12px; height: 1.5px; background: var(--acc); border-radius: 1px; }
.summary-body { font-size: var(--fs-14); color: var(--t-1); line-height: 1.6; }
.summary-body p { margin: 0 0 8px; }
.summary-body p:last-child { margin: 0; }
.summary-body .md-h {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-12);
  font-weight: 600; letter-spacing: 0.08em;
  margin: 10px 0 4px;
  color: var(--acc);
  text-transform: uppercase;
}

/* Wave A item 3 - quiet grounding badge (log-first, never blocks the answer) */
.grounding-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--acc);
}
.grounding-badge svg { flex: 0 0 auto; }
.summary-body .md-h:first-child { margin-top: 0; }
.summary-body .md-ul, .summary-body .md-ol { margin: 0 0 8px 20px; padding: 0; }
.summary-body .md-ul li, .summary-body .md-ol li { margin: 3px 0; }
.summary-body strong { color: var(--t-1); font-weight: 600; }
.summary-body em { color: var(--t-2); font-style: italic; }
.summary-body .md-code { font-family: 'JetBrains Mono', monospace; background: var(--surface-3); padding: 1px 5px; border-radius: 3px; font-size: 12px; color: var(--cyan); }
.summary-body .md-num { font-family: 'JetBrains Mono', monospace; display: inline-block; background: var(--acc-soft); color: var(--acc-ink); font-weight: 600; padding: 1px 6px; border-radius: 4px; }

/* ── Suggestion chips: one-click chaining ── */
.suggest-row {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  padding: 4px 0 2px;
}
.suggest-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--t-4); font-weight: 700; margin-right: 2px;
}
.suggest-label::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 70%, var(--t-4));
}
/* Subtle tinted badge - uses the active agent's identity color */
.suggest-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px 4px 8px;
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--active-agent-c, var(--acc)) 22%, var(--line));
  border-radius: 7px;
  font-size: var(--fs-12); font-weight: 500;
  color: color-mix(in srgb, var(--active-agent-c, var(--acc)) 65%, var(--t-1));
  transition: all var(--t-fast) var(--ease);
  text-align: left; line-height: 1.3;
}
.suggest-chip:hover {
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--active-agent-c, var(--acc)) 45%, var(--line));
  color: color-mix(in srgb, var(--active-agent-c, var(--acc)) 85%, var(--t-1));
}
.suggest-chip svg { flex-shrink: 0; opacity: 0.7; }
.suggest-chip:hover svg { opacity: 1; }

/* ── Recent-ask chips ── */
.qp.recent-chip {
  background: var(--surface);
  border-style: dashed;
  border-color: var(--line-strong);
}
.qp.recent-chip:hover { border-style: solid; }

/* ── Receipt card ── */
.receipt-card {
  max-width: 380px;
  margin: 18px auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.receipt-head {
  padding: 16px 20px 12px;
  text-align: center;
  border-bottom: 2px solid var(--acc);
}
.receipt-school {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-15); font-weight: 700; letter-spacing: 0.04em;
}
.receipt-no {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-12); color: var(--t-3); margin-top: 2px;
}
.receipt-body { padding: 16px 22px; }
.receipt-body .rrow {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-13);
}
.receipt-body .rrow span { color: var(--t-3); }
.receipt-body .rrow strong { color: var(--t-1); font-weight: 600; }
.receipt-body .rrow .ramt { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-16); color: var(--acc); }
.receipt-note {
  margin-top: 10px;
  font-size: var(--fs-11); color: var(--amber);
  background: var(--amber-soft);
  padding: 6px 10px; border-radius: 6px;
  text-align: center;
}
.receipt-actions {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}
.deliver-btn {
  padding: 11px 0;
  background: var(--surface-2);
  font-size: var(--fs-13); font-weight: 600;
  color: var(--t-2);
  transition: all var(--t-fast);
}
.deliver-btn:hover { background: var(--acc); color: white; }
.deliver-btn:disabled { opacity: 0.5; }

/* ── Report data-source footer ── */
.report-sources {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 18px;
  font-size: var(--fs-11);
  color: var(--t-4);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.report-sources code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 4px;
  color: var(--t-3);
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translate(-50%, 12px);
  background: var(--t-1); color: white;
  padding: 11px 18px; border-radius: 8px;
  font-size: var(--fs-13); font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transition: all 280ms var(--ease);
  z-index: 2000; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); }

.tool-error {
  background: var(--red-soft);
  border-left: 2px solid var(--red);
  border-radius: 6px;
  padding: 8px 11px;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-12);
  color: #991b1b;
  white-space: pre-wrap;
}

/* Quick prompts: single scrollable row */
.quick-prompts {
  display: flex; gap: 6px;
  padding: 0 20px 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  white-space: nowrap;
}
.quick-prompts.hidden { display: none; }
.quick-prompts::-webkit-scrollbar { height: 4px; }
.quick-prompts::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.qp {
  flex: 0 0 auto;
  padding: 6px 11px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: var(--fs-12); font-weight: 500;
  color: var(--t-2);
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.qp:not(:disabled):hover { color: var(--acc-ink); background: var(--acc-soft); border-color: var(--acc); }
.qp[disabled] { opacity: 0.4; cursor: not-allowed; }
.qp .qp-cat { font-size: 9px; letter-spacing: 0.1em; color: var(--t-4); font-weight: 700; margin-right: 6px; text-transform: uppercase; }

.show-prompts-row {
  display: flex; gap: 8px; align-items: center;
  padding: 0 20px 10px;
  font-size: var(--fs-12); color: var(--t-3);
}
.show-prompts-btn {
  font-size: var(--fs-12); color: var(--acc);
  border: 0; padding: 3px 7px; border-radius: 5px;
  transition: background var(--t-fast);
}
.show-prompts-btn:hover { background: var(--acc-soft); }

/* Composer */
.composer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.composer-shell {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.composer-shell:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.composer-shell textarea {
  min-height: 32px; max-height: 160px;
  resize: none; border: 0; outline: none;
  background: transparent;
  font-size: var(--fs-14);
  color: var(--t-1);
  padding: 6px 0;
}
.composer-shell textarea::placeholder { color: var(--t-4); }
.send-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--acc);
  color: white;
  transition: all var(--t-fast) var(--ease);
  align-self: end;
  margin: 2px;
}
.send-btn:not(:disabled):hover { background: var(--acc-hover); }
.send-btn:disabled { background: var(--surface-3); color: var(--t-4); cursor: not-allowed; }
.mic-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--surface);
  color: var(--t-3);
  border: 1px solid var(--line);
  transition: all var(--t-fast) var(--ease);
  align-self: end;
  margin: 2px;
}
.mic-btn:not(:disabled):hover { color: var(--acc); border-color: var(--acc); background: var(--acc-soft); }
.mic-btn:disabled { color: var(--t-4); cursor: not-allowed; opacity: 0.5; }
.mic-btn.recording {
  color: white;
  background: #dc2626;
  border-color: #dc2626;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.composer-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px;
  font-size: var(--fs-11);
  color: var(--t-4);
}
.model-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-11);
  padding: 2px 6px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--t-3);
}
.hint-key { display: flex; align-items: center; gap: 4px; }

/* ━━━ CANVAS ━━━ */
.canvas-pane {
  display: grid;
  grid-template-rows: auto 1fr auto;   /* head | stream (full height) | pinned stats bar */
  min-height: 0;
  background: var(--bg);
}

/* Pinned stats bar - totals of the latest report, light background, 2-3 lines max */
.canvas-statsbar {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  padding: 9px 20px;
  min-height: 44px; max-height: 92px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 5%, var(--surface));
  border-top: 2px solid color-mix(in srgb, var(--active-agent-c, var(--acc)) 40%, var(--line));
  font-size: var(--fs-12);
}
.canvas-statsbar[hidden] { display: none; }
.csb-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: var(--fs-12);
  color: var(--t-2);
  margin-right: 6px;
  white-space: nowrap;
}
.csb-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--active-agent-c, var(--acc)) 25%, var(--line));
  border-radius: 6px;
  white-space: nowrap;
}
.csb-chip .l { color: var(--t-3); font-size: var(--fs-11); text-transform: capitalize; }
.csb-chip b {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-13); font-weight: 700;
  color: color-mix(in srgb, var(--active-agent-c, var(--acc)) 75%, var(--t-1));
}
.csb-chip.total b { font-size: var(--fs-14); }
.canvas-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.canvas-title { display: flex; align-items: baseline; gap: 14px; }
.canvas-eyebrow {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-12);
  letter-spacing: 0.2em;
  font-weight: 700;
  color: var(--t-3);
  text-transform: uppercase;
}
.canvas-state {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-12);
  color: var(--t-3);
  display: inline-flex; align-items: center; gap: 5px;
}
.canvas-state.live { color: var(--green); }
.canvas-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.canvas-stream {
  overflow-y: auto;
  overscroll-behavior: contain;          /* don't bounce the whole page when reaching ends */
  scroll-behavior: smooth;
  padding: 18px 18px 28px;
  display: flex; flex-direction: column;
  gap: 22px;
  min-height: 0;                         /* flex+overflow safety: allow the cell to shrink */
}
/* Cards keep their natural height - never flex-shrink, never overflow:hidden clipping.
   The CANVAS itself is the scrollable surface, not each card. */
.canvas-stream > .report-card,
.canvas-stream > .briefing-card { width: 100%; flex: 0 0 auto; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  font-size: var(--fs-12); font-weight: 500;
  color: var(--t-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: all var(--t-fast) var(--ease);
}
.ghost-btn:not(:disabled):hover { color: var(--t-1); background: var(--surface-3); }
.ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.canvas-empty { margin: auto; text-align: center; padding: 40px 30px; max-width: 460px; }
.canvas-empty-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.ce-tile { height: 64px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--line-strong); }
.canvas-empty-text { font-size: var(--fs-13); color: var(--t-3); margin: 0; }

/* Loader skeleton (canvas) */
.canvas-loader {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  animation: fade-in 200ms var(--ease);
}
.canvas-loader .ld-head {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-14); font-weight: 600;
  color: var(--t-2);
}
.canvas-loader .ld-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--surface-3);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.canvas-loader .ld-bars { display: flex; flex-direction: column; gap: 10px; }
.canvas-loader .ld-bar {
  height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--line) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.canvas-loader .ld-bar:nth-child(1) { width: 70%; }
.canvas-loader .ld-bar:nth-child(2) { width: 90%; }
.canvas-loader .ld-bar:nth-child(3) { width: 50%; }
.canvas-loader .ld-chart {
  height: 200px; border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--line) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  margin-top: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.canvas-loader .ld-note { font-size: var(--fs-12); color: var(--t-3); font-style: italic; }

/* Inline chat thinking indicator */
.thinking-dots {
  display: inline-flex; gap: 4px;
  align-items: center; padding: 6px 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: var(--fs-12); color: var(--t-3);
  align-self: flex-start;
}
.thinking-dots .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--acc);
  animation: pulse 1.2s ease-in-out infinite;
}
.thinking-dots .dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.1); }
}

/* Report card */
.report-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  /* No overflow:hidden - let inner sections render fully. Scrolling happens
     at the canvas-stream level, not per-card. Rounded corners are preserved
     by the children's own bg + border-radius. */
  animation: fade-in 280ms var(--ease);
  box-shadow: var(--shadow);
}
.report-card.fresh {
  border-color: var(--acc);
  box-shadow: 0 0 0 1px var(--acc), var(--shadow-lg);
}
.report-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 16px;            /* tighter so a multi-report Director canvas stays scannable */
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

/* ── Per-kind output colour cue ──────────────────────────────────────────────
   Distinguish KINDS of output with a subtle, light cue: a soft left-accent
   strip on the header plus a very faint header tint in a relevant hue. The
   strip rides on .report-head's left edge via an inset box-shadow, so it never
   fights the per-agent fresh-state ring (--active-agent-c). Tints stay around
   --acc-soft lightness; body + table styling is untouched, readability kept.
   data-kind is set by reportKind() in app.js. */
.report-card[data-kind] .report-head {
  box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--rk-c, var(--acc)) 70%, var(--line));
  background: color-mix(in srgb, var(--rk-c, var(--acc)) 5%, var(--surface-2));
}
.report-card[data-kind="kpi"]       { --rk-c: #2563eb; } /* blue */
.report-card[data-kind="finance"]   { --rk-c: #15803d; } /* green */
.report-card[data-kind="alert"]     { --rk-c: #b45309; } /* amber (risk/overdue) */
.report-card[data-kind="chart"]     { --rk-c: #7c3aed; } /* violet */
.report-card[data-kind="table"]     { --rk-c: #475569; } /* slate */
.report-card[data-kind="list"]      { --rk-c: #0d9488; } /* teal */
.report-card[data-kind="narrative"] { --rk-c: var(--t-4); } /* neutral */
.report-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.report-head-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: color-mix(in srgb, var(--active-agent-c, var(--acc)) 88%, #0b1424);
  color: white;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.report-head-meta { min-width: 0; }
.report-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: var(--fs-15);
  font-weight: 600; letter-spacing: -0.01em;
  color: var(--t-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.report-sub { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-11); color: var(--t-3); margin-top: 2px; }
.report-actions { display: flex; align-items: center; gap: 14px; }
.report-stats { display: flex; gap: 12px; font-size: var(--fs-11); color: var(--t-3); }
.report-stats .stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.report-stats .stat .v { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-13); color: var(--t-1); font-weight: 600; }
.report-export { display: flex; gap: 4px; padding-left: 12px; border-left: 1px solid var(--line); }
.export-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 9px; border-radius: 6px;
  font-size: var(--fs-11); font-weight: 600;
  color: var(--t-3);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all var(--t-fast) var(--ease);
}
.export-btn:hover { color: var(--acc); border-color: var(--acc); background: var(--acc-soft); }
.pin-btn { padding: 5px 7px; }
.pin-btn[aria-pressed="true"] { color: var(--acc); border-color: var(--acc); background: var(--acc-soft); }

/* Pinned reports strip - sits between canvas head and stream */
.pinned-strip {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.pinned-strip::-webkit-scrollbar { height: 4px; }
.pinned-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.pinned-label { font-size: 9px; letter-spacing: 0.16em; color: var(--t-4); font-weight: 700; margin-right: 4px; }
.pin-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  background: var(--acc-soft); color: var(--acc-ink);
  border: 1px solid var(--line-focus);
  border-radius: 14px;
  font-size: var(--fs-12); font-weight: 600;
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.pin-chip:hover { background: var(--acc); color: white; }
.report-body { padding: 0; }

.chart-wrap { padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chart-frame { position: relative; height: 200px; }
/* When a card stacks multiple charts, keep each one compact */
.chart-wrap + .chart-wrap .chart-frame { height: 168px; }
.chart-wrap.rv-hidden, .r-table-wrap.rv-hidden { display: none; }

/* Wide tables scroll horizontally only - vertical scrolling happens at the canvas
   level so the full card (incl. trust bar, actions) stays accessible naturally. */
.r-table-wrap { overflow-x: auto; }
.r-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.r-table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  background: var(--surface-2);
  color: var(--t-3);
  padding: 10px 16px;
  font-size: var(--fs-11);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.r-table tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--t-2); }
.r-table tbody tr { transition: background var(--t-fast); }
.r-table tbody tr:hover { background: var(--surface-3); }
.r-table tbody tr:last-child td { border-bottom: 0; }
.r-table td.num { font-family: 'JetBrains Mono', monospace; text-align: right; color: var(--t-1); font-weight: 500; }
.r-table td.num.big { font-size: var(--fs-14); color: var(--acc); }
.r-table tfoot td {
  position: sticky; bottom: 0;
  background: var(--surface-2);
  border-top: 2px solid var(--line-strong);
  padding: 12px 16px;
  font-size: var(--fs-13);
  font-weight: 700;
  color: var(--t-1);
}
.r-table tfoot td.lbl { color: var(--t-3); font-size: var(--fs-11); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.r-table tfoot td.num { font-family: 'JetBrains Mono', monospace; text-align: right; color: var(--acc); font-weight: 700; }
.r-table tfoot td.num .stat-sub { display:block; font-size: var(--fs-11); font-weight: 500; color: var(--t-3); margin-top: 2px; }

/* Stats strip below KV cards */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.stats-strip .stat-cell {
  padding: 8px 14px;
  border-right: 1px solid var(--line);
}
.stats-strip .stat-cell:last-child { border-right: 0; }
.stats-strip .stat-lbl { font-size: 10px; letter-spacing: 0.12em; color: var(--t-4); font-weight: 700; text-transform: uppercase; }
.stats-strip .stat-val { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-15); color: var(--acc); font-weight: 700; margin-top: 3px; }
.r-table td .drill {
  color: var(--acc); text-decoration: none; font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.r-table td .drill:hover { color: var(--acc-hover); text-decoration: underline; }
.r-table td .drill::after { content: '↗'; font-size: 11px; opacity: 0.7; }
/* Generic cross-filter: reads as normal text, reveals the affordance on hover */
.r-table td .drill.drill-soft { color: inherit; font-weight: inherit; }
.r-table td .drill.drill-soft::after { content: ''; }
.r-table td .drill.drill-soft:hover { color: var(--acc); text-decoration: none; }
.r-table td .drill.drill-soft:hover::after { content: '↗'; font-size: 11px; opacity: 0.7; margin-left: 4px; }

.kv-card { padding: 18px 22px; display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; font-size: var(--fs-14); }
.kv-card .k { color: var(--t-3); font-size: var(--fs-11); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; align-self: center; }
.kv-card .v { color: var(--t-1); font-weight: 500; }
.kv-card .v.num { font-family: 'JetBrains Mono', monospace; font-size: var(--fs-15); color: var(--acc); }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
/* Compact KPI tile - fits more cards in the viewport when 3+ stack (e.g. Director). */
.kpi { padding: 10px 16px; border-right: 1px solid var(--line); min-height: 56px; }
.kpi:last-child { border-right: 0; }
.kpi-label { font-size: 9px; letter-spacing: 0.1em; color: var(--t-4); font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-family: 'Space Grotesk', sans-serif; font-size: var(--fs-17); font-weight: 700; letter-spacing: -0.01em; color: var(--t-1); margin-top: 3px; line-height: 1.2; }
.kpi-value.accent { color: var(--acc); }
.kpi-foot { font-size: var(--fs-12); color: var(--t-3); margin-top: 2px; }

/* Severity accents - override .accent to color the value */
.kpi-value.accent.kpi-sev-danger { color: #dc2626; }   /* red-600  */
.kpi-value.accent.kpi-sev-warn   { color: #d97706; }   /* amber-600 */
.kpi-value.accent.kpi-sev-good   { color: #16a34a; }   /* green-600 */
/* Severity dot before the label for extra visual cue */
.kpi.kpi-emphasis { padding: 12px 18px; min-height: 66px; background: #f0f6ff; }
.kpi.kpi-emphasis .kpi-label { color: #1e40af; }
.kpi.kpi-emphasis .kpi-value { font-size: calc(var(--fs-17) + 2px); }
/* Dot indicator for danger/warn tiles */
.kpi-label[data-sev="danger"]::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #dc2626; margin-right: 4px; vertical-align: middle; }
.kpi-label[data-sev="warn"]::before   { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #d97706; margin-right: 4px; vertical-align: middle; }
/* LTR isolation for numbers under RTL context - keep numbers left-to-right */
bdi[dir="ltr"] { unicode-bidi: isolate; direction: ltr; }

/* ━━━ MODALS ━━━ */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  z-index: 1000;
  animation: fade-in 160ms var(--ease);
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 560px; max-width: 92vw; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-wide { width: 720px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  position: relative;
}
.modal-icon-wrap { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 8px; background: var(--acc); color: white; font-weight: 700; }
.modal-icon { font-size: 18px; color: var(--amber); }
.modal-title { font-family: 'Space Grotesk', sans-serif; font-size: var(--fs-16); font-weight: 600; }
.modal-subtitle { font-size: var(--fs-13); color: var(--t-3); margin-top: 2px; }
.modal-close { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--t-3); font-size: 20px; line-height: 1; transition: all var(--t-fast); }
.modal-header { padding-right: 52px; }
.modal-close:hover { color: var(--t-1); background: var(--surface-3); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-readback { padding: 10px 12px; background: var(--amber-soft); border-left: 2px solid var(--amber); border-radius: 5px; font-size: var(--fs-13); color: #78350f; margin-bottom: 14px; }
.modal-preview-label { font-size: 10px; letter-spacing: 0.12em; color: var(--t-4); font-weight: 700; margin-bottom: 8px; }
.modal-preview { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.btn { padding: 8px 14px; border-radius: 7px; font-size: var(--fs-13); font-weight: 500; transition: all var(--t-fast); }
.btn-secondary { background: var(--surface); color: var(--t-2); border: 1px solid var(--line); }
.btn-secondary:hover { color: var(--t-1); background: var(--surface-3); }
.btn-primary { background: var(--acc); color: white; font-weight: 600; }
.btn-primary:not(:disabled):hover { background: var(--acc-hover); }
.btn-primary:disabled { background: var(--surface-3); color: var(--t-4); cursor: not-allowed; }

/* Capability help modal */
.cap-section { margin-bottom: 18px; }
.cap-section:last-child { margin-bottom: 0; }
.cap-section-title { font-family: 'Space Grotesk', sans-serif; font-size: var(--fs-12); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; margin-bottom: 8px; }
.cap-section-title.can { color: var(--green); }
.cap-section-title.cannot { color: var(--red); }
.cap-section-title.tips { color: var(--acc); }
.cap-list { display: flex; flex-direction: column; gap: 6px; }
.cap-item { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.cap-item .cap-bullet { width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-top: 7px; flex-shrink: 0; }
.cap-item.can { color: var(--green); }
.cap-item.cannot { color: var(--red); }
.cap-item.tips { color: var(--acc); }
.cap-item-body { color: var(--t-1); }
.cap-item-name { font-weight: 600; color: var(--t-1); font-size: var(--fs-13); margin-bottom: 1px; }
.cap-item-desc { font-size: var(--fs-13); color: var(--t-2); line-height: 1.5; }
.cap-example { margin-top: 4px; font-family: 'JetBrains Mono', monospace; font-size: var(--fs-12); color: var(--acc-ink); background: var(--acc-soft); padding: 4px 7px; border-radius: 5px; }

/* Topic Directory (C1b) - grouped agent launcher modal + empty-state entry point */
.modal-directory { width: 760px; }
.modal-directory .modal-body { display: flex; flex-direction: column; gap: 20px; }
.dir-loading { padding: 24px 4px; text-align: center; font-size: var(--fs-13); color: var(--t-3); }
.dir-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dir-group-name { font-family: 'Space Grotesk', sans-serif; font-size: var(--fs-13); font-weight: 700; letter-spacing: -0.005em; color: var(--t-1); }
.dir-group-count {
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  padding: 1px 8px; border-radius: 999px;
  color: var(--acc-ink); background: var(--acc-soft);
  border: 1px solid color-mix(in srgb, var(--acc) 22%, var(--line));
}
.dir-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.dir-card {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 11px 13px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.dir-card:hover { border-color: color-mix(in srgb, var(--acc) 40%, var(--line)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.dir-card-icon {
  flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  color: var(--acc); background: var(--acc-soft);
  border: 1px solid color-mix(in srgb, var(--acc) 22%, var(--line));
}
.dir-card-icon svg { width: 17px; height: 17px; }
.dir-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dir-card-title { font-size: var(--fs-13); font-weight: 700; color: var(--t-1); display: inline-flex; align-items: center; gap: 6px; }
.dir-card-sub { font-size: var(--fs-12); color: var(--t-3); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 720px) { .dir-cards { grid-template-columns: 1fr; } .modal-directory { width: 96vw; } }

.empty-browse-btn { margin-top: 16px; }

/* Scrollbars - slightly wider on the main scroll surfaces so users SEE they can scroll. */
.chat-stream::-webkit-scrollbar,
.canvas-stream::-webkit-scrollbar { width: 10px; height: 10px; }
.r-table-wrap::-webkit-scrollbar,
.modal-preview::-webkit-scrollbar,
.modal-body::-webkit-scrollbar { width: 7px; height: 7px; }
.chat-stream::-webkit-scrollbar-thumb,
.canvas-stream::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--t-4) 65%, var(--line)); border-radius: 5px; border: 2px solid var(--bg); }
.r-table-wrap::-webkit-scrollbar-thumb,
.modal-preview::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.chat-stream::-webkit-scrollbar-thumb:hover,
.canvas-stream::-webkit-scrollbar-thumb:hover { background: var(--t-3); }
.chat-stream::-webkit-scrollbar-track,
.canvas-stream::-webkit-scrollbar-track { background: transparent; }
/* Firefox */
.chat-stream, .canvas-stream { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--t-4) 65%, var(--line)) transparent; }

/* Canvas "Jump to top" pill */
.canvas-pane { position: relative; }
.canvas-jump {
  position: absolute; right: 22px; bottom: 110px; z-index: 12;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: #0b1424; color: #fff; font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: fade-up 220ms var(--ease);
}
.canvas-jump:hover { background: #1b2740; }
.canvas-jump svg { display: inline-block; }

/* ═══════════════════════════════════════════════════════════════════
   RELEASE POLISH - welcome card · jump pill · report accents ·
   micro-interactions · toast · responsive
   ═══════════════════════════════════════════════════════════════════ */

/* ── Per-agent welcome card ── */
.welcome-card {
  background: color-mix(in srgb, var(--agent-c, var(--acc)) 4%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--agent-c, var(--acc)) 16%, var(--line));
  border-radius: 12px;
  padding: 16px 18px;
  animation: fade-up 320ms var(--ease);
}
.welcome-head { display: flex; align-items: center; gap: 12px; }
.welcome-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 11px;
  background: color-mix(in srgb, var(--agent-c, var(--acc)) 88%, #0b1424);
  color: white;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--agent-c, var(--acc)) 25%, transparent);
}
.welcome-icon svg { width: 23px; height: 23px; }
.welcome-name { font-family: 'Space Grotesk', sans-serif; font-size: var(--fs-16); font-weight: 600; letter-spacing: -0.01em; }
.welcome-sub { font-size: var(--fs-13); color: var(--t-2); margin-top: 2px; line-height: 1.4; }
.welcome-meta {
  font-size: var(--fs-11); color: var(--t-4); font-weight: 600;
  letter-spacing: 0.03em; margin: 12px 0 2px;
  font-family: 'JetBrains Mono', monospace;
}
.welcome-starters-label {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--t-4); font-weight: 700; margin: 12px 0 7px;
}
.welcome-starters { display: flex; flex-direction: column; gap: 6px; }
.welcome-chip {
  text-align: left; padding: 9px 12px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--agent-c, var(--acc)) 22%, var(--line));
  border-radius: 9px;
  font-size: var(--fs-13); font-weight: 500;
  color: color-mix(in srgb, var(--agent-c, var(--acc)) 60%, var(--t-1));
  transition: all var(--t-fast) var(--ease);
}
.welcome-chip:hover {
  background: color-mix(in srgb, var(--agent-c, var(--acc)) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--agent-c, var(--acc)) 45%, var(--line));
  transform: translateX(2px);
}

/* ── Jump-to-latest pill ── */
.jump-pill {
  position: absolute; left: 50%; bottom: 96px;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px;
  background: var(--t-1); color: white;
  border-radius: 16px;
  font-size: var(--fs-12); font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  animation: fade-up 180ms var(--ease);
}
.jump-pill:hover { background: #1b2740; }
.chat-pane { position: relative; }

/* ── Report card: agent-colored accent strip on top + timestamp ── */
.report-card { position: relative; }
.report-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: color-mix(in srgb, var(--agent-c, var(--acc)) 80%, transparent);
  border-radius: 12px 12px 0 0;
  opacity: 0; transition: opacity 200ms var(--ease);
}
.report-card.fresh::before { opacity: 1; }
.report-sub .rs-time {
  font-weight: 700;
  color: color-mix(in srgb, var(--agent-c, var(--acc)) 60%, var(--t-3));
}

/* ── Micro-interactions ── */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.report-card { animation: fade-up 300ms var(--ease); }
.send-btn:active:not(:disabled) { transform: scale(0.92); }
.welcome-chip:active, .qp:active, .suggest-chip:active { transform: scale(0.97); }
.composer-shell:focus-within .send-btn:not(:disabled) {
  background: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft);
}

/* ── Contrast bumps (AA) ── */
:root { --t-3: #5a6378; --t-4: #828aa0; }

/* ── Toast restyle to match badge language ── */
.toast {
  border-radius: 9px; padding: 10px 16px;
  font-weight: 500; letter-spacing: 0.01em;
  border-left: 3px solid var(--green);
}
.toast.err { border-left-color: #f87171; }

/* ── Responsive (4-column grid aware) ── */
@media (max-width: 1280px) {
  .workspace { grid-template-columns: 76px minmax(300px, var(--chat-w, 40%)) 6px 1fr; }
}
/* Narrow screens: STACK chat (top) + canvas (bottom) - never hide the canvas */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 64px 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
  .rail { grid-column: 1; grid-row: 1 / 3; }
  .chat-pane { grid-column: 2; grid-row: 1; }
  .splitter { display: none; }
  .canvas-pane { grid-column: 2; grid-row: 2; border-top: 2px solid var(--line); }
}

/* ═══════════════════════════════════════════════════════════════════════
   TRACK 3 - Arabic / RTL support
   All RTL rules are scoped under [dir=rtl] - zero impact on LTR layouts.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Language toggle button in the top bar ── */
.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: var(--acc);
  background: var(--acc-soft);
  border: 1.5px solid var(--acc-tint);
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  letter-spacing: 0;
}
.lang-toggle-btn:hover {
  background: var(--acc-tint);
  color: var(--acc-ink);
}

/* ── Arabic font stack - add Noto Naskh for Arabic text ── */
[dir=rtl] body,
[dir=rtl] button,
[dir=rtl] textarea,
[dir=rtl] input {
  font-family: 'Noto Naskh Arabic', 'Segoe UI', 'Inter', system-ui, sans-serif;
}

/* ── Global text direction ── */
[dir=rtl] { text-align: right; }

/* ── Top bar: reverse the flex for RTL ── */
[dir=rtl] .topbar {
  flex-direction: row-reverse;
}
[dir=rtl] .top-right {
  flex-direction: row-reverse;
}
[dir=rtl] .brand {
  flex-direction: row-reverse;
}
[dir=rtl] .brand-stack {
  text-align: right;
}

/* ── Workspace grid: rail moves to the RIGHT in RTL ── */
[dir=rtl] .workspace {
  /* LTR: rail | chat | splitter | canvas */
  /* RTL: canvas | splitter | chat | rail */
  grid-template-columns: 1fr 6px minmax(300px, var(--chat-w, 42%)) 76px;
  direction: rtl;
}
[dir=rtl] .rail {
  grid-column: 4;
  border-left: none;
  border-right: 1px solid var(--line);
}
[dir=rtl] .chat-pane {
  grid-column: 3;
}
[dir=rtl] .splitter {
  grid-column: 2;
}
[dir=rtl] .canvas-pane {
  grid-column: 1;
  border-right: 1px solid var(--line);
  border-left: none;
}

/* ── Rail tooltip: opens from the LEFT in RTL (opposite of LTR) ── */
[dir=rtl] .rail-tip {
  left: auto !important;
  right: 80px;
}

/* ── Chat pane head: align correctly ── */
[dir=rtl] .chat-pane-head,
[dir=rtl] .agent-card {
  flex-direction: row-reverse;
}
[dir=rtl] .agent-text {
  text-align: right;
}

/* ── Composer: button order mirrors ── */
[dir=rtl] .composer-shell {
  flex-direction: row-reverse;
}
[dir=rtl] .composer-foot {
  flex-direction: row-reverse;
}

/* ── Chat messages ── */
[dir=rtl] .msg-user {
  margin-left: 0;
  margin-right: auto;
  text-align: right;
}
[dir=rtl] .msg-agent {
  text-align: right;
}
[dir=rtl] .summary-body {
  text-align: right;
}

/* ── Quick prompts: align right in RTL ── */
[dir=rtl] .quick-prompts {
  direction: rtl;
  text-align: right;
}
[dir=rtl] .qp {
  direction: rtl;
  text-align: right;
}

/* ── Show-prompts row ── */
[dir=rtl] .show-prompts-row {
  flex-direction: row-reverse;
}

/* ── History / dashboards / inbox sheets: slide from the LEFT in RTL ── */
[dir=rtl] .sheet-backdrop {
  direction: rtl;
}
[dir=rtl] .sheet {
  /* LTR: slides in from right. RTL: slides in from left. */
  right: auto;
  left: 0;
  transform: translateX(-100%);
}
[dir=rtl] .sheet.open {
  transform: translateX(0);
}
[dir=rtl] .sheet-right {
  left: auto;
  right: 0;
  transform: translateX(100%);
}
[dir=rtl] .sheet-right.open {
  transform: translateX(0);
}
[dir=rtl] .sheet-head {
  flex-direction: row-reverse;
}

/* ── Report canvas ── */
[dir=rtl] .canvas-head {
  flex-direction: row-reverse;
}
[dir=rtl] .report-head {
  flex-direction: row-reverse;
}
[dir=rtl] .report-head-left {
  flex-direction: row-reverse;
}
[dir=rtl] .report-head-meta {
  text-align: right;
}
[dir=rtl] .report-actions {
  flex-direction: row-reverse;
}
[dir=rtl] .trust-row {
  flex-direction: row-reverse;
}

/* ── Numbers, dates, currency: stay LTR even inside RTL ── */
/* All numeric table cells, KPI values, AED amounts, times, and dates
   must render left-to-right so digits read correctly. */
[dir=rtl] .kc-l,
[dir=rtl] .v,
[dir=rtl] .csb-chip b,
[dir=rtl] .bfs-kpi-val,
[dir=rtl] .stat .v,
[dir=rtl] .rs-time {
  direction: ltr;
  unicode-bidi: isolate;
}
/* Table cells: use isolate so AED amounts inside RTL rows stay LTR */
[dir=rtl] td,
[dir=rtl] .dp-table td {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right; /* text still aligns right, but numerals render LTR */
}
[dir=rtl] th {
  text-align: right;
}
/* Report stats numbers */
[dir=rtl] .report-sub,
[dir=rtl] .rs-time {
  direction: ltr;
  unicode-bidi: embed;
}

/* ── Status footer ── */
[dir=rtl] .status-footer {
  flex-direction: row-reverse;
}

/* ── Modals ── */
[dir=rtl] .modal-header {
  flex-direction: row-reverse;
}
[dir=rtl] .modal-footer {
  flex-direction: row-reverse;
}

/* ── Switcher pop ── */
[dir=rtl] .switcher-pop {
  right: auto;
  left: 12px;
}

/* ── Role home cards ── */
[dir=rtl] .rh-cards {
  direction: rtl;
}
[dir=rtl] .rh-card {
  flex-direction: row-reverse;
  text-align: right;
}
[dir=rtl] .rh-card-go {
  transform: scaleX(-1); /* flip the right-arrow to point left */
}
[dir=rtl] .rh-greet {
  text-align: right;
}

/* ── Suggest row ── */
[dir=rtl] .suggest-row {
  flex-direction: row-reverse;
  flex-wrap: wrap;
}

/* ── Data preview ── */
[dir=rtl] .dp-head {
  flex-direction: row-reverse;
}

/* ── KPI chips ── */
[dir=rtl] .kpi-chips {
  flex-direction: row-reverse;
}
[dir=rtl] .kpi-chip {
  flex-direction: row-reverse;
}

/* ── Canvas stats bar ── */
[dir=rtl] .canvas-statsbar {
  flex-direction: row-reverse;
}

/* ── Narrow screen: RTL grid ── */
@media (max-width: 1024px) {
  [dir=rtl] .workspace {
    grid-template-columns: 64px 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
  [dir=rtl] .rail { grid-column: 1; grid-row: 1 / 3; }
  [dir=rtl] .chat-pane { grid-column: 2; grid-row: 1; }
  [dir=rtl] .canvas-pane { grid-column: 2; grid-row: 2; border-right: none; border-top: 2px solid var(--line); }
}

/* =============================================================================
   CLAB DESK - blended human + AI service (Wave C chat integration)
   Light theme, blue #2563eb, no gradients. Reuses existing tokens.
   ============================================================================= */

/* ── 1. Flag → expectation capture (inline under an answer) ── */
.fb-expect {
  margin-top: 6px;
  background: var(--acc-soft);
  border: 1px solid var(--acc-tint);
  border-radius: 10px;
  padding: 11px 13px;
  animation: fade-in 180ms var(--ease);
  align-self: stretch;
}
.fb-expect-q {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--acc-ink);
  margin-bottom: 8px;
}
.fb-expect-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.fb-expect-chip {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--acc-tint);
  border-radius: 16px;
  font-size: var(--fs-12);
  color: var(--acc-ink);
  transition: all var(--t-fast) var(--ease);
}
.fb-expect-chip:hover, .fb-expect-chip.on {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}
.fb-expect textarea {
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: var(--fs-13);
  background: var(--surface);
  color: var(--t-1);
  outline: none;
}
.fb-expect textarea:focus { border-color: var(--line-focus); }
.fb-expect-actions { display: flex; gap: 7px; margin-top: 8px; justify-content: flex-end; }
.fb-expect-send {
  padding: 5px 14px;
  background: var(--acc);
  color: #fff;
  border-radius: 7px;
  font-size: var(--fs-12);
  font-weight: 600;
  transition: background var(--t-fast) var(--ease);
}
.fb-expect-send:hover { background: var(--acc-hover); }
.fb-expect-skip {
  padding: 5px 12px;
  background: transparent;
  color: var(--t-3);
  border-radius: 7px;
  font-size: var(--fs-12);
}
.fb-expect-skip:hover { color: var(--t-1); }

/* ── 2. "Get a person on this" affordance ── */
.get-person-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}
.get-person-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: var(--fs-12);
  font-weight: 500;
  color: var(--t-3);
  transition: all var(--t-fast) var(--ease);
}
.get-person-btn:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: var(--acc-soft);
}
.get-person-btn svg { flex-shrink: 0; opacity: 0.85; }

/* ── 3. Status chip - "👤 Sara · Finance is on it" ── */
.desk-chip {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  padding: 7px 12px;
  background: var(--acc-soft);
  border: 1px solid var(--acc-tint);
  border-left: 3px solid var(--acc);
  border-radius: 9px;
  font-size: var(--fs-13);
  color: var(--acc-ink);
  animation: fade-in 200ms var(--ease);
  max-width: 92%;
}
.desk-chip .dc-avatar {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--acc);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-11); font-weight: 700;
}
.desk-chip .dc-text { line-height: 1.35; }
.desk-chip .dc-name { font-weight: 700; }
.desk-chip .dc-state { color: var(--t-3); font-weight: 500; }
/* typing… dots */
.desk-chip .dc-typing { display: inline-flex; gap: 2px; align-items: center; margin-left: 2px; }
.desk-chip .dc-typing i {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--acc);
  display: inline-block;
  animation: dc-blink 1.2s infinite both;
}
.desk-chip .dc-typing i:nth-child(2) { animation-delay: 0.2s; }
.desk-chip .dc-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dc-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.desk-chip.resolved {
  background: var(--green-soft);
  border-color: #a7f3d0;
  border-left-color: var(--green);
  color: #065f46;
}
.desk-chip.resolved .dc-avatar { background: var(--green); }

/* ── 4. Human reply inline - a real named person ── */
.msg-human {
  align-self: flex-start;
  width: 100%;
  display: flex;
  gap: 10px;
  animation: fade-in 220ms var(--ease);
}
.msg-human .mh-avatar {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--acc);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-14); font-weight: 700;
  margin-top: 2px;
}
.msg-human .mh-body {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--acc-tint);
  border-left: 3px solid var(--acc);
  border-radius: 4px 12px 12px 12px;
  padding: 10px 13px;
  box-shadow: var(--shadow-sm);
}
.msg-human .mh-head {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 5px;
}
.msg-human .mh-name { font-size: var(--fs-13); font-weight: 700; color: var(--t-1); }
.msg-human .mh-role {
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--acc);
  background: var(--acc-soft);
  padding: 1px 7px;
  border-radius: 10px;
}
.msg-human .mh-person-tag {
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--t-4); font-weight: 700; margin-left: auto;
  display: inline-flex; align-items: center; gap: 3px;
}
.msg-human .mh-text {
  font-size: var(--fs-14);
  color: var(--t-1);
  line-height: 1.55;
  white-space: pre-wrap;
}
.msg-human .mh-time { font-size: 10px; color: var(--t-4); margin-top: 5px; }

/* ── 7. Proactive offer chip (from chat SSE) ── */
.proactive-offer {
  align-self: flex-start;
  display: flex; align-items: center; gap: 10px;
  background: var(--acc-soft);
  border: 1px dashed var(--acc-tint);
  border-radius: 10px;
  padding: 10px 13px;
  max-width: 92%;
  animation: fade-in 200ms var(--ease);
}
.proactive-offer .po-text { font-size: var(--fs-13); color: var(--acc-ink); line-height: 1.4; }
.proactive-offer .po-btn {
  flex-shrink: 0;
  padding: 5px 13px;
  background: var(--acc);
  color: #fff;
  border-radius: 7px;
  font-size: var(--fs-12);
  font-weight: 600;
  transition: background var(--t-fast) var(--ease);
}
.proactive-offer .po-btn:hover { background: var(--acc-hover); }
.proactive-offer .po-dismiss {
  flex-shrink: 0;
  width: 20px; height: 20px;
  color: var(--t-4);
  font-size: 15px; line-height: 1;
}
.proactive-offer .po-dismiss:hover { color: var(--t-2); }

/* ── Wave 4b: Smart Auto-Router handoff UX ── */
/* Auto-switch chip - confidence >= switchFloor. Visible + reversible: always
   pairs with a "Stay with X" undo, never a silent switch. */
.router-handoff-chip {
  align-self: flex-start;
  display: flex; align-items: center; gap: 9px;
  background: var(--acc-soft);
  border: 1px solid var(--acc-tint);
  border-left: 3px solid var(--acc);
  border-radius: 9px;
  padding: 8px 12px;
  max-width: 92%;
  font-size: var(--fs-13);
  color: var(--acc-ink);
  animation: fade-in 200ms var(--ease);
}
.router-handoff-chip .rhc-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--acc);
}
.router-handoff-chip .rhc-icon svg { width: 16px; height: 16px; }
.router-handoff-chip .rhc-text { flex: 1; line-height: 1.4; font-weight: 500; }
.router-handoff-chip .rhc-undo {
  flex-shrink: 0;
  padding: 4px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--t-3);
  border-radius: 7px;
  font-size: var(--fs-12);
  font-weight: 600;
  transition: all var(--t-fast) var(--ease);
}
.router-handoff-chip .rhc-undo:hover { border-color: var(--acc); color: var(--acc); background: #fff; }

/* Inline suggestion - 0.4 <= confidence < switchFloor. Never auto-switches;
   tap-to-switch or dismiss (both logged for tuning). */
.router-suggest-chip {
  align-self: flex-start;
  display: flex; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  max-width: 92%;
  font-size: var(--fs-13);
  color: var(--t-2);
  animation: fade-in 200ms var(--ease);
}
.router-suggest-chip .rsc-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--t-3);
}
.router-suggest-chip .rsc-icon svg { width: 16px; height: 16px; }
.router-suggest-chip .rsc-text { flex: 1; line-height: 1.4; }
.router-suggest-chip .rsc-switch {
  flex-shrink: 0;
  padding: 4px 11px;
  background: var(--acc);
  color: #fff;
  border-radius: 7px;
  font-size: var(--fs-12);
  font-weight: 600;
  transition: background var(--t-fast) var(--ease);
}
.router-suggest-chip .rsc-switch:hover { background: var(--acc-hover); }
.router-suggest-chip .rsc-dismiss {
  flex-shrink: 0;
  width: 20px; height: 20px;
  color: var(--t-4);
  font-size: 15px; line-height: 1;
}
.router-suggest-chip .rsc-dismiss:hover { color: var(--t-2); }

/* ── 6. Notification bell - human replies / resolutions ── */
.desk-bell-btn { position: relative; }
.desk-bell-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--acc);
  color: #fff;
  border-radius: 9px;
  font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.desk-bell-btn.has-unread svg { color: var(--acc); }
/* In-app Guide concierge button - subtle blue accent so it reads as the helper */
.guide-btn svg { color: var(--acc); }
.guide-btn:hover { background: #eff6ff; border-color: var(--acc); }
/* Desk notification dropdown */
.desk-notif-pop {
  position: fixed;
  top: 52px; right: 14px;
  width: 320px; max-width: calc(100vw - 28px);
  max-height: 60vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 2100;
  animation: fade-in 140ms var(--ease);
}
.desk-notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-13); font-weight: 700; color: var(--t-1);
}
.desk-notif-head .dn-clear { font-size: var(--fs-12); color: var(--acc); font-weight: 500; }
.desk-notif-list { padding: 6px; }
.desk-notif-empty { padding: 22px 14px; text-align: center; color: var(--t-4); font-size: var(--fs-13); }
.desk-notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.desk-notif-item:hover { background: var(--acc-soft); }
.desk-notif-item .dni-dot {
  flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--acc); margin-top: 5px;
}
.desk-notif-item.is-resolved .dni-dot { background: var(--green); }
.desk-notif-item .dni-body { flex: 1; min-width: 0; }
.desk-notif-item .dni-title { font-size: var(--fs-13); font-weight: 600; color: var(--t-1); }
.desk-notif-item .dni-sub { font-size: var(--fs-12); color: var(--t-3); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-notif-item .dni-age { font-size: 10px; color: var(--t-4); margin-top: 2px; }

/* ── 8. Handler "Desk" link in header ── */
.desk-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  background: var(--acc-soft);
  border: 1px solid var(--acc-tint);
  border-radius: 8px;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--acc-ink);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}
.desk-link-btn:hover { background: var(--acc-tint); border-color: var(--acc); }
.desk-link-btn svg { flex-shrink: 0; }

/* ── RTL mirrors ── */
[dir=rtl] .msg-human { flex-direction: row-reverse; text-align: right; }
[dir=rtl] .msg-human .mh-body { border-left: none; border-right: 3px solid var(--acc); border-radius: 12px 4px 12px 12px; }
[dir=rtl] .msg-human .mh-person-tag { margin-left: 0; margin-right: auto; }
[dir=rtl] .desk-chip { border-left: none; border-right: 3px solid var(--acc); }
[dir=rtl] .desk-chip.resolved { border-right-color: var(--green); }
[dir=rtl] .fb-expect-actions { flex-direction: row-reverse; }
[dir=rtl] .desk-notif-pop { right: auto; left: 14px; }
[dir=rtl] .desk-bell-badge { right: auto; left: -3px; }

/* =============================================================================
   WAVE D - Assignment + Admin panels
   Light/blue #2563eb, no gradients, no dark mode, RTL-safe
   ============================================================================= */

/* ── Pinned persona button marker ──────────────────────────────────────────── */
.persona-btn.pinned { position: relative; }
.pb-pin {
  position: absolute;
  top: 2px; right: 2px;
  width: 11px; height: 11px;
  display: flex; align-items: center; justify-content: center;
  color: var(--acc);
  pointer-events: none;
}
.persona-btn.pinned .pb-icon { outline: 1.5px solid var(--acc-tint); outline-offset: 1px; border-radius: 10px; }

/* ── Rail pref pop (right-click menu on an agent button) ───────────────────── */
.rail-pref-pop {
  position: fixed;
  z-index: 3000;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 200px;
}
.rpp-name {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--t-2);
  padding: 4px 8px 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.rpp-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  font-size: var(--fs-13);
  color: var(--t-1);
  border-radius: 5px;
  transition: background var(--t-fast);
}
.rpp-btn:hover { background: var(--acc-soft); color: var(--acc); }

/* ── Rail pin control (in chat header after persona selected) ──────────────── */
.rail-pin-ctrl {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
  padding: 0 4px;
}
.rpc-btn {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: var(--t-4);
  transition: background var(--t-fast), color var(--t-fast);
  border: 1px solid transparent;
}
.rpc-btn:hover { background: var(--acc-soft); color: var(--acc); border-color: var(--acc-tint); }
.rpc-btn.on { color: var(--acc); background: var(--acc-soft); }

/* ── Admin desk pane (shared shell for handlers / routes / feedback) ────────── */
.admin-desk-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}
.adp-head {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.adp-title {
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--t-1);
  margin: 0 0 4px;
}
.adp-sub {
  font-size: var(--fs-13);
  color: var(--t-3);
  margin: 0 0 12px;
}
.adp-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--acc);
  color: #fff;
  border-radius: 6px;
  font-size: var(--fs-13);
  font-weight: 600;
  transition: background var(--t-fast);
}
.adp-add-btn:hover { background: var(--acc-hover); }

/* ── Inline add form ─────────────────────────────────────────────────────────── */
.adp-form {
  padding: 14px 24px;
  background: var(--acc-soft);
  border-bottom: 1px solid var(--acc-tint);
  flex-shrink: 0;
}
.adp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.adp-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-13);
  color: var(--t-2);
  font-weight: 500;
}
.adp-form-grid input,
.adp-form-grid select {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font-size: var(--fs-13);
  background: var(--surface);
  color: var(--t-1);
  transition: border-color var(--t-fast);
}
.adp-form-grid input:focus,
.adp-form-grid select:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 2px var(--acc-soft); }
.adp-check-row {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  grid-column: 1 / -1;
  font-size: var(--fs-13);
  color: var(--t-2);
}
.adp-check-row input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--acc); flex-shrink: 0; }
.adp-form-foot {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.adp-cancel {
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: var(--fs-13);
  color: var(--t-2);
  background: var(--surface);
  transition: background var(--t-fast);
}
.adp-cancel:hover { background: var(--surface-3); }
.adp-save {
  padding: 6px 14px;
  background: var(--acc);
  color: #fff;
  border-radius: 6px;
  font-size: var(--fs-13);
  font-weight: 600;
  transition: background var(--t-fast);
}
.adp-save:hover { background: var(--acc-hover); }

/* ── List rows ───────────────────────────────────────────────────────────────── */
.adp-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.adp-loading, .adp-empty {
  padding: 24px;
  font-size: var(--fs-13);
  color: var(--t-4);
  text-align: center;
}
.adp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  transition: background var(--t-fast);
}
.adp-row:hover { background: var(--surface-3); }
.adpr-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.adpr-name {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--t-1);
}
.adpr-role {
  font-size: var(--fs-12);
  color: var(--t-3);
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 6px;
}
.adpr-badge {
  font-size: var(--fs-11);
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 7px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.adpr-badge.sup { background: var(--acc-soft); color: var(--acc); }
.adpr-badge.off { background: var(--amber-soft); color: var(--amber); }
.adpr-agent-tag {
  font-size: var(--fs-13);
  font-weight: 700;
  color: var(--acc);
  background: var(--acc-soft);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: 'JetBrains Mono', monospace;
}
.adpr-arrow {
  color: var(--t-4);
  font-size: var(--fs-14);
}
.adpr-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.adpr-edit, .adpr-toggle, .adpr-del {
  padding: 4px 10px;
  font-size: var(--fs-12);
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--t-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.adpr-edit:hover, .adpr-toggle:hover { background: var(--acc-soft); color: var(--acc); border-color: var(--acc-tint); }
.adpr-del { color: var(--red); border-color: var(--red-soft); }
.adpr-del:hover { background: var(--red-soft); }

/* ── Feedback review rows ────────────────────────────────────────────────────── */
.adp-fb-row {
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  transition: background var(--t-fast);
}
.adp-fb-row:hover { background: var(--surface-3); }
.adp-fb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.adp-fb-agent {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--acc);
  background: var(--acc-soft);
  border-radius: 4px;
  padding: 1px 7px;
  font-family: 'JetBrains Mono', monospace;
}
.adp-fb-age { font-size: var(--fs-12); color: var(--t-4); margin-left: auto; }
.adp-fb-reason {
  font-size: var(--fs-12);
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 4px;
  padding: 1px 7px;
}
.adp-fb-desk-badge {
  font-size: var(--fs-12);
  color: var(--green);
  background: var(--green-soft);
  border-radius: 4px;
  padding: 1px 7px;
  font-weight: 600;
}
.adp-fb-note {
  font-size: var(--fs-13);
  color: var(--t-1);
  padding: 6px 10px;
  background: var(--surface-2);
  border-left: 3px solid var(--acc);
  border-radius: 0 5px 5px 0;
  line-height: 1.5;
}
.adp-fb-note.muted { color: var(--t-4); border-left-color: var(--line); background: transparent; }

/* ── Workload mini-row (inside Feedback Review head) ─────────────────────────── */
.adp-workload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  flex-wrap: wrap;
}
.adw-label {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--t-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.adw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: var(--fs-12);
  color: var(--t-2);
}
.adw-chip b { font-weight: 700; color: var(--acc); }
.adw-chip.unclaimed { border-style: dashed; color: var(--t-3); }
.adw-chip.unclaimed b { color: var(--amber); }

/* ── RTL mirrors ─────────────────────────────────────────────────────────────── */
[dir=rtl] .adp-fb-note { border-left: none; border-right: 3px solid var(--acc); border-radius: 5px 0 0 5px; }
[dir=rtl] .adp-fb-note.muted { border-right-color: var(--line); }
[dir=rtl] .adp-fb-age { margin-left: 0; margin-right: auto; }
[dir=rtl] .rail-pref-pop { right: auto; }
[dir=rtl] .rail-pin-ctrl { margin-left: 0; margin-right: auto; }
[dir=rtl] .desk-notif-item { flex-direction: row-reverse; }

/* ── CSAT Survey ──────────────────────────────────────────────────────────── */
.csat-survey {
  position: relative;
  margin: 12px 0;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--acc-tint);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(37,99,235,.08);
  animation: csat-fadein .22s ease;
}
@keyframes csat-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.csat-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}
.csat-q {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--t-1);
}
.csat-sub {
  font-size: var(--fs-12);
  color: var(--t-3);
  margin-bottom: 10px;
}
.csat-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.csat-star {
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--t-4);
  transition: color var(--t-fast), transform var(--t-fast);
  background: none;
  border: none;
  padding: 2px;
  border-radius: 4px;
}
.csat-star:hover,
.csat-star.on { color: #f59e0b; transform: scale(1.15); }
.csat-star:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.csat-thumbs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.csat-thumb {
  font-size: 20px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  line-height: 1.2;
}
.csat-thumb:hover { background: var(--acc-soft); border-color: var(--acc-tint); }
.csat-thumb.on   { background: var(--acc-soft); border-color: var(--acc); transform: scale(1.1); }
.csat-thumb:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.csat-comment {
  width: 100%;
  padding: 6px 10px;
  font-size: var(--fs-13);
  font-family: inherit;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--t-1);
  resize: vertical;
  min-height: 52px;
  margin-bottom: 10px;
  box-sizing: border-box;
  transition: border-color var(--t-fast);
}
.csat-comment:focus {
  outline: none;
  border-color: var(--acc);
}
.csat-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.csat-skip {
  font-size: var(--fs-13);
  color: var(--t-4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--t-fast);
}
.csat-skip:hover { color: var(--t-2); }
.csat-send {
  font-size: var(--fs-13);
  font-weight: 600;
  color: #fff;
  background: var(--acc);
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background var(--t-fast), opacity var(--t-fast);
}
.csat-send:hover { background: var(--acc-hover); }
.csat-send:disabled { opacity: .45; cursor: not-allowed; }
.csat-thanks {
  padding: 14px 18px;
  text-align: center;
  font-size: var(--fs-14);
  color: var(--green);
  font-weight: 600;
  background: var(--green-soft);
  border-radius: 10px;
  border: 1px solid rgba(22,163,74,.18);
  animation: csat-fadein .22s ease;
}

/* ── Unified notification type badge ─────────────────────────────────────── */
.dni-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1.5;
}
.dni-type-badge[data-kind="desk"]     { background: var(--acc-soft);   color: var(--acc); }
.dni-type-badge[data-kind="inbox"]    { background: var(--amber-soft);  color: var(--amber); }
.dni-type-badge[data-kind="resolved"] { background: var(--green-soft);  color: var(--green); }
.dni-type-badge[data-kind="alert"]    { background: var(--red-soft);    color: var(--red); }

/* ── Admin: Analytics pane ──────────────────────────────────────────────── */
.adp-analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 700px) {
  .adp-analytics-grid { grid-template-columns: 1fr; }
}
.adp-analytics-col {
  padding: 16px 20px;
  border-right: 1px solid var(--line);
  min-height: 120px;
}
.adp-analytics-col:last-child { border-right: none; }
.adp-analytics-section-title {
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t-3);
  margin-bottom: 10px;
}
.adp-analytics-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.adp-analytics-row:last-child { border-bottom: none; }
.aar-count {
  font-size: var(--fs-14);
  font-weight: 700;
  color: var(--acc);
  min-width: 30px;
  text-align: right;
  flex-shrink: 0;
}
.aar-text {
  font-size: var(--fs-13);
  color: var(--t-1);
  flex: 1;
  line-height: 1.4;
}
.aar-agent {
  font-size: 11px;
  background: var(--acc-soft);
  color: var(--acc);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.aar-age {
  font-size: 11px;
  color: var(--t-4);
  flex-shrink: 0;
}
.adp-analytics-empty {
  font-size: var(--fs-13);
  color: var(--t-4);
  padding: 12px 0;
}

/* ── Admin: Learning Suggestions pane ───────────────────────────────────── */
.adp-review-gate-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--amber-soft);
  border-bottom: 1px solid rgba(217,119,6,.2);
  font-size: var(--fs-13);
  color: var(--amber);
  font-weight: 500;
}
.adp-review-gate-notice svg {
  flex-shrink: 0;
  opacity: .85;
}
.adp-suggestion-row {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  transition: background var(--t-fast);
}
.adp-suggestion-row:hover { background: var(--surface-3); }
.asr-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.asr-agent {
  font-size: 11px;
  background: var(--acc-soft);
  color: var(--acc);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.asr-age {
  font-size: 11px;
  color: var(--t-4);
  margin-left: auto;
}
.asr-q {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--t-1);
  margin-bottom: 3px;
}
.asr-q strong { color: var(--acc); font-weight: 700; }
.asr-a {
  font-size: var(--fs-13);
  color: var(--t-2);
  line-height: 1.5;
  margin-bottom: 8px;
}
.asr-a strong { color: var(--t-3); font-weight: 600; }
/* Review-gated notice + per-suggestion publish fields (Wave H1) */
.sugg-notice {
  font-size: var(--fs-12);
  color: var(--acc);
  background: var(--acc-soft);
  border: 1px solid rgba(37,99,235,.18);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 20px;
  line-height: 1.5;
}
.asr-status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface-3);
  color: var(--t-3);
}
.asr-status-pending   { background: var(--acc-soft); color: var(--acc); }
.asr-status-published { background: rgba(22,163,74,.12); color: var(--green); }
.asr-status-rejected  { background: var(--red-soft);  color: var(--red); }
.asr-reviewed { margin-top: 6px; color: var(--t-3); font-size: var(--fs-12); }
.asr-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 10px;
}
.asr-field { display: flex; flex-direction: column; gap: 3px; }
.asr-field > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--t-3);
}
.asr-cap, .asr-args {
  font-size: var(--fs-13);
  font-family: 'JetBrains Mono', monospace;
  color: var(--t-1);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 9px;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
.asr-cap:focus, .asr-args:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.asr-actions {
  display: flex;
  gap: 8px;
}
.asr-publish {
  font-size: var(--fs-12);
  font-weight: 600;
  color: #fff;
  background: var(--acc);
  border: none;
  border-radius: 5px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background var(--t-fast), opacity var(--t-fast);
}
.asr-publish:hover { background: #1d4ed8; }
.asr-publish:disabled { opacity: .4; cursor: not-allowed; }
.asr-reject {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 5px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background var(--t-fast), opacity var(--t-fast);
}
.asr-reject:hover { background: rgba(239,68,68,.18); }
.asr-reject:disabled { opacity: .4; cursor: not-allowed; }
.adp-suggestions-empty {
  font-size: var(--fs-13);
  color: var(--t-4);
  padding: 20px 20px;
}

/* ── RTL mirrors (Wave E additions) ─────────────────────────────────────── */
[dir=rtl] .csat-foot { justify-content: flex-start; }
[dir=rtl] .adp-analytics-col { border-right: none; border-left: 1px solid var(--line); }
[dir=rtl] .adp-analytics-col:last-child { border-left: none; }
[dir=rtl] .asr-age { margin-left: 0; margin-right: auto; }
[dir=rtl] .adp-review-gate-notice { flex-direction: row-reverse; }

/* ════════════════════════════════════════════════════════════════════════
   AGENTS DASHBOARD (admin) - responsive tile grid, click a tile to run
   ════════════════════════════════════════════════════════════════════════ */
.agent-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 18px 20px 24px;
  overflow-y: auto;
}
.agent-tile { position: relative; }
.agent-tile-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "dot icon"
    "name name"
    "chips chips"
    "foot foot";
  align-items: center;
  gap: 6px 10px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.agent-tile-btn:hover {
  border-color: var(--acc);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.agent-tile-btn:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-color: var(--acc);
}
.agent-tile.is-flagship .agent-tile-btn {
  border-color: var(--acc-tint);
  background: color-mix(in srgb, var(--acc-soft) 55%, var(--surface));
}
.at-dot {
  grid-area: dot;
  width: 9px; height: 9px; border-radius: 50%;
  align-self: start; margin-top: 4px;
  box-shadow: 0 0 0 3px var(--surface);
}
.at-dot-green { background: var(--green); }
.at-dot-amber { background: var(--amber); }
.at-dot-red   { background: var(--red); }
.at-dot-none  { background: var(--t-4); }
.at-icon {
  grid-area: icon;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  justify-self: end;
  color: var(--acc);
}
.at-icon svg { width: 26px; height: 26px; }
.at-name {
  grid-area: name;
  font-size: var(--fs-15);
  font-weight: 700;
  color: var(--t-1);
  line-height: 1.25;
  display: flex; align-items: center; gap: 6px;
}
.at-flag { color: var(--acc); font-size: var(--fs-13); }
.at-chips {
  grid-area: chips;
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px;
}
.at-chip {
  font-size: var(--fs-11);
  color: var(--t-3);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.at-chip b { color: var(--t-1); font-weight: 700; }
.at-foot {
  grid-area: foot;
  margin-top: 6px;
  font-size: var(--fs-11);
  color: var(--t-4);
}

/* ── Settings: voice accent dropdown ──────────────────────────────────── */
.setting-select {
  font-size: var(--fs-13);
  color: var(--t-1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 11px;
  min-width: 200px;
  max-width: 260px;
  margin-left: auto;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.setting-select:hover { border-color: var(--acc); }
.setting-select:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* ── Mic: processing (cloud STT) state - distinct from listening ────────── */
.mic-btn.processing {
  color: var(--acc);
  background: var(--acc-soft);
  border-color: var(--acc);
  animation: mic-spin 0.9s linear infinite;
}
@keyframes mic-spin {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
  50%      { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0); }
}

/* ── RTL mirrors for the agent tiles ──────────────────────────────────── */
[dir=rtl] .agent-tile-btn { text-align: right; }
[dir=rtl] .at-icon { justify-self: start; }
[dir=rtl] .at-dot { box-shadow: 0 0 0 3px var(--surface); }

/* ── Regression fixes (2026-06-19) ─────────────────────────────────────────── */
/* Make the [hidden] attribute authoritative - several panes/bodies set an explicit
   display (flex/grid/block) which was overriding [hidden], leaving admin panes
   stacked, desk placeholders stuck, and inbox alert bodies permanently expanded. */
[hidden] { display: none !important; }
/* Temporarily hide the Arabic UI-language toggles (voice accent picker unaffected). */
#btnLangToggle, #deskLangToggle, #loginLangBtn, .lang-toggle-btn, .login-lang-btn,
#setLang [data-v="ar"], [data-v="ar"] { display: none !important; }
/* Keep expanded inbox alert result tables contained within the card. */
.inbox-body { max-width: 100%; overflow-x: auto; }
.inbox-body table, .inbox-body pre { display: block; max-width: 100%; overflow-x: auto; max-height: 220px; }

/* =============================================================================
   AGENT STUDIO DASHBOARD (admin) - rebuilt tiled landing (2026-06-20)
   Strict light · accent #2563eb · soft shadows · rounded-2xl · NO gradients.
   ============================================================================= */
.agent-dash { background: var(--bg); }
.agent-dash-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 22px 26px 30px;
}

/* 1 · Title row ------------------------------------------------------------- */
.agd-titlerow {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px;
}
.agd-title { font-size: 22px; font-weight: 800; color: var(--t-1); margin: 0 0 4px; letter-spacing: -0.02em; }
.agd-sub   { font-size: var(--fs-13); color: var(--t-3); margin: 0; font-weight: 500; }
/* "＋ New Agent" - opens the no-code Agent Wizard (agent-wizard.html). */
.agd-newagent {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px;
  margin-left: auto;
  background: var(--acc); color: #fff; border: 1px solid var(--acc);
  border-radius: 11px; padding: 0 16px; height: 38px;
  font-size: var(--fs-13); font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.agd-newagent:hover { background: #1d4fd8; transform: translateY(-1px); }
.agd-newagent:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* Swarm entry-point - light ghost button; sits left of New Agent and pushes
   the action group to the right edge of the title row. */
.agd-swarm {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px;
  margin-left: auto;
  background: var(--acc-soft); color: var(--acc-ink); border: 1px solid var(--acc-tint);
  border-radius: 11px; padding: 0 14px; height: 38px;
  font-size: var(--fs-13); font-weight: 700; cursor: pointer; text-decoration: none;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.agd-swarm:hover { background: var(--acc-tint); border-color: var(--acc); transform: translateY(-1px); }
.agd-swarm:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
/* With Swarm taking the auto margin, New Agent no longer needs it. */
.agd-swarm + .agd-newagent { margin-left: 0; }

.agd-refresh {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--t-2);
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.agd-refresh:hover { border-color: var(--acc); color: var(--acc); transform: translateY(-1px); }
.agd-refresh:active svg { transform: rotate(-90deg); transition: transform .25s var(--ease); }
.agd-refresh:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* 2 · KPI cards ------------------------------------------------------------- */
.agd-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px;
}
.agd-kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 18px 16px; box-shadow: 0 4px 20px -2px rgba(0,0,0,.05);
  display: flex; flex-direction: column; gap: 4px;
}
.agd-kpi-chip {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 10px;
}
.agd-kpi-blue  .agd-kpi-chip { background: var(--acc-soft);   color: var(--acc); }
.agd-kpi-green .agd-kpi-chip { background: var(--green-soft); color: var(--green); }
.agd-kpi-amber .agd-kpi-chip { background: var(--amber-soft); color: var(--amber); }
.agd-kpi-cyan  .agd-kpi-chip { background: #ecfeff;           color: var(--cyan); }
.agd-kpi-num { font-size: 26px; font-weight: 800; color: var(--t-1); letter-spacing: -0.02em; line-height: 1.05; }
.agd-kpi-lbl { font-size: var(--fs-12); color: var(--t-3); font-weight: 500; }

/* 3 · Two-column layout ----------------------------------------------------- */
.agd-grid {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px; align-items: start;
}
.agd-col-main, .agd-col-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.agd-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 4px 20px -2px rgba(0,0,0,.05); overflow: hidden;
}
.agd-card-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.agd-card-title { font-size: var(--fs-15); font-weight: 700; color: var(--t-1); margin: 0; }
.agd-card-cap   { font-size: var(--fs-12); color: var(--t-3); margin: 3px 0 0; font-weight: 500; }

/* 4 · Agent tiles (grouped) ------------------------------------------------- */
.agd-tiles-body { padding: 8px 18px 18px; }
.agd-group { margin-top: 14px; }
.agd-group:first-child { margin-top: 6px; }
.agd-group-head {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 10px;
}
.agd-group-name {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t-3);
}
.agd-group-count {
  font-size: var(--fs-11); font-weight: 700; color: var(--t-3);
  background: var(--surface-3); border-radius: 999px; padding: 1px 8px;
}
.agent-tiles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px;
}
.agent-tile { position: relative; }
.agent-tile-btn {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-areas:
    "icon name"
    "icon desc"
    "badge badge"
    "foot foot";
  align-items: center; gap: 3px 12px;
  width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.agent-tile-btn:hover {
  border-color: var(--acc); box-shadow: 0 8px 22px -6px rgba(37,99,235,.18); transform: translateY(-2px);
}
.agent-tile-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-color: var(--acc); }
.agent-tile-btn.is-selected { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); }
.agent-tile.is-flagship .agent-tile-btn { background: color-mix(in srgb, var(--acc-soft) 45%, var(--surface)); }

.at-icon {
  grid-area: icon; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; align-self: start;
  color: var(--tile-c, var(--acc));
  background: color-mix(in srgb, var(--tile-c, var(--acc)) 12%, #fff);
}
.at-icon svg { width: 24px; height: 24px; }
.at-name {
  grid-area: name; font-size: var(--fs-14); font-weight: 700; color: var(--t-1); line-height: 1.2;
  display: flex; align-items: center; gap: 6px;
}
.at-flag { color: #d97706; font-size: var(--fs-13); }
.at-desc {
  grid-area: desc; font-size: var(--fs-12); color: var(--t-3); line-height: 1.35;
  margin-top: 1px;
  display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.at-badge {
  grid-area: badge; justify-self: start; margin-top: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-11); font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent;
}
.at-badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.at-badge-green { color: var(--green); background: var(--green-soft); border-color: #a7f3d0; }
.at-badge-green .at-badge-dot { background: var(--green); }
.at-badge-amber { color: var(--amber); background: var(--amber-soft); border-color: #fde68a; }
.at-badge-amber .at-badge-dot { background: var(--amber); }
.at-badge-red   { color: var(--red); background: var(--red-soft); border-color: #fecaca; }
.at-badge-red   .at-badge-dot { background: var(--red); }
.at-badge-none  { color: var(--t-3); background: var(--surface-3); border-color: var(--line); }
.at-badge-none  .at-badge-dot { background: var(--t-4); }
.at-foot {
  grid-area: foot; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: var(--fs-11); color: var(--t-3);
}
.at-stat b { color: var(--t-1); font-weight: 700; }

/* 5 · Details panel --------------------------------------------------------- */
.agd-detail-card { min-height: 200px; }
.agd-detail-empty {
  padding: 34px 22px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.agd-detail-empty-orb {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--acc-soft); color: var(--acc);
}
.agd-detail-empty-text { font-size: var(--fs-13); color: var(--t-3); margin: 0; max-width: 220px; line-height: 1.4; }
.agd-detail-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.agd-detail-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  color: var(--detail-c, var(--acc));
  background: color-mix(in srgb, var(--detail-c, var(--acc)) 12%, #fff);
  flex-shrink: 0;
}
.agd-detail-icon svg { width: 25px; height: 25px; }
.agd-detail-id { flex: 1; min-width: 0; }
.agd-detail-name { font-size: var(--fs-15); font-weight: 700; color: var(--t-1); line-height: 1.2; }
.agd-detail-domain {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--t-3); margin-top: 2px;
}
.agd-detail-close {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--line); color: var(--t-3);
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.agd-detail-close:hover { border-color: var(--line-strong); color: var(--t-1); }
.agd-detail-close:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.agd-detail-body { padding: 16px 18px 18px; }
.agd-detail-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px;
}
.agd-metric {
  background: var(--surface-3); border-radius: 11px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.agd-metric-v { font-size: var(--fs-16); font-weight: 800; color: var(--t-1); }
.agd-metric-l { font-size: var(--fs-11); color: var(--t-3); font-weight: 500; }
.agd-detail-sec { margin-bottom: 14px; }
.agd-detail-sec-h {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--t-3); margin-bottom: 8px;
}
.agd-health-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3);
}
.ahb-seg { height: 100%; }
.ahb-green { background: var(--green); }
.ahb-amber { background: var(--amber); }
.ahb-red   { background: var(--red); }
.agd-health-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; }
.ahl { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-11); color: var(--t-2); }
.ahl-dot { width: 8px; height: 8px; border-radius: 50%; }
.agd-detail-na { font-size: var(--fs-12); color: var(--t-3); }
.agd-detail-last { font-size: var(--fs-12); color: var(--t-3); margin-bottom: 14px; }
.agd-detail-last b { color: var(--t-1); font-weight: 600; }
.agd-detail-open {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: 11px; background: var(--acc); color: #fff;
  font-size: var(--fs-13); font-weight: 600; cursor: pointer; border: none;
  transition: background var(--t-fast) var(--ease);
}
.agd-detail-open:hover { background: var(--acc-hover); }
.agd-detail-open:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* Detail action row: primary "Open in chat" + secondary "Test in Sandbox" + "Report card" */
.agd-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.agd-detail-actions .agd-detail-open { flex: 1 1 140px; width: auto; }
.agd-detail-sandbox, .agd-detail-scorecard {
  flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: 11px; background: var(--surface); color: var(--acc);
  font-size: var(--fs-13); font-weight: 600; cursor: pointer; border: 1px solid var(--acc-tint);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.agd-detail-sandbox:hover, .agd-detail-scorecard:hover { background: var(--acc-soft); border-color: var(--acc); }
.agd-detail-sandbox:focus-visible, .agd-detail-scorecard:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ── Per-agent Report Card ────────────────────────────────────────────────── */
.agd-scorecard { margin-top: 14px; }
.agd-sc-loading, .agd-sc-error {
  padding: 14px 4px; font-size: var(--fs-13); color: var(--t-3); text-align: center;
}
.agd-sc-error { color: var(--danger, #b91c1c); }
.agd-sc {
  border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px;
}
.agd-sc-summary {
  font-size: var(--fs-13); color: var(--t-2); line-height: 1.5;
  background: var(--acc-soft); border: 1px solid var(--acc-tint);
  border-radius: 10px; padding: 10px 12px;
}
.agd-sc-sec { display: flex; flex-direction: column; gap: 8px; }
.agd-sc-sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.agd-sc-sec-t { font-size: var(--fs-12); font-weight: 700; color: var(--t-1); letter-spacing: .01em; }
.agd-sc-sec-src { font-size: var(--fs-11); color: var(--t-4); font-weight: 500; }
.agd-sc-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.agd-sc-tile {
  flex: 1 1 90px; min-width: 90px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface-3, #f6f8fc); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.agd-sc-v { font-size: var(--fs-16); font-weight: 800; color: var(--t-1); line-height: 1.1; }
.agd-sc-l { font-size: var(--fs-11); color: var(--t-3); font-weight: 500; }
.agd-sc-sub { font-size: var(--fs-11); color: var(--t-4); }
.agd-sc-when { font-size: var(--fs-12); font-weight: 600; }
.agd-sc-na { font-size: var(--fs-12); color: var(--t-4); font-weight: 600; font-style: italic; }
.agd-sc-empty {
  flex: 1; font-size: var(--fs-12); color: var(--t-4); font-style: italic;
  padding: 8px 12px; background: var(--surface-3, #f6f8fc); border: 1px dashed var(--line); border-radius: 10px;
}
/* Health mini bar (blue/amber/red only, no gradient) */
.agd-sc-health { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.agd-sc-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; background: var(--surface-3, #eef2f9); }
.agd-sc-bar-seg.is-green { background: var(--acc); }
.agd-sc-bar-seg.is-amber { background: #d97706; }
.agd-sc-bar-seg.is-red   { background: #dc2626; }
.agd-sc-health-legend { display: flex; align-items: center; gap: 14px; font-size: var(--fs-12); color: var(--t-2); }
.agd-sc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.agd-sc-dot.is-green { background: var(--acc); }
.agd-sc-dot.is-amber { background: #d97706; }
.agd-sc-dot.is-red   { background: #dc2626; }
.agd-sc-checked { margin-inline-start: auto; color: var(--t-4); font-size: var(--fs-11); }

/* 6 · Usage chart ----------------------------------------------------------- */
.agd-chart-body { padding: 16px 18px 18px; height: 268px; position: relative; }
.agd-chart-body canvas { max-height: 234px; }
.agd-chart-empty {
  position: absolute; inset: 16px 18px; display: grid; place-items: center;
  font-size: var(--fs-13); color: var(--t-3); text-align: center;
}

/* 7 · Activity stream ------------------------------------------------------- */
.agd-activity-body { padding: 8px 10px 12px; max-height: 360px; overflow-y: auto; }
.agd-act-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 9px;
  transition: background var(--t-fast) var(--ease);
}
.agd-act-row:hover { background: var(--surface-3); }
.agd-act-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.agd-act-text { flex: 1; min-width: 0; font-size: var(--fs-13); color: var(--t-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agd-act-text b { color: var(--t-1); font-weight: 600; }
.agd-act-time { font-size: var(--fs-11); color: var(--t-4); flex-shrink: 0; }

/* Responsive - collapse to one column on narrow viewports. */
@media (max-width: 980px) {
  .agd-grid { grid-template-columns: 1fr; }
  .agd-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .agd-kpis { grid-template-columns: 1fr; }
  .agent-tiles-grid { grid-template-columns: 1fr; }
}

/* RTL mirrors */
[dir=rtl] .agent-tile-btn,
[dir=rtl] .agd-detail-empty-text { text-align: right; }
[dir=rtl] .agent-tile-btn {
  grid-template-columns: 1fr 40px;
  grid-template-areas: "name icon" "desc icon" "badge badge" "foot foot";
}
[dir=rtl] .at-badge, [dir=rtl] .agd-group-head { justify-self: end; }

/* =============================================================================
   CLEAN TREATMENT (2026-06-20c) - surface polish on the main chat workspace
   ---------------------------------------------------------------------------
   CSS-ONLY refinement. No HTML/JS/layout/grid changes. Strict light theme,
   accent blue #2563eb, NO gradients, soft shadows, slate palette. Matches the
   crispness of the Agent Studio dashboard (.agd-* cards above). Refines the
   EXISTING selectors in place - every rule here targets a selector that already
   exists; this block sits last so it overrides cleanly. RTL-safe throughout.
   Does NOT touch the regression-fixes block ([hidden], Arabic-toggle hides).
   ============================================================================= */

/* Shared soft-card shadow tokens, aligned with the dashboard's tile shadow. */
:root {
  --shadow-card:  0 4px 20px -2px rgba(15, 23, 42, 0.05);
  --shadow-chip:  0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  --ring-blue:    0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* ── Top bar: hairline crispness ─────────────────────────────────────────── */
.topbar { border-bottom-color: var(--line); box-shadow: var(--shadow-chip); }
.brand-name { letter-spacing: -0.025em; }
.icon-only-btn,
.top-switcher {
  border-radius: 9px;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}

/* ── Persona rail: tidy icon buttons, clear active ring ──────────────────── */
.rail { border-right-color: var(--line); }
.persona-btn .pb-icon {
  border-radius: 11px;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.persona-btn:hover .pb-icon { transform: translateY(-1px); }
.persona-btn.active .pb-icon {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--agent-c) 16%, transparent),
              var(--shadow-chip);
}

/* ── Chat pane head: crisp agent card ────────────────────────────────────── */
.chat-pane { border-right-color: var(--line); }
.chat-pane-head { padding: 16px 20px; }
.agent-icon { border-radius: 12px; }
.agent-name { letter-spacing: -0.02em; }

/* ── Welcome / empty state ───────────────────────────────────────────────── */
.empty-orb { border-radius: 14px; border-color: var(--line); box-shadow: var(--shadow-chip); }
.empty-h { letter-spacing: -0.02em; }

/* ── Chat bubbles ────────────────────────────────────────────────────────── */
/* User = soft slate bubble (was solid blue) - calmer, crisper, one squared
   corner. Keeps right alignment / RTL mirroring handled by existing rules. */
.msg-user {
  padding: 10px 14px;
  background: var(--surface-3);
  color: var(--t-1);
  border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px;
  line-height: 1.55;
}
[dir=rtl] .msg-user { border-radius: 16px 16px 16px 4px; }
/* Assistant summary = white bordered card with the soft dashboard shadow. */
.summary-card {
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}
/* Human-from-desk = keep the warm blue left-accent; just round + soften. */
.msg-human .mh-body {
  border-radius: 4px 16px 16px 16px;
  box-shadow: var(--shadow-card);
}
[dir=rtl] .msg-human .mh-body { border-radius: 16px 4px 16px 16px; }

/* ── Suggestion / starter chips: crisper radius + soft hover lift ────────── */
.suggest-chip { border-radius: 9px; box-shadow: var(--shadow-chip); }
.suggest-chip:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.qp { border-radius: 10px; }
.qp:not(:disabled):hover { box-shadow: var(--shadow-chip); }

/* ── Composer: rounded input, slate-50 bg, blue focus ring, crisp send ───── */
.composer { border-top-color: var(--line); }
.composer-shell {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.composer-shell:focus-within {
  border-color: var(--acc);
  box-shadow: var(--ring-blue);
}
.send-btn { border-radius: 9px; }
.mic-btn { border-radius: 9px; }

/* ── Report canvas: head + cards crisp like the dashboard ────────────────── */
.canvas-head { border-bottom-color: var(--line); }
.canvas-eyebrow { letter-spacing: 0.18em; }
.report-card {
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.report-card:hover { box-shadow: var(--shadow-hover); }
.report-head { border-bottom-color: var(--line); }
.report-title { letter-spacing: -0.02em; }
/* KPI strip + KV / stats reuse slate hairlines - already on-theme; sharpen radii
   of the card-level KPI chips for consistency with the dashboard tiles. */
.kpi-chip { border-radius: 8px; }
.export-btn { border-radius: 8px; }
.ghost-btn { border-radius: 8px; }
.ce-tile { border-radius: 12px; }

/* Empty-canvas tiles get a subtle resting shadow so the empty state reads as
   "cards will appear here", matching the dashboard's tile language. */
.canvas-empty .ce-tile { box-shadow: var(--shadow-chip); }

/* ── Data table: rounded container, sticky header, zebra/hover rows ──────── */
.r-table-wrap { border-radius: 0 0 16px 16px; }
.r-table thead th { background: var(--surface-2); letter-spacing: 0.05em; }
.r-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-3) 45%, var(--surface)); }
.r-table tbody tr:hover td { background: var(--acc-soft); }

/* ── Sheets / drawers (history, dashboards, inbox, schedules) ────────────── */
.sheet { box-shadow: var(--shadow-hover); }
.sheet-head { border-bottom-color: var(--line); }
.sheet-title { letter-spacing: -0.01em; }
.sheet-close { border-radius: 8px; }
.hist-open, .dash-open { border-radius: 12px; }
.hist-open:hover, .dash-open:hover { box-shadow: var(--shadow-chip); }

/* ── Toast: crisp dark pill (single solid, no gradient) ──────────────────── */
.toast { border-radius: 10px; box-shadow: var(--shadow-hover); }

/* ── Rail tooltip: round + soft ──────────────────────────────────────────── */
.rail-tip { border-radius: 10px; box-shadow: var(--shadow-hover); }

/* ── Receipt card: align radius/shadow with the clean card language ──────── */
.receipt-card { border-radius: 16px; box-shadow: var(--shadow-card); }

/* ── Scrollbars: thin slate, matching the dashboard ──────────────────────── */
.chat-stream::-webkit-scrollbar,
.canvas-stream::-webkit-scrollbar,
.sheet-body::-webkit-scrollbar { width: 8px; height: 8px; }
.chat-stream::-webkit-scrollbar-thumb,
.canvas-stream::-webkit-scrollbar-thumb,
.sheet-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--t-4) 55%, var(--line));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.chat-stream::-webkit-scrollbar-thumb:hover,
.canvas-stream::-webkit-scrollbar-thumb:hover,
.sheet-body::-webkit-scrollbar-thumb:hover { background: var(--t-3); background-clip: padding-box; }
.sheet-body { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--t-4) 55%, var(--line)) transparent; }
/* ===== end CLEAN TREATMENT (2026-06-20c) ================================== */

/* ============================================================================
   ACCESS CONTROL (admin) - geo / IP / time-window fence. Light, blue, no gradient.
   ============================================================================ */
.access-pane{padding:20px 24px 0;overflow-y:auto}
.access-pane .adp-head{margin-bottom:14px}
.ac-scoperow{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin-top:10px}
.ac-scope{display:flex;align-items:center;gap:8px;font-size:12.5px;font-weight:600;color:#334155}
.ac-scope select{padding:6px 10px;border:1px solid #e2e8f0;border-radius:8px;font-size:13px;background:#fff;min-width:220px}
.ac-geostat{font-size:12px;color:#64748b}
.ac-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
@media (max-width:880px){.ac-grid{grid-template-columns:1fr}}
.ac-card{border:1px solid #e8edf3;border-radius:14px;background:#fff;padding:16px 18px}
.ac-card-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:12px}
.ac-card-head--plain{padding-left:2px}
.ac-card-title{margin:0;font-size:14.5px;font-weight:700;color:#0f172a}
.ac-card-cap{margin:2px 0 0;font-size:12px;color:#64748b;line-height:1.5}
.ac-card-body{display:flex;flex-direction:column;gap:12px;transition:opacity .15s}
.ac-field{display:flex;flex-direction:column;gap:5px;font-size:12.5px;font-weight:600;color:#334155}
.ac-field input,.ac-field select{padding:8px 11px;border:1px solid #e2e8f0;border-radius:9px;font-size:13px;font-weight:500;color:#0f172a;background:#fff}
.ac-field input:focus,.ac-field select:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.ac-field--sm{max-width:130px}
.ac-hint{font-size:11px;font-weight:500;color:#94a3b8}
.ac-check{display:flex;align-items:center;gap:8px;font-size:12.5px;color:#475569;font-weight:500;cursor:pointer}
.ac-timerow{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}
.ac-timerow .ac-field{flex:0 0 auto}
.ac-timerow .ac-field:last-child{flex:1 1 180px}
/* toggle switch */
.ac-switch{position:relative;display:inline-block;width:38px;height:22px;flex:0 0 auto;cursor:pointer;margin-top:2px}
.ac-switch input{opacity:0;width:0;height:0;position:absolute}
.ac-slider{position:absolute;inset:0;background:#cbd5e1;border-radius:22px;transition:background .15s}
.ac-slider::before{content:"";position:absolute;height:16px;width:16px;left:3px;top:3px;background:#fff;border-radius:50%;transition:transform .15s;box-shadow:0 1px 2px rgba(15,23,42,.2)}
.ac-switch input:checked + .ac-slider{background:#2563eb}
.ac-switch input:checked + .ac-slider::before{transform:translateX(16px)}
.ac-switch input:focus-visible + .ac-slider{box-shadow:0 0 0 3px rgba(37,99,235,.25)}
/* days */
.ac-days{display:flex;gap:6px;flex-wrap:wrap}
.ac-day{position:relative;cursor:pointer}
.ac-day input{position:absolute;opacity:0;width:0;height:0}
.ac-day span{display:inline-block;padding:5px 11px;border:1px solid #e2e8f0;border-radius:8px;font-size:12px;font-weight:600;color:#64748b;background:#fff;transition:.12s}
.ac-day input:checked + span{background:#eff6ff;border-color:#2563eb;color:#2563eb}
/* ip rules */
.ac-iprules{display:flex;flex-direction:column;gap:7px}
.ac-rules-empty{font-size:12px;color:#94a3b8;padding:6px 2px}
.ac-rule{display:flex;align-items:center;gap:9px;padding:7px 10px;border:1px solid #eef2f7;border-radius:9px;background:#fafbfc;font-size:12.5px}
.ac-rule-type{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;padding:2px 7px;border-radius:5px}
.ac-rule-type.allow{background:#ecfdf5;color:#059669}
.ac-rule-type.block{background:#fef2f2;color:#dc2626}
.ac-rule-type.breakglass{background:#eff6ff;color:#2563eb}
.ac-rule-cidr{font-family:ui-monospace,'Cascadia Code',monospace;font-weight:600;color:#0f172a}
.ac-rule-label{color:#64748b}
.ac-rule-global{font-size:10px;font-weight:700;color:#7c3aed;background:#f5f3ff;padding:1px 6px;border-radius:5px}
.ac-rule-del{margin-left:auto;border:none;background:transparent;color:#94a3b8;cursor:pointer;font-size:14px;line-height:1;padding:3px 5px;border-radius:6px}
.ac-rule-del:hover{background:#fef2f2;color:#dc2626}
.ac-iprow{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}
.ac-iprow select,.ac-iprow input{padding:7px 10px;border:1px solid #e2e8f0;border-radius:8px;font-size:12.5px;background:#fff}
.ac-iprow input{flex:1 1 140px;min-width:120px}
.ac-addrule{padding:7px 14px;border:1px solid #2563eb;background:#2563eb;color:#fff;border-radius:8px;font-size:12.5px;font-weight:600;cursor:pointer}
.ac-addrule:hover{background:#1d4ed8}
/* footer */
.ac-foot{position:sticky;bottom:0;display:flex;align-items:center;justify-content:flex-end;gap:14px;padding:14px 0 18px;margin-top:16px;background:#fff;border-top:1px solid #eef2f7;}
.ac-savehint{font-size:12px;color:#059669;font-weight:600}
.ac-save{padding:9px 20px;border:none;background:#2563eb;color:#fff;border-radius:10px;font-size:13.5px;font-weight:700;cursor:pointer}
.ac-save:hover{background:#1d4ed8}
.ac-save:disabled{opacity:.6;cursor:default}

/* ============================================================================
   VISUAL UPGRADE 2026-06-21 - cinematic splash · frosted chrome · readable rail
   (Light/blue app preserved; dark drama lives ONLY in the splash + login.)
   ============================================================================ */

/* ---- Cinematic splash ---- */
.splash.splash-cine{background:#080d20;gap:0;}
.splash-cv{position:absolute;inset:0;width:100%;height:100%;display:block;}
.splash-skip{position:absolute;bottom:26px;right:26px;z-index:2;background:rgba(255,255,255,.08);color:#aeb9da;border:1px solid rgba(255,255,255,.18);border-radius:999px;padding:7px 16px;font-size:12.5px;font-weight:500;cursor:pointer;transition:background .15s,color .15s;}
.splash-skip:hover{background:rgba(255,255,255,.18);color:#fff;}
.splash-skip:focus-visible{outline:2px solid #5b9dff;outline-offset:2px;}

/* ---- Frosted chrome (glass) - selective: top bar, rail, overlays. Data stays crisp. ---- */
.topbar{background:rgba(255,255,255,.74);-webkit-backdrop-filter:blur(14px) saturate(125%);backdrop-filter:blur(14px) saturate(125%);}
.rail{background:rgba(248,250,253,.72);-webkit-backdrop-filter:blur(13px) saturate(120%);backdrop-filter:blur(13px) saturate(120%);border-right:1px solid rgba(37,99,235,.10);}
.admin-backdrop{background:rgba(15,23,42,.32)!important;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);}
.admin-sheet{background:rgba(255,255,255,.86)!important;-webkit-backdrop-filter:blur(18px) saturate(125%);backdrop-filter:blur(18px) saturate(125%);}
.lock-pop .lp-card{background:rgba(255,255,255,.82);-webkit-backdrop-filter:blur(16px) saturate(120%);backdrop-filter:blur(16px) saturate(120%);}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  .topbar,.rail,.admin-sheet,.lock-pop .lp-card{background:var(--surface-1);}
}
@media (prefers-reduced-transparency:reduce){
  .topbar,.rail{background:var(--surface-1)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;}
  .admin-sheet,.lock-pop .lp-card{background:var(--surface-1)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;}
}

/* ---- Readable, prominent rail - boost label contrast + weight, status dots, stronger active ---- */
.workspace{grid-template-columns:96px minmax(320px,var(--chat-w,38%)) 6px 1fr;}
.rail-group span{font-size:9.5px;font-weight:700;letter-spacing:.10em;color:var(--t-2);}
.pb-label{font-size:11px;font-weight:600;line-height:1.2;letter-spacing:-.005em;}
/* override the very-muted (30%) tint that made labels hard to read */
.persona-btn .pb-label{color:color-mix(in srgb,var(--agent-c) 38%,var(--t-1))!important;}
.persona-btn:hover .pb-label{color:color-mix(in srgb,var(--agent-c) 60%,var(--t-1))!important;}
.persona-btn.active .pb-label{color:color-mix(in srgb,var(--agent-c) 64%,#0f172a)!important;font-weight:700;}
.persona-btn.active{background:color-mix(in srgb,var(--agent-c) 12%,transparent);border-radius:11px;}
.persona-btn{border-radius:11px;}
/* live status dot on the agent icon */
.pb-status{position:absolute;top:-2px;right:-2px;width:9px;height:9px;border-radius:50%;background:#22c55e;border:2px solid var(--surface-1);box-shadow:0 0 0 1px rgba(34,197,94,.25);}
.pb-status.training{background:#f59e0b;box-shadow:0 0 0 1px rgba(245,158,11,.25);}
.pb-status.off{background:#94a3b8;box-shadow:none;}

/* ============================================================================
   KNOWLEDGE BASE pane (admin) - documents + FAQ / Q&A curation. Light, blue,
   no gradients. Mirrors the access-pane card language.
   ========================================================================== */
.knowledge-pane{padding:20px 24px 24px;overflow-y:auto}
.kp-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px;flex-wrap:wrap}
.kp-title{margin:0;font-size:16px;font-weight:700;color:var(--t-1)}
.kp-sub{margin:3px 0 0;font-size:12.5px;color:var(--t-3);line-height:1.5;max-width:560px}
.kp-scope{display:flex;gap:12px;align-items:flex-end}
.kp-scope-l{display:flex;flex-direction:column;gap:4px;font-size:11px;font-weight:600;color:var(--t-3)}
.kp-scope-l select{min-width:160px;padding:7px 10px;border:1px solid var(--line);border-radius:9px;background:var(--surface);font-size:13px;color:var(--t-1)}
.kp-scope-l select:focus{outline:none;border-color:var(--acc);box-shadow:0 0 0 3px var(--acc-soft)}

.kp-cols{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:start}
@media (max-width:1080px){.kp-cols{grid-template-columns:1fr}}

.kp-card{border:1px solid var(--line);border-radius:14px;background:var(--surface);padding:16px 18px}
.kpc-head{display:flex;flex-direction:column;gap:2px;margin-bottom:14px}
.kpc-title{font-size:14.5px;font-weight:700;color:var(--t-1)}
.kpc-hint{font-size:12px;color:var(--t-3);line-height:1.5}

/* Drag-drop */
.kp-drop{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;
  border:1.5px dashed var(--line);border-radius:12px;background:var(--surface-2);padding:22px 16px;cursor:pointer;
  color:var(--t-3);transition:border-color .15s,background .15s}
.kp-drop:hover,.kp-drop:focus-visible{border-color:var(--acc);background:var(--acc-soft);color:var(--acc-ink);outline:none}
.kp-drop.drag{border-color:var(--acc);background:var(--acc-soft);color:var(--acc-ink)}
.kp-drop svg{width:26px;height:26px;color:var(--acc)}
.kpd-text{font-size:12.5px}
.kpd-link{color:var(--acc);font-weight:600;text-decoration:underline}

/* Add from URL */
.kp-url{display:flex;gap:8px;margin-top:12px}
.kp-url input{flex:1;min-width:0;padding:9px 11px;border:1px solid var(--line);border-radius:9px;background:var(--surface);
  font-size:13px;color:var(--t-1);font-family:inherit}
.kp-url input:focus{outline:none;border-color:var(--acc);box-shadow:0 0 0 3px var(--acc-soft)}
.kp-url input:disabled{opacity:.6}
.kp-url .kp-btn{flex:0 0 auto}

/* Document list */
.kp-doclist{display:flex;flex-direction:column;gap:8px;margin-top:14px}
.kpd-row{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);padding:9px 11px}
.kpd-row.pending{opacity:.7}
.kpd-icon{display:flex;align-items:center;justify-content:center;width:28px;height:28px;flex:0 0 28px;border-radius:8px;background:var(--acc-soft);color:var(--acc)}
.kpd-icon svg{width:16px;height:16px}
.kpd-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.kpd-name{font-size:13px;font-weight:600;color:var(--t-1);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kpd-meta{font-size:11px;color:var(--t-3);display:flex;align-items:center;gap:6px}
.kpd-del{flex:0 0 auto;border:1px solid var(--line);background:var(--surface);color:var(--t-3);width:26px;height:26px;border-radius:7px;cursor:pointer;font-size:13px;line-height:1}
.kpd-del:hover{border-color:var(--red);color:var(--red);background:var(--red-soft)}

/* Status chips */
.kp-chip{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:700;padding:2px 8px;border-radius:999px;letter-spacing:.01em}
.kp-chip-ready{background:var(--green-soft);color:var(--green)}
.kp-chip-ingesting{background:var(--acc-soft);color:var(--acc-ink)}
.kp-chip-warn{background:var(--amber-soft);color:var(--amber)}
.kp-chip-err{background:var(--red-soft);color:var(--red)}

/* FAQ form */
.kp-faqform{display:flex;flex-direction:column;gap:11px}
.kp-fl{display:flex;flex-direction:column;gap:5px;font-size:11.5px;font-weight:600;color:var(--t-3)}
.kp-fl-hint{font-weight:500;color:var(--t-4)}
.kp-fl input,.kp-fl textarea,.kp-faqform select{width:100%;padding:9px 11px;border:1px solid var(--line);border-radius:9px;background:var(--surface);
  font-size:13px;color:var(--t-1);font-family:inherit;resize:vertical}
.kp-fl input:focus,.kp-fl textarea:focus,.kp-faqform select:focus{outline:none;border-color:var(--acc);box-shadow:0 0 0 3px var(--acc-soft)}
.kp-faqactions{display:flex;justify-content:flex-end;gap:8px;margin-top:2px}

/* Buttons */
.kp-btn{border:1px solid var(--line);background:var(--surface);color:var(--t-2);font-size:12.5px;font-weight:600;
  padding:8px 14px;border-radius:9px;cursor:pointer;transition:background .15s,border-color .15s,color .15s}
.kp-btn:hover{background:var(--surface-3)}
.kp-btn.primary{background:var(--acc);border-color:var(--acc);color:#fff}
.kp-btn.primary:hover{background:#1d4ed8;border-color:#1d4ed8}
.kp-btn.ghost{background:var(--surface);color:var(--acc-ink);border-color:var(--line)}
.kp-btn.ghost:hover{background:var(--acc-soft);border-color:var(--acc)}
.kp-btn.danger{color:var(--red);border-color:var(--line)}
.kp-btn.danger:hover{background:var(--red-soft);border-color:var(--red)}

/* FAQ list */
.kp-faqlist{display:flex;flex-direction:column;gap:10px;margin-top:16px}
.kpf-row{border:1px solid var(--line);border-radius:11px;background:var(--surface);padding:12px 14px}
.kpf-row.is-pub{border-color:#cfe0fb;background:var(--surface-2)}
.kpf-top{display:flex;align-items:center;gap:8px;margin-bottom:7px;flex-wrap:wrap}
.kpf-badge{font-size:10px;font-weight:700;padding:2px 8px;border-radius:999px;letter-spacing:.03em;text-transform:uppercase}
.kpf-badge.pub{background:var(--green-soft);color:var(--green)}
.kpf-badge.draft{background:var(--surface-3);color:var(--t-3)}
.kpf-scope{font-size:11px;font-weight:600;color:var(--acc-ink);background:var(--acc-soft);padding:2px 8px;border-radius:6px}
.kpf-tags{font-size:11px;color:var(--t-3)}
.kpf-q{font-size:13.5px;font-weight:700;color:var(--t-1);line-height:1.45}
.kpf-a{font-size:12.5px;color:var(--t-2);line-height:1.5;margin-top:4px}
.kpf-how{font-size:11.5px;color:var(--t-3);line-height:1.5;margin-top:6px;padding-top:6px;border-top:1px dashed var(--line)}
.kpf-how-l{font-weight:700;color:var(--t-2)}
.kpf-actions{display:flex;gap:7px;margin-top:10px;flex-wrap:wrap}
.kpf-actions .kp-btn{padding:6px 11px;font-size:12px}

/* Connectors */
.kp-connectors{margin-top:18px}
.kp-connector-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;margin-top:6px}
.kpcn-card{display:flex;flex-direction:column;gap:7px;border:1px solid var(--line);border-radius:11px;background:var(--surface);padding:13px 14px}
.kpcn-card.is-working{border-color:#cfe0fb;background:var(--surface-2)}
.kpcn-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.kpcn-name{font-size:13.5px;font-weight:700;color:var(--t-1)}
.kpcn-status{font-size:10px;font-weight:700;padding:2px 8px;border-radius:999px;letter-spacing:.03em;text-transform:uppercase;white-space:nowrap}
.kpcn-status-on{background:var(--green-soft);color:var(--green)}
.kpcn-status-setup{background:var(--amber-soft);color:var(--amber)}
.kpcn-desc{font-size:12px;color:var(--t-2);line-height:1.5}
.kpcn-note{font-size:11px;color:var(--t-3);line-height:1.45}
.kpcn-actions{display:flex;justify-content:flex-end;margin-top:2px}
.kpcn-actions .kp-btn{padding:6px 12px;font-size:12px}
.kpcn-actions .kp-btn:disabled{opacity:.55;cursor:not-allowed}

.kp-empty{font-size:12.5px;color:var(--t-3);text-align:center;padding:18px 8px}

/* Evaluation (golden set) */
.kp-eval{margin-top:18px}
.kp-eval-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:6px;flex-wrap:wrap}
.kp-eval-agent{font-size:13px;font-weight:600;color:var(--t-2)}
.kp-eval-summary{margin-top:14px}
.kp-eval-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(92px,1fr));gap:10px}
.kpe-stat{display:flex;flex-direction:column;align-items:center;gap:3px;border:1px solid var(--line);border-radius:11px;background:var(--surface);padding:12px 8px}
.kpe-stat-v{font-size:20px;font-weight:800;color:var(--t-1);line-height:1.1}
.kpe-stat-l{font-size:10.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--t-3)}
.kpe-stat.kpe-pass{border-color:#bbf0cf}.kpe-stat.kpe-pass .kpe-stat-v{color:var(--green)}
.kpe-stat.kpe-partial{border-color:#fadcae}.kpe-stat.kpe-partial .kpe-stat-v{color:var(--amber)}
.kpe-stat.kpe-fail{border-color:#f4c4c4}.kpe-stat.kpe-fail .kpe-stat-v{color:var(--red)}

.kp-eval-results{margin-top:16px;display:flex;flex-direction:column;gap:10px}
.kpe-section-title{font-size:11.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--t-3);margin-top:6px}
.kpe-passed-title{margin-top:14px}
.kpe-allgood{color:var(--green);font-weight:600}
.kpe-row{border:1px solid var(--line);border-left-width:3px;border-radius:11px;background:var(--surface);padding:13px 14px}
.kpe-row.kpe-fail{border-left-color:var(--red)}
.kpe-row.kpe-partial{border-left-color:var(--amber)}
.kpe-row.kpe-pass{border-left-color:var(--green)}
.kpe-row-head{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.kpe-badge{font-size:10px;font-weight:700;padding:2px 8px;border-radius:999px;letter-spacing:.03em;text-transform:uppercase}
.kpe-badge-pass{background:var(--green-soft);color:var(--green)}
.kpe-badge-partial{background:var(--amber-soft);color:var(--amber)}
.kpe-badge-fail{background:var(--red-soft);color:var(--red)}
.kpe-score{font-size:11px;font-weight:600;color:var(--t-3)}
.kpe-q{font-size:13.5px;font-weight:600;color:var(--t-1);flex:1 1 100%;margin-top:2px}
.kpe-ab{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}
.kpe-col{border:1px solid var(--line);border-radius:9px;background:var(--surface-2);padding:9px 11px}
.kpe-col-l{font-size:10px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:var(--t-3);margin-bottom:4px}
.kpe-col-t{font-size:12.5px;color:var(--t-2);line-height:1.5;white-space:pre-wrap}
.kpe-empty-answer{color:var(--red);font-style:italic}
.kpe-note{font-size:11.5px;color:var(--t-3);line-height:1.45;margin-top:9px}
.kpe-note-l{font-weight:700;color:var(--t-2)}
@media (max-width:720px){.kpe-ab{grid-template-columns:1fr}}

/* ─── Governance: Approvals Workbench + Audit Log Viewer ─────────────────── */
.gov-pane{padding:18px 22px 26px;overflow:auto}
.gov-pane .adp-sub{max-width:760px}
.gov-refresh{margin-left:auto;align-self:flex-start;border:1px solid var(--line);background:var(--surface);color:var(--t-2);border-radius:8px;padding:6px 12px;font-size:12.5px;font-weight:600;cursor:pointer}
.gov-refresh:hover{border-color:var(--acc);color:var(--acc)}
.gov-summary{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0 16px}
.gov-chip{display:inline-flex;align-items:center;gap:6px;background:var(--acc-soft);color:var(--acc);border:1px solid var(--acc-tint);border-radius:999px;padding:5px 12px;font-size:12.5px;font-weight:700}
.gov-chip.soft{background:var(--surface);color:var(--t-3);border-color:var(--line);font-weight:600}
/* Approvals cards */
.gov-list{display:flex;flex-direction:column;gap:10px}
.gov-card{display:flex;align-items:center;gap:16px;border:1px solid var(--line);background:var(--surface);border-radius:12px;padding:14px 16px;transition:border-color .15s,box-shadow .15s,opacity .3s}
.gov-card:hover{border-color:var(--line-strong,#cdd3e0);box-shadow:var(--shadow-sm)}
.gov-card.done{opacity:.35;pointer-events:none}
.gov-card-main{flex:1;min-width:0}
.gov-card-top{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.gov-kind{font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;padding:2px 8px;border-radius:6px}
.gov-kind.finding{background:var(--acc-soft);color:var(--acc)}
.gov-kind.desk{background:#f1f5f9;color:var(--t-2)}
.gov-badge.fin{font-size:11px;font-weight:700;color:var(--amber);background:var(--amber-soft,#fef3c7);border:1px solid #fde68a;border-radius:6px;padding:2px 8px}
.gov-when{margin-left:auto;font-size:11.5px;color:var(--t-3)}
.gov-card-title{font-size:14.5px;font-weight:650;color:var(--t-1);line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.gov-card-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px;font-size:12px;color:var(--t-3)}
.gov-who{font-weight:650;color:var(--t-2)}
.gov-impact{color:var(--acc);font-weight:650}
.gov-card-actions{display:flex;gap:8px;flex-shrink:0}
.gov-btn{border:1px solid var(--line);background:var(--surface);color:var(--t-2);border-radius:8px;padding:7px 14px;font-size:12.5px;font-weight:650;cursor:pointer;transition:all .15s}
.gov-btn:hover:not(:disabled){border-color:var(--acc);color:var(--acc)}
.gov-btn:disabled{opacity:.5;cursor:default}
.gov-btn.primary{background:var(--acc);border-color:var(--acc);color:#fff}
.gov-btn.primary:hover:not(:disabled){background:var(--acc-hover,#1d4ed8);border-color:var(--acc-hover,#1d4ed8);color:#fff}
.gov-btn.ghost{background:transparent}
/* Routed approval packets (workbench) */
.gov-section-label{font-size:11.5px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:var(--t-3);margin:14px 2px 8px}
.gov-section-label:first-child{margin-top:2px}
.gov-card.gov-packet{align-items:flex-start}
.gov-kind.packet{background:var(--acc-soft);color:var(--acc)}
.gov-action-pill{font-size:11px;font-weight:700;color:var(--t-2);background:#f1f5f9;border:1px solid var(--line);border-radius:6px;padding:2px 8px;text-transform:capitalize}
.gov-card-summary{font-size:12.5px;color:var(--t-2);line-height:1.45;margin-top:6px}
.gov-route-row{display:flex;align-items:center;gap:8px;margin-top:8px}
.gov-route-label{font-size:11px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:var(--t-3)}
.gov-route-chip{display:inline-flex;align-items:center;font-size:12px;font-weight:700;color:var(--acc);background:var(--acc-soft);border:1px solid var(--acc-tint);border-radius:999px;padding:3px 11px}
.gov-evidence-toggle{margin-top:9px;border:1px solid var(--line);background:var(--surface);color:var(--t-2);border-radius:7px;padding:5px 11px;font-size:12px;font-weight:650;cursor:pointer;transition:all .15s}
.gov-evidence-toggle:hover{border-color:var(--acc);color:var(--acc)}
.gov-evidence{margin-top:9px;border:1px solid var(--line);background:#f8fafc;border-radius:9px;padding:11px 13px}
.gov-ev-row{display:flex;gap:10px;padding:3px 0;font-size:12.5px;border-bottom:1px solid var(--line)}
.gov-ev-row:last-child{border-bottom:none}
.gov-ev-k{flex:0 0 38%;font-weight:700;color:var(--t-3);word-break:break-word}
.gov-ev-v{flex:1;color:var(--t-1);word-break:break-word;font-variant-numeric:tabular-nums}
.gov-ev-list{margin:0;padding-left:18px;font-size:12.5px;color:var(--t-1)}
.gov-ev-list li{padding:2px 0}
.gov-ev-pre{margin:0;font-size:12px;color:var(--t-1);white-space:pre-wrap;word-break:break-word;font-family:var(--mono,ui-monospace,monospace)}
.gov-notice{margin-top:10px;font-size:12px;font-weight:650;color:var(--amber);background:var(--amber-soft,#fef3c7);border:1px solid #fde68a;border-radius:8px;padding:8px 11px;line-height:1.4}
.gov-status-tag{font-size:11px;font-weight:800;letter-spacing:.03em;text-transform:uppercase;border-radius:6px;padding:2px 8px}
.gov-status-tag.approved{color:var(--acc);background:var(--acc-soft)}
.gov-status-tag.rejected{color:var(--t-2);background:#f1f5f9}
/* Audit filters + table */
.gov-filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:6px 0 14px}
.gov-filters select,.gov-filters input{border:1px solid var(--line);border-radius:8px;padding:7px 10px;font-size:12.5px;color:var(--t-1);background:var(--surface)}
.gov-filters input[type=search]{min-width:200px;flex:1}
.gov-filters select:focus,.gov-filters input:focus{outline:none;border-color:var(--acc);box-shadow:var(--ring-blue,0 0 0 3px #dbeafe)}
.gov-table-wrap{border:1px solid var(--line);border-radius:12px;overflow:auto}
.gov-table{width:100%;border-collapse:collapse;font-size:12.5px}
.gov-table thead th{position:sticky;top:0;background:#f8fafc;color:var(--t-3);font-weight:700;text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);white-space:nowrap;font-size:11.5px;letter-spacing:.02em;text-transform:uppercase}
.gov-table tbody td{padding:9px 12px;border-bottom:1px solid var(--line);color:var(--t-2);vertical-align:top}
.gov-table tbody tr:last-child td{border-bottom:none}
.gov-table tbody tr:hover{background:var(--acc-soft)}
.gv-when{white-space:nowrap;color:var(--t-3);font-variant-numeric:tabular-nums}
.gv-note{max-width:380px;color:var(--t-2)}
.gov-act{font-weight:700;color:var(--acc);background:var(--acc-soft);border-radius:6px;padding:2px 8px;font-size:11.5px}
.gov-pager{display:flex;align-items:center;gap:12px;margin-top:14px}
.gov-pageinfo{font-size:12.5px;color:var(--t-3)}

/* ============================================================================
   GAP #4 - AUTO-CHART smart default (hand-rolled SVG, single brand blue)
   ============================================================================ */
.chart-auto .chart-frame { position: relative; }
.chart-auto .chart-frame::before {
  content: 'Smart chart';
  position: absolute; top: 4px; right: 6px;
  font-size: 10px; color: var(--t-4); letter-spacing: .04em;
  pointer-events: none;
}
.chart-auto-frame svg { display: block; width: 100%; height: 100%; }
.chart-auto-frame [data-idx]:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

/* ============================================================================
   GAP #10 - USER ANNOTATIONS (per-response private note)
   ============================================================================ */
.annotation-wrap { padding: 8px 18px 12px; border-top: 1px solid var(--line); }
.annotation-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px dashed var(--line); color: var(--t-3); background: transparent;
  border-radius: 8px; padding: 4px 10px; font-size: 11.5px; cursor: pointer;
}
.annotation-toggle:hover { color: #2563eb; border-color: #2563eb; }
.annotation-toggle.has-notes { color: #2563eb; border-style: solid; border-color: #bfdbfe; background: #eff6ff; }
.annotation-body { margin-top: 8px; }
.annotation-ta {
  width: 100%; box-sizing: border-box; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font: inherit; font-size: 13px; color: var(--t-1, #1a2233); background: var(--surface);
}
.annotation-ta:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.annotation-foot { display: flex; gap: 8px; margin-top: 6px; }
.annotation-save, .annotation-cancel {
  border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; border: 1px solid var(--line);
}
.annotation-save { background: #2563eb; color: #fff; border-color: #2563eb; }
.annotation-cancel { background: transparent; color: var(--t-3); }
.annotation-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ann-empty { font-size: 12px; color: var(--t-4); }
.ann-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface-2); }
.ann-text { font-size: 13px; color: var(--t-2); white-space: pre-wrap; word-break: break-word; }
.ann-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 5px; }
.ann-when { font-size: 11px; color: var(--t-4); }
.ann-del { background: transparent; border: none; color: var(--t-4); font-size: 11.5px; cursor: pointer; }
.ann-del:hover { color: #b91c1c; }

/* ============================================================================
   GAP #3 - SHARE + SUBSCRIBE (dashboards + schedules)
   ============================================================================ */
.dash-row, .sched-row { display: flex; align-items: center; gap: 6px; }
.dash-share-btn, .sched-share-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--t-3); cursor: pointer;
}
.dash-share-btn:hover, .sched-share-btn:hover { color: #2563eb; border-color: #bfdbfe; background: #eff6ff; }
.sched-sub-badge {
  margin-left: 8px; font-size: 10px; font-weight: 600; letter-spacing: .03em;
  background: #dbeafe; color: #1d4ed8; border-radius: 99px; padding: 1px 7px; vertical-align: middle;
}
.share-panel {
  margin-top: 8px; border: 1px solid #bfdbfe; background: #f8faff;
  border-radius: 10px; padding: 12px;
}
.sp-head { font-size: 12px; font-weight: 700; color: var(--t-2); margin-bottom: 8px; }
.sp-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.sp-seg button { border: none; background: var(--surface); color: var(--t-3); font-size: 12px; padding: 5px 12px; cursor: pointer; }
.sp-seg button.on { background: #2563eb; color: #fff; }
.sp-input-row { display: flex; gap: 8px; }
.sp-input {
  flex: 1 1 auto; min-width: 0; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font: inherit; font-size: 13px; background: var(--surface);
}
.sp-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.sp-submit { border: none; background: #2563eb; color: #fff; border-radius: 8px; padding: 6px 14px; font-size: 12px; cursor: pointer; }
.sp-msg { font-size: 12px; margin-top: 6px; min-height: 14px; }
.sp-msg.ok { color: #15803d; }
.sp-msg.bad { color: #b91c1c; }
.sp-subs { margin-top: 8px; }
.sp-subs-head, .sp-subs-empty, .sp-subs-load { font-size: 11px; color: var(--t-4); margin-bottom: 4px; }
.sp-sub-item { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; border-top: 1px solid var(--line); }
.sp-sub-who { font-size: 12.5px; color: var(--t-2); }
.sp-unshare { background: transparent; border: none; color: var(--t-4); font-size: 11.5px; cursor: pointer; }
.sp-unshare:hover { color: #b91c1c; }

/* ============================================================================
   GAP #8 - WHAT-IF / PROJECTION card (chat surface)
   ============================================================================ */
.projection-card {
  background: color-mix(in srgb, #2563eb 7%, var(--surface));
  border: 1px solid color-mix(in srgb, #2563eb 25%, var(--line));
  border-radius: 12px; padding: 12px 16px; margin-top: 8px;
}
.proj-label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; color: #2563eb;
  text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.proj-badge { background: #dbeafe; color: #1d4ed8; border-radius: 99px; padding: 1px 7px; font-size: 10px; font-weight: 600; letter-spacing: .03em; text-transform: none; }
.proj-kpis { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proj-kpi { display: inline-flex; flex-direction: column; }
.proj-kpi span { font-size: 10.5px; color: var(--t-4); }
.proj-kpi b { font-size: 18px; color: var(--t-1, #1a2233); font-variant-numeric: tabular-nums; }
.proj-kpi.projected b { color: #2563eb; }
.proj-arrow { color: var(--t-4); font-size: 18px; }
.proj-delta { font-size: 13px; font-weight: 700; margin-top: 6px; }
.proj-delta.up { color: #15803d; }
.proj-delta.down { color: #b45309; }
.proj-basis { font-size: 12px; color: var(--t-2); margin-top: 6px; }
.proj-basis-text { font-size: 11.5px; color: var(--t-3); margin-top: 3px; }
.proj-chart { margin-top: 8px; }
.proj-chart svg { width: 100%; max-height: 120px; }
.proj-disclaimer { font-size: 10.5px; color: var(--t-4); font-style: italic; margin-top: 6px; }

/* ============================================================================
   GAP #13 - PWA install affordance + phone reflow
   ============================================================================ */
.install-banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: color-mix(in srgb, #2563eb 10%, var(--surface));
  border-top: 1px solid color-mix(in srgb, #2563eb 30%, var(--line));
  font-size: 13px; color: var(--t-2);
}
.install-banner > span:first-child { flex: 1 1 auto; }
.install-banner button { border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer; border: none; }
#btnInstall { background: #2563eb; color: #fff; }
#btnInstallDismiss { background: transparent; color: var(--t-4); font-size: 16px; }

/* Phone width: keep the share/annotation panels and projection card comfortable. */
@media (max-width: 680px) {
  .annotation-wrap, .chart-wrap { padding-left: 12px; padding-right: 12px; }
  .sp-input-row { flex-wrap: wrap; }
  .sp-submit { width: 100%; }
  .proj-kpi b { font-size: 16px; }
  .install-banner { flex-wrap: wrap; }
}
