/* ═══════════════════════════════════════════════════════════════
   Windrose AU Owner's Manual — Service Portal Stylesheet v2
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --hdr-bg: #1a2332;
  --hdr-fg: #f0f4f8;
  --nav-bg: #f5f7fa;
  --nav-border: #dde3ea;
  --nav-active: #0b5ed7;
  --main-bg: #ffffff;
  --text: #222831;
  --text-muted: #5a6577;
  --accent: #0b5ed7;
  --accent-light: #e8f0fe;
  --warning-bg: #fff3cd;
  --warning-border: #e6a817;
  --warning-text: #664d03;
  --notice-bg: #fff3e0;
  --notice-border: #f57c00;
  --notice-text: #7a4100;
  --note-bg: #e3f2fd;
  --note-border: #1976d2;
  --note-text: #0d47a1;
  --env-bg: #e8f5e9;
  --env-border: #43a047;
  --env-text: #1b5e20;
  --table-header: #eef2f7;
  --table-border: #d0d7e0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,.12);
  --radius: 6px;
  --sidebar-w: 300px;
  --header-h: 118px;
  --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ═══════════════════════════════════════════════════════════════
   WINDROSE MAIN-SITE HEADER STYLE
   Stack: topbar(44px) + lang-row(36px) + topnav(44px) = 124px
   ═══════════════════════════════════════════════════════════════ */

/* Hide old site-header (safety net) */
.site-header { display: none !important; }

/* ── Topbar (blue) ── */
#manual-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 103;
  height: 44px; background: #1a6abf;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; box-sizing: border-box; gap: 0.75rem;
}
.manual-edition-name {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 0.85rem; letter-spacing: 0.08em; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
#manual-topbar > a {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 0.8rem; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.85); text-decoration: none;
  padding: 0.2rem 0.7rem;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 3px; white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
#manual-topbar > a:hover {
  background: rgba(255,255,255,0.15); color: #fff; text-decoration: none;
}

/* ── Edition / lang-row (dark navy) ── */
#manual-lang-row {
  position: fixed; top: 38px; left: 0; right: 0; z-index: 102;
  height: 36px; background: rgba(6,15,30,0.97);
  border-bottom: 1px solid rgba(74,158,255,0.12);
  display: flex; align-items: center;
  padding: 0 1rem; box-sizing: border-box;
  overflow-x: auto; scrollbar-width: none;
}
#manual-lang-row::-webkit-scrollbar { display: none; }
#manual-edition-select-wrap {
  display: flex; align-items: center; width: 100%;
}
#manual-edition-select-wrap .lang-select,
#manual-edition-select-wrap select {
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(74,158,255,0.28) !important;
  color: #f0f4ff !important;
  font-size: 13px; padding: 4px 10px;
  border-radius: 4px; cursor: pointer;
  max-width: 360px; width: 100%; outline: none; font-family: inherit;
}
#manual-edition-select-wrap .lang-select:hover,
#manual-edition-select-wrap select:hover {
  background: rgba(255,255,255,0.12) !important;
}
#manual-edition-select-wrap option { background: #0d1f38; color: #f0f4ff; }

/* ── Top nav (dark navy, main site links) ── */
#manual-topnav {
  position: fixed; top: 74px; left: 0; right: 0; z-index: 100;
  height: 44px; background: rgba(6,15,30,0.97);
  border-bottom: 1px solid rgba(74,158,255,0.12);
  display: flex; align-items: stretch; overflow: visible; box-sizing: border-box;
}
#manual-topnav .nav-toggle {
  background: transparent;
  border: none; border-right: 1px solid rgba(74,158,255,0.12);
  color: #f0f4ff; font-size: 1.15rem;
  padding: 0 1rem; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#manual-topnav .nav-toggle:hover { background: rgba(74,158,255,0.08); }
#manual-topnav .logo {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 1.15rem; letter-spacing: 0.08em; color: #4a9eff;
  text-decoration: none; display: flex; align-items: center;
  padding: 0 1.2rem; border-right: 1px solid rgba(74,158,255,0.12);
  white-space: nowrap; flex-shrink: 0;
}
#manual-topnav .logo:hover { color: #7ec4ff; text-decoration: none; }
#manual-topnav .nav-links {
  display: flex; list-style: none; margin: 0; padding: 0;
  flex: 1; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
