/* =====================================================================
   AXIRA USER OPERATION MANUAL — stylesheet
   Loads after tokens.css. Every colour is a token (var(--…)); the theme
   is switched by data-theme="dark" | "light" on <html>. Dark is default.
   Prefix: ax-   ·   No external assets, no web fonts.
   ===================================================================== */

/* ---------- 0. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-height) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body.ax {
  margin: 0; background: var(--page); color: var(--ink-body);
  font-family: var(--font-sans); font-size: 16px; line-height: 26px;
  font-variant-numeric: tabular-nums;
}
:where(.ax) :where(h1, h2, h3, h4) { color: var(--ink); font-family: var(--font-display); font-weight: 600; margin: 0; }
:where(.ax) p { margin: 0 0 var(--space-4); max-width: var(--measure); }
:where(.ax) p:last-child { margin-bottom: 0; }
:where(.ax) a { color: var(--accent-text); text-underline-offset: 3px; }
:where(.ax) strong { color: var(--ink); font-weight: 600; }
:where(.ax) img { max-width: 100%; height: auto; display: block; }
.ax :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.ax-num { font-family: var(--font-mono); font-weight: 600; color: var(--accent-text); letter-spacing: 0; }
.ax-eyebrow { font-size: 11.5px; line-height: 16px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); }
.ax-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:where(.ax) mark { background: var(--accent-tint); color: inherit; border-radius: 2px; box-shadow: 0 0 0 1px var(--accent); }

/* ---------- 1. Top bar ---------- */
.ax-topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-height);
  display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4);
  background: var(--sidebar); border-bottom: 1px solid var(--line);
}
.ax-topbar-logo { height: 34px; width: auto; }
.ax-logo--on-light { display: none; }
[data-theme="light"] .ax-logo--on-dark { display: none; }
[data-theme="light"] .ax-logo--on-light { display: block; }
.ax-topbar-title { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; color: var(--ink); font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-rev { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink-muted); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0 6px; line-height: 20px; }
.ax-topbar-spacer { flex: 1; }
.ax-iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer;
}
.ax-iconbtn:hover { background: var(--panel-hover); }
.ax-iconbtn svg { width: 20px; height: 20px; }
.ax-menu-btn { display: none; }

/* Theme toggle — a two-way segmented control, labelled in words */
.ax-theme { display: inline-flex; padding: 3px; gap: 2px; background: var(--page); border: 1px solid var(--line-strong); border-radius: var(--radius-md); }
.ax-theme button {
  font: 600 13px/1 var(--font-sans); color: var(--ink-muted); background: transparent; border: 0; border-radius: 5px;
  padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.ax-theme button svg { width: 15px; height: 15px; }
.ax-theme button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- 2. Shell ---------- */
.ax-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-height)); }
.ax-main { padding: var(--space-6) var(--space-6) var(--space-8); min-width: 0; }
.ax-main > * { max-width: var(--content-max); margin-inline: auto; }

/* ---------- 3. Sidebar contents ---------- */
.ax-sidebar {
  position: sticky; top: var(--topbar-height); height: calc(100vh - var(--topbar-height));
  display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line);
}
.ax-search { position: relative; padding: var(--space-4) var(--space-4) var(--space-3); border-bottom: 1px solid var(--line); }
.ax-search svg { position: absolute; left: 28px; top: 50%; margin-top: -1px; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-muted); pointer-events: none; }
.ax-input {
  width: 100%; font: 400 14px/20px var(--font-sans); color: var(--ink);
  background: var(--panel-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 9px 12px;
}
.ax-search .ax-input { padding-left: 36px; padding-right: 36px; }
.ax-input::placeholder { color: var(--ink-faint); }
.ax-input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.ax-kbd-hint { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); margin-top: -1px; font: 600 11px/18px var(--font-mono); color: var(--ink-faint); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; }
.ax-search-count { font-size: 12px; line-height: 16px; color: var(--ink-muted); margin-top: 8px; min-height: 16px; }
.ax-toc { overflow-y: auto; flex: 1; padding: var(--space-2) 0 var(--space-6); overscroll-behavior: contain; scrollbar-width: thin; }
.ax-toc ol { list-style: none; margin: 0; padding: 0; }
.ax-toc-ch-btn {
  width: 100%; display: grid; grid-template-columns: 28px 1fr 16px; align-items: center; gap: 6px;
  padding: 9px var(--space-4); background: none; border: 0; cursor: pointer; text-align: left;
  font: 600 14px/20px var(--font-sans); color: var(--ink);
}
.ax-toc-ch-btn:hover { background: var(--panel-hover); }
.ax-toc-ch-btn .ax-num { font-size: 13px; }
.ax-toc-ch-btn svg { width: 14px; height: 14px; color: var(--ink-muted); transition: transform .15s; }
.ax-toc-ch-btn[aria-expanded="true"] svg { transform: rotate(90deg); }
.ax-toc-ch-btn[aria-expanded="false"] + ol { display: none; }
.ax-toc-link {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: baseline;
  padding: 5px var(--space-4) 5px calc(var(--space-4) + 34px); text-decoration: none;
  font-size: 14px; line-height: 20px; color: var(--ink-muted);
}
.ax-toc-link .ax-num { font-size: 12px; font-weight: 500; color: var(--ink-faint); }
.ax-toc-link[data-level="3"] { padding-left: calc(var(--space-4) + 46px); }
.ax-toc-link[data-level="4"] { padding-left: calc(var(--space-4) + 58px); font-size: 13px; }
.ax-toc-link:hover { background: var(--panel-hover); color: var(--ink); }
.ax-toc-link[aria-current="true"] { background: var(--accent-tint); color: var(--ink); font-weight: 600; }
.ax-toc-link[aria-current="true"] .ax-num { color: var(--accent-text); }
.ax-toc-link[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0; }
.ax-toc-link[data-pending] { opacity: .55; }
.ax-toc li[hidden] { display: none; }
.ax-toc-empty { padding: var(--space-4); color: var(--ink-muted); font-size: 14px; }
.ax-scrim { display: none; }

