/* ==========================================================================
   AiHisab Help Center — "Ledger" theme override  (v3: + AI/tech layer + contrast fixes)
   Load AFTER kb.css:
   loaded by lib/layout.php on themed pages — do not add it again in config.php
   Scoped to body.theme-dark, so the light admin/article pages are untouched.
   To roll back, remove the <link> line.
   ========================================================================== */

/* Fonts (Fraunces, Geist, JetBrains Mono) are loaded by lib/layout.php with a <link>, not @import. */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #F6F4EE;           /* warm paper */
  --panel: #FFFFFF;
  --panel-2: #FBFAF6;
  --line: #E4E0D5;
  --line-2: #D9D4C7;
  --text: #16211C;         /* ink */
  --muted: #5B635E;
  --accent: #0E5E4B;       /* ledger green — change this one value to re-brand */
  --accent-soft: #E6EFEA;
  --accent-ink: #08402F;
  --amber: #B7791F;
  --ink-panel: #16211C;
  --teal: var(--accent);
  --cyan: var(--accent);
  --violet: var(--accent);
  --pink: var(--amber);
  --grad: linear-gradient(var(--accent), var(--accent));  /* kills the rainbow everywhere it's used */
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- 2. Base ---------- */
body.theme-dark {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}
body.theme-dark ::selection { background: var(--accent-soft); color: var(--text); }

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3 {
  font-family: var(--serif);
  font-weight: 500 !important;
  letter-spacing: -0.02em;
  color: var(--text);
}
body.theme-dark h1 { line-height: 1.04; }

/* Gradient headline words → italic serif in accent */
body.theme-dark .kb-grad-text {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
}
body.theme-dark .kb-muted { color: var(--muted); }

