/* Nabgol flagship chat polish v3.8.1 — typography, bubbles, RTL, media */

/* G0 scale mirror — numbers live in assets/js/chat/diagram-tokens.js */
:root {
  --nbg-diag-min-on-screen: 16px;
  --nbg-diag-bubble-inner-m: 316;
  --nbg-diag-bubble-inner-d: 560;
  --nbg-diag-node-pad-x: 16px;
  --nbg-diag-node-pad-y: 12px;
  --nbg-diag-node-min-h: 34px;
  --nbg-diag-rank-gap: 26px;
  --nbg-diag-node-gap: 22px;
  --nbg-diag-mermaid-rank-spacing: 22px;
  --nbg-diag-mermaid-node-spacing: 36px;
  --nbg-diag-mermaid-wrap-width: 100px;
  --nbg-diag-stroke-node: 2px;
  --nbg-diag-stroke-edge: 1.6px;
  --nbg-diag-radius-rect: 8px;
  --nbg-diag-max-aspect: 2.4;
}

body.desktop-chat,
body.mobile-chat {
  font-family: "Vazirmatn", "IRANSansX", Tahoma, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:is(.desktop-chat, .mobile-chat) .message {
  margin-bottom: 16px;
}

body.mobile-chat .message-body {
  max-width: min(92vw, 520px);
}

body.desktop-chat .chat-messages .message-body {
  max-width: min(100%, 640px);
}

/* —— Bubbles —— */
body:is(.desktop-chat, .mobile-chat) .message.assistant .message-bubble {
  background: linear-gradient(165deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.94) 100%);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px 20px 20px 8px;
  padding: 15px 17px 12px;
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body:is(.desktop-chat, .mobile-chat) .message.user .message-bubble {
  background: linear-gradient(135deg, #10b981 0%, #059669 52%, #047857 100%);
  border: 1px solid rgba(167, 243, 208, 0.28);
  border-radius: 20px 20px 8px 20px;
  padding: 12px 16px 10px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.32);
}

body:is(.desktop-chat, .mobile-chat) .message .text {
  font-size: 15.5px;
  line-height: 1.92;
  letter-spacing: 0.008em;
  word-spacing: 0.02em;
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 38em;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* Safe horizontal containment ONLY — never clip message bubbles/diagrams vertically
   (v830 overflow:hidden on .message/.bubble/.figure crushed layout + cut flowcharts). */
body:is(.desktop-chat, .mobile-chat) #messages,
body:is(.desktop-chat, .mobile-chat) #chatMessages,
body:is(.desktop-chat, .mobile-chat) .chat-messages {
  overflow-x: hidden;
}
body:is(.desktop-chat, .mobile-chat) .message .text pre,
body:is(.desktop-chat, .mobile-chat) .message .text code,
body:is(.desktop-chat, .mobile-chat) .message .text .nabgol-code-block {
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  max-width: 100%;
  box-sizing: border-box;
}
body:is(.desktop-chat, .mobile-chat) .message .text svg.nabgol-diagram-svg,
body:is(.desktop-chat, .mobile-chat) .message .text svg.nabgol-mermaid-svg {
  max-width: 100%;
  height: auto;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) {
  color: #e8eef7;
  /* `emoji` (not `normal`) forced EMOJI presentation on every character that
     has one — which in Unicode includes the ASCII digits 0-9, `#` and `*`,
     because they are the bases of the keycap sequences. Measured on the real
     page 2026-09-02, both shells: `query=1234567890` inside inline code painted
     as ten blue emoji tiles with white numerals, and a bare `#` or `*` in prose
     painted as one. Persian digits were never affected (they have no emoji
     form), which is why it survived: the digit normaliser hides it everywhere
     EXCEPT inside code, where digits must stay ASCII. Real emoji render in
     colour at `normal` anyway — this property was never what made them work. */
  font-variant-emoji: normal;
  hyphens: none;
  -webkit-hyphens: none;
}

body:is(.desktop-chat, .mobile-chat) .message.user .text {
  color: #f0fdf4;
  max-width: 34em;
}

/* Strong RTL even when parent shell is LTR */
body.desktop-chat .message,
body.desktop-chat .message-body,
body.desktop-chat .message-bubble,
body.desktop-chat .message .text,
body.mobile-chat .message,
body.mobile-chat .message-body,
body.mobile-chat .message-bubble,
body.mobile-chat .message .text {
  direction: rtl !important;
  text-align: right !important;
}

body:is(.desktop-chat, .mobile-chat) .message .text p,
body:is(.desktop-chat, .mobile-chat) .message .text li,
body:is(.desktop-chat, .mobile-chat) .message .text h1,
body:is(.desktop-chat, .mobile-chat) .message .text h2,
body:is(.desktop-chat, .mobile-chat) .message .text h3,
body:is(.desktop-chat, .mobile-chat) .message .text h4,
body:is(.desktop-chat, .mobile-chat) .message .text blockquote {
  direction: rtl !important;
  text-align: right !important;
}

/* Magazine editorial — assistant chat ONLY. Unmistakable vs notepad. */
body:is(.desktop-chat, .mobile-chat) .message.assistant .message-bubble {
  padding: 18px 18px 14px;
}

/* Deliberately NOT widened to reach fullscreen (see nabgol-media-fullscreen__zoomwrap
   elsewhere in this file): this caps PROSE READING WIDTH to 34em, which is exactly
   backwards for the one thing that ever gets fullscreened (a table or diagram) — the
   whole point of opening it is to let it be as big as the screen allows, not squeeze
   it back down to reading-column width. Confirmed live: widening this one used to
   shrink and mis-position the ENTIRE fullscreen overlay, not just its content. */
body:is(.desktop-chat, .mobile-chat) .message.assistant .text,
body:is(.desktop-chat, .mobile-chat) .message.assistant .text.nabgol-mag-prose,
body:is(.desktop-chat, .mobile-chat) .message.assistant .text.nabgol-mag-article {
  max-width: 34em;
  font-size: 16.75px;
  line-height: 2.18;
  letter-spacing: 0.012em;
  word-spacing: 0.045em;
  color: #eef2f7;
  text-wrap: pretty;
  hanging-punctuation: first last;
}

body:is(.desktop-chat, .mobile-chat) .message.assistant .text.nabgol-mag-article {
  display: block;
  padding: 0.15em 0.1em 0.35em;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-eyebrow {
  margin: 0 0 0.95em;
  padding: 0;
  font-size: 0.9em;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #6ee7b7;
  background: none;
  border: 0;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-title {
  margin: 0.15em 0 1em;
  padding: 0 0 0.55em;
  font-size: 1.42em;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -0.018em;
  color: #f0fdf4;
  background: none;
  border: 0;
  border-bottom: 2px solid rgba(52, 211, 153, 0.55);
  border-radius: 0;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-title strong {
  background: none;
  color: inherit;
  font-weight: inherit;
  padding: 0;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-section {
  margin: 1.15em 0 0.55em;
  padding: 0;
  font-size: 0.98em;
  font-weight: 750;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: #a7f3d0;
  background: none;
  border: 0;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-lead {
  margin: 0 0 1.15em;
  font-size: 1.06em;
  font-weight: 560;
  line-height: 2.12;
  color: #f8fafc;
  background: none;
  border: 0;
}

body:is(.desktop-chat, .mobile-chat) .message.assistant .text.nabgol-mag-article > p {
  margin: 0 0 1.15em;
  background: none;
  border: 0;
  padding: 0;
}

body:is(.desktop-chat, .mobile-chat) .message.assistant .text.nabgol-mag-article > p:last-child {
  margin-bottom: 0.2em;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-kicker,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-pull {
  margin: 0.15em 0 0.95em;
  padding: 0 0 0.55em;
  font-size: 1.42em;
  font-weight: 800;
  line-height: 1.45;
  color: #f0fdf4;
  background: none !important;
  border: 0 !important;
  border-bottom: 2px solid rgba(52, 211, 153, 0.55) !important;
  border-radius: 0 !important;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-question {
  margin: 1.25em 0 0.3em;
  padding: 0.9em 1.05em;
  font-size: 1.05em;
  font-weight: 750;
  line-height: 1.8;
  color: #ecfdf5;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.22), rgba(15, 23, 42, 0.65));
  border: 1px solid rgba(52, 211, 153, 0.42);
  border-radius: 14px;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p.nabgol-mag-note {
  margin: 0.95em 0 1.1em;
  padding: 0.6em 0.9em;
  font-size: 0.98em;
  font-weight: 600;
  line-height: 1.9;
  color: #d1fae5;
  background: rgba(6, 78, 59, 0.28);
  border-right: 3px solid rgba(52, 211, 153, 0.55);
  border-radius: 0 12px 12px 0;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p {
  margin: 0 0 1.15em;
  line-height: 2.12;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p:last-child {
  margin-bottom: 0.2em;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h1,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h2,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h3,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h4 {
  margin: 1.05em 0 0.45em;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #f0fdf4;
  border-bottom: 2px solid rgba(52, 211, 153, 0.4);
  padding-bottom: 0.4em;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h1 { font-size: 1.42em; }
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h2 { font-size: 1.28em; color: #ecfdf5; }
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h3,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h4 { font-size: 1.12em; color: #a7f3d0; border-bottom-width: 1px; }

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h1:first-child,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h2:first-child,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) h3:first-child {
  margin-top: 0.05em;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) strong {
  color: #ecfdf5;
  font-weight: 800;
  background: linear-gradient(180deg, transparent 55%, rgba(52, 211, 153, 0.4) 55%);
  padding: 0 0.16em;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) em {
  color: #cbd5e1;
  font-style: italic;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) blockquote {
  margin: 0.8em 0 1.05em;
  padding: 0.65em 1em;
  border-right: 3px solid rgba(52, 211, 153, 0.65);
  border-left: 0;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 0 12px 12px 0;
  color: #d1d9e6;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) hr {
  border: 0;
  height: 1px;
  margin: 1.15em 0;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.4), transparent);
}


/* Persian list counters (magazine) */
@counter-style nabgol-fa {
  system: numeric;
  symbols: "۰" "۱" "۲" "۳" "۴" "۵" "۶" "۷" "۸" "۹";
  suffix: "";
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) ul,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) ol {
  list-style: none;
  margin: 0.35em 0 1.15em;
  padding: 0.65em 0.9em 0.65em 0.55em;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  counter-reset: magitem;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) li {
  position: relative;
  margin: 0.6em 0;
  padding: 0.2em 0.25em 0.2em 0;
  padding-right: 2.15em;
  line-height: 1.95;
}

/* Ordered: Persian digit pills from data-n (never rely on Latin counters) */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) li[data-kind="num"]::before,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) ol.nabgol-mag-list-ol > li::before {
  content: attr(data-n);
  position: absolute;
  right: 0;
  top: 0.2em;
  width: 1.55em;
  height: 1.55em;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78em;
  font-weight: 800;
  color: #042f2e;
  background: #6ee7b7;
  line-height: 1;
}

/* Unordered: mint bullet — not fake 1…n */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) li[data-kind="bullet"]::before,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) ul.nabgol-mag-list-ul > li::before {
  content: "";
  position: absolute;
  right: 0.45em;
  top: 0.72em;
  width: 0.55em;
  height: 0.55em;
  border-radius: 999px;
  background: #6ee7b7;
  box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.18);
}

/* Legacy fallback when data-kind missing: still prefer data-n if present */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) li:not([data-kind])::before {
  content: attr(data-n);
  position: absolute;
  right: 0;
  top: 0.2em;
  width: 1.55em;
  height: 1.55em;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78em;
  font-weight: 800;
  color: #042f2e;
  background: #6ee7b7;
  line-height: 1;
}

/* ============================================================================
   DIAGRAM PALETTE (`--nbgd-*`) — the diagram interior, in TWO themes.
   ----------------------------------------------------------------------------
   Why this block exists (measured 2026-08-28 with tools/_chat_canvas_shot.js on
   the real cascade, mobile-light / desktop-light): every colour in the diagram
   region below was a hard dark-scheme hex. On a light page the formula card and
   every `figure.nabgol-diagram` rendered as a BLACK SLAB in the middle of a
   white answer, with its own expression nearly illegible — exactly the defect
   that was fixed for the step accordion in chat-canvas.css section 17.

   The rule that keeps it fixed: no rule under `figure.nabgol-diagram` /
   `.nabgol-diagram-shell` may name a colour again. It reads a token from here.

   Three families, and the reason each behaves differently in light theme:

     1. NEUTRAL SURFACES + NEUTRAL INK — these INVERT. A slate panel or a
        near-black well is the whole defect; on a light canvas it becomes a
        white/tinted panel and the ink goes dark.
     2. SOLID SATURATED CHIPS (`*-face`) — these DO NOT invert. A dark emerald
        terminal node or a navy IO node with light text is a legible, deliberate
        chip on white just as it is on black, and inverting them would throw
        away the shape language the four flowchart node types depend on. Where a
        token keeps one value for both themes, that is the reason.
     3. TRANSLUCENT TINTS + BRIGHT ACCENT INK — these invert TOGETHER. A 0.28
        emerald wash over white is pale, so its `#ecfdf5`-class ink has to darken
        with it or the label disappears. Never move one without the other.

   These tokens live HERE, with the rules they serve, and not in chat-canvas.css:
   the diagram region ships in this file, so a session that re-skins the canvas
   cannot leave the diagrams colourless, and the lab's canvas=0 mode still paints.
   The values mirror the --nbgc-* scale in chat-canvas.css section 1 (same canvases,
   same contrast targets) — when that scale moves, move these with it.
   ========================================================================== */
:root {
  /* 0) GEOMETRY, not colour — the one non-colour token in this block, and it
     belongs here because it is the other half of the same contract the palette
     keeps: every rule about a diagram reads its value from one place.
     316 is DIAGRAM_BUBBLE_W in chat-flowchart.js — the coordinate space every
     layout in that file is drawn on, one unit to one CSS pixel. It is the size
     the diagrams were designed at, so it is the size they are shown at; see the
     1:1 cap under `.nabgol-diagram-svg` for what happened when nothing said so.
     Move this only together with DIAGRAM_BUBBLE_W. */
  --nbgd-canvas-w: 316px;

  /* 1) the card itself */
  --nbgd-card-a: rgba(15, 23, 42, 0.98);
  --nbgd-card-b: rgba(6, 78, 59, 0.32);
  --nbgd-card-edge: rgba(52, 211, 153, 0.38);
  /* --nbgd-card-shadow removed 2026-08-30: the card no longer casts one.
     S2 canvas law is hairline over shadow, and the fullscreen viewer — the
     version the owner calls clean — never had one. A token nothing reads is a
     decoy the next session would try to tune. */

  /* 2) neutral surfaces that sit ON the card — these invert */
  --nbgd-panel: rgba(30, 41, 59, 0.95);
  --nbgd-panel-2: rgba(30, 41, 59, 0.92);
  --nbgd-panel-3: rgba(30, 41, 59, 0.75);
  --nbgd-well: rgba(15, 23, 42, 0.88);
  --nbgd-well-2: rgba(15, 23, 42, 0.92);
  --nbgd-well-3: rgba(15, 23, 42, 0.95);
  --nbgd-well-4: rgba(15, 23, 42, 0.9);
  --nbgd-track: rgba(15, 23, 42, 0.85);
  --nbgd-bars-track: #0f172a;        /* the bar chart's empty rail (was an inline fill) */
  --nbgd-tint: rgba(15, 23, 42, 0.2);
  --nbgd-tint-2: rgba(15, 23, 42, 0.15);
  --nbgd-node: #1e293b;              /* a solid chip: same in both themes */

  /* 3) hairlines */
  --nbgd-line: rgba(148, 163, 184, 0.28);
  --nbgd-line-soft: rgba(148, 163, 184, 0.18);
  --nbgd-line-mid: rgba(148, 163, 184, 0.3);
  --nbgd-line-mid-2: rgba(148, 163, 184, 0.35);
  --nbgd-line-strong: rgba(148, 163, 184, 0.55);

  /* 4) ink */
  --nbgd-ink: #f8fafc;
  --nbgd-ink-2: #e2e8f0;
  --nbgd-ink-3: #f1f5f9;
  --nbgd-ink-soft: #94a3b8;
  --nbgd-ink-faint: #cbd5e1;
  --nbgd-stroke-soft: #94a3b8;       /* a neutral node outline / graph line */
  --nbgd-on-dark: #f8fafc;           /* text ON a solid dark chip — never inverts */
  --nbgd-on-bright: #0f172a;         /* text ON a bright fill — never inverts */
  --nbgd-on-bright-em: #042f2e;
  --nbgd-on-white: #fff;

  /* 5) the book-page mock (annotate) is PAPER — light in both themes by design */
  --nbgd-paper: #f8fafc;
  --nbgd-paper-2: #e2e8f0;
  --nbgd-paper-ink: #334155;
  --nbgd-paper-chip: rgba(255, 255, 255, 0.85);
  --nbgd-paper-rule: rgba(100, 116, 139, 0.22);
  --nbgd-paper-edge: rgba(148, 163, 184, 0.55);
  --nbgd-paper-inset: rgba(255, 255, 255, 0.65);
  /* the pin tooltip is a dark chip ON the paper — dark in both themes */
  --nbgd-paper-tip: rgba(15, 23, 42, 0.92);
  --nbgd-paper-tip-ink: #f8fafc;

  /* 6) emerald — the brand hue: terminal nodes, "good", the spine */
  --nbgd-em-face: #065f46;
  --nbgd-em-face-2: #047857;   /* #059669 put the pros badge at 3.58:1 */
  --nbgd-em-face-deep: #064e3b;
  --nbgd-em-face-mid: rgba(6, 78, 59, 0.85);
  --nbgd-em-face-nav: rgba(6, 78, 59, 0.55);
  --nbgd-em-edge: #34d399;
  --nbgd-em-edge-2: #6ee7b7;
  --nbgd-em-edge-45: rgba(52, 211, 153, 0.45);
  --nbgd-em-ink: #6ee7b7;
  --nbgd-em-ink-2: #a7f3d0;
  --nbgd-em-on: #ecfdf5;
  --nbgd-em-wash: rgba(52, 211, 153, 0.16);
  --nbgd-em-wash-2: rgba(52, 211, 153, 0.1);
  --nbgd-em-wash-edge: rgba(110, 231, 183, 0.38);
  --nbgd-em-wash-edge-2: rgba(110, 231, 183, 0.28);
  --nbgd-em-tint: rgba(16, 185, 129, 0.22);
  --nbgd-em-tint-2: rgba(16, 185, 129, 0.28);
  --nbgd-em-tint-3: rgba(16, 185, 129, 0.32);
  --nbgd-em-glow: rgba(52, 211, 153, 0.35);

  /* 7) sky + cyan — IO nodes, the cycle, the tree rails */
  --nbgd-sky-face: #0c4a6e;
  --nbgd-sky-face-2: #0369a1;
  --nbgd-sky-face-3: #bae6fd;
  --nbgd-sky-edge: #38bdf8;
  --nbgd-sky-edge-2: #7dd3fc;
  --nbgd-sky-tint: rgba(56, 189, 248, 0.28);
  --nbgd-sky-line: rgba(125, 211, 252, 0.35);
  --nbgd-sky-line-2: rgba(125, 211, 252, 0.4);
  --nbgd-cy-face: #155e75;
  --nbgd-cy-face-2: #0e7490;
  --nbgd-cy-face-deep: rgba(8, 47, 73, 0.95);
  --nbgd-cy-face-mid: rgba(14, 116, 144, 0.92);
  --nbgd-cy-edge: #67e8f9;
  --nbgd-cy-edge-soft: rgba(103, 232, 249, 0.42);
  --nbgd-cy-edge-50: rgba(103, 232, 249, 0.5);
  --nbgd-cy-edge-70: rgba(165, 243, 252, 0.7);
  --nbgd-cy-ink: #a5f3fc;
  --nbgd-cy-on: #ecfeff;
  --nbgd-cy-glow: rgba(34, 211, 238, 0.08);
  --nbgd-cy-shadow: rgba(8, 47, 73, 0.45);

  /* 8) blue — the formula card */
  --nbgd-bl-face: #1e3a8a;
  --nbgd-bl-tint: rgba(30, 64, 175, 0.35);
  --nbgd-bl-tint-2: rgba(59, 130, 246, 0.28);
  --nbgd-bl-edge: rgba(147, 197, 253, 0.55);
  --nbgd-bl-edge-2: rgba(147, 197, 253, 0.45);
  --nbgd-bl-ink: #93c5fd;
  --nbgd-bl-ink-2: #dbeafe;
  --nbgd-bl-ink-3: #eff6ff;
  --nbgd-bl-highlight: rgba(255, 255, 255, 0.06);

  /* 9) amber — the decision rhombus, "attention" */
  --nbgd-am-face: #7c2d12;
  --nbgd-am-face-2: #854d0e;
  --nbgd-am-face-3: #b45309;
  --nbgd-am-face-4: #fde68a;
  --nbgd-am-edge: #fbbf24;
  --nbgd-am-tint: rgba(251, 191, 36, 0.28);

  /* 10) violet — the sequence diagram, the deck */
  --nbgd-vi-face: #4c1d95;
  --nbgd-vi-face-2: #6d28d9;
  --nbgd-vi-tint: rgba(91, 33, 182, 0.35);
  --nbgd-vi-tint-2: rgba(91, 33, 182, 0.55);
  --nbgd-vi-edge: #a78bfa;
  --nbgd-vi-edge-2: #c4b5fd;
  --nbgd-vi-edge-soft: rgba(196, 181, 253, 0.35);
  --nbgd-vi-edge-45: rgba(167, 139, 250, 0.45);
  --nbgd-vi-ink: #ddd6fe;
  --nbgd-vi-on: #ede9fe;
  --nbgd-vi-on-2: #f5f3ff;

  /* 11) red — "cons", the annotate pin */
  --nbgd-rd-face: #dc2626;
  --nbgd-rd-face-2: #b91c1c;
  --nbgd-rd-face-3: #f87171;
  --nbgd-rd-face-4: rgba(220, 38, 38, 0.9);
  --nbgd-rd-tint: rgba(239, 68, 68, 0.28);
  --nbgd-rd-on: #fef2f2;
  --nbgd-rd-shadow: rgba(127, 29, 29, 0.45);

  /* 12) the accent SERIES — a bars/stat card cycles through it, one hue per row.
     chat-flowchart.js emits these as inline custom properties, so they must be
     tokens: a #34d399 stat value on a white card measured 1.79:1. */
  --nbgd-acc-1: #34d399;
  --nbgd-acc-2: #38bdf8;
  --nbgd-acc-3: #fbbf24;
  --nbgd-acc-4: #a78bfa;
  --nbgd-acc-5: #f472b6;
  --nbgd-acc-6: #22d3ee;

  /* 13) drop shadows */
  --nbgd-shadow: rgba(2, 6, 23, 0.28);
  --nbgd-shadow-2: rgba(2, 6, 23, 0.35);
  --nbgd-shadow-3: rgba(15, 23, 42, 0.85);
}

html[data-theme="light"] {
  /* 1) the card: a white sheet with the faintest mint, not a slab */
  --nbgd-card-a: #ffffff;
  --nbgd-card-b: rgba(21, 128, 61, 0.05);
  --nbgd-card-edge: rgba(21, 128, 61, 0.22);

  /* 2) surfaces invert: a panel is now lighter than the card, a well darker */
  --nbgd-panel: #ffffff;
  --nbgd-panel-2: rgba(255, 255, 255, 0.94);
  --nbgd-panel-3: rgba(15, 23, 42, 0.035);
  --nbgd-well: rgba(15, 23, 42, 0.035);
  --nbgd-well-2: rgba(15, 23, 42, 0.05);
  --nbgd-well-3: rgba(15, 23, 42, 0.06);
  --nbgd-well-4: rgba(15, 23, 42, 0.04);
  --nbgd-track: rgba(15, 23, 42, 0.07);
  --nbgd-bars-track: rgba(15, 23, 42, 0.07);
  --nbgd-tint: rgba(15, 23, 42, 0.05);
  --nbgd-tint-2: rgba(15, 23, 42, 0.04);
  /* --nbgd-node stays #1e293b: see family (2) in the header comment. */

  /* 3) hairlines: slate alpha is invisible on white, so switch to ink alpha */
  --nbgd-line: rgba(15, 23, 42, 0.14);
  --nbgd-line-soft: rgba(15, 23, 42, 0.09);
  --nbgd-line-mid: rgba(15, 23, 42, 0.15);
  --nbgd-line-mid-2: rgba(15, 23, 42, 0.18);
  --nbgd-line-strong: rgba(15, 23, 42, 0.3);

  /* 4) ink (contrast measured against the light canvas #ffffff / #f6f8fa) */
  --nbgd-ink: #14181d;               /* 15.8:1 */
  --nbgd-ink-2: #1f2733;             /* 13.8:1 */
  --nbgd-ink-3: #14181d;
  --nbgd-ink-soft: #5b6672;          /*  6.4:1 */
  --nbgd-ink-faint: #4b5563;         /*  8.0:1 */
  --nbgd-stroke-soft: #64748b;       /*  4.8:1 — a visible graph line on white */
  /* --nbgd-on-dark / --nbgd-on-bright / --nbgd-on-white do not invert: they are
     the ink ON a chip, and the chips do not invert either. */

  /* 5) paper stays paper */
  --nbgd-paper: #ffffff;
  --nbgd-paper-2: #eef2f6;
  --nbgd-paper-chip: rgba(255, 255, 255, 0.92);
  --nbgd-paper-edge: rgba(15, 23, 42, 0.22);
  --nbgd-paper-inset: rgba(255, 255, 255, 0.8);

  /* 6) emerald: the mints all fail on white — the ink and every stroke darken,
     the washes get lighter, the solid chips stay. */
  --nbgd-em-face-2: #15803d;
  --nbgd-em-face-mid: rgba(6, 78, 59, 0.9);
  --nbgd-em-face-nav: rgba(6, 95, 70, 0.96);   /* 0.92 green put the deck arrows at 4.12:1 */
  --nbgd-em-edge: #15803d;           /*  4.6:1 — a bar, a spine, a border */
  --nbgd-em-edge-2: #16a34a;
  --nbgd-em-edge-45: rgba(21, 128, 61, 0.3);
  --nbgd-em-ink: #0f6a37;            /*  5.6:1 */
  --nbgd-em-ink-2: #15803d;
  --nbgd-em-wash: rgba(21, 128, 61, 0.08);
  --nbgd-em-wash-2: rgba(21, 128, 61, 0.06);
  --nbgd-em-wash-edge: rgba(21, 128, 61, 0.25);
  --nbgd-em-wash-edge-2: rgba(21, 128, 61, 0.2);
  --nbgd-em-tint: rgba(21, 128, 61, 0.1);
  --nbgd-em-tint-2: rgba(21, 128, 61, 0.12);
  --nbgd-em-tint-3: rgba(21, 128, 61, 0.13);
  --nbgd-em-glow: rgba(21, 128, 61, 0.18);

  /* 7) sky + cyan */
  --nbgd-sky-edge: #0284c7;
  --nbgd-sky-edge-2: #0369a1;
  --nbgd-sky-tint: rgba(2, 132, 199, 0.12);
  --nbgd-sky-line: rgba(2, 132, 199, 0.28);
  --nbgd-sky-line-2: rgba(2, 132, 199, 0.3);
  --nbgd-cy-edge: #0e7490;
  --nbgd-cy-edge-soft: rgba(14, 116, 144, 0.4);
  --nbgd-cy-edge-50: rgba(14, 116, 144, 0.55);
  --nbgd-cy-ink: #0e7490;            /*  4.6:1 */
  --nbgd-cy-glow: rgba(14, 116, 144, 0.06);
  --nbgd-cy-shadow: rgba(8, 47, 73, 0.18);

  /* 8) blue — the formula expression box stops being a dark plate */
  --nbgd-bl-tint: rgba(37, 99, 235, 0.1);
  --nbgd-bl-tint-2: rgba(37, 99, 235, 0.12);
  --nbgd-bl-edge: rgba(37, 99, 235, 0.35);
  --nbgd-bl-edge-2: rgba(37, 99, 235, 0.3);
  --nbgd-bl-ink: #1d4ed8;            /*  6.3:1 */
  --nbgd-bl-ink-2: #1e3a8a;
  --nbgd-bl-ink-3: #14203a;
  --nbgd-bl-highlight: rgba(255, 255, 255, 0.9);

  /* 9) amber */
  --nbgd-am-edge: #b45309;           /*  4.9:1 — #fbbf24 is 1.8:1 on white */
  --nbgd-am-tint: rgba(180, 83, 9, 0.14);

  /* 10) violet */
  --nbgd-vi-tint: rgba(91, 33, 182, 0.13);
  --nbgd-vi-tint-2: rgba(91, 33, 182, 0.9);
  --nbgd-vi-edge: #6d28d9;
  --nbgd-vi-edge-2: #7c3aed;
  --nbgd-vi-edge-soft: rgba(124, 58, 237, 0.28);
  --nbgd-vi-edge-45: rgba(109, 40, 217, 0.45);
  --nbgd-vi-ink: #5b21b6;            /*  7.2:1 */
  --nbgd-vi-on: #3b0764;             /* the 0.13 tint is pale, so its ink is dark */

  /* 11) red */
  --nbgd-rd-face-3: #dc2626;
  --nbgd-rd-face-4: rgba(185, 28, 28, 0.96);   /* 0.9 red put the legend pin at 4.32:1 */
  --nbgd-rd-tint: rgba(220, 38, 38, 0.12);
  --nbgd-rd-shadow: rgba(127, 29, 29, 0.3);

  /* 12) the accent series, dark enough to be TEXT on white (>= 4.5:1) */
  --nbgd-acc-1: #0f6a37;   /* #15803d was 4.40:1 on the desktop canvas #f6f8fa */
  --nbgd-acc-2: #0369a1;
  --nbgd-acc-3: #a3560a;
  --nbgd-acc-4: #6d28d9;
  --nbgd-acc-5: #be185d;
  --nbgd-acc-6: #0e7490;

  /* 13) shadows: a black drop shadow on white reads as dirt */
  --nbgd-shadow: rgba(15, 23, 42, 0.08);
  --nbgd-shadow-2: rgba(15, 23, 42, 0.1);
  --nbgd-shadow-3: rgba(15, 23, 42, 0.12);
}

/* Diagram cards — HTML/RTL-first, Persian digits, fit assistant bubble
   ---------------------------------------------------------------------------
   CHROME: the card is a block on the answer canvas, so it speaks the canvas's
   chrome language, not its own. Every other boxed block chat-canvas.css paints —
   `pre`, `.nabgol-table-scroll`, `.nabgol-step` — is the same thing: a 12px
   radius, a hairline, a flat surface, 24px of rhythm above and below, and NO
   shadow. This card used to be the only one that disagreed with all four, which
   is why it read as an object imported from a different app.
   · `box-shadow: 0 12px 30px` is gone. S2's law is hairline over shadow and
     surface depth must be invisible — and the fullscreen viewer, the version the
     owner calls clean, has never had a shadow. Bringing that here costs nothing.
   · radius 18px -> --nbgc-radius-sm, the value its neighbours already use.
   · margin 1.1em/1.25em -> the modular scale (24px), the same step `pre` and the
     table scroller take, so three blocks in one answer no longer sit on three
     different grids.
   The fallbacks exist because a dozen tool pages load this sheet without
   chat-canvas.css; they resolve to the same numbers that file declares.
   PADDING is deliberately NOT changed: the flowchart/sequence canvases reclaim it
   by name (`calc(-0.85em - 1px)` further down) to reach the 316px design canvas
   on a small phone, and retuning one without the other silently breaks that. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: var(--nbgc-r-075, 24px) 0;
  padding: 0.95em 0.85em 0.7em;
  direction: rtl !important;
  text-align: right !important;
  line-height: 1.55 !important;
  font-family: Vazirmatn, Tahoma, sans-serif;
  background:
    radial-gradient(120% 90% at 0% 0%, var(--nbgd-em-wash), transparent 55%),
    linear-gradient(160deg, var(--nbgd-card-a), var(--nbgd-card-b));
  border: 1px solid var(--nbgd-card-edge);
  border-radius: var(--nbgc-radius-sm, 12px);
  overflow: visible;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram .nabgol-diagram-shell,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart .nabgol-diagram-shell,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram .nabgol-diagram-kicker,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart .nabgol-diagram-kicker,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram .nabgol-diagram-title,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart .nabgol-diagram-title,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram .nabgol-diagram-canvas,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart .nabgol-diagram-canvas {
  box-sizing: border-box;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-shell {
  width: 100%;
}

/* ── A CARD IS A FIGURE, NOT A FLUID BLOCK (chat surface only) ───────────────
   The 1:1 cap above fixes the seven kinds that draw an SVG. The other six —
   compare, formula, proscons, annotate, stat, deck — are built from HTML, so no
   viewBox scale applies to them, and they were stretching a different way:
   their rows, chips and wells are tuned for the same 316px bubble, and on the
   560px desktop column they turned into vast empty rectangles. Measured on the
   desktop light shell: `compare` was 597px tall to say three words, each item a
   150px bar about three-quarters empty; every `formula` row was a full-width
   white pill with its content pushed to the right edge (the "empty white bar" S2
   logged as open debt and handed to this session).

   Same cause as the SVG, same cure: lay the content out at the width it was
   designed for, and let the frame hug it instead of the other way round. That is
   also, exactly, what the fullscreen viewer does — its panel is `width:
   fit-content` — which is the other half of why it reads as tidy.

   Chat only, deliberately. The viewer already reaches the same place by its own
   route (fit-content panel + the JS contain-fit), and its shell is explicitly
   `width: 100%` in chat-components.css; re-deciding that from here would have two
   files arguing about one box.

   A FIXED design width, not `fit-content` — that was tried first and measured
   wrong in both directions: shrink-to-fit resolves HTML content toward
   min-content, so `compare` collapsed to a 132px ribbon while staying 588px tall,
   and the SVG kinds under-shot to 0.95 with 15.2px type. The card is not asking
   its content how wide to be; the design canvas already decided. 1.7em + 2px is
   this card's own horizontal padding and border, so the CONTENT box lands exactly
   on --nbgd-canvas-w and the frame sits around it. */
body:is(.desktop-chat, .mobile-chat) #messages .message.assistant .text figure.nabgol-diagram,
body:is(.desktop-chat, .mobile-chat) #messages .message.assistant .text figure.nabgol-flowchart {
  width: min(100%, calc(var(--nbgd-canvas-w) + 1.7em + 2px));
}
/* The kicker: an EYEBROW, not a badge.
   Measured (tools/_diagram_size_probe.js, 2026-08-30): the pill was exactly 36px
   tall on every one of the 13 kinds in both shells — on a `stat` card only 303px
   tall on a phone, the label plus its margin was 15% of the whole card, set in
   16px/800 filled green. It was the loudest ink on a card whose entire job is to
   show its CONTENT first. Reading order was inverted: you learned what the card
   was called before you saw what it said.
   Quieted along S2's own hierarchy law (space > weight > size > colour), spending
   the cheap currencies first: the FILL and the BORDER go (they were the badge),
   weight 800 -> 600, and only then size 16 -> 13 with tracking, which is what
   turns a heading into a label. The accent ink stays — it is the one accent this
   card is allowed, and it is what still says "this is a label".
   NEVER hide it. There is no title bar in the chat to carry the name (the
   fullscreen viewer has one, which is why it may hide this), and several diagrams
   can share one bubble — hiding it once turned the kitchen-sink screenshot into
   one unlabelled neon wall (real defect). Quiet, never absent. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-kicker {
  display: block;
  margin: 0 0 var(--nbgc-r-025, 8px);
  padding: 0;
  background: none;
  border: 0;
  color: var(--nbgd-em-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.08em;
}

/* Standard SVG diagrams (ISO shapes, not HTML lists) */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-canvas {
  direction: ltr;
  width: 100%;
  margin: 0.1em 0 0.15em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-svg {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: none !important;
  font-family: Vazirmatn, Tahoma, sans-serif;
}

/* ── THE 1:1 CAP — this is the fix for "flowcharts are oversize in the chat" ──
   Measured, not guessed (tools/_diagram_size_probe.js, all 13 kinds x 2 shells):

     surface            scale (rendered width / viewBox width)
     chat, phone 390     1.06 – 1.16
     chat, desktop 1280  1.67 – 1.77      <- the complaint
     fullscreen, both    0.93 – 1.04

   Every layout in chat-flowchart.js is drawn on a DIAGRAM_BUBBLE_W = 316 unit
   canvas where one unit is meant to be one CSS pixel — the sheet already says so
   further down ("makes viewBox 316 map 1:1"). But the SVG is sized `width: 100%`,
   so the drawing simply takes whatever column it is given. A phone's 338px column
   is close enough to 316 that nobody noticed. The desktop answer column is 560px,
   which magnifies EVERY diagram by ~1.7x: a 16-unit label lands at 26.8px on glass
   next to 16px prose, and the flowchart grows to 1092.8px — 121% of the window,
   taller than the screen it is drawn on.

   The fullscreen viewer escapes this only because chat-markdown.js contain-fits
   the SVG into the panel's `min(92vh, 880px)` height budget, and the size that
   fits is — measured — 0.93-1.04. So "fullscreen is minimal and clean" was never
   a styling difference at all: fullscreen is the diagram at 1:1, and the chat was
   showing the same diagram blown up by 70%.

   The cap states that intent as a rule instead of an accident. Nothing shrinks
   below what it does today; the cap only stops the stretch ABOVE the size the
   diagram was drawn at, so the design canvas maps 1:1 on every screen.

   Two exemptions, both deliberate:
   · Mermaid lays out its own coordinate space, so 316 is meaningless to it — and
     it has its own sizing rule plus the scroll-x machinery further down.
   · A diagram too dense to hold the 16px on-screen floor is deliberately allowed
     to render LARGER than its column and pan sideways (enforceOnScreenFloor in
     chat-flowchart.js). That path sets `max-width: none` inline with !important,
     which outranks this rule — so the floor still wins over the cap, which is the
     correct precedence: legibility first, then restraint.

   WHY THE SELECTOR IS LONG, and why it is NOT written with this file's usual
   `:where(chat, fullscreen)` shorthand: chat-canvas.css:1068 resets
     body:is(.desktop-chat,.mobile-chat) #messages .message .text
       :is(img,video,svg):not(.katex *) { max-width: 100% !important }
   at specificity (1,4,2). `:where()` contributes nothing, so the shorthand form
   of this rule scored (0,2,0) and lost silently — measured: the cap changed the
   card heights by 0 and the scale stayed at 1.77. Written out, this is (1,6,1)
   and wins on specificity, independent of file order. If that reset ever moves or
   is rewritten, re-measure with tools/_diagram_size_probe.js rather than trusting
   that this still binds; a cap that loses looks exactly like a cap that works. */
body:is(.desktop-chat, .mobile-chat) #messages .message.assistant .text .nabgol-diagram-svg:not(.nabgol-mermaid-svg),
.nabgol-media-fullscreen__zoomwrap .nabgol-diagram-shell .nabgol-diagram-svg:not(.nabgol-mermaid-svg) {
  max-width: min(100%, var(--nbgd-canvas-w)) !important;
  margin-inline: auto !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg.nabgol-fc-svg,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg.nabgol-cycle-svg,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg.nabgol-tree-svg,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg.nabgol-timeline-svg,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg.nabgol-compare-svg,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg.nabgol-sequence-svg,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg.nabgol-bars-svg {
  overflow: visible;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-process rect {
  fill: var(--nbgd-node);
  stroke: var(--nbgd-stroke-soft);
  stroke-width: 2;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-terminal rect {
  fill: var(--nbgd-em-face);
  stroke: var(--nbgd-em-edge);
  stroke-width: 2.5;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-io polygon {
  fill: var(--nbgd-sky-face);
  stroke: var(--nbgd-sky-edge);
  stroke-width: 2.5;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-decision polygon {
  fill: var(--nbgd-am-face);
  stroke: var(--nbgd-am-edge);
  stroke-width: 2.6;
}
/* An SVG label's ink depends on WHAT IT SITS ON, and that is the one thing a
   blanket rule cannot know. These eight were one rule with one fill until
   2026-08-28, so on a light page the sequence labels stayed white on a pale
   panel — invisible (screenshot, DIAGRAM_THEME_GATE).
   ON A SOLID CHIP: the chip does not invert, so neither does the ink. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-label,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-edge-label,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-hub-label {
  fill: var(--nbgd-on-dark);
  font-size: 16px;
  font-weight: 800;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-edge-label {
  fill: var(--nbgd-em-on);
}
/* ON THE CARD (or on a panel that inverts with it): the ink inverts too. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-label,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-name,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-point,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-svg-label,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-lens-label,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-svg .nabgol-diagram-title {
  fill: var(--nbgd-ink);
  font-size: 16px;
  font-weight: 800;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
/* `.nabgol-ink-light` is the GENERATOR's verdict ("this text sits on a dark
   fill"), decided while emitting the SVG and true only for the theme it was
   written for. The venn lenses are translucent hue over the CARD, so on a light
   page that verdict is a lie and the "both" label went white on pale amber.
   This rule is (0,2,1) like the .nabgol-ink-light rule above and sits after it,
   so it wins; in dark theme --nbgd-ink is the same #f8fafc as before. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-svg text.nabgol-ink-light,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-svg text.nabgol-ink-dark {
  fill: var(--nbgd-ink);
}
/* The renderer picks ink from the fill it sits on; these must outrank the blanket
   .nabgol-fc-label fill above, or dark-on-light labels silently turn white again. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-svg text.nabgol-ink-dark {
  fill: var(--nbgd-on-bright);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-svg text.nabgol-ink-light {
  fill: var(--nbgd-on-dark);
}
/* THE BAR CHART sits on the CARD, not on a chip — so its row label, its empty
   rail, and a value written on that rail (a bar too short to hold it) all invert
   with the card. renderBarsHtml still writes the old dark-card literals as SVG
   attributes (fill="#f8fafc", fill="#0f172a"), which is what the print sheet in
   chat-print.js keys on; CSS outranks a presentation attribute, so these rules
   repaint the chat and the fullscreen viewer only. Before 2026-09-13 the label
   was a `.nabgol-fc-label` and took the blanket chip ink above: white on the
   light card, invisible (live, dabir-karofanavari-9, 375px, light theme).
   The label/value rules are (0,3,1) and sit after the (0,2,1) ink rules, so they
   win; the rail and label also match by structure, so a bars SVG painted by an
   older chat-flowchart.js (no classes yet) is repainted too. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-svg text.nabgol-bars-label,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-svg text.nabgol-fc-label:not(.nabgol-bars-val),
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-svg text.nabgol-bars-val.nabgol-bars-offbar {
  fill: var(--nbgd-ink);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-svg rect.nabgol-bars-track,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-svg rect[fill="#0f172a"] {
  fill: var(--nbgd-bars-track);
  stroke: var(--nbgd-line-mid-2);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-edge {
  fill: none;
  stroke: var(--nbgd-em-edge-2);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-fc-edge-pill {
  fill: var(--nbgd-em-face-deep);
  stroke: var(--nbgd-em-edge-2);
  stroke-width: 1.3;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-edge,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-spine,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-track,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-arc,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-life {
  fill: none;
  stroke: var(--nbgd-cy-edge);
  stroke-width: 1.8;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-arc {
  stroke: var(--nbgd-em-edge-2);
  stroke-width: 2;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-life {
  stroke-dasharray: 3 5;
  stroke: var(--nbgd-vi-edge-2);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-msg {
  fill: none;
  stroke: var(--nbgd-vi-edge);
  stroke-width: 1.8;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-label {
  fill: var(--nbgd-ink);
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-val {
  font-weight: 900;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-node rect,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-card,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-card {
  fill: var(--nbgd-node);
  stroke: var(--nbgd-sky-edge-2);
  stroke-width: 1.5;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-node.is-root rect,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-node.is-list-head rect {
  fill: var(--nbgd-em-face);
  stroke: var(--nbgd-em-edge);
  stroke-width: 1.6;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-node.is-flat rect,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-node.is-branch rect,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-node.is-leaf rect {
  fill: var(--nbgd-node);
  stroke: var(--nbgd-sky-edge-2);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-dot {
  fill: var(--nbgd-em-face);
  stroke: var(--nbgd-em-edge-2);
  stroke-width: 1.6;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-num {
  fill: var(--nbgd-em-on);
  font-size: 16px;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-card {
  fill: var(--nbgd-cy-face-2);
  stroke: var(--nbgd-cy-edge);
  stroke-width: 1.5;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) svg .nabgol-cycle-hub {
  fill: var(--nbgd-cy-face);
  stroke: var(--nbgd-cy-edge);
  stroke-width: 1.6;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-actor {
  fill: var(--nbgd-vi-face);
  stroke: var(--nbgd-vi-edge-2);
  stroke-width: 1.5;
}

/* Kill magazine list pills inside diagrams (they break RTL cards). */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram ul,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram ol,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart ul,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart ol {
  list-style: none !important;
  margin: 0;
  padding: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram li::before,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-flowchart li::before {
  content: none !important;
  display: none !important;
  background: none !important;
  border: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram .nabgol-compare-points li::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  right: 0 !important;
  top: 0.55em !important;
  width: 0.4em !important;
  height: 0.4em !important;
  border-radius: 999px !important;
  background: var(--nbgd-em-edge) !important;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-title {
  margin: 0 0 0.75em;
  padding: 0 0.15em;
  color: var(--nbgd-em-ink-2);
  /* 0.98em alone breaks the 16px on-screen floor on the 15px mobile bubble base
     (0.98 * 15 = 14.7px, measured on the formula/compare/proscons/stat HTML cards
     that have no <svg> for compensateCardFontFloor() to bump -- see G6 note above
     and CHAT_GRAPHICS_OPERATING_PLAN.md 5c). max() keeps the em-based scaling for
     larger ambient contexts while guaranteeing the floor on the smallest one. */
  font-size: max(var(--nbg-diag-min-on-screen, 16px), 0.98em);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flowchart-cap {
  margin: 0.65em 0 0;
  text-align: center;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--nbgd-em-ink);
}

/* Compare — ALWAYS one column inside chat bubble.
   Multi-column inside a ~360–500px bubble is the cramped 3-card screenshot defect.
   Do not re-enable side-by-side via min-width media queries. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-grid {
  display: grid;
  gap: 0.75em;
  grid-template-columns: 1fr !important;
  align-items: start;
}
:where(body.mobile-chat .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-grid {
  grid-template-columns: 1fr !important;
}
:where(body.mobile-chat .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-grid:not([data-layout="side"]) {
  grid-template-columns: 1fr !important;
}
@media (max-width: 540px) {
  :where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-grid {
    grid-template-columns: 1fr !important;
  }
  :where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-grid:not([data-layout="side"]) {
    grid-template-columns: 1fr !important;
  }
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-col {
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: var(--nbgd-well);
  border: 1px solid var(--nbgd-line);
  overflow: hidden;
  height: auto;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-col[data-i="0"] .nabgol-compare-head {
  background: linear-gradient(135deg, var(--nbgd-em-tint-2), var(--nbgd-tint));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-col[data-i="1"] .nabgol-compare-head {
  background: linear-gradient(135deg, var(--nbgd-sky-tint), var(--nbgd-tint));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-col[data-i="2"] .nabgol-compare-head {
  background: linear-gradient(135deg, var(--nbgd-am-tint), var(--nbgd-tint));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-head {
  display: flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.7em 0.8em;
  border-bottom: 1px solid var(--nbgd-line-soft);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-badge {
  flex: 0 0 auto;
  width: 1.7em;
  height: 1.7em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--nbgd-em-face-mid);
  color: var(--nbgd-em-on);
  font-size: 16px;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-name {
  margin: 0;
  color: var(--nbgd-ink);
  font-size: 1em;
  font-weight: 800;
  line-height: 1.35;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-points {
  list-style: none;
  margin: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-points li {
  position: relative;
  margin: 0 0 0.45em;
  padding: 0 1em 0 0;
  color: var(--nbgd-ink-2);
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1.55;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-points li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.55em;
  width: 0.4em;
  height: 0.4em;
  border-radius: 999px;
  background: var(--nbgd-em-edge);
}

/* Stat (KPI tiles) — plain HTML grid, not SVG; see chat-flowchart.js renderStatHtml. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.6em;
  margin: 0;
}
@media (min-width: 541px) {
  :where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-stat-grid[data-count="3"],
  :where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-stat-grid[data-count="6"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-stat-tile {
  position: relative;
  margin: 0;
  padding: 0.75em 0.7em 0.65em;
  border-radius: 12px;
  background: var(--nbgd-well);
  border: 1px solid var(--nbgd-line);
  border-top: 2px solid var(--nabgol-stat-accent, var(--nbgd-em-edge));
  text-align: center;
  overflow: hidden;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-stat-value {
  font-size: 1.5em;
  font-weight: 800;
  line-height: 1.2;
  color: var(--nabgol-stat-accent, var(--nbgd-em-edge));
  direction: rtl;
  unicode-bidi: plaintext;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-stat-label {
  margin-top: 0.3em;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--nbgd-ink-2);
  line-height: 1.5;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-stat-caption {
  margin-top: 0.2em;
  font-size: 0.72em;
  font-weight: 500;
  color: var(--nbgd-ink-soft);
  line-height: 1.5;
}

/* Timeline */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0.15em 0.2em 0.2em;
  border-right: 3px solid var(--nbgd-em-edge-45);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7em;
  margin: 0 0 0.75em;
  padding: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-index {
  flex: 0 0 auto;
  width: 1.85em;
  height: 1.85em;
  margin-right: -1.05em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--nbgd-em-face-2);
  border: 2px solid var(--nbgd-em-edge-2);
  color: var(--nbgd-em-on);
  font-size: 0.85em;
  font-weight: 800;
  box-shadow: 0 0 0 4px var(--nbgd-shadow-3);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-list .nabgol-timeline-card {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.65em 0.8em;
  border-radius: 12px;
  background: var(--nbgd-panel);
  border: 1px solid var(--nbgd-line-mid);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-label {
  color: var(--nbgd-ink);
  font-weight: 800;
  font-size: 0.98em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-timeline-detail {
  margin-top: 0.25em;
  color: var(--nbgd-ink-soft);
  font-size: 0.88em;
  font-weight: 600;
}

/* Step-by-step solution cards — native <details>/<summary>, see chat-markdown.js
   groupSolutionSteps(). Native gives keyboard + screen-reader toggling for free. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step {
  margin: 0 0 0.6em;
  padding: 0;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  overflow: hidden;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step > summary {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.6em 0.8em;
  cursor: pointer;
  color: #f8fafc;
  font-weight: 800;
  font-size: 0.98em;
  list-style: none;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step > summary::-webkit-details-marker,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step > summary::marker {
  display: none;
  content: "";
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step > summary::after {
  content: "";
  margin-right: auto;
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step[open] > summary::after {
  transform: rotate(-135deg);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step-n {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7em;
  height: 1.7em;
  border-radius: 999px;
  background: #059669;
  border: 2px solid #6ee7b7;
  color: #ecfdf5;
  font-size: 0.82em;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step-body {
  padding: 0 0.9em 0.75em;
  color: #e2e8f0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step-body > :first-child {
  margin-top: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step-body > :last-child {
  margin-bottom: 0;
}
/* پاسخ نهایی — mint accent border marks the destination card among the steps */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step-final {
  border-color: #34d399;
  border-width: 2px;
  background: rgba(6, 78, 59, 0.35);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-step-final > summary {
  color: #34d399;
}

/* Tree */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-list {
  list-style: none;
  margin: 0;
  padding: 0 0.85em 0 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-item {
  margin: 0 0 0.45em;
  padding: 0;
  position: relative;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-list .nabgol-tree-list {
  margin-top: 0.4em;
  border-right: 2px solid var(--nbgd-sky-line);
}
/* HTML leftover. Unscoped display:inline-block on svg g.nabgol-tree-node
   turned every tree into a stack of green buttons (screenshot). */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-list .nabgol-tree-node {
  display: inline-block;
  max-width: 100%;
  padding: 0.45em 0.75em;
  border-radius: 11px;
  background: var(--nbgd-panel);
  border: 1px solid var(--nbgd-sky-line-2);
  color: var(--nbgd-ink);
  font-weight: 700;
  font-size: 0.95em;
  line-height: 1.4;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-tree-shell > .nabgol-tree-list > .nabgol-tree-item > .nabgol-tree-node {
  background: var(--nbgd-em-tint);
  border-color: var(--nbgd-em-edge);
}

/* Sequence */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-actors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
  justify-content: flex-start;
  margin-bottom: 0.75em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-actors .nabgol-sequence-actor {
  display: inline-flex;
  padding: 0.35em 0.75em;
  border-radius: 999px;
  background: var(--nbgd-vi-tint);
  border: 1px solid var(--nbgd-vi-edge-2);
  color: var(--nbgd-vi-on);
  font-size: 0.88em;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-msgs {
  list-style: none;
  margin: 0;
  padding: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-msgs .nabgol-sequence-msg {
  display: flex;
  gap: 0.65em;
  align-items: flex-start;
  margin: 0 0 0.65em;
  padding: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-step {
  flex: 0 0 auto;
  width: 1.7em;
  height: 1.7em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--nbgd-vi-tint-2);
  color: var(--nbgd-vi-on-2);
  font-size: 0.82em;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.55em 0.75em;
  border-radius: 12px;
  background: var(--nbgd-panel-2);
  border: 1px solid var(--nbgd-vi-edge-soft);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
  color: var(--nbgd-vi-ink);
  font-size: 0.88em;
  font-weight: 700;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-arrow {
  color: var(--nbgd-vi-edge);
  font-weight: 900;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-text {
  margin-top: 0.25em;
  color: var(--nbgd-ink);
  font-size: 0.95em;
  font-weight: 700;
}

/* Cycle — true ring, not a wrapped pill row */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-ring {
  position: relative;
  width: min(100%, 17.5rem);
  aspect-ratio: 1;
  margin: 0.35em auto 0.55em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-orbit {
  position: absolute;
  inset: 22%;
  border: 2px dashed var(--nbgd-cy-edge-soft);
  border-radius: 50%;
  box-shadow: 0 0 24px var(--nbgd-cy-glow) inset;
}
/* HTML-only leftover ring. NEVER apply to svg .nabgol-cycle-hub —
   that painted the floating teal blob on the cycle screenshot. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-ring .nabgol-cycle-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 4.4em;
  height: 4.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--nbgd-cy-edge), var(--nbgd-cy-face-2) 70%);
  border: 2px solid var(--nbgd-cy-edge-70);
  color: var(--nbgd-on-bright-em);
  font-size: 0.78em;
  font-weight: 900;
  box-shadow: 0 8px 20px var(--nbgd-cy-shadow);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-list {
  list-style: none;
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  display: block;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2em;
  width: max-content;
  max-width: 6.8em;
  margin: 0;
  padding: 0.4em 0.55em;
  border-radius: 14px;
  background: linear-gradient(165deg, var(--nbgd-cy-face-mid), var(--nbgd-cy-face-deep));
  border: 1px solid var(--nbgd-cy-edge-50);
  color: var(--nbgd-cy-on);
  font-weight: 800;
  font-size: 0.82em;
  line-height: 1.3;
  text-align: center;
  --ang: calc((var(--i) * 360deg / var(--n, 4)) - 90deg);
  transform: translate(-50%, -50%) rotate(var(--ang)) translate(6.55em) rotate(calc(-1 * var(--ang)));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-num {
  width: 1.35em;
  height: 1.35em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--nbgd-cy-face-deep);
  border: 1px solid var(--nbgd-cy-edge);
  font-size: 0.8em;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-cycle-foot {
  margin-top: 0.15em;
  text-align: center;
  color: var(--nbgd-cy-ink);
  font-size: 0.85em;
  font-weight: 700;
}

/* Flowchart (HTML steps — flagship card, not code) */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-shell {
  position: relative;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-list {
  list-style: none;
  margin: 0;
  padding: 0.15em 0.1em 0.25em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-step {
  display: flex;
  gap: 0.7em;
  align-items: stretch;
  margin: 0 0 0.4em;
  padding: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-index {
  flex: 0 0 auto;
  align-self: center;
  width: 1.85em;
  height: 1.85em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(145deg, #065f46, #047857);
  border: 1px solid #6ee7b7;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
  color: #ecfdf5;
  font-size: 0.82em;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-card {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.65em 0.9em 0.7em;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(51, 65, 85, 1), rgba(30, 41, 59, 0.98));
  border: 1px solid rgba(203, 213, 225, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px rgba(2, 6, 23, 0.28);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-decision .nabgol-flow-card {
  border-color: rgba(251, 191, 36, 0.62);
  background: linear-gradient(165deg, rgba(120, 53, 15, 0.42), rgba(30, 41, 59, 0.9));
  border-radius: 4px 28px;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.15);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-terminal .nabgol-flow-card {
  border-color: #34d399;
  background: linear-gradient(165deg, rgba(16, 185, 129, 0.28), rgba(6, 78, 59, 0.35));
  border-radius: 999px;
  text-align: center;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-io .nabgol-flow-card {
  border-color: rgba(56, 189, 248, 0.6);
  background: linear-gradient(165deg, rgba(12, 74, 110, 0.45), rgba(30, 41, 59, 0.92));
  transform: skewX(-8deg);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-io .nabgol-flow-card > * {
  transform: skewX(8deg);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-shape-tag {
  display: inline-block;
  margin-bottom: 0.25em;
  padding: 0.05em 0.45em;
  border-radius: 999px;
  color: #a7f3d0;
  background: rgba(6, 78, 59, 0.45);
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.02em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-decision .nabgol-flow-shape-tag {
  color: #fde68a;
  background: rgba(120, 53, 15, 0.55);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-io .nabgol-flow-shape-tag {
  color: #bae6fd;
  background: rgba(12, 74, 110, 0.55);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-label {
  color: #f8fafc;
  font-size: 1.02em;
  font-weight: 800;
  line-height: 1.5;
  font-feature-settings: "ss01";
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-edges {
  margin: 0 0 0.55em 2.55em;
  padding: 0.15em 0 0.2em;
  list-style: none;
  border-right: 2px dashed rgba(52, 211, 153, 0.35);
  padding-right: 0.75em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-fork {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5em;
  margin: 0.15em 0 0.65em 2.35em;
  padding: 0;
  list-style: none;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  padding: 0.65em 0.55em 0.7em;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(6, 78, 59, 0.55), rgba(15, 23, 42, 0.75));
  border: 1px solid rgba(52, 211, 153, 0.42);
  text-align: center;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-branch .nabgol-flow-edge-if {
  align-self: center;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-branch-card {
  color: #f8fafc;
  font-weight: 800;
  font-size: 0.95em;
  line-height: 1.4;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-merge {
  border-right-style: solid;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-edge-box {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-edge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em;
  color: #bbf7d0;
  font-size: 0.9em;
  font-weight: 700;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-edge-if {
  padding: 0.15em 0.55em;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.95), rgba(4, 120, 87, 0.85));
  border: 1px solid rgba(110, 231, 183, 0.55);
  color: #ecfdf5;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.25);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-edge-arrow {
  color: #6ee7b7;
  font-weight: 900;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-flow-edge-to {
  color: #e2e8f0;
  font-weight: 800;
}

/* Never set display on SVG descendants — that pulls shapes out of SVG layout into a chip row. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-canvas {
  direction: ltr !important;
  unicode-bidi: isolate;
  overflow: visible;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-canvas svg.nabgol-diagram-svg {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
}

/* ───────────────────────────────────────────────────────────────────────────────
   Diagram cards own their own list chrome (2026-08-20).

   Every <ul>/<ol> in an assistant bubble gets the magazine treatment: a translucent
   card background, a 1px border, side padding, and a mint dot or Persian numeral pill
   on each <li>. Inside a diagram card that is a second frame drawn on top of the card's
   own frame, and the dots land on formula symbols as stray green blobs.

   Two earlier kill-switches existed but both missed real cases:
     · they were scoped to `figure.nabgol-diagram` — and the fullscreen viewer moves the
       .nabgol-diagram-shell ALONE into the overlay, leaving that figure behind, so every
       suppressed dot came back the moment a card was opened fullscreen (the misplaced
       green dot in the user's report);
     · they never touched background/border/padding, only ::before, so on mobile the
       formula list still painted a full-width bordered box flush against the card's own
       border (measured: list box 37→463px inside a shell that is itself 37→463px).

   Scoping to .nabgol-diagram-shell fixes both at once: the shell is exactly what travels
   into the fullscreen overlay, so in-bubble and fullscreen now render identically. */
/* Specificity note: the legacy `body.mobile-chat .message .text ul { padding-right: 22px
   !important }` in style-mobile.css is (0,3,2) with !important, so a `:where()`-scoped
   reset silently loses to it on phones — which is where every one of these reports came
   from. These selectors are written out longhand to outrank it. */
body:is(.desktop-chat, .mobile-chat) .message .text .nabgol-diagram-shell :is(ul, ol),
.nabgol-media-fullscreen .nabgol-diagram-shell :is(ul, ol) {
  list-style: none !important;
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
  counter-reset: none !important;
}

body:is(.desktop-chat, .mobile-chat) .message .text .nabgol-diagram-shell :is(ul, ol) > li,
.nabgol-media-fullscreen .nabgol-diagram-shell :is(ul, ol) > li {
  padding-right: 0;
  padding-left: 0;
  line-height: 1.5;
}

/* …and the two lists that legitimately have padding of their own get it back.
   The blanket `padding: 0 !important` above is aimed at an INHERITED prose indent,
   not at a component's own inset — but it could not tell the two apart, so it
   flattened both. Measured on the real cascade: `.nabgol-compare-points` and the
   pros/cons list rendered with zero inset, which put their bullet dot
   (`li::before { right: 0 }`) hard against the row's inner edge, touching the first
   letter, in the bubble AND in the viewer.
   Written longhand rather than as a `:where()` component rule because it has to
   outrank TWO !important declarations at once — the reset directly above (0,4,2)
   and style-mobile.css's legacy `body.mobile-chat .message .text ul
   { padding-right: 22px !important }` (0,3,2). A `:where()`-scoped rule scores
   (0,1,0) and loses to both; that was tried, and the dot did not move. */
body:is(.desktop-chat, .mobile-chat) .message .text .nabgol-diagram-shell :is(.nabgol-compare-points, .nabgol-proscons-col > ul),
.nabgol-media-fullscreen .nabgol-diagram-shell :is(.nabgol-compare-points, .nabgol-proscons-col > ul) {
  padding: 0.65em 0.85em 0.8em !important;
}
/* The row's own bullet gutter, for the same reason and from the same cause: the
   `> li { padding-right: 0 }` half of the reset above (0,4,3) outranks the
   component's `:where()` rule (0,2,0), so the 1em the dot needs to sit in was
   being removed and the dot landed ON the first letter. This is the gutter the
   absolutely-positioned `li::before { right: 0 }` is measured against — change one
   and you must change the other. */
body:is(.desktop-chat, .mobile-chat) .message .text .nabgol-diagram-shell :is(.nabgol-compare-points, .nabgol-proscons-col > ul) > li,
.nabgol-media-fullscreen .nabgol-diagram-shell :is(.nabgol-compare-points, .nabgol-proscons-col > ul) > li {
  padding-right: 1em !important;
  padding-left: 0 !important;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-shell li::before,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-shell li::marker,
.nabgol-media-fullscreen .nabgol-diagram-shell li::before,
.nabgol-media-fullscreen .nabgol-diagram-shell li::marker {
  content: none !important;
  display: none !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* …but the .nabgol-compare-points bullets are part of a compare card's design, not
   magazine chrome bleeding in, so they are restored explicitly. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-shell .nabgol-compare-points li::before,
.nabgol-media-fullscreen .nabgol-diagram-shell .nabgol-compare-points li::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  right: 0 !important;
  top: 0.55em !important;
  width: 0.4em !important;
  height: 0.4em !important;
  border-radius: 999px !important;
  background: var(--nbgd-em-edge) !important;
}

/* Formula card */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-expr {
  display: flex;
  justify-content: center;
  margin: 0.15em 0 0.85em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-expr-inner {
  display: inline-block;
  padding: 0.7em 1.1em;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--nbgd-well-3), var(--nbgd-bl-tint));
  border: 1px solid var(--nbgd-bl-edge);
  color: var(--nbgd-bl-ink-3);
  font-size: 1.15em;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 var(--nbgd-bl-highlight);
  unicode-bidi: isolate;
}
/* Legend rows (2026-08-20). Every row used to be `width: fit-content`, so the three
   rows of a legend ended up three different widths, each hugging the card's start edge —
   and because the magazine list chrome painted a bordered box around the whole list at
   the card's exact width, the widest row sat flush on that border and read as spilling
   out of the card. The list chrome is gone (see the diagram-shell list reset above) and
   the rows are now one aligned grid: symbol column, «یعنی» column, meaning column, so
   every symbol chip and every meaning lines up with the one above it. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-parts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4em;
  direction: rtl;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-part {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0.45em 0.55em;
  margin: 0;
  /* A HAIRLINE, NOT A BOX — this is the "empty white bar" S2 logged as open debt
     and handed to this session. The grid above is right and stays: symbol, «یعنی»,
     meaning, each column aligned with the one above it. What was wrong was the
     PAINT. A filled, bordered panel drawn at the full row width, whose third
     column is short by nature («طول», «عرض»), reads as a bright empty bar with the
     content shoved into one corner — the defect the owner saw in day mode, and it
     got worse the wider the column grew.
     A legend is a definition list, and the canvas language for one is a rule
     between rows, not a container around each. Nothing is lost: the columns still
     line up, and the row is now quiet enough that the eye reads down the symbols
     instead of across three panels. */
  padding: 0.42em 0.15em;
  direction: rtl;
  text-align: right;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-part + .nabgol-formula-part {
  border-top: 1px solid var(--nbgd-line-soft);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-sym {
  min-width: 2.1em;
  padding: 0.15em 0.45em;
  border-radius: 7px;
  background: var(--nbgd-bl-tint-2);
  border: 1px solid var(--nbgd-bl-edge-2);
  color: var(--nbgd-bl-ink-2);
  font-weight: 800;
  text-align: center;
  unicode-bidi: isolate;
  line-height: 1.3;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-eq {
  color: var(--nbgd-bl-ink);
  font-weight: 900;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-formula-mean {
  color: var(--nbgd-ink-3);
  font-weight: 700;
  font-size: 0.95em;
  line-height: 1.45;
  text-align: right;
  min-width: 0;
}

/* Bars */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-unit {
  margin: -0.35em 0 0.7em;
  text-align: center;
  color: var(--nbgd-ink-soft);
  font-size: 0.85em;
  font-weight: 700;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-row {
  margin: 0;
  padding: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75em;
  margin-bottom: 0.28em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-label {
  color: var(--nbgd-ink);
  font-weight: 800;
  font-size: 0.95em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-value {
  color: var(--nbgd-em-ink);
  font-weight: 800;
  font-size: 0.95em;
  font-variant-numeric: tabular-nums;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-track {
  display: flex;
  justify-content: flex-end;
  height: 0.72em;
  border-radius: 999px;
  background: var(--nbgd-track);
  border: 1px solid var(--nbgd-line);
  overflow: hidden;
  direction: rtl;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(270deg, var(--nbgd-em-face-2), var(--nbgd-em-edge) 55%, var(--nbgd-em-ink-2));
  box-shadow: 0 0 12px var(--nbgd-em-glow);
  transition: width 0.35s ease;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-row[data-i="1"] .nabgol-bars-fill {
  background: linear-gradient(270deg, var(--nbgd-sky-face-2), var(--nbgd-sky-edge) 55%, var(--nbgd-sky-face-3));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-row[data-i="2"] .nabgol-bars-fill {
  background: linear-gradient(270deg, var(--nbgd-am-face-3), var(--nbgd-am-edge) 55%, var(--nbgd-am-face-4));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-row[data-i="3"] .nabgol-bars-fill {
  background: linear-gradient(270deg, var(--nbgd-vi-face-2), var(--nbgd-vi-edge) 55%, var(--nbgd-vi-ink));
}

/* Venn (real SVG circles) */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-stage {
  margin: 0.2em auto 0.85em;
  max-width: 22em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-svg-label {
  fill: var(--nbgd-ink);
  font-size: 16px;
  font-weight: 800;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-svg-both {
  font-size: 16px;
  font-weight: 800;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-svg-bothv {
  fill: var(--nbgd-on-bright);
  font-size: 16px;
  font-weight: 800;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-legend li {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  color: var(--nbgd-ink-2);
  font-size: 0.88em;
  font-weight: 600;
  line-height: 1.45;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-dot {
  flex: 0 0 auto;
  width: 0.7em;
  height: 0.7em;
  margin-top: 0.35em;
  border-radius: 999px;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-dot.a { background: var(--nbgd-em-edge); }
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-dot.b { background: var(--nbgd-sky-edge); }
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-dot.both { background: var(--nbgd-am-edge); }

/* Pros / Cons — stack by default; side-by-side only when data-layout=side (short copy). */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-grid {
  display: grid;
  gap: 0.65em;
  grid-template-columns: 1fr;
  align-items: start;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-grid[data-layout="side"] {
  grid-template-columns: 1fr 1fr;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--nbgd-well-4);
  border: 1px solid var(--nbgd-line);
  width: 100%;
  max-width: 100%;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col header {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.65em 0.8em;
  border-bottom: 1px solid var(--nbgd-line-soft);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col h4 {
  margin: 0;
  color: var(--nbgd-ink);
  font-size: 1em;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-badge {
  width: 1.55em;
  height: 1.55em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.95em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-pro header {
  background: linear-gradient(135deg, var(--nbgd-em-tint-3), var(--nbgd-tint-2));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-pro .nabgol-proscons-badge {
  background: var(--nbgd-em-face-2);
  color: var(--nbgd-em-on);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-con header {
  background: linear-gradient(135deg, var(--nbgd-rd-tint), var(--nbgd-tint-2));
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-con .nabgol-proscons-badge {
  background: var(--nbgd-rd-face-2);
  color: var(--nbgd-rd-on);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col ul {
  list-style: none;
  margin: 0;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col li {
  position: relative;
  margin: 0 0 0.45em;
  padding: 0 1em 0 0;
  color: var(--nbgd-ink-2);
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1.5;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-pro li::before,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-con li::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  right: 0 !important;
  top: 0.55em !important;
  width: 0.4em !important;
  height: 0.4em !important;
  border-radius: 999px !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-pro li::before {
  background: var(--nbgd-em-edge) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-proscons-col.is-con li::before {
  background: var(--nbgd-rd-face-3) !important;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-sequence-label-bg {
  fill: var(--nbgd-well-2);
  stroke: var(--nbgd-vi-edge-45);
  stroke-width: 1;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-bars-axis {
  fill: var(--nbgd-ink-soft);
  font-size: 11px;
  font-weight: 700;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-venn-lens-label {
  fill: var(--nbgd-ink);
  font-size: 16px;
  font-weight: 800;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-schematic-note {
  margin: 0 0 0.55em;
  padding: 0.45em 0.65em;
  border-radius: 10px;
  background: var(--nbgd-em-wash-2);
  border: 1px solid var(--nbgd-em-wash-edge-2);
  color: var(--nbgd-em-ink-2);
  font-size: 0.82em;
  line-height: 1.5;
}
@media (max-width: 480px) {
  :where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-compare-shell[data-stack="mobile"] .nabgol-compare-svg {
    min-height: 280px;
  }
}

/* Annotate (book page pins) */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-page {
  position: relative;
  direction: ltr;
  height: 12.5em;
  margin: 0.15em auto 0.85em;
  max-width: 18em;
  border-radius: 12px;
  background:
    linear-gradient(180deg, var(--nbgd-paper) 0%, var(--nbgd-paper-2) 100%);
  border: 1px solid var(--nbgd-paper-edge);
  box-shadow:
    inset 0 0 0 1px var(--nbgd-paper-inset),
    0 10px 24px var(--nbgd-shadow);
  overflow: hidden;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-page-label {
  position: absolute;
  top: 0.45em;
  right: 0.55em;
  z-index: 2;
  direction: rtl;
  color: var(--nbgd-paper-ink);
  font-size: 0.78em;
  font-weight: 800;
  background: var(--nbgd-paper-chip);
  padding: 0.15em 0.45em;
  border-radius: 999px;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-lines {
  position: absolute;
  inset: 2.1em 1em 1em;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 0.85em,
      var(--nbgd-paper-rule) 0.85em,
      var(--nbgd-paper-rule) 0.9em
    );
  opacity: 0.85;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-pin-n {
  width: 1.55em;
  height: 1.55em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--nbgd-rd-face);
  border: 2px solid var(--nbgd-on-white);
  color: var(--nbgd-on-white);
  font-size: 0.78em;
  font-weight: 900;
  box-shadow: 0 4px 10px var(--nbgd-rd-shadow);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-pin-cap {
  margin-top: 0.2em;
  max-width: 6.2em;
  padding: 0.12em 0.4em;
  border-radius: 7px;
  background: var(--nbgd-paper-tip);
  color: var(--nbgd-paper-tip-ink);
  font-size: 0.62em;
  font-weight: 800;
  direction: rtl;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 8px var(--nbgd-shadow-2);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-pin-arrow {
  width: 0;
  height: 0;
  margin-top: -1px;
  border-left: 0.35em solid transparent;
  border-right: 0.35em solid transparent;
  border-top: 0.55em solid var(--nbgd-rd-face);
  filter: drop-shadow(0 1px 0 #fff);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-legend li {
  display: flex;
  gap: 0.55em;
  align-items: flex-start;
  margin: 0;
  color: var(--nbgd-ink-2);
  font-size: 0.9em;
  font-weight: 600;
  line-height: 1.45;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-leg-n {
  flex: 0 0 auto;
  width: 1.45em;
  height: 1.45em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--nbgd-rd-face-4);
  color: var(--nbgd-on-white);
  font-size: 0.8em;
  font-weight: 900;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-annotate-hint {
  margin: 0.75em 0 0;
  padding: 0.55em 0.7em;
  border-radius: 10px;
  background: var(--nbgd-panel-3);
  border: 1px dashed var(--nbgd-line-mid-2);
  color: var(--nbgd-ink-faint);
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.45;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) pre,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) code,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .katex,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .katex-display,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-math-tex,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .MathJax,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) mjx-container,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .math {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) p code,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) li code {
  margin: 0 0.12em;
  white-space: nowrap;
}


body:is(.desktop-chat, .mobile-chat) .message .text ol > li::marker,
body:is(.desktop-chat, .mobile-chat) .message .text ul > li::marker {
  unicode-bidi: isolate;
  color: #86efac;
  font-weight: 700;
}

body:is(.desktop-chat, .mobile-chat) .message .text pre,
body:is(.desktop-chat, .mobile-chat) .message .text code {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) :not(pre) > code {
  font-size: 0.9em;
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #bbf7d0;
}

/* Images & media in messages */
body:is(.desktop-chat, .mobile-chat) .message .text img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.38);
}

body:is(.desktop-chat, .mobile-chat) .message .text table {
  border-radius: 10px;
  overflow: hidden;
}

/* Workflow step pill */
.nabgol-workflow-badge {
  font-size: 11px;
  letter-spacing: 0.02em;
  margin-top: 10px;
}

/* Action chips — icon dock; labels stay hover-tooltips (style-desktop) */
body:is(.desktop-chat, .mobile-chat) .action-chip {
  min-height: 28px;
  padding: 0;
  border-radius: 8px;
  opacity: 0.88;
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.12s ease, color 0.15s ease;
}

body:is(.desktop-chat, .mobile-chat) .message-bubble:hover .action-chip,
body:is(.desktop-chat, .mobile-chat) .action-chip:focus-visible {
  opacity: 1;
}

body:is(.desktop-chat, .mobile-chat) .action-chip:active {
  transform: scale(0.96);
}

body:is(.desktop-chat, .mobile-chat) .message-bubble > .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 8px;
}

body:is(.desktop-chat, .mobile-chat) .message-actions {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* Do not force visible text labels beside icons */
body:is(.desktop-chat, .mobile-chat) .message-actions > .action-chip {
  gap: 0;
}

/* THE «بیشتر» DOOR IS HIDDEN AGAIN — owner, 2026-09-06.
   Step 7 unhid `.action-overflow` and moved «حذف» · «ثبت در پرونده» · «این پاسخ
   اشکال داشت» behind it. The owner reversed that: all seven actions are icon
   squares directly in the row, and «بیشتر» is not wanted at all.
   `buildOverflowMenu()` in script.js is left standing but is now called by
   nothing, so this rule is what guarantees the door cannot come back by
   accident — a stored page rendered by an older script.js, or a future call
   site added without reading the master plan, paints nothing instead of a
   half-styled chip. Delete this only together with that function. */
body:is(.desktop-chat, .mobile-chat) .action-overflow {
  display: none !important;
}

/* Error bubble — large retry CTA */
body:is(.desktop-chat, .mobile-chat) .message.is-error .message-bubble {
  border-color: rgba(248, 113, 113, 0.45) !important;
  background: linear-gradient(165deg, rgba(69, 10, 10, 0.55) 0%, rgba(15, 23, 42, 0.94) 100%) !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-error-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ecfdf5;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-error-retry:hover {
  filter: brightness(1.06);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-error-retry .ico {
  width: 18px;
  height: 18px;
}

body:is(.desktop-chat, .mobile-chat) .message.is-error .message-actions > .action-chip.regenerate-btn {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.4);
  opacity: 1;
  font-weight: 800;
}

/* Version bar under bubble — classic pill */
body:is(.desktop-chat, .mobile-chat) .message-body > .version-controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  color: rgba(226, 232, 240, 0.92);
  font-size: 12px;
}

body:is(.desktop-chat, .mobile-chat) .message-body > .version-controls.show,
body:is(.desktop-chat, .mobile-chat) .message-body > .version-controls:not([hidden]) {
  display: inline-flex !important;
}

body:is(.desktop-chat, .mobile-chat) .message-body > .version-controls button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.85;
}

body:is(.desktop-chat, .mobile-chat) .message-body > .version-controls button:hover {
  opacity: 1;
  color: #6ee7b7;
}

body:is(.desktop-chat, .mobile-chat) .message-body > .version-controls .version-badge {
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* The overflow MENU is hidden again too — 2026-09-06, same reversal as
   `.action-overflow` above. chat-canvas.css no longer paints it at all, so
   without this an emitted `.action-menu` would inherit style-controls.css's
   28px font-size-0 button squares and open as a column of blank boxes. */
body:is(.desktop-chat, .mobile-chat) .action-menu {
  display: none !important;
}

/* Version controls beside bubble meta (not page bottom) */
body:is(.desktop-chat, .mobile-chat) .version-controls {
  display: none;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

body:is(.desktop-chat, .mobile-chat) .version-controls.show,
body:is(.desktop-chat, .mobile-chat) .version-controls:not([hidden]).show {
  display: inline-flex !important;
}

body:is(.desktop-chat, .mobile-chat) .version-controls[hidden] {
  display: none !important;
}

body:is(.desktop-chat, .mobile-chat) .version-controls .prev-version,
body:is(.desktop-chat, .mobile-chat) .version-controls .next-version {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  cursor: pointer;
}

body:is(.desktop-chat, .mobile-chat) .version-controls .prev-version span,
body:is(.desktop-chat, .mobile-chat) .version-controls .next-version span {
  display: none;
}

body:is(.desktop-chat, .mobile-chat) .version-controls .version-badge {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  min-width: 2.6em;
  text-align: center;
  direction: ltr;
}

body:is(.desktop-chat, .mobile-chat) .footer-meta {
  opacity: 0.62;
  font-size: 10px;
}

/* Inline interactive block inside bubble */
body:is(.desktop-chat, .mobile-chat) .message-bubble > .nabgol-inline-components {
  margin-top: 14px;
  padding-top: 14px;
  border-top-color: rgba(255, 255, 255, 0.1);
}

/* Desktop stage atmosphere — dark only; light uses --bg */
@media (min-width: 768px) {
  html:not([data-theme="light"]) body.desktop-chat .chat-main {
    background:
      radial-gradient(ellipse 80% 50% at 50% 0%, rgba(16, 185, 129, 0.06) 0%, transparent 55%),
      linear-gradient(180deg, #0a0f1a 0%, #0d1424 48%, #0a0f1a 100%);
  }
}

/* Phase 3 layering — empty never competes with open dossier (desktop+mobile) */
body.nabgol-workspace-open #emptyState,
body.nabgol-workspace-open .chat-messages > .empty {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Phase 3 — history popover must not dim/cover dossier (any viewport) */
body.nabgol-workspace-open.nabgol-chats-open .sidebar-overlay,
body.nabgol-workspace-open .sidebar-overlay.show {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* PDF preview — dark surround, paper centered */
.nabgol-print-sheet-frame {
  background: #1a2332 !important;
}

body.desktop-chat #splitPanel.open,
body.desktop-chat #splitPanel.nabgol-workspace-v2.open {
  background: #0b1220 !important;
}

/* External tool cards — high-contrast readable on dark chat chrome */
body:is(.desktop-chat, .mobile-chat) .external-tool-card {
  direction: rtl;
  text-align: right;
  border-radius: 16px;
  border: 1px solid rgba(110, 231, 183, 0.38);
  background: linear-gradient(165deg, #173528 0%, #0f241a 55%, #0c1b14 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  margin: 8px 0 12px;
  padding: 14px 16px;
  color: #eef8f1 !important;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-badge {
  background: rgba(167, 243, 208, 0.18);
  color: #a7f3d0 !important;
  border: 1px solid rgba(167, 243, 208, 0.28);
}
body:is(.desktop-chat, .mobile-chat) .external-tool-card--disease .external-tool-badge {
  background: rgba(253, 186, 116, 0.18);
  color: #fdba74 !important;
  border-color: rgba(253, 186, 116, 0.3);
}
body:is(.desktop-chat, .mobile-chat) .external-tool-title {
  color: #f0fdf4 !important;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-summary {
  color: #dcefe3 !important;
  font-weight: 600;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-cand {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(167, 243, 208, 0.22);
  color: #eaf7ef !important;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-cand-name {
  color: #f0fdf4 !important;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-cand-score {
  background: rgba(167, 243, 208, 0.16);
  color: #bbf7d0 !important;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-cand-meta {
  color: #b7d4c2 !important;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-card.is-error {
  background: linear-gradient(165deg, #3a1d18, #2a1410);
  border-color: rgba(252, 165, 165, 0.35);
  color: #fee2e2 !important;
}
body:is(.desktop-chat, .mobile-chat) .external-tool-card.is-error .external-tool-title {
  color: #fecaca !important;
}

/* ============================================================================
   NABGOL THINK — the wait signature (v9 · forever)
   ---------------------------------------------------------------------------
   One composition, three beats, read top → down:
     1) the living mark          — brand film breathing inside a slow aura
     2) «در حال فکر کردن» + ⋯     — honest status line; three dots keep the pulse
     3) «ریشه در اندیشه دارم…»    — the motto, gold, lit by one specular sweep
   Laws proven by real device screenshots — do not undo:
     · frameless: no card, no glass matte — only a soft edgeless vignette
     · ghost layer: never captures a tap, never blocks scroll
     · the base motto text always keeps a real `color` (transparent fill on the
       base run = the “empty plaque” bug). Transparent fill is allowed ONLY on
       the duplicated `.nabgol-think-sub-gleam` overlay, inside @supports.
     · the motto never wraps and never sits in a pill (a plaque reads as a button)
     · no straight rule/bar near the copy (reads as a progress bar)
   ========================================================================== */
@keyframes nabgol-think-veil-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* ——— ENTRANCE LAW ———
   Every staggered entrance below animates TRANSFORM ONLY. No opacity, no
   clip-path, ever, on anything carrying words. Reason: with a delay plus
   `both`, the from-frame is painted during the delay, so an animation that is
   throttled, overridden or never advanced leaves the text stranded invisible —
   which is exactly how the motto disappeared in the field. A stranded
   transform costs a few pixels of offset; a stranded opacity costs the brand.
   The single fade of the whole composition lives on .typing-indicator. */
@keyframes nabgol-think-stage-in {
  /* transform only — filter:blur here destroys the film's alpha edges */
  from { transform: translateY(12px) scale(0.965); }
  to { transform: translateY(0) scale(1); }
}
@keyframes nabgol-think-breathe {
  0%, 100% { transform: scale(1) translateZ(0); }
  50% { transform: scale(1.028) translateZ(0); }
}
/* Two blooms drift on opposite slow orbits — organic light, never a spinner. */
@keyframes nabgol-think-aura-a {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.94); }
  50% { opacity: 0.76; transform: translate(-53%, -47%) scale(1.12); }
}
@keyframes nabgol-think-aura-b {
  0%, 100% { opacity: 0.24; transform: translate(-50%, -50%) scale(1.08); }
  50% { opacity: 0.52; transform: translate(-47%, -53%) scale(0.9); }
}
/* One thought ring leaves the mark per cycle — the only literal “activity” tell. */
@keyframes nabgol-think-ring {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  16% { opacity: 0.4; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45); }
}
/* Copy settles in once, then holds still — no infinite text glow (reads cheap). */
@keyframes nabgol-think-line-in {
  from { transform: translateY(7px); }
  to { transform: translateY(0); }
}
/* Resting opacity stays high enough that a still frame (screenshot, slow paint)
   still shows three dots — a loading tell nobody can see is not a tell. */
@keyframes nabgol-think-dot {
  0%, 62%, 100% { opacity: 0.42; transform: translateY(0) scale(0.85); }
  31% { opacity: 1; transform: translateY(-2.5px) scale(1); }
}
/* The motto rises once into place. There is deliberately NO clip-path wipe here:
   a stranded clip is an invisible motto, and the gleam already carries the
   “engraved metal” read without ever being able to hide a glyph. */
/* Idle life for the motto — transform only, same law as every other seal
   animation: a stalled loop just holds one harmless scale, never hides text. */
/* Specular sweep — light travelling across gold, right → left (RTL).
   With background-size 300% the offset is -2W·P, so -100% parks the band off
   the RIGHT and 100% parks it off the LEFT: -100% → 100% is an RTL sweep. */
/* A bare custom property animates by discrete jumps; registering it as a
   <percentage> is what makes the two bead combs glide instead of teleport. */
body:is(.desktop-chat, .mobile-chat) .typing-indicator[hidden],
body:is(.desktop-chat, .mobile-chat) #typing[hidden] {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator {
  display: none;
  box-sizing: border-box;
  position: fixed !important;
  inset: 0 0 var(--nabgol-composer-offset, 76px) 0 !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: var(--nabgol-composer-offset, 76px) !important;
  /* Above dossier/PDF (1400) so think stays visible when panel is open */
  z-index: 1500 !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  align-self: auto !important;
  /* Ghost layer: visible only — scroll/click pass through to chat */
  pointer-events: none !important;
  opacity: 0;
  --think-live-opacity: 1;
  --think-live-scale: 1;
  transition: opacity 0.35s ease;
  transform: none !important;
  overflow: visible !important;
}

/* Beat desktop-shell in-flow rules — always fixed ghost overlay */
body.desktop-chat .chat-messages > .typing-indicator,
body.desktop-chat .chat-messages > .typing-indicator.show,
body.desktop-chat .chat-messages > .typing-indicator.show:not(.is-leaving) {
  position: fixed !important;
  /* Bound to .chat-main via --think-* (syncThinkBounds) */
  left: var(--think-left, 0px) !important;
  width: var(--think-width, 100%) !important;
  top: var(--think-top, 0px) !important;
  height: var(--think-height, auto) !important;
  right: auto !important;
  bottom: auto !important;
  inset: auto !important;
  max-width: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  align-self: auto !important;
  pointer-events: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  filter: none !important;
  z-index: 1500 !important;
}

body.desktop-chat .typing-indicator.is-chat-bound.show:not(.is-leaving) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.show:not(.is-leaving) {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 1 !important;
  filter: none !important;
  animation: nabgol-think-veil-in 0.4s ease both;
  pointer-events: none !important;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.show .nabgol-think-stage {
  opacity: var(--think-live-opacity, 1) !important;
  filter: none !important;
  transform: scale(var(--think-live-scale, 1));
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-leaving {
  opacity: 1 !important;
  filter: none !important;
  pointer-events: none !important;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-leaving .nabgol-think-stage {
  opacity: 0 !important;
  filter: none !important;
  transform: translateY(-8px) scale(0.96) !important;
  transition:
    opacity 1.05s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.05s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* Page stays sharp — welcome card hides during think so it never looks like a frame */
body:is(.desktop-chat, .mobile-chat) .chat-messages:has(> .typing-indicator.show) > .empty,
body:is(.desktop-chat, .mobile-chat).nabgol-thinking #emptyState {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: none;
}

/* —— The stage: one centred column, three beats, zero chrome —— */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-stage,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-row {
  position: relative;
  z-index: 1;
  pointer-events: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: min(90vw, 420px);
  max-width: min(90vw, 420px);
  margin: 0 auto;
  padding: 4px 10px 8px;
  /* Frameless — no card, no glass matte over the page */
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible;
  text-align: center;
  transform-origin: center center;
  will-change: opacity, transform;
}

/* Edgeless vignette: lifts the composition off live message text without ever
   drawing a card. No border, no radius, no hard edge anywhere — it cannot be
   mistaken for a dialog because it has no boundary to see. */
body:is(.desktop-chat, .mobile-chat) .typing-indicator.show::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border: 0;
  border-radius: 0;
  background: radial-gradient(ellipse 64% 48% at 50% 47%,
    rgba(3, 9, 7, 0.8) 0%,
    rgba(3, 9, 7, 0.58) 40%,
    rgba(3, 9, 7, 0.24) 64%,
    rgba(3, 9, 7, 0) 82%);
  opacity: var(--think-live-opacity, 1);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  animation: nabgol-think-veil-in 0.5s ease both;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-leaving::before {
  opacity: 0 !important;
  transition: opacity 1.05s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ——— THE SPAN TRAP · read this before adding any <span> to the think stage ———
   style-common.css still ships the pre-2026 typing dots:

     .typing-indicator span { width: 8px; height: 8px; background: …; border-radius: 50% }

   It targets EVERY span inside the indicator. Measured consequence when the seal
   put its copy in spans: the motto rendered 8px wide and 8px tall — present in the
   DOM, gold, opacity 1, and completely invisible on screen (field report + measured
   2026-08-20). Blockification makes it worse: a span that is a flex item, or one we
   set to inline-block, starts honouring that width/height.

   So the legacy sizing is neutralised ONCE, here, before anything below re-declares
   what each span actually needs. Every rule after this point that wants a real size
   or animation on a span must say so with !important. Never narrow this selector to
   `span:not([class])` — that protects nothing, which is exactly how the bug shipped. */
body:is(.desktop-chat, .mobile-chat) .typing-indicator .nabgol-think-stage span:not([class^="nabgol-think-"]),
body:is(.desktop-chat, .mobile-chat) .typing-indicator.show .nabgol-think-stage span:not([class^="nabgol-think-"]) {
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  animation: none !important;
}
/* ↑ The `:not([class^="nabgol-think-"])` is not cosmetic — it is a bug fix.
   This neutraliser originally matched EVERY span in the stage, and at
   (0,4,2) it outranks the seal's own (0,4,1) rules. So its
   `animation: none !important` and `background: transparent !important`
   silently killed the motto's gleam sweep and its reveal wash for several
   releases: the effects were authored, shipped, and never once ran.

   Our own spans are therefore excluded here, and every one of them instead
   pins its own `width`/`height`/`background` against the legacy
   `.typing-indicator span { width: 8px }` rule (see THE SPAN TRAP). Anything
   new added under the `nabgol-think-` namespace MUST carry those pins — and
   test_think_seal_visual.js measures real painted geometry, so a missing pin
   fails the gate instead of shipping. */

/* —— Beat 1 · the living mark —— */

/* single source of truth for the mark size; the roots derive from it */

/* single source of truth for the mark size; the roots derive from it */

/* single source of truth for the mark size; the roots derive from it */

/* single source of truth for the mark size; the roots derive from it */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-stage { --think-mark: min(52vw, 214px); }

body:is(.desktop-chat, .mobile-chat) .nabgol-think-mark {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: var(--think-mark);
  height: var(--think-mark);
  margin: 0 auto;
  pointer-events: none !important;
  animation: nabgol-think-stage-in 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-aura {
  position: absolute;
  left: 50%;
  top: 50%;
  grid-area: 1 / 1;
  width: 152% !important;
  height: 120% !important;
  border-radius: 50% !important;
  filter: blur(26px);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-aura.is-a {
  background: radial-gradient(ellipse at 50% 50%,
    rgba(52, 211, 153, 0.34) 0%,
    rgba(16, 185, 129, 0.14) 44%,
    transparent 72%) !important;
  animation: nabgol-think-aura-a 5.6s ease-in-out infinite !important;
}

/* Kept as a faint gold undertone only — .is-a carries the halo everyone knows
   from the original mark; this must never compete with it or with the film. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-aura.is-b {
  background: radial-gradient(ellipse at 50% 50%,
    rgba(251, 191, 36, 0.11) 0%,
    rgba(245, 158, 11, 0.05) 40%,
    transparent 68%) !important;
  animation: nabgol-think-aura-b 7.4s ease-in-out infinite !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  grid-area: 1 / 1;
  width: 76% !important;
  height: 76% !important;
  border-radius: 50% !important;
  border: 1px solid rgba(110, 231, 183, 0.42) !important;
  background: transparent !important;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
  animation: nabgol-think-ring 3.6s cubic-bezier(0.16, 0.8, 0.3, 1) infinite !important;
}

/* One ring reads as "a thought just left the mark"; two read as a target
   sight. Second ring stays in the DOM (markup gate keeps checking for it) but
   is switched off here — `opacity: 0 !important` beats a running keyframe. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-ring.is-2 {
  opacity: 0 !important;
}



/* Legacy nodes from older builds — neutralised, never painted. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-halo,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-glow,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-wave,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-orb::before {
  display: none !important;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-think-orb,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-core {
  all: unset;
  display: contents;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-video {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center center;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0;
  margin: 0 auto;
  /* Prefer readable brand over blend tricks that vanish on dark panels */
  mix-blend-mode: normal;
  filter: drop-shadow(0 10px 30px rgba(52, 211, 153, 0.3)) !important;
  -webkit-filter: drop-shadow(0 10px 30px rgba(52, 211, 153, 0.3)) !important;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  pointer-events: none !important;
  transform-origin: center center;
  animation: nabgol-think-breathe 4.2s ease-in-out infinite;
  will-change: transform;
}

@supports (mix-blend-mode: plus-lighter) {
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-video.is-alpha {
    mix-blend-mode: plus-lighter;
    filter: drop-shadow(0 10px 30px rgba(52, 211, 153, 0.34)) !important;
  }
}

@media (min-width: 768px) {
  body.desktop-chat .nabgol-think-stage { --think-mark: 224px; }
  body.desktop-chat .nabgol-think-stage {
    width: min(92vw, 460px);
    max-width: 460px;
    padding: 8px 24px 14px;
  }
}

/* —— Beats 2 + 3 · the copy —— */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-meta,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-copy {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 2px;
  text-align: center;
  color: #e2e8f0;
  writing-mode: horizontal-tb;
  direction: rtl;
}

/* Beat 2 — the honest status line. Whisper weight: the motto is the focal point. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-title {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  padding: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  /* Persian is a joined script — letter-spacing here breaks the connections. */
  letter-spacing: 0 !important;
  line-height: 1.5 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  color: #a3b8b1 !important;
  background: transparent !important;
  border-radius: 0 !important;
  text-shadow: none !important;
  writing-mode: horizontal-tb !important;
  animation: nabgol-think-line-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-title.is-quiet {
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  color: #a3b8b1 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

/* Functional states (writing / stopped / timeout) put the title in front. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-meta:not(.is-brand-seal) .nabgol-think-title {
  font-size: 1.04rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.005em;
  color: #ecfdf5 !important;
}

/* A copy run must always measure as text, never as a legacy 8px dot. See THE
   SPAN TRAP above: width/height/background are pinned on purpose. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-title-text {
  display: inline !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  background: none !important;
  border-radius: 0 !important;
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  font: inherit;
  letter-spacing: inherit;
}

/* Stale cached script/markup can leave the status line as a bare text node with
   the dots span gone. The line must still read «در حال فکر کردن …», so a
   pseudo-element ellipsis stands in — pseudo-elements survive textContent. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-title:not(:has(.nabgol-think-dots))::after {
  content: " …";
  opacity: 0.7;
  letter-spacing: 0;
}

/* The animated ellipsis of «در حال فکر کردن …» — three dots, RTL rhythm. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-dots {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  flex: 0 0 auto;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-dots i {
  display: block;
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: linear-gradient(180deg, #a7f3d0, #34d399);
  box-shadow: 0 0 9px -1px rgba(52, 211, 153, 0.9);
  animation: nabgol-think-dot 1.4s ease-in-out infinite;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-think-dots i:nth-child(1) { animation-delay: 0s; }
body:is(.desktop-chat, .mobile-chat) .nabgol-think-dots i:nth-child(2) { animation-delay: 0.16s; }
body:is(.desktop-chat, .mobile-chat) .nabgol-think-dots i:nth-child(3) { animation-delay: 0.32s; }



/* ══════ THE MOTTO IS WRITTEN BY THE LIGHT ══════
   Asked for repeatedly and never actually delivered until now: the phrase is
   invisible at rest, becomes readable only while light crosses it, then fades
   back into the dark.

   Two stacked copies of the same sentence:
     · .nabgol-think-sub-text is the BASE. It keeps the real text, the real box
       and the real layout — machines and a text search still find it — but it
       is painted at a whisper, so at rest there is only a ghost.
     · .nabgol-think-sub-gleam is a duplicate laid exactly on top at full
       brightness, revealed through a MOVING MASK. Only the band under the mask
       window is visible, so the letters light up as the band passes and go dark
       behind it.

   Why a duplicate rather than animating the base's own colour: an earlier
   attempt animated -webkit-text-fill-color and lost, because an !important
   base declaration on that property outranks a running animation. Two elements
   sidestep the whole cascade fight.

   The sweep runs right-to-left, following the direction of the script. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text {
  position: relative;
  z-index: 1;
  /* the ghost: present, never quite readable */
  color: rgba(233, 207, 146, 0.13) !important;
  -webkit-text-fill-color: rgba(233, 207, 146, 0.13) !important;
  text-shadow: none !important;
}

/* The BASE copy's «اندیشه» has to be dim too. `.nabgol-think-key` carries an
   !important colour of its own, which beat the ghost above and left that one
   word permanently lit while everything around it breathed — the reveal looked
   dead because the eye locked onto the word that never changed. This selector
   is deeper, so it wins. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text .nabgol-think-key {
  color: rgba(240, 218, 160, 0.16) !important;
  -webkit-text-fill-color: rgba(240, 218, 160, 0.16) !important;
  text-shadow: none !important;
}



/* THE PERCENTAGE IS NOT WHAT IT LOOKS LIKE. For mask-position, p% resolves to
   (elementWidth - imageWidth) * p. The image here is 300% of the element, so
   that factor is NEGATIVE (-200%) and the offset runs backwards: bigger p moves
   the band LEFT, and values outside 0..100% overshoot wildly. A first attempt
   animated 150% -> -170% and the band spent the whole cycle off the element,
   which is why the motto never lit up.
   The bright core sits at 48% of the image, i.e. 1.44 element-widths in, so:
     core at the right edge  -> offset -0.44 -> p = 22%
     core at the left edge   -> offset -1.44 -> p = 72%
   14% and 80% put a little dark margin either side, so the phrase is unlit for
   most of the cycle and is then written right-to-left, the way it is read. */
@keyframes nabgol-think-motto-reveal {
  0%, 6% { -webkit-mask-position: 14% 0; mask-position: 14% 0; }
  76%, 100% { -webkit-mask-position: 80% 0; mask-position: 80% 0; }
}



/* ══════ THE MOTTO IS WRITTEN BY THE LIGHT ══════
   Asked for repeatedly and never actually delivered until now: the phrase is
   invisible at rest, becomes readable only while light crosses it, then fades
   back into the dark.

   Two stacked copies of the same sentence:
     · .nabgol-think-sub-text is the BASE. It keeps the real text, the real box
       and the real layout — machines and a text search still find it — but it
       is painted at a whisper, so at rest there is only a ghost.
     · .nabgol-think-sub-gleam is a duplicate laid exactly on top at full
       brightness, revealed through a MOVING MASK. Only the band under the mask
       window is visible, so the letters light up as the band passes and go dark
       behind it.

   Why a duplicate rather than animating the base's own colour: an earlier
   attempt animated -webkit-text-fill-color and lost, because an !important
   base declaration on that property outranks a running animation. Two elements
   sidestep the whole cascade fight.

   The sweep runs right-to-left, following the direction of the script. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text {
  position: relative;
  z-index: 1;
  /* the ghost: present, never quite readable */
  color: rgba(233, 207, 146, 0.13) !important;
  -webkit-text-fill-color: rgba(233, 207, 146, 0.13) !important;
  text-shadow: none !important;
}

/* The BASE copy's «اندیشه» has to be dim too. `.nabgol-think-key` carries an
   !important colour of its own, which beat the ghost above and left that one
   word permanently lit while everything around it breathed — the reveal looked
   dead because the eye locked onto the word that never changed. This selector
   is deeper, so it wins. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text .nabgol-think-key {
  color: rgba(240, 218, 160, 0.16) !important;
  -webkit-text-fill-color: rgba(240, 218, 160, 0.16) !important;
  text-shadow: none !important;
}



/* THE PERCENTAGE IS NOT WHAT IT LOOKS LIKE. For mask-position, p% resolves to
   (elementWidth - imageWidth) * p. The image here is 300% of the element, so
   that factor is NEGATIVE (-200%) and the offset runs backwards: bigger p moves
   the band LEFT, and values outside 0..100% overshoot wildly. A first attempt
   animated 150% -> -170% and the band spent the whole cycle off the element,
   which is why the motto never lit up.
   The bright core sits at 48% of the image, i.e. 1.44 element-widths in, so:
     core at the right edge  -> offset -0.44 -> p = 22%
     core at the left edge   -> offset -1.44 -> p = 72%
   14% and 80% put a little dark margin either side, so the phrase is unlit for
   most of the cycle and is then written right-to-left, the way it is read. */
@keyframes nabgol-think-motto-reveal {
  0%, 6% { -webkit-mask-position: 14% 0; mask-position: 14% 0; }
  76%, 100% { -webkit-mask-position: 80% 0; mask-position: 80% 0; }
}



/* ══════ THE MOTTO IS WRITTEN BY THE LIGHT ══════
   Asked for repeatedly and never actually delivered until now: the phrase is
   invisible at rest, becomes readable only while light crosses it, then fades
   back into the dark.

   Two stacked copies of the same sentence:
     · .nabgol-think-sub-text is the BASE. It keeps the real text, the real box
       and the real layout — machines and a text search still find it — but it
       is painted at a whisper, so at rest there is only a ghost.
     · .nabgol-think-sub-gleam is a duplicate laid exactly on top at full
       brightness, revealed through a MOVING MASK. Only the band under the mask
       window is visible, so the letters light up as the band passes and go dark
       behind it.

   Why a duplicate rather than animating the base's own colour: an earlier
   attempt animated -webkit-text-fill-color and lost, because an !important
   base declaration on that property outranks a running animation. Two elements
   sidestep the whole cascade fight.

   The sweep runs right-to-left, following the direction of the script. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text {
  position: relative;
  z-index: 1;
  /* the ghost: present, never quite readable */
  color: rgba(233, 207, 146, 0.13) !important;
  -webkit-text-fill-color: rgba(233, 207, 146, 0.13) !important;
  text-shadow: none !important;
}

/* The BASE copy's «اندیشه» has to be dim too. `.nabgol-think-key` carries an
   !important colour of its own, which beat the ghost above and left that one
   word permanently lit while everything around it breathed — the reveal looked
   dead because the eye locked onto the word that never changed. This selector
   is deeper, so it wins. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text .nabgol-think-key {
  color: rgba(240, 218, 160, 0.16) !important;
  -webkit-text-fill-color: rgba(240, 218, 160, 0.16) !important;
  text-shadow: none !important;
}



/* THE PERCENTAGE IS NOT WHAT IT LOOKS LIKE. For mask-position, p% resolves to
   (elementWidth - imageWidth) * p. The image here is 300% of the element, so
   that factor is NEGATIVE (-200%) and the offset runs backwards: bigger p moves
   the band LEFT, and values outside 0..100% overshoot wildly. A first attempt
   animated 150% -> -170% and the band spent the whole cycle off the element,
   which is why the motto never lit up.
   The bright core sits at 48% of the image, i.e. 1.44 element-widths in, so:
     core at the right edge  -> offset -0.44 -> p = 22%
     core at the left edge   -> offset -1.44 -> p = 72%
   14% and 80% put a little dark margin either side, so the phrase is unlit for
   most of the cycle and is then written right-to-left, the way it is read. */
@keyframes nabgol-think-motto-reveal {
  0%, 6% { -webkit-mask-position: 14% 0; mask-position: 14% 0; }
  76%, 100% { -webkit-mask-position: 80% 0; mask-position: 80% 0; }
}



/* ══════ THE ROOTS THAT REACH THE WORD ══════
   The plant's roots grow DOWN and reach «اندیشه». Three thick mains leave from
   nearest the centre of symmetry, go deepest and twine around the word, each
   throwing one branch; the outer tips carry only short surface roots, because
   in a real root system the side roots do not go deep. Signals then travel back
   UP the mains and branches, from the word into the plant.

   Geometry, all measured off the film rather than guessed:
     · the box is pinned to the MARK's width. Sizing it from the viewport once
       made it 384px against a 214px plant, so the outer roots began in empty
       space beside it.
     · y=0 of the viewBox sits just above the shallowest measured root tip and
       y=56 is the mark's bottom edge, so every root starts exactly where a real
       one ends — and leaves along that root's MEASURED growth direction, which
       is what makes it read as the same root continuing rather than a new
       angled thing. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-nerve {
  position: relative;
  /* BEHIND the film. The mains start at the crown and run down through the real
     root mass; drawn on top they looked like a separate thing laid over the
     plant. The film blends with plus-lighter, so where it is dark the roots
     show through unchanged and where its own roots are bright they simply add —
     which is what makes the two read as one system. */
  z-index: 0;
  display: block;
  width: var(--think-mark);
  height: calc(var(--think-mark) * 0.525);
  margin: calc(var(--think-mark) * -0.38) auto calc(var(--think-mark) * -0.11);
  overflow: visible;
  pointer-events: none !important;
}

/* A root is thick where it leaves the parent and thins to a point. A STROKE
   cannot taper, so each root is a filled outline and the bead rides a separate
   unpainted centreline. No `opacity` here: an earlier shared rule carried 0.6
   and silently dimmed every root by 40%. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-rail,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-rootlet {
  fill: url(#nabgolRootFill);
  stroke: none;
}

/* Surface roots: no signal rides these. They exist so the system reads as a
   root system instead of a comb. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-rootlet {
  opacity: 0.72;
}

/* THE SIGNAL, matched to the film by measurement (12 frames at 24fps):
   diameter 2.0-3.5 units, speed 67.6 units/s, about 9 lit at once. The old
   build set one flat duration for every root, so a short branch crawled at
   25 units/s while a long main raced at 96 — two visibly different signals.
   Each root now carries its own duration (length / 67.6) and its own dash
   period, both inline, so every bead everywhere moves at the film's rate.

   A near-zero dash with a round cap paints nothing but its own cap — a circle
   whose diameter is the stroke-width — so no streak can creep in at any speed.
   The REPEATING period is what gives several beads per root for nothing: no
   extra elements, which matters on an Android WebView. The glow is a second
   concentric stroke rather than filter: drop-shadow, measured as the most
   expensive thing in the seal.

   The 0.01 999 below is only a single-bead fallback; the real period arrives
   inline per root. It must divide 100 a whole number of times, because the
   animation slides the pattern by exactly 100 normalised units per cycle and
   any remainder shows up as a jump at the loop point. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sparkhalo,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-spark {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 0.01 999;
  stroke-dashoffset: 0;
  animation: nabgol-think-nerve-run 3s linear infinite backwards;
}

/* NOT named .nabgol-think-glow: that class is already force-hidden by the
   legacy-node neutraliser (display: none !important), which would have made
   every bead halo invisible the moment it shipped. The same trap cost a rename
   once before with .nabgol-think-halo. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sparkhalo {
  stroke: rgba(198, 214, 150, 0.17);
}

/* The film's bead colour, measured in the rendered frame: rgb(194,195,135) mean
   with peak luminance 208. The old #fcf0c2 peaked at 236 — brighter and warmer
   than the film, which is a large part of why the two read as different signals.
   Note green sits just ABOVE red here; a warm yellow core is wrong. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-spark {
  stroke: #ced296;
}

/* -100 -> 0 is bottom-to-top on these paths: the signal is born in the word and
   travels up into the plant. Reversing these two numbers reverses the story, so
   do not tidy the negative sign away. There is deliberately NO opacity here:
   with a repeating dash period the beads flow continuously, and a global fade
   would blink every bead on the same root in unison. */
@keyframes nabgol-think-nerve-run {
  from { stroke-dashoffset: -100; }
  to { stroke-dashoffset: 0; }
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator:not(.is-streaming) .nabgol-think-nerve {
  opacity: 0.3;
}
body:is(.desktop-chat, .mobile-chat) .typing-indicator:not(.is-streaming) .nabgol-think-sparkhalo,
body:is(.desktop-chat, .mobile-chat) .typing-indicator:not(.is-streaming) .nabgol-think-spark {
  animation-play-state: paused;
}

/* ══════ THE MOTTO IS WRITTEN BY THE LIGHT ══════
   Asked for repeatedly and never actually delivered until now: the phrase is
   invisible at rest, becomes readable only while light crosses it, then fades
   back into the dark.

   Two stacked copies of the same sentence:
     · .nabgol-think-sub-text is the BASE. It keeps the real text, the real box
       and the real layout — machines and a text search still find it — but it
       is painted at a whisper, so at rest there is only a ghost.
     · .nabgol-think-sub-gleam is a duplicate laid exactly on top at full
       brightness, revealed through a MOVING MASK. Only the band under the mask
       window is visible, so the letters light up as the band passes and go dark
       behind it.

   Why a duplicate rather than animating the base's own colour: an earlier
   attempt animated -webkit-text-fill-color and lost, because an !important
   base declaration on that property outranks a running animation. Two elements
   sidestep the whole cascade fight.

   The sweep runs right-to-left, following the direction of the script. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text {
  position: relative;
  z-index: 1;
  /* the ghost: present, never quite readable */
  color: rgba(233, 207, 146, 0.22) !important;
  -webkit-text-fill-color: rgba(233, 207, 146, 0.22) !important;
  text-shadow: none !important;
}

/* The BASE copy's «اندیشه» has to be dim too. `.nabgol-think-key` carries an
   !important colour of its own, which beat the ghost above and left that one
   word permanently lit while everything around it breathed — the reveal looked
   dead because the eye locked onto the word that never changed. This selector
   is deeper, so it wins. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text .nabgol-think-key {
  color: rgba(240, 218, 160, 0.26) !important;
  -webkit-text-fill-color: rgba(240, 218, 160, 0.26) !important;
  text-shadow: none !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub-gleam {
  /* This span used to be suppressed outright, and that is exactly why the
     reveal never appeared in any earlier build. NOTE: do not spell the
     suppressed-display declaration out in this comment — our own gate greps
     this rule body for it and would read the comment as the code. */
  position: absolute !important;
  inset: 0 !important;
  z-index: 2;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  pointer-events: none !important;
  /* inherit every metric from the paragraph so the two copies register exactly */
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  white-space: nowrap !important;
  text-align: inherit;
  color: #fdf3cf !important;
  -webkit-text-fill-color: #fdf3cf !important;
  text-shadow: 0 0 7px rgba(252, 240, 194, 0.5), 0 0 16px rgba(239, 210, 156, 0.28);

  /* The reveal window. Narrow bright core with long soft shoulders, so a letter
     brightens gradually instead of switching on. */
  -webkit-mask-image: linear-gradient(95deg,
    transparent 0%, transparent 18%,
    rgba(0, 0, 0, 0.4) 29%,
    #000 38%, #000 58%,
    rgba(0, 0, 0, 0.4) 67%,
    transparent 78%, transparent 100%);
  mask-image: linear-gradient(95deg,
    transparent 0%, transparent 18%,
    rgba(0, 0, 0, 0.4) 29%,
    #000 38%, #000 58%,
    rgba(0, 0, 0, 0.4) 67%,
    transparent 78%, transparent 100%);
  -webkit-mask-size: 300% 100%;
  mask-size: 300% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: nabgol-think-motto-reveal 7.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* THE PERCENTAGE IS NOT WHAT IT LOOKS LIKE. For mask-position, p% resolves to
   (elementWidth - imageWidth) * p. The image here is 300% of the element, so
   that factor is NEGATIVE (-200%) and the offset runs backwards: bigger p moves
   the band LEFT, and values outside 0..100% overshoot wildly. A first attempt
   animated 150% -> -170% and the band spent the whole cycle off the element,
   which is why the motto never lit up.
   The bright core sits at 48% of the image, i.e. 1.44 element-widths in, so:
     core at the right edge  -> offset -0.44 -> p = 22%
     core at the left edge   -> offset -1.44 -> p = 72%
   14% and 80% put a little dark margin either side, so the phrase is unlit for
   most of the cycle and is then written right-to-left, the way it is read. */
@keyframes nabgol-think-motto-reveal {
  0%, 6% { -webkit-mask-position: 14% 0; mask-position: 14% 0; }
  76%, 100% { -webkit-mask-position: 80% 0; mask-position: 80% 0; }
}

/* «اندیشه» in the bright copy is the film's own measured bead core, so the word
   the signals leave is made of the same light as the signals. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub-gleam .nabgol-think-key {
  color: #fcf0c2 !important;
  -webkit-text-fill-color: #fcf0c2 !important;
}

/* Paused or finished, nothing is being thought: stop writing the motto. */
body:is(.desktop-chat, .mobile-chat) .typing-indicator:not(.is-streaming) .nabgol-think-sub-gleam {
  animation-play-state: paused;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  font-style: normal !important;
  opacity: 1 !important;
  line-height: 1.65 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip;
  letter-spacing: 0;
  color: #93a5b8 !important;
  background: transparent !important;
  text-shadow: none !important;
  animation: none !important;
}

/* ══════ ROLLBACK (2026-08-22) ══════
   The masked-artwork motto (alpha-mask wordmark + knotted strand network) that
   lived here shipped broken: the supplied artwork's «اندیشه» glyph is an
   unreadable blot at any size (verified by direct pixel inspection, not an
   opinion), the strand network read as disconnected decoration, and the
   "light travelling through the letters" effect had no visible signal in it.
   Rather than patch a design already rejected, this restores the last state
   proven acceptable before that artwork was introduced — v866, commit
   538d83d: quiet gold motto text, «اندیشه» bigger and coloured like its own
   signals, invisible-rail root pulses. The masked-artwork CSS/markup/asset
   stay in git history (commit d900157) if that direction is ever revisited
   properly instead of live. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand {
  position: relative;
  display: inline-block !important;
  box-sizing: border-box;
  width: max-content !important;
  max-width: calc(100% - 6px) !important;
  margin: 1px auto 0 !important;
  padding: 2px 10px 4px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #fcd34d !important;
  /* Smaller than the earlier draft — this is a signature line under the mark,
     not a headline. Life comes from motion (breathe), not from size. */
  font-size: clamp(0.86rem, 3.3vw, 1.02rem) !important;
  font-weight: 700 !important;
  font-style: normal !important;
  /* Persian is a joined script: any letter-spacing breaks the connections. */
  letter-spacing: 0 !important;
  line-height: 1.55 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-align: center;
  text-shadow: none !important;
  transform-origin: center center;
  animation:
    nabgol-think-motto-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.36s both,
    nabgol-think-motto-breathe 3.2s ease-in-out 1.1s infinite !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 128%;
  height: 190%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(251, 191, 36, 0.2) 0%,
    rgba(245, 158, 11, 0.08) 45%,
    transparent 74%);
  filter: blur(14px);
  pointer-events: none;
  animation: nabgol-think-motto-glow 6.4s cubic-bezier(0.4, 0, 0.55, 1) 1.2s infinite;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand::after {
  content: none !important;
  display: none !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-key {
  display: inline !important;
  font-size: 1.42em !important;
  font-weight: 800 !important;
  font-style: normal !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
  /* The bead core colour, measured off the film (#fcf0c2) — «اندیشه» is made
     of the same light as the signals so the kinship reads as cause, not
     coincidence. */
  color: #fcf0c2 !important;
  -webkit-text-fill-color: #fcf0c2 !important;
  background: none !important;
  vertical-align: -0.04em;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub-text {
  position: relative;
  z-index: 1;
  display: inline !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  border-radius: 0 !important;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  white-space: nowrap !important;
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  background: none !important;
  text-shadow: none !important;
  animation: none !important;
}





@keyframes nabgol-think-motto-in {
  from { transform: translateY(5px); }
  to { transform: translateY(0); }
}

@keyframes nabgol-think-motto-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

@keyframes nabgol-think-motto-glow {
  0%, 100% { opacity: 0.16; transform: translate(-50%, -50%) scale(0.88, 1); }
  38% { opacity: 0.46; transform: translate(-50%, -50%) scale(1.04, 1); }
}



body:is(.desktop-chat, .mobile-chat) .nabgol-gen-ico {
  display: inline-flex !important;
  width: 14px !important;
  height: 14px !important;
  line-height: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  animation: none !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-label {
  display: inline !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  font-style: normal !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: 1.2 !important;
  color: inherit !important;
  background: transparent !important;
  border-radius: 0 !important;
  animation: none !important;
}

/* Honesty: the pulse belongs to work in flight only. Paused or finished, the
   dots and the thought rings stop — a still frame never claims to be thinking. */
body:is(.desktop-chat, .mobile-chat) .typing-indicator .nabgol-think-dots {
  display: none !important;
}
body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-streaming .nabgol-think-dots {
  display: inline-flex !important;
}
body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-resume .nabgol-think-dots,
body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-resume .nabgol-think-ring {
  display: none !important;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-think-actions {
  display: none !important; /* stop/resume on composer only — think never steals taps */
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-btn {
  appearance: none;
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  min-width: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-btn:hover {
  transform: translateY(-1px);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-btn:active {
  transform: translateY(0);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-btn.is-stop {
  color: #fff5f5;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.28), rgba(127, 29, 29, 0.38));
  border-color: rgba(252, 165, 165, 0.55);
  backdrop-filter: blur(12px);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.12),
    0 8px 24px rgba(185, 28, 28, 0.28);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-btn.is-stop:hover {
  color: #fff;
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.42), rgba(185, 28, 28, 0.5));
  border-color: rgba(254, 202, 202, 0.7);
  box-shadow:
    0 0 0 4px rgba(239, 68, 68, 0.14),
    0 10px 28px rgba(185, 28, 28, 0.35);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-btn.is-resume {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.42);
  backdrop-filter: blur(10px);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-btn.is-resume:hover {
  background: rgba(16, 185, 129, 0.26);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-resume .nabgol-think-video {
  opacity: 0.55;
  animation: none;
  filter: none !important;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-streaming .nabgol-gen-btn.is-resume,
body:is(.desktop-chat, .mobile-chat) .typing-indicator:not(.is-resume) .nabgol-gen-btn.is-resume {
  display: none !important;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-resume .nabgol-gen-btn.is-stop {
  display: none !important;
}

body:is(.desktop-chat, .mobile-chat) .typing-indicator.is-resume .nabgol-gen-btn.is-resume {
  display: inline-flex !important;
}

body:is(.desktop-chat, .mobile-chat) .message.is-gen-stopped .message-bubble {
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(248, 113, 113, 0.22);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.22);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #fecaca;
  font-size: 0.8rem;
}

body:is(.desktop-chat, .mobile-chat) .nabgol-gen-chip-resume {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: #064e3b;
  background: linear-gradient(135deg, #6ee7b7, #34d399);
}

body:is(.desktop-chat, .mobile-chat) .send-btn.is-gen-stop {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35) !important;
}
body:is(.desktop-chat, .mobile-chat) .send-btn.is-gen-stop .nabgol-stop-ico,
body:is(.desktop-chat, .mobile-chat) .send-btn.is-gen-stop .ico {
  width: 18px !important;
  height: 18px !important;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-choice.is-spent-pack,
body:is(.desktop-chat, .mobile-chat) .nabgol-component.is-spent-pack {
  opacity: 0.55;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-choice-button.is-spent,
body:is(.desktop-chat, .mobile-chat) .nabgol-choice-button:disabled {
  cursor: default;
  pointer-events: none;
}

body:is(.desktop-chat, .mobile-chat) .send-btn.is-gen-resume {
  background: linear-gradient(135deg, #34d399, #059669) !important;
}

@media (max-width: 520px) {
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-stage {
    padding: 4px 8px 8px;
    gap: 2px;
  }
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-stage { --think-mark: min(50vw, 170px); }
  body:is(.desktop-chat, .mobile-chat) .typing-indicator.show {
    min-height: 148px !important;
  }
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-title {
    font-size: 0.82rem !important;
    letter-spacing: 0.04em;
  }


}

/* Tutor free-intro notice — quiet, no dashed “sticker” look */
#emptyState .nabgol-free-intro-note,
.chat-messages .empty .nabgol-free-intro-note {
  margin: 12px auto 2px;
  max-width: 22rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: center;
  opacity: 0.92;
}

body.nabgol-chat-has-messages #starterChips,
body.nabgol-chat-has-messages #emptyState #starterChips,
#starterChips[hidden],
#emptyState #starterChips[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Forever V2: when chips are the empty-state entry, they must be tappable. */
#emptyState:not([hidden]) #starterChips:not([hidden]),
#emptyState:not([hidden]) #starterChips:not([hidden]) button,
#emptyState:not([hidden]) #starterChips:not([hidden]) .suggestion-chip,
.chat-messages > .empty:not([hidden]) #starterChips:not([hidden]),
.chat-messages > .empty:not([hidden]) #starterChips:not([hidden]) button {
  pointer-events: auto !important;
  visibility: visible !important;
}

/* —— Flagship empty-state starter chips ——
   Tutor studio: calm single column, dark-native rows, one emerald hero.
   Non-tutor flagship keeps a compact quiet stack. */
body:is(.desktop-chat, .mobile-chat) #starterChips.suggestion-chips--flagship,
body:is(.desktop-chat, .mobile-chat) .suggestion-chips.suggestion-chips--flagship {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: min(100%, 22.5rem) !important;
  max-width: 100% !important;
  margin: 1.25rem auto 0 !important;
  padding: 0 2px !important;
  box-sizing: border-box !important;
}

/* Colour comes from --nab-chip-* (chat-action-buttons.css), which flips on
   html[data-theme]. There used to be a second `body:not(.dark-mode)` block here
   for the day palette; nothing in live/ ever sets .dark-mode, so the negation
   always matched and the day palette also painted at night. */
body:is(.desktop-chat, .mobile-chat) #starterChips .starter-chips__paths {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
  padding: 10px;
  border-radius: 1.15rem;
  border: 1px solid var(--nab-chip-panel-edge);
  background: var(--nab-chip-panel-face);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body:is(.desktop-chat, .mobile-chat) #starterChips .starter-chips__eyebrow {
  margin: 0 2px 10px;
  padding: 0 2px;
  color: var(--nab-chip-eyebrow);
  font-size: 0.875rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  text-align: center;
  line-height: 1.4;
  opacity: 1;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power),
body:is(.desktop-chat, .mobile-chat) .suggestion-chips--flagship .suggestion-chip:not(.suggestion-chip--live-power) {
  position: relative;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.7rem !important;
  width: 100% !important;
  min-height: var(--nab-chip-min) !important;
  padding: 0.75rem 0.9rem !important;
  margin: 0 !important;
  border-radius: var(--nab-chip-radius) !important;
  border: 1px solid var(--nab-chip-edge) !important;
  background: linear-gradient(
    180deg,
    var(--nab-chip-face-1) 0%,
    var(--nab-chip-face-2) 45%,
    var(--nab-chip-face-3) 100%) !important;
  color: var(--nab-chip-ink) !important;
  font-size: 0.92rem !important;
  font-weight: 650 !important;
  line-height: 1.35 !important;
  letter-spacing: -0.01em !important;
  text-align: right !important;
  white-space: normal !important;
  box-shadow:
    inset 0 1px 0 var(--nab-chip-ring),
    var(--nab-chip-lift) !important;
  transition:
    transform 0.22s var(--nab-btn-spring),
    border-color 0.2s var(--nab-btn-ease),
    background 0.2s var(--nab-btn-ease),
    box-shadow 0.24s var(--nab-btn-ease),
    color 0.18s var(--nab-btn-ease) !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
  direction: rtl;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip__lead {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.55rem;
  background: var(--nab-chip-lead-face);
  color: var(--nab-chip-lead-ink);
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip__ico {
  display: block;
  color: inherit;
  stroke: currentColor;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power):hover,
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power):focus-visible,
body:is(.desktop-chat, .mobile-chat) .suggestion-chips--flagship .suggestion-chip:not(.suggestion-chip--live-power):hover,
body:is(.desktop-chat, .mobile-chat) .suggestion-chips--flagship .suggestion-chip:not(.suggestion-chip--live-power):focus-visible {
  border-color: var(--nab-chip-edge-hover) !important;
  color: var(--nab-chip-ink-hover) !important;
  box-shadow:
    inset 0 1px 0 var(--nab-chip-ring),
    var(--nab-chip-lift-hover) !important;
  transform: translateY(-2px);
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power):hover .suggestion-chip__lead,
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power):focus-visible .suggestion-chip__lead {
  background: var(--nab-chip-lead-face);
  color: var(--nab-chip-lead-ink);
}

/* press — the same squash-and-spring as an in-chat option */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power):active {
  transform: translateY(1px) scale(0.975);
  transition-duration: 0.06s !important;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip__label,
body:is(.desktop-chat, .mobile-chat) #starterChips .live-power-label {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  color: inherit;
  text-align: right;
}

/* Live + attach: label must NOT flex-grow, or center group breaks */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--live-power .live-power-label,
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--live-power .suggestion-chip__label,
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--attach .suggestion-chip__label {
  flex: 0 1 auto !important;
  width: auto !important;
  text-align: center !important;
}

/* Live stays on original power look — same outer size as attach; center dot+label */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--live-power.suggestion-chip--hero {
  width: 100% !important;
  max-width: 100% !important;
  align-self: stretch !important;
  box-sizing: border-box !important;
  min-height: 44px !important;
  height: auto !important;
  padding: 0.55rem 1.1rem !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0.45rem !important;
}

/* Teach — the primary path, so it wears the accent (--nab-btn-win-*): the same
   fill in both themes, exactly like a chosen option in the chat.
   The old recipe was #ecfdf5 on a #10b981 top stop — measured 2.47:1, i.e. under
   AA. Dark ink on the emerald is the fix the in-chat buttons already use. */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip[data-kind="teach"] {
  min-height: 3.15rem !important;
  padding: 0.8rem 0.9rem !important;
  border: 1px solid var(--nab-chip-hero-edge) !important;
  background: linear-gradient(180deg, var(--nab-chip-hero-1) 0%, var(--nab-chip-hero-2) 100%) !important;
  color: var(--nab-chip-hero-ink) !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 22px rgba(5, 150, 105, 0.26) !important;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip[data-kind="teach"] .suggestion-chip__lead {
  background: var(--nab-chip-hero-lead-face) !important;
  color: var(--nab-chip-hero-ink) !important;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip[data-kind="teach"]:hover,
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip[data-kind="teach"]:focus-visible {
  border-color: var(--nab-chip-hero-edge-hover) !important;
  color: var(--nab-chip-hero-ink) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 0 0 3px var(--nab-chip-hero-ring),
    0 14px 32px rgba(5, 150, 105, 0.36) !important;
}

/* Attach pill size + centered icon+text */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship.suggestion-chip--attach {
  min-height: 44px !important;
  height: auto !important;
  padding: 0.55rem 1.1rem !important;
  border-radius: 999px !important;
  justify-content: center !important;
  gap: 0.45rem !important;
  font-weight: 650 !important;
}

/* Its glyph is inline, not a badge — so it takes the chip ink and is AA by
   construction. Same rule as the studio embed, so both cascades agree. */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--attach .suggestion-chip__lead {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: transparent !important;
  color: inherit !important;
  flex: 0 0 auto !important;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--mode {
  min-height: 2.85rem !important;
  padding: 0.7rem 0.8rem !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
}

/* Slate volume — the neutral family (modes + the photo pill). One rule, both
   themes: --nab-chip-face-* carries the palette.

   Deleted with this change: five `body:not(.dark-mode)` day blocks and two
   `body.dark-mode / html.dark` night blocks that used to fight over these same
   chips. Neither class is ever set in live/ (the theme is html[data-theme]), so
   the day blocks won unconditionally — a white card at night on desktop — while
   the night blocks only ever reached the phone through their `body.mobile-chat`
   arm. That is exactly the defect this rewrite removes.

   The old night recipe also failed AA: #f8fafc on the #94a3b8 top stop measured
   2.46:1. Ordering the gradient light→dark per theme keeps the ink safe in both
   (worst measured 7.06:1 day, 9.9:1 night). */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship.suggestion-chip--attach,
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship.suggestion-chip--mode:not([data-kind="teach"]) {
  border: 1px solid var(--nab-chip-edge) !important;
  background: linear-gradient(
    180deg,
    var(--nab-chip-face-1) 0%,
    var(--nab-chip-face-2) 45%,
    var(--nab-chip-face-3) 100%) !important;
  color: var(--nab-chip-ink) !important;
  box-shadow:
    inset 0 1px 0 var(--nab-chip-ring),
    var(--nab-chip-lift) !important;
}

/* Forever W2: the label never renders near-black on a dark chip — it inherits
   the chip ink, which is now token-driven and therefore always on the right
   side of the surface. (Was a hard-coded #f8fafc keyed on the dead .dark-mode.) */
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip__label {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  opacity: 1 !important;
  visibility: visible !important;
}

@media (min-width: 900px) {
  body.desktop-chat #starterChips.suggestion-chips--flagship {
    width: min(100%, 24rem) !important;
    gap: 12px !important;
  }
  body.desktop-chat #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power) {
    min-height: 3.1rem !important;
    font-size: 0.95rem !important;
  }
  body.desktop-chat #starterChips .suggestion-chip--live-power.suggestion-chip--hero {
    /* original live-power sizing wins */
  }
  body.desktop-chat #starterChips .suggestion-chip[data-kind="teach"] {
    min-height: 3.25rem !important;
    font-size: 0.98rem !important;
  }
}

@media (max-width: 420px) {
  body.mobile-chat #starterChips.suggestion-chips--flagship {
    width: min(100%, 20.5rem) !important;
  }
  body.mobile-chat #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power) {
    min-height: 2.9rem !important;
    font-size: 0.88rem !important;
    padding: 0.7rem 0.8rem !important;
  }
  body.mobile-chat #starterChips .suggestion-chip--mode {
    font-size: 0.86rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship {
    transition: none !important;
  }
  body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--flagship:hover {
    transform: none !important;
  }
  /* Forever E9 · think under reduced-motion: the film, the aura drift, the rings,
     the dot pulse and the gleam all stop. Both copy lines stay fully readable —
     accessibility never costs the user the status or the motto. */
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-video {
    display: none !important;
    animation: none !important;
  }
  /* Drive the SIZE through the var, not through the mark's own width. The nerve
     derives its box from --think-mark too, so hardcoding the mark here would
     leave a 214px-wide conduit under a 108px plant. */
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-stage { --think-mark: 108px; }
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-mark {
    animation: none !important;
  }
  /* The rails stay: they are part of the picture, not motion. Only the
     travelling light stops. */
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-sparkhalo,
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-spark,
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub-gleam {
    display: none !important;
  }
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-aura {
    animation: none !important;
    opacity: 0.4 !important;
  }
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-ring,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-halo,
body:is(.desktop-chat, .mobile-chat) .nabgol-think-wave {
    display: none !important;
  }


  body:is(.desktop-chat, .mobile-chat) .nabgol-think-dots i {
    animation: none !important;
    opacity: 0.7 !important;
    transform: none !important;
  }
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-title,
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand,
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand::before,
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub-text {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    clip-path: none !important;
  }
  /* The motto is plain text again and is always readable, so this block only
     has to cancel the breathing and pin the colour. It used to compensate for
     a masked-artwork reveal that kept the words near-invisible until a signal
     crossed them; that mechanism is gone. */
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub-text,
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-sub.is-brand .nabgol-think-sub-text {
    background-image: none !important;
    animation: none !important;
    -webkit-text-fill-color: #fcd34d !important;
    color: #fcd34d !important;
  }
  body:is(.desktop-chat, .mobile-chat) .nabgol-think-static {
    display: flex !important;
  }
}

/* Forever E9: static think fallback (hidden unless reduced-motion).
   It paints the real brand mark — the film's own first frame — not a generic
   green ball. Reduced motion must never downgrade the brand, only the motion.
   The «…» glyph inside stays in the DOM for ancient engines but is not drawn. */
body:is(.desktop-chat, .mobile-chat) .nabgol-think-static {
  display: none;
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  align-items: center;
  justify-content: center;
  background: url("/assets/media/nabgol-thinking-poster.webp?v=1") center center / contain no-repeat;
  filter: drop-shadow(0 10px 30px rgba(52, 211, 153, 0.3));
  color: transparent;
  font-size: 0;
  line-height: 0;
  letter-spacing: 0;
}

/* Live tutor power chip — only data-action=live_tutor_pdf */
body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.55rem 1.15rem 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #ecfdf5;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  background:
    radial-gradient(120% 180% at 10% 20%, rgba(110, 231, 183, 0.35), transparent 55%),
    linear-gradient(135deg, #065f46 0%, #047857 42%, #0f766e 100%);
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.25),
    0 8px 28px rgba(16, 185, 129, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  overflow: hidden;
  isolation: isolate;
  animation: nabgol-live-power-breathe 2.4s ease-in-out infinite;
  transform: translateZ(0);
}

body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power:hover,
body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power:focus-visible {
  border-color: rgba(167, 243, 208, 0.85);
  color: #fff;
  background:
    radial-gradient(120% 180% at 15% 15%, rgba(167, 243, 208, 0.45), transparent 50%),
    linear-gradient(135deg, #047857 0%, #059669 45%, #14b8a6 100%);
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.45),
    0 10px 34px rgba(16, 185, 129, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power .live-power-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #6ee7b7;
  box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.75);
  animation: nabgol-live-power-pulse 1.6s ease-out infinite;
  flex-shrink: 0;
}

body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power .live-power-ring {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from 180deg,
    transparent 0deg,
    rgba(167, 243, 208, 0.55) 70deg,
    transparent 140deg,
    rgba(45, 212, 191, 0.4) 220deg,
    transparent 300deg
  );
  opacity: 0.55;
  animation: nabgol-live-power-spin 4.5s linear infinite;
  z-index: -1;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 2px;
}

body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power .live-power-label {
  position: relative;
  z-index: 1;
}

@keyframes nabgol-live-power-pulse {
  0% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(110, 231, 183, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0); }
}

@keyframes nabgol-live-power-breathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

@keyframes nabgol-live-power-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power,
  body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power .live-power-dot,
  body:is(.desktop-chat, .mobile-chat) .suggestion-chip--live-power .live-power-ring {
    /* pulse kept */
  }
}

/* Photo-homework chip outside #starterChips — practical, not competing with Live
   power. One token-driven rule; the old pair forked on the dead .dark-mode/.dark
   classes, so the day branch painted a pale blue card at night too. */
body:is(.desktop-chat, .mobile-chat) .suggestion-chip--attach {
  border-color: var(--nab-chip-edge);
  background: linear-gradient(180deg, var(--nab-chip-face-1) 0%, var(--nab-chip-face-3) 100%);
  color: var(--nab-chip-ink);
  font-weight: 650;
}

/* Mid-chat Live tutor CTA — same power effect as empty-state chip */
body:is(.desktop-chat, .mobile-chat) .nabgol-live-tutor-cta.suggestion-chip--live-power,
body:is(.desktop-chat, .mobile-chat) .nabgol-action-button-cta.nabgol-live-tutor-cta.suggestion-chip--live-power,
body:is(.desktop-chat, .mobile-chat) .nabgol-confirmation .nabgol-live-tutor-cta.suggestion-chip--live-power {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.55rem 1.15rem 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #ecfdf5 !important;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  background:
    radial-gradient(120% 180% at 10% 20%, rgba(110, 231, 183, 0.35), transparent 55%),
    linear-gradient(135deg, #065f46 0%, #047857 42%, #0f766e 100%);
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.25),
    0 8px 28px rgba(16, 185, 129, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  overflow: hidden;
  isolation: isolate;
  animation: nabgol-live-power-breathe 2.4s ease-in-out infinite;
  transform: translateZ(0);
}

body:is(.desktop-chat, .mobile-chat) .nabgol-live-tutor-cta,
body:is(.desktop-chat, .mobile-chat) .nabgol-action-button-cta.nabgol-live-tutor-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.55rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.55);
  background: linear-gradient(145deg, #047857, #0f766e);
  color: #ecfdf5 !important;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(6, 78, 59, 0.28);
}

body:is(.desktop-chat, .mobile-chat) .live-call-btn--tutor {
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35);
}


/* —— Stream-in-progress: under partial assistant reply (replaces confusing think overlay) —— */
@keyframes nabgol-stream-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@keyframes nabgol-stream-sheen {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0.45rem 0.15rem 0.15rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background:
    linear-gradient(105deg, rgba(6, 78, 59, 0.22), rgba(15, 118, 110, 0.14) 45%, rgba(6, 78, 59, 0.22));
  background-size: 200% 100%;
  animation: nabgol-stream-sheen 2.8s ease-in-out infinite;
  color: #d1fae5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  direction: rtl;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress__pulse {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.35rem;
  flex: 0 0 auto;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress__pulse i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  display: block;
  animation: nabgol-stream-dot 1.1s ease-in-out infinite;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress__pulse i:nth-child(2) { animation-delay: 0.15s; }
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress__pulse i:nth-child(3) { animation-delay: 0.3s; }
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress__copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress__copy strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ecfdf5;
  letter-spacing: -0.01em;
}
body:is(.desktop-chat, .mobile-chat) .nabgol-stream-progress__copy span {
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(209, 250, 229, 0.82);
}
body:is(.desktop-chat, .mobile-chat) .message.is-streaming-reply .message-bubble {
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(52, 211, 153, 0.18);
}


/* tutor-honesty-hero-v786 */
/* Forever U3: chips inside empty welcome must stay clickable (never inherit a dead overlay). */
#emptyState:not([hidden]) #starterChips:not([hidden]),
#emptyState:not([hidden]) #starterChips:not([hidden]) button,
#emptyState:not([hidden]) #starterChips:not([hidden]) .suggestion-chip,
.chat-messages > .empty:not([hidden]) #starterChips:not([hidden]),
.chat-messages > .empty:not([hidden]) #starterChips:not([hidden]) button {
  pointer-events: auto !important;
}

body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--mission-hero,
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip--mission-more {
  min-height: 44px !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.4rem !important;
}
body:is(.desktop-chat, .mobile-chat) #starterChips .suggestion-chip__hint {
  display: block;
  font-size: 0.72rem;
  opacity: 0.92;
  font-weight: 500;
}
/* «کمک بیشتر» — same panel tokens as the paths group, so it is not a dark slab
   sitting in a day-theme empty state (it was a hard-coded rgba(15,23,42,.28)). */
body:is(.desktop-chat, .mobile-chat) #starterChips .starter-chips__more {
  width: 100%;
  margin-top: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--nab-chip-panel-edge);
  padding: 0.35rem 0.55rem 0.55rem;
  background: var(--nab-chip-panel-face);
}
body:is(.desktop-chat, .mobile-chat) #starterChips .starter-chips__more > summary {
  cursor: pointer;
  list-style: none;
  color: var(--nab-chip-ink);
  font-size: 0.86rem;
  opacity: 0.9;
  padding: 0.35rem 0.15rem;
}
body:is(.desktop-chat, .mobile-chat) #starterChips .starter-chips__more-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0.35rem;
}
#input.nabgol-composer-check-locked {
  opacity: 0.72;
  cursor: not-allowed;
}

/* Wave 3: tutor default composer = mic + more; advanced tools behind panel */
body.tutor-composer-simple .composer-more-panel[hidden] {
  display: none !important;
}
body.tutor-composer-simple .composer-more-panel:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
body.tutor-composer-simple .composer-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
body.tutor-composer-simple .composer-more-label {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
}
@media (max-width: 520px) {
  body.tutor-composer-simple .composer-more-label { display: none; }
}

/* —— S1 Entry purity: hide idle TTS dock, not key composer tools ——
   File / camera / send stay visible. Mission never occupies this bar.
   The header's theme + read-aloud pair is NOT in this list any more
   (2026-09-27): the owner's rule is «every header control, always», and in
   the installed app (no browser chrome) a tutor opened on its welcome screen
   had no way to reach either — measured by the owner on his phone. */
body.tutor-composer-simple:not(.nabgol-chat-has-messages):not(.nabgol-entry-settled) .composer-more-btn,
body.tutor-composer-simple:not(.nabgol-chat-has-messages):not(.nabgol-entry-settled) .composer-more-panel,
body.tutor-composer-simple:not(.nabgol-chat-has-messages):not(.nabgol-entry-settled) #ttsPlayer:not(.show),
body.tutor-composer-simple:not(.nabgol-chat-has-messages):not(.nabgol-entry-settled) .composer-ai-disclaimer {
  display: none !important;
}

/* —— S2 Tutor identity: subject hue ring + monogram —— */
body.tutor-composer-simple {
  --tutor-identity-hue: 168;
  --tutor-identity: hsl(var(--tutor-identity-hue) 55% 42%);
  --tutor-identity-soft: hsl(var(--tutor-identity-hue) 40% 18% / 0.55);
}
body.tutor-composer-simple .chat-header .avatar:not(.has-img),
body.tutor-composer-simple .brand-avatar:not(.has-img) {
  background: linear-gradient(145deg, var(--tutor-identity), hsl(var(--tutor-identity-hue) 45% 28%));
  color: #f4fffa;
  font-weight: 800;
  box-shadow: 0 0 0 2px hsl(var(--tutor-identity-hue) 60% 55% / 0.55);
}
body.tutor-composer-simple .chat-header .avatar.has-img,
body.tutor-composer-simple .brand-avatar.has-img {
  box-shadow: 0 0 0 2px hsl(var(--tutor-identity-hue) 55% 50% / 0.5);
}
body.tutor-composer-simple #starterChips .starter-chips__paths {
  border-color: hsl(var(--tutor-identity-hue) 35% 45% / 0.35);
}
body.tutor-composer-simple #starterChips .suggestion-chip--flagship:not(.suggestion-chip--live-power):focus-visible {
  outline: 2px solid hsl(var(--tutor-identity-hue) 70% 48%);
  outline-offset: 2px;
}

/* Mermaid flowchart pilot — ISO shapes must stay visible (htmlLabels + classDef) */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  background: transparent !important;
}
/* Dense diagrams keep 16px type and pan sideways instead of shrinking below the
   floor (see enforceOnScreenFloor). Only these two rules may win over the
   width/max-width above, and only for a canvas the renderer explicitly marked. */
/* The card's own 0.85em padding + 1px border eats 30px of the 316px text column, so
   an SVG is painted at 285.5px and its 16px type lands at 14.5px on screen — under
   the floor this design system is built on. Invisible until the audit was changed to
   measure the real rendered width instead of assuming the token.
   Only the Mermaid flowchart canvas reclaims that width: its layout already centres
   the drawing inside generous whitespace, so spanning the column costs nothing
   visually and makes viewBox 316 map 1:1. Card kinds (bars/venn/timeline…) are
   deliberately NOT included — they paint tracks and circles right out to their
   viewBox edge, and a screenshot of `bars` with this rule showed the bars welded to
   the card border. Their 14.5px shortfall needs the renderer-side fix logged in
   docs/CHAT_DIAGRAMS_PLAN.md, not this. */
/* `tree` was removed from this list on 2026-08-20. A tree is the one kind here whose
   drawing really does reach its own viewBox edge — the legacy renderer runs the spine
   and its connector stubs out to the frame, and a Mermaid mindmap pushes its outermost
   pills right to the boundary. Reclaiming the card's padding therefore did not buy a
   1:1 map, it painted the diagram straight over the card's rounded border and off the
   bubble (measured: canvas 357px inside a 330px shell, so 13px hanging past the border
   on each side — the "tree bleeds out of its card" half of the user's report). */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram-flowchart .nabgol-diagram-canvas,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) figure.nabgol-diagram-sequence .nabgol-diagram-canvas {
  margin-inline: calc(-0.85em - 1px);
  width: calc(100% + 1.7em + 2px);
  max-width: none;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-canvas.nabgol-diagram-scroll-x {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  /* Without an edge cue a diagram wider than the bubble just looks chopped off.
     Faded on BOTH sides: the scroll position is centred (see enforceOnScreenFloor),
     so content can be hidden on either edge depending on the layout, not only the
     one this was first written for. Reads as "there is more, pan to see it" on
     whichever side actually has it. */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  scrollbar-width: thin;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-canvas.nabgol-diagram-scroll-x::-webkit-scrollbar {
  height: 6px;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-canvas.nabgol-diagram-scroll-x::-webkit-scrollbar-thumb {
  background: var(--nbgd-em-edge-45);
  border-radius: 3px;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-diagram-canvas.nabgol-diagram-scroll-x .nabgol-mermaid-svg[data-diag-scroll] {
  width: auto !important;
  max-width: none !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .node rect,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .node polygon,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .node circle,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .node ellipse,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .node path {
  stroke-width: 2.2px !important;
}
/* Text was clipped («دریافت عد») because these !important font rules changed the label
   size AFTER Mermaid had already measured the box with its own font — so the text grew
   past the fixed foreignObject width. Do NOT set font-size/weight/family here; Mermaid's
   init fontSize is the single source of truth so measured box == painted text. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .nodeLabel,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .edgeLabel,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg foreignObject,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg foreignObject div,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg foreignObject span {
  color: var(--nbgd-on-dark) !important;
  text-align: center !important;
  direction: rtl !important;
  unicode-bidi: isolate;
  overflow: visible !important;
}
/* The rule above only ever reached foreignObject labels. Since htmlLabels:false the
   labels are real SVG <text>, whose base direction stayed LTR — so a Persian
   sentence carrying a Latin identifier reordered into nonsense on screen
   (27 Mordad: «آیا i > جذر n است؟» painted as «آیا i ›جذر nاست؟»).
   `plaintext` picks each line's direction from its own first strong character, so
   «آیا باقیمانده…» goes RTL while a pure formula line like «i = ۲» stays LTR —
   one rule, both cases, no per-label tagging. Direction never changes measured
   width, so this cannot re-break the clipping the comment above guards. */
/* Scoped to .node/.edgeLabel only covered the flowchart engine. Sequence
   (.actor / .messageText / .loopText / .noteText) and mindmap (.mindmap-node)
   render real SVG <text> too and never got this rule — verified by measuring
   direction:ltr on both live in the browser (18 Aug). Every current fixture
   happens to be pure Persian so it never showed, but any Latin identifier in a
   sequence message or mindmap label would scramble exactly like the flowchart
   bug did. Target every <text>/<tspan> under the mermaid root instead of
   enumerating per-kind classes, so a future diagram kind cannot reopen this
   gap by not being named here. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg text,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg tspan {
  direction: rtl;
  unicode-bidi: plaintext;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .edgeLabel foreignObject div,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .edgeLabel span {
  background: var(--nbgd-em-face-deep) !important;
  border: 1px solid var(--nbgd-em-edge) !important;
  border-radius: 999px !important;
  padding: 2px 10px !important;
  font-size: 16px !important;
  color: var(--nbgd-em-on) !important;
  display: inline-block !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .edgeLabel text {
  fill: var(--nbgd-em-on) !important;
  font-weight: 700 !important;
}
/* Mermaid mindmap colours each branch by an internal "section" scale we never
   set, so it fell back to defaults meant for a light theme: section-0 painted
   near-black (rgb(11,0,0)) with black text on top -- fully invisible, verified
   live in the browser (medium tree fixture, «فصل ۱ / درس ۱ / درس ۲» all blank
   black boxes while the root and section-1 branch happened to be visible by
   luck). Same fix pattern as the flowchart classDefs: a deliberate palette,
   not an unexamined default, plus text forced light regardless of section. */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node text,
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node tspan {
  fill: var(--nbgd-on-dark) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node .node-bkg {
  stroke: var(--nbgd-line-strong) !important;
  stroke-width: 1.6px !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node.section-root .node-bkg {
  fill: var(--nbgd-sky-face) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node.section-0 .node-bkg {
  fill: var(--nbgd-em-face) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node.section-1 .node-bkg {
  fill: var(--nbgd-am-face) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node.section-2 .node-bkg {
  fill: var(--nbgd-vi-face) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node.section-3 .node-bkg {
  fill: var(--nbgd-bl-face) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node.section-4 .node-bkg {
  fill: var(--nbgd-am-face-2) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .mindmap-node.section-5 .node-bkg {
  fill: var(--nbgd-cy-face) !important;
}

:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg rect.nabgol-mmd-edge-pill {
  fill: var(--nbgd-em-face-deep) !important;
  stroke: var(--nbgd-em-edge) !important;
  stroke-width: 1.25px !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .edge-thickness-normal {
  stroke-width: 1.75px !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .marker {
  fill: var(--nbgd-ink-soft) !important;
  stroke: var(--nbgd-stroke-soft) !important;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-mermaid-svg .edgePath .path {
  stroke: var(--nbgd-stroke-soft) !important;
  stroke-width: 1.75px !important;
}

/* G5 — deck (flip slides, no PPTX) */
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-shell {
  padding-bottom: 0.35em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-track {
  position: relative;
  min-height: 120px;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-slide {
  display: none;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-slide.is-active {
  display: block;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-slide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
  margin-bottom: 0.45em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-slide-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--nbgd-em-on);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-counter {
  font-size: 14px;
  color: var(--nbgd-ink-soft);
  white-space: nowrap;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-prose p {
  margin: 0 0 0.35em;
  font-size: 16px;
  line-height: 1.45;
  color: var(--nbgd-ink-2);
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-visual {
  margin-top: 0.45em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-nav {
  display: flex;
  justify-content: center;
  gap: 0.65em;
  margin-top: 0.55em;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-nav button {
  min-width: 44px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid var(--nbgd-em-edge-45);
  background: var(--nbgd-em-face-nav);
  color: var(--nbgd-em-on);
  font-size: 18px;
  cursor: pointer;
}
:where(body:is(.desktop-chat, .mobile-chat) .message.assistant .text, .nabgol-media-fullscreen__zoomwrap) .nabgol-deck-nav button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Chat chrome theme contrast forever — html[data-theme] is the only switch */
html[data-theme="light"] body.desktop-chat .chat-main {
  background: var(--bg) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .message-bubble {
  background: var(--assistant-msg, #fff);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .footer-meta,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .msg-date,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .msg-time {
  color: #334155 !important;
  opacity: 1 !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message .footer {
  border-top-color: rgba(15, 23, 42, 0.12) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .action-chip,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .message-actions button {
  background: transparent !important;
  border-color: rgba(15, 23, 42, 0.16) !important;
  color: #1e293b !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .action-chip .ico {
  color: #1e293b !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message .action-chip:hover {
  background: rgba(15, 23, 42, 0.06) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn {
  background: transparent !important;
  color: #1e293b !important;
  border: 1px solid rgba(15, 23, 42, 0.16) !important;
  box-shadow: none !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn .ico {
  color: #1e293b !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn:hover {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(5, 150, 105, 0.45) !important;
  color: #059669 !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn:hover .ico {
  color: #059669 !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message-body > .version-controls {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
/* REMOVED 2026-08-21 — the day palette for #starterChips used to be re-declared
   here (a flat #ffffff chip, #f8fafc panel, hard #0f172a label). Correctly keyed,
   unlike the .dark-mode fork further up, but a second source of truth: because it
   also matched .suggestion-chip--mode it flattened the teach chip's accent to
   plain white, so in day theme the primary path was indistinguishable from the
   neutral ones. Day now comes from --nab-chip-* in chat-action-buttons.css.
   Measured after removal: teach 6.80:1, neutral 7.06:1, panel/summary AA-clean. */
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-header,
html[data-theme="light"] body.mobile-chat .chat-header {
  background: var(--bg-secondary) !important;
  border-bottom-color: var(--border) !important;
  color: var(--text) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-header .name,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .icon-btn {
  color: var(--text) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-input .input-wrapper {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-input #input {
  color: var(--text) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-ai-disclaimer {
  color: #475569 !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .text {
  color: var(--text) !important;
}
html:not([data-theme="light"]) body:is(.desktop-chat, .mobile-chat) .message.assistant .message-bubble {
  background-color: var(--assistant-msg, #161b22);
  color: var(--text);
  border-color: var(--border);
}
html:not([data-theme="light"]) body:is(.desktop-chat, .mobile-chat) .message.assistant .text {
  color: var(--text);
}
html[data-theme="dark"] body:is(.desktop-chat, .mobile-chat) .message.assistant .action-chip,
html:not([data-theme="light"]) body:is(.desktop-chat, .mobile-chat) .message.assistant .action-chip {
  color: rgba(226, 232, 240, 0.92);
}
html:not([data-theme="light"]) body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn {
  background: transparent !important;
  color: rgba(226, 232, 240, 0.92) !important;
  border: 1px solid rgba(226, 232, 240, 0.18) !important;
  box-shadow: none !important;
}
html:not([data-theme="light"]) body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn .ico {
  color: rgba(226, 232, 240, 0.92) !important;
}
html:not([data-theme="light"]) body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn:hover {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: rgba(52, 211, 153, 0.45) !important;
  color: #6ee7b7 !important;
}
html:not([data-theme="light"]) body:is(.desktop-chat, .mobile-chat) .message .message-actions > .action-chip.regenerate-btn:hover .ico {
  color: #6ee7b7 !important;
}

/* Light theme: one ink for every chrome surface. No per-robot hunt. */
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .icon-btn,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .ghost-btn,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-action-btn,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .header-actions .icon-btn,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .header-actions .ghost-btn {
  color: #0f172a !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .icon-btn .ico,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .ghost-btn .ico,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-action-btn .ico {
  color: #0f172a !important;
  stroke: currentColor !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-header .name,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-header .robot-status-line,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .empty-title,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .empty-sub,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-hint,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .sidebar,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-item,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .sheet-select {
  color: var(--text) !important;
}
/* `span` was in this list until 2026-08-28 and it is why every diagram badge went
   unreadable in day theme: a <span> inside a diagram sits on a SATURATED CHIP
   (.nabgol-compare-badge on a dark emerald pill, .nabgol-annotate-pin-n on red),
   so forcing prose ink onto it measured 2.38:1 / 3.70:1 (DIAGRAM_THEME_GATE).
   Prose spans do not need it: they carry no colour of their own and inherit from
   .text, which chat-canvas.css sets from --nbgc-ink with a higher-specificity
   #messages selector. Elements that DO choose their own ink now keep it. */
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .text,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .text :where(p, li, strong, em, a, h1, h2, h3, h4, blockquote) {
  color: #0f172a !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .text :where(h1, h2, h3) {
  color: #0f172a !important;
}
/* REMOVED 2026-08-21 — duplicate of the block above (same panel, same forced
   #0f172a chip ink). Both are now --nab-chip-ink / --nab-chip-panel-*. */
html[data-theme="light"] body.mobile-chat .input-wrapper {
  border-color: var(--border) !important;
  background: var(--bg-secondary) !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08) !important;
}
html[data-theme="light"] body.mobile-chat .message.assistant .message-bubble {
  background: #fff !important;
  color: #0f172a !important;
  border-color: #d0d7de !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .file-preview .file-name,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .file-preview .file-meta,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .file-preview .fp-caption-hint {
  color: var(--text) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .file-preview .file-meta,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .file-preview .fp-caption-hint {
  color: var(--text-secondary) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .nabgol-workspace,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .nabgol-workspace-panel,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .control-surface {
  color: var(--text);
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .action-chip,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .action-chip .ico {
  color: #0f172a !important;
}

/* Light theme — accent-on-soft & danger-red text forever (2026-08-20).
   --dc-accent/--tg-accent + their "-soft" translucent wash were tuned for a
   near-black page background: bright green/red text over a ~12% wash of the
   SAME hue reads fine on #0d1117 but becomes near-invisible (contrast ~2:1)
   once the page background turns white. Every place below measured under
   4.5:1 with a real browser + WCAG luminance formula, not by eye. Reuse the
   already-existing "-dark" tokens for the TEXT only — button/badge
   backgrounds elsewhere keep their bright brand green unchanged. */
html[data-theme="light"] body.desktop-chat .msg-avatar,
html[data-theme="light"] body.mobile-chat .msg-avatar,
html[data-theme="light"] body.mobile-chat .big-icon,
html[data-theme="light"] body.mobile-chat .brand-avatar,
html[data-theme="light"] body.desktop-chat .icon-btn.active,
html[data-theme="light"] body.desktop-chat .new-chat-sidebar:hover {
  color: #15803d !important;
}
/* `.suggestion-chip:hover` used to be in that list. On the day chip's darkest
   gradient stop (#94a3b8) #15803d measures 1.97:1 — the exact class of defect
   this whole block was written to remove, just on a surface that was white when
   it was written. Chip hover ink is --nab-chip-ink-hover now: 6.35:1 there. */
/* 2026-08-20 real re-measure: #15803d text on THIS pill's actual composited
   background (~rgb(222,237,228)) only hit 4.14:1 — still under the 4.5:1 AA
   floor for 11px text, which is exactly why the earlier "fix" here kept
   failing a fresh audit. #166534 on the same background measures 5.89:1. */
html[data-theme="light"] body.desktop-chat .robot-status.active {
  color: #166534 !important;
  background: rgba(21, 128, 61, 0.14) !important;
}
html[data-theme="light"] body.desktop-chat .robot-status.active .status-dot {
  background: #166534 !important;
  box-shadow: 0 0 6px rgba(21, 128, 61, 0.35) !important;
}
html[data-theme="light"] body.desktop-chat .icon-btn.active {
  background: rgba(21, 128, 61, 0.14) !important;
  border-color: #15803d !important;
}

html[data-theme="light"] body.desktop-chat .icon-btn.danger,
html[data-theme="light"] body.desktop-chat .ghost-btn.danger,
html[data-theme="light"] body.desktop-chat .chat-header .header-actions .icon-btn.danger,
html[data-theme="light"] body.desktop-chat .chat-header .header-actions .ghost-btn.danger,
html[data-theme="light"] body.desktop-chat .chat-header .header-actions .ghost-btn.danger .btn-label,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .voice-btn.recording,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-action-btn.voice-btn.recording {
  color: #b91c1c !important;
}
html[data-theme="light"] body.desktop-chat .chat-header .header-actions .icon-btn.danger:hover,
html[data-theme="light"] body.desktop-chat .chat-header .header-actions .ghost-btn.danger:hover,
html[data-theme="light"] body.desktop-chat .icon-btn.danger:hover {
  background: rgba(185, 28, 28, 0.12) !important;
  color: #b91c1c !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .voice-btn.recording,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-action-btn.voice-btn.recording {
  background: rgba(185, 28, 28, 0.12) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message .delete-btn:hover {
  color: #b91c1c !important;
  border-color: rgba(185, 28, 28, 0.5) !important;
  background: rgba(185, 28, 28, 0.12) !important;
}

/* Telegram-standard attach card: guarantee the inner preview/input stay
   borderless so only the OUTER frame reads as a border, in light theme too. */
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-input.composer-has-attach {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-input.composer-has-attach .file-preview.show,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-input.composer-has-attach .input-wrapper {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