/* ---------- 4. Chapter opener + section panel ---------- */
.ax-chapter { display: flex; align-items: baseline; gap: var(--space-4); padding: var(--space-7) 0 var(--space-5); border-bottom: 2px solid var(--accent); margin-bottom: var(--space-6); }
.ax-chapter .ax-num { font-size: 34px; line-height: 40px; }
.ax-chapter h1 { font-size: 34px; line-height: 40px; }

.ax-section {
  container-type: inline-size; container-name: section;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel); padding: var(--space-6); margin-bottom: var(--space-7);
}
.ax-sh { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-4); align-items: start; padding-bottom: var(--space-5); margin-bottom: var(--space-5); border-bottom: 1px solid var(--line); }
.ax-sh-crumb { grid-column: 1 / -1; }
.ax-sh h2 { font-size: 26px; line-height: 32px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.ax-sh h2 .ax-num { font-size: 20px; }
.ax-sh-nav { display: flex; gap: var(--space-2); }
.ax-pn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); color: var(--ink); background: var(--panel-raised); text-decoration: none;
}
.ax-pn:hover { border-color: var(--accent); color: var(--accent-text); }
.ax-pn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.ax-pn svg { width: 18px; height: 18px; }
.ax-body > * + * { margin-top: var(--space-5); }
.ax-body h3 { font-size: 20px; line-height: 28px; }
.ax-body :where(ul, ol) { margin: 0; padding-left: 1.3em; max-width: var(--measure); }
.ax-body :where(li + li) { margin-top: 6px; }

/* Section footer: full-width previous / next */
.ax-sf { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--line); }
.ax-sf a { display: block; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); text-decoration: none; color: var(--ink); background: var(--panel-raised); font-size: 14px; line-height: 20px; }
.ax-sf a:hover { border-color: var(--accent); }
.ax-sf a small { display: block; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-muted); margin-bottom: 2px; }
.ax-sf .ax-sf-next { text-align: right; grid-column: 2; }

/* ---------- 5. Layout primitives (inside a section) ---------- */
/* .ax-keep: an image and its explanation — never split (screen or print) */
.ax-keep { break-inside: avoid; }
/* .ax-split: text beside its figure when the panel is wide enough */
.ax-split { display: grid; gap: var(--space-5); }
@container section (min-width: 780px) {
  .ax-split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .ax-split--fig-left { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .ax-split--fig-left > .ax-fig { order: -1; }
}
/* .ax-pair: two figures compared side by side (dark vs light UI, left vs right) */
.ax-pair { display: grid; gap: var(--space-5); }
@container section (min-width: 620px) { .ax-pair { grid-template-columns: 1fr 1fr; } }

/* ---------- 6. Figure ---------- */
.ax-fig { margin: 0; break-inside: avoid; }
.ax-fig-frame {
  position: relative; display: block; width: 100%; padding: 8px; margin: 0; cursor: zoom-in;
  background: var(--bezel); border: 1px solid var(--bezel-edge); border-radius: var(--radius-md);
}
.ax-fig-frame img { width: 100%; border-radius: 3px; }
.ax-fig-frame:hover { border-color: var(--accent); }
.ax-fig-frame::after {
  content: ""; position: absolute; right: 14px; bottom: 14px; width: 30px; height: 30px; border-radius: 6px; opacity: 0; transition: opacity .15s;
  background: #000000b3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.ax-fig-frame:hover::after, .ax-fig-frame:focus-visible::after { opacity: 1; }
.ax-fig--bare .ax-fig-frame { background: transparent; border-color: transparent; padding: 0; } /* light-theme HMI shots, diagrams */
.ax-fig figcaption { display: flex; gap: 10px; align-items: baseline; margin-top: 10px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ax-step {
  flex: none; font: 700 12.5px/16px var(--font-mono); color: var(--on-accent); background: var(--accent);
  border-radius: var(--radius-sm); padding: 2px 7px;
}
.ax-fig--narrow { max-width: 420px; }

/* Stepped sequence 1.1 → 1.2 → 1.3: each step = figure + its own text */
.ax-steps { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; gap: var(--space-5); counter-reset: none; }
.ax-steps > li { position: relative; break-inside: avoid; min-width: 0; }
.ax-fig, .ax-split > *, .ax-pair > * { min-width: 0; }
.ax-steps > li p { font-size: 14px; line-height: 22px; margin-top: 10px; }
@container section (min-width: 700px) {
  .ax-steps { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-6); }
  .ax-steps > li + li::before {
    content: ""; position: absolute; left: calc(var(--space-6) / -2 - 7px); top: 30%; width: 14px; height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M4 2l6 5-6 5' fill='none' stroke='%2301d9fc' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  [data-theme="light"] .ax-steps > li + li::before { filter: hue-rotate(20deg) saturate(.8) brightness(.7); }
}
@container section (max-width: 699px) {
  .ax-steps > li { padding-left: 18px; border-left: 2px solid var(--line); }
}

/* ---------- 7. Keycap + button reference ---------- */
.ax-key {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: baseline;
  font: 600 13.5px/18px var(--font-sans); color: var(--key-ink); white-space: nowrap;
  background: var(--key-face); border: 1px solid var(--line-strong); border-bottom-color: var(--key-edge);
  border-radius: var(--radius-sm); padding: 2px 9px; box-shadow: var(--shadow-key);
}
.ax-key--on { background: var(--key-on); color: var(--key-on-ink); border-color: var(--key-on); }
.ax-key--sel { background: var(--key-selected); color: var(--key-selected-ink); border-color: var(--key-selected); }
.ax-key--off { opacity: .55; }
p .ax-key, li .ax-key, td .ax-key { margin: 0 1px; }

.ax-btnref { margin: 0; display: grid; gap: 0; }
.ax-body .ax-btnref-title { margin: 0 0 var(--space-2); font: 700 11.5px/16px var(--font-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); }
.ax-btnref-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-2) var(--space-4); align-items: center;
  padding: var(--space-3) 0; border-top: 1px solid var(--line); break-inside: avoid;
}
.ax-btnref-row:first-of-type { border-top: 0; }
.ax-btnref dt { grid-row: span 2; }
.ax-btnref-shot { width: 56px; height: 56px; object-fit: contain; background: var(--bezel); border-radius: var(--radius-sm); padding: 2px; }
.ax-btnref-name { margin: 0; }
.ax-btnref dd { margin: 0; font-size: 14px; line-height: 22px; color: var(--ink-body); }
.ax-btnref-row:not(:has(.ax-btnref-shot)) { grid-template-columns: 150px minmax(0, 1fr); }
.ax-btnref-row:not(:has(.ax-btnref-shot)) dt { grid-row: auto; }
/* two toolbars side by side, as they appear on screen */
.ax-btnref-cols { display: grid; gap: var(--space-5) var(--space-7); }
@container section (min-width: 760px) { .ax-btnref-cols { grid-template-columns: 1fr 1fr; } }
/* compact variant: name + definition only, 2-up grid */
@container section (min-width: 760px) {
  .ax-btnref--grid { grid-template-columns: 1fr 1fr; column-gap: var(--space-7); }
  .ax-btnref--grid .ax-btnref-row:nth-of-type(2) { border-top: 0; }
}

/* ---------- 8. Callouts (modelled on the HMI message popup) ---------- */
.ax-callout {
  --c: var(--accent); --c-fill: var(--accent-tint); --c-ink: var(--accent-text);
  border: 1px solid var(--c); border-radius: var(--radius-md); overflow: hidden; background: var(--panel); break-inside: avoid;
}
.ax-callout-head {
  display: flex; align-items: center; gap: 10px; padding: 9px var(--space-4);
  background: var(--c-fill); border-bottom: 1px solid var(--c); color: var(--c-ink);
  font: 700 13px/18px var(--font-sans); letter-spacing: .1em; text-transform: uppercase;
}
.ax-callout-head svg { width: 18px; height: 18px; flex: none; }
.ax-callout-body { padding: var(--space-4); font-size: 15px; line-height: 24px; }
.ax-callout--danger { --c: var(--msg-safety); --c-fill: var(--msg-safety-fill); --c-ink: var(--msg-safety-ink); border-width: 2px; }
.ax-callout--danger .ax-callout-body { background: var(--msg-safety-fill); color: var(--ink); }
.ax-callout--warning { --c: var(--msg-warning); --c-fill: var(--msg-warning-fill); --c-ink: var(--msg-warning-ink); }
.ax-callout--note { --c: var(--accent); --c-fill: var(--accent-tint); --c-ink: var(--accent-text); }
.ax-callout--rules { --c: var(--line-strong); --c-fill: var(--panel-raised); --c-ink: var(--ink); }
.ax-rules { list-style: none; margin: 0; padding: 0; max-width: none; counter-reset: rule; }
.ax-rules li { counter-increment: rule; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); max-width: none; }
.ax-rules li:first-child { border-top: 0; padding-top: 0; }
.ax-rules li::before {
  content: counter(rule); font: 700 12.5px/24px var(--font-mono); text-align: center; height: 24px;
  color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--panel);
}