#manual-topnav .nav-links::-webkit-scrollbar { display: none; }
#manual-topnav .nav-links li {
  flex: 1 1 0; display: flex; min-width: 6.5rem;
}
#manual-topnav .nav-links a {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 0.875rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(120,160,200,0.9); text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  border-right: 1px solid rgba(74,158,255,0.12); white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
#manual-topnav .nav-links li:last-child a { border-right: none; }
#manual-topnav .nav-links a:hover {
  background: rgba(74,158,255,0.08); color: #f0f4ff; text-decoration: none;
}

/* RTL overrides */
[dir="rtl"] #manual-topnav .nav-toggle {
  border-right: none; border-left: 1px solid rgba(74,158,255,0.12);
}
[dir="rtl"] #manual-topnav .logo {
  border-right: none; border-left: 1px solid rgba(74,158,255,0.12);
}
[dir="rtl"] #manual-topnav .nav-links a {
  border-right: none; border-left: 1px solid rgba(74,158,255,0.12);
}
[dir="rtl"] #manual-topnav .nav-links li:last-child a { border-left: none; }

/* ── AI-powered unified search ── */
.ai-search { position: relative; padding: 8px 14px 4px; }
.ai-search-form { display: flex; align-items: center; gap: 6px; }
.ai-search-form input[type="search"] {
  flex: 1; padding: 7px 12px;
  border: 1px solid var(--nav-border); border-radius: 20px;
  background: #fff; color: var(--text); font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-search-form input[type="search"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11,94,215,0.15);
}
.ai-search-btn {
  flex-shrink: 0; width: 28px; height: 28px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 50%; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.ai-search-btn:hover { background: #0a4fc4; }
.ai-search .search-results {
  position: absolute; top: calc(100% - 4px); left: 14px; right: 14px;
  background: #fff; color: var(--text); border-radius: var(--radius);
  box-shadow: var(--shadow-md); max-height: 380px; overflow-y: auto;
  border: 1px solid var(--nav-border); z-index: 999;
}
.ai-answer {
  display: none; margin: 4px 0 0;
  background: #f0f6ff; border: 1px solid #b8d4f8;
  border-radius: var(--radius); overflow: hidden;
}
.ai-answer-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 600;
}
.ai-close {
  background: none; border: none; color: #fff; font-size: 18px;
  cursor: pointer; line-height: 1; padding: 0;
}
.ai-close:hover { opacity: 0.7; }
.ai-answer-body {
  padding: 12px; font-size: 13px; line-height: 1.6;
  max-height: 300px; overflow-y: auto; color: var(--text);
  white-space: pre-wrap;
}
.ai-thinking { color: var(--text-muted); font-style: italic; }

/* Mobile compact header */
@media (max-width: 600px) {
  #manual-topbar { height: 36px; padding: 0 0.75rem; }
  .manual-edition-name { font-size: 0.78rem; letter-spacing: 0.04em; }
  #manual-lang-row { top: 36px; }
  #manual-topnav { top: 72px; }
}


html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: #eef1f5;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--header-h);
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow-md);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-size: 20px; font-weight: 600; white-space: nowrap; }
.nav-toggle {
  background: transparent; border: 1px solid rgba(255,255,255,.25);
  color: var(--hdr-fg); font-size: 20px; padding: 4px 10px;
  border-radius: 4px; cursor: pointer; display: none;
}
.nav-toggle:hover { background: rgba(255,255,255,.1); }

