/* ────────────────────────────────────────────────────────────────────
   theme.css — v39.0.7
   Dark / light theme overrides for the Main AI dashboard.

   FOUC guard release
   ──────────────────
   dashboard.html adds .t-loading to <html> at the top of head and sets
   html.t-loading body { visibility: hidden }. This release rule fires as
   soon as theme.css has parsed (which is the moment when all the rules
   below are ready to apply), making body visible again. The result:
   first paint shows the correctly-themed dashboard, with no dark-to-light
   flash and no half-loaded "command box missing" state.
   ──────────────────────────────────────────────────────────────────── */
html.t-loading body,
body { visibility: visible !important; }

/* ────────────────────────────────────────────────────────────────────
   Dark / light theme overrides for the Main AI dashboard.

   How this works
   ──────────────
   The dashboard ships dark by default; tens of stylesheets and inline
   <style> blocks bake dark-on-light values directly into rules (e.g.
   background: rgba(15,23,42,.82); color: #fff). To get a usable light
   mode without rewriting every rule, this file uses a single high-
   specificity gate — `body[data-theme="light"]` — and remaps the
   surfaces, borders, text, and panel patterns that visibly carry the
   chrome.

   Loading order
   ─────────────
   This file is the LAST stylesheet the document loads. That means it
   wins against everything in styles.css, dashboard-polish.css,
   mobile-polish.css, project-overview.css, command-palette.css, etc.
   Many original rules use !important; we match that selectively.

   What this DOESN'T try to do
   ───────────────────────────
   - Preview iframes and document-render surfaces (.preview-frame,
     .resume-page, .essay-draft-card textarea) stay white because they
     simulate printed paper. That's correct in both themes.
   - Per-mode tweaks deep inside infrequently-visited modal subviews
     may still bleed dark patches; the dashboard-mock.js inline styles
     can't be reached by selectors. Those should be addressed in a
     future pass if any are reported.

   Purple accents stay constant in both modes. Only surfaces flip.
   ──────────────────────────────────────────────────────────────────── */


/* ════════════════════════════════════════════════════════════════════
   1. THEME TOGGLE UI (in profile modal) — visible in both themes.
   ════════════════════════════════════════════════════════════════════ */

.theme-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.18);
  width: fit-content;
}
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: rgba(200, 206, 224, 0.72);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}
.theme-toggle-btn:hover {
  color: #f0eef8;
}
.theme-toggle-btn.is-active {
  background: linear-gradient(135deg, var(--ca-accent, #a855f7), var(--ca-accent-dark, #7c3aed));
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.32);
}
.theme-toggle-btn.is-active:hover {
  transform: translateY(-1px);
}
.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle-icon svg { display: block; }

/* In light mode, soften the toggle wrapper so it sits on white. */
body[data-theme="light"] .theme-toggle {
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(168, 85, 247, 0.22);
}
body[data-theme="light"] .theme-toggle-btn {
  color: #5b3b8e;
}
body[data-theme="light"] .theme-toggle-btn:hover {
  color: #2d1b4e;
}
body[data-theme="light"] .theme-toggle-btn.is-active {
  color: #ffffff;
}

/* The accent picker row that used to live here is gone. Hide any
   stragglers from older cached HTML so they don't reappear. */
.v74-accent-row,
.v74-swatches { display: none !important; }


/* ════════════════════════════════════════════════════════════════════
   2. LIGHT MODE — root variables
      Override the foundational tokens defined in dashboard.html's
      inline <style>. Everything that consumes these vars (sidebar,
      panels, tabs, toast, etc.) flips automatically.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"],
html[data-theme="light"] body {
  /* Dashboard core tokens (defined inline in dashboard.html) */
  --bg:        #f4f1fb;
  --panel:     #ffffff;
  --panel2:    #f7f3fd;
  --line:      #e5dff0;
  --muted:     #64748b;
  --text:      #1f2937;
  --shadow:    0 12px 36px rgba(76, 29, 149, 0.08);
  --glow:      0 0 28px rgba(168, 85, 247, 0.18);

  /* Adaptive dashboard tokens (defined throughout styles.css). These
     are what the v50/v51 "redesign" rules consume. */
  --db-bg:       #f4f1fb;
  --db-bg2:      #ffffff;
  --db-panel:    #ffffff;
  --db-panel2:   #f7f3fd;
  --db-surface:  #ffffff;
  --db-surface2: #faf7ff;
  --db-text:     #1f2937;
  --db-text2:    #334155;
  --db-muted:    #64748b;
  --db-muted2:   #6b7280;
  --db-line:     #e5dff0;
  --db-border:   #e5dff0;
  --db-s2:       #ece5f7;        /* the "rest of ring" track color */
  --db-accent:   #7c3aed;
  --db-accent2:  #a855f7;

  /* Generic tokens used by the marketing pages (styles.css :root) */
  --border:      rgba(15, 23, 42, 0.10);
  --muted-2:     rgba(15, 23, 42, 0.50);
  --radius-xl:   32px;
  --radius-md:   18px;

  /* Color-scheme so form controls (selects, scrollbars) follow. */
  color-scheme: light;
}