/* ---------- 9. Worked example ---------- */
.ax-example { background: var(--panel-raised); border: 1px solid var(--line); border-radius: var(--radius-md); break-inside: avoid; }
.ax-example-head { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px var(--space-4); border-bottom: 1px solid var(--line); }
.ax-example-head .ax-eyebrow { color: var(--accent-text); }
.ax-example-grid { display: grid; gap: 0; }
@container section (min-width: 700px) { .ax-example-grid { grid-template-columns: 1fr 1fr 1.3fr; } .ax-example-step + .ax-example-step { border-left: 1px solid var(--line); border-top: 0 !important; } }
.ax-example-step { padding: var(--space-4); }
.ax-example-step + .ax-example-step { border-top: 1px solid var(--line); }
.ax-example-step h4 { font-size: 11.5px; line-height: 16px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); font-family: var(--font-sans); font-weight: 700; margin-bottom: 10px; }
.ax-given { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-family: var(--font-mono); font-size: 14px; line-height: 22px; }
.ax-given dt { color: var(--ink-muted); } .ax-given dd { margin: 0; color: var(--ink); font-weight: 600; }
.ax-formula { font-family: var(--font-mono); font-size: 18px; line-height: 28px; color: var(--ink); }
.ax-formula b { color: var(--accent-text); font-weight: 700; }
.ax-example-step p { font-size: 14px; line-height: 22px; margin-top: 8px; }
.ax-result { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 14px; line-height: 20px; }
.ax-result td { padding: 4px 0; }
.ax-result td:first-child { color: var(--ink-muted); width: 64px; }
.ax-result td:nth-child(2) { text-align: right; width: 78px; color: var(--ink); font-weight: 600; padding-right: 12px; }
.ax-bar { display: block; height: 8px; border-radius: 2px; background: var(--accent); width: var(--w); opacity: .85; }
.ax-result tr.ax-more td { color: var(--ink-faint); font-family: var(--font-sans); font-size: 13px; }

/* ---------- 10. Tables ---------- */
.ax-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.ax-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 22px; }
.ax-table th { text-align: left; font-weight: 600; color: var(--ink); background: var(--panel-raised); padding: 10px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ax-table td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.ax-table tbody tr:hover td { background: var(--panel-hover); }
.ax-table code, .ax-code-plain { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); background: var(--panel-raised); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; }
.ax-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 8px; background: var(--sw); box-shadow: 0 0 0 1px var(--line-strong); print-color-adjust: exact; -webkit-print-color-adjust: exact; }

