/* ============================================================================
   lesson-features.css — TaxTami lesson experience layer
   Powers (all injected by js/lesson-features.js, no per-page HTML needed):
     • reading progress bar + reading-time badge
     • floating reader toolbar (listen / dark / font / completion ring)
     • per-section read-ticks + completion ring
     • scroll-spy active state on the A–I nav
     • command palette (Ctrl/⌘-K)
     • dark mode + font scaling
   Theme: green #1a5038 / #2c724f, accent #c97a37.
   ========================================================================== */

/* ---- Reading progress bar --------------------------------------------- */
.tt-readbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(to right, #2c724f, #c97a37);
  z-index: 5000; transition: width 0.08s linear;
}

/* ---- Reading-time badge (in lesson header) ---------------------------- */
.tt-readtime {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; font-size: 12px; font-weight: 600;
  color: #6b7670; text-transform: uppercase; letter-spacing: 0.4px;
}
.tt-readtime::before { content: "\1F551"; font-size: 13px; }

/* ---- Floating reader toolbar ----------------------------------------- */
.tt-toolbar {
  position: fixed; right: 18px; bottom: 18px; z-index: 4600;
  display: flex; align-items: center; gap: 8px;
  background: #ffffff; border: 1px solid #e0e8e3; border-radius: 999px;
  box-shadow: 0 6px 22px rgba(20,50,35,0.16); padding: 7px 10px;
}
.tt-tool-btn {
  border: none; background: #f0f7f3; color: #1a5038;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.tt-tool-btn:hover { background: #2c724f; color: #fff; }
.tt-tool-btn.is-active { background: #c97a37; color: #fff; }
.tt-tool-label { font-size: 11px; color: #6b7670; font-weight: 600; padding: 0 4px; }

/* Completion ring (conic-gradient) */
.tt-ring {
  width: 40px; height: 40px; border-radius: 50%;
  background: conic-gradient(#2c724f calc(var(--pct,0) * 1%), #e6ebe8 0);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tt-ring__inner {
  width: 30px; height: 30px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #1a5038;
}

/* ---- Per-section read tick ------------------------------------------- */
.tt-tick {
  float: right; margin-left: 12px; margin-top: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #cdd8d2; background: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: transparent; flex-shrink: 0;
  transition: all 0.15s;
}
.tt-tick:hover { border-color: #2c724f; }
.tt-tick.is-done { background: #2c724f; border-color: #2c724f; color: #fff; }

/* ---- Scroll-spy active nav ------------------------------------------- */
.lesson-nav a.tt-current {
  background: #2c724f !important; color: #fff !important;
}

/* ---- Command palette -------------------------------------------------- */
.tt-palette-overlay {
  position: fixed; inset: 0; z-index: 6000; background: rgba(15,30,22,0.45);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh; backdrop-filter: blur(2px);
}
.tt-palette-overlay.is-open { display: flex; }
.tt-palette {
  width: 640px; max-width: calc(100vw - 32px); background: #fff;
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,0.3); overflow: hidden;
}
.tt-palette__input {
  width: 100%; border: none; outline: none; padding: 18px 20px;
  font-size: 17px; color: #1a2b22; border-bottom: 1px solid #eef3f0;
}
.tt-palette__results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.tt-palette__item {
  display: flex; align-items: baseline; gap: 10px; padding: 10px 14px;
  border-radius: 8px; cursor: pointer; text-decoration: none;
}
.tt-palette__item.is-active, .tt-palette__item:hover { background: #f0f7f3; }
.tt-palette__kind {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  color: #fff; background: #2c724f; border-radius: 4px; padding: 2px 6px; flex-shrink: 0;
}
.tt-palette__kind.k-term { background: #c97a37; }
.tt-palette__kind.k-leg { background: #4a6b5a; }
.tt-palette__title { color: #1a2b22; font-size: 14px; font-weight: 600; }
.tt-palette__sub { color: #6b7670; font-size: 12px; }
.tt-palette__hint { padding: 8px 16px; font-size: 11px; color: #9aa5a0; border-top: 1px solid #eef3f0; }

/* keyboard hint chip near toolbar */
.tt-kbd { font: inherit; font-size: 10px; background: #eef3f0; border-radius: 4px; padding: 1px 5px; color: #46524c; }

/* ======================================================================
   DARK MODE  (html[data-theme="dark"])
   Palette rules:
     • ALL body text is white / near-white — never mid-grey.
     • Greens are LIGHT on dark (#7fd8a6 / #9fe3bd) for headings and accents;
       dark greens are used only as surfaces, never as text.
     • Surfaces step up in lightness: page #0f1c17 < card #172a22 < raised #1e3529.
     • Amber accent lightened to #f0b24a so it reads on dark.
   ====================================================================== */
html[data-theme="dark"] {
  --tt-bg:      #0f1c17;   /* page */
  --tt-surface: #172a22;   /* cards, panels, sidebar */
  --tt-raised:  #1e3529;   /* headers, hovers, chips */
  --tt-line:    #2f4d3e;   /* borders */
  --tt-text:    #ffffff;   /* body text — white */
  --tt-dim:     #d7e6dd;   /* secondary text, still bright */
  --tt-green:   #7fd8a6;   /* headings / links */
  --tt-green-2: #9fe3bd;   /* hover / brighter accent */
  --tt-amber:   #f0b24a;   /* accent, highlights */
}

/* ---- Page + containers ------------------------------------------------ */
html[data-theme="dark"] body { background: var(--tt-bg) !important; color: var(--tt-text) !important; }
html[data-theme="dark"] .sidebar-page-container,
html[data-theme="dark"] .auto-container,
html[data-theme="dark"] .service-detail,
html[data-theme="dark"] .inner-box { background: transparent !important; color: var(--tt-text); }

/* ---- All text white ---------------------------------------------------- */
html[data-theme="dark"] .lesson-details .section-content,
html[data-theme="dark"] .lesson-details .section-content p,
html[data-theme="dark"] .lesson-details .section-content li,
html[data-theme="dark"] .lesson-details .section-content td,
html[data-theme="dark"] .lesson-details .section-content th,
html[data-theme="dark"] .lesson-overview-card__cell p,
html[data-theme="dark"] .lesson-page-header .lesson-excerpt,
html[data-theme="dark"] .tt-leg-body,
html[data-theme="dark"] .tt-leg-block,
html[data-theme="dark"] .tt-def-tip__body,
html[data-theme="dark"] .tt-lesson-flyout,
html[data-theme="dark"] .tt-lesson-flyout__summary,
html[data-theme="dark"] .tt-lesson-flyout__objectives li,
html[data-theme="dark"] .tt-palette__title,
html[data-theme="dark"] .tt-msg.bot { color: var(--tt-text) !important; }

/* Secondary text stays bright, not grey */
html[data-theme="dark"] .lesson-section-desc,
html[data-theme="dark"] .tt-readtime,
html[data-theme="dark"] .tt-palette__sub,
html[data-theme="dark"] .tt-palette__hint,
html[data-theme="dark"] .tt-lesson-flyout__label,
html[data-theme="dark"] .tt-leg-amend__asat { color: var(--tt-dim) !important; }

/* ---- Headings + links: light green ------------------------------------ */
html[data-theme="dark"] .lesson-page-header .lesson-name,
html[data-theme="dark"] .lesson-details .section-content h3,
html[data-theme="dark"] .lesson-details .section-content h4,
html[data-theme="dark"] .lesson-details .section-content h5,
html[data-theme="dark"] .lesson-details .lesson-summary h2,
html[data-theme="dark"] .lesson-overview-card__cell h3,
html[data-theme="dark"] .tt-def-tip__term,
html[data-theme="dark"] .tt-lesson-flyout__title,
html[data-theme="dark"] .tt-map__head h3,
html[data-theme="dark"] .tt-leg-block .tt-leg-id { color: var(--tt-green) !important; }
html[data-theme="dark"] .lesson-details .section-content h3,
html[data-theme="dark"] .lesson-details .section-content h4,
html[data-theme="dark"] .lesson-details .section-content h5 { border-bottom-color: var(--tt-line) !important; }
html[data-theme="dark"] .lesson-details .section-content strong,
html[data-theme="dark"] .lesson-details .section-content b,
html[data-theme="dark"] .lesson-details .section-content em,
html[data-theme="dark"] code { color: #ffffff !important; }

/* ---- Surfaces ---------------------------------------------------------- */
html[data-theme="dark"] .lesson-overview-card,
html[data-theme="dark"] .lesson-details,
html[data-theme="dark"] .dom-sidebar,
html[data-theme="dark"] .customs-sidebar,
html[data-theme="dark"] .tt-leg-panel,
html[data-theme="dark"] .tt-leg-modal,
html[data-theme="dark"] .tt-def-tip,
html[data-theme="dark"] .tt-lesson-flyout,
html[data-theme="dark"] .tt-toolbar,
html[data-theme="dark"] .tt-palette,
html[data-theme="dark"] .tt-map,
html[data-theme="dark"] .tt-tutor {
  background: var(--tt-surface) !important;
  border-color: var(--tt-line) !important;
  color: var(--tt-text) !important;
}
html[data-theme="dark"] .lesson-summary,
html[data-theme="dark"] .lesson-details > summary,
html[data-theme="dark"] .tt-leg-head,
html[data-theme="dark"] .tt-leg-note,
html[data-theme="dark"] .tt-map__head,
html[data-theme="dark"] .tt-tutor__log {
  background: var(--tt-raised) !important;
  color: var(--tt-text) !important;
  border-color: var(--tt-line) !important;
}
html[data-theme="dark"] .lesson-summary:hover { background: #24402f !important; }
html[data-theme="dark"] .lesson-overview-card__cell,
html[data-theme="dark"] .lesson-overview-card__cell:last-child { border-color: var(--tt-line) !important; }
html[data-theme="dark"] .lesson-overview-card__head { background: linear-gradient(to right, #1e3529, #264736) !important; }
html[data-theme="dark"] .lesson-overview-card__num { background: var(--tt-raised) !important; color: var(--tt-green) !important; }

/* ---- Sidebar ----------------------------------------------------------- */
html[data-theme="dark"] .dom-sidebar-item { color: var(--tt-dim) !important; }
html[data-theme="dark"] .dom-sidebar-item:hover { background: var(--tt-raised) !important; color: #fff !important; }
html[data-theme="dark"] .dom-sidebar-item.active { background: #2f6b4c !important; color: #fff !important; }
html[data-theme="dark"] .dom-sidebar-header h3 { color: var(--tt-green) !important; }
html[data-theme="dark"] .dom-sidebar-header p,
html[data-theme="dark"] .dom-sidebar-header a { color: var(--tt-dim) !important; }
html[data-theme="dark"] .dom-sidebar-module { background: linear-gradient(to right, #264736, #2f6b4c) !important; color: #fff !important; }
html[data-theme="dark"] .dom-sidebar-submodule { background: var(--tt-raised) !important; color: var(--tt-green) !important; border-left-color: var(--tt-green) !important; }
html[data-theme="dark"] .dom-sidebar-item .lesson-tag { background: var(--tt-raised) !important; color: var(--tt-green) !important; }
html[data-theme="dark"] .dom-sidebar-item .icon { color: var(--tt-amber) !important; }

/* ---- Section nav ------------------------------------------------------- */
html[data-theme="dark"] .lesson-nav a { background: var(--tt-raised) !important; color: var(--tt-dim) !important; border-color: var(--tt-line) !important; }
html[data-theme="dark"] .lesson-nav a:hover { background: #2f6b4c !important; color: #fff !important; }
html[data-theme="dark"] .lesson-nav a.tt-current { background: #3d8a63 !important; color: #fff !important; }

/* ---- Inline marks ------------------------------------------------------ */
html[data-theme="dark"] .tt-key {
  background: rgba(240,178,74,0.22) !important;
  box-shadow: 0 0 0 1px rgba(240,178,74,0.35) !important;
  color: #ffe9c2 !important;
}
html[data-theme="dark"] .def-ref { border-bottom-color: var(--tt-green) !important; }
html[data-theme="dark"] .def-ref:hover { background: var(--tt-raised) !important; }
html[data-theme="dark"] .lesson-link { color: var(--tt-green) !important; border-bottom-color: var(--tt-line) !important; }
html[data-theme="dark"] .lesson-link:hover { color: var(--tt-amber) !important; border-bottom-color: var(--tt-amber) !important; }
html[data-theme="dark"] .lesson-link::before { color: var(--tt-amber) !important; }
html[data-theme="dark"] .leg-ref { color: var(--tt-green) !important; }
html[data-theme="dark"] .tt-enum-mark { color: var(--tt-green) !important; }
html[data-theme="dark"] .lesson-details .section-content li::marker { color: var(--tt-green) !important; }
html[data-theme="dark"] .lesson-details .section-content blockquote {
  background: var(--tt-raised) !important; border-left-color: var(--tt-green) !important;
}

/* ---- Legislation popup ------------------------------------------------- */
html[data-theme="dark"] .tt-leg-head h4 { color: var(--tt-green) !important; }
html[data-theme="dark"] .tt-leg-head small { color: #ffffff !important; }
html[data-theme="dark"] .tt-leg-close { background: var(--tt-line) !important; color: #fff !important; }
html[data-theme="dark"] .tt-leg-block.is-target { background: rgba(240,178,74,0.20) !important; box-shadow: inset 3px 0 0 var(--tt-amber) !important; }
html[data-theme="dark"] .tt-leg-block.is-target .tt-leg-id { color: var(--tt-amber) !important; }
html[data-theme="dark"] .tt-leg-note b { color: var(--tt-amber) !important; }
html[data-theme="dark"] .tt-leg-amend {
  background: rgba(240,178,74,0.14) !important; border-color: rgba(240,178,74,0.38) !important; color: #ffefd6 !important;
}
html[data-theme="dark"] .tt-leg-amend b,
html[data-theme="dark"] .tt-leg-amend__more > summary { color: var(--tt-amber) !important; }
html[data-theme="dark"] .tt-leg-amend__tag { background: var(--tt-amber) !important; color: #24170a !important; }
html[data-theme="dark"] .tt-def-tip__ref { color: var(--tt-amber) !important; }
html[data-theme="dark"] .tt-def-tip__head { border-bottom-color: var(--tt-line) !important; }

/* ---- Toolbar / palette / tutor ---------------------------------------- */
html[data-theme="dark"] .tt-tool-btn { background: var(--tt-raised) !important; color: var(--tt-green) !important; }
html[data-theme="dark"] .tt-tool-btn:hover { background: #2f6b4c !important; color: #fff !important; }
html[data-theme="dark"] .tt-tool-btn.is-active { background: var(--tt-amber) !important; color: #24170a !important; }
html[data-theme="dark"] .tt-ring { background: conic-gradient(var(--tt-green) calc(var(--pct,0) * 1%), var(--tt-line) 0) !important; }
html[data-theme="dark"] .tt-ring__inner { background: var(--tt-surface) !important; color: var(--tt-green) !important; }
html[data-theme="dark"] .tt-tick { background: var(--tt-raised) !important; border-color: var(--tt-line) !important; }
html[data-theme="dark"] .tt-tick.is-done { background: var(--tt-green) !important; border-color: var(--tt-green) !important; color: #0f1c17 !important; }
html[data-theme="dark"] .tt-palette__input { background: var(--tt-surface) !important; color: #fff !important; border-bottom-color: var(--tt-line) !important; }
html[data-theme="dark"] .tt-palette__item.is-active,
html[data-theme="dark"] .tt-palette__item:hover { background: var(--tt-raised) !important; }
html[data-theme="dark"] .tt-palette__kind { background: #2f6b4c !important; color: #fff !important; }
html[data-theme="dark"] .tt-palette__kind.k-term { background: var(--tt-amber) !important; color: #24170a !important; }
html[data-theme="dark"] .tt-msg.bot { background: var(--tt-raised) !important; border-color: var(--tt-line) !important; }
html[data-theme="dark"] .tt-msg.user { background: #2f6b4c !important; color: #fff !important; }
html[data-theme="dark"] .tt-tutor__input { background: var(--tt-raised) !important; color: #fff !important; border-color: var(--tt-line) !important; }
html[data-theme="dark"] .tt-map__close { background: var(--tt-raised) !important; color: var(--tt-green) !important; }

/* ---- Tables ------------------------------------------------------------ */
html[data-theme="dark"] table, html[data-theme="dark"] th, html[data-theme="dark"] td { border-color: var(--tt-line) !important; }
html[data-theme="dark"] thead th { background: var(--tt-raised) !important; color: var(--tt-green) !important; }
html[data-theme="dark"] tbody tr:nth-child(even) { background: rgba(255,255,255,0.03) !important; }


/* ---- Font scaling ---------------------------------------------------- */
/* Font scaling — a multiplier applied to the ELEMENTS that carry text.
   Scaling only the container did nothing, because paragraphs, list items and
   headings set their own sizes and simply overrode the inherited value. */
html { --tt-fs: 1; }
html[data-fontscale="large"]  { --tt-fs: 1.13; }
html[data-fontscale="xlarge"] { --tt-fs: 1.28; }

.lesson-details .section-content p,
.lesson-details .section-content li,
.lesson-details .section-content td,
.lesson-details .section-content th,
.lesson-details .section-content blockquote,
.lesson-details .section-content .tt-enum-item {
  font-size: calc(15px * var(--tt-fs, 1)) !important;
}
.lesson-details .section-content h3,
.lesson-details .section-content h4,
.lesson-details .section-content h5 {
  font-size: calc(1.15rem * var(--tt-fs, 1)) !important;
}
.lesson-details .lesson-summary h2 { font-size: calc(1.05rem * var(--tt-fs, 1)) !important; }
.lesson-section-desc              { font-size: calc(13px * var(--tt-fs, 1)) !important; }
.lesson-overview-card__cell p     { font-size: calc(13.5px * var(--tt-fs, 1)) !important; }

/* Show the current step on the button so the control feels responsive */
html[data-fontscale="large"]  .tt-tool-btn.tt-font-btn::after { content: "+"; font-size: 9px; }
html[data-fontscale="xlarge"] .tt-tool-btn.tt-font-btn::after { content: "++"; font-size: 9px; }

/* ---- Concept map modal ------------------------------------------------ */
.tt-map-overlay {
  position: fixed; inset: 0; z-index: 6000; background: rgba(15,30,22,0.55);
  display: none; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(2px);
}
.tt-map-overlay.is-open { display: flex; }
.tt-map {
  background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.32);
  width: 860px; max-width: 100%; max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.tt-map__head {
  padding: 14px 20px; border-bottom: 1px solid #eef3f0;
  display: flex; align-items: center; justify-content: space-between;
}
.tt-map__head h3 { margin: 0; color: #1a5038; font-size: 16px; font-weight: 700; }
.tt-map__close { border: none; background: #f0f7f3; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; color: #1a5038; font-size: 16px; }
.tt-map__body { overflow: auto; padding: 8px; }
.tt-map svg text { font-family: inherit; }
.tt-map-node { cursor: pointer; }
.tt-map-node:hover circle { stroke: #c97a37; stroke-width: 3; }

/* ---- AI tutor chat ---------------------------------------------------- */
.tt-tutor-launch {
  position: fixed; right: 18px; bottom: 70px; z-index: 4600;
  background: linear-gradient(135deg, #1e5c3a, #2c724f); color: #fff;
  border: none; border-radius: 999px; padding: 11px 18px; cursor: pointer;
  font-size: 14px; font-weight: 700; box-shadow: 0 8px 24px rgba(20,50,35,0.28);
  display: inline-flex; align-items: center; gap: 8px;
}
.tt-tutor-launch:hover { filter: brightness(1.07); }
.tt-tutor {
  position: fixed; right: 18px; bottom: 18px; z-index: 4700;
  width: 380px; max-width: calc(100vw - 24px); height: 540px; max-height: calc(100vh - 36px);
  background: #fff; border: 1px solid #dbe6e0; border-radius: 16px;
  box-shadow: 0 20px 54px rgba(20,50,35,0.28); display: none; flex-direction: column; overflow: hidden;
}
.tt-tutor.is-open { display: flex; }
.tt-tutor__head { background: linear-gradient(135deg, #1e5c3a, #2c724f); color: #fff; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; }
.tt-tutor__head strong { font-size: 14px; }
.tt-tutor__head small { display: block; font-size: 11px; opacity: 0.85; font-weight: 400; }
.tt-tutor__close { background: rgba(255,255,255,0.2); border: none; color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.tt-tutor__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #f7faf8; }
.tt-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.tt-msg.user { align-self: flex-end; background: #2c724f; color: #fff; border-bottom-right-radius: 3px; }
.tt-msg.bot { align-self: flex-start; background: #fff; color: #26332c; border: 1px solid #e6ebe8; border-bottom-left-radius: 3px; }
.tt-msg.bot.thinking { color: #6b7670; font-style: italic; }
.tt-tutor__foot { border-top: 1px solid #eef3f0; padding: 10px; display: flex; gap: 8px; }
.tt-tutor__input { flex: 1; border: 1px solid #d7e2db; border-radius: 10px; padding: 9px 11px; font-size: 13px; resize: none; outline: none; font-family: inherit; }
.tt-tutor__send { border: none; background: #2c724f; color: #fff; border-radius: 10px; padding: 0 14px; cursor: pointer; font-weight: 700; }
.tt-tutor__disclaimer { font-size: 10px; color: #9aa5a0; padding: 0 12px 8px; text-align: center; }
html[data-theme="dark"] .tt-tutor, html[data-theme="dark"] .tt-map { background: #182e25; color: #d7e2db; }
html[data-theme="dark"] .tt-tutor__log { background: #10201a; }
html[data-theme="dark"] .tt-msg.bot { background: #1f3529; border-color: #2b4638; color: #d7e2db; }

@media print {
  .tt-toolbar, .tt-readbar, .tt-palette-overlay, .tt-tick,
  .tt-tutor, .tt-tutor-launch, .tt-map-overlay { display: none !important; }
}

/* ======================================================================
   DARK MODE — NO WHITE BACKGROUNDS ANYWHERE
   The theme paints ~20 containers #ffffff (header, sticky header, menu,
   dropdowns, section nav, sidebar blocks, panels). Blanket-clear them, then
   re-assert the intended dark surfaces. Only TEXT may be white.
   ====================================================================== */

/* 1. Blanket: strip light backgrounds from every structural element. */
html[data-theme="dark"] header,
html[data-theme="dark"] nav,
html[data-theme="dark"] section,
html[data-theme="dark"] aside,
html[data-theme="dark"] article,
html[data-theme="dark"] main,
html[data-theme="dark"] div,
html[data-theme="dark"] ul,
html[data-theme="dark"] ol,
html[data-theme="dark"] li,
html[data-theme="dark"] figure,
html[data-theme="dark"] form,
html[data-theme="dark"] .auto-container,
html[data-theme="dark"] .inner-container,
html[data-theme="dark"] .page-wrapper,
html[data-theme="dark"] .content-side,
html[data-theme="dark"] .sidebar-side { background-color: transparent !important; }

/* 2. Site header + main menu + dropdowns */
html[data-theme="dark"] .main-header,
html[data-theme="dark"] .main-header .header-upper,
html[data-theme="dark"] .main-header .header-lower,
html[data-theme="dark"] .sticky-header,
html[data-theme="dark"] .header-style-two,
html[data-theme="dark"] .main-menu,
html[data-theme="dark"] .main-menu .navigation > li > ul,
html[data-theme="dark"] .main-menu .navigation > li > ul > li > ul,
html[data-theme="dark"] .main-menu .navbar-collapse,
html[data-theme="dark"] .nav-outer,
html[data-theme="dark"] .mobile-menu .menu-box {
  background-color: var(--tt-surface) !important;
  border-color: var(--tt-line) !important;
}
html[data-theme="dark"] .main-menu .navigation > li > a,
html[data-theme="dark"] .main-menu .navigation > li > ul > li > a,
html[data-theme="dark"] .mobile-menu .navigation li > a { color: #ffffff !important; }
html[data-theme="dark"] .main-menu .navigation > li:hover > a,
html[data-theme="dark"] .main-menu .navigation > li.current > a,
html[data-theme="dark"] .main-menu .navigation > li > ul > li:hover > a { color: var(--tt-green) !important; }
html[data-theme="dark"] .main-menu .navigation > li > ul > li { border-color: var(--tt-line) !important; }
html[data-theme="dark"] .sticky-header { box-shadow: 0 2px 12px rgba(0,0,0,0.45) !important; }

/* 3. Section navigation (the A–I button strip) */
html[data-theme="dark"] .lesson-nav {
  background: var(--tt-surface) !important;
  border-color: var(--tt-line) !important;
}
html[data-theme="dark"] .lesson-nav::before { color: var(--tt-green) !important; }

/* 4. "All TaxTami Lessons" sidebar header block */
html[data-theme="dark"] .dom-sidebar-header,
html[data-theme="dark"] .customs-sidebar-header {
  background: var(--tt-surface) !important;    /* same tone as the sidebar, but OPAQUE */
  border-bottom-color: var(--tt-line) !important;
}
html[data-theme="dark"] .dom-sidebar-header h3 { color: var(--tt-green) !important; }
html[data-theme="dark"] .dom-sidebar-header p { color: var(--tt-dim) !important; }
html[data-theme="dark"] .dom-sidebar-header a { color: var(--tt-amber) !important; }

/* 5. Page/lesson header band + footer */
html[data-theme="dark"] .lesson-page-header {
  background: var(--tt-surface) !important;
  border-color: var(--tt-line) !important;
}
html[data-theme="dark"] .lesson-page-header .lesson-number { color: var(--tt-amber) !important; }
html[data-theme="dark"] .main-footer,
html[data-theme="dark"] .footer-bottom { background-color: var(--tt-bg) !important; color: var(--tt-dim) !important; }

/* 6. Any remaining generic panels the theme leaves white */
html[data-theme="dark"] .service-detail .inner-box,
html[data-theme="dark"] .sidebar-widget,
html[data-theme="dark"] .widget-content,
html[data-theme="dark"] .search-box,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background-color: var(--tt-surface) !important;
  color: #ffffff !important;
  border-color: var(--tt-line) !important;
}
html[data-theme="dark"] ::placeholder { color: #9fb3a8 !important; }

/* 7. Re-assert our own surfaces after the blanket (blanket used !important) */
html[data-theme="dark"] .lesson-overview-card,
html[data-theme="dark"] .lesson-details,
html[data-theme="dark"] .dom-sidebar,
html[data-theme="dark"] .customs-sidebar,
html[data-theme="dark"] .tt-leg-panel,
html[data-theme="dark"] .tt-leg-modal,
html[data-theme="dark"] .tt-def-tip,
html[data-theme="dark"] .tt-lesson-flyout,
html[data-theme="dark"] .tt-toolbar,
html[data-theme="dark"] .tt-palette,
html[data-theme="dark"] .tt-map,
html[data-theme="dark"] .tt-tutor { background-color: var(--tt-surface) !important; }
html[data-theme="dark"] .lesson-summary,
html[data-theme="dark"] .tt-leg-head,
html[data-theme="dark"] .tt-leg-note,
html[data-theme="dark"] .tt-map__head,
html[data-theme="dark"] .tt-tutor__log,
html[data-theme="dark"] .dom-sidebar-submodule,
html[data-theme="dark"] .tt-tool-btn,
html[data-theme="dark"] .tt-tick { background-color: var(--tt-raised) !important; }
html[data-theme="dark"] .lesson-details .section-content blockquote { background-color: var(--tt-raised) !important; }
html[data-theme="dark"] .lesson-overview-card__head { background: linear-gradient(to right, #1e3529, #264736) !important; }
html[data-theme="dark"] .dom-sidebar-module { background: linear-gradient(to right, #264736, #2f6b4c) !important; }
html[data-theme="dark"] .lesson-nav a { background-color: var(--tt-raised) !important; }
html[data-theme="dark"] .lesson-nav a:hover { background-color: #2f6b4c !important; }
html[data-theme="dark"] .lesson-nav a.tt-current { background-color: #3d8a63 !important; }
html[data-theme="dark"] .dom-sidebar-item:hover { background-color: var(--tt-raised) !important; }
html[data-theme="dark"] .dom-sidebar-item.active { background-color: #2f6b4c !important; }
html[data-theme="dark"] .tt-msg.user { background-color: #2f6b4c !important; }
html[data-theme="dark"] .tt-msg.bot { background-color: var(--tt-raised) !important; }
html[data-theme="dark"] .tt-tool-btn.is-active { background-color: var(--tt-amber) !important; }
html[data-theme="dark"] .tt-tick.is-done { background-color: var(--tt-green) !important; }
html[data-theme="dark"] .tt-palette__kind { background-color: #2f6b4c !important; }
html[data-theme="dark"] .tt-palette__kind.k-term { background-color: var(--tt-amber) !important; }
html[data-theme="dark"] thead th { background-color: var(--tt-raised) !important; }
html[data-theme="dark"] tbody tr:nth-child(even) { background-color: rgba(255,255,255,0.03) !important; }
html[data-theme="dark"] .tt-key { background-color: rgba(240,178,74,0.22) !important; }
html[data-theme="dark"] .tt-leg-amend { background-color: rgba(240,178,74,0.14) !important; }
html[data-theme="dark"] .tt-leg-block.is-target { background-color: rgba(240,178,74,0.20) !important; }
html[data-theme="dark"] .tt-leg-amend__tag { background-color: var(--tt-amber) !important; }
html[data-theme="dark"] .lesson-overview-card__num { background-color: var(--tt-raised) !important; }
html[data-theme="dark"] .dom-sidebar-item .lesson-tag { background-color: var(--tt-raised) !important; }

/* Main menu: ALL items white in dark mode (no mixed green/white). */
html[data-theme="dark"] .main-menu .navigation > li > a,
html[data-theme="dark"] .main-menu .navigation > li:hover > a,
html[data-theme="dark"] .main-menu .navigation > li.current > a,
html[data-theme="dark"] .main-menu .navigation > li.current-menu-item > a,
html[data-theme="dark"] .main-menu .navigation > li > ul > li > a,
html[data-theme="dark"] .main-menu .navigation > li > ul > li:hover > a,
html[data-theme="dark"] .main-menu .navigation > li > ul > li > ul > li > a,
html[data-theme="dark"] .mobile-menu .navigation li > a,
html[data-theme="dark"] .main-menu .navigation > li > a:hover,
html[data-theme="dark"] .main-menu .navigation > li > a:focus {
  color: #ffffff !important;
}
/* Menu is ONE solid colour — no boxes behind hover/current items.
   The active item is signalled by an underline, not a background block. */
html[data-theme="dark"] .main-menu .navigation > li > a,
html[data-theme="dark"] .main-menu .navigation > li:hover > a,
html[data-theme="dark"] .main-menu .navigation > li.current > a,
html[data-theme="dark"] .main-menu .navigation > li.current-menu-item > a {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .main-menu .navigation > li.current > a,
html[data-theme="dark"] .main-menu .navigation > li:hover > a {
  box-shadow: inset 0 -2px 0 var(--tt-green) !important;
}

/* ---- Toolbar icons: strictly green / white, no emoji colour ------------ */
.tt-tool-btn { color: #1a5038; }
.tt-tool-btn svg { display: block; }
.tt-tool-btn:hover, .tt-tool-btn:hover svg { color: #ffffff; }
.tt-tool-btn.is-active, .tt-tool-btn.is-active svg { color: #ffffff; }
/* Strip the colour from any emoji glyph still used as a label (▶ ◐ etc.) */
.tt-tool-btn { font-variant-emoji: text; }
html[data-theme="dark"] .tt-tool-btn { color: var(--tt-green) !important; }
html[data-theme="dark"] .tt-tool-btn:hover,
html[data-theme="dark"] .tt-tool-btn:hover svg { color: #ffffff !important; }
html[data-theme="dark"] .tt-tool-btn.is-active,
html[data-theme="dark"] .tt-tool-btn.is-active svg { color: #24170a !important; }