/* ════════════════════════════════════════════════════════════════════
   3. LIGHT MODE — body background
      The dashboard body uses three layered radial gradients on a deep
      navy. We swap to soft lavender-tinted gradients on white.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] {
  background:
    radial-gradient(circle at 45% -15%, rgba(168, 85, 247, 0.10), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(124, 58, 237, 0.05), transparent 28%),
    var(--bg) !important;
  color: var(--text) !important;
}


/* ════════════════════════════════════════════════════════════════════
   4. LIGHT MODE — sidebar
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .mock-sidebar {
  background: linear-gradient(180deg, #ffffff, #faf7ff);
  border-right: 1px solid var(--line);
  scrollbar-color: #c4b5fd transparent;
}
body[data-theme="light"] .mock-sidebar .brand {
  border-bottom: 1px solid var(--line);
}
body[data-theme="light"] .mock-sidebar .brand h1 {
  color: #1f2937;
}
body[data-theme="light"] .nav button {
  color: #475569;
}
body[data-theme="light"] .nav button:hover {
  background: rgba(168, 85, 247, 0.08);
  color: #1f2937;
}
body[data-theme="light"] .nav button.active {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark));
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.28);
}
body[data-theme="light"] .nav .new {
  background: var(--ca-accent);
  color: #ffffff;
}

/* Sidebar engine status / profile chip */
body[data-theme="light"] .engine-status,
body[data-theme="light"] .profile {
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(76, 29, 149, 0.04);
}
body[data-theme="light"] .engine-status h3 { color: #1f2937; }
body[data-theme="light"] .status-line     { color: #475569; }
body[data-theme="light"] .details         { color: var(--ca-accent-dark); }
body[data-theme="light"] .profile b       { color: #1f2937; }
body[data-theme="light"] .profile span    { color: #6b7280; }
body[data-theme="light"] .profile:hover {
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.10);
}

/* Avatar — keep the light circle but bump contrast */
body[data-theme="light"] .avatar {
  background: linear-gradient(135deg, #ede9fe, #f5f3ff);
  color: #6d28d9;
  border: 1px solid #e5dff0;
}


/* ════════════════════════════════════════════════════════════════════
   5. LIGHT MODE — main area, greeting, top
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .mock-main,
body[data-theme="light"] .mock-right {
  scrollbar-color: #c4b5fd transparent;
}
body[data-theme="light"] .greeting h2 { color: #1f2937; }
body[data-theme="light"] .greeting p  { color: #475569; }


/* ════════════════════════════════════════════════════════════════════
   6. LIGHT MODE — score card / ring
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .score-card {
  background: linear-gradient(180deg, #ffffff, #faf7ff);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
body[data-theme="light"] .score-card b   { color: #1f2937; }
body[data-theme="light"] .score-card p   { color: #475569; }
body[data-theme="light"] .score-card button {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.30);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .ring {
  background: conic-gradient(var(--ca-accent) calc(var(--p) * 1%), #ece5f7 0);
  box-shadow:
    inset 0 0 0 8px rgba(168, 85, 247, 0.06),
    0 0 30px rgba(168, 85, 247, 0.12);
}
body[data-theme="light"] .ring:after { background: #ffffff; }
body[data-theme="light"] .ring strong { color: #1f2937; }
body[data-theme="light"] .ring span   { color: #6b7280; }

body[data-theme="light"] .mini-ring {
  background: conic-gradient(#22c55e 72%, #e5dff0 0);
}
body[data-theme="light"] .mini-ring:after { background: #ffffff; }
body[data-theme="light"] .mini-ring strong { color: #1f2937; }
body[data-theme="light"] .mini-ring span   { color: #475569; }


/* ════════════════════════════════════════════════════════════════════
   7. LIGHT MODE — builder CTA + ready states
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .builder-cta {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), #ffffff);
  border: 1px solid rgba(124, 58, 237, 0.35);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.08);
}
body[data-theme="light"] .builder-cta h2 { color: #1f2937; }
body[data-theme="light"] .builder-cta p  { color: #475569; }
body[data-theme="light"] .cta-icon {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  color: var(--ca-accent-dark);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18);
}

body[data-theme="light"] .builder-ready {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), #ffffff);
  border: 1px solid rgba(124, 58, 237, 0.40);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.08);
}
body[data-theme="light"] .builder-ready .ready-top b   { color: #1f2937; }
body[data-theme="light"] .builder-ready .ready-top p   { color: #475569; }
body[data-theme="light"] .builder-ready .ready-stats strong { color: var(--ca-accent-dark); }
body[data-theme="light"] .builder-ready .ready-stats small  { color: #6b7280; }


/* ════════════════════════════════════════════════════════════════════
   8. LIGHT MODE — content card, tabs, metric cards, panels
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .content-card {
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
body[data-theme="light"] .tabs {
  border-bottom: 1px solid var(--line);
}
body[data-theme="light"] .tabs button {
  border-right: 1px solid rgba(15, 23, 42, 0.06);
  color: #6b7280;
}
body[data-theme="light"] .tabs button:hover { color: #1f2937; }
body[data-theme="light"] .tabs button.active { color: #1f2937; }
body[data-theme="light"] .tabs button.active:after { background: var(--ca-accent); }
body[data-theme="light"] .tab-new {
  background: rgba(168, 85, 247, 0.14);
  color: var(--ca-accent-dark);
}

body[data-theme="light"] .metric-card {
  background: linear-gradient(180deg, #ffffff, #faf7ff);
  border: 1px solid var(--line);
}
body[data-theme="light"] .metric-card:before {
  background: radial-gradient(circle at 20% 0%, rgba(168, 85, 247, 0.08), transparent 38%);
}
body[data-theme="light"] .metric-card b      { color: #1f2937; }
body[data-theme="light"] .metric-card strong { color: #1f2937; }
body[data-theme="light"] .metric-card p      { color: #475569; }
body[data-theme="light"] .m-green   { background: #d1fae5; color: #047857; }
body[data-theme="light"] .m-orange  { background: #fed7aa; color: #c2410c; }
body[data-theme="light"] .m-red     { background: #fecaca; color: #b91c1c; }
body[data-theme="light"] .m-purple  { background: #ede9fe; color: #6d28d9; }

body[data-theme="light"] .panel {
  background: #ffffff;
  border: 1px solid var(--line);
}
body[data-theme="light"] .panel h3 { color: #1f2937; }

body[data-theme="light"] .action-item,
body[data-theme="light"] .insight-item {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] .action-item:hover,
body[data-theme="light"] .insight-item:hover {
  border-color: rgba(124, 58, 237, 0.50);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.08);
}
body[data-theme="light"] .action-item h4 { color: #1f2937; }
body[data-theme="light"] .action-item p,
body[data-theme="light"] .insight-item p { color: #475569; }

body[data-theme="light"] .badge.high   { background: #fee2e2; color: #b91c1c; }
body[data-theme="light"] .badge.medium { background: #fef3c7; color: #b45309; }
body[data-theme="light"] .badge.low    { background: #d1fae5; color: #047857; }
body[data-theme="light"] .high   { background: #fee2e2; color: #b91c1c; }
body[data-theme="light"] .medium { background: #fef3c7; color: #b45309; }
body[data-theme="light"] .low    { background: #d1fae5; color: #047857; }

body[data-theme="light"] .view-all { color: var(--ca-accent-dark); }

body[data-theme="light"] .skills {
  border: 1px solid var(--line);
  background: #ffffff;
}
body[data-theme="light"] .chips span,
body[data-theme="light"] .chips i { font-style: normal; }
body[data-theme="light"] .chips span { background: #d1fae5; color: #047857; }
body[data-theme="light"] .chips i    { background: #fee2e2; color: #b91c1c; }


/* ════════════════════════════════════════════════════════════════════
   9. LIGHT MODE — primary issue / risk banners
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .primary-issue {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.08), #ffffff);
  border: 1px solid rgba(244, 63, 94, 0.50);
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.06);
}
body[data-theme="light"] .primary-issue .pi-icon {
  background: rgba(244, 63, 94, 0.12);
  color: #b91c1c;
}
body[data-theme="light"] .primary-issue small { color: #b91c1c; }
body[data-theme="light"] .primary-issue b     { color: #1f2937; }
body[data-theme="light"] .primary-issue p     { color: #475569; }
body[data-theme="light"] .primary-issue button {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.40);
  color: #b91c1c;
}


/* ════════════════════════════════════════════════════════════════════
  10. LIGHT MODE — right column (preview, recent items)
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .right-card {
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
body[data-theme="light"] .right-card h3 { color: #1f2937; }
body[data-theme="light"] .right-card h3 button { color: var(--ca-accent-dark); }
body[data-theme="light"] .recent-item { color: #475569; }


/* ════════════════════════════════════════════════════════════════════
  11. LIGHT MODE — modals (profile, upgrade, nav-panel)
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .profile-modal-backdrop,
body[data-theme="light"] .upgrade-modal-backdrop {
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(6px);
}
body[data-theme="light"] .profile-modal,
body[data-theme="light"] .upgrade-modal {
  background: linear-gradient(180deg, #ffffff, #faf7ff);
  border: 1px solid rgba(124, 58, 237, 0.32);
  box-shadow: 0 30px 80px rgba(76, 29, 149, 0.18);
  color: #1f2937;
}
body[data-theme="light"] .profile-modal h2,
body[data-theme="light"] .upgrade-modal h2 { color: #1f2937; }
body[data-theme="light"] .profile-modal p,
body[data-theme="light"] .upgrade-modal p  { color: #475569; }
body[data-theme="light"] .modal-close {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--line);
  color: #475569;
}
body[data-theme="light"] .modal-close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #1f2937;
}
body[data-theme="light"] .profile-row {
  border-top: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] .profile-row span:first-child { color: #6b7280; }
body[data-theme="light"] .profile-row strong          { color: #1f2937; }
body[data-theme="light"] .profile-row span            { color: #475569; }

body[data-theme="light"] .modal-actions button.secondary {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] .modal-actions button.secondary:hover {
  background: rgba(15, 23, 42, 0.07);
}

body[data-theme="light"] .upgrade-list div {
  background: #faf7ff;
  border: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] .upgrade-actions .secondary {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--line);
  color: #1f2937;
}

/* nav-panel (the section that hosts the workspace shell) */
body[data-theme="light"] .nav-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
body[data-theme="light"] .nav-panel h2 { color: #1f2937; }
body[data-theme="light"] .nav-panel p  { color: #475569; }
body[data-theme="light"] .nav-tile {
  background: #faf7ff;
  border: 1px solid var(--line);
}
body[data-theme="light"] .nav-tile b    { color: #1f2937; }
body[data-theme="light"] .nav-tile span { color: #475569; }


/* ════════════════════════════════════════════════════════════════════
  12. LIGHT MODE — toast, tooltips, generic utility
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .toast {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #1f2937;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.10);
}


/* ════════════════════════════════════════════════════════════════════
  13. LIGHT MODE — text colors that are baked in throughout
       Many rules use literal #fff or rgba(255,255,255,…) for body text.
       These selectors flip them at the visible chrome level without
       touching preview frames or simulated paper surfaces.
   ════════════════════════════════════════════════════════════════════ */

/* Generic body text containers that hardcode white. */
body[data-theme="light"] {
  color: #1f2937;
}
body[data-theme="light"] h1,
body[data-theme="light"] h2,
body[data-theme="light"] h3,
body[data-theme="light"] h4,
body[data-theme="light"] h5,
body[data-theme="light"] h6 { color: #1f2937; }

body[data-theme="light"] .mock-shell, body[data-theme="light"] .mock-shell * {
  /* don't apply globally — would be too aggressive; specific rules above. */
}


/* ════════════════════════════════════════════════════════════════════
  14. LIGHT MODE — dashboard redesign (db-* token-driven blocks)
       Many of the v50 layout pieces consume the --db-* vars we already
       overrode at :root. Anything that reads --db-bg / --db-panel /
       --db-text / etc. now flips automatically. The few remaining
       rules that hardcode hex inside the v50 redesign block are
       handled below.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .dashboard-shell,
body[data-theme="light"] .db-shell,
body[data-theme="light"] .db-main,
body[data-theme="light"] .db-content {
  background: var(--db-bg);
  color: var(--db-text);
}
body[data-theme="light"] .db-card,
body[data-theme="light"] .db-panel,
body[data-theme="light"] .db-surface,
body[data-theme="light"] [class^="db-"][class*="card"],
body[data-theme="light"] [class^="db-"][class*="panel"] {
  background: var(--db-panel);
  border-color: var(--db-line);
  color: var(--db-text);
}


/* ════════════════════════════════════════════════════════════════════
  15. LIGHT MODE — chat / right rail / composer
       These show up across every analysis, so they earn explicit love.
       Heavy use of !important to beat the inline-purple gradients
       baked into specific composer rules.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .rp-chat,
body[data-theme="light"] [class*="chat-rail"],
body[data-theme="light"] [class*="chat-panel"],
body[data-theme="light"] [class*="composer"],
body[data-theme="light"] .chat-message {
  color: #1f2937;
}

/* Right-rail second card hosts the AI chat. It's a generic .right-card
   so it picks up our right-card override above, but the inner chat
   composer overlays it with a darker gradient. */
body[data-theme="light"] .chat-command-composer,
body[data-theme="light"] .command-composer,
body[data-theme="light"] .adaptive-ask-composer,
body[data-theme="light"] .compact-workspace-composer,
body[data-theme="light"] .document-command-composer,
body[data-theme="light"] .workspace-composer {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 4px 14px rgba(76, 29, 149, 0.04) !important;
}
body[data-theme="light"] .adaptive-ask-composer textarea,
body[data-theme="light"] .chat-command-composer textarea,
body[data-theme="light"] .command-composer textarea,
body[data-theme="light"] .workspace-composer textarea {
  background: #faf7ff !important;
  color: #1f2937 !important;
  border: 1px solid var(--line) !important;
}
body[data-theme="light"] .adaptive-ask-composer textarea::placeholder,
body[data-theme="light"] .chat-command-composer textarea::placeholder,
body[data-theme="light"] .command-composer textarea::placeholder,
body[data-theme="light"] .workspace-composer textarea::placeholder {
  color: #9ca3af !important;
}

body[data-theme="light"] .chat-message.assistant {
  background: #faf7ff;
  border: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] .chat-message.user {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark));
  color: #ffffff;
}
body[data-theme="light"] #rp-chat-send,
body[data-theme="light"] .rp-chat-send {
  background: var(--ca-accent) !important;
  color: #ffffff !important;
}

/* Empty-state panels for the chat / ask views */
body[data-theme="light"] .chat-empty,
body[data-theme="light"] .empty-queue,
body[data-theme="light"] .static-tab-empty,
body[data-theme="light"] .adaptive-empty-panel,
body[data-theme="light"] .adaptive-highlight-empty,
body[data-theme="light"] .adaptive-ask-empty,
body[data-theme="light"] .top-findings-empty,
body[data-theme="light"] .document-risk-heatmap-empty {
  background: #faf7ff !important;
  border: 1px solid var(--line) !important;
  color: #475569 !important;
}

/* Suggested-question pills in the empty chat state */
body[data-theme="light"] .adaptive-ask-suggestion,
body[data-theme="light"] [class*="ask-suggestion"],
body[data-theme="light"] [class*="suggested-question"] {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .adaptive-ask-suggestion:hover,
body[data-theme="light"] [class*="ask-suggestion"]:hover {
  background: rgba(168, 85, 247, 0.06) !important;
  border-color: rgba(124, 58, 237, 0.30) !important;
}


/* ════════════════════════════════════════════════════════════════════
  16. LIGHT MODE — inputs, textareas, selects
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] input,
body[data-theme="light"] textarea,
body[data-theme="light"] select {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] input::placeholder,
body[data-theme="light"] textarea::placeholder { color: #9ca3af; }
body[data-theme="light"] input:focus,
body[data-theme="light"] textarea:focus,
body[data-theme="light"] select:focus {
  border-color: var(--ca-accent) !important;
  box-shadow: 0 0 0 3px rgba(var(--ca-accent-rgb), 0.18) !important;
  outline: none;
}

/* Don't flip text fields that look like simulated paper (preview frames) */
body[data-theme="light"] .preview-frame,
body[data-theme="light"] .preview-frame *,
body[data-theme="light"] .resume-page,
body[data-theme="light"] .resume-page *,
body[data-theme="light"] .essay-draft-card textarea,
body[data-theme="light"] .essay-diff-view {
  /* preserve original (already white, dark-text) styling */
  background: revert;
  color: revert;
  border-color: revert;
}


/* ════════════════════════════════════════════════════════════════════
  17. LIGHT MODE — common rgba-on-white surface helpers
       The codebase uses rgba(255,255,255,X) heavily for borders and
       sub-panel fills. In light mode those become invisible. We map
       the most common patterns to dark-on-light equivalents using
       the cascade — these target ANY descendant of the body, but
       only flip the rule when the ELEMENT is one of the chrome
       containers we've already covered above. The `:where()` keeps
       specificity low so the explicit rules above always win.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] :where(.mock-sidebar, .mock-main, .mock-right, .content-card,
  .right-card, .panel, .nav-panel, .nav-tile, .profile-modal, .upgrade-modal, .builder-cta,
  .builder-ready, .score-card, .metric-card, .action-item, .insight-item, .skills,
  .engine-status, .profile, .toast) {
  scrollbar-color: #c4b5fd transparent;
}


/* ════════════════════════════════════════════════════════════════════
  18. LIGHT MODE — admin chip, locked pills, value gates
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .admin-only {
  background: rgba(168, 85, 247, 0.10) !important;
  border: 1px solid rgba(124, 58, 237, 0.32) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .locked-pro-pill,
body[data-theme="light"] .value-gate-upgrade {
  background: rgba(168, 85, 247, 0.10);
  border: 1px solid rgba(124, 58, 237, 0.32);
  color: var(--ca-accent-dark);
}


/* ════════════════════════════════════════════════════════════════════
  19. LIGHT MODE — ai-token-box (only renders for free-ish tiers in
      legacy dashboards; harmless if hidden)
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .ai-token-box {
  background: linear-gradient(180deg, #ffffff, #faf7ff);
  border: 1px solid rgba(124, 58, 237, 0.32);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.08);
}
body[data-theme="light"] .ai-token-box .token-head b      { color: #1f2937; }
body[data-theme="light"] .ai-token-box .token-head small  { color: #6b7280; }
body[data-theme="light"] .ai-token-box > strong           { color: #1f2937; }
body[data-theme="light"] .ai-token-box .token-track       { background: #ece5f7; }


/* ════════════════════════════════════════════════════════════════════
  20. LIGHT MODE — generic dark-rgba surface neutralizer
       Some widgets (cross-doc search overlay, command palette,
       smart workspace, redline editor) use deeply-nested rgba dark
       fills with no semantic class hooks. For those, we flip the
       VISIBLE container and rely on the inner color rules to read
       from the parent. If a particular widget still has dark patches,
       its specific selector should be added above; this fallback
       prevents fully-black panels.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .cmd-palette-modal,
body[data-theme="light"] .cmd-palette-result,
body[data-theme="light"] .v50-search-input,
body[data-theme="light"] .cross-search-overlay,
body[data-theme="light"] .cross-search-modal,
body[data-theme="light"] .smart-workspace-panel,
body[data-theme="light"] .redline-editor-modal,
body[data-theme="light"] .redline-cards,
body[data-theme="light"] .redline-summary,
body[data-theme="light"] .v75-insights-banner,
body[data-theme="light"] .v75-predicted-chip,
body[data-theme="light"] .v32-doc-project-chip,
body[data-theme="light"] .v71-undo-toast,
body[data-theme="light"] .queue-strip,
body[data-theme="light"] [class^="v32-"],
body[data-theme="light"] [class^="v50-"],
body[data-theme="light"] [class^="v51-"],
body[data-theme="light"] [class^="v71-"],
body[data-theme="light"] [class^="v75-"] {
  /* Don't blanket-set background here — too risky. We only change the
     text color so any dark-rgba background that DOES leak through still
     has readable white-tinted text. Specific containers are styled in
     dedicated blocks above and below. */
  color: #1f2937;
}

/* Command palette specifically — visible, modal-like overlay. */
body[data-theme="light"] .cmd-palette-modal {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.16) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .cmd-palette-result {
  color: #1f2937 !important;
}
body[data-theme="light"] .cmd-palette-result.is-active,
body[data-theme="light"] .cmd-palette-result:hover {
  background: rgba(168, 85, 247, 0.10) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .cmd-palette-input {
  background: #faf7ff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}

/* Cross-doc search overlay */
body[data-theme="light"] .cross-search-overlay {
  background: rgba(15, 23, 42, 0.32) !important;
}
body[data-theme="light"] .cross-search-modal {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.16) !important;
  color: #1f2937 !important;
}

/* v32 project chip on doc */
body[data-theme="light"] .v32-doc-project-chip {
  background: rgba(168, 85, 247, 0.12) !important;
  color: var(--ca-accent-dark) !important;
  border: 1px solid rgba(124, 58, 237, 0.30) !important;
}

/* v71 undo toast */
body[data-theme="light"] .v71-undo-toast {
  background: #ffffff !important;
  color: #1f2937 !important;
  border: 1px solid rgba(124, 58, 237, 0.45) !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12) !important;
}


/* ════════════════════════════════════════════════════════════════════
  21. LIGHT MODE — tabs (v50/v51) and tab indicators
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .v50-tab,
body[data-theme="light"] .v50-project-tab {
  color: #6b7280 !important;
}
body[data-theme="light"] .v50-tab:hover,
body[data-theme="light"] .v50-project-tab:hover {
  color: #1f2937 !important;
}
body[data-theme="light"] .v50-tab.is-active,
body[data-theme="light"] .v50-project-tab.is-active {
  color: var(--ca-accent-dark) !important;
  border-bottom-color: var(--ca-accent) !important;
}


/* ════════════════════════════════════════════════════════════════════
  22. LIGHT MODE — analysis chips, pills, and small inline UI
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .analysis-mode-pill {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.30);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .analysis-mode-pill:hover {
  background: rgba(168, 85, 247, 0.14);
}


/* ════════════════════════════════════════════════════════════════════
  23. LIGHT MODE — workspace view, source-context view, redline editor
       These are large modal-like surfaces used during analysis.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .workspace-view,
body[data-theme="light"] .workspace-context,
body[data-theme="light"] .source-context-view,
body[data-theme="light"] .source-context-modal,
body[data-theme="light"] .playbook-view,
body[data-theme="light"] .playbook-compliance-view,
body[data-theme="light"] .analysis-augmentation-view,
body[data-theme="light"] .queue-view {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-color: var(--line) !important;
}

body[data-theme="light"] .redline-editor-view,
body[data-theme="light"] .redline-editor-modal {
  background: #ffffff !important;
  color: #1f2937 !important;
}


/* ════════════════════════════════════════════════════════════════════
  24. LIGHT MODE — focus rings (purple glow on light)
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .nav button:focus-visible,
body[data-theme="light"] .profile:focus-visible,
body[data-theme="light"] .modal-actions button:focus-visible,
body[data-theme="light"] .theme-toggle-btn:focus-visible {
  outline: 2px solid var(--ca-accent);
  outline-offset: 2px;
}


/* ════════════════════════════════════════════════════════════════════
  25. LIGHT MODE — verified badges, dots, etc.
       Keep purple/green semantics; just bump contrast on light.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .verified {
  background: var(--ca-accent);
  color: #ffffff;
}
body[data-theme="light"] .dot {
  background: #16a34a;
  color: #ffffff;
}


/* ════════════════════════════════════════════════════════════════════
  26. LIGHT MODE — backwards compat: hide/disable old accent picker
       One more belt-and-braces pass in case any cached HTML mounts it.
   ════════════════════════════════════════════════════════════════════ */

.v74-swatch,
.v74-swatch-circle,
.v74-accent-row > div:first-child {
  /* In the active dashboard the wrapper is `display:none !important`
     above; these are extra protection if a partial render fires. */
}


/* ════════════════════════════════════════════════════════════════════
  27. DARK MODE — explicit overrides for things that need attention
       Mostly re-asserting the stock dark behavior so light-mode
       overrides above don't accidentally bleed when the user toggles
       back. These are scoped to body[data-theme="dark"] for clarity.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="dark"] {
  color-scheme: dark;
}
/* Nothing else needed here — dark is the codebase default. */


/* ════════════════════════════════════════════════════════════════════
  28. PRINT
       Keep page surfaces white when printing regardless of theme.
   ════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════
  29. LIGHT MODE — v27/v50/v52 dashboard surfaces
       These are the analysis-page surfaces that show every time a
       document is opened. Many hardcode dark hex values; explicit
       overrides keep them readable on light.
   ════════════════════════════════════════════════════════════════════ */

/* v27 dashboard chrome */
body[data-theme="light"] .v27-dashboard {
  color: #1f2937;
}
body[data-theme="light"] .v27-greeting,
body[data-theme="light"] .v27-headline {
  color: #1f2937;
}
body[data-theme="light"] .v27-kicker {
  color: #6b7280;
}
body[data-theme="light"] .v27-doc-card {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 4px 14px rgba(76, 29, 149, 0.04);
}
body[data-theme="light"] .v27-doc-icon {
  background: #faf7ff;
  color: var(--ca-accent-dark);
  border: 1px solid var(--line);
}
body[data-theme="light"] .v27-doc-title { color: #1f2937; }
body[data-theme="light"] .v27-doc-meta  { color: #6b7280; }

body[data-theme="light"] .v27-rail {
  background: #faf7ff !important;
  border-left: 1px solid var(--line) !important;
}

/* v27 right-rail chat (the "Ask anything" surface) */
body[data-theme="light"] .v27-rail-chat,
body[data-theme="light"] #rp-panel-ai {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 4px 14px rgba(76, 29, 149, 0.04) !important;
}
/* AI message bubbles */
body[data-theme="light"] .rp-ai-bubble,
body[data-theme="light"] .v27-rail-msg-a {
  background: #faf7ff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
/* User message bubbles — keep purple */
body[data-theme="light"] .v27-rail-msg-u,
body[data-theme="light"] .rp-user-bubble {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
}
/* Suggested-question chips inside the rail chat */
body[data-theme="light"] .v27-rail-suggest,
body[data-theme="light"] .rp-suggest,
body[data-theme="light"] [class*="rail-suggest"] {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .v27-rail-suggest:hover,
body[data-theme="light"] .rp-suggest:hover {
  background: rgba(168, 85, 247, 0.06) !important;
  border-color: rgba(124, 58, 237, 0.30) !important;
}
/* Rail chat input/textarea */
body[data-theme="light"] .v27-rail-chat input,
body[data-theme="light"] .v27-rail-chat textarea,
body[data-theme="light"] #rp-panel-ai input,
body[data-theme="light"] #rp-panel-ai textarea {
  background: #faf7ff !important;
  color: #1f2937 !important;
  border: 1px solid var(--line) !important;
}
/* Rail preview fade gradient — flip the fade-to color */
body[data-theme="light"] .v27-rail-preview-fade {
  background: linear-gradient(rgba(255,255,255,0), #faf7ff) !important;
}

body[data-theme="light"] .v27-fnd {
  background: #ffffff;
  border: 1px solid var(--line);
}
body[data-theme="light"] .v27-fnd-title  { color: #1f2937; }
body[data-theme="light"] .v27-fnd-detail { color: #475569; }

body[data-theme="light"] .v27-primary-cta {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
}

/* Floating help launcher button (v79) */
body[data-theme="light"] .v79-help-launcher,
body[data-theme="light"] #v79HelpLauncher {
  background: #ffffff !important;
  border: 1px solid rgba(124, 58, 237, 0.35) !important;
  color: var(--ca-accent-dark) !important;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.18) !important;
}
body[data-theme="light"] .v79-help-launcher:hover {
  background: rgba(168, 85, 247, 0.08) !important;
}
/* Help panel itself, when opened */
body[data-theme="light"] .v79-help-panel,
body[data-theme="light"] [class^="v79-"] {
  background: #ffffff !important;
  border-color: var(--line) !important;
  color: #1f2937 !important;
}

/* v50 filter row */
body[data-theme="light"] .v50-filter-row {
  background: #ffffff;
  border: 1px solid var(--line);
}

/* v52 landing columns */
body[data-theme="light"] .v52-landing-col {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937;
}
body[data-theme="light"] .v52-landing-col h2,
body[data-theme="light"] .v52-landing-col h3,
body[data-theme="light"] .v52-landing-col strong { color: #1f2937; }
body[data-theme="light"] .v52-landing-col p,
body[data-theme="light"] .v52-landing-col span,
body[data-theme="light"] .v52-landing-col li { color: #475569; }

/* v32 project chips and cards */
body[data-theme="light"] .v32-project-card,
body[data-theme="light"] .v32-section,
body[data-theme="light"] .v32-input {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}

/* v34 diff side-by-side */
body[data-theme="light"] .v34-diff-sbs {
  background: #ffffff;
  border: 1px solid var(--line);
}

/* v54 doc actions toolbar */
body[data-theme="light"] .v54-doc-actions {
  background: #ffffff;
  border: 1px solid var(--line);
}

/* Verdict cards (dashboard-redesign.css) — keep semantic tints but
   readable on light. The rgba tints already work; we just bump text. */
body[data-theme="light"] .verdict-card { color: #1f2937; }
body[data-theme="light"] .vc-title     { color: #1f2937; }
body[data-theme="light"] .vc-body      { color: #475569; }


/* ════════════════════════════════════════════════════════════════════
  30. LIGHT MODE — score-factor list, elite-match cards
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .score-factor-list {
  background: #ffffff;
  border: 1px solid var(--line);
}
body[data-theme="light"] .score-factor-row { color: #1f2937; }
body[data-theme="light"] .score-factor-head { color: #1f2937; }
body[data-theme="light"] .score-factor-explain { color: #475569; }
body[data-theme="light"] .score-factor-bar {
  background: #ece5f7;
}

body[data-theme="light"] .elite-match-card {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #1f2937;
}


/* ════════════════════════════════════════════════════════════════════
  31. LIGHT MODE — inbox / email composer mock
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .inbox-mock,
body[data-theme="light"] .inbox-section,
body[data-theme="light"] .inbox-grid {
  background: #ffffff;
  border-color: var(--line);
  color: #1f2937;
}
body[data-theme="light"] .ec-panel,
body[data-theme="light"] .ec-body,
body[data-theme="light"] .ec-head,
body[data-theme="light"] .ec-foot,
body[data-theme="light"] .ec-field,
body[data-theme="light"] .ec-field-body,
body[data-theme="light"] .ec-from-row,
body[data-theme="light"] .ec-from-pick {
  background: #ffffff !important;
  border-color: var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .ec-btn {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.30);
  color: var(--ca-accent-dark);
}


/* ════════════════════════════════════════════════════════════════════
  32. LIGHT MODE — workflow runner / playbook view
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .wf-body,
body[data-theme="light"] [class*="workflow"],
body[data-theme="light"] [class*="playbook"] {
  color: #1f2937;
}


/* ════════════════════════════════════════════════════════════════════
  33. PRINT — keep page surfaces white when printing regardless of theme
   ════════════════════════════════════════════════════════════════════ */

@media print {
  body[data-theme="dark"],
  body[data-theme="light"] {
    background: #ffffff !important;
    color: #000000 !important;
  }
}


/* ════════════════════════════════════════════════════════════════════
  34. LIGHT MODE — CONTRAST PASS (post-feedback)
       Fixes for elements that were created with hardcoded inline
       white-on-white styles in productivity.js / dashboard-mock.js,
       and link/label colors that were too pale to read on a light
       background.

       Strategy:
       - For inline-styled buttons (no class hooks), target by id or
         parent id with !important to beat the inline `color:` rules.
       - For class-based elements that only set color, override the
         color directly with stronger contrast.
   ════════════════════════════════════════════════════════════════════ */

/* ─── #cmdHintBtn — sidebar "Search commands… ⌘K" button ───────────
   Created by productivity.js with inline white-on-transparent styles.
   In light mode it was completely invisible. */
body[data-theme="light"] #cmdHintBtn {
  background: rgba(168, 85, 247, 0.06) !important;
  border: 1px solid var(--line) !important;
  color: #475569 !important;
}
body[data-theme="light"] #cmdHintBtn:hover {
  background: rgba(168, 85, 247, 0.10) !important;
  border-color: rgba(124, 58, 237, 0.35) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] #cmdHintBtn span {
  background: rgba(168, 85, 247, 0.12) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] #cmdHintBtn svg {
  color: #6b7280 !important;
}

/* ─── #rp-chat-suggestions buttons — suggested-question chips ─────
   Created by dashboard-mock.js with inline white-on-transparent styles. */
body[data-theme="light"] #rp-chat-suggestions button {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] #rp-chat-suggestions button:hover {
  background: rgba(168, 85, 247, 0.06) !important;
  border-color: rgba(124, 58, 237, 0.35) !important;
  color: var(--ca-accent-dark) !important;
}

/* ─── Workspace switcher (.ws-ctx-trigger) — "Personal PRIVATE" pill ─
   Hardcoded dark navy bg with white text. Flip to light. */
body[data-theme="light"] .ws-ctx-trigger {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] .ws-ctx-trigger:hover {
  background: #faf7ff;
  border-color: rgba(124, 58, 237, 0.35);
}
body[data-theme="light"] .ws-ctx-trigger[aria-expanded="true"] {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(124, 58, 237, 0.45);
}
body[data-theme="light"] .ws-ctx-trigger-name { color: #1f2937; }
body[data-theme="light"] .ws-ctx-trigger-sub  { color: #6b7280; }
body[data-theme="light"] .ws-ctx-trigger-chev { color: #6b7280; }

/* Workspace dropdown menu (when open) */
body[data-theme="light"] .ws-ctx-menu,
body[data-theme="light"] [class*="ws-ctx-menu"] {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.10) !important;
}
body[data-theme="light"] .ws-ctx-option {
  background: transparent;
  color: #1f2937;
}
body[data-theme="light"] .ws-ctx-option:hover {
  background: rgba(168, 85, 247, 0.06);
}
body[data-theme="light"] .ws-ctx-option.is-active {
  background: rgba(168, 85, 247, 0.10);
}
body[data-theme="light"] .ws-ctx-option-text b  { color: #1f2937; }
body[data-theme="light"] .ws-ctx-option-text em { color: #6b7280; }
body[data-theme="light"] .ws-ctx-option-icon {
  background: linear-gradient(180deg, var(--ca-accent), var(--ca-accent-dark));
  color: #ffffff;
}

/* ─── Section labels in sidebar ("WORKSPACE" header) ───────────────── */
body[data-theme="light"] .nav-section-label {
  color: #6b7280;
}

/* ─── Active sidebar nav item — bump text from light lavender to white
       on the purple active-pill so it actually pops. ──────────────── */
body[data-theme="light"] .nav button.active,
body[data-theme="light"] .nav button.active span,
body[data-theme="light"] .nav button.active i {
  color: #ffffff !important;
}
body[data-theme="light"] .nav button.active {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.30) !important;
}
/* Inactive nav items — strengthen contrast */
body[data-theme="light"] .nav button:not(.active) {
  color: #334155;
}
body[data-theme="light"] .nav button:not(.active):hover {
  background: rgba(168, 85, 247, 0.08);
  color: #1f2937;
}
/* Nav badges (Inbox count, "NEW" tag) — keep readable */
body[data-theme="light"] .nav .new {
  background: var(--ca-accent);
  color: #ffffff;
}

/* ─── Link buttons that were too light ───────────────────────────── */
body[data-theme="light"] .v52-landing-link,
body[data-theme="light"] .v27-rail-link {
  color: var(--ca-accent-dark) !important;
  font-weight: 600;
}
body[data-theme="light"] .v52-landing-link:hover,
body[data-theme="light"] .v27-rail-link:hover {
  color: #5b21b6 !important;
  text-decoration: underline;
}

/* ─── Section headers on the dashboard landing
       ("Pick up where you left off", "This month", "Your projects") */
body[data-theme="light"] .v52-landing-row,
body[data-theme="light"] .v52-landing-col,
body[data-theme="light"] .v52-landing-title,
body[data-theme="light"] .v52-landing-col h2,
body[data-theme="light"] .v52-landing-col h3,
body[data-theme="light"] .v52-landing-col strong,
body[data-theme="light"] .v52-landing-col b {
  color: #1f2937 !important;
}
body[data-theme="light"] .v52-landing-col p,
body[data-theme="light"] .v52-landing-col span:not(.v52-landing-link),
body[data-theme="light"] .v52-landing-col em,
body[data-theme="light"] .v52-landing-col li {
  color: #475569 !important;
}

/* ─── "OR PASTE TEXT BELOW" divider, "0 chars" counter, etc. ──────── */
body[data-theme="light"] .paste-divider,
body[data-theme="light"] [class*="paste-divider"],
body[data-theme="light"] .v71-paste-counter,
body[data-theme="light"] [class*="paste-counter"] {
  color: #6b7280 !important;
}

/* ─── Disabled "Analyze pasted text" button — make it visible even
       when disabled. The button uses opacity:0.4 by default, which is
       readable on dark (white text @ 40% opacity ≈ light gray on dark)
       but invisible on light (light purple @ 40% opacity ≈ ghost). */
body[data-theme="light"] .v71-paste-analyze-btn {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
  border: 0 !important;
}
body[data-theme="light"] .v71-paste-analyze-btn:disabled,
body[data-theme="light"] .v71-paste-analyze-btn[disabled] {
  background: #e5dff0 !important;
  color: #6b7280 !important;
  opacity: 1 !important;
  cursor: not-allowed;
}

/* ─── Greeting "Good afternoon" / "Good evening" small label ──────── */
body[data-theme="light"] .greeting > p,
body[data-theme="light"] .greeting > small,
body[data-theme="light"] .v27-greeting-time,
body[data-theme="light"] [class*="greeting-time"] {
  color: #6b7280 !important;
}

/* ─── Right-rail header labels ("DOCUMENT", "ASK MAINAI") ───────── */
body[data-theme="light"] .v27-rail-head,
body[data-theme="light"] .v27-rail-title,
body[data-theme="light"] [class*="rail-head"],
body[data-theme="light"] [class*="rail-title"] {
  color: #6b7280 !important;
}

/* ─── "No document uploaded / Awaiting upload" empty placeholder ──── */
body[data-theme="light"] .v71-doc-tile,
body[data-theme="light"] .v71-doc-tile-title,
body[data-theme="light"] [class*="doc-tile"] strong,
body[data-theme="light"] [class*="doc-tile"] b {
  color: #1f2937 !important;
}
body[data-theme="light"] .v71-doc-tile-sub,
body[data-theme="light"] [class*="doc-tile"] small,
body[data-theme="light"] [class*="doc-tile"] em {
  color: #6b7280 !important;
}

/* ─── Paste-text textarea — solid white instead of dark-translucent ── */
body[data-theme="light"] textarea[placeholder*="Paste"],
body[data-theme="light"] textarea[placeholder*="paste"],
body[data-theme="light"] textarea[id*="paste"],
body[data-theme="light"] textarea[id*="Paste"] {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}


/* ════════════════════════════════════════════════════════════════════
  35. LIGHT MODE — full-page section views
       Inbox, Projects, Code Analysis, Document Templates all render
       inside dashboard.html as `.nav-panel.mockup-panel.<flavor>-mock`.
       The outer panel already flips white via --db-surface, but each
       view has its own inner-card system that hardcodes dark hex
       values. This block flips them.

       Also: stronger contrast on the sidebar WORKSPACE label, which
       was reported as "too faded" — bumped from slate-500 to slate-700.
   ════════════════════════════════════════════════════════════════════ */

/* ─── Sidebar section labels ("WORKSPACE", any future ones) ───────── */
body[data-theme="light"] .nav-section-label,
body[data-theme="light"] [class*="nav-section-label"] {
  color: #334155 !important;
  font-weight: 600 !important;
}

/* ─── mockup-panel head titles — they sit inside the white panel ──── */
body[data-theme="light"] .mockup-panel,
body[data-theme="light"] .nav-panel {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .mockup-head h2,
body[data-theme="light"] .nav-panel h2 {
  color: #1f2937 !important;
}
body[data-theme="light"] .mockup-head p,
body[data-theme="light"] .nav-panel > p {
  color: #475569 !important;
}
body[data-theme="light"] .mockup-head {
  border-bottom-color: var(--line) !important;
}
body[data-theme="light"] .mockup-toolbar {
  border-bottom-color: var(--line) !important;
}
body[data-theme="light"] .mockup-toolbar input,
body[data-theme="light"] .mockup-toolbar select {
  background: #faf7ff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}


/* ─── INBOX VIEW (.inbox-mock) ────────────────────────────────────── */
body[data-theme="light"] .inbox-section {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 4px 14px rgba(76, 29, 149, 0.04);
}
body[data-theme="light"] .inbox-h {
  color: #475569 !important;
}
body[data-theme="light"] .inbox-count {
  background: rgba(168, 85, 247, 0.14);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .inbox-loading,
body[data-theme="light"] .inbox-empty {
  color: #6b7280 !important;
  background: #faf7ff !important;
  border-color: var(--line) !important;
}

/* Pending finding cards */
body[data-theme="light"] .inbox-item {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  border-left-width: 3px !important;
  color: #1f2937 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
body[data-theme="light"] .inbox-item:hover {
  background: #faf7ff !important;
  border-color: rgba(124, 58, 237, 0.32) !important;
}
/* Severity left borders — keep semantic colors */
body[data-theme="light"] .inbox-r { border-left-color: #dc2626 !important; }
body[data-theme="light"] .inbox-a { border-left-color: #d97706 !important; }
body[data-theme="light"] .inbox-g { border-left-color: #16a34a !important; }

body[data-theme="light"] .inbox-item-t { color: #1f2937 !important; }
body[data-theme="light"] .inbox-item-d { color: #475569 !important; }
body[data-theme="light"] .inbox-doc-name { color: #6b7280 !important; }

/* Severity pills — solid pastel on white */
body[data-theme="light"] .inbox-pill-r {
  background: #fee2e2 !important; color: #b91c1c !important;
}
body[data-theme="light"] .inbox-pill-a {
  background: #fef3c7 !important; color: #b45309 !important;
}
body[data-theme="light"] .inbox-pill-g {
  background: #d1fae5 !important; color: #047857 !important;
}

/* Mark resolved button */
body[data-theme="light"] .inbox-resolve-btn {
  background: rgba(168, 85, 247, 0.10) !important;
  border: 1px solid rgba(124, 58, 237, 0.32) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .inbox-resolve-btn:hover {
  background: rgba(168, 85, 247, 0.18) !important;
}

/* Recent documents column on the right */
body[data-theme="light"] .inbox-recent,
body[data-theme="light"] .inbox-recent-doc,
body[data-theme="light"] .inbox-doc-tile {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .inbox-recent-doc:hover,
body[data-theme="light"] .inbox-doc-tile:hover {
  background: #faf7ff !important;
}

/* Upload-new-document button in the header */
body[data-theme="light"] .inbox-mock .mockup-head > button,
body[data-theme="light"] .nav-panel .mockup-head > button {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.30) !important;
}


/* ─── PROJECTS VIEW (.v32-projects-panel) ─────────────────────────── */
body[data-theme="light"] .v32-projects-panel,
body[data-theme="light"] .v32-project-panel {
  color: #1f2937 !important;
}
body[data-theme="light"] .v32-panel-head h2 { color: #1f2937 !important; }
body[data-theme="light"] .v32-panel-head p  { color: #475569 !important; }

body[data-theme="light"] .v32-proj-card {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
body[data-theme="light"] .v32-proj-card:hover {
  border-color: rgba(124, 58, 237, 0.40) !important;
  background: #faf7ff !important;
}
body[data-theme="light"] .v32-proj-icon {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
}
body[data-theme="light"] .v32-proj-meta h3 { color: #1f2937 !important; }
body[data-theme="light"] .v32-proj-meta p,
body[data-theme="light"] .v32-proj-meta small,
body[data-theme="light"] .v32-proj-meta span { color: #6b7280 !important; }

body[data-theme="light"] .v52-projects-list {
  background: #ffffff !important;
  border-color: var(--line) !important;
}

/* "New project" / "Templates" buttons in the projects header toolbar */
body[data-theme="light"] .v32-projects-panel button[data-action*="template"],
body[data-theme="light"] .v32-projects-panel button.secondary,
body[data-theme="light"] .v32-panel-head button.secondary {
  background: rgba(168, 85, 247, 0.08) !important;
  border: 1px solid rgba(124, 58, 237, 0.30) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .v32-projects-panel input[type="search"],
body[data-theme="light"] .v32-projects-panel input,
body[data-theme="light"] .v32-projects-panel select {
  background: #faf7ff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .v32-projects-panel input::placeholder {
  color: #9ca3af !important;
}


/* ─── CODE ANALYSIS VIEW (.cae-empty) ─────────────────────────────── */
body[data-theme="light"] .cae-empty,
body[data-theme="light"] .cae-empty * {
  color: #1f2937 !important;
}
body[data-theme="light"] .cae-head h2 {
  color: #1f2937 !important;
}
body[data-theme="light"] .cae-head .cae-meta {
  color: #6b7280 !important;
}

/* Hero dropzone — flip the dark gradient to a light lavender wash */
body[data-theme="light"] .cae-drop {
  background: linear-gradient(180deg, #faf7ff, #f4f1fb) !important;
  border: 1.5px dashed rgba(124, 58, 237, 0.45) !important;
  box-shadow:
    0 0 60px rgba(168, 85, 247, 0.08),
    inset 0 0 36px rgba(124, 58, 237, 0.03) !important;
}
body[data-theme="light"] .cae-drop::before {
  background: radial-gradient(ellipse at center, rgba(168, 85, 247, 0.12), transparent 60%) !important;
}
body[data-theme="light"] .cae-drop h3 { color: #1f2937 !important; }
body[data-theme="light"] .cae-drop .cae-sub { color: #475569 !important; }
body[data-theme="light"] .cae-drop .cae-formats {
  color: #6b7280 !important;
}
/* Icon stays purple (it's the focal element) */
body[data-theme="light"] .cae-drop .cae-icon {
  background: linear-gradient(135deg, var(--ca-accent-dark), var(--ca-accent)) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.35) !important;
}
body[data-theme="light"] .cae-cta {
  background: linear-gradient(135deg, var(--ca-accent-dark), var(--ca-accent)) !important;
  color: #ffffff !important;
}

body[data-theme="light"] .cae-rule h4 {
  color: #6b7280 !important;
}
body[data-theme="light"] .cae-rule .cae-line {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.30), transparent 70%) !important;
}

/* "What you'll get" cards */
body[data-theme="light"] .cae-prev {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
body[data-theme="light"] .cae-prev::before {
  background: radial-gradient(circle at 18% 0%, rgba(168, 85, 247, 0.06), transparent 42%) !important;
}
body[data-theme="light"] .cae-prev-title { color: #1f2937 !important; }
body[data-theme="light"] .cae-prev-sub   { color: #6b7280 !important; }
body[data-theme="light"] .cae-prev-detail,
body[data-theme="light"] .cae-prev p,
body[data-theme="light"] .cae-prev div:not(.cae-prev-icon) { color: #475569 !important; }

/* Severity icon tints inside prev-icon — keep saturated, lighter on light */
body[data-theme="light"] .cae-prev-icon.red    { background: #fee2e2 !important; color: #b91c1c !important; }
body[data-theme="light"] .cae-prev-icon.green  { background: #d1fae5 !important; color: #047857 !important; }
body[data-theme="light"] .cae-prev-icon.amber  { background: #fef3c7 !important; color: #b45309 !important; }
body[data-theme="light"] .cae-prev-icon.purple { background: #ede9fe !important; color: var(--ca-accent-dark) !important; }


/* ─── DOCUMENT TEMPLATES VIEW (.doc-templates-mock) ───────────────── */
body[data-theme="light"] .doc-templates-mock {
  color: #1f2937 !important;
}

/* Search input */
body[data-theme="light"] .doc-templates-mock .doc-template-toolbar input[type=search] {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-toolbar input[type=search]::placeholder {
  color: #9ca3af !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-toolbar input[type=search]:focus {
  border-color: var(--ca-accent) !important;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18) !important;
}

/* Category tabs */
body[data-theme="light"] .doc-templates-mock .template-cat-tab {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #475569 !important;
}
body[data-theme="light"] .doc-templates-mock .template-cat-tab:hover {
  background: rgba(168, 85, 247, 0.08) !important;
  border-color: rgba(124, 58, 237, 0.30) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .doc-templates-mock .template-cat-tab.active {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

/* Template cards — the main fix */
body[data-theme="light"] .doc-templates-mock .doc-template-card {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
body[data-theme="light"] .doc-templates-mock .doc-template-card:hover {
  border-color: rgba(124, 58, 237, 0.40) !important;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.10) !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-cat {
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-card h3 {
  color: #1f2937 !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-card p {
  color: #475569 !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-meta {
  color: #6b7280 !important;
}

/* Card footer buttons */
body[data-theme="light"] .doc-templates-mock .doc-template-card footer button {
  background: rgba(168, 85, 247, 0.08) !important;
  border: 1px solid rgba(124, 58, 237, 0.25) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-card footer button:hover {
  background: rgba(168, 85, 247, 0.16) !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-card footer button.primary {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}
body[data-theme="light"] .doc-templates-mock .doc-template-empty {
  background: #faf7ff !important;
  border: 1px dashed var(--line) !important;
  color: #6b7280 !important;
}


/* ─── REPORTS / HISTORY / DOCUMENTS / GENERIC TABLE-CARDS ─────────── */
body[data-theme="light"] .stat-strip article {
  background: #faf7ff !important;
  border: 1px solid var(--line) !important;
}
body[data-theme="light"] .stat-strip span { color: #6b7280 !important; }
body[data-theme="light"] .stat-strip strong,
body[data-theme="light"] .stat-strip .small-stat { color: #1f2937 !important; }

body[data-theme="light"] .table-card {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
}
body[data-theme="light"] .elite-table {
  color: #1f2937 !important;
}
body[data-theme="light"] .elite-table thead {
  background: #faf7ff !important;
}
body[data-theme="light"] .elite-table th {
  color: #475569 !important;
  border-bottom: 1px solid var(--line) !important;
}
body[data-theme="light"] .elite-table td {
  color: #1f2937 !important;
  border-bottom: 1px solid var(--line) !important;
}
body[data-theme="light"] .elite-table tr:hover td {
  background: #faf7ff !important;
}
body[data-theme="light"] .pager {
  color: #6b7280 !important;
  border-top: 1px solid var(--line) !important;
}

/* Section side panel (right column inside Reports etc.) */
body[data-theme="light"] .section-side {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
}
body[data-theme="light"] .section-side h3 { color: #1f2937 !important; }
body[data-theme="light"] .section-side .legend li { color: #475569 !important; }
body[data-theme="light"] .section-side .side-box {
  background: #faf7ff !important;
  border: 1px solid var(--line) !important;
}
body[data-theme="light"] .side-box p { color: #475569 !important; }
body[data-theme="light"] .side-box p small { color: #6b7280 !important; }
body[data-theme="light"] .donut strong { color: #1f2937 !important; }
body[data-theme="light"] .donut span { color: #6b7280 !important; }


/* ─── TEMPLATES.HTML — STANDALONE PAGE ────────────────────────────── */
/* templates.html is a separate page that wasn't wired to the theme
   system. It defaults to dark and stays that way; theme.css won't
   load there unless we add a <link>. The fix for that page is in
   templates.html itself (see commit). This block is just defensive
   coverage in case the user navigates back-and-forth via the standalone
   nav link. */


/* ════════════════════════════════════════════════════════════════════
  36. LIGHT MODE — templates.html standalone page overrides
       This is a separate page from dashboard.html; its dark colors
       are baked into an inline <style>. We override them here.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .wrap { color: #1f2937; }
body[data-theme="light"] .nav a { color: var(--ca-accent-dark) !important; }
body[data-theme="light"] .hero h2 { color: #1f2937 !important; }
body[data-theme="light"] .hero p  { color: #475569 !important; }
body[data-theme="light"] .brand h1 { color: #1f2937 !important; }

/* templates.html .card */
body[data-theme="light"] .wrap .card,
body[data-theme="light"] body > .wrap .card {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}
body[data-theme="light"] .wrap .card:hover {
  border-color: rgba(124, 58, 237, 0.45) !important;
}
body[data-theme="light"] .card-title { color: #1f2937 !important; }
body[data-theme="light"] .card-desc  { color: #475569 !important; }
body[data-theme="light"] .card-meta  { color: #6b7280 !important; }

body[data-theme="light"] .btn-secondary {
  background: rgba(168, 85, 247, 0.08) !important;
  border: 1px solid rgba(124, 58, 237, 0.30) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .btn-secondary:hover {
  background: rgba(168, 85, 247, 0.16) !important;
}

/* Preview modal in templates.html */
body[data-theme="light"] .preview-modal {
  background: rgba(15, 23, 42, 0.32) !important;
}
body[data-theme="light"] .preview-panel {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .preview-header {
  border-bottom-color: var(--line) !important;
}
body[data-theme="light"] .preview-header b { color: #1f2937 !important; }
body[data-theme="light"] .preview-header button {
  background: rgba(15, 23, 42, 0.04) !important;
  border: 1px solid var(--line) !important;
  color: #475569 !important;
}
body[data-theme="light"] .preview-footer {
  border-top-color: var(--line) !important;
}


/* ════════════════════════════════════════════════════════════════════
  37. LIGHT MODE — section-expanded / code-empty-active / code-engine-active
       The .mock-shell gets re-painted dark navy (#050917 / #050913) when
       the user is on Code Analysis / Inbox / Projects / Templates routes
       (rules in dashboard.html line 246 and styles.css line 17605/18366).
       Those rules use !important, so we must too.

       The rules also use `body.adaptive-dashboard-runtime` for higher
       specificity, so we mirror that pattern.
   ════════════════════════════════════════════════════════════════════ */

/* Code-empty route (the Code Analysis empty state) */
body[data-theme="light"].adaptive-dashboard-runtime .mock-shell.code-empty-active,
body[data-theme="light"] .mock-shell.code-empty-active {
  background:
    radial-gradient(circle at 72px 36px, rgba(168, 85, 247, 0.10), transparent 230px),
    radial-gradient(circle at 62% 0%, rgba(124, 58, 237, 0.07), transparent 42%),
    var(--bg) !important;
}

/* Code-engine-active route (after a code file is uploaded) */
body[data-theme="light"] .mock-shell.code-engine-active,
body[data-theme="light"].adaptive-dashboard-runtime .mock-shell.code-engine-active {
  background:
    radial-gradient(circle at 52% 4%, rgba(168, 85, 247, 0.10), transparent 30%),
    var(--bg) !important;
}
body[data-theme="light"] .mock-shell.code-engine-active .mock-main {
  background: var(--bg) !important;
  color: #1f2937 !important;
}

/* Section-expanded shell — when any non-Dashboard nav item is active.
   The shell loses its right rail and grows; many of these surfaces
   inherit a darker bg from elsewhere. Force them transparent so the
   body lavender shows through. */
body[data-theme="light"] .mock-shell.section-expanded {
  background: transparent !important;
}

/* Catch-all: any .mock-shell variant that explicitly sets a dark bg
   should inherit the body lavender in light mode. We use a high-
   specificity selector so we win without competing with the !important
   in the original rules. */
html[data-theme="light"] body[data-theme="light"] .mock-shell {
  /* No bg here — this is just extra specificity for the rules below. */
}


/* ════════════════════════════════════════════════════════════════════
  38. LIGHT MODE — code-engine analysis surfaces
       When the user uploads a code file, an entirely different set of
       cards renders (.code-card, .code-metrics-bar, .code-hero, etc.)
       with hardcoded dark gradients. Theme them.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .code-engine-dashboard {
  color: #1f2937 !important;
}
body[data-theme="light"] .code-hero h1 { color: #1f2937 !important; }
body[data-theme="light"] .code-hero h1 span {
  color: #047857 !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
  background: #d1fae5 !important;
}
body[data-theme="light"] .code-hero p { color: #475569 !important; }
body[data-theme="light"] .code-hero button,
body[data-theme="light"] .code-card button,
body[data-theme="light"] .view-all-findings {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .code-hero button.primary {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
  border: 0 !important;
}

body[data-theme="light"] .code-metrics-bar {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
}
body[data-theme="light"] .code-metrics-bar article {
  border-right-color: var(--line) !important;
}
body[data-theme="light"] .code-metrics-bar span { color: #6b7280 !important; }
body[data-theme="light"] .code-metrics-bar strong { color: #1f2937 !important; }

body[data-theme="light"] .code-card {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 4px 14px rgba(76, 29, 149, 0.04) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .code-card-head {
  border-bottom-color: var(--line) !important;
}
body[data-theme="light"] .code-card-head h2 { color: #1f2937 !important; }
body[data-theme="light"] .code-card-head button { color: var(--ca-accent-dark) !important; }
body[data-theme="light"] .code-file-head {
  border-bottom-color: var(--line) !important;
}
body[data-theme="light"] .code-file-head b { color: #1f2937 !important; }
body[data-theme="light"] .code-file-head small { color: #6b7280 !important; }

/* Code viewer pane — keep dark-on-light for code readability */
body[data-theme="light"] .elite-code-view {
  background: #faf7ff !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .elite-code-line .ln { color: #94a3b8 !important; }
body[data-theme="light"] .elite-code-line code { color: #1f2937 !important; }
body[data-theme="light"] .tok-key     { color: #7c3aed !important; }
body[data-theme="light"] .tok-string  { color: #c2410c !important; }
body[data-theme="light"] .tok-num     { color: #b45309 !important; }
body[data-theme="light"] .tok-comment { color: #6b7280 !important; }
body[data-theme="light"] .elite-code-line.has-finding {
  background: #fef2f2 !important;
}
body[data-theme="light"] .elite-code-line.is-focused {
  background: rgba(168, 85, 247, 0.10) !important;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.40) !important;
}

body[data-theme="light"] .code-preview-card footer {
  border-top-color: var(--line) !important;
  color: #6b7280 !important;
}
body[data-theme="light"] .code-explain-card p { color: #475569 !important; }
body[data-theme="light"] .code-structure {
  border-left-color: var(--line) !important;
}
body[data-theme="light"] .structure-map b {
  background: rgba(168, 85, 247, 0.10) !important;
  border-color: rgba(124, 58, 237, 0.45) !important;
  color: var(--ca-accent-dark) !important;
}
body[data-theme="light"] .structure-map i {
  background: #ffffff !important;
  border-color: var(--line) !important;
  color: #475569 !important;
}

body[data-theme="light"] .overview-cards article {
  background: #faf7ff !important;
  border-color: var(--line) !important;
}
body[data-theme="light"] .overview-cards b { color: #1f2937 !important; }
body[data-theme="light"] .overview-cards span { color: #475569 !important; }

body[data-theme="light"] .code-actions button {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .code-actions button:hover {
  background: rgba(168, 85, 247, 0.06) !important;
  border-color: rgba(124, 58, 237, 0.30) !important;
}
body[data-theme="light"] .code-actions span { color: #1f2937 !important; }
body[data-theme="light"] .code-actions small { color: #475569 !important; }

body[data-theme="light"] .findings-list {
  border-color: var(--line) !important;
}
body[data-theme="light"] .code-finding-row {
  background: #ffffff !important;
  border-bottom-color: var(--line) !important;
}
body[data-theme="light"] .code-finding-row p { color: #475569 !important; }
body[data-theme="light"] .code-finding-row small { color: #475569 !important; }


/* ════════════════════════════════════════════════════════════════════
  39. LIGHT MODE — code-empty layout sub-elements
       (Bottom of the .cae-empty page: side recommendations, format
       chip list, recent uploads section.)
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .code-empty-recent strong,
body[data-theme="light"] .code-empty-recent b { color: #1f2937 !important; }
body[data-theme="light"] .code-empty-recent small { color: #475569 !important; }
body[data-theme="light"] .code-empty-side ul li { color: #475569 !important; }
body[data-theme="light"] .code-empty-format-list span {
  background: #ffffff !important;
  border-color: var(--line) !important;
  color: #475569 !important;
}


/* ════════════════════════════════════════════════════════════════════
  40. LIGHT MODE — welcome onboarding modal
       The popup itself shows on first visit. In light mode, soften
       the dim from rgba(0,0,0,.7) to a lighter overlay, and reskin
       the inner panel so it doesn't feel jarringly dark.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] #clauseOnboardModal {
  background: rgba(15, 23, 42, 0.36) !important;
  backdrop-filter: blur(4px);
}
body[data-theme="light"] #clauseOnboardModal .ob-inner {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18) !important;
}
body[data-theme="light"] #clauseOnboardModal .ob-inner h2 {
  color: #1f2937 !important;
}
body[data-theme="light"] #clauseOnboardModal .ob-inner p {
  color: #475569 !important;
}
body[data-theme="light"] #clauseOnboardModal #ob-cta {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark)) !important;
  color: #ffffff !important;
}
body[data-theme="light"] #clauseOnboardModal #ob-skip {
  color: #6b7280 !important;
}


/* ════════════════════════════════════════════════════════════════════
  41. ACTIVITY FEED — History view (replaces old documents-table)
       The History tab now renders a chronological event feed instead of
       a duplicate of the Documents table. Styled for both dark and light
       so the layout is intentional, not theme-dependent.
   ════════════════════════════════════════════════════════════════════ */

/* Container */
.activity-mock .activity-feed {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 18px 22px 26px;
}

/* Day-bucket header */
.activity-bucket-h {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.activity-bucket-count {
  font-size: 10.5px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  font-weight: 500;
  font-family: 'Geist', sans-serif;
  text-transform: none;
}

.activity-bucket-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Subtle vertical timeline line on the left, behind the icons */
  position: relative;
}
.activity-bucket-items::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.18), rgba(148, 163, 184, 0.04) 92%);
  border-radius: 2px;
  pointer-events: none;
}

/* Single event row */
.activity-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 0;
  border-radius: 10px;
  transition: background 0.12s ease;
  position: relative;
}
.activity-item:hover {
  background: rgba(148, 163, 184, 0.05);
}

/* Action icon disc */
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Geist', sans-serif;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.20);
  position: relative;
  z-index: 1;
}
/* Action color variants */
.activity-color-a .activity-icon { background: rgba(168, 85, 247, 0.16); color: #c4b5fd; border-color: rgba(168, 85, 247, 0.32); }
.activity-color-p .activity-icon { background: rgba(124, 58, 237, 0.20); color: #c4b5fd; border-color: rgba(124, 58, 237, 0.36); }
.activity-color-g .activity-icon { background: rgba(34, 197, 94, 0.16);  color: #86efac; border-color: rgba(34, 197, 94, 0.32);  }
.activity-color-r .activity-icon { background: rgba(244, 63, 94, 0.16);  color: #fda4af; border-color: rgba(244, 63, 94, 0.32);  }
.activity-color-b .activity-icon { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.32); }
.activity-color-n .activity-icon { /* default neutral, already covered above */ }

/* Headline + detail */
.activity-body { min-width: 0; }
.activity-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.activity-verb {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}
.activity-doc {
  font-size: 14px;
  color: #f3f4f9;
  font-weight: 500;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 380px;
}
.activity-type-pill {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}
/* Type-specific pill tints (mirror existing rowTypeClass colors) */
.activity-type-pill.invoice  { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.activity-type-pill.resume   { background: rgba(168, 85, 247, 0.15); color: #c4b5fd; }
.activity-type-pill.contract { background: rgba(244, 63, 94, 0.15);  color: #fda4af; }
.activity-type-pill.lease    { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.activity-type-pill.proposal { background: rgba(34, 197, 94, 0.15);  color: #86efac; }

.activity-detail {
  margin: 3px 0 0;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.activity-time {
  font-size: 11.5px;
  color: #6e7791;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.activity-open-btn {
  background: rgba(124, 58, 237, 0.10);
  border: 1px solid rgba(168, 85, 247, 0.30);
  color: #c4b5fd;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  font-weight: 500;
  transition: filter 0.12s ease;
}
.activity-open-btn:hover { filter: brightness(1.15); }

/* Empty state */
.activity-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 50px 24px 60px;
  gap: 12px;
  color: #94a3b8;
}
.activity-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(168, 85, 247, 0.10);
  border: 1px solid rgba(168, 85, 247, 0.25);
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #c4b5fd;
  margin-bottom: 8px;
}
.activity-empty h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #f3f4f9;
  letter-spacing: -0.01em;
}
.activity-empty p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 420px;
  color: #94a3b8;
}
.activity-empty-cta {
  margin-top: 6px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border: 0;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.32);
}

/* Clear-log button in the toolbar */
.activity-clear-btn {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fda4af;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.12s ease;
  margin-left: auto;
}
.activity-clear-btn:hover {
  background: rgba(244, 63, 94, 0.14);
}


/* ─── LIGHT MODE — activity feed ──────────────────────────────────── */
body[data-theme="light"] .activity-bucket-h {
  color: #475569;
}
body[data-theme="light"] .activity-bucket-count {
  background: rgba(168, 85, 247, 0.12);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .activity-bucket-items::before {
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.18), rgba(148, 163, 184, 0.04) 92%);
}

body[data-theme="light"] .activity-item:hover {
  background: rgba(168, 85, 247, 0.06);
}

body[data-theme="light"] .activity-icon {
  background: #faf7ff;
  color: var(--ca-accent-dark);
  border-color: var(--line);
}
body[data-theme="light"] .activity-color-a .activity-icon { background: #ede9fe; color: #6d28d9; border-color: rgba(124, 58, 237, 0.30); }
body[data-theme="light"] .activity-color-p .activity-icon { background: #ddd6fe; color: #5b21b6; border-color: rgba(124, 58, 237, 0.40); }
body[data-theme="light"] .activity-color-g .activity-icon { background: #d1fae5; color: #047857; border-color: rgba(34, 197, 94, 0.30);  }
body[data-theme="light"] .activity-color-r .activity-icon { background: #fee2e2; color: #b91c1c; border-color: rgba(244, 63, 94, 0.30);  }
body[data-theme="light"] .activity-color-b .activity-icon { background: #dbeafe; color: #0369a1; border-color: rgba(56, 189, 248, 0.30); }

body[data-theme="light"] .activity-verb { color: #6b7280; }
body[data-theme="light"] .activity-doc  { color: #1f2937; }
body[data-theme="light"] .activity-detail { color: #6b7280; }
body[data-theme="light"] .activity-time { color: #94a3b8; }

body[data-theme="light"] .activity-type-pill {
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
}
body[data-theme="light"] .activity-type-pill.invoice  { background: #dbeafe; color: #0369a1; }
body[data-theme="light"] .activity-type-pill.resume   { background: #ede9fe; color: #6d28d9; }
body[data-theme="light"] .activity-type-pill.contract { background: #fee2e2; color: #b91c1c; }
body[data-theme="light"] .activity-type-pill.lease    { background: #fef3c7; color: #b45309; }
body[data-theme="light"] .activity-type-pill.proposal { background: #d1fae5; color: #047857; }

body[data-theme="light"] .activity-open-btn {
  background: rgba(168, 85, 247, 0.10);
  border-color: rgba(124, 58, 237, 0.30);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .activity-open-btn:hover {
  background: rgba(168, 85, 247, 0.18);
}

body[data-theme="light"] .activity-empty-icon {
  background: rgba(168, 85, 247, 0.10);
  border-color: rgba(124, 58, 237, 0.30);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .activity-empty h3 { color: #1f2937; }
body[data-theme="light"] .activity-empty p  { color: #475569; }
body[data-theme="light"] .activity-empty-cta {
  background: linear-gradient(135deg, var(--ca-accent), var(--ca-accent-dark));
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.30);
}

body[data-theme="light"] .activity-clear-btn {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
body[data-theme="light"] .activity-clear-btn:hover {
  background: #fee2e2;
}


/* ════════════════════════════════════════════════════════════════════
  42. DOCUMENTS — visual differentiation from History
       The Documents table gets a "library" treatment so it doesn't read
       as a copy of History. Bigger row hover, file-icon emphasis,
       cleaner pager.
   ════════════════════════════════════════════════════════════════════ */

.documents-mock .stat-strip {
  background: rgba(148, 163, 184, 0.04);
}
.documents-mock .file-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: rgba(168, 85, 247, 0.12);
  color: #c4b5fd;
  font-size: 11px;
  margin-right: 9px;
  vertical-align: middle;
}
body[data-theme="light"] .documents-mock .file-icon {
  background: rgba(168, 85, 247, 0.10);
  color: var(--ca-accent-dark);
}

/* Selected document row — keep the highlight strong so users know
   which doc they're "in" relative to the rest of the library. */
.documents-mock .selected-doc-row td {
  background: rgba(168, 85, 247, 0.08) !important;
  border-left: 3px solid var(--ca-accent, #7c3aed) !important;
}
body[data-theme="light"] .documents-mock .selected-doc-row td {
  background: rgba(168, 85, 247, 0.10) !important;
  border-left-color: var(--ca-accent-dark) !important;
}


/* ════════════════════════════════════════════════════════════════════
  43. LIGHT MODE — v54 doc actions new buttons (v39.0.8)
       The Compose email + Upload new document buttons hardcode purple
       icon colors that work fine in dark but look off in light. Also
       give the Upload-new button a subtle warning tint so it doesn't
       get confused with a primary CTA.
   ════════════════════════════════════════════════════════════════════ */

body[data-theme="light"] .v54-email-btn i,
body[data-theme="light"] .v54-new-upload-btn i {
  color: var(--ca-accent-dark) !important;
}

body[data-theme="light"] .v54-email-btn,
body[data-theme="light"] .v54-new-upload-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #1f2937;
}
body[data-theme="light"] .v54-email-btn:hover,
body[data-theme="light"] .v54-new-upload-btn:hover {
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(124, 58, 237, 0.30);
}

/* v27-rail-cta in light mode — was `color: #e8edf6` (white-ish) on a faint
   purple tinted bg, basically invisible on the lavender body. Flip to
   dark text on a stronger purple-tinted surface. */
body[data-theme="light"] .v27-rail-cta {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .v27-rail-cta:hover {
  background: rgba(168, 85, 247, 0.06) !important;
  border-color: rgba(124, 58, 237, 0.30) !important;
}
body[data-theme="light"] .v27-rail-cta i {
  color: var(--ca-accent-dark) !important;
}


/* ════════════════════════════════════════════════════════════════════
  44. LIGHT MODE — doc-type-specific shell + analysis layout overrides
       When a contract/lease/nda or financial_analytics document is
       loaded, dashboard.html applies a different shell layout AND
       repaints the shell background dark navy. Those rules use both
       !important AND higher specificity than my plain body[data-theme]
       selectors, so light mode falls through to the dark default.

       The fix: combine [data-theme="light"][data-doc-type="..."] for
       matching specificity, with !important to beat the bake-in.
   ════════════════════════════════════════════════════════════════════ */

/* lease / contract / nda — the analysis-active dark navy shell */
body[data-theme="light"][data-doc-type="lease"] .mock-shell,
body[data-theme="light"][data-doc-type="contract"] .mock-shell,
body[data-theme="light"][data-doc-type="nda"] .mock-shell,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .mock-shell,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .mock-shell,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .mock-shell {
  background:
    radial-gradient(circle at 50% -18%, rgba(168, 85, 247, 0.10), transparent 34%),
    var(--bg) !important;
}

/* financial_analytics — same fix */
body[data-theme="light"][data-doc-type="financial_analytics"] .mock-shell {
  background:
    radial-gradient(circle at 52% 4%, rgba(168, 85, 247, 0.10), transparent 30%),
    var(--bg) !important;
}

/* Preview frame dark gradient — flip to a clean white surface so the
   document preview reads naturally. */
body[data-theme="light"][data-doc-type="lease"] .preview-frame,
body[data-theme="light"][data-doc-type="contract"] .preview-frame,
body[data-theme="light"][data-doc-type="nda"] .preview-frame,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .preview-frame,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .preview-frame,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .preview-frame {
  background: linear-gradient(180deg, #ffffff 0%, #faf7ff 100%) !important;
  border: 1px solid var(--line) !important;
}

/* Greeting copy color — was hardcoded to light-on-dark `#c9d4ee` for
   these legal types, which becomes nearly invisible on lavender. */
body[data-theme="light"][data-doc-type="lease"] .greeting p,
body[data-theme="light"][data-doc-type="contract"] .greeting p,
body[data-theme="light"][data-doc-type="nda"] .greeting p,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .greeting p,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .greeting p,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .greeting p {
  color: #475569 !important;
}
body[data-theme="light"][data-doc-type="lease"] .greeting h2,
body[data-theme="light"][data-doc-type="contract"] .greeting h2,
body[data-theme="light"][data-doc-type="nda"] .greeting h2,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .greeting h2,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .greeting h2,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .greeting h2 {
  color: #1f2937 !important;
}

/* Score card dark gradient → white card */
body[data-theme="light"][data-doc-type="lease"] .score-card,
body[data-theme="light"][data-doc-type="contract"] .score-card,
body[data-theme="light"][data-doc-type="nda"] .score-card,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .score-card,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .score-card,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .score-card {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 4px 14px rgba(76, 29, 149, 0.04) !important;
}

/* Builder CTA dark gradient → soft purple light card */
body[data-theme="light"][data-doc-type="lease"] .builder-cta,
body[data-theme="light"][data-doc-type="contract"] .builder-cta,
body[data-theme="light"][data-doc-type="nda"] .builder-cta,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .builder-cta,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .builder-cta,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .builder-cta {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.10), rgba(255, 255, 255, 1)) !important;
  border: 1px solid rgba(124, 58, 237, 0.30) !important;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.10) !important;
}

/* Lease/contract/nda source-page text — switch to dark on white */
body[data-theme="light"][data-doc-type="lease"] .source-page-canvas,
body[data-theme="light"][data-doc-type="contract"] .source-page-canvas,
body[data-theme="light"][data-doc-type="nda"] .source-page-canvas,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .source-page-canvas,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .source-page-canvas,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .source-page-canvas {
  background: #ffffff !important;
  color: #1f2937 !important;
}

/* Lease intro line — dark color override for light mode */
body[data-theme="light"][data-doc-type="lease"] .lease-intro,
body[data-theme="light"][data-doc-type="contract"] .lease-intro,
body[data-theme="light"][data-doc-type="nda"] .lease-intro,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .lease-intro,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .lease-intro,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .lease-intro {
  color: #475569 !important;
}


/* ─── Right-rail elements that get the legal-doc-type treatment ───────
   The chat panel, version chip, redline chip, workflow CTA, etc. live
   in the right rail and get specific styling for legal docs. The base
   #rp-panel-ai overrides in section 29 handle the chat panel itself,
   but lease/contract/nda have additional rules with higher specificity
   that I need to match. */

/* Chat panel (ASK MAINAI) inside legal doc layout */
body[data-theme="light"][data-doc-type="lease"] #rp-panel-ai,
body[data-theme="light"][data-doc-type="contract"] #rp-panel-ai,
body[data-theme="light"][data-doc-type="nda"] #rp-panel-ai,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] #rp-panel-ai,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] #rp-panel-ai,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] #rp-panel-ai {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}

/* AI message bubble inside the legal layout */
body[data-theme="light"][data-doc-type="lease"] .rp-ai-bubble,
body[data-theme="light"][data-doc-type="contract"] .rp-ai-bubble,
body[data-theme="light"][data-doc-type="nda"] .rp-ai-bubble,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .rp-ai-bubble,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .rp-ai-bubble,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .rp-ai-bubble {
  background: #faf7ff !important;
  color: #1f2937 !important;
  border: 1px solid var(--line) !important;
}

/* Right-rail container background for legal docs (.mock-right + .v27-rail) */
body[data-theme="light"][data-doc-type="lease"] .v27-rail,
body[data-theme="light"][data-doc-type="contract"] .v27-rail,
body[data-theme="light"][data-doc-type="nda"] .v27-rail,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="lease"] .v27-rail,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="contract"] .v27-rail,
body[data-theme="light"].adaptive-dashboard-runtime[data-doc-type="nda"] .v27-rail {
  background: transparent !important;
}

/* Version + redline + workflow chips — keep purple-tinted in light mode */
body[data-theme="light"][data-doc-type="lease"] .v34-rail-version-chip,
body[data-theme="light"][data-doc-type="contract"] .v34-rail-version-chip,
body[data-theme="light"][data-doc-type="nda"] .v34-rail-version-chip,
body[data-theme="light"][data-doc-type="lease"] .v35-rail-redline-chip,
body[data-theme="light"][data-doc-type="contract"] .v35-rail-redline-chip,
body[data-theme="light"][data-doc-type="nda"] .v35-rail-redline-chip {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  color: #1f2937 !important;
}

/* "Med" / "High" severity pills inside the legal-layout findings cards */
body[data-theme="light"][data-doc-type="lease"] .v27-pill-r,
body[data-theme="light"][data-doc-type="contract"] .v27-pill-r,
body[data-theme="light"][data-doc-type="nda"] .v27-pill-r {
  background: #fee2e2 !important; color: #b91c1c !important;
}
body[data-theme="light"][data-doc-type="lease"] .v27-pill-a,
body[data-theme="light"][data-doc-type="contract"] .v27-pill-a,
body[data-theme="light"][data-doc-type="nda"] .v27-pill-a {
  background: #fef3c7 !important; color: #b45309 !important;
}
body[data-theme="light"][data-doc-type="lease"] .v27-pill-g,
body[data-theme="light"][data-doc-type="contract"] .v27-pill-g,
body[data-theme="light"][data-doc-type="nda"] .v27-pill-g {
  background: #d1fae5 !important; color: #047857 !important;
}


/* ════════════════════════════════════════════════════════════════════
  45. ELITE MODE — v39.1.0 (the wedge)

       New components introduced by the v39.1 push:
         .v80-verb-row + .v80-verb-btn  — verb on every finding
         .v81-insights + .v81-ins-*     — cross-doc insights panel
         .v82-receipt-*                 — session receipt modal
         .v83-learn-banner + .v83-*     — decision-learning banner
         .v83-snoozed / .v83-flagged    — finding card state flags

       All styled for both dark (default) and light mode.
   ════════════════════════════════════════════════════════════════════ */

/* ─── 45.1 verb action row on finding cards ──────────────────────── */
.v80-verb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
}

.v80-verb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: rgba(124, 58, 237, 0.10);
  color: #d8b4fe;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: filter 0.12s ease, transform 0.12s ease, border-color 0.12s ease;
}
.v80-verb-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  border-color: rgba(168, 85, 247, 0.55);
}
.v80-verb-btn i { font-size: 13px; }

/* Primary verb gets gradient + glow */
.v80-verb-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
  color: #ffffff !important;
  border: 0 !important;
  font-weight: 600;
  padding: 9px 15px;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.28);
}
.v80-verb-primary:hover { box-shadow: 0 10px 24px rgba(124, 58, 237, 0.38); }
.v80-verb-chevron {
  font-weight: 700;
  margin-left: 2px;
  opacity: 0.85;
  font-size: 12px;
}

/* Hue variants — bias the primary button's gradient */
.v80-verb-primary.v80-hue-red    { background: linear-gradient(135deg, #dc2626, #b91c1c) !important; box-shadow: 0 6px 18px rgba(220, 38, 38, 0.32); }
.v80-verb-primary.v80-hue-amber  { background: linear-gradient(135deg, #d97706, #b45309) !important; box-shadow: 0 6px 18px rgba(217, 119, 6, 0.32); }
.v80-verb-primary.v80-hue-green  { background: linear-gradient(135deg, #10b981, #059669) !important; box-shadow: 0 6px 18px rgba(16, 185, 129, 0.32); }
.v80-verb-primary.v80-hue-blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32); }
.v80-verb-primary.v80-hue-purple { background: linear-gradient(135deg, #7c3aed, #a855f7) !important; }
.v80-verb-primary.v80-hue-neutral{ background: linear-gradient(135deg, #475569, #334155) !important; box-shadow: 0 6px 18px rgba(71, 85, 105, 0.32); }

/* Secondary verb (icon-only, square) */
.v80-verb-secondary {
  padding: 7px 9px;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.20);
  color: #94a3b8;
}
.v80-verb-secondary i { font-size: 14px; }

/* Snoozed / flagged finding card visual cues */
.v83-snoozed {
  opacity: 0.55;
  position: relative;
}
.v83-snoozed::after {
  content: 'SNOOZED 7d';
  position: absolute;
  top: 8px; right: 12px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  padding: 3px 7px;
  border-radius: 4px;
}
.v83-flagged {
  border-left: 3px solid #f59e0b !important;
}

/* ─── 45.2 cross-doc insights panel ──────────────────────────────── */
.v81-insights {
  margin: 0 0 22px;
  padding: 18px 20px 16px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.10), rgba(168, 85, 247, 0.04));
  box-shadow: 0 12px 30px rgba(76, 29, 149, 0.10);
}
.v81-insights-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.v81-insights-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #c4b5fd;
  background: rgba(168, 85, 247, 0.18);
  padding: 4px 9px;
  border-radius: 999px;
}
.v81-insights-eyebrow i { font-size: 11px; }
.v81-insights-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f3f4f9;
  letter-spacing: -0.01em;
}

.v81-insights-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.v81-ins {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
  padding: 11px 13px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.32);
  border: 1px solid rgba(148, 163, 184, 0.10);
}
.v81-ins-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(168, 85, 247, 0.16);
  color: #c4b5fd;
}
.v81-ins-icon i { font-size: 15px; }
.v81-ins.v81-ins-warn .v81-ins-icon { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.v81-ins.v81-ins-good .v81-ins-icon { background: rgba(34, 197, 94, 0.18);  color: #86efac; }
.v81-ins.v81-ins-info .v81-ins-icon { background: rgba(168, 85, 247, 0.18); color: #c4b5fd; }

.v81-ins-body { min-width: 0; }
.v81-ins-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.v81-ins-headline strong {
  color: #f3f4f9;
  font-size: 13px;
  font-weight: 500;
}
.v81-ins-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.v81-ins-detail {
  margin: 0;
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.55;
}
.v81-ins-action {
  margin-top: 8px;
  background: transparent;
  border: 0;
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.v81-ins-action:hover { text-decoration: underline; }

/* ─── 45.3 receipt modal ─────────────────────────────────────────── */
.v82-receipt-modal {
  position: fixed; inset: 0;
  z-index: 9700;
  background: rgba(2, 6, 18, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: v82-fade-in 0.18s ease-out;
}
@keyframes v82-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.v82-receipt-card {
  background: #0e1525;
  border: 1px solid rgba(168, 85, 247, 0.30);
  border-radius: 18px;
  padding: 32px 36px 24px;
  max-width: 760px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  position: relative;
}
.v82-receipt-head {
  margin-bottom: 22px;
}
.v82-receipt-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #c4b5fd;
  background: rgba(168, 85, 247, 0.18);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.v82-receipt-head h2 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -0.025em;
  color: #f3f4f9;
  font-weight: 600;
}
.v82-receipt-sub {
  margin: 0;
  color: #94a3b8;
  font-size: 13.5px;
  line-height: 1.55;
}
.v82-receipt-close {
  position: absolute;
  top: 18px; right: 20px;
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.v82-receipt-close:hover { background: rgba(148, 163, 184, 0.10); color: #f3f4f9; }

.v82-range-row {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  padding: 4px;
  background: rgba(15, 23, 42, 0.48);
  border-radius: 10px;
  width: fit-content;
}
.v82-range-btn {
  background: transparent;
  border: 0;
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}
.v82-range-btn:hover { color: #f3f4f9; }
.v82-range-btn.is-active {
  background: rgba(168, 85, 247, 0.22);
  color: #f3f4f9;
}

.v82-stat-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 26px;
}
.v82-stat-row article {
  padding: 14px 14px 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.42);
}
.v82-stat-label {
  display: block;
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 6px;
}
.v82-stat-row strong {
  font-size: 22px;
  color: #f3f4f9;
  letter-spacing: -0.015em;
}
.v82-stat-hi {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(15, 23, 42, 0.48)) !important;
  border-color: rgba(168, 85, 247, 0.40) !important;
}
.v82-stat-hi strong { color: #d8b4fe !important; }

.v82-doc-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.v82-doc-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.v82-doc-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.10);
  align-items: center;
}
.v82-doc-row:last-child { border-bottom: 0; }
.v82-doc-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.v82-doc-name i { color: #94a3b8; font-size: 15px; }
.v82-doc-name strong {
  color: #f3f4f9;
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}
.v82-doc-type {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.15);
  color: #c4b5fd;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.v82-doc-score {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}
.v82-doc-acts {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.v82-doc-act-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(168, 85, 247, 0.14);
  color: #d8b4fe;
  white-space: nowrap;
}
.v82-doc-empty {
  padding: 36px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  list-style: none;
}

.v82-receipt-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
}
.v82-foot-time {
  font-size: 11.5px;
  color: #94a3b8;
}
.v82-foot-actions { display: flex; gap: 8px; }
.v82-foot-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.50);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.v82-foot-btn:hover {
  background: rgba(15, 23, 42, 0.70);
  border-color: rgba(168, 85, 247, 0.40);
}
.v82-foot-btn i { font-size: 13px; }
.v82-foot-btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
  border: 0 !important;
  color: #ffffff !important;
}
.v82-foot-btn-primary:hover { filter: brightness(1.1); }

/* ─── 45.4 decision learning banner ──────────────────────────────── */
.v83-learn-banner {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(168, 85, 247, 0.36);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(124, 58, 237, 0.06));
  margin: 0 0 16px;
}
.v83-learn-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
}
.v83-learn-icon i { font-size: 17px; }
.v83-learn-body { min-width: 0; }
.v83-learn-headline {
  font-size: 13.5px;
  color: #f3f4f9;
  line-height: 1.4;
  margin-bottom: 4px;
}
.v83-learn-headline strong {
  color: #d8b4fe;
  font-weight: 700;
}
.v83-learn-sub {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
}
.v83-learn-actions { display: flex; gap: 6px; flex-shrink: 0; }
.v83-learn-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 7px;
  border: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.12s ease;
}
.v83-learn-btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
}
.v83-learn-btn-primary:hover { filter: brightness(1.1); }
.v83-learn-btn-ghost {
  background: transparent;
  color: #94a3b8;
}
.v83-learn-btn-ghost:hover { color: #f3f4f9; }


/* ─── 45.5 LIGHT MODE for all the above ──────────────────────────── */
body[data-theme="light"] .v80-verb-row {
  border-top-color: var(--line);
}
body[data-theme="light"] .v80-verb-secondary {
  border-color: var(--line);
  color: #6b7280;
}
body[data-theme="light"] .v80-verb-secondary:hover {
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(124, 58, 237, 0.30);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .v83-snoozed::after {
  background: rgba(15, 23, 42, 0.06);
  color: #6b7280;
}

body[data-theme="light"] .v81-insights {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(255, 255, 255, 1));
  border-color: rgba(168, 85, 247, 0.32);
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.08);
}
body[data-theme="light"] .v81-insights-eyebrow {
  background: rgba(168, 85, 247, 0.14);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .v81-insights-title { color: #1f2937; }
body[data-theme="light"] .v81-ins {
  background: #ffffff;
  border-color: var(--line);
}
body[data-theme="light"] .v81-ins.v81-ins-info .v81-ins-icon { background: #ede9fe; color: #6d28d9; }
body[data-theme="light"] .v81-ins.v81-ins-warn .v81-ins-icon { background: #fef3c7; color: #b45309; }
body[data-theme="light"] .v81-ins.v81-ins-good .v81-ins-icon { background: #d1fae5; color: #047857; }
body[data-theme="light"] .v81-ins-headline strong { color: #1f2937; }
body[data-theme="light"] .v81-ins-chip {
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
}
body[data-theme="light"] .v81-ins-detail { color: #475569; }
body[data-theme="light"] .v81-ins-action { color: var(--ca-accent-dark); }

body[data-theme="light"] .v82-receipt-modal {
  background: rgba(15, 23, 42, 0.32);
}
body[data-theme="light"] .v82-receipt-card {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: 0 30px 80px rgba(76, 29, 149, 0.20);
}
body[data-theme="light"] .v82-receipt-head h2 { color: #1f2937; }
body[data-theme="light"] .v82-receipt-sub { color: #475569; }
body[data-theme="light"] .v82-receipt-eyebrow {
  background: rgba(168, 85, 247, 0.12);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .v82-receipt-close { color: #6b7280; }
body[data-theme="light"] .v82-receipt-close:hover { background: rgba(168, 85, 247, 0.08); color: #1f2937; }
body[data-theme="light"] .v82-range-row {
  background: #faf7ff;
}
body[data-theme="light"] .v82-range-btn { color: #475569; }
body[data-theme="light"] .v82-range-btn:hover { color: #1f2937; }
body[data-theme="light"] .v82-range-btn.is-active {
  background: rgba(168, 85, 247, 0.18);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .v82-stat-row article {
  background: #faf7ff;
  border-color: var(--line);
}
body[data-theme="light"] .v82-stat-label { color: #6b7280; }
body[data-theme="light"] .v82-stat-row strong { color: #1f2937; }
body[data-theme="light"] .v82-stat-hi {
  background: linear-gradient(135deg, #ede9fe, #f5f3ff) !important;
  border-color: rgba(168, 85, 247, 0.40) !important;
}
body[data-theme="light"] .v82-stat-hi strong { color: #5b21b6 !important; }
body[data-theme="light"] .v82-doc-section h3 { color: #475569; }
body[data-theme="light"] .v82-doc-row { border-bottom-color: var(--line); }
body[data-theme="light"] .v82-doc-name i { color: #94a3b8; }
body[data-theme="light"] .v82-doc-name strong { color: #1f2937; }
body[data-theme="light"] .v82-doc-type {
  background: #ede9fe;
  color: #6d28d9;
}
body[data-theme="light"] .v82-doc-score { color: #6b7280; }
body[data-theme="light"] .v82-doc-act-chip {
  background: rgba(168, 85, 247, 0.10);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .v82-doc-empty { color: #6b7280; }
body[data-theme="light"] .v82-receipt-foot { border-top-color: var(--line); }
body[data-theme="light"] .v82-foot-time { color: #6b7280; }
body[data-theme="light"] .v82-foot-btn {
  background: #ffffff;
  border-color: var(--line);
  color: #1f2937;
}
body[data-theme="light"] .v82-foot-btn:hover {
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(124, 58, 237, 0.30);
}

body[data-theme="light"] .v83-learn-banner {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.10), #ffffff);
  border-color: rgba(168, 85, 247, 0.35);
}
body[data-theme="light"] .v83-learn-headline { color: #1f2937; }
body[data-theme="light"] .v83-learn-headline strong { color: var(--ca-accent-dark); }
body[data-theme="light"] .v83-learn-sub { color: #475569; }
body[data-theme="light"] .v83-learn-btn-ghost { color: #6b7280; }
body[data-theme="light"] .v83-learn-btn-ghost:hover { color: #1f2937; }


/* ════════════════════════════════════════════════════════════════════
  46. PII SHIELD — v39.1.7
       Visible trust signal: a small chip next to AI input call sites
       showing "🛡 N items will be redacted before sending". Clickable
       popover shows each match. Settings modal for category toggles.
   ════════════════════════════════════════════════════════════════════ */

/* ─── 46.1 inline shield chip ────────────────────────────────────── */
.pii-shield-chip {
  position: absolute;
  right: 56px;
  bottom: 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  background: rgba(15, 23, 42, 0.55);
  color: #94a3b8;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  z-index: 5;
}
.pii-shield-chip:hover {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(168, 85, 247, 0.35);
  color: #e2e8f0;
}
.pii-shield-icon { font-size: 12px; }
.pii-shield-label { font-size: 10px; letter-spacing: 0.02em; }
.pii-shield-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
}
.pii-shield-chip.pii-shield-active {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(168, 85, 247, 0.55);
  color: #c4b5fd;
}

/* ─── 46.2 popover ───────────────────────────────────────────────── */
.pii-shield-popover {
  width: 360px;
  max-width: 92vw;
  max-height: 420px;
  overflow-y: auto;
  background: #0e1525;
  border: 1px solid rgba(168, 85, 247, 0.30);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  font-size: 12px;
  color: #cbd5e1;
  animation: pii-fade-in 0.14s ease-out;
}
@keyframes pii-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pii-shield-pop-head strong {
  display: block;
  color: #f3f4f9;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.pii-shield-pop-head p {
  margin: 0 0 12px;
  color: #94a3b8;
  font-size: 11.5px;
  line-height: 1.5;
}
.pii-shield-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pii-shield-group {
  background: rgba(15, 23, 42, 0.50);
  border-left: 3px solid rgba(168, 85, 247, 0.55);
  border-radius: 6px;
  padding: 8px 10px;
}
.pii-shield-group.pii-shield-hue-red    { border-left-color: #ef4444; }
.pii-shield-group.pii-shield-hue-amber  { border-left-color: #f59e0b; }
.pii-shield-group.pii-shield-hue-neutral{ border-left-color: #64748b; }
.pii-shield-group-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.pii-shield-group-head strong {
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
}
.pii-shield-group-count {
  background: rgba(148, 163, 184, 0.16);
  color: #94a3b8;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}
.pii-shield-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pii-shield-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 10.5px;
}
.pii-shield-item-orig {
  color: #f87171;
  text-decoration: line-through;
  text-decoration-color: rgba(248, 113, 113, 0.55);
}
.pii-shield-item-arrow { color: #64748b; }
.pii-shield-item-token { color: #86efac; }
.pii-shield-pop-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
  text-align: right;
}
.pii-shield-link {
  background: transparent;
  border: 0;
  color: #c4b5fd;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.pii-shield-link:hover { text-decoration: underline; }

/* ─── 46.3 settings modal ────────────────────────────────────────── */
.pii-set-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 6, 18, 0.72);
  backdrop-filter: blur(8px);
  z-index: 9700;
}
.pii-set-modal {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 92vw; max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #0e1525;
  border: 1px solid rgba(168, 85, 247, 0.30);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.60);
  z-index: 9701;
  padding: 28px 32px 24px;
}
.pii-set-head { position: relative; margin-bottom: 18px; }
.pii-set-eyebrow {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.10em;
  text-transform: uppercase; color: #c4b5fd;
  background: rgba(168, 85, 247, 0.18);
  padding: 4px 10px; border-radius: 999px;
  margin-bottom: 12px;
}
.pii-set-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #f3f4f9;
  font-weight: 600;
}
.pii-set-head p {
  margin: 0;
  color: #94a3b8;
  font-size: 12.5px;
  line-height: 1.55;
}
.pii-set-close {
  position: absolute; top: 0; right: 0;
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 7px;
}
.pii-set-close:hover { background: rgba(148, 163, 184, 0.10); color: #f3f4f9; }
.pii-set-rows {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 18px;
}
.pii-set-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.10);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.pii-set-row:hover { background: rgba(15, 23, 42, 0.55); border-color: rgba(148, 163, 184, 0.20); }
.pii-set-row input[type="checkbox"] { margin: 2px 0 0; cursor: pointer; }
.pii-set-row-body strong {
  display: block;
  color: #f3f4f9;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 2px;
}
.pii-set-row-body p { margin: 0; color: #94a3b8; font-size: 11.5px; line-height: 1.5; }
.pii-set-row.pii-hue-red strong    { color: #fca5a5; }
.pii-set-row.pii-hue-amber strong  { color: #fcd34d; }
.pii-set-foot { text-align: right; }
.pii-set-done {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.pii-set-done:hover { filter: brightness(1.1); }

/* ─── 46.4 LIGHT MODE overrides ──────────────────────────────────── */
body[data-theme="light"] .pii-shield-chip {
  background: #ffffff;
  border-color: var(--line);
  color: #475569;
}
body[data-theme="light"] .pii-shield-chip:hover {
  background: #faf7ff;
  border-color: rgba(124, 58, 237, 0.40);
  color: #1f2937;
}
body[data-theme="light"] .pii-shield-chip.pii-shield-active {
  background: rgba(168, 85, 247, 0.10);
  border-color: rgba(124, 58, 237, 0.45);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .pii-shield-popover {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: 0 18px 50px rgba(76, 29, 149, 0.15);
  color: #1f2937;
}
body[data-theme="light"] .pii-shield-pop-head strong { color: #1f2937; }
body[data-theme="light"] .pii-shield-pop-head p { color: #475569; }
body[data-theme="light"] .pii-shield-group { background: #faf7ff; }
body[data-theme="light"] .pii-shield-group-head strong { color: #1f2937; }
body[data-theme="light"] .pii-shield-group-count {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}
body[data-theme="light"] .pii-shield-item-orig { color: #dc2626; }
body[data-theme="light"] .pii-shield-item-token { color: #047857; }
body[data-theme="light"] .pii-shield-pop-foot { border-top-color: var(--line); }
body[data-theme="light"] .pii-shield-link { color: var(--ca-accent-dark); }
body[data-theme="light"] .pii-set-overlay { background: rgba(15, 23, 42, 0.32); }
body[data-theme="light"] .pii-set-modal {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: 0 30px 80px rgba(76, 29, 149, 0.20);
}
body[data-theme="light"] .pii-set-eyebrow {
  background: rgba(168, 85, 247, 0.12);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .pii-set-head h2 { color: #1f2937; }
body[data-theme="light"] .pii-set-head p { color: #475569; }
body[data-theme="light"] .pii-set-close { color: #6b7280; }
body[data-theme="light"] .pii-set-close:hover { background: rgba(168, 85, 247, 0.08); color: #1f2937; }
body[data-theme="light"] .pii-set-row { border-color: var(--line); }
body[data-theme="light"] .pii-set-row:hover { background: #faf7ff; border-color: rgba(124, 58, 237, 0.30); }
body[data-theme="light"] .pii-set-row-body strong { color: #1f2937; }
body[data-theme="light"] .pii-set-row-body p { color: #475569; }
body[data-theme="light"] .pii-set-row.pii-hue-red strong   { color: #b91c1c; }
body[data-theme="light"] .pii-set-row.pii-hue-amber strong { color: #b45309; }


/* ════════════════════════════════════════════════════════════════════
  47. PRIVACY TRACK — v39.1.8
       Shred modal · Privacy Center modal · Onboarding tour popovers.
       Three distinct UI surfaces sharing a visual language:
       purple eyebrow, soft elevated card, hue-tagged severity.
   ════════════════════════════════════════════════════════════════════ */

/* ─── 47.1 Shred modal (per-doc permanent delete) ────────────────── */
.shred-modal-host { position: fixed; inset: 0; z-index: 9750; }
.shred-overlay {
  position: absolute; inset: 0;
  background: rgba(2, 6, 18, 0.78);
  backdrop-filter: blur(8px);
}
.shred-modal {
  position: relative;
  margin: 6vh auto 0;
  width: 92vw; max-width: 480px;
  background: #0e1525;
  border: 1px solid rgba(239, 68, 68, 0.30);
  border-radius: 14px;
  padding: 28px 30px 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.60),
              0 0 0 1px rgba(239, 68, 68, 0.08) inset;
  color: #e5e7eb;
}
.shred-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.shred-eyebrow-done {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
}
.shred-eyebrow-warn {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
}
.shred-modal h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: #f3f4f9;
}
.shred-sub {
  margin: 0 0 14px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.55;
}
.shred-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shred-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 7px;
  font-size: 12.5px;
  color: #cbd5e1;
}
.shred-list i { color: #94a3b8; font-size: 14px; }
.shred-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 18px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.20);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.5;
}
.shred-warn i { font-size: 14px; margin-top: 1px; flex-shrink: 0; }
.shred-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.shred-cancel {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 9px 16px;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.shred-cancel:hover { border-color: rgba(148, 163, 184, 0.45); background: rgba(148, 163, 184, 0.08); }
.shred-confirm {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.shred-confirm:hover { filter: brightness(1.10); }
.shred-confirm:disabled { opacity: 0.65; cursor: wait; }
.shred-report {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shred-report li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 7px;
  font-size: 12.5px;
}
.shred-rep-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 11px;
}
.shred-rep-ok .shred-rep-icon { background: rgba(34, 197, 94, 0.25); color: #86efac; }
.shred-rep-skip .shred-rep-icon { background: rgba(148, 163, 184, 0.20); color: #94a3b8; }
.shred-report small {
  margin-left: auto;
  color: #94a3b8;
  font-size: 11px;
}

/* ─── 47.2 Privacy Center modal ──────────────────────────────────── */
.privctr-host { position: fixed; inset: 0; z-index: 9760; }
.privctr-overlay {
  position: absolute; inset: 0;
  background: rgba(2, 6, 18, 0.72);
  backdrop-filter: blur(8px);
}
.privctr-modal {
  position: relative;
  margin: 5vh auto 0;
  width: 94vw; max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #0e1525;
  border: 1px solid rgba(168, 85, 247, 0.30);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.62);
  color: #e5e7eb;
  overflow: hidden;
}
.privctr-head {
  padding: 26px 30px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.10);
  position: relative;
}
.privctr-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: #c4b5fd;
  background: rgba(168, 85, 247, 0.16);
  padding: 4px 10px; border-radius: 999px;
  margin-bottom: 10px;
}
.privctr-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.025em;
  color: #f3f4f9;
}
.privctr-sub {
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.55;
  max-width: 520px;
}
.privctr-close-btn {
  position: absolute;
  top: 20px; right: 22px;
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 24px;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
}
.privctr-close-btn:hover { background: rgba(148, 163, 184, 0.10); color: #f3f4f9; }
.privctr-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}
.privctr-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.privctr-tab i { font-size: 15px; }
.privctr-tab:hover { color: #cbd5e1; }
.privctr-tab.is-active {
  color: #c4b5fd;
  border-bottom-color: #a855f7;
}
.privctr-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 30px 20px;
}
.privctr-section { display: flex; flex-direction: column; gap: 12px; }
.privctr-intro {
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
}
.privctr-intro em { color: #cbd5e1; font-style: normal; font-weight: 600; }
.privctr-empty {
  margin: 0;
  padding: 24px 18px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 8px;
  border: 1px dashed rgba(148, 163, 184, 0.18);
}
.privctr-empty-row {
  padding: 24px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}
.privctr-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.privctr-row:hover { background: rgba(15, 23, 42, 0.55); border-color: rgba(148, 163, 184, 0.22); }
.privctr-row input[type="checkbox"] { margin: 2px 0 0; cursor: pointer; accent-color: #a855f7; }
.privctr-row strong {
  display: block;
  color: #f3f4f9;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.privctr-row p { margin: 0; color: #94a3b8; font-size: 11.5px; line-height: 1.5; }
.privctr-row.privctr-hue-red strong    { color: #fca5a5; }
.privctr-row.privctr-hue-amber strong  { color: #fcd34d; }

/* Audit tab */
.privctr-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}
.privctr-audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: rgba(15, 23, 42, 0.50);
  border-radius: 7px;
  border-left: 3px solid rgba(168, 85, 247, 0.40);
}
.privctr-audit-main strong {
  color: #f3f4f9;
  font-size: 13px;
  font-weight: 600;
}
.privctr-audit-doc {
  display: block;
  color: #94a3b8;
  font-size: 11.5px;
  margin-top: 2px;
}
.privctr-audit-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  white-space: nowrap;
}
.privctr-audit-meta time {
  color: #94a3b8;
  font-size: 11px;
}
.privctr-pii-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(168, 85, 247, 0.15);
  color: #c4b5fd;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}
.privctr-pii-chip.privctr-pii-none {
  background: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
  font-weight: 500;
}

/* Export tab */
.privctr-export-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.privctr-export-stats > div {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}
.privctr-export-stats strong {
  display: block;
  font-size: 24px;
  color: #c4b5fd;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.privctr-export-stats span {
  display: block;
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.privctr-export-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.privctr-export-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.privctr-export-btn:hover {
  border-color: rgba(168, 85, 247, 0.40);
  background: rgba(168, 85, 247, 0.06);
}
.privctr-export-btn i { font-size: 18px; color: #c4b5fd; flex-shrink: 0; }
.privctr-export-btn strong { display: block; font-weight: 600; color: #f3f4f9; }
.privctr-export-btn span { display: block; color: #94a3b8; font-size: 11.5px; margin-top: 2px; }

/* Reset tab */
.privctr-doc-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 40vh;
  overflow-y: auto;
}
.privctr-doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 7px;
}
.privctr-doc-row strong {
  color: #f3f4f9;
  font-size: 12.5px;
  font-weight: 500;
}
.privctr-doc-type {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  background: rgba(168, 85, 247, 0.16);
  color: #c4b5fd;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.privctr-shred-btn {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fca5a5;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.12s, border-color 0.12s;
}
.privctr-shred-btn:hover {
  background: rgba(239, 68, 68, 0.20);
  border-color: rgba(239, 68, 68, 0.50);
}
.privctr-nuclear {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 9px;
}
.privctr-nuclear strong {
  display: block;
  color: #fca5a5;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.privctr-nuclear p {
  margin: 0;
  color: #94a3b8;
  font-size: 11.5px;
  line-height: 1.5;
}
.privctr-nuclear-btn {
  flex-shrink: 0;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border: 0;
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.privctr-nuclear-btn:hover { filter: brightness(1.10); }

/* Common footer */
.privctr-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
}
.privctr-done {
  margin-left: auto;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: 0;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
}
.privctr-done:hover { filter: brightness(1.10); }
.privctr-link {
  background: transparent;
  border: 0;
  color: #c4b5fd;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.privctr-link:hover { text-decoration: underline; }

/* ─── 47.3 Onboarding tour ───────────────────────────────────────── */
.tour-halo {
  position: fixed;
  z-index: 9990;
  border-radius: 10px;
  pointer-events: none;
  box-shadow:
    0 0 0 9999px rgba(2, 6, 18, 0.72),
    0 0 0 2px rgba(168, 85, 247, 0.85),
    0 0 32px rgba(168, 85, 247, 0.45);
  animation: tour-halo-pulse 2s ease-in-out infinite;
}
@keyframes tour-halo-pulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(2, 6, 18, 0.72),
                          0 0 0 2px rgba(168, 85, 247, 0.85),
                          0 0 32px rgba(168, 85, 247, 0.45); }
  50%      { box-shadow: 0 0 0 9999px rgba(2, 6, 18, 0.72),
                          0 0 0 3px rgba(168, 85, 247, 1.0),
                          0 0 44px rgba(168, 85, 247, 0.70); }
}
.tour-popover {
  width: 340px;
  max-width: 90vw;
  background: #0e1525;
  border: 1px solid rgba(168, 85, 247, 0.42);
  border-radius: 12px;
  padding: 18px 20px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.60);
  color: #e5e7eb;
  animation: tour-pop-in 0.20s ease-out;
}
@keyframes tour-pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.tour-pop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.tour-pop-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #ffffff;
  display: grid; place-items: center;
  font-size: 16px;
}
.tour-pop-step {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tour-pop-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: #f3f4f9;
  letter-spacing: -0.01em;
}
.tour-pop-body {
  margin: 0 0 14px;
  color: #cbd5e1;
  font-size: 12.5px;
  line-height: 1.55;
}
.tour-pop-body em {
  color: #c4b5fd;
  font-style: normal;
  font-weight: 600;
}
.tour-pop-progress {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
}
.tour-pop-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.30);
  transition: background 0.2s;
}
.tour-pop-dot.is-active { background: #a855f7; width: 18px; border-radius: 3px; }
.tour-pop-dot.is-done   { background: rgba(168, 85, 247, 0.50); }
.tour-pop-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tour-skip {
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
}
.tour-skip:hover { color: #cbd5e1; text-decoration: underline; }
.tour-pop-nav { display: flex; gap: 6px; }
.tour-btn {
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.32);
  color: #c4b5fd;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  padding: 6px 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.tour-btn:hover {
  background: rgba(168, 85, 247, 0.22);
  border-color: rgba(168, 85, 247, 0.50);
}
.tour-btn.tour-next, .tour-btn.tour-done {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-color: transparent;
  color: #ffffff;
}
.tour-btn.tour-next:hover, .tour-btn.tour-done:hover { filter: brightness(1.10); }

/* ─── 47.4 LIGHT MODE overrides ──────────────────────────────────── */
body[data-theme="light"] .shred-modal {
  background: #ffffff;
  border-color: rgba(220, 38, 38, 0.30);
  color: #1f2937;
  box-shadow: 0 30px 80px rgba(127, 29, 29, 0.18);
}
body[data-theme="light"] .shred-modal h2 { color: #1f2937; }
body[data-theme="light"] .shred-sub { color: #475569; }
body[data-theme="light"] .shred-list li { background: #fef2f2; color: #1f2937; }
body[data-theme="light"] .shred-list i { color: #6b7280; }
body[data-theme="light"] .shred-eyebrow { background: rgba(220, 38, 38, 0.10); color: #b91c1c; }
body[data-theme="light"] .shred-eyebrow-done { background: rgba(34, 197, 94, 0.10); color: #047857; }
body[data-theme="light"] .shred-eyebrow-warn { background: rgba(245, 158, 11, 0.10); color: #b45309; }
body[data-theme="light"] .shred-warn { background: #fef2f2; border-color: rgba(220, 38, 38, 0.20); color: #b91c1c; }
body[data-theme="light"] .shred-cancel { border-color: #d1d5db; color: #374151; }
body[data-theme="light"] .shred-cancel:hover { background: #f3f4f6; border-color: #9ca3af; }
body[data-theme="light"] .shred-report li { background: #f9fafb; color: #1f2937; }
body[data-theme="light"] .shred-report small { color: #6b7280; }

body[data-theme="light"] .privctr-modal {
  background: #ffffff;
  border-color: var(--line);
  color: #1f2937;
  box-shadow: 0 30px 80px rgba(76, 29, 149, 0.18);
}
body[data-theme="light"] .privctr-overlay { background: rgba(15, 23, 42, 0.42); }
body[data-theme="light"] .privctr-head { border-bottom-color: var(--line); }
body[data-theme="light"] .privctr-eyebrow {
  background: rgba(168, 85, 247, 0.12);
  color: var(--ca-accent-dark);
}
body[data-theme="light"] .privctr-head h2 { color: #1f2937; }
body[data-theme="light"] .privctr-sub { color: #475569; }
body[data-theme="light"] .privctr-close-btn { color: #6b7280; }
body[data-theme="light"] .privctr-close-btn:hover { background: rgba(168, 85, 247, 0.08); color: #1f2937; }
body[data-theme="light"] .privctr-tabs { border-bottom-color: var(--line); }
body[data-theme="light"] .privctr-tab { color: #6b7280; }
body[data-theme="light"] .privctr-tab:hover { color: #1f2937; }
body[data-theme="light"] .privctr-tab.is-active { color: var(--ca-accent-dark); border-bottom-color: var(--ca-accent); }
body[data-theme="light"] .privctr-intro { color: #475569; }
body[data-theme="light"] .privctr-intro em { color: #1f2937; }
body[data-theme="light"] .privctr-empty,
body[data-theme="light"] .privctr-empty-row { background: #faf7ff; color: #6b7280; border-color: rgba(168, 85, 247, 0.20); }
body[data-theme="light"] .privctr-row { border-color: var(--line); }
body[data-theme="light"] .privctr-row:hover { background: #faf7ff; border-color: rgba(168, 85, 247, 0.32); }
body[data-theme="light"] .privctr-row strong { color: #1f2937; }
body[data-theme="light"] .privctr-row p { color: #475569; }
body[data-theme="light"] .privctr-row.privctr-hue-red strong   { color: #b91c1c; }
body[data-theme="light"] .privctr-row.privctr-hue-amber strong { color: #b45309; }
body[data-theme="light"] .privctr-audit-row { background: #faf7ff; border-left-color: var(--ca-accent); }
body[data-theme="light"] .privctr-audit-main strong { color: #1f2937; }
body[data-theme="light"] .privctr-audit-doc { color: #6b7280; }
body[data-theme="light"] .privctr-audit-meta time { color: #6b7280; }
body[data-theme="light"] .privctr-pii-chip { background: rgba(168, 85, 247, 0.14); color: var(--ca-accent-dark); }
body[data-theme="light"] .privctr-pii-chip.privctr-pii-none { background: #f3f4f6; color: #6b7280; }
body[data-theme="light"] .privctr-export-stats > div { background: #faf7ff; border-color: var(--line); }
body[data-theme="light"] .privctr-export-stats strong { color: var(--ca-accent-dark); }
body[data-theme="light"] .privctr-export-stats span { color: #6b7280; }
body[data-theme="light"] .privctr-export-btn { background: #faf7ff; border-color: var(--line); color: #1f2937; }
body[data-theme="light"] .privctr-export-btn:hover { border-color: rgba(168, 85, 247, 0.40); }
body[data-theme="light"] .privctr-export-btn i { color: var(--ca-accent-dark); }
body[data-theme="light"] .privctr-export-btn strong { color: #1f2937; }
body[data-theme="light"] .privctr-export-btn span { color: #6b7280; }
body[data-theme="light"] .privctr-doc-row { background: #faf7ff; }
body[data-theme="light"] .privctr-doc-row strong { color: #1f2937; }
body[data-theme="light"] .privctr-doc-type { background: rgba(168, 85, 247, 0.12); color: var(--ca-accent-dark); }
body[data-theme="light"] .privctr-shred-btn { background: #fef2f2; border-color: rgba(220, 38, 38, 0.30); color: #b91c1c; }
body[data-theme="light"] .privctr-shred-btn:hover { background: #fee2e2; border-color: rgba(220, 38, 38, 0.50); }
body[data-theme="light"] .privctr-nuclear { background: #fef2f2; border-color: rgba(220, 38, 38, 0.22); }
body[data-theme="light"] .privctr-nuclear strong { color: #b91c1c; }
body[data-theme="light"] .privctr-nuclear p { color: #6b7280; }
body[data-theme="light"] .privctr-foot { border-top-color: var(--line); }
body[data-theme="light"] .privctr-link { color: var(--ca-accent-dark); }

body[data-theme="light"] .tour-halo {
  box-shadow:
    0 0 0 9999px rgba(15, 23, 42, 0.55),
    0 0 0 2px var(--ca-accent),
    0 0 32px rgba(168, 85, 247, 0.50);
}
body[data-theme="light"] .tour-popover {
  background: #ffffff;
  border-color: rgba(168, 85, 247, 0.40);
  color: #1f2937;
  box-shadow: 0 18px 50px rgba(76, 29, 149, 0.22);
}
body[data-theme="light"] .tour-pop-step { color: #6b7280; }
body[data-theme="light"] .tour-pop-title { color: #1f2937; }
body[data-theme="light"] .tour-pop-body { color: #475569; }
body[data-theme="light"] .tour-pop-body em { color: var(--ca-accent-dark); }
body[data-theme="light"] .tour-pop-dot { background: rgba(148, 163, 184, 0.30); }
body[data-theme="light"] .tour-pop-dot.is-active { background: var(--ca-accent); }
body[data-theme="light"] .tour-pop-dot.is-done { background: rgba(168, 85, 247, 0.45); }
body[data-theme="light"] .tour-skip { color: #6b7280; }
body[data-theme="light"] .tour-skip:hover { color: #1f2937; }
body[data-theme="light"] .tour-btn { background: rgba(168, 85, 247, 0.10); border-color: rgba(168, 85, 247, 0.30); color: var(--ca-accent-dark); }
body[data-theme="light"] .tour-btn:hover { background: rgba(168, 85, 247, 0.18); border-color: rgba(168, 85, 247, 0.50); }

/* ════════════════════════════════════════════════════════════════
   Section 48 — Counterparty Memory (v39.2.0)
   ════════════════════════════════════════════════════════════════
   The relationship view: list of every party the user has dealt
   with, with detail pages per party showing full doc history and
   insights. Dark mode default; light mode overrides at the end. */

.cp-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 32px 80px 32px;
  color: var(--ca-text, #e6e8f0);
}

/* ─── List view header ─── */
.cp-header {
  margin-bottom: 24px;
}
.cp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(165, 166, 246, 0.85);
  margin-bottom: 8px;
}
.cp-eyebrow i { font-size: 14px; }
.cp-header h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ca-text, #f3f4f8);
  letter-spacing: -0.01em;
}
.cp-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(204, 204, 220, 0.78);
  max-width: 680px;
}
.cp-subtitle em {
  font-style: normal;
  color: rgba(165, 166, 246, 0.95);
  font-weight: 500;
}

/* ─── Toolbar (search + filter + sort) ─── */
.cp-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 18px 0;
  flex-wrap: wrap;
}
.cp-search {
  flex: 1 1 280px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ca-text, #e6e8f0);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.cp-search:focus {
  border-color: rgba(120, 121, 240, 0.45);
  background: rgba(255, 255, 255, 0.06);
}
.cp-filters {
  display: inline-flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px;
}
.cp-filter-btn {
  background: transparent;
  border: none;
  color: rgba(204, 204, 220, 0.72);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.cp-filter-btn:hover { color: var(--ca-text, #f3f4f8); }
.cp-filter-btn.is-active {
  background: rgba(120, 121, 240, 0.18);
  color: #c4c5fa;
}
.cp-sort { display: inline-flex; }
.cp-sort-select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--ca-text, #e6e8f0);
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

/* ─── Card list ─── */
.cp-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cp-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  color: inherit;
  font: inherit;
}
.cp-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(120, 121, 240, 0.28);
  transform: translateY(-1px);
}
.cp-card-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.cp-icon-organization { background: rgba(120, 121, 240, 0.14); color: #93c5fd; }
.cp-icon-person       { background: rgba(34, 197, 94, 0.14);  color: #6ee7a3; }
.cp-icon-institution  { background: rgba(234, 179, 8, 0.14);  color: #fbcd47; }
.cp-icon-property     { background: rgba(168, 85, 247, 0.14); color: #d3a7ff; }
.cp-card-body { flex: 1 1 auto; min-width: 0; }
.cp-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ca-text, #f3f4f8);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-card-meta {
  font-size: 11px;
  color: rgba(204, 204, 220, 0.62);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cp-card-sep { opacity: 0.5; }
.cp-card-role { text-transform: capitalize; }
.cp-card-insight {
  margin-top: 5px;
  font-size: 12px;
  color: rgba(165, 166, 246, 0.88);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.cp-card-arrow {
  flex: none;
  color: rgba(204, 204, 220, 0.42);
  font-size: 16px;
}
.cp-card:hover .cp-card-arrow { color: rgba(165, 166, 246, 0.85); }

/* ─── Empty state ─── */
.cp-empty {
  text-align: center;
  padding: 56px 24px 40px 24px;
  color: rgba(204, 204, 220, 0.7);
  max-width: 520px;
  margin: 30px auto;
}
.cp-empty-icon {
  font-size: 36px;
  color: rgba(120, 121, 240, 0.42);
  margin-bottom: 14px;
}
.cp-empty h3 {
  margin: 0 0 10px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ca-text, #f3f4f8);
}
.cp-empty p {
  margin: 0 0 10px 0;
  font-size: 13px;
  line-height: 1.55;
}
.cp-empty-hint {
  font-size: 12px;
  color: rgba(204, 204, 220, 0.5);
}
.cp-empty-filtered { padding: 40px 24px; }
.cp-link {
  background: none;
  border: none;
  color: rgba(165, 166, 246, 0.95);
  cursor: pointer;
  text-decoration: underline;
  font-size: 13px;
  padding: 0;
}

/* ─── Detail view ─── */
.cp-detail-back-row { margin-bottom: 14px; }
.cp-back-btn {
  background: none;
  border: none;
  color: rgba(204, 204, 220, 0.7);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  transition: color 0.12s;
}
.cp-back-btn:hover { color: rgba(165, 166, 246, 0.95); }
.cp-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.cp-detail-icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.cp-detail-titleblock { flex: 1 1 auto; min-width: 0; }
.cp-detail-titleblock h1 {
  margin: 0 0 6px 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ca-text, #f3f4f8);
}
.cp-detail-meta {
  font-size: 12px;
  color: rgba(204, 204, 220, 0.68);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.cp-detail-sep { opacity: 0.5; }
.cp-detail-role { text-transform: capitalize; }
.cp-aliases {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(204, 204, 220, 0.52);
  font-style: italic;
}
.cp-detail-actions {
  flex: none;
  display: flex;
  gap: 8px;
}
.cp-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--ca-text, #e6e8f0);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.cp-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(120, 121, 240, 0.35);
}
.cp-action-danger {
  color: rgba(239, 68, 68, 0.85);
  border-color: rgba(239, 68, 68, 0.20);
}
.cp-action-danger:hover {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.45);
}

/* ─── Detail grid ─── */
.cp-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 24px;
}
@media (max-width: 820px) {
  .cp-detail-grid { grid-template-columns: 1fr; }
}
.cp-detail-col { display: flex; flex-direction: column; gap: 20px; }
.cp-section {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 18px;
}
.cp-section h2 {
  margin: 0 0 14px 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(204, 204, 220, 0.88);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Insights list ─── */
.cp-insights {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cp-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(230, 232, 240, 0.9);
}
.cp-insight i {
  margin-top: 2px;
  font-size: 14px;
  flex: none;
  color: rgba(165, 166, 246, 0.75);
}
.cp-insight-outstanding i { color: rgba(251, 205, 71, 0.95); }
.cp-insight-pattern i { color: rgba(110, 231, 163, 0.9); }
.cp-insight-context i { color: rgba(120, 121, 240, 0.75); }
.cp-insight-empty {
  list-style: none;
  font-size: 12px;
  color: rgba(204, 204, 220, 0.52);
  font-style: italic;
  line-height: 1.5;
}
.cp-notes {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(230, 232, 240, 0.85);
  white-space: pre-wrap;
}

/* ─── Document history list ─── */
.cp-doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cp-doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
  color: inherit;
  font: inherit;
}
.cp-doc-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(120, 121, 240, 0.3);
}
.cp-doc-info { flex: 1 1 auto; min-width: 0; }
.cp-doc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ca-text, #f3f4f8);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-doc-meta {
  font-size: 11px;
  color: rgba(204, 204, 220, 0.6);
  display: flex;
  gap: 6px;
  align-items: center;
}
.cp-doc-type {
  background: rgba(120, 121, 240, 0.14);
  color: #93c5fd;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.04em;
}
.cp-doc-sep { opacity: 0.5; }
.cp-doc-score {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  color: rgba(110, 231, 163, 0.95);
  background: rgba(34, 197, 94, 0.10);
  border-radius: 5px;
  padding: 4px 8px;
}
.cp-doc-arrow {
  flex: none;
  color: rgba(204, 204, 220, 0.42);
  font-size: 14px;
}
.cp-doc-empty {
  font-size: 12px;
  color: rgba(204, 204, 220, 0.5);
  font-style: italic;
  padding: 10px 0;
}

/* ─── Edit modal ─── */
.cp-edit-host {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cp-edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}
.cp-edit-modal {
  position: relative;
  background: #1a1b2e;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 24px 26px;
  width: min(90vw, 460px);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.cp-edit-modal h2 {
  margin: 0 0 18px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ca-text, #f3f4f8);
}
.cp-edit-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(204, 204, 220, 0.75);
  margin-bottom: 14px;
}
.cp-edit-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: rgba(204, 204, 220, 0.5);
  margin-left: 6px;
}
.cp-edit-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--ca-text, #e6e8f0);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}
.cp-edit-input:focus { border-color: rgba(120, 121, 240, 0.5); }
.cp-edit-textarea { min-height: 80px; resize: vertical; }
.cp-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.cp-edit-cancel, .cp-edit-save {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--ca-text, #e6e8f0);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 7px;
  cursor: pointer;
}
.cp-edit-save {
  background: rgba(120, 121, 240, 0.85);
  border-color: rgba(120, 121, 240, 0.85);
  color: #0a0a1a;
}
.cp-edit-save:hover { background: rgba(165, 166, 246, 1); }

/* ═══════════ Light mode overrides ═══════════ */
body[data-theme="light"] .cp-view { color: #1f2937; }
body[data-theme="light"] .cp-header h1 { color: #0f1117; }
body[data-theme="light"] .cp-subtitle { color: #4b5563; }
body[data-theme="light"] .cp-subtitle em { color: #6366f1; }
body[data-theme="light"] .cp-eyebrow { color: #6366f1; }
body[data-theme="light"] .cp-search,
body[data-theme="light"] .cp-sort-select {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}
body[data-theme="light"] .cp-search:focus { border-color: #818cf8; }
body[data-theme="light"] .cp-filters {
  background: #f9fafb;
  border-color: #e5e7eb;
}
body[data-theme="light"] .cp-filter-btn { color: #6b7280; }
body[data-theme="light"] .cp-filter-btn:hover { color: #1f2937; }
body[data-theme="light"] .cp-filter-btn.is-active {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}
body[data-theme="light"] .cp-card {
  background: #ffffff;
  border-color: #e5e7eb;
}
body[data-theme="light"] .cp-card:hover {
  background: #f9fafb;
  border-color: #c7d2fe;
}
body[data-theme="light"] .cp-card-name { color: #0f1117; }
body[data-theme="light"] .cp-card-meta { color: #6b7280; }
body[data-theme="light"] .cp-card-insight { color: #6366f1; }
body[data-theme="light"] .cp-icon-organization { background: rgba(99, 102, 241, 0.10); color: #4f46e5; }
body[data-theme="light"] .cp-icon-person       { background: rgba(34, 197, 94, 0.10);  color: #16a34a; }
body[data-theme="light"] .cp-icon-institution  { background: rgba(234, 179, 8, 0.10);  color: #ca8a04; }
body[data-theme="light"] .cp-icon-property     { background: rgba(168, 85, 247, 0.10); color: #9333ea; }
body[data-theme="light"] .cp-empty { color: #6b7280; }
body[data-theme="light"] .cp-empty h3 { color: #0f1117; }
body[data-theme="light"] .cp-empty-icon { color: rgba(99, 102, 241, 0.5); }
body[data-theme="light"] .cp-empty-hint { color: #9ca3af; }
body[data-theme="light"] .cp-link { color: #6366f1; }
body[data-theme="light"] .cp-detail-header { border-bottom-color: #e5e7eb; }
body[data-theme="light"] .cp-detail-titleblock h1 { color: #0f1117; }
body[data-theme="light"] .cp-detail-meta { color: #6b7280; }
body[data-theme="light"] .cp-aliases { color: #9ca3af; }
body[data-theme="light"] .cp-back-btn { color: #6b7280; }
body[data-theme="light"] .cp-back-btn:hover { color: #6366f1; }
body[data-theme="light"] .cp-action-btn {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}
body[data-theme="light"] .cp-action-btn:hover {
  background: #f9fafb;
  border-color: #818cf8;
}
body[data-theme="light"] .cp-action-danger {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.25);
}
body[data-theme="light"] .cp-action-danger:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.5);
}
body[data-theme="light"] .cp-section {
  background: #ffffff;
  border-color: #e5e7eb;
}
body[data-theme="light"] .cp-section h2 { color: #4b5563; }
body[data-theme="light"] .cp-insight { color: #1f2937; }
body[data-theme="light"] .cp-insight-context i { color: #6366f1; }
body[data-theme="light"] .cp-insight-empty { color: #9ca3af; }
body[data-theme="light"] .cp-notes { color: #1f2937; }
body[data-theme="light"] .cp-doc-row {
  background: #ffffff;
  border-color: #e5e7eb;
}
body[data-theme="light"] .cp-doc-row:hover {
  background: #f9fafb;
  border-color: #c7d2fe;
}
body[data-theme="light"] .cp-doc-name { color: #0f1117; }
body[data-theme="light"] .cp-doc-meta { color: #6b7280; }
body[data-theme="light"] .cp-doc-type { background: rgba(99, 102, 241, 0.10); color: #4f46e5; }
body[data-theme="light"] .cp-doc-score { background: rgba(34, 197, 94, 0.10); color: #16a34a; }
body[data-theme="light"] .cp-doc-empty { color: #9ca3af; }
body[data-theme="light"] .cp-edit-modal {
  background: #ffffff;
  border-color: #e5e7eb;
}
body[data-theme="light"] .cp-edit-modal h2 { color: #0f1117; }
body[data-theme="light"] .cp-edit-label { color: #4b5563; }
body[data-theme="light"] .cp-edit-hint { color: #9ca3af; }
body[data-theme="light"] .cp-edit-input {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}
body[data-theme="light"] .cp-edit-input:focus { border-color: #818cf8; }
body[data-theme="light"] .cp-edit-cancel {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}
body[data-theme="light"] .cp-edit-save {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}
body[data-theme="light"] .cp-edit-save:hover { background: #4f46e5; }

/* ════════════════════════════════════════════════════════════════
   Section 49 — Pre-commit Checkpoint (v39.2.1)
   ════════════════════════════════════════════════════════════════ */

.chk-host {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.chk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 16, 0.72);
  backdrop-filter: blur(4px);
}
.chk-modal {
  position: relative;
  background: #14152a;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  width: min(92vw, 720px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.chk-modal-scroll {
  overflow-y: auto;
  padding: 32px 36px 24px 36px;
}
.chk-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  background: transparent;
  border: none;
  color: rgba(204, 204, 220, 0.55);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 2;
}
.chk-close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(204, 204, 220, 0.95);
}

/* ─── Header ─── */
.chk-header { margin-bottom: 20px; }
.chk-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(165, 166, 246, 0.9);
  margin-bottom: 6px;
}
.chk-header h2 {
  margin: 0 0 6px 0;
  font-size: 24px;
  font-weight: 700;
  color: #f3f4f8;
  letter-spacing: -0.01em;
}
.chk-doc-context {
  margin: 0;
  font-size: 13px;
  color: rgba(204, 204, 220, 0.75);
}
.chk-doc-context strong { color: #f3f4f8; font-weight: 600; }
.chk-doc-type {
  color: rgba(204, 204, 220, 0.5);
  font-size: 12px;
  text-transform: uppercase;
  margin-left: 4px;
}

/* ─── Verdict banner ─── */
.chk-verdict {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 10px;
  margin-bottom: 24px;
  border: 1px solid;
}
.chk-verdict-high-confidence {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.30);
}
.chk-verdict-consider {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.30);
}
.chk-verdict-review-needed {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.32);
}
.chk-verdict-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}
.chk-verdict-high-confidence .chk-verdict-icon {
  background: rgba(34, 197, 94, 0.18);
  color: #6ee7a3;
}
.chk-verdict-consider .chk-verdict-icon {
  background: rgba(234, 179, 8, 0.20);
  color: #fbcd47;
}
.chk-verdict-review-needed .chk-verdict-icon {
  background: rgba(239, 68, 68, 0.20);
  color: #fca5a5;
}
.chk-verdict-body { flex: 1 1 auto; padding-top: 4px; }
.chk-verdict-label {
  font-size: 15px;
  font-weight: 600;
  color: #f3f4f8;
}
.chk-verdict-concerns {
  font-size: 12px;
  color: rgba(204, 204, 220, 0.78);
  margin-top: 4px;
  line-height: 1.5;
}

/* ─── Sections ─── */
.chk-section { margin-bottom: 24px; }
.chk-section-title {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(230, 232, 240, 0.92);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chk-count {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(204, 204, 220, 0.85);
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.chk-count-warn {
  background: rgba(234, 179, 8, 0.16);
  color: #fbcd47;
}
.chk-optional {
  font-weight: 400;
  font-size: 11px;
  color: rgba(204, 204, 220, 0.5);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}
.chk-empty {
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: rgba(204, 204, 220, 0.7);
  line-height: 1.5;
}

/* ─── Outstanding items list ─── */
.chk-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chk-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 3px solid transparent;
}
.chk-sev-high { border-left-color: rgba(239, 68, 68, 0.75); background: rgba(239, 68, 68, 0.05); }
.chk-sev-medium { border-left-color: rgba(234, 179, 8, 0.75); background: rgba(234, 179, 8, 0.05); }
.chk-sev-flagged { border-left-color: rgba(120, 121, 240, 0.75); background: rgba(120, 121, 240, 0.05); }
.chk-sev-low { border-left-color: rgba(148, 163, 184, 0.5); }

.chk-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.chk-sev-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(204, 204, 220, 0.85);
}
.chk-sev-high .chk-sev-pill {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}
.chk-sev-medium .chk-sev-pill {
  background: rgba(234, 179, 8, 0.18);
  color: #fbcd47;
}
.chk-sev-flagged .chk-sev-pill {
  background: rgba(120, 121, 240, 0.18);
  color: #93c5fd;
}
.chk-item-title {
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 600;
  color: #f3f4f8;
}
.chk-item-detail {
  font-size: 12px;
  color: rgba(204, 204, 220, 0.75);
  line-height: 1.55;
}

/* ─── Structure check ─── */
.chk-structure-ok {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.20);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: rgba(230, 232, 240, 0.9);
}
.chk-check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.20);
  color: #6ee7a3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.chk-struct-block { margin-bottom: 12px; }
.chk-struct-block:last-child { margin-bottom: 0; }
.chk-struct-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(204, 204, 220, 0.7);
  margin-bottom: 6px;
}
.chk-struct-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.chk-struct-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 0;
}
.chk-miss-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(234, 179, 8, 0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}
.chk-missing-item { color: rgba(251, 205, 71, 0.92); }
.chk-pres-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.20);
  color: #6ee7a3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
}
.chk-present-item { color: rgba(204, 204, 220, 0.75); }

/* ─── Counterparty context ─── */
.chk-cp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chk-cp {
  background: rgba(120, 121, 240, 0.05);
  border: 1px solid rgba(120, 121, 240, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
}
.chk-cp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.chk-cp-name {
  font-size: 13px;
  font-weight: 600;
  color: #f3f4f8;
}
.chk-cp-role {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #93c5fd;
  background: rgba(120, 121, 240, 0.15);
  padding: 2px 7px;
  border-radius: 4px;
}
.chk-cp-notes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chk-cp-notes li {
  font-size: 12px;
  color: rgba(204, 204, 220, 0.85);
  line-height: 1.5;
}
.chk-cp-notes li::before {
  content: '·';
  margin-right: 6px;
  color: rgba(165, 166, 246, 0.6);
}
.chk-cp-empty {
  font-size: 12px;
  color: rgba(204, 204, 220, 0.6);
  font-style: italic;
}

/* ─── Changes ─── */
.chk-changes {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.chk-changes-unchanged {
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.18);
  color: rgba(230, 232, 240, 0.92);
}
.chk-changes-changed {
  background: rgba(234, 179, 8, 0.06);
  border: 1px solid rgba(234, 179, 8, 0.25);
  color: rgba(230, 232, 240, 0.92);
}
.chk-changes-first {
  background: rgba(120, 121, 240, 0.05);
  border-color: rgba(120, 121, 240, 0.20);
}
.chk-changes-icon {
  flex: none;
  font-size: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chk-changes-unchanged .chk-changes-icon {
  background: rgba(34, 197, 94, 0.2);
  color: #6ee7a3;
}
.chk-changes-changed .chk-changes-icon {
  background: rgba(234, 179, 8, 0.2);
  color: #fbcd47;
}
.chk-changes-first .chk-changes-icon {
  background: rgba(120, 121, 240, 0.2);
  color: #93c5fd;
}

/* ─── Reasoning textarea ─── */
.chk-textarea {
  width: 100%;
  min-height: 70px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 10px 12px;
  color: #e6e8f0;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.chk-textarea:focus { border-color: rgba(120, 121, 240, 0.5); }

/* ─── Action buttons ─── */
.chk-actions {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  flex-wrap: wrap;
}
.chk-btn {
  flex: 1 1 220px;
  padding: 13px 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.chk-btn:hover { transform: translateY(-1px); }
.chk-btn:active { transform: translateY(0); }
.chk-btn-hold {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(230, 232, 240, 0.92);
}
.chk-btn-hold:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}
.chk-btn-proceed {
  background: rgba(120, 121, 240, 0.9);
  border-color: rgba(120, 121, 240, 0.95);
  color: #0a0a1a;
}
.chk-btn-proceed:hover {
  background: rgba(165, 166, 246, 1);
  border-color: rgba(165, 166, 246, 1);
}

/* ═══════════ Light mode overrides ═══════════ */
body[data-theme="light"] .chk-overlay { background: rgba(15, 17, 23, 0.55); }
body[data-theme="light"] .chk-modal {
  background: #ffffff;
  border-color: #e5e7eb;
}
body[data-theme="light"] .chk-close-btn { color: #9ca3af; }
body[data-theme="light"] .chk-close-btn:hover {
  background: #f3f4f6;
  color: #1f2937;
}
body[data-theme="light"] .chk-eyebrow { color: #6366f1; }
body[data-theme="light"] .chk-header h2 { color: #0f1117; }
body[data-theme="light"] .chk-doc-context { color: #4b5563; }
body[data-theme="light"] .chk-doc-context strong { color: #0f1117; }
body[data-theme="light"] .chk-doc-type { color: #9ca3af; }
body[data-theme="light"] .chk-verdict-high-confidence {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.35);
}
body[data-theme="light"] .chk-verdict-consider {
  background: rgba(234, 179, 8, 0.10);
  border-color: rgba(234, 179, 8, 0.40);
}
body[data-theme="light"] .chk-verdict-review-needed {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
}
body[data-theme="light"] .chk-verdict-high-confidence .chk-verdict-icon { color: #16a34a; }
body[data-theme="light"] .chk-verdict-consider .chk-verdict-icon { color: #ca8a04; }
body[data-theme="light"] .chk-verdict-review-needed .chk-verdict-icon { color: #dc2626; }
body[data-theme="light"] .chk-verdict-label { color: #0f1117; }
body[data-theme="light"] .chk-verdict-concerns { color: #4b5563; }
body[data-theme="light"] .chk-section-title { color: #1f2937; }
body[data-theme="light"] .chk-count {
  background: #f3f4f6;
  color: #4b5563;
}
body[data-theme="light"] .chk-count-warn {
  background: rgba(234, 179, 8, 0.15);
  color: #92400e;
}
body[data-theme="light"] .chk-optional { color: #9ca3af; }
body[data-theme="light"] .chk-empty {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
}
body[data-theme="light"] .chk-item {
  background: #ffffff;
  border-color: #e5e7eb;
}
body[data-theme="light"] .chk-sev-high { background: rgba(239, 68, 68, 0.05); }
body[data-theme="light"] .chk-sev-medium { background: rgba(234, 179, 8, 0.05); }
body[data-theme="light"] .chk-sev-flagged { background: rgba(99, 102, 241, 0.05); }
body[data-theme="light"] .chk-sev-high .chk-sev-pill { background: rgba(239, 68, 68, 0.10); color: #b91c1c; }
body[data-theme="light"] .chk-sev-medium .chk-sev-pill { background: rgba(234, 179, 8, 0.12); color: #a16207; }
body[data-theme="light"] .chk-sev-flagged .chk-sev-pill { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
body[data-theme="light"] .chk-item-title { color: #0f1117; }
body[data-theme="light"] .chk-item-detail { color: #4b5563; }
body[data-theme="light"] .chk-structure-ok {
  background: rgba(34, 197, 94, 0.07);
  border-color: rgba(34, 197, 94, 0.25);
  color: #1f2937;
}
body[data-theme="light"] .chk-struct-label { color: #6b7280; }
body[data-theme="light"] .chk-missing-item { color: #a16207; }
body[data-theme="light"] .chk-present-item { color: #4b5563; }
body[data-theme="light"] .chk-cp {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.20);
}
body[data-theme="light"] .chk-cp-name { color: #0f1117; }
body[data-theme="light"] .chk-cp-role { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
body[data-theme="light"] .chk-cp-notes li { color: #4b5563; }
body[data-theme="light"] .chk-cp-notes li::before { color: #818cf8; }
body[data-theme="light"] .chk-cp-empty { color: #9ca3af; }
body[data-theme="light"] .chk-changes { color: #1f2937; }
body[data-theme="light"] .chk-changes-unchanged {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.22);
}
body[data-theme="light"] .chk-changes-changed {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.28);
}
body[data-theme="light"] .chk-changes-first {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.22);
}
body[data-theme="light"] .chk-textarea {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}
body[data-theme="light"] .chk-textarea:focus { border-color: #818cf8; }
body[data-theme="light"] .chk-actions { border-top-color: #e5e7eb; }
body[data-theme="light"] .chk-btn-hold {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}
body[data-theme="light"] .chk-btn-hold:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
body[data-theme="light"] .chk-btn-proceed {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}
body[data-theme="light"] .chk-btn-proceed:hover {
  background: #4f46e5;
  border-color: #4f46e5;
}

/* Doc-action toolbar button (the trigger) */
.v54-doc-action.chk-trigger {
  color: rgba(165, 166, 246, 0.95);
}
.v54-doc-action.chk-trigger:hover {
  background: rgba(120, 121, 240, 0.12);
}

/* ════════════════════════════════════════════════════════════════
   Section 50 — Plain Language Layer (v39.2.4)
   ════════════════════════════════════════════════════════════════ */

/* Toolbar toggle button */
.v54-doc-action.pl-toggle.is-active {
  background: rgba(110, 231, 163, 0.10);
  border-color: rgba(110, 231, 163, 0.35);
  color: #6ee7a3;
}
.v54-doc-action.pl-toggle.is-active:hover {
  background: rgba(110, 231, 163, 0.15);
}

/* Container that has been rewritten */
.pl-rewritten {
  position: relative;
}

/* Each rewritten term — subtle underline so the user knows
   they're not reading the original verbatim, but unobtrusive
   enough not to feel like an annotation overlay. */
.pl-term {
  border-bottom: 1px dotted rgba(110, 231, 163, 0.55);
  cursor: help;
  transition: background 0.12s, border-bottom-color 0.12s;
  padding-bottom: 1px;
}
.pl-term:hover {
  background: rgba(110, 231, 163, 0.10);
  border-bottom-color: rgba(110, 231, 163, 0.95);
}

/* Light mode */
body[data-theme="light"] .v54-doc-action.pl-toggle.is-active {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.35);
  color: #16a34a;
}
body[data-theme="light"] .v54-doc-action.pl-toggle.is-active:hover {
  background: rgba(34, 197, 94, 0.14);
}
body[data-theme="light"] .pl-term {
  border-bottom-color: rgba(22, 163, 74, 0.55);
}
body[data-theme="light"] .pl-term:hover {
  background: rgba(22, 163, 74, 0.08);
  border-bottom-color: rgba(22, 163, 74, 0.95);
}

/* ─── v39.2.7 — Counterparty doc banner ──────────────────────────────
   Moment-of-truth callout that appears inside the analysis view when
   the active doc is linked to a known counterparty. Visual hierarchy
   intentionally sits ABOVE the cross-doc insights panel and BELOW the
   risk score — it's the next thing the user should read after the
   headline number.

   Tone: cyan/teal accent (distinct from the violet cross-doc panel
   and the amber/red severity colors used for findings). Counterparty
   context is a "knowledge" signal, not a "warning" signal — color
   choice reflects that. */
.v92-cp-banner {
  margin: 0 0 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.10), rgba(56, 189, 248, 0.04));
  border: 1px solid rgba(34, 211, 238, 0.28);
  box-shadow: 0 12px 30px rgba(8, 47, 73, 0.10);
  overflow: hidden;
}
.v92-cp-body {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 20px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background 0.15s;
}
.v92-cp-body:hover { background: rgba(34, 211, 238, 0.04); }
.v92-cp-body:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.45);
  outline-offset: -2px;
}

.v92-cp-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.v92-cp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.16);
  padding: 4px 9px;
  border-radius: 999px;
}
.v92-cp-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}
.v92-cp-name {
  font-size: 16px;
  font-weight: 600;
  color: #f3f4f9;
  letter-spacing: -0.01em;
}
.v92-cp-meta {
  font-size: 12px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.v92-cp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.v92-cp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.35;
  background: rgba(15, 23, 42, 0.32);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #e2e8f0;
}
.v92-cp-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.v92-cp-chip-warn { border-color: rgba(245, 158, 11, 0.30); }
.v92-cp-chip-warn .v92-cp-chip-icon {
  background: rgba(245, 158, 11, 0.20);
  color: #fcd34d;
}
.v92-cp-chip-good { border-color: rgba(34, 197, 94, 0.30); }
.v92-cp-chip-good .v92-cp-chip-icon {
  background: rgba(34, 197, 94, 0.20);
  color: #86efac;
}
.v92-cp-chip-info { border-color: rgba(34, 211, 238, 0.30); }
.v92-cp-chip-info .v92-cp-chip-icon {
  background: rgba(34, 211, 238, 0.20);
  color: #67e8f9;
}

.v92-cp-firstdoc {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
  margin-bottom: 10px;
}

.v92-cp-cta {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: #67e8f9;
  letter-spacing: 0.01em;
}
.v92-cp-body:hover .v92-cp-cta { color: #22d3ee; }

/* Light-theme variant — soften the cyan to a slate-blue and lift the
   chip backgrounds for legibility on a white surface. */
body[data-theme="light"] .v92-cp-banner {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.06), rgba(56, 189, 248, 0.02));
  border-color: rgba(8, 145, 178, 0.22);
  box-shadow: 0 4px 14px rgba(8, 47, 73, 0.04);
}
body[data-theme="light"] .v92-cp-body:hover { background: rgba(8, 145, 178, 0.04); }
body[data-theme="light"] .v92-cp-eyebrow {
  color: #0e7490;
  background: rgba(8, 145, 178, 0.12);
}
body[data-theme="light"] .v92-cp-name { color: #0f172a; }
body[data-theme="light"] .v92-cp-meta { color: #64748b; }
body[data-theme="light"] .v92-cp-chip {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.30);
  color: #1e293b;
}
body[data-theme="light"] .v92-cp-chip-warn .v92-cp-chip-icon {
  background: rgba(245, 158, 11, 0.18); color: #b45309;
}
body[data-theme="light"] .v92-cp-chip-good .v92-cp-chip-icon {
  background: rgba(34, 197, 94, 0.18); color: #166534;
}
body[data-theme="light"] .v92-cp-chip-info .v92-cp-chip-icon {
  background: rgba(8, 145, 178, 0.18); color: #0e7490;
}
body[data-theme="light"] .v92-cp-firstdoc { color: #64748b; }
body[data-theme="light"] .v92-cp-cta { color: #0e7490; }
body[data-theme="light"] .v92-cp-body:hover .v92-cp-cta { color: #155e75; }

/* ─── v39.2.7 — Counterparties list-view "+ New" button ────────────
   Lives in the header row next to the title. Lets the user create a
   counterparty manually for cases where auto-extraction missed (no
   role labels, scanned PDF, informal naming). */
.cp-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.cp-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid rgba(120, 121, 240, 0.4);
  box-shadow: 0 4px 14px rgba(91, 91, 214, 0.30);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.cp-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 91, 214, 0.40);
}
.cp-add-btn i { font-size: 14px; }

/* Error state for the create-modal name field. */
.cp-edit-input-error {
  border-color: rgba(239, 68, 68, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

body[data-theme="light"] .cp-add-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.20);
}

/* ─── v39.2.7 — Attach-prompt + picker (no-link state) ─────────────
   Shown when the active doc has no counterparty linked. Lighter weight
   than the full banner because it's an action, not a finding. */
.v92-cp-wrap { position: relative; }
.v92-cp-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 10px;
  margin-top: -8px;
}
.v92-cp-action-link {
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  letter-spacing: 0.01em;
}
.v92-cp-action-link:hover { color: #67e8f9; background: rgba(34, 211, 238, 0.06); }
body[data-theme="light"] .v92-cp-action-link { color: #64748b; }
body[data-theme="light"] .v92-cp-action-link:hover { color: #0e7490; background: rgba(8, 145, 178, 0.05); }

.v92-cp-attach-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.32);
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
}
.v92-cp-attach-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.12);
  color: #67e8f9;
  font-size: 16px;
  font-weight: 500;
  flex-shrink: 0;
}
.v92-cp-attach-text {
  flex: 1;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.4;
}
.v92-cp-attach-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #67e8f9;
  background: transparent;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.v92-cp-attach-btn:hover {
  background: rgba(34, 211, 238, 0.10);
  color: #22d3ee;
}
body[data-theme="light"] .v92-cp-attach-prompt {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.40);
}
body[data-theme="light"] .v92-cp-attach-icon {
  background: rgba(8, 145, 178, 0.10); color: #0e7490;
}
body[data-theme="light"] .v92-cp-attach-text { color: #475569; }
body[data-theme="light"] .v92-cp-attach-btn {
  color: #0e7490; border-color: rgba(8, 145, 178, 0.40);
}
body[data-theme="light"] .v92-cp-attach-btn:hover {
  background: rgba(8, 145, 178, 0.08); color: #155e75;
}

/* Picker modal — lists existing counterparties for the user to pick. */
.v92-cp-picker-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
}
.v92-cp-picker-list li + li {
  border-top: 1px solid rgba(148, 163, 184, 0.10);
}
.v92-cp-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: inherit;
  transition: background 0.10s;
}
.v92-cp-picker-row:hover { background: rgba(34, 211, 238, 0.06); }
.v92-cp-picker-name { color: #f3f4f9; font-weight: 500; }
.v92-cp-picker-meta { color: #94a3b8; font-size: 11px; font-variant-numeric: tabular-nums; }
.v92-cp-picker-empty {
  font-size: 13px; color: #94a3b8; padding: 12px;
  text-align: center; margin: 0 0 12px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 8px;
}
body[data-theme="light"] .v92-cp-picker-list { border-color: rgba(148, 163, 184, 0.30); }
body[data-theme="light"] .v92-cp-picker-list li + li { border-top-color: rgba(148, 163, 184, 0.22); }
body[data-theme="light"] .v92-cp-picker-row:hover { background: rgba(8, 145, 178, 0.05); }
body[data-theme="light"] .v92-cp-picker-name { color: #0f172a; }
body[data-theme="light"] .v92-cp-picker-meta { color: #64748b; }
body[data-theme="light"] .v92-cp-picker-empty { color: #64748b; border-color: rgba(148, 163, 184, 0.40); }

/* ─── v39.2.8 — Dashboard Tools card (Compare docs entry point) ───
   Lives in the v52-landing area as the right-hand column on the bottom
   row, pairing visually with Your Projects. Replaces the sidebar
   "Compare docs" entry that was removed to reduce sidebar clutter. */
.v52-landing-compare .v52-landing-head h3 {
  /* same spacing as the other landing columns */
}
.v52-tool-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  padding: 18px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(91, 91, 214, 0.08), rgba(120, 121, 240, 0.03));
  border: 1px solid rgba(120, 121, 240, 0.22);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.v52-tool-card:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 121, 240, 0.40);
  background: linear-gradient(135deg, rgba(91, 91, 214, 0.12), rgba(120, 121, 240, 0.05));
  box-shadow: 0 8px 24px rgba(91, 91, 214, 0.15);
}
.v52-tool-card:focus-visible {
  outline: 2px solid rgba(120, 121, 240, 0.5);
  outline-offset: 2px;
}
.v52-tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(91, 91, 214, 0.25), rgba(120, 121, 240, 0.12));
  color: #93c5fd;
}
.v52-tool-icon svg { width: 24px; height: 24px; }
.v52-tool-body { min-width: 0; }
.v52-tool-title {
  font-size: 14px;
  font-weight: 600;
  color: #f3f4f9;
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.v52-tool-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
}
.v52-tool-cta {
  font-size: 12px;
  font-weight: 500;
  color: #93c5fd;
  white-space: nowrap;
  align-self: center;
  flex-shrink: 0;
}
.v52-tool-card:hover .v52-tool-cta { color: #c7c8ff; }

/* Light theme */
body[data-theme="light"] .v52-tool-card {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.04), rgba(99, 102, 241, 0.02));
  border-color: rgba(79, 70, 229, 0.18);
}
body[data-theme="light"] .v52-tool-card:hover {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(99, 102, 241, 0.04));
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.10);
}
body[data-theme="light"] .v52-tool-icon {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(99, 102, 241, 0.08));
  color: #4f46e5;
}
body[data-theme="light"] .v52-tool-title { color: #1f2937; }
body[data-theme="light"] .v52-tool-desc { color: #475569; }
body[data-theme="light"] .v52-tool-cta { color: #4f46e5; }
body[data-theme="light"] .v52-tool-card:hover .v52-tool-cta { color: #4338ca; }

/* Make the bottom row a balanced 2-column grid (was 1-column when
   Projects was alone). Mobile collapses to single column via the
   existing v52-landing responsive breakpoint, if any — but in case
   that breakpoint isn't defined, fall back to single column under
   720px. */
@media (max-width: 900px) {
  .v52-landing-row { grid-template-columns: 1fr !important; }
}

/* ─── v39.2.10 — Unify doc-action toolbar button styling ───────────
   The toolbar below the doc card mixed wildly different styles across
   variants:
     - chk-trigger:           subtle purple text, no bg
     - pl-toggle (inactive):  inherited base, no bg
     - v31-rail-export-chip:  plain gray surface (export review chip)
     - v32-rail-project-chip: plain gray surface (add-to-project chip)
     - v27-rail-cta:          STRONG PURPLE bg (the doc-type primary CTA —
                              "Export syllabus summary" for syllabus,
                              "Draft negotiation email" for NDA, etc.)
     - v54-email-btn:         inherited base
     - v54-new-upload-btn:    inherited base
   The result was a row where some buttons looked "primary" and others
   looked dim, with no consistent visual logic. These are all SECONDARY
   actions on a doc dashboard — the primary actions live in the right
   rail and in the document body (Build course plan, Run review, etc.).
   Neutralize them all to a uniform surface; hierarchy comes from icon
   + label, not from a paint-bucket fill.
   Specificity: stack two classes to outrank both .v54-doc-actions >
   .v54-doc-action and the per-variant rules.
   ═════════════════════════════════════════════════════════════════ */
.v54-doc-actions > .v54-doc-action,
.v54-doc-actions > .v54-doc-action.chk-trigger,
.v54-doc-actions > .v54-doc-action.v27-rail-cta,
.v54-doc-actions > .v54-doc-action.v31-rail-export-chip,
.v54-doc-actions > .v54-doc-action.v32-rail-project-chip,
.v54-doc-actions > .v54-doc-action.v54-email-btn,
.v54-doc-actions > .v54-doc-action.v54-new-upload-btn {
  background: rgba(148, 163, 184, 0.06) !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  color: #e8edf6 !important;
}
.v54-doc-actions > .v54-doc-action:hover {
  background: rgba(120, 121, 240, 0.10) !important;
  border-color: rgba(168, 85, 247, 0.40) !important;
  filter: none;  /* override the rail's brightness(1.15) which combined
                    with our hover bg produced a washed-out look */
}

/* Icon tone — the only color signal in the row. Subtle lavender on
   the icon glyph, uniform across all variants. Tabler webfont icons
   and inline SVG icons both pick this up. */
.v54-doc-actions > .v54-doc-action > i,
.v54-doc-actions > .v54-doc-action > svg,
.v54-doc-actions > .v54-doc-action .v31-rail-export-icon,
.v54-doc-actions > .v54-doc-action .v32-rail-project-dot {
  color: #c4b5fd !important;
}

/* Plain English's "is-active" pressed state stays distinct — it's a
   stateful toggle, not a static action, so it has earned its own
   color. The green still wins over the neutral baseline. */
.v54-doc-actions > .v54-doc-action.pl-toggle.is-active {
  background: rgba(110, 231, 163, 0.10) !important;
  border-color: rgba(110, 231, 163, 0.35) !important;
  color: #6ee7a3 !important;
}
.v54-doc-actions > .v54-doc-action.pl-toggle.is-active:hover {
  background: rgba(110, 231, 163, 0.15) !important;
  border-color: rgba(110, 231, 163, 0.50) !important;
}

/* Light theme: same neutralization on a light surface. */
body[data-theme="light"] .v54-doc-actions > .v54-doc-action,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action.chk-trigger,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action.v27-rail-cta,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action.v31-rail-export-chip,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action.v32-rail-project-chip,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action.v54-email-btn,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action.v54-new-upload-btn {
  background: #ffffff !important;
  border-color: rgba(148, 163, 184, 0.30) !important;
  color: #1f2937 !important;
}
body[data-theme="light"] .v54-doc-actions > .v54-doc-action:hover {
  background: rgba(79, 70, 229, 0.06) !important;
  border-color: rgba(79, 70, 229, 0.35) !important;
}
body[data-theme="light"] .v54-doc-actions > .v54-doc-action > i,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action > svg,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action .v31-rail-export-icon,
body[data-theme="light"] .v54-doc-actions > .v54-doc-action .v32-rail-project-dot {
  color: #4f46e5 !important;
}

/* ─── v39.2.10 — Restored-doc preview placeholder ──────────────────
   Shown in the preview pane when activeDocumentState was restored but
   the visual source isn't available (PDF canvas image, blob URL, and
   data URL all get stripped before localStorage persist so the quota
   doesn't blow on a multi-MB doc). Replaces the previously-broken
   black-rectangle preview with a clear status card and a re-upload
   action. */
.restored-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 24px;
  margin: 12px;
  min-height: 240px;
  background: rgba(148, 163, 184, 0.04);
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  color: #e8edf6;
}
.restored-preview-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(91, 91, 214, 0.14);
  color: #93c5fd;
  margin-bottom: 14px;
}
.restored-preview-icon svg { width: 26px; height: 26px; }
.restored-preview-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
  color: #f3f4f9;
}
.restored-preview-name {
  font-size: 12px;
  color: #94a3b8;
  margin: 0 0 12px;
  word-break: break-word;
  max-width: 100%;
}
.restored-preview-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
  margin: 0 0 16px;
  max-width: 320px;
}
.restored-preview-cta {
  padding: 9px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border: 1px solid rgba(120, 121, 240, 0.45);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.restored-preview-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(91, 91, 214, 0.32);
}

body[data-theme="light"] .restored-preview-card {
  background: #fafafa;
  border-color: rgba(148, 163, 184, 0.40);
  color: #1f2937;
}
body[data-theme="light"] .restored-preview-icon {
  background: rgba(79, 70, 229, 0.10);
  color: #4f46e5;
}
body[data-theme="light"] .restored-preview-title { color: #0f172a; }
body[data-theme="light"] .restored-preview-name { color: #64748b; }
body[data-theme="light"] .restored-preview-body { color: #475569; }
body[data-theme="light"] .restored-preview-cta {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.20);
}

/* ─── v39.2.10 — Documents page head actions (Upload + Compare) ────
   The Documents page top-bar previously had only "Upload New Document"
   as a single primary button. v39.2.10 adds "Compare two documents"
   as a secondary action next to it so the pair lives where the user
   is already looking at their document library — the natural place
   to ask "I want to diff two of these." Pair styling: primary uses
   accent purple, secondary uses neutral surface with a hover hint
   so it reads as related-but-secondary. */
.docs-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.docs-head-secondary,
.docs-head-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.005em;
  transition: background 0.15s, border-color 0.15s, transform 0.10s;
  white-space: nowrap;
}
.docs-head-secondary {
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.20);
  color: #e8edf6;
}
.docs-head-secondary:hover {
  background: rgba(120, 121, 240, 0.10);
  border-color: rgba(168, 85, 247, 0.40);
  color: #f3f4f9;
}
.docs-head-secondary svg { color: #c4b5fd; }
.docs-head-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border: 1px solid rgba(120, 121, 240, 0.45);
  box-shadow: 0 4px 14px rgba(91, 91, 214, 0.25);
}
.docs-head-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 91, 214, 0.40);
}

/* On narrow viewports, stack so neither truncates. */
@media (max-width: 720px) {
  .docs-head-actions { flex-direction: column; align-items: stretch; }
  .docs-head-secondary, .docs-head-primary { justify-content: center; }
}

/* Light theme */
body[data-theme="light"] .docs-head-secondary {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.35);
  color: #1f2937;
}
body[data-theme="light"] .docs-head-secondary:hover {
  background: rgba(79, 70, 229, 0.06);
  border-color: rgba(79, 70, 229, 0.40);
  color: #0f172a;
}
body[data-theme="light"] .docs-head-secondary svg { color: #4f46e5; }
body[data-theme="light"] .docs-head-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.18);
}

/* ════════════════════════════════════════════════════════════════════
   v39.3.0 — Time Machine (Timeline view + dashboard banner)
   The forward calendar of every obligation across every doc the user
   has analyzed. Style language: cyan-blue for "knowledge/timeline"
   signals (distinct from counterparty's cyan-teal and findings'
   amber/red). Tight typography, monospace tabular dates, severity-
   coded type chips.
   ════════════════════════════════════════════════════════════════════ */

/* ─── Dashboard banner (v52 landing surface) ─────────────────── */
.v93-ob-banner {
  margin: 0 0 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.10), rgba(96, 165, 250, 0.04));
  border: 1px solid rgba(59, 130, 246, 0.28);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
  overflow: hidden;
}
.v93-ob-body {
  display: block; width: 100%; text-align: left;
  padding: 16px 20px 14px; background: transparent; border: 0;
  cursor: pointer; color: inherit; font: inherit;
  transition: background 0.15s;
}
.v93-ob-body:hover { background: rgba(59, 130, 246, 0.05); }
.v93-ob-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px;
  margin-bottom: 8px;
}
.v93-ob-eyebrow {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.18);
  padding: 4px 9px; border-radius: 999px;
}
.v93-ob-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}
.v93-ob-summary {
  font-size: 15px; font-weight: 600; color: #f3f4f9;
  letter-spacing: -0.005em;
}
.v93-ob-preview {
  font-size: 12.5px; color: #cbd5e1;
  margin-bottom: 10px; line-height: 1.45;
}
.v93-ob-preview-title { font-weight: 600; color: #94a3b8; }
.v93-ob-preview-text { color: #e2e8f0; }
.v93-ob-cta {
  display: inline-block; font-size: 12px; font-weight: 500;
  color: #93c5fd; letter-spacing: 0.01em;
}
.v93-ob-body:hover .v93-ob-cta { color: #60a5fa; }

body[data-theme="light"] .v93-ob-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(59, 130, 246, 0.02));
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}
body[data-theme="light"] .v93-ob-body:hover { background: rgba(37, 99, 235, 0.04); }
body[data-theme="light"] .v93-ob-eyebrow { color: #1d4ed8; background: rgba(37, 99, 235, 0.12); }
body[data-theme="light"] .v93-ob-summary { color: #0f172a; }
body[data-theme="light"] .v93-ob-preview-title { color: #64748b; }
body[data-theme="light"] .v93-ob-preview-text { color: #1e293b; }
body[data-theme="light"] .v93-ob-cta { color: #1d4ed8; }
body[data-theme="light"] .v93-ob-body:hover .v93-ob-cta { color: #1e40af; }

/* ─── Timeline view (the full page) ──────────────────────────── */
.ob-view {
  padding: 0 0 60px;
  max-width: 1100px;
  margin: 0 auto;
  color: #e8edf6;
}

/* Header */
.ob-header { padding: 24px 0 18px; }
.ob-header-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap; margin-bottom: 18px;
}
.ob-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #93c5fd; margin-bottom: 8px;
}
.ob-eyebrow svg { width: 13px; height: 13px; }
.ob-view h1 {
  font-size: 28px; font-weight: 600; letter-spacing: -0.015em;
  margin: 0 0 8px; color: #f3f4f9;
}
.ob-subtitle {
  font-size: 14px; color: #94a3b8; max-width: 600px;
  line-height: 1.5; margin: 0;
}
.ob-subtitle strong { color: #cbd5e1; font-weight: 600; }
.ob-add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; font-size: 13px; font-weight: 500;
  border: 1px solid rgba(120, 121, 240, 0.45);
  box-shadow: 0 4px 14px rgba(91, 91, 214, 0.25);
  cursor: pointer; flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ob-add-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(91, 91, 214, 0.40); }
.ob-add-btn svg { width: 14px; height: 14px; }

/* Stats strip */
.ob-stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 14px;
}
.ob-stat {
  padding: 14px 16px; border-radius: 10px;
  background: rgba(148, 163, 184, 0.04);
  border: 0.5px solid rgba(148, 163, 184, 0.16);
}
.ob-stat-num {
  font-size: 22px; font-weight: 600; color: #f3f4f9;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.ob-stat-label {
  font-size: 11px; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px;
}

/* Filter row */
.ob-filter-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 0.5px solid rgba(148, 163, 184, 0.14);
}
.ob-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #cbd5e1; font-size: 12.5px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ob-filter-btn:hover { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.30); color: #f3f4f9; }
.ob-filter-btn.active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}
.ob-filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; padding: 0 6px; border-radius: 999px;
  background: rgba(15, 23, 42, 0.40); color: inherit;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* Timeline buckets */
.ob-timeline { padding: 18px 0 0; display: flex; flex-direction: column; gap: 22px; }
.ob-bucket {}
.ob-bucket-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 0 0 10px; margin-bottom: 8px;
  border-bottom: 0.5px solid rgba(148, 163, 184, 0.10);
}
.ob-bucket-head h2 {
  font-size: 13px; font-weight: 600; margin: 0;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #cbd5e1;
}
.ob-bucket-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: rgba(59, 130, 246, 0.16); color: #93c5fd;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ob-bucket-hint {
  font-size: 11px; color: #6b7280; font-style: italic; margin-left: auto;
}
.ob-bucket-urgent .ob-bucket-head h2 { color: #fca5a5; }
.ob-bucket-urgent .ob-bucket-count {
  background: rgba(239, 68, 68, 0.16); color: #fca5a5;
}
.ob-bucket-list, .ob-flat-list {
  display: flex; flex-direction: column; gap: 8px;
}

/* Obligation card */
.ob-card {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(148, 163, 184, 0.04);
  border: 0.5px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.ob-card:hover { border-color: rgba(59, 130, 246, 0.35); }
.ob-overdue { border-left: 3px solid rgba(239, 68, 68, 0.65); padding-left: 13px; }
.ob-sev-warn { border-left: 3px solid rgba(245, 158, 11, 0.55); padding-left: 13px; }
.ob-sev-good { border-left: 3px solid rgba(34, 197, 94, 0.55); padding-left: 13px; }
.ob-sev-info { border-left: 3px solid rgba(59, 130, 246, 0.55); padding-left: 13px; }
.ob-overdue.ob-overdue { border-left-color: rgba(239, 68, 68, 0.75); }

.ob-date-col { display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.ob-date {
  font-size: 13px; font-weight: 600; color: #f3f4f9;
  font-variant-numeric: tabular-nums; line-height: 1.25;
}
.ob-rel {
  font-size: 11px; color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.ob-body { min-width: 0; }
.ob-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 5px; }
.ob-type-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.ob-type-warn { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.ob-type-good { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.ob-type-info { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
.ob-overdue-chip {
  background: rgba(239, 68, 68, 0.18); color: #fca5a5;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.ob-cp-chip {
  font-size: 11px; color: #67e8f9;
  background: rgba(34, 211, 238, 0.10);
  padding: 2px 8px; border-radius: 4px;
  border: 0.5px solid rgba(34, 211, 238, 0.25);
  cursor: pointer; transition: background 0.10s;
}
.ob-cp-chip:hover { background: rgba(34, 211, 238, 0.18); }
.ob-title {
  font-size: 14px; font-weight: 500; margin: 0 0 4px;
  color: #f3f4f9; line-height: 1.35;
}
.ob-desc {
  font-size: 12px; color: #94a3b8; line-height: 1.4;
  margin: 0 0 6px; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ob-source { font-size: 11px; }
.ob-source-link, .ob-source-manual {
  display: inline-flex; align-items: center; gap: 5px;
  color: #94a3b8; background: transparent;
  border: 0; padding: 2px 0; cursor: pointer; font-family: inherit;
}
.ob-source-link svg { width: 11px; height: 11px; flex-shrink: 0; }
.ob-source-link:hover { color: #93c5fd; }
.ob-source-manual { font-style: italic; cursor: default; }
.ob-snoozed-note {
  display: block; font-size: 11px; color: #6b7280;
  font-style: italic; margin-top: 6px;
}

/* Per-card actions */
.ob-actions { display: flex; gap: 4px; align-items: flex-start; flex-shrink: 0; }
.ob-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 6px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: #cbd5e1; font-size: 11.5px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ob-action:hover {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.30);
  color: #86efac;
}
.ob-action svg { width: 12px; height: 12px; }
.ob-action-danger:hover {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.30);
  color: #fca5a5;
}

/* Empty state */
.ob-empty {
  text-align: center; padding: 50px 24px;
  max-width: 540px; margin: 40px auto;
  background: rgba(148, 163, 184, 0.03);
  border: 1px dashed rgba(148, 163, 184, 0.20);
  border-radius: 14px;
}
.ob-empty-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: inline-grid; place-items: center;
  background: rgba(59, 130, 246, 0.10); color: #93c5fd;
  margin-bottom: 14px;
}
.ob-empty-icon svg { width: 28px; height: 28px; }
.ob-empty h3 { font-size: 17px; font-weight: 600; margin: 0 0 8px; color: #f3f4f9; }
.ob-empty p {
  font-size: 13px; color: #94a3b8; line-height: 1.55;
  margin: 0 auto 18px; max-width: 420px;
}
.ob-empty-cta {
  padding: 10px 20px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; font-size: 13px; font-weight: 500;
  border: 1px solid rgba(120, 121, 240, 0.45);
  cursor: pointer; font-family: inherit;
  margin-right: 8px; transition: transform 0.15s;
}
.ob-empty-cta:hover { transform: translateY(-1px); }
.ob-empty-secondary {
  background: transparent; border: 0;
  color: #94a3b8; font-size: 12px; cursor: pointer;
  text-decoration: underline; font-family: inherit;
}
.ob-empty-secondary:hover { color: #cbd5e1; }
.ob-empty-filter { padding: 30px 20px; }

/* Manual-add modal */
.ob-modal-host {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.ob-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(8, 12, 30, 0.65); backdrop-filter: blur(4px);
}
.ob-modal {
  position: relative; width: 100%; max-width: 460px;
  background: #1a1f3a; border: 0.5px solid rgba(148, 163, 184, 0.20);
  border-radius: 14px; padding: 24px; color: #e8edf6;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.50);
}
.ob-modal h2 {
  font-size: 18px; font-weight: 600; margin: 0 0 8px;
  letter-spacing: -0.005em; color: #f3f4f9;
}
.ob-modal-hint {
  font-size: 12.5px; color: #94a3b8;
  line-height: 1.5; margin: 0 0 18px;
}
.ob-field {
  display: flex; flex-direction: column; gap: 5px;
  margin-bottom: 14px;
}
.ob-field span {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #94a3b8;
}
.ob-field input, .ob-field select, .ob-field textarea {
  padding: 9px 12px; border-radius: 8px;
  background: rgba(15, 23, 42, 0.40);
  border: 1px solid rgba(148, 163, 184, 0.20);
  color: #f3f4f9; font-size: 13px; font-family: inherit;
}
.ob-field input:focus, .ob-field select:focus, .ob-field textarea:focus {
  outline: none; border-color: rgba(91, 91, 214, 0.60);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.15);
}
.ob-field textarea { min-height: 60px; resize: vertical; font-family: inherit; }
.ob-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px;
}
.ob-modal-cancel {
  padding: 9px 16px; border-radius: 8px;
  background: transparent; border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1; font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.ob-modal-cancel:hover { border-color: rgba(148, 163, 184, 0.45); color: #f3f4f9; }
.ob-modal-save {
  padding: 9px 20px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; font-size: 13px; font-weight: 500;
  border: 1px solid rgba(120, 121, 240, 0.45);
  cursor: pointer; font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ob-modal-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(91, 91, 214, 0.40);
}

/* Light theme */
body[data-theme="light"] .ob-view { color: #1f2937; }
body[data-theme="light"] .ob-eyebrow { color: #1d4ed8; }
body[data-theme="light"] .ob-view h1 { color: #0f172a; }
body[data-theme="light"] .ob-subtitle { color: #475569; }
body[data-theme="light"] .ob-subtitle strong { color: #1e293b; }
body[data-theme="light"] .ob-add-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.20);
}
body[data-theme="light"] .ob-stat {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.30);
}
body[data-theme="light"] .ob-stat-num { color: #0f172a; }
body[data-theme="light"] .ob-stat-label { color: #64748b; }
body[data-theme="light"] .ob-filter-row { border-bottom-color: rgba(148, 163, 184, 0.25); }
body[data-theme="light"] .ob-filter-btn {
  background: #ffffff; border-color: rgba(148, 163, 184, 0.30); color: #475569;
}
body[data-theme="light"] .ob-filter-btn:hover { background: rgba(37, 99, 235, 0.06); color: #1e40af; }
body[data-theme="light"] .ob-filter-btn.active {
  background: rgba(37, 99, 235, 0.10); border-color: rgba(37, 99, 235, 0.45); color: #1d4ed8;
}
body[data-theme="light"] .ob-filter-count { background: rgba(15, 23, 42, 0.08); }
body[data-theme="light"] .ob-bucket-head { border-bottom-color: rgba(148, 163, 184, 0.25); }
body[data-theme="light"] .ob-bucket-head h2 { color: #475569; }
body[data-theme="light"] .ob-bucket-count { background: rgba(37, 99, 235, 0.10); color: #1d4ed8; }
body[data-theme="light"] .ob-bucket-urgent .ob-bucket-head h2 { color: #b91c1c; }
body[data-theme="light"] .ob-bucket-urgent .ob-bucket-count { background: rgba(239, 68, 68, 0.10); color: #b91c1c; }
body[data-theme="light"] .ob-card {
  background: #ffffff; border-color: rgba(148, 163, 184, 0.25);
}
body[data-theme="light"] .ob-card:hover { border-color: rgba(37, 99, 235, 0.45); }
body[data-theme="light"] .ob-date { color: #0f172a; }
body[data-theme="light"] .ob-rel { color: #64748b; }
body[data-theme="light"] .ob-type-warn { background: rgba(245, 158, 11, 0.14); color: #b45309; }
body[data-theme="light"] .ob-type-good { background: rgba(34, 197, 94, 0.14); color: #15803d; }
body[data-theme="light"] .ob-type-info { background: rgba(59, 130, 246, 0.14); color: #1d4ed8; }
body[data-theme="light"] .ob-overdue-chip { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
body[data-theme="light"] .ob-cp-chip { color: #0e7490; background: rgba(8, 145, 178, 0.08); border-color: rgba(8, 145, 178, 0.30); }
body[data-theme="light"] .ob-title { color: #0f172a; }
body[data-theme="light"] .ob-desc { color: #64748b; }
body[data-theme="light"] .ob-source-link, body[data-theme="light"] .ob-source-manual { color: #64748b; }
body[data-theme="light"] .ob-source-link:hover { color: #1d4ed8; }
body[data-theme="light"] .ob-action { background: #ffffff; border-color: rgba(148, 163, 184, 0.30); color: #475569; }
body[data-theme="light"] .ob-action:hover { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.40); color: #15803d; }
body[data-theme="light"] .ob-action-danger:hover { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.40); color: #b91c1c; }
body[data-theme="light"] .ob-empty { background: #fafafa; border-color: rgba(148, 163, 184, 0.30); }
body[data-theme="light"] .ob-empty-icon { background: rgba(37, 99, 235, 0.10); color: #1d4ed8; }
body[data-theme="light"] .ob-empty h3 { color: #0f172a; }
body[data-theme="light"] .ob-empty p { color: #475569; }
body[data-theme="light"] .ob-empty-cta {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
}
body[data-theme="light"] .ob-empty-secondary { color: #64748b; }
body[data-theme="light"] .ob-empty-secondary:hover { color: #1e293b; }
body[data-theme="light"] .ob-modal { background: #ffffff; border-color: rgba(148, 163, 184, 0.35); color: #1f2937; }
body[data-theme="light"] .ob-modal h2 { color: #0f172a; }
body[data-theme="light"] .ob-modal-hint { color: #475569; }
body[data-theme="light"] .ob-field span { color: #64748b; }
body[data-theme="light"] .ob-field input, body[data-theme="light"] .ob-field select, body[data-theme="light"] .ob-field textarea {
  background: #ffffff; border-color: rgba(148, 163, 184, 0.40); color: #0f172a;
}
body[data-theme="light"] .ob-field input:focus, body[data-theme="light"] .ob-field select:focus, body[data-theme="light"] .ob-field textarea:focus {
  border-color: rgba(79, 70, 229, 0.60); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10);
}
body[data-theme="light"] .ob-modal-cancel { color: #475569; border-color: rgba(148, 163, 184, 0.40); }
body[data-theme="light"] .ob-modal-cancel:hover { color: #0f172a; border-color: #94a3b8; }
body[data-theme="light"] .ob-modal-save { background: linear-gradient(135deg, #4f46e5, #6366f1); }

/* Mobile */
@media (max-width: 700px) {
  .ob-stat-strip { grid-template-columns: repeat(2, 1fr); }
  .ob-card { grid-template-columns: 1fr; gap: 8px; padding: 12px 14px; }
  .ob-date-col { flex-direction: row; gap: 8px; align-items: baseline; }
  .ob-actions { flex-wrap: wrap; }
}

/* ─── v39.4.0 — Workspace completion stack ────────────────────────
   CSS for embedded e-signature (modals + status), clause glossary
   (term highlight + popover), and Second Opinion (panel + launcher).
   All visually consistent with the existing v39.2 / v39.3 surfaces:
   deep navy surface, lavender accents, 0.5px hairlines, subtle
   shadows. */

/* ─── Modal shell (shared by sign / send / certificate) ───────── */
.sig-modal-host {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  animation: sigFadeIn 0.18s ease-out;
}
@keyframes sigFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sigSlideIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.sig-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(5, 8, 22, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.sig-modal {
  position: relative; z-index: 1;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #0c1228;
  border: 0.5px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  padding: 24px 28px 22px;
  color: #e8edf6;
  animation: sigSlideIn 0.20s ease-out;
}
.sig-modal-sign { width: min(620px, calc(100vw - 32px)); }
.sig-modal-cert { width: min(580px, calc(100vw - 32px)); }
.sig-modal::-webkit-scrollbar { width: 8px; }
.sig-modal::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.20); border-radius: 4px;
}
.sig-modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 12px;
}
.sig-modal-head h2 {
  flex: 1; margin: 0;
  font-size: 19px; font-weight: 600; letter-spacing: -0.01em;
  color: #f3f4f9;
}
.sig-modal-x {
  width: 28px; height: 28px; border-radius: 8px;
  background: transparent; border: 0; cursor: pointer;
  color: #94a3b8; display: grid; place-items: center;
  transition: background 0.12s, color 0.12s;
}
.sig-modal-x:hover { background: rgba(148, 163, 184, 0.10); color: #e8edf6; }
.sig-modal-hint {
  margin: 0 0 16px;
  font-size: 12.5px; line-height: 1.55; color: #94a3b8;
}

/* ─── Doc-pill chip on the sign modal ─────────────────────────── */
.sig-doc-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; margin: 0 0 14px;
  background: rgba(91, 91, 214, 0.10);
  border: 0.5px solid rgba(91, 91, 214, 0.25);
  border-radius: 999px;
  font-size: 11.5px; color: #93c5fd;
  max-width: 100%;
}
.sig-doc-pill span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}

/* ─── Tabs ────────────────────────────────────────────────────── */
.sig-tabs {
  display: flex; gap: 4px;
  padding: 4px;
  background: #131a39;
  border: 0.5px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  max-width: 320px;
  margin-bottom: 14px;
}
.sig-tab {
  flex: 1; padding: 6px 12px;
  background: transparent; border: 0; cursor: pointer;
  border-radius: 7px;
  color: #94a3b8; font-size: 12px; font-weight: 500;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.sig-tab:hover { color: #e8edf6; }
.sig-tab.active { background: rgba(91, 91, 214, 0.18); color: #93c5fd; }
.sig-panel { display: block; }
.sig-panel[hidden] { display: none; }

/* ─── Form fields ─────────────────────────────────────────────── */
.sig-field {
  display: flex; flex-direction: column; gap: 5px;
  margin-bottom: 12px;
}
.sig-field > span {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #94a3b8;
}
.sig-field input, .sig-field textarea {
  padding: 9px 12px; border-radius: 8px;
  background: #131a39;
  border: 1px solid rgba(148, 163, 184, 0.20);
  color: #e8edf6;
  font-size: 13px; font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.sig-field input:focus, .sig-field textarea:focus {
  outline: none;
  border-color: rgba(91, 91, 214, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.14);
}
.sig-field textarea { min-height: 64px; resize: vertical; }
.sig-meta-fields { margin-top: 4px; }

/* ─── Typed/initials cursive preview ──────────────────────────── */
.sig-preview-cursive {
  min-height: 90px; padding: 18px;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: 'Pinyon Script', 'Brush Script MT', cursive;
  font-size: 42px;
  margin-bottom: 12px;
  word-break: break-word;
  text-align: center;
  line-height: 1;
}
.sig-preview-initials { font-size: 52px; letter-spacing: 0.05em; }
.sig-preview-empty {
  font-family: 'Geist', sans-serif !important;
  font-size: 12px; color: #94a3b8;
  letter-spacing: 0;
}

/* ─── Drawn-canvas ────────────────────────────────────────────── */
.sig-canvas-wrap {
  position: relative;
  margin-bottom: 12px;
}
.sig-canvas-wrap canvas {
  width: 100%; max-width: 100%;
  height: 160px;
  background: #fff;
  border-radius: 8px;
  display: block; cursor: crosshair;
}
.sig-canvas-clear {
  position: absolute; top: 8px; right: 8px;
  background: rgba(15, 23, 42, 0.85); color: #fff;
  border: 0; padding: 5px 11px; border-radius: 5px;
  font-size: 11px; cursor: pointer; font-family: inherit;
}
.sig-canvas-clear:hover { background: rgba(15, 23, 42, 1); }
.sig-canvas-hint {
  font-size: 11px; color: #94a3b8;
  margin-top: 6px; font-style: italic;
}

/* ─── Consent box ─────────────────────────────────────────────── */
.sig-consent {
  margin: 4px 0 16px;
  padding: 12px 14px;
  background: rgba(91, 91, 214, 0.06);
  border: 0.5px solid rgba(91, 91, 214, 0.20);
  border-radius: 8px;
}
.sig-consent label {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
}
.sig-consent input { margin-top: 3px; flex-shrink: 0; }
.sig-consent span {
  font-size: 12px; line-height: 1.5;
  color: #cbd5e1;
}

/* ─── Modal action row + buttons ──────────────────────────────── */
.sig-modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 16px;
}
.sig-btn {
  padding: 9px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, color 0.12s;
}
.sig-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; border: 1px solid rgba(120, 121, 240, 0.45);
  box-shadow: 0 4px 14px rgba(91, 91, 214, 0.22);
}
.sig-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 91, 214, 0.34);
}
.sig-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.sig-btn-secondary {
  background: transparent; color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.22);
}
.sig-btn-secondary:hover {
  color: #e8edf6;
  border-color: rgba(148, 163, 184, 0.40);
}

/* ─── Send-for-signature: magic-link reveal ───────────────────── */
.sig-magic-area {
  margin-top: 12px;
  padding: 14px;
  background: rgba(52, 211, 153, 0.06);
  border: 0.5px solid rgba(52, 211, 153, 0.22);
  border-radius: 10px;
}
.sig-magic-row {
  display: flex; gap: 6px;
}
.sig-magic-row input {
  flex: 1; padding: 9px 12px;
  background: #131a39;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 8px;
  color: #e8edf6; font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.sig-magic-tip {
  margin: 8px 0 0;
  font-size: 11.5px; line-height: 1.5;
  color: #94a3b8;
}

/* ─── Certificate modal ───────────────────────────────────────── */
.sig-cert-sig {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  display: grid; place-items: center;
  margin: 8px 0 18px;
  min-height: 100px;
  color: #0f172a;
  font-family: 'Pinyon Script', cursive;
  font-size: 40px;
}
.sig-cert-sig img {
  max-width: 100%; max-height: 110px;
  object-fit: contain;
}
.sig-cert-meta {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 16px;
}
.sig-cert-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid rgba(148, 163, 184, 0.10);
}
.sig-cert-row:last-child { border-bottom: 0; }
.sig-cert-label {
  width: 130px; flex-shrink: 0;
  font-size: 11px; font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.sig-cert-value {
  flex: 1; min-width: 0;
  font-size: 12.5px; color: #e8edf6;
  word-break: break-word;
}
.sig-cert-email { color: #94a3b8; }
.sig-cert-hash, .sig-cert-ua {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
  padding: 2px 6px; border-radius: 4px;
  word-break: break-all;
}
.sig-cert-validity {
  padding: 12px 14px;
  background: rgba(52, 211, 153, 0.06);
  border: 0.5px solid rgba(52, 211, 153, 0.22);
  border-radius: 8px;
  margin-bottom: 12px;
}
.sig-cert-validity strong {
  display: block; margin-bottom: 4px;
  font-size: 12px; font-weight: 600; color: #6ee7a3;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.sig-cert-validity p {
  margin: 0;
  font-size: 12px; line-height: 1.55; color: #cbd5e1;
}

/* ─── Inline doc-card signature status badge ──────────────────── */
#v94SigStatus {
  margin: 0 0 10px;
}
.sig-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(91, 91, 214, 0.10);
  border: 0.5px solid rgba(91, 91, 214, 0.30);
  border-radius: 999px;
  color: #93c5fd;
  font-size: 11.5px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background 0.12s, transform 0.12s;
}
.sig-status:hover {
  background: rgba(91, 91, 214, 0.18);
  transform: translateY(-1px);
}
.sig-status-done {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.32);
  color: #6ee7a3;
}
.sig-status-pending {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.28);
  color: #fbbf24;
}
.sig-status-count {
  padding: 1px 7px;
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
  color: inherit;
}

/* ─── Clause glossary: term highlight + popover ───────────────── */
.gl-term {
  position: relative;
  border-bottom: 1px dotted rgba(91, 91, 214, 0.60);
  cursor: help;
  transition: background 0.12s, border-color 0.12s;
}
.gl-term:hover, .gl-term:focus {
  background: rgba(91, 91, 214, 0.10);
  border-bottom-color: rgba(91, 91, 214, 0.95);
  outline: none;
}
.gl-pop {
  position: absolute;
  z-index: 9998;
  width: min(360px, calc(100vw - 32px));
  background: #0c1228;
  border: 0.5px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  padding: 14px 16px;
  color: #e8edf6;
  animation: sigSlideIn 0.16s ease-out;
}
.gl-pop[hidden] { display: none; }
.gl-pop-head {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 6px;
}
.gl-pop-head strong {
  flex: 1;
  font-size: 13.5px; font-weight: 600; color: #f3f4f9;
}
.gl-pop-close {
  width: 22px; height: 22px;
  background: transparent; border: 0; cursor: pointer;
  color: #94a3b8; border-radius: 5px;
  display: grid; place-items: center;
  transition: background 0.12s, color 0.12s;
}
.gl-pop-close:hover { background: rgba(148, 163, 184, 0.10); color: #e8edf6; }
.gl-pop-body {
  margin: 0 0 10px;
  font-size: 12.5px; line-height: 1.55;
  color: #cbd5e1;
}
.gl-pop-watch {
  padding: 9px 11px;
  background: rgba(251, 191, 36, 0.06);
  border: 0.5px solid rgba(251, 191, 36, 0.22);
  border-radius: 7px;
  margin-bottom: 10px;
  font-size: 11.5px; line-height: 1.5;
  color: #fde68a;
}
.gl-pop-watch span {
  display: block;
  font-size: 10px; font-weight: 600;
  color: #fbbf24;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.gl-pop-actions { display: flex; justify-content: flex-end; }
.gl-pop-more {
  background: transparent; border: 0;
  color: #93c5fd; cursor: pointer;
  font-size: 11.5px; font-weight: 500;
  padding: 4px 8px; border-radius: 5px;
  font-family: inherit;
  transition: background 0.12s;
}
.gl-pop-more:hover { background: rgba(91, 91, 214, 0.14); }

/* ─── Second Opinion: side panel + launcher ──────────────────── */
.so-panel {
  position: fixed; right: 16px; bottom: 16px;
  z-index: 9997;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 32px));
  display: flex; flex-direction: column;
  background: #0c1228;
  border: 0.5px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  color: #e8edf6;
  animation: sigSlideIn 0.18s ease-out;
}
.so-panel[hidden] { display: none; }
.so-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(148, 163, 184, 0.14);
}
.so-head-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.so-avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.so-title {
  font-size: 13.5px; font-weight: 600; color: #f3f4f9;
}
.so-sub {
  font-size: 11px; color: #94a3b8; margin-top: 1px;
}
.so-x {
  width: 26px; height: 26px; border-radius: 7px;
  background: transparent; border: 0; cursor: pointer;
  color: #94a3b8; display: grid; place-items: center;
  transition: background 0.12s, color 0.12s;
}
.so-x:hover { background: rgba(148, 163, 184, 0.10); color: #e8edf6; }

.so-context-pill {
  margin: 10px 14px 0;
  padding: 8px 12px;
  background: #131a39;
  border: 0.5px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  font-size: 11.5px; line-height: 1.4;
  color: #94a3b8;
}
.so-context-pill.so-context-active {
  border-color: rgba(91, 91, 214, 0.30);
  background: rgba(91, 91, 214, 0.06);
  color: #cbd5e1;
}

.so-msgs {
  flex: 1; overflow-y: auto;
  padding: 14px 16px 6px;
  display: flex; flex-direction: column; gap: 12px;
}
.so-msgs::-webkit-scrollbar { width: 6px; }
.so-msgs::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.18); border-radius: 3px;
}
.so-msg { display: flex; }
.so-msg-user { justify-content: flex-end; }
.so-msg-body {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px; line-height: 1.5;
  word-break: break-word;
}
.so-msg-user .so-msg-body {
  background: rgba(91, 91, 214, 0.20);
  border: 0.5px solid rgba(91, 91, 214, 0.30);
  color: #e8edf6;
  border-bottom-right-radius: 4px;
}
.so-msg-assistant .so-msg-body {
  background: #131a39;
  border: 0.5px solid rgba(148, 163, 184, 0.15);
  color: #e8edf6;
  border-bottom-left-radius: 4px;
}
.so-msg-body p { margin: 0 0 8px; }
.so-msg-body p:last-child { margin-bottom: 0; }
.so-msg-body ul { margin: 4px 0 8px; padding-left: 18px; }
.so-msg-body ul:last-child { margin-bottom: 0; }
.so-msg-body li { margin-bottom: 3px; line-height: 1.5; }
.so-msg-body strong { color: #f3f4f9; }

.so-typing {
  display: inline-flex; gap: 4px;
  padding: 2px 0;
}
.so-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #94a3b8;
  animation: soTyping 1.2s infinite;
}
.so-typing span:nth-child(2) { animation-delay: 0.2s; }
.so-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes soTyping {
  0%, 60%, 100% { opacity: 0.30; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.so-suggestions {
  padding: 0 14px 12px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.so-suggestion {
  padding: 6px 11px;
  background: rgba(91, 91, 214, 0.08);
  border: 0.5px solid rgba(91, 91, 214, 0.22);
  border-radius: 999px;
  color: #93c5fd;
  font-size: 11.5px; font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}
.so-suggestion:hover {
  background: rgba(91, 91, 214, 0.16);
  transform: translateY(-1px);
}

.so-footer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px 14px 14px;
  border-top: 0.5px solid rgba(148, 163, 184, 0.14);
}
.so-input {
  flex: 1;
  padding: 9px 12px;
  background: #131a39;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 10px;
  color: #e8edf6;
  font-size: 13px; line-height: 1.4;
  font-family: inherit;
  resize: none;
  min-height: 38px; max-height: 120px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.so-input:focus {
  outline: none;
  border-color: rgba(91, 91, 214, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.14);
}
.so-send {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: 1px solid rgba(120, 121, 240, 0.45);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: transform 0.12s, box-shadow 0.12s;
}
.so-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 91, 214, 0.34);
}
.so-send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── Floating launcher button ────────────────────────────────── */
.so-launcher {
  position: fixed; right: 20px; bottom: 20px;
  z-index: 9996;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px 10px 14px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: 1px solid rgba(120, 121, 240, 0.45);
  border-radius: 999px;
  color: #fff;
  font-size: 12.5px; font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(91, 91, 214, 0.40);
  transition: transform 0.15s, box-shadow 0.15s;
}
.so-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(91, 91, 214, 0.55);
}
.so-launcher-label {
  letter-spacing: 0.005em;
}

/* Hide the launcher when the panel is open. */
.so-panel:not([hidden]) ~ .so-launcher,
body:has(#secondOpinionPanel:not([hidden])) #soLauncher {
  display: none;
}

/* ─── Mobile sizing ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .so-panel {
    right: 8px; bottom: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 14px;
  }
  .so-launcher {
    right: 12px; bottom: 12px;
    padding: 9px 14px 9px 12px;
  }
  .so-launcher-label { display: none; }
  .sig-modal { padding: 18px 18px 16px; }
  .sig-cert-label { width: 110px; font-size: 10px; }
  .sig-canvas-wrap canvas { height: 130px; }
}

/* ─── v39.4.2 — Free-uploads pill + exhausted-CTA state ───────────
   Surfaces the remaining-tokens count next to the primary upload
   CTA so free users always know where they stand. The "exhausted"
   variant (0 tokens left) switches to an amber treatment and the
   CTA becomes "Upgrade to continue." */

.free-uploads-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 10px 6px 12px;
  background: rgba(91, 91, 214, 0.10);
  border: 0.5px solid rgba(91, 91, 214, 0.28);
  border-radius: 999px;
  color: #93c5fd;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
}
.free-uploads-pill svg { color: inherit; }

.free-uploads-pill-upgrade {
  margin-left: 4px;
  padding: 3px 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: 1px solid rgba(120, 121, 240, 0.45);
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.free-uploads-pill-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 91, 214, 0.40);
}

/* Exhausted state — switch to amber to communicate "action required". */
.free-uploads-pill-exhausted {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.32);
  color: #fbbf24;
}

/* Primary CTA in exhausted state. Slight dim + amber accent so the
   visual hierarchy still works (it's still the most prominent action
   on the page, just with a clear "upgrade required" tone). */
.v27-primary-cta-exhausted {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(251, 191, 36, 0.10)) !important;
  border-color: rgba(251, 191, 36, 0.40) !important;
  color: #fde68a !important;
}
.v27-primary-cta-exhausted:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.28), rgba(251, 191, 36, 0.18)) !important;
}
.v27-primary-cta-exhausted .v27-cta-icon,
.v27-primary-cta-exhausted .v27-cta-arrow {
  color: #fbbf24 !important;
}