/* ---------- 11. Message code table ---------- */
.ax-msgs { display: grid; gap: var(--space-4); }
.ax-msgs-tools { display: grid; gap: var(--space-3); }
.ax-msgs-search { position: relative; max-width: 460px; }
.ax-msgs-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-muted); }
.ax-msgs-search .ax-input { padding-left: 36px; }
.ax-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ax-chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: 600 13px/18px var(--font-sans); color: var(--ink-body); background: var(--panel-raised);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px;
}
.ax-chip span { font-family: var(--font-mono); font-weight: 500; color: var(--ink-muted); font-size: 12px; }
.ax-chip[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.ax-chip[aria-pressed="true"] span { color: inherit; opacity: .75; }
.ax-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }

.ax-mt { --c: var(--msg-general); --c-fill: var(--msg-general-fill); --c-ink: var(--msg-general-ink); }
.ax-mt--error   { --c: var(--msg-error);   --c-fill: var(--msg-error-fill);   --c-ink: var(--msg-error-ink); }
.ax-mt--warning { --c: var(--msg-warning); --c-fill: var(--msg-warning-fill); --c-ink: var(--msg-warning-ink); }
.ax-mt--tooling { --c: var(--msg-warning); --c-fill: var(--msg-warning-fill); --c-ink: var(--msg-warning-ink); }
.ax-mt--safety  { --c: var(--msg-safety);  --c-fill: var(--msg-safety-fill);  --c-ink: var(--msg-safety-ink); }
.ax-mt--info, .ax-mt--general { --c: var(--msg-general); --c-fill: var(--msg-general-fill); --c-ink: var(--msg-general-ink); }
.ax-mt--success { --c: var(--msg-success); --c-fill: var(--msg-success-fill); --c-ink: var(--msg-success-ink); }
.ax-mt--setup   { --c: var(--msg-setup);   --c-fill: var(--msg-setup-fill);   --c-ink: var(--msg-setup-ink); }