/* ── Search ────────────────────────────────────────────────── */
.header-search { position: relative; flex: 0 1 440px; }
.header-search input {
  width: 100%; padding: 8px 14px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  background: rgba(255,255,255,.1);
  color: #fff; font-size: 14px;
  transition: all .2s;
}
.header-search input::placeholder { color: rgba(255,255,255,.5); }
.header-search input:focus {
  outline: none; background: rgba(255,255,255,.15);
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11,94,215,.3);
}
.search-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; color: var(--text); border-radius: var(--radius);
  box-shadow: var(--shadow-md); max-height: 420px; overflow-y: auto;
  margin-top: 6px; border: 1px solid var(--nav-border);
}
.sr-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 10px 14px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid #f0f0f0; transition: background .15s;
}
.sr-item:hover { background: var(--accent-light); }
.sr-title { font-weight: 600; flex: 1 1 100%; }
.sr-section { font-size: 12px; color: var(--text-muted); }
.sr-cat {
  font-size: 11px; padding: 1px 8px; border-radius: 10px;
  font-weight: 500; text-transform: uppercase; letter-spacing: .3px;
}
.badge-safety        { background: #fce4ec; color: #b71c1c; }
.badge-procedure     { background: #e3f2fd; color: #0d47a1; }
.badge-charging      { background: #e8f5e9; color: #1b5e20; }
.badge-warning-lamps { background: #fff8e1; color: #e65100; }
.badge-maintenance   { background: #f3e5f5; color: #6a1b9a; }
.badge-technical-data{ background: #e0f2f1; color: #004d40; }
.badge-emergency     { background: #fbe9e7; color: #bf360c; }
.badge-driving-assistance{background:#e8eaf6;color:#283593;}
.badge-controls      { background: #eceff1; color: #37474f; }
.badge-overview      { background: #f5f5f5; color: #424242; }
.badge-troubleshooting{background:#fff3e0;color:#e65100;}
.sr-empty { padding: 20px; text-align: center; color: var(--text-muted); }

/* ── Sidebar / Nav ─────────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  overflow-y: auto; overflow-x: hidden;
  z-index: 900;
  transition: transform .25s ease;
}
.sidebar-inner { padding: 12px 0 40px; }

.nav-toc-link {
  padding: 8px 14px; border-bottom: 1px solid var(--nav-border);
}
.nav-toc-link a {
  display: block; padding: 6px 10px;
  background: var(--accent-light); color: var(--accent);
  border-radius: 4px; text-decoration: none;
  font-size: 13px; font-weight: 600; text-align: center;
  transition: background .15s;
}
.nav-toc-link a:hover { background: #d0e3ff; }

.nav-filter { padding: 8px 14px; }
.nav-filter input {
  width: 100%; padding: 6px 10px; border: 1px solid var(--nav-border);
  border-radius: 4px; font-size: 13px; background: #fff;
}
.nav-filter input:focus { outline: none; border-color: var(--accent); }

.nav-chapters { list-style: none; }
.nav-chapter { border-bottom: 1px solid var(--nav-border); }
.nav-chapter-title {
  display: block; padding: 10px 14px; font-weight: 600;
  font-size: 13px; color: var(--text); text-decoration: none;
  text-transform: uppercase; letter-spacing: .4px;
  background: transparent; transition: background .15s;
  cursor: pointer;
}
.nav-chapter-title:hover { background: rgba(11,94,215,.06); }
.nav-chapter-title::before {
  content: "▸"; display: inline-block; margin-right: 6px;
  transition: transform .2s; font-size: 11px;
}
.nav-sections.expanded + .nav-chapter-title::before,
.nav-chapter-title:has(+ .nav-sections.expanded)::before {
  transform: rotate(90deg);
}

.nav-sections {
  list-style: none; max-height: 0; overflow: hidden;
  transition: max-height .3s ease;
}
.nav-sections.expanded { max-height: 4000px; }
.nav-sections li a {
  display: block; padding: 5px 14px 5px 28px;
  font-size: 13px; color: var(--text-muted); text-decoration: none;
  border-left: 3px solid transparent; transition: all .15s;
}
.nav-sections li a:hover { color: var(--accent); background: rgba(11,94,215,.04); }
.nav-sections li a.active {
  color: var(--accent); font-weight: 600;
  border-left-color: var(--accent); background: var(--accent-light);
}
.nav-l3 a { padding-left: 40px !important; font-size: 12.5px !important; }
.nav-l4 a { padding-left: 52px !important; font-size: 12px !important; }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 24px 32px 60px;
  max-width: 960px;
  background: var(--main-bg);
  min-height: calc(100vh - var(--header-h));
}

/* ── Sections ──────────────────────────────────────────────── */
.manual-section {
  padding: 20px 0 12px;
  border-bottom: 1px solid #eee;
}
.manual-section:target {
  animation: highlight 1.5s ease;
}
@keyframes highlight {
  0%   { background: var(--accent-light); }
  100% { background: transparent; }
}

/* ── Preamble ──────────────────────────────────────────────── */
.preamble-section blockquote {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
  border-left: 4px solid var(--accent);
  padding: 20px 24px;
  border-radius: var(--radius);
  margin: 12px 0;
}


/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: 28px; font-weight: 700; color: var(--hdr-bg); margin: 8px 0 12px; padding-bottom: 8px; border-bottom: 3px solid var(--accent); }
h2 { font-size: 18px; font-weight: 600; color: #2c3e50; margin: 6px 0 10px; }
h3 { font-size: 15px; font-weight: 600; color: #34495e; margin: 4px 0 8px; }
h4 { font-size: 13px; font-weight: 600; color: #4a5568; margin: 4px 0 6px; }
p  { margin: 6px 0; }
blockquote {
  margin: 6px 0; padding: 0;
  border: none;
}

/* ── Lists ─────────────────────────────────────────────────── */
ul, ol { margin: 8px 0; padding-left: 28px; }
li { margin: 4px 0; }
li > p { margin: 2px 0; }

/* ── Tables ────────────────────────────────────────────────── */
table {
  width: 100%; border-collapse: collapse;
  margin: 12px 0; font-size: 14px;
  box-shadow: var(--shadow-sm); border-radius: var(--radius);
  overflow: hidden;
}
thead th, thead td {
  background: var(--table-header); padding: 10px 12px;
  text-align: left; font-weight: 600; font-size: 13px;
  border-bottom: 2px solid var(--accent);
  white-space: nowrap;
}
td, th {
  padding: 8px 12px; border-bottom: 1px solid var(--table-border);
  vertical-align: top;
}
tr:nth-child(even) > td { background: #fafbfc; }
tr:hover > td { background: var(--accent-light); }

/* Gradeability tables — keep text wrapping for long cell content */
table td[rowspan], table th[rowspan] {
  vertical-align: middle;
  font-weight: 600;
}

/* ── Images & Figures ──────────────────────────────────────── */
.manual-img {
  max-width: 100%; height: auto;
  border-radius: 4px;
}
figure { margin: 12px 0; text-align: center; }
figcaption {
  font-size: 13px; color: var(--text-muted);
  margin-top: 6px; font-style: italic;
}

/* Icons (small inline indicator images) */
img[src*="image5.png"],
img[src*="image6.png"],
img[src*="image7.png"],
img[src*="image8.png"] {
  width: 16px; height: 16px;
  vertical-align: middle; display: inline;
  margin-right: 4px;
}
img[src*="image9."],
img[src*="image10."],
img[src*="image11."],
img[src*="image12."] {
  width: 20px; height: 20px;
  vertical-align: middle; display: inline;
}
p > img:only-child:not(.toc-page-img) {
  display: block; margin: 10px auto;
  max-width: 680px;
}
img:not(.toc-page-img) { max-height: 600px; }

/* ── Callout Boxes ─────────────────────────────────────────── */
.callout {
  margin: 12px 0; padding: 12px 16px;
  border-left: 4px solid; border-radius: var(--radius);
  font-size: 14px;
}
.callout-title {
  font-weight: 700; font-size: 13px; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 4px;
}
.callout-body { margin: 0; }
.callout.warning {
  background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text);
}
.callout.notice {
  background: var(--notice-bg); border-color: var(--notice-border); color: var(--notice-text);
}
.callout.note {
  background: var(--note-bg); border-color: var(--note-border); color: var(--note-text);
}
.callout.env-protection {
  background: var(--env-bg); border-color: var(--env-border); color: var(--env-text);
}

/* ── Back to Top ───────────────────────────────────────────── */
.back-to-top {
  display: inline-block; margin-top: 8px;
  font-size: 12px; color: var(--text-muted);
  text-decoration: none; opacity: .5;
  transition: opacity .2s;
}
.back-to-top:hover { opacity: 1; color: var(--accent); }

/* ── Links ─────────────────────────────────────────────────── */
a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* ── Underline utility (chapter breadcrumbs from Word) ─────── */
u { text-decoration: none; font-weight: 600; color: var(--text-muted); font-size: 12px; letter-spacing: .3px; text-transform: uppercase; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 960px) {
  :root { --header-h: 190px; }
  .nav-toggle { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .main-content { margin-left: 0; padding: 16px 18px 40px; }
  .site-header { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 6px; }
  .header-left { flex: 1 1 100%; order: 1; }
  .header-left h1 { font-size: 16px; white-space: normal; }
  .header-lang { flex: 1 1 100%; order: 2; }
  .lang-select { width: 100% !important; max-width: 100% !important; }
  #wr-header-chat { flex: 1 1 100%; order: 3; padding: 9px 14px !important; text-align: center; border-radius: 6px !important; font-size: 14px !important; }
  .header-search { flex: 1 1 100%; order: 4; margin-left: 0; }
  img { max-width: 100% !important; height: auto !important; }
  table { font-size: 13px; display: block; overflow-x: auto; }
}
@media (max-width: 600px) {
  .main-content { padding: 12px 12px 30px; }
  h1 { font-size: 22px; }
  h2 { font-size: 15px; }
  h3 { font-size: 13px; }
}

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  #manual-topbar, #manual-lang-row, #manual-topnav, .sidebar, .back-to-top, .nav-toggle { display: none !important; }
  .main-content { margin: 0; padding: 0; max-width: 100%; }
  .manual-section { page-break-inside: avoid; border: none; }
  table { page-break-inside: avoid; }
  img { max-width: 100% !important; max-height: none !important; }
  body { font-size: 11pt; background: #fff; }
  .toc-page-img { page-break-after: always; }
}

/* ── HTML Table of Contents (two-level collapsible) ──────── */
.toc-html {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 20px 0;
  text-align: left;
}
[dir="rtl"] .toc-html { text-align: right; }

/* ── Group card (layer 1) ─── */
details.toc-group {
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
summary.toc-group-title {
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
}
summary.toc-group-title::-webkit-details-marker { display: none; }
summary.toc-group-title::after {
  content: "▾";
  margin-left: auto;
  font-size: 13px;
  opacity: 0.7;
  transition: transform 0.2s;
  flex-shrink: 0;
}
details.toc-group:not([open]) > summary.toc-group-title::after {
  transform: rotate(-90deg);
}
[dir="rtl"] summary.toc-group-title::after {
  margin-left: 0;
  margin-right: auto;
}
[dir="rtl"] details.toc-group:not([open]) > summary.toc-group-title::after {
  transform: rotate(90deg);
}

/* ── Chapter list ─── */
.toc-chapters {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-chapters > li {
  border-bottom: 1px solid var(--nav-border);
}
.toc-chapters > li:last-child { border-bottom: none; }

/* Plain chapter (no subsections) */
.toc-chapters > li > a {
  display: block;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.toc-chapters > li > a:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* ── Chapter with subsections (layer 2) ─── */
details.toc-chapter {
  width: 100%;
}
summary.toc-chapter-title {
  display: flex;
  align-items: center;
  padding: 7px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  gap: 0;
}
summary.toc-chapter-title::-webkit-details-marker { display: none; }
summary.toc-chapter-title > a {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
  transition: color 0.12s;
}
summary.toc-chapter-title > a:hover { color: var(--accent); }
summary.toc-chapter-title::after {
  content: "▾";
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
details.toc-chapter:not([open]) > summary.toc-chapter-title::after {
  transform: rotate(-90deg);
}
[dir="rtl"] summary.toc-chapter-title::after {
  margin-left: 0;
  margin-right: 6px;
}
[dir="rtl"] details.toc-chapter:not([open]) > summary.toc-chapter-title::after {
  transform: rotate(90deg);
}
summary.toc-chapter-title:hover { background: rgba(11,94,215,.04); }

/* ── Subsection list ─── */
.toc-subsections {
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(0,0,0,0.025);
  border-top: 1px solid var(--nav-border);
}
.toc-subsections li {
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.toc-subsections li:last-child { border-bottom: none; }

/* ── Subsection disclosure (toc-sub) ─── */
details.toc-sub { width: 100%; }
summary.toc-sub-title {
  display: flex;
  align-items: center;
  padding: 5px 14px 5px 28px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
summary.toc-sub-title::-webkit-details-marker { display: none; }
summary.toc-sub-title > a {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s;
}
summary.toc-sub-title > a:hover { color: var(--accent); }
summary.toc-sub-title::after {
  content: "▾";
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 6px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
details.toc-sub:not([open]) > summary.toc-sub-title::after { transform: rotate(-90deg); }
[dir="rtl"] summary.toc-sub-title { padding: 5px 28px 5px 14px; }
[dir="rtl"] summary.toc-sub-title::after { margin-left: 0; margin-right: 6px; }
[dir="rtl"] details.toc-sub:not([open]) > summary.toc-sub-title::after { transform: rotate(90deg); }
summary.toc-sub-title:hover { background: rgba(11,94,215,.04); }

/* ── Inline content slot ─── */
.toc-content-slot {
  padding: 10px 14px 14px 28px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.65;
  border-top: 1px solid var(--nav-border);
  background: rgba(0,0,0,0.015);
}
.toc-content-slot:empty { display: none; }
.toc-content-slot img { max-width: 100%; height: auto; border-radius: 4px; margin: 4px 0; }
.toc-content-slot table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin: 6px 0; }
.toc-content-slot td, .toc-content-slot th {
  padding: 4px 8px;
  border: 1px solid var(--nav-border);
  text-align: left;
}
.toc-content-slot h2, .toc-content-slot h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 10px 0 4px;
  color: var(--text);
}
.toc-content-slot p { margin: 4px 0; }
.toc-content-slot ul, .toc-content-slot ol { margin: 4px 0; padding-left: 18px; }
.toc-content-slot .sec-toggle::after { display: none; }
[dir="rtl"] .toc-content-slot { padding: 10px 28px 14px 14px; }
[dir="rtl"] .toc-content-slot td, [dir="rtl"] .toc-content-slot th { text-align: right; }

/* ── Chapter label badge (e.g. 1A, 3Z) ─── */
.toc-chapter-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 7px;
  letter-spacing: 0.02em;
  vertical-align: middle;
  flex-shrink: 0;
  white-space: nowrap;
}
[dir="rtl"] .toc-chapter-label {
  margin-right: 0;
  margin-left: 7px;
}

/* ── Section label badge in body headings ───────────────────── */
.sec-label {
  display: inline-block;
  font-size: 0.52em;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 3px;
  padding: 2px 6px;
  margin-right: 10px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
[dir="rtl"] .sec-label { margin-right: 0; margin-left: 10px; }

/* ── Collapsible body sections ─────────────────────────────── */
.sec-toggle { cursor: pointer; user-select: none; }
.sec-toggle::after {
  content: '▾';
  font-size: 0.6em;
  font-weight: 400;
  opacity: 0.5;
  margin-left: 10px;
  display: inline-block;
  transition: transform 0.18s;
  vertical-align: middle;
}
.sec-toggle:not(.is-open)::after { transform: rotate(-90deg); }
.sec-toggle:hover { opacity: 0.8; }
[dir="rtl"] .sec-toggle::after { margin-left: 0; margin-right: 10px; }
[dir="rtl"] .sec-toggle:not(.is-open)::after { transform: rotate(90deg); }

/* ── Override old header heights (new 3-bar header is fixed height) ── */
@media (max-width: 960px) { :root { --header-h: 118px; } }
@media (max-width: 600px) { :root { --header-h: 116px; } }