/* Background effects: aurora off, grid becomes faint ledger lines */
body.theme-dark .kb-aurora { display: none; }
body.theme-dark .kb-grid {
  background-image: repeating-linear-gradient(0deg, transparent 0 39px, rgba(22,33,28,.06) 39px 40px);
  background-size: auto;
  mask-image: linear-gradient(#000 0, transparent 70vh);
  -webkit-mask-image: linear-gradient(#000 0, transparent 70vh);
}

/* ---------- 3. Tailwind colour utilities used in the markup ---------- */
body.theme-dark .text-white,
body.theme-dark .text-slate-100,
body.theme-dark .text-slate-900 { color: var(--text) !important; }
body.theme-dark .text-slate-300 { color: #2F3833 !important; }
body.theme-dark .text-slate-400 { color: var(--muted) !important; }
body.theme-dark .text-teal-300,
body.theme-dark .text-teal-300\/80,
body.theme-dark .text-cyan-300,
body.theme-dark .text-violet-300,
body.theme-dark .text-pink-300 { color: var(--accent) !important; }
body.theme-dark .text-amber-300,
body.theme-dark .text-amber-200\/90,
body.theme-dark .text-orange-400 { color: var(--amber) !important; }
body.theme-dark .border-white\/5 { border-color: var(--line) !important; }
body.theme-dark .hover\:bg-white\/\[\.04\]:hover { background: var(--accent-soft) !important; }
body.theme-dark .hover\:text-white:hover,
body.theme-dark .group:hover .group-hover\:text-white { color: var(--accent) !important; }

/* ---------- 4. Top bar & nav ---------- */
body.theme-dark .kb-topbar {
  background: rgba(246,244,238,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
body.theme-dark .kb-logo {
  background: var(--accent) !important;
  animation: none;
  box-shadow: none;
  color: #fff;
}
body.theme-dark .kb-nav { color: #2F3833; }
body.theme-dark .kb-nav:hover { color: var(--text); background: rgba(22,33,28,.05); }
body.theme-dark .kb-nav.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}
body.theme-dark .kb-app-btn {
  background: var(--ink-panel);
  color: #F6F4EE;
  border: 1px solid var(--ink-panel);
}
body.theme-dark .kb-app-btn:hover { background: #000; box-shadow: none; border-color: #000; }
body.theme-dark .kb-cmd-trigger {
  background: #fff;
  border: 1px solid var(--line-2);
  color: var(--muted);
}
body.theme-dark .kb-cmd-trigger:hover { border-color: var(--text); color: var(--text); }
body.theme-dark .kb-cmd-trigger kbd,
body.theme-dark .kb-kbd {
  background: var(--panel-2);
  border-color: var(--line-2);
  color: var(--muted);
  box-shadow: none;
}
body.theme-dark .kb-icon-btn { color: var(--text); }

/* ---------- 5. Hero: orb, badge, search, chips ---------- */
body.theme-dark .kb-orb::before { background: var(--accent); animation: none; filter: none; }
body.theme-dark .kb-orb::after { background: var(--accent) !important; }
body.theme-dark .kb-orb i { color: #fff; text-shadow: none; }
body.theme-dark .kb-orb .kb-orb-halo { background: radial-gradient(circle, rgba(14,94,75,.14), transparent 65%); }

body.theme-dark .kb-badge {
  color: var(--accent);
  background: #fff;
  border: 1px solid var(--line);
  letter-spacing: .08em;
}

body.theme-dark .kb-search {
  background: #fff;
  border: 1.5px solid var(--text);
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--text);
}
body.theme-dark .kb-search.kb-glow-border::before,
body.theme-dark .kb-glow-border::before { display: none; }
body.theme-dark .kb-search input { color: var(--text); border-radius: 16px; }
body.theme-dark .kb-search input::placeholder { color: #8A908B; }
body.theme-dark .kb-search .kb-search-ico { color: var(--muted); }
body.theme-dark .kb-search button[type="submit"] {
  background: var(--accent);
  color: #fff;
  animation: none;
  border-radius: 11px;
}
body.theme-dark .kb-search button[type="submit"]:hover { background: var(--accent-ink); box-shadow: none; }

body.theme-dark .kb-chip {
  color: #2F3833;
  background: #fff;
  border: 1px solid var(--line-2);
}
body.theme-dark .kb-chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

body.theme-dark .kb-suggest {
  background: #fff;
  border: 1px solid var(--line-2);
  box-shadow: 0 24px 48px -20px rgba(22,33,28,.3);
}
body.theme-dark .kb-suggest a { border-bottom-color: var(--line); color: var(--text); }
body.theme-dark .kb-suggest a:hover { background: var(--accent-soft); }

body.theme-dark .kb-stat { color: var(--muted); }
body.theme-dark .kb-stat b { color: var(--text); font-family: var(--serif); font-weight: 500; font-size: 1.25rem; }
body.theme-dark .kb-dot-live { background: #2F9E6E; }

/* ---------- 6. Cards (paths, tools, popular, audit) ---------- */
body.theme-dark .kb-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
body.theme-dark a.kb-card:hover,
body.theme-dark .kb-card.is-hover:hover {
  transform: translateY(-2px);
  background: var(--panel);
  border-color: var(--text);
  box-shadow: 4px 4px 0 var(--text);
}

/* Rainbow icon tiles → calm tinted tiles */
body.theme-dark .kb-icon-tile {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border: 1px solid #CFE0D7;
}

/* Learning-path topic rows */
body.theme-dark .kb-path-link { color: var(--text); border-color: var(--line); }
body.theme-dark .kb-path-link:hover { color: var(--accent); background: var(--accent-soft); }
body.theme-dark .kb-path-count {
  font-family: var(--mono);
  color: var(--muted);
  background: transparent;
}

/* Big numbers (guide counts, ranks) read as editorial figures */
body.theme-dark .font-mono { font-family: var(--mono); }

/* ---------- 7. AI answer box ---------- */
body.theme-dark .kb-answer {
  background: #fff;
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 60px -30px rgba(22,33,28,.3);
}
body.theme-dark .kb-answer-head { border-bottom-color: var(--line); }
body.theme-dark .kb-answer-lead { color: var(--text); }
body.theme-dark .kb-mini-orb { background: var(--accent); animation: none; }
body.theme-dark .kb-mini-orb::after { background: #fff; }
body.theme-dark .kb-steps li { background: var(--panel-2); border-color: var(--line); }
body.theme-dark .kb-steps li::before { background: var(--accent); color: #fff; }
body.theme-dark .kb-points li::before { background: var(--accent); box-shadow: none; }
body.theme-dark .kb-caret::after { background: var(--accent); }
body.theme-dark .kb-source { color: #2F3833; background: #fff; border-color: var(--line-2); }
body.theme-dark a.kb-source:hover { color: var(--accent); border-color: var(--accent); }
body.theme-dark .kb-skeleton { background: linear-gradient(90deg, #EFECE4, #F8F6F0, #EFECE4); background-size: 200% 100%; }
body.theme-dark .kb-thinking-text { background: linear-gradient(90deg, #8A908B, #16211C, #8A908B); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }

/* ---------- 8. Ctrl-K palette, mobile sheet & tab bar ---------- */
body.theme-dark .kb-cmd-backdrop { background: rgba(22,33,28,.35); }
body.theme-dark .kb-cmd-panel {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-2);
  box-shadow: 0 40px 100px -30px rgba(22,33,28,.45);
}
body.theme-dark .kb-cmd-input { border-bottom-color: var(--line); }
body.theme-dark .kb-cmd-input i { color: var(--accent); }
body.theme-dark .kb-cmd-input input { color: var(--text); }
body.theme-dark .kb-cmd-item { color: var(--text); }
body.theme-dark .kb-cmd-item.is-sel,
body.theme-dark .kb-cmd-item:hover { background: var(--accent-soft); }
body.theme-dark .kb-cmd-ico { background: var(--panel-2) !important; color: var(--accent) !important; }
body.theme-dark .kb-cmd-foot { color: var(--muted); border-top-color: var(--line); }

body.theme-dark .kb-sheet-panel,
body.theme-dark .kb-tabbar {
  background: rgba(255,255,255,.96) !important;
  border-color: var(--line) !important;
  color: var(--text);
}
body.theme-dark .kb-sheet-link,
body.theme-dark .kb-tab { color: #2F3833; }
body.theme-dark .kb-tab-orb,
body.theme-dark .kb-tab-ask { background: var(--accent) !important; color: #fff !important; }

/* ---------- 9. Misc ---------- */
body.theme-dark .kb-progress { background: var(--accent); box-shadow: none; }
body.theme-dark .kb-toc a { color: var(--muted); border-left-color: var(--line); }
body.theme-dark .kb-toc a:hover { color: var(--text); }
body.theme-dark .kb-toc a.is-active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }
body.theme-dark .kb-footer { border-top-color: var(--line-2); color: var(--muted); }
body.theme-dark .kb-footer a:hover { color: var(--accent); }

/* ---------- 10. Learning-path cards, library & topic pages ---------- */
body.theme-dark .kb-path::after { background: var(--line); opacity: 1; height: 1px; }
body.theme-dark .kb-path::before { display: none; }
body.theme-dark .kb-path-count { color: var(--text); font-family: var(--serif); font-weight: 500; font-size: 2rem; }
body.theme-dark .kb-path-count small { font-family: var(--sans); color: var(--muted); }
body.theme-dark .kb-path-link { background: var(--panel-2); }
body.theme-dark .kb-path-link > i:first-child { color: var(--accent); }

/* Card titles in serif */
body.theme-dark .kb-card .text-lg.font-bold,
body.theme-dark .kb-card .text-xl.font-bold,
body.theme-dark .kb-card .text-2xl.font-bold {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

/* Buttons that sat on the old gradient now sit on solid accent → white text */
body.theme-dark [style*="--grad"],
body.theme-dark a.text-slate-900.rounded-xl,
body.theme-dark button.text-slate-900 { color: #fff !important; }

body.theme-dark .kb-step-no {
  color: #fff;
  background: var(--accent);
  border: 0;
}
body.theme-dark .kb-topic-head::before { background: var(--accent-soft); opacity: .6; }
body.theme-dark .kb-chip.is-on { color: #fff; background: var(--accent); border-color: var(--accent); }
body.theme-dark .kb-footer { background: transparent; }

body.theme-dark .kb-lib-nav { background: rgba(246,244,238,.9); border-bottom-color: var(--line); }
body.theme-dark .kb-lib-item:hover { background: var(--accent-soft); }
body.theme-dark .kb-pn small { color: var(--muted); }
body.theme-dark .out-box { background: var(--panel-2); border-color: var(--line); }

/* ---------- 11. Article content ---------- */
body.theme-dark .kb-h2,
body.theme-dark .kb-h3 { color: var(--text); font-family: var(--serif); font-weight: 500; }
body.theme-dark .kb-h2 { font-size: 1.75rem; }
body.theme-dark .kb-h4 { color: #2F3833; }
body.theme-dark .kb-p,
body.theme-dark .kb-ul,
body.theme-dark .kb-ol { color: #2F3833; }
body.theme-dark .kb-ul li::marker,
body.theme-dark .kb-ol li::marker { color: var(--accent); }
body.theme-dark strong { color: var(--text); }
body.theme-dark .kb-link { color: var(--accent); }
body.theme-dark .kb-code { background: var(--accent-soft); border-color: #CFE0D7; color: var(--accent-ink); }
body.theme-dark .kb-pre { background: var(--ink-panel); color: #E6EDE9; border-color: var(--ink-panel); }
body.theme-dark .kb-tip { background: var(--accent-soft); border-color: #CFE0D7; color: #1F2C26; }
body.theme-dark .kb-tip i { color: var(--accent); }
body.theme-dark .kb-table { border-color: var(--line-2); background: #fff; }
body.theme-dark .kb-table th,
body.theme-dark .kb-table td { border-color: var(--line); color: #2F3833; }
body.theme-dark .kb-table th { background: var(--panel-2); color: var(--text); }
body.theme-dark .kb-table tr:hover td { background: var(--accent-soft); }

/* ---------- 12. Mobile bits ---------- */
body.theme-dark .kb-icon-btn { background: #fff; border-color: var(--line-2); color: var(--text); }
body.theme-dark .kb-icon-btn:hover { color: var(--accent); border-color: var(--accent); }
body.theme-dark .kb-tab.is-active { color: var(--accent); }
body.theme-dark .kb-tab.is-active i { color: var(--accent); filter: none; }
body.theme-dark .kb-tab-orb { animation: none; box-shadow: 0 0 0 4px var(--bg); }
body.theme-dark .kb-sheet-backdrop { background: rgba(22,33,28,.35); }
body.theme-dark .kb-sheet-grip { background: var(--line-2); }
body.theme-dark .kb-sheet-link { background: var(--panel-2); }
body.theme-dark .kb-sheet-link i { color: var(--accent); }
body.theme-dark .kb-sheet-link.is-active { border-color: var(--accent); background: var(--accent-soft); }

/* Focus ring for keyboard users */
body.theme-dark a:focus-visible,
body.theme-dark button:focus-visible,
body.theme-dark input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   13. AI / tech layer (v2) — dot grid, orbit rings, gradient accents,
       glass header with pill nav, emphasised search bar
   ========================================================================== */

:root {
  --ai-1: #0E5E4B;
  --ai-2: #14B8A6;
  --ai-3: #06B6D4;
  --ai-4: #6366F1;
  --ai-grad: linear-gradient(110deg, var(--ai-1), var(--ai-2) 40%, var(--ai-3) 65%, var(--ai-4));
}

body.theme-dark .kb-grid {
  background-image:
    radial-gradient(rgba(14, 94, 75, .16) 1px, transparent 1.2px) !important;
  background-size: 22px 22px !important;
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 18%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 55% at 50% 18%, #000 30%, transparent 75%);
}

body.theme-dark .kb-aurora {
  display: block !important;
  position: fixed;
  inset: -20% 0 auto 0;
  height: 70vh;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  background:
    radial-gradient(35% 45% at 25% 25%, rgba(20, 184, 166, .16), transparent 70%),
    radial-gradient(30% 40% at 78% 18%, rgba(99, 102, 241, .08), transparent 70%) !important;
  filter: blur(20px);
  animation: ai-drift 18s ease-in-out infinite alternate;
}

@keyframes ai-drift { to { transform: translate3d(0, 4%, 0) scale(1.06); } }

body.theme-dark .kb-orb-halo::before,
body.theme-dark .kb-orb-halo::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 124px;
  height: 124px;
  margin: -62px 0 0 -62px;
  border-radius: 50%;
  pointer-events: none;
}

body.theme-dark .kb-orb-halo::before {
  width: 144px;
  height: 144px;
  margin: -72px 0 0 -72px;
  border: 1px dashed rgba(14, 94, 75, .3);
  animation: ai-spin 22s linear infinite;
}

body.theme-dark .kb-orb-halo::after {
  background: conic-gradient(from 0deg, transparent 0 75%, var(--ai-2) 88%, var(--ai-3) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  animation: ai-spin 4s linear infinite;
}

@keyframes ai-spin { to { transform: rotate(360deg); } }

body.theme-dark .kb-badge {
  font-family: var(--mono) !important;
  letter-spacing: .12em;
  position: relative;
  overflow: hidden;
  border-color: rgba(20, 184, 166, .35) !important;
}

body.theme-dark .kb-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: ai-sweep 3.5s ease-in-out infinite;
}

@keyframes ai-sweep { 60%, 100% { transform: translateX(120%); } }

body.theme-dark .kb-grad-text {
  background: var(--ai-grad) !important;
  background-size: 220% 100% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: ai-flow 8s ease-in-out infinite alternate;
}

@keyframes ai-flow { to { background-position: 100% 0; } }

body.theme-dark .kb-search {
  position: relative;
  border: 1px solid transparent !important;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    var(--ai-grad) border-box !important;
  background-size: 100% 100%, 200% 100% !important;
  animation: ai-flow 6s ease-in-out infinite alternate;
  box-shadow: 0 10px 40px -12px rgba(20, 184, 166, .35) !important;
  transition: box-shadow .3s ease;
}

body.theme-dark .kb-search:focus-within {
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .15), 0 14px 50px -10px rgba(6, 182, 212, .45) !important;
}

body.theme-dark .kb-search input::placeholder {
  font-family: var(--mono);
  font-size: .92em;
}

body.theme-dark .kb-search button {
  background: var(--ai-grad) !important;
  background-size: 200% 100% !important;
  transition: background-position .4s ease, transform .2s ease;
}

body.theme-dark .kb-search button:hover {
  background-position: 100% 0 !important;
  transform: translateY(-1px);
}

body.theme-dark .kb-chip {
  font-family: var(--mono);
  font-size: .78rem !important;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

body.theme-dark .kb-chip:hover {
  border-color: var(--ai-2) !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .12);
  transform: translateY(-1px);
}

body.theme-dark .kb-card {
  position: relative;
  overflow: hidden;
}

body.theme-dark .kb-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--ai-grad);
  opacity: .0;
  transition: opacity .3s;
}

body.theme-dark .kb-card:hover::before {
  opacity: 1;
}

body.theme-dark .kb-card:hover {
  border-color: rgba(20, 184, 166, .45) !important;
  box-shadow: 0 18px 40px -20px rgba(14, 94, 75, .35) !important;
}

body.theme-dark .kb-dot-live {
  position: relative;
}

body.theme-dark .kb-dot-live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ai-2);
  animation: ai-ping 1.8s cubic-bezier(0,0,.2,1) infinite;
}

@keyframes ai-ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

body.theme-dark .kb-topbar {
  background: rgba(250, 249, 245, .78) !important;
  -webkit-backdrop-filter: saturate(160%) blur(16px) !important;
  backdrop-filter: saturate(160%) blur(16px) !important;
  border-bottom: 1px solid rgba(14, 94, 75, .08) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 8px 24px -18px rgba(14, 94, 75, .35);
}

body.theme-dark .kb-topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ai-2) 30%, var(--ai-3) 50%, var(--ai-4) 70%, transparent);
  background-size: 200% 100%;
  opacity: .55;
  animation: ai-line 7s linear infinite;
}

@keyframes ai-line { from { background-position: 200% 0; } to { background-position: 0 0; } }

body.theme-dark .kb-topbar .kb-logo {
  background: linear-gradient(135deg, #0E5E4B, #0f766e 60%, #0e7490) !important;
  box-shadow: 0 0 0 1px rgba(20,184,166,.25), 0 6px 18px -6px rgba(20,184,166,.55);
}

body.theme-dark .kb-topbar .kb-grad-text {
  animation: none !important;
  background: none !important;
  -webkit-text-fill-color: #0f766e !important;
  color: #0f766e !important;
  padding-right: .15em;
}

body.theme-dark .kb-topbar .truncate {
  overflow: visible;
}

body.theme-dark .kb-topbar .tracking-\[\.18em\] {
  font-family: var(--mono);
  font-size: 9.5px !important;
  letter-spacing: .14em !important;
}

body.theme-dark .kb-cmd-trigger {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(255,255,255,.7) !important;
  border: 1px solid rgba(14, 94, 75, .14) !important;
  transition: border-color .2s, box-shadow .2s;
}

body.theme-dark .kb-cmd-trigger:hover {
  border-color: rgba(20,184,166,.55) !important;
  box-shadow: 0 0 0 3px rgba(20,184,166,.12);
}

body.theme-dark .kb-cmd-trigger kbd {
  font-family: var(--mono);
  background: #fff !important;
  border: 1px solid rgba(14,94,75,.18) !important;
  box-shadow: 0 1px 0 rgba(14,94,75,.18);
}

body.theme-dark .kb-topbar nav.ml-auto {
  padding: 4px;
  gap: 2px !important;
  border: 1px solid rgba(14, 94, 75, .10);
  border-radius: 999px;
  background: rgba(255,255,255,.55);
}

body.theme-dark .kb-topbar .kb-nav {
  border-radius: 999px !important;
  padding: 6px 12px !important;
  font-size: 13px;
  font-weight: 500;
  color: #3f4a45 !important;
  gap: 6px;
  transition: background .2s, color .2s;
}

body.theme-dark .kb-topbar .kb-nav i {
  font-size: 12px;
  opacity: .8;
}

body.theme-dark .kb-topbar .kb-nav:hover {
  background: rgba(20,184,166,.10) !important;
  color: #0E5E4B !important;
}

body.theme-dark .kb-topbar .kb-nav.is-active {
  background: linear-gradient(120deg, #0E5E4B, #0f766e) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px -6px rgba(14,94,75,.6);
}

body.theme-dark .kb-topbar .kb-nav.is-active i {
  opacity: 1;
}

@media (min-width: 1100px) {
  body.theme-dark .kb-topbar .kb-nav span {
    display: inline !important;
  }
}

body.theme-dark .kb-topbar .kb-app-btn {
  background: linear-gradient(120deg, #16211C, #0E5E4B) !important;
  border-radius: 999px !important;
  box-shadow: 0 6px 16px -8px rgba(14,94,75,.7);
  transition: transform .2s, box-shadow .2s;
}

body.theme-dark .kb-topbar .kb-app-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px rgba(20,184,166,.6);
}

body.theme-dark .kb-search {
  border-width: 1.5px !important;
  border-radius: 18px !important;
  box-shadow:
    0 0 0 4px rgba(20, 184, 166, .06),
    0 14px 36px -18px rgba(6, 182, 212, .45) !important;
}

body.theme-dark .kb-search:focus-within {
  box-shadow:
    0 0 0 4px rgba(20, 184, 166, .14),
    0 16px 40px -16px rgba(6, 182, 212, .5) !important;
}

body.theme-dark .kb-search input::placeholder {
  color: #75827c;
}

body.theme-dark .kb-search .kb-search-ico {
  color: #0f766e !important;
}

body.theme-dark .kb-search button {
  border-radius: 12px !important;
  font-weight: 600;
}

/* ==========================================================================
   14. Light-theme contrast fixes (v3)
       Leftovers from the dark theme that showed white/pale text on paper.
   ========================================================================== */

/* AI answer: "Also good to know" bullets were #cbd5e1 on white */
body.theme-dark .kb-points li { color: #2F3833; }
body.theme-dark .kb-points li strong { color: var(--text); }

/* AI answer: assistant avatar — was an empty ring; now a filled orb with icon */
body.theme-dark .kb-mini-orb {
  background: linear-gradient(135deg, #0E5E4B, #0f766e 60%, #0e7490) !important;
  box-shadow: 0 0 0 1px rgba(20,184,166,.25), 0 6px 16px -6px rgba(20,184,166,.55);
  display: inline-grid; place-items: center;
  animation: none;
}
body.theme-dark .kb-mini-orb::after {
  content: "\e2ca";                                   /* fa-wand-magic-sparkles */
  font-family: "Font Awesome 6 Free"; font-weight: 900;
  position: static; inset: auto; background: none !important;
  color: #fff; font-size: 13px; line-height: 1;
}
/* while thinking: a teal arc spins around the orb */
body.theme-dark .kb-mini-orb.is-thinking::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 70%, #14B8A6 85%, #06B6D4 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  animation: ai-spin .9s linear infinite;
}

/* Ctrl-K palette: the "Ask AI" row icon was white on a pale tile */
body.theme-dark .kb-cmd-ico.is-ai {
  background: linear-gradient(135deg, #0E5E4B, #0f766e) !important;
  color: #fff !important;
}

/* Tailwind pale-text utilities used in guide, HSN, article and tools pages */
body.theme-dark .text-slate-200 { color: #2F3833 !important; }
body.theme-dark .text-teal-200  { color: #0f766e !important; }
body.theme-dark .text-amber-200,
body.theme-dark .text-amber-200\/90 { color: #92400e !important; }
body.theme-dark .text-rose-200,
body.theme-dark .\!text-rose-200 { color: #be123c !important; }
/* "!text-white" = Tailwind important variant; used on the selected HSN filter chips */
body.theme-dark .\!text-white { color: var(--accent) !important; }
body.theme-dark .\!bg-teal-400\/10,
body.theme-dark .\!bg-violet-400\/10 { background: var(--accent-soft) !important; }
body.theme-dark .\!border-teal-400\/60,
body.theme-dark .\!border-violet-400\/60 { border-color: var(--accent) !important; }

/* HSN rate pills (inline styles written for a dark background) */
body.theme-dark [style*="color:#c4b5fd"] { color: #6d28d9 !important; }
body.theme-dark [style*="color:#5eead4"] { color: #0f766e !important; }
body.theme-dark [style*="color:#fcd34d"] { color: #b45309 !important; }
body.theme-dark [style*="color:#fda4af"] { color: #be123c !important; }
body.theme-dark [style*="color:#cbd5e1"] { color: #475569 !important; }

/* Tools page: headings, inputs, results and status colours */
body.theme-dark .tool-h { color: var(--text); }
body.theme-dark .tool-i {
  background: #fff;
  color: var(--text);
  border-color: var(--line-2);
}
body.theme-dark .tool-i::placeholder { color: #8A908B; }
body.theme-dark .tool-i option { background: #fff; color: var(--text); }
body.theme-dark .out-box .v { color: var(--text); }
body.theme-dark .out-big { background: var(--accent-soft); border-color: #CFE0D7; }
body.theme-dark .out-big .v { color: var(--accent-ink); }
body.theme-dark main .ok   { color: #047857; }
body.theme-dark main .bad  { color: #be123c; }
body.theme-dark main .warn { color: #b45309; }

/* Respect reduced motion (kept last so it wins) */
@media (prefers-reduced-motion: reduce) {
  body.theme-dark *, body.theme-dark *::before, body.theme-dark *::after { animation: none !important; transition: none !important; }
}