.ax-msgtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 20px; }
.ax-msgtable thead th { position: sticky; top: var(--topbar-height); z-index: 1; text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); background: var(--panel); padding: 8px 12px; border-bottom: 1px solid var(--line-strong); }
.ax-msgtable .ax-msg-group th {
  text-align: left; padding: 18px 12px 8px; background: var(--panel); border-bottom: 2px solid var(--c);
  font: 600 16px/24px var(--font-display); color: var(--ink);
}
.ax-msg-group th > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ax-msg-group small { font: 400 13px/18px var(--font-sans); color: var(--ink-muted); }
.ax-msg-group .ax-msg-type { font: 700 11px/16px var(--font-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--c-ink); background: var(--c-fill); border: 1px solid var(--c); border-radius: var(--radius-sm); padding: 1px 7px; }
.ax-msgtable td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ax-msgtable td:first-child { width: 96px; }
.ax-msgtable tbody tr:not(.ax-msg-group):hover td { background: var(--panel-hover); }
.ax-code {
  display: inline-block; min-width: 58px; text-align: center;
  font: 700 13px/20px var(--font-mono); color: var(--c-ink); background: var(--c-fill);
  border: 1px solid var(--c); border-radius: var(--radius-sm); padding: 1px 8px;
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.ax-msgtable .ax-dyn { font-size: 12px; color: var(--ink-muted); }
.ax-msgs-empty { padding: var(--space-5); text-align: center; color: var(--ink-muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); }
.ax-msgtable tr[hidden], .ax-msgtable tbody[hidden] { display: none; }
@container section (max-width: 520px) {
  .ax-msgtable thead { display: none; }
  .ax-msgtable td { display: inline-block; border: 0; padding: 6px 0 6px 4px; }
  .ax-msgtable td:first-child { width: 76px; }
  .ax-msgtable tr:not(.ax-msg-group) { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
  .ax-msgtable .ax-msg-group, .ax-msgtable .ax-msg-group th { display: block; }
}

/* Popup-colour legend (11.1) */
.ax-legend { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ax-legend-item { border: 1px solid var(--c); border-radius: var(--radius-md); overflow: hidden; background: var(--panel); break-inside: avoid; }
.ax-legend-item b { display: block; padding: 6px 12px; background: var(--c-fill); border-bottom: 1px solid var(--c); color: var(--c-ink); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.ax-legend-item span { display: block; padding: 8px 12px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }

/* ---------- 12. Front matter / cover ---------- */
.ax-front { container-type: inline-size; container-name: section; margin-bottom: var(--space-7); }
.ax-cover {
  position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6) var(--space-6); box-shadow: var(--shadow-panel);
}
.ax-cover-logo { width: 150px; margin-bottom: var(--space-7); }
.ax-cover .ax-eyebrow { color: var(--accent-text); letter-spacing: .24em; }
.ax-cover h1 { font-size: 44px; line-height: 48px; letter-spacing: -.01em; margin: 10px 0 var(--space-5); }
.ax-cover-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: 14px; color: var(--ink-muted); }
.ax-cover-meta b { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
.ax-cover-mark { position: absolute; right: -40px; top: 28px; width: 300px; opacity: .08; pointer-events: none; }
.ax-front-grid { display: grid; gap: var(--space-5); margin-top: var(--space-5); }
@container section (min-width: 760px) { .ax-front-grid { grid-template-columns: 1fr 1fr; } .ax-front-grid > .ax-wide { grid-column: 1 / -1; } }
.ax-front-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-5); font-size: 14px; line-height: 22px; break-inside: avoid; }
.ax-front-card h3 { font-size: 16px; line-height: 24px; margin-bottom: 8px; }
.ax-click { display: flex; gap: var(--space-4); align-items: center; }
.ax-click img { width: 44px; flex: none; background: var(--bezel); border-radius: var(--radius-sm); padding: 4px; }

/* ---------- 13. Lightbox ---------- */
.ax-lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: #000000eb; color: #f2f2f2; }
.ax-lightbox::backdrop { background: #000000cc; }
.ax-lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }
.ax-lb-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; font-size: 14px; }
.ax-lb-bar .ax-step { color: #000; background: #01d9fc; }
.ax-lb-bar span.ax-lb-count { margin-left: auto; font-family: var(--font-mono); color: #b0b0b0; }
.ax-lb-stage { overflow: auto; display: grid; place-items: center; padding: 0 16px; }
.ax-lb-stage img { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; cursor: zoom-in; }
.ax-lb-stage.is-actual img { max-width: none; max-height: none; cursor: zoom-out; }
.ax-lb-cap { padding: 10px 16px 16px; font-size: 14px; color: #dcdcdc; text-align: center; }
.ax-lightbox .ax-iconbtn { color: #f2f2f2; }
.ax-lightbox .ax-iconbtn:hover { background: #ffffff1f; }

/* ---------- 14. Responsive ---------- */
@media (max-width: 1099px) {
  .ax-shell { grid-template-columns: minmax(0, 1fr); }
  .ax-menu-btn { display: inline-grid; }
  .ax-sidebar {
    position: fixed; z-index: 50; top: var(--topbar-height); left: 0; bottom: 0; height: auto; width: min(340px, 88vw);
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px #0000008c;
  }
  .ax-nav-open .ax-sidebar { transform: none; }
  .ax-nav-open .ax-scrim { display: block; position: fixed; inset: var(--topbar-height) 0 0; z-index: 45; background: #00000080; }
  .ax-main { padding: var(--space-5) var(--space-5) var(--space-8); }
}
@media (max-width: 640px) {
  .ax-main { padding: var(--space-4) var(--space-4) var(--space-7); }
  .ax-section { padding: var(--space-4); border-radius: var(--radius-md); margin-bottom: var(--space-5); }
  .ax-sh h2 { font-size: 22px; line-height: 28px; }
  .ax-sh h2 .ax-num { font-size: 16px; }
  .ax-chapter .ax-num, .ax-chapter h1 { font-size: 26px; line-height: 32px; }
  .ax-cover { padding: var(--space-6) var(--space-4) var(--space-5); }
  .ax-cover h1 { font-size: 32px; line-height: 38px; }
  .ax-topbar-title .ax-doc { display: none; }
  .ax-theme button .ax-theme-label { display: none; }
  .ax-theme button { padding: 7px 9px; }
  .ax-btnref-row:not(:has(.ax-btnref-shot)) { grid-template-columns: minmax(0, 1fr); }
  .ax-sf { grid-template-columns: 1fr; } .ax-sf .ax-sf-next { grid-column: 1; }
}

/* ---------- 15. Print ----------
   Paper is always the LIGHT palette on white. Each section starts a page;
   figures, steps, button rows, callouts and examples never split. */
@page { size: A4; margin: 14mm 14mm 16mm; }
@page {
  @bottom-left { content: "Axira · User Operation Manual · Rev 1.4"; font: 8pt "Segoe UI", sans-serif; color: #5d6b7e; }
  @bottom-right { content: counter(page); font: 600 9pt "Segoe UI", sans-serif; color: #0f172a; }
}
@media print {
  :root, [data-theme="dark"], [data-theme="light"] {
    --page: #ffffff; --sidebar: #ffffff; --panel: #ffffff; --panel-raised: #f4f6f8; --panel-hover: transparent;
    --bezel: #ffffff; --bezel-edge: #9aa3af; --line: #d5dae2; --line-strong: #7c8594;
    --ink: #0f172a; --ink-body: #1f2937; --ink-muted: #475569; --ink-faint: #5d6b7e;
    --accent: #1f6feb; --accent-text: #0b4fcc; --on-accent: #ffffff; --accent-tint: #e8f0fd; --focus: #0b4fcc;
    --key-face: #ffffff; --key-edge: #7c8594; --key-ink: #0f172a; --key-on: #15803d; --key-on-ink: #fff; --key-selected: #1f6feb; --key-selected-ink: #fff;
    --msg-error: #8b1e2e; --msg-error-fill: #f9e9ec; --msg-error-ink: #7a1a28;
    --msg-safety: #c81e1e; --msg-safety-fill: #fdeceb; --msg-safety-ink: #a11414;
    --msg-warning: #b45309; --msg-warning-fill: #fff5e0; --msg-warning-ink: #8a4108;
    --msg-general: #64748b; --msg-general-fill: #edf0f4; --msg-general-ink: #334155;
    --msg-success: #15803d; --msg-success-fill: #e7f6ec; --msg-success-ink: #14612f;
    --shadow-panel: none; --shadow-key: none;
  }
  body.ax { font-size: 10.5pt; line-height: 1.5; background: #fff; }
  .ax-topbar, .ax-sidebar, .ax-scrim, .ax-sh-nav, .ax-sf, .ax-msgs-tools, .ax-msgs-empty, .ax-lightbox, .ax-cover-mark { display: none !important; }
  .ax-shell { display: block; }
  .ax-main { padding: 0; }
  .ax-main > * { max-width: none; }
  .ax-section, .ax-front { break-before: page; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0; background: none; }
  .ax-chapter { break-before: page; padding-top: 0; }
  .ax-chapter + .ax-section { break-before: avoid; }
  .ax-main > :first-child { break-before: auto; }
  .ax-sh { break-after: avoid; }
  .ax-sh h2 { font-size: 18pt; line-height: 1.25; }
  h2, h3, h4, .ax-btnref-title { break-after: avoid; }
  .ax-keep, .ax-fig, .ax-steps > li, .ax-btnref-row, .ax-callout, .ax-example, .ax-front-card, .ax-legend-item, tr { break-inside: avoid; }
  p { orphans: 3; widows: 3; }
  .ax-fig-frame { padding: 0; border: .5pt solid var(--bezel-edge); cursor: auto; }
  .ax-fig-frame::after { display: none; }
  .ax-fig img { max-height: 120mm; width: auto; margin-inline: auto; }
  .ax-steps { grid-template-columns: repeat(auto-fit, minmax(52mm, 1fr)); gap: 5mm; }
  .ax-steps > li { padding-left: 0; border-left: 0; }
  .ax-steps > li + li::before { display: none; }
  .ax-steps .ax-fig img { max-height: 70mm; }
  .ax-msgtable tr[hidden], .ax-msgtable tbody[hidden] { display: table-row-group !important; }
  .ax-msgtable tr[hidden] { display: table-row !important; }
  .ax-msgtable thead th { position: static; }
  .ax-front-grid { gap: 4mm; margin-top: 0; }
  .ax-front-card { padding: 3mm 4mm; font-size: 9.5pt; line-height: 1.45; }
  .ax-callout-body { font-size: 10pt; line-height: 1.45; }
  .ax-cover { break-after: page; border: 0; box-shadow: none; padding: 40mm 0 0; min-height: 240mm; }
  .ax a { color: inherit; text-decoration: none; }
  .ax-key, .ax-step, .ax-code, .ax-chip, .ax-callout-head, .ax-callout-body, .ax-btnref-shot, .ax-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .ax-logo--on-dark { display: none !important; } .ax-logo--on-light { display: block !important; }
}

/* ---- build additions ---- */
.ax-btnref dt { display: flex; gap: 4px; }
.ax-btnref-row--pair { grid-template-columns: 124px minmax(0, 1fr); }
.ax-body h3 { margin: var(--space-2) 0 0; font: 600 20px/28px var(--font-display); color: var(--ink); }
.ax-body code { font-family: var(--font-mono); font-size: .92em; }
.ax-check { font-weight: 700; }   /* "please confirm" wording: bold (the title tooltip says why) */

/* =====================================================================
   SIDEBAR TREE (every manual) + HOME PAGE
   ===================================================================== */
.ax-topbar-home { display: inline-flex; align-items: center; }
.ax-tree { list-style: none; margin: 0; padding: 0; }
.ax-tree-group { padding: var(--space-4) var(--space-4) var(--space-1); }
.ax-tree-group:first-child { padding-top: var(--space-2); }
.ax-tree-group[hidden], .ax-tree-book[hidden], .ax-toc-ch[hidden] { display: none; }
.ax-tree-book-btn {
  width: 100%; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 14px; align-items: center; gap: 10px;
  padding: 10px var(--space-4); background: none; border: 0; cursor: pointer; text-align: left;
  font: 600 14.5px/20px var(--font-sans); color: var(--ink);
}
button.ax-tree-book-btn:hover { background: var(--panel-hover); }
.ax-tree-book-btn > svg:first-child { width: 18px; height: 18px; color: var(--accent-text); }
.ax-tree-book-btn > svg:last-child { width: 14px; height: 14px; color: var(--ink-muted); transition: transform .15s; }
.ax-tree-book-btn[aria-expanded="true"] > svg:last-child { transform: rotate(90deg); }
.ax-tree-book-btn[aria-expanded="false"] + ol { display: none; }
.ax-tree-book.is-here > .ax-tree-book-btn { background: var(--accent-tint); }
.ax-tree-book > ol { padding-bottom: var(--space-2); border-left: 1px solid var(--line-strong); margin-left: 24px; }
.ax-tree-tag { font: 600 11px/16px var(--font-mono); color: var(--ink-faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.ax-tree-book.is-planned .ax-tree-book-btn { grid-template-columns: 18px minmax(0, 1fr) auto; color: var(--ink-faint); font-weight: 500; cursor: default; }
.ax-tree-book.is-planned .ax-tree-book-btn > svg:first-child { color: var(--ink-faint); }
/* chapters and sections sit inside a manual: shift them in under the manual's rail */
.ax-tree-book .ax-toc-ch-btn { padding-left: 12px; grid-template-columns: 24px 1fr 16px; font-size: 13.5px; }
.ax-tree-book .ax-toc-link { padding-left: 44px; }
.ax-tree-book .ax-toc-link--page { padding-left: 12px; }
.ax-tree-book .ax-toc-link[data-level="3"] { padding-left: 56px; }
.ax-tree-book .ax-toc-link[data-level="4"] { padding-left: 68px; }
.ax-tree-book .ax-toc-ch.is-here > .ax-toc-ch-btn { color: var(--accent-text); }

.ax-home .ax-main > * { max-width: 720px; }
.ax-home-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12vh 0 var(--space-6); }
.ax-home-logo { width: 280px; max-width: 70%; margin-bottom: var(--space-6); }
.ax-home-hero .ax-eyebrow { color: var(--accent-text); letter-spacing: .24em; margin-bottom: var(--space-3); }
.ax-home-hero h1 { font: 600 44px/50px var(--font-display); letter-spacing: -.01em; margin: 0 0 var(--space-5); color: var(--ink); }
.ax-home-search { position: relative; width: 100%; max-width: 560px; }
.ax-home-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-muted); pointer-events: none; }
.ax-home-search .ax-input { padding-left: 44px; height: 48px; font-size: 16px; }
.ax-home-results { list-style: none; margin: var(--space-3) 0 0; padding: 0; width: 100%; max-width: 560px; max-height: 50vh; overflow-y: auto; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel-raised); }
.ax-home-results li + li { border-top: 1px solid var(--line); }
.ax-home-results a { display: grid; gap: 2px; padding: 10px 14px; text-decoration: none; color: var(--ink-body); }
.ax-home-results a:hover, .ax-home-results a:focus-visible { background: var(--panel-hover); }
.ax-home-results strong { color: var(--ink); font-weight: 600; }
.ax-home-results small { color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.ax-home-noresult { padding: 12px 14px; color: var(--ink-muted); }
.ax-home .ax-logo--on-light { display: none; }
[data-theme="light"] .ax-home .ax-logo--on-dark { display: none; }
[data-theme="light"] .ax-home .ax-logo--on-light { display: block; }

/* In the app: jump to the chapter for the screen the operator came from (added by manual.js) */
.ax-home-context {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px; align-items: center; gap: 2px var(--space-3);
  width: 100%; max-width: 560px; margin-top: var(--space-3); padding: 12px 16px; text-align: left; text-decoration: none;
  color: var(--ink); background: var(--accent-tint); border: 1px solid var(--accent); border-radius: var(--radius-md);
}
.ax-home-context:hover { background: var(--panel-hover); }
.ax-home-context .ax-eyebrow { grid-column: 1; margin: 0; color: var(--accent-text); letter-spacing: .14em; }
.ax-home-context strong { grid-column: 1; font-size: 18px; line-height: 26px; }
.ax-home-context svg { grid-column: 2; grid-row: 1 / span 2; width: 20px; height: 20px; color: var(--accent-text); }

/* =====================================================================
   IN THE AXIRA APP (html.ax-in-app, set by manual.js inside WebView2)
   Touch panel: bigger targets and scrollbars, no text selection or
   double-tap zoom; the app sets the theme, so no theme switch or print.
   Search fields open the app's keypad (they are read-only here).
   ===================================================================== */
.ax-in-app { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ax-in-app, .ax-in-app * { scrollbar-width: auto; scrollbar-color: var(--line-strong) transparent; }
.ax-in-app .ax-theme, .ax-in-app [data-print], .ax-in-app .ax-kbd-hint { display: none; }
.ax-in-app .ax-iconbtn { width: 48px; height: 48px; }
.ax-in-app .ax-iconbtn svg { width: 24px; height: 24px; }
.ax-in-app .ax-iconbtn:disabled { opacity: .35; cursor: default; background: transparent; }
.ax-in-app .ax-input { cursor: pointer; caret-color: transparent; }
.ax-in-app .ax-search .ax-input { height: 48px; font-size: 16px; }
.ax-in-app .ax-toc-link { padding-top: 10px; padding-bottom: 10px; }
.ax-in-app .ax-toc-ch-btn, .ax-in-app .ax-tree-book-btn { padding-top: 13px; padding-bottom: 13px; }
.ax-in-app .ax-pn { width: 48px; height: 48px; }
.ax-in-app .ax-pn svg { width: 22px; height: 22px; }
.ax-in-app .ax-sf a { padding: 14px 16px; }
.ax-in-app .ax-home-results a { padding: 14px 16px; }

/* =====================================================================
   DIAGRAMS (images/diagrams/*.svg, inlined by tools/refresh.py)
   Every colour is a token, so diagrams follow the theme switch.
   ===================================================================== */
.ax-dg { margin: 0; break-inside: avoid; }
.ax-dg-frame { background: var(--dg-bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); }
.ax-dg figcaption { margin-top: 10px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ax-dg figcaption b { color: var(--ink); font-weight: 600; }
svg.dg { display: block; width: 100%; height: auto; font-family: var(--font-sans); overflow: visible; }
.dg text { font-size: 12.5px; fill: var(--ink-body); }
.dg .dg-lbl { font-size: 12px; fill: var(--ink-muted); }
.dg .dg-strong { font-weight: 600; fill: var(--ink); font-size: 13px; }
.dg .dg-num { font-family: var(--font-mono); font-size: 12px; fill: var(--ink); }
.dg .dg-on-bar { fill: var(--ink); font-weight: 600; }
.dg .dg-ax { stroke: var(--line-strong); stroke-width: 1.4; fill: none; }
.dg .dg-thin { stroke-width: 1; }
.dg .dg-ahead { fill: var(--line-strong); }
.dg .dg-grid { stroke: var(--line-strong); stroke-width: 1; opacity: .6; }
.dg .dg-dash { stroke-dasharray: 6 5; }
.dg .dg-thick { stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.dg .dg-l0 { stroke: var(--ink-faint); fill: none; stroke-width: 1.6; }
.dg .dg-l1 { stroke: var(--dg-1); fill: none; }
.dg .dg-l2 { stroke: var(--dg-2); fill: none; }
.dg .dg-l3 { stroke: var(--dg-3); fill: none; }
.dg .dg-l4 { stroke: var(--dg-4); fill: none; }
.dg .dg-l5 { stroke: var(--dg-5); fill: none; }
.dg .dg-f1 { fill: var(--dg-1-tint); } .dg .dg-f2 { fill: var(--dg-2-tint); } .dg .dg-f5 { fill: var(--dg-5-tint); }
.dg .dg-edge { stroke: var(--line-strong); stroke-width: 1; }
.dg .dg-dashbox { stroke: var(--dg-5); stroke-dasharray: 4 3; stroke-width: 1.2; }
.dg .dg-band1 { fill: var(--dg-1-tint); } .dg .dg-band2 { fill: var(--dg-2-tint); } .dg .dg-band3 { fill: var(--dg-3-tint); }
.dg .dg-band4 { fill: var(--dg-4-tint); } .dg .dg-band5 { fill: var(--dg-5-tint); }
.dg .dg-bar1 { fill: var(--dg-1); opacity: .55; } .dg .dg-bar2 { fill: var(--dg-2); opacity: .55; }
.dg .dg-bar4 { fill: var(--dg-4); opacity: .55; } .dg .dg-bar5 { fill: var(--dg-2); opacity: .35; }
.dg .dg-auth1 { fill: var(--dg-1-tint); stroke: var(--dg-1); stroke-width: 1; }
.dg .dg-auth3 { fill: var(--dg-3-tint); stroke: var(--dg-3); stroke-width: 1; }
/* DXF layer drawings: tinted regions, layer-coloured text, layer swatches */
.dg .dg-reg1 { fill: var(--dg-1-tint); stroke: var(--dg-1); stroke-width: 2; stroke-linejoin: round; }
.dg .dg-reg2 { fill: var(--dg-2-tint); stroke: var(--dg-2); stroke-width: 2; stroke-linejoin: round; }
.dg .dg-reg3 { fill: var(--dg-3-tint); stroke: var(--dg-3); stroke-width: 2; stroke-linejoin: round; }
.dg .dg-t1 { fill: var(--dg-1); font-weight: 600; } .dg .dg-t2 { fill: var(--dg-2); font-weight: 600; }
.dg .dg-t3 { fill: var(--dg-3); font-weight: 600; } .dg .dg-t4 { fill: var(--dg-4); font-weight: 700; font-size: 14px; }
.dg .dg-bend { stroke: var(--dg-5); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.dg .dg-hole { stroke: var(--ink-muted); stroke-width: 1.6; fill: none; }
.dg .dg-sw1 { fill: var(--dg-1); } .dg .dg-sw2 { fill: var(--dg-2); } .dg .dg-sw3 { fill: var(--dg-3); }
.dg .dg-sw4 { fill: var(--dg-4); } .dg .dg-sw5 { fill: var(--dg-5); } .dg .dg-sw0 { fill: var(--ink-muted); }
.dg .dg-mark { stroke: var(--ink-faint); stroke-width: 1.2; stroke-dasharray: 3 3; fill: none; }
.dg .dg-box { fill: var(--panel-raised); stroke: var(--line-strong); stroke-width: 1.2; }
.dg .dg-box1 { stroke: var(--dg-1); } .dg .dg-box2 { stroke: var(--dg-2); } .dg .dg-box3 { stroke: var(--dg-3); } .dg .dg-box4 { stroke: var(--dg-4); }
.dg .dg-beam { fill: var(--ink-faint); opacity: .8; }
.dg .dg-bed { fill: var(--line-strong); opacity: .7; }

/* =====================================================================
   PARAMETER REFERENCE (generated pages) + concept pages
   ===================================================================== */
.ax-section.ax-param { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.ax-param .ax-sh { padding-bottom: var(--space-4); }
.ax-param-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.ax-param-meta > div { background: var(--panel-raised); padding: 8px 12px; min-width: 0; }
.ax-param-meta dt { font: 700 11px/16px var(--font-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.ax-param-meta dd { margin: 2px 0 0; font: 600 15px/22px var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.ax-param-purpose { font-size: 16px; line-height: 26px; color: var(--ink-body); max-width: var(--measure); }
.ax-param-flag { font-size: 13.5px; line-height: 20px; color: var(--ink-muted); padding-left: 12px; border-left: 3px solid var(--line-strong); }
.ax-param-see { font-size: 14px; color: var(--ink-muted); }
.ax-param-see a, .ax-param-flag a { color: var(--accent-text); }
.ax-effects { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.ax-effect { --c: var(--line-strong); background: var(--panel-raised); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--radius-md); padding: 12px 16px; break-inside: avoid; }
.ax-effect h4 { margin: 0 0 6px; font: 700 12px/16px var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.ax-effect p { margin: 0; font-size: 14.5px; line-height: 23px; color: var(--ink-body); }
.ax-effect--up { --c: var(--dg-1); } .ax-effect--down { --c: var(--dg-2); }
.ax-effect--on { --c: var(--dg-3); } .ax-effect--off { --c: var(--ink-faint); } .ax-effect--both { --c: var(--dg-4); }
.ax-param-options { max-width: 520px; }
.ax-param-hint .ax-callout-body p + p { margin-top: 6px; }
.ax-param-hint .ax-callout-body ul { margin: 0; padding-left: 1.2em; }
.ax-appfig { max-width: 560px; }
.ax-appfig-frame { background: var(--sv-000000); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); }
svg.ax-appsvg { display: block; width: 100%; height: auto; }
.ax-appfig figcaption b { color: var(--ink); font-weight: 600; }
.ax-subgroup { display: flex; align-items: baseline; gap: 12px; margin: var(--space-6) 0 var(--space-4); padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); font: 600 20px/28px var(--font-display); color: var(--ink); }
.ax-subgroup .ax-eyebrow { color: var(--accent-text); }
.ax-param-index td { padding-top: 6px; padding-bottom: 6px; }
.ax-param-index td:first-child { width: 64px; }
.ax-num-cell { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.ax-param-index th:last-child { text-align: right; }
.ax-param-legend { display: grid; gap: var(--space-3); }
.ax-param-legend p { font-size: 14px; color: var(--ink-muted); margin: 0; }
.ax-concept-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ax-concept { display: grid; gap: 4px; padding: 12px 14px; background: var(--panel-raised); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-md); text-decoration: none; color: var(--ink-body); font-size: 14px; line-height: 20px; }
.ax-concept:hover { border-color: var(--accent); }
.ax-concept b { font: 700 15px/20px var(--font-mono); color: var(--accent-text); }
.ax-formula-inline { font-family: var(--font-mono); font-size: .95em; color: var(--ink); background: var(--panel-raised); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; white-space: nowrap; }
.ax-formula-block { padding: 12px 16px; background: var(--panel-raised); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-md); max-width: max-content; }
.ax-layers { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); max-width: none; }
.ax-layers li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; background: var(--panel-raised); border: 1px solid var(--line); border-radius: var(--radius-md); font-size: 15px; line-height: 24px; }
.ax-layer-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 700 14px/1 var(--font-mono); }
@media (max-width: 640px) {
  .ax-param-meta { grid-template-columns: 1fr 1fr; }
}
@media print {
  .ax-appfig-frame, .ax-dg-frame { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
.ax-body > .ax-dg, .ax-body > .ax-appfig { margin-top: var(--space-5); }
.ax-param > .ax-sf { display: none; }   /* parameter entries: header arrows are enough */
.ax-body > .ax-dg + * { margin-top: var(--space-5); }
/* an open manual keeps its title visible while scrolling through its chapters */
.ax-tree-book-btn[aria-expanded="true"] { position: sticky; top: calc(-1 * var(--space-2)); z-index: 2; background: var(--sidebar); box-shadow: 0 1px 0 var(--line); }
.ax-tree-book.is-here > .ax-tree-book-btn[aria-expanded="true"] { background: linear-gradient(var(--accent-tint), var(--accent-tint)), var(--sidebar); }
