/* Weight & Balance: application styles.

   One token set drives every screen. In order:
     tokens, base, shell (sidebar, top bar), controls, page layout, tables, states, overlays,
     overview, reports, report detail, new report, fleet, administration, fleet setup,
     station references, lever arm, sign in,
     official documents (copied unchanged: the PDF depends on them), document view, responsive, motion, print. */

/* ================= Tokens ================= */

:root {
  color-scheme: light;

  --bg: #f7f7f6;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --surface-3: #f1f1ef;
  --sidebar-bg: #f3f3f1;
  --hover: rgba(17, 18, 20, 0.045);
  --row-hover: #f7f7f5;
  --seg-bg: #efefed;
  --seg-on: #ffffff;
  --overlay: rgba(14, 15, 17, 0.4);
  --viewer-bg: #d8dee3;
  --viewer-grid: #cbd1d6;
  --viewer-grid-axis: #b2b9bf;
  --viewer-edge: #4d555c;
  --drawing-bg: #ffffff;
  --doc-stage: #e9e9e6;

  --line: #e4e4e1;
  --line-soft: #eeeeeb;
  --line-strong: #d4d4d0;
  --line-hover: #bdbdb8;

  --text: #17181a;
  --text-2: #51545a;
  --text-3: #85888e;

  --accent: #2b59c3;
  --accent-hover: #2149a8;
  --accent-text: #2450b5;
  --accent-soft: #eef2fb;
  --accent-line: #c6d3f0;
  --on-accent: #ffffff;

  --ok: #1b7446; --ok-soft: #eaf5ee; --ok-line: #bcdcc8;
  --warn: #8f5a00; --warn-soft: #fbf4e4; --warn-line: #ead3a0;
  --bad: #b3261e; --bad-soft: #fcedeb; --bad-line: #f0c2bc;

  --chart-major: #d9d9d5;
  --chart-minor: #eeeeeb;
  --chart-axis: #9a9ca1;
  --chart-env: rgba(43, 89, 195, 0.09);

  --font: Geist, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --fs-2xs: 10.5px;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 22px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;

  --sidebar-w: 212px;
  --topbar-h: 48px;
  --h-xs: 24px;
  --h-sm: 28px;
  --h-md: 32px;
  --h-lg: 36px;
  --nav-h: 30px;
  --row-h: 36px;
  --gutter: 24px;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --shadow-1: 0 1px 2px rgba(17, 18, 20, 0.05);
  --shadow-pop: 0 1px 2px rgba(17, 18, 20, 0.06), 0 12px 32px -10px rgba(17, 18, 20, 0.22);
  --shadow-dialog: 0 24px 64px -16px rgba(17, 18, 20, 0.34);
  --ring: 0 0 0 3px rgba(43, 89, 195, 0.2);
  --ring-bad: 0 0 0 3px rgba(179, 38, 30, 0.16);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-press: 80ms;
  --t-hover: 80ms;
  --t-focus: 130ms;
  --t-menu: 150ms;
  --t-dialog: 190ms;

  --pz: 1;
  font-family: var(--font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1012;
  --surface: #16171a;
  --surface-2: #1a1b1f;
  --surface-3: #212226;
  --sidebar-bg: #121316;
  --hover: rgba(255, 255, 255, 0.05);
  --row-hover: #1c1d21;
  --seg-bg: #1d1e22;
  --seg-on: #2b2c31;
  --overlay: rgba(0, 0, 0, 0.6);
  --viewer-bg: #1d2024;
  --viewer-grid: #2a2e33;
  --viewer-grid-axis: #3a3f46;
  --viewer-edge: #3d444b;
  --drawing-bg: #fbfbfa;
  --doc-stage: #0b0c0e;
  --line: #27282d;
  --line-soft: #202125;
  --line-strong: #35363c;
  --line-hover: #4a4b52;
  --text: #ececee;
  --text-2: #a5a7ae;
  --text-3: #74767d;
  --accent: #7d9cf2;
  --accent-hover: #95aff6;
  --accent-text: #98b0f5;
  --accent-soft: rgba(125, 156, 242, 0.12);
  --accent-line: rgba(125, 156, 242, 0.34);
  --on-accent: #0b0d13;
  --ok: #62c08d; --ok-soft: rgba(98, 192, 141, 0.12); --ok-line: rgba(98, 192, 141, 0.32);
  --warn: #e0aa4c; --warn-soft: rgba(224, 170, 76, 0.12); --warn-line: rgba(224, 170, 76, 0.32);
  --bad: #f08176; --bad-soft: rgba(240, 129, 118, 0.12); --bad-line: rgba(240, 129, 118, 0.32);
  --chart-major: #34353b;
  --chart-minor: #222327;
  --chart-axis: #6b6d74;
  --chart-env: rgba(125, 156, 242, 0.13);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 14px 36px -10px rgba(0, 0, 0, 0.7);
  --shadow-dialog: 0 28px 70px -16px rgba(0, 0, 0, 0.8);
  --ring: 0 0 0 3px rgba(125, 156, 242, 0.28);
  --ring-bad: 0 0 0 3px rgba(240, 129, 118, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1012;
    --surface: #16171a;
    --surface-2: #1a1b1f;
    --surface-3: #212226;
    --sidebar-bg: #121316;
    --hover: rgba(255, 255, 255, 0.05);
    --row-hover: #1c1d21;
    --seg-bg: #1d1e22;
    --seg-on: #2b2c31;
    --overlay: rgba(0, 0, 0, 0.6);
    --viewer-bg: #1d2024;
  --viewer-grid: #2a2e33;
  --viewer-grid-axis: #3a3f46;
  --viewer-edge: #3d444b;
    --drawing-bg: #fbfbfa;
    --doc-stage: #0b0c0e;
    --line: #27282d;
    --line-soft: #202125;
    --line-strong: #35363c;
    --line-hover: #4a4b52;
    --text: #ececee;
    --text-2: #a5a7ae;
    --text-3: #74767d;
    --accent: #7d9cf2;
    --accent-hover: #95aff6;
    --accent-text: #98b0f5;
    --accent-soft: rgba(125, 156, 242, 0.12);
    --accent-line: rgba(125, 156, 242, 0.34);
    --on-accent: #0b0d13;
    --ok: #62c08d; --ok-soft: rgba(98, 192, 141, 0.12); --ok-line: rgba(98, 192, 141, 0.32);
    --warn: #e0aa4c; --warn-soft: rgba(224, 170, 76, 0.12); --warn-line: rgba(224, 170, 76, 0.32);
    --bad: #f08176; --bad-soft: rgba(240, 129, 118, 0.12); --bad-line: rgba(240, 129, 118, 0.32);
    --chart-major: #34353b;
    --chart-minor: #222327;
    --chart-axis: #6b6d74;
    --chart-env: rgba(125, 156, 242, 0.13);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 14px 36px -10px rgba(0, 0, 0, 0.7);
    --shadow-dialog: 0 28px 70px -16px rgba(0, 0, 0, 0.8);
    --ring: 0 0 0 3px rgba(125, 156, 242, 0.28);
    --ring-bad: 0 0 0 3px rgba(240, 129, 118, 0.22);
  }
}

/* Model colours: a small swatch beside the model name. FleetSetup.applyModels() overrides these from the database. */
:root { --m-B200: #5a7fa8; --m-B300: #3f8069; --m-B300ER: #85689f; --m-C208B: #b9823f; --m-T206H: #a9605a; --m-T206H_ER: #9d5a82; }
[data-model="B200"] { --mc: var(--m-B200); }
[data-model="B300"] { --mc: var(--m-B300); }
[data-model="B300ER"] { --mc: var(--m-B300ER); }
[data-model="C208B"] { --mc: var(--m-C208B); }
[data-model="T206H"] { --mc: var(--m-T206H); }
[data-model="T206H_ER"] { --mc: var(--m-T206H_ER); }

/* ================= Base ================= */

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Icons are stroked line drawings from the sprite in index.html. The report chart and logo opt out further down. */
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
#i-more circle { fill: currentColor; stroke: none; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 300;
  padding: 7px 12px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--t-menu) var(--ease);
}
.skip-link:focus { transform: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.unit { margin-left: 3px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.mdl { display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; background: var(--mc, var(--text-3)); border-radius: 2px; }

/* An aircraft registration or report identifier */
.tail-id, .code-id { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.code-id { color: var(--text); }

kbd {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 4px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font: 500 10.5px/1 var(--mono);
}

/* ================= Shell ================= */

.app-frame { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-w);
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  transition: transform var(--t-menu) var(--ease), box-shadow var(--t-menu) var(--ease);
}

.sidebar-head { display: flex; height: var(--topbar-h); flex: 0 0 auto; align-items: center; gap: 6px; padding: 0 6px 0 12px; }

.brand { display: flex; min-width: 0; flex: 1; align-items: center; gap: 9px; color: var(--text); text-decoration: none; border-radius: var(--r); }
.brand-mark { width: 22px; height: 22px; flex: 0 0 22px; background: #000 url("assets/dst-emblem.png") center / cover no-repeat; border-radius: 5px; }
.brand-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.brand-copy strong { overflow: hidden; font-size: var(--fs-base); font-weight: 600; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy small { color: var(--text-3); font-size: var(--fs-2xs); font-weight: 500; }

.primary-nav { display: flex; flex: 1; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; padding: 8px 8px 12px; scrollbar-width: thin; }

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  height: var(--nav-h);
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: var(--r);
  font-size: var(--fs-base);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.nav-item:hover { color: var(--text); background: var(--hover); }
.nav-item:active { background: var(--surface-3); }
.nav-item.active { color: var(--text); background: var(--hover); font-weight: 600; }
.nav-item.active::before { position: absolute; top: 8px; bottom: 8px; left: 0; width: 2px; background: var(--accent); border-radius: 2px; content: ""; }

.nav-sep { height: 1px; margin: 8px 4px; flex: 0 0 auto; background: var(--line); }

.nav-parent .nav-caret { width: 12px; height: 12px; margin-left: auto; color: var(--text-3); stroke-width: 2; transform: rotate(-90deg); transition: transform var(--t-menu) var(--ease); }
.nav-parent[aria-expanded="true"] .nav-caret { transform: none; }
.nav-parent.has-active { color: var(--text); font-weight: 600; }

.nav-children { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--t-menu) var(--ease); }
.nav-group.collapsed .nav-children { grid-template-rows: 0fr; }
.nav-children-inner { position: relative; display: flex; min-height: 0; flex-direction: column; gap: 1px; overflow: hidden; padding: 2px 0 4px 10px; }
.nav-children-inner::before { position: absolute; top: 4px; bottom: 6px; left: 15px; width: 1px; background: var(--line); content: ""; }
.nav-child { height: 28px; padding-left: 18px; font-size: var(--fs-sm); }
.nav-child.active::before { top: 6px; bottom: 6px; left: 4.5px; }

.sidebar-foot { position: relative; flex: 0 0 auto; padding: 6px 8px max(8px, env(safe-area-inset-bottom, 0px)); background: var(--sidebar-bg); border-top: 1px solid var(--line); }

.user-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--r);
  text-align: left;
  transition: background-color var(--t-hover) var(--ease);
}
.user-card:hover, .user-card[aria-expanded="true"] { background: var(--hover); }
.user-card > svg { width: 14px; height: 14px; color: var(--text-3); }

.avatar {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.user-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; line-height: 1.25; }
.user-copy strong, .user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: var(--fs-sm); font-weight: 600; }
.user-copy small { color: var(--text-3); font-size: var(--fs-2xs); }

.account-pop {
  position: absolute;
  right: 8px;
  bottom: calc(100% - 2px);
  left: 8px;
  z-index: 60;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  animation: pop-up var(--t-menu) var(--ease) both;
}
.menu-item, .account-pop button {
  display: block;
  width: 100%;
  height: 28px;
  padding: 0 8px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  text-align: left;
  transition: background-color var(--t-hover) var(--ease);
}
.menu-item:hover, .account-pop button:hover { background: var(--hover); }

.sidebar-scrim { display: none; }

.main-shell { min-height: 100vh; margin-left: var(--sidebar-w); transition: margin-left var(--t-menu) var(--ease); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  height: var(--topbar-h);
  align-items: center;
  gap: 12px;
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar .menu-btn { display: none; }

.crumbs { display: flex; min-width: 0; align-items: center; gap: 6px; margin: 0; padding: 0; color: var(--text-3); font-size: var(--fs-base); list-style: none; white-space: nowrap; }
.crumbs li { display: flex; min-width: 0; align-items: center; gap: 6px; }
.crumbs li + li::before { color: var(--line-hover); content: "/"; }
.crumbs a { color: var(--text-3); text-decoration: none; border-radius: var(--r-sm); transition: color var(--t-hover) var(--ease); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current="page"] { overflow: hidden; color: var(--text); font-weight: 600; text-overflow: ellipsis; }

.search-shell {
  display: flex;
  width: min(300px, 34vw);
  height: var(--h-md);
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 0 6px 0 9px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color var(--t-focus) var(--ease), box-shadow var(--t-focus) var(--ease);
}
.search-shell:hover { border-color: var(--line-strong); }
.search-shell:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.search-shell svg { width: 14px; height: 14px; }
.search-shell input { min-width: 0; height: 100%; flex: 1; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: var(--fs-sm); }
.search-shell input::placeholder { color: var(--text-3); }
.search-shell input:focus-visible { outline: 0; }

.topbar-actions { display: flex; align-items: center; gap: 2px; }
.search-shell { position: relative; }
.gs-pop { position: absolute; top: calc(100% + 6px); right: 0; left: 0; z-index: 70; min-width: 360px; max-height: min(460px, 70dvh); overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in var(--t-menu) var(--ease) both; }
.gs-group { margin: 6px 8px 2px; color: var(--text-3); font-size: var(--fs-2xs); font-weight: 500; }
.gs-item { display: flex; width: 100%; min-height: 30px; align-items: baseline; gap: 10px; padding: 5px 8px; color: var(--text); background: transparent; border: 0; border-radius: var(--r-sm); font-size: var(--fs-sm); text-align: left; }
.gs-item.active { background: var(--hover); }
.gs-title { flex: 0 0 auto; font-weight: 500; }
.gs-title.mono { font-family: var(--mono); }
.gs-meta { min-width: 0; overflow: hidden; color: var(--text-3); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.gs-all { margin-top: 4px; border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--r-sm) var(--r-sm); color: var(--accent-text); }
.gs-none { margin: 4px 8px 6px; color: var(--text-3); font-size: var(--fs-xs); }

#app-view { width: 100%; min-height: calc(100vh - var(--topbar-h)); padding: 20px var(--gutter) 40px; outline: 0; }

/* Sidebar hidden by the user: the top bar's Menu button opens it over the page. */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main-shell { margin-left: 0; }
body.sidebar-collapsed .topbar .menu-btn { display: inline-flex; }
body.sidebar-collapsed.nav-open .sidebar { transform: none; box-shadow: var(--shadow-dialog); }
body.sidebar-collapsed.nav-open .sidebar-scrim { position: fixed; inset: 0; z-index: 45; display: block; background: var(--overlay); border: 0; animation: fade-in var(--t-menu) ease both; }

/* ================= Controls ================= */

.button {
  display: inline-flex;
  height: var(--h-md);
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease), box-shadow var(--t-hover) var(--ease), transform var(--t-press) var(--ease);
}
.button svg { width: 14px; height: 14px; }
.button:active:not(:disabled) { transform: translateY(0.5px); }
.button.sm { height: var(--h-sm); padding: 0 10px; font-size: var(--fs-sm); }

.button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.button.secondary { color: var(--text); background: var(--surface); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.button.secondary:hover { background: var(--surface-2); border-color: var(--line-hover); }

.button.ghost { color: var(--text-2); background: transparent; }
.button.ghost:hover { color: var(--text); background: var(--hover); }

.button.danger { color: #fff; background: var(--bad); border-color: var(--bad); box-shadow: var(--shadow-1); }
.button.danger:hover { filter: brightness(0.93); }
:root[data-theme="dark"] .button.danger { color: #1a0b09; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .button.danger { color: #1a0b09; } }

.button:disabled, .button.primary:disabled, .button.secondary:disabled { color: var(--text-3); background: var(--surface-2); border-color: var(--line); box-shadow: none; cursor: not-allowed; filter: none; }
.button.busy { cursor: progress; opacity: 0.7; }

.icon-button {
  position: relative;
  display: inline-grid;
  width: var(--h-md);
  height: var(--h-md);
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r);
  transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.icon-button:hover { color: var(--text); background: var(--hover); }
.icon-button:active { background: var(--surface-3); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button.sm { width: var(--h-sm); height: var(--h-sm); }
.icon-button.sm svg { width: 14px; height: 14px; }

.link-btn, .text-button {
  display: inline-flex;
  height: var(--h-xs);
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  color: var(--accent-text);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.link-btn:hover, .text-button:hover { background: var(--accent-soft); }
.link-btn.bad { color: var(--bad); }
.link-btn.bad:hover { background: var(--bad-soft); }
.link-btn svg, .text-button svg { width: 13px; height: 13px; }
.link-btn:disabled { color: var(--text-3); background: none; cursor: not-allowed; }

/* Segmented control: report type, drawing, units, theme */
.sr-seg {
  display: inline-flex;
  height: var(--h-md);
  max-width: 100%;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 2px;
  overflow-x: auto;
  padding: 2px;
  background: var(--seg-bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  scrollbar-width: none;
}
.sr-seg::-webkit-scrollbar { display: none; }
.sr-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease), box-shadow var(--t-hover) var(--ease);
}
.sr-seg button:hover { color: var(--text); }
.sr-seg button.active { color: var(--text); background: var(--seg-on); box-shadow: 0 1px 2px rgba(17, 18, 20, 0.1), 0 0 0 1px var(--line); font-weight: 600; }
.sr-seg button:focus-visible { outline-offset: -2px; }
.sr-seg button small { color: var(--text-3); font: 500 var(--fs-2xs) var(--mono); font-variant-numeric: tabular-nums; }
.sr-seg button.active small { color: var(--text-2); }
.sr-seg.small { height: var(--h-sm); }
.sr-seg.small button { padding: 0 9px; font-size: var(--fs-xs); }

/* Text inputs, selects and text areas share one look */
.input,
.form-field input,
.form-field select,
.form-field textarea,
.select-wrap select,
.toolbar-select,
.nr-in,
.nr-select,
.nr-fields input,
.nr-fields select,
.nr-fields textarea,
.fs-gi,
.sr-goto input,
.fs-dens input {
  width: 100%;
  height: var(--h-md);
  padding: 0 9px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  outline: 0;
  font-size: var(--fs-base);
  transition: border-color var(--t-focus) var(--ease), box-shadow var(--t-focus) var(--ease), background-color var(--t-focus) var(--ease);
}
.input:hover, .form-field input:hover, .form-field select:hover, .form-field textarea:hover, .select-wrap select:hover, .nr-in:hover, .nr-fields input:hover, .nr-fields textarea:hover, .fs-gi:hover, .sr-goto input:hover, .fs-dens input:hover { border-color: var(--line-hover); }
.input:focus, .form-field input:focus, .form-field select:focus, .form-field textarea:focus, .select-wrap select:focus, .nr-in:focus, .nr-select:focus, .nr-fields input:focus, .nr-fields select:focus, .nr-fields textarea:focus, .fs-gi:focus, .sr-goto input:focus, .fs-dens input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: 0; }
.form-field textarea, .nr-fields textarea { height: auto; min-height: 64px; padding: 7px 9px; line-height: 1.45; resize: vertical; }
.form-field input[readonly], .nr-fields input[readonly] { color: var(--text-2); background: var(--surface-2); border-color: var(--line); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input[type="number"], input[type="date"], .nr-in, .fs-num { font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.4; }
.invalid, .form-field .invalid, .nr-fields .invalid, .fs-gi.bad { border-color: var(--bad) !important; }
.invalid:focus, .fs-gi.bad:focus { box-shadow: var(--ring-bad) !important; }
input[type="checkbox"]:not(.switch), input[type="radio"] { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }

.select-wrap { position: relative; display: block; min-width: 0; }
.select-wrap select, .toolbar-select { padding-right: 26px; appearance: none; -webkit-appearance: none; }
.select-wrap > svg { position: absolute; top: 50%; right: 8px; width: 13px; height: 13px; color: var(--text-3); pointer-events: none; transform: translateY(-50%); stroke-width: 2; }
.toolbar .select-wrap, .page-head .select-wrap { display: inline-block; }
.toolbar .select-wrap select, .toolbar-select { width: auto; min-width: 140px; }

.form-field { min-width: 0; }
.form-field > label, .field-label { display: block; margin: 0 0 4px; color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; }

.switch {
  position: relative;
  width: 28px;
  height: 16px;
  flex: 0 0 28px;
  margin: 0;
  background: var(--line-hover);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color var(--t-focus) var(--ease);
}
.switch::after { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); content: ""; transition: transform var(--t-focus) var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(12px); }

/* A boolean filter that reads as a button but keeps a visible checkbox, so the state never depends on colour alone */
.toggle-chip {
  display: inline-flex;
  height: var(--h-md);
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.toggle-chip:hover { border-color: var(--line-hover); color: var(--text); }
.toggle-chip:has(input:checked) { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.toggle-chip:has(input:focus-visible) { box-shadow: var(--ring); }
.toggle-chip input:focus-visible { outline: 0; }

.inline-search, .picker-search {
  display: flex;
  width: 280px;
  max-width: 100%;
  height: var(--h-md);
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  transition: border-color var(--t-focus) var(--ease), box-shadow var(--t-focus) var(--ease);
}
.inline-search:hover, .picker-search:hover { border-color: var(--line-hover); }
.inline-search:focus-within, .picker-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.inline-search svg, .picker-search svg { width: 14px; height: 14px; }
.inline-search input, .picker-search input { min-width: 0; height: 100%; flex: 1; margin: 0; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: var(--fs-base); }
.inline-search input:focus-visible, .picker-search input:focus-visible { outline: 0; }

.check-row { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--text-2); font-size: var(--fs-base); cursor: pointer; }

.status-badge {
  display: inline-flex;
  height: 20px;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-2xs);
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}
.status-badge::before { width: 6px; height: 6px; flex: 0 0 6px; background: currentColor; border-radius: 50%; content: ""; opacity: 0.85; }
.status-badge.ready, .status-badge.imported { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.status-badge.review { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.status-badge.alert { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); }

/* ================= Page layout ================= */

.page-shell { width: 100%; max-width: 1680px; margin: 0 auto; }

.page-head { position: relative; z-index: 30; display: flex; min-height: var(--h-lg); align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 16px; }
.page-head h1 { margin: 0; color: var(--text); font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.022em; line-height: 1.2; }
.page-title { display: flex; min-width: 0; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-sub { margin: 3px 0 0; color: var(--text-3); font-size: var(--fs-sm); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel-header { display: flex; min-height: 40px; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line-soft); }
.panel-header h2 { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.panel-header h2 small, .count { color: var(--text-3); font: 500 var(--fs-xs) var(--mono); font-variant-numeric: tabular-nums; }
.panel-body { padding: 12px 14px; }

.toolbar { position: relative; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px; border-bottom: 1px solid var(--line-soft); }
.toolbar-left, .toolbar-right { display: flex; min-width: 0; align-items: center; gap: 8px; flex-wrap: wrap; }
.result-count { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-sep { width: 1px; height: 18px; flex: 0 0 1px; background: var(--line); }
.tb-label { color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }

/* ================= Tables ================= */

.data-table-wrap { overflow-x: auto; scrollbar-width: thin; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-base); }
.data-table th {
  height: 32px;
  padding: 0 12px;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.data-table td { height: var(--row-h); padding: 0 12px; color: var(--text); border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background-color var(--t-hover) var(--ease); }
.data-table tbody tr:hover td { background: var(--row-hover); }
.data-table th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th .unit { margin-left: 2px; font-size: var(--fs-2xs); }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.data-table tr.clickable:active td { background: var(--surface-3); }
.data-table tr.selected td, .data-table tr.selected:hover td { background: var(--accent-soft); }
.data-table tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.data-table tr.group-row td { height: 30px; color: var(--text-2); background: var(--surface-2); border-bottom-color: var(--line); font-size: var(--fs-xs); font-weight: 600; }
.data-table tr.group-row:hover td { background: var(--surface-2); }
.data-table tr.group-row .mdl { margin-right: 7px; vertical-align: 0; }
.data-table tr.group-row td { padding: 0 8px; }
.group-toggle { display: flex; width: 100%; height: 30px; align-items: center; gap: 0; padding: 0 4px; color: inherit; background: none; border: 0; border-radius: var(--r-sm); font: inherit; text-align: left; }
.group-toggle:hover { color: var(--text); }
.group-toggle > svg { width: 12px; height: 12px; margin-right: 6px; color: var(--text-3); stroke-width: 2.2; transition: transform var(--t-menu) var(--ease); }
.group-toggle[aria-expanded="false"] > svg { transform: rotate(-90deg); }
.group-toggle:focus-visible { outline-offset: -2px; }
.data-table tr.group-row span + span { margin-left: 8px; color: var(--text-3); font-weight: 400; }
.data-table tr.group-row span:last-child { margin-left: auto; font-family: var(--mono); }
.data-table tfoot td { height: 34px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; font-weight: 600; }
.data-table .dim { color: var(--text-3); }
.data-table .open-cell { width: 1%; padding-right: 8px; color: var(--text-3); text-align: right; }
.data-table tr.clickable:hover .open-cell { color: var(--accent-text); }

.th-sort { display: inline-flex; height: 24px; align-items: center; gap: 3px; margin: 0 -6px; padding: 0 6px; color: inherit; background: transparent; border: 0; border-radius: var(--r-sm); font: inherit; transition: color var(--t-hover) var(--ease), background-color var(--t-hover) var(--ease); }
.th-sort:hover { color: var(--text); background: var(--hover); }
.th-sort.active { color: var(--text); }
.th-sort svg { width: 11px; height: 11px; opacity: 0; stroke-width: 2.2; transition: opacity var(--t-hover) var(--ease); }
.th-sort:hover svg, .th-sort:focus-visible svg { opacity: 0.45; }
.th-sort.active { font-weight: 600; }
.th-sort.active svg { opacity: 1; color: var(--accent-text); }
.num .th-sort { flex-direction: row-reverse; }

.notes-cell { max-width: 240px; color: var(--text-2) !important; }
.notes-cell > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table.has-grow th:not(.grow), .data-table.has-grow td:not(.grow) { width: 1%; }
.data-table .grow, .notes-cell.grow { width: 100%; min-width: 160px; max-width: 0; }
.note-tip { position: fixed; z-index: 250; padding: 7px 10px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; pointer-events: none; }
.cell-sub { display: block; margin-top: 1px; color: var(--text-3); font-size: var(--fs-2xs); }
.row-actions { width: 1%; text-align: right; white-space: nowrap; }
.admin-table tr.is-deleted td { color: var(--text-3); }
.admin-table tr.is-deleted strong { text-decoration: line-through; }

.tail-cell { display: flex; align-items: baseline; gap: 8px; }
.tail-cell .mdl { display: none; }
.tail-cell span { display: flex; align-items: baseline; gap: 8px; }
.tail-cell strong { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 500; letter-spacing: -0.01em; }
.tail-cell small { color: var(--text-3); font-size: var(--fs-xs); }

/* ================= States ================= */

.empty-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px 20px; color: var(--text-3); font-size: var(--fs-base); text-align: center; }
.empty-state svg { width: 16px; height: 16px; }
.empty-state strong { display: block; color: var(--text-2); font-weight: 600; }
.empty-state p { margin: 4px 0 0; text-wrap: pretty; }
.empty-state code { padding: 1px 5px; background: var(--surface-3); border-radius: var(--r-sm); font: 11.5px var(--mono); }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--r-lg); }
.skeleton::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent); content: ""; transform: translateX(-100%); animation: shimmer 1.4s ease-in-out infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent); } }
.skeleton-banner { width: 220px; height: 28px; margin-bottom: 16px; }
.skeleton-panel { min-height: 260px; }

.notice, .validation-note, .admin-note, .report-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  padding: 7px 10px;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  line-height: 1.45;
}
.notice svg, .validation-note svg, .report-banner svg { width: 14px; height: 14px; margin-top: 1px; }
.auth-error, .fs-plist { margin: 0 0 12px; padding: 7px 10px; color: var(--bad); background: var(--bad-soft); border: 1px solid var(--bad-line); border-radius: var(--r); font-size: var(--fs-sm); }

.toast-region { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 200; display: grid; justify-items: end; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  max-width: min(440px, calc(100vw - 32px));
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toast-in var(--t-dialog) var(--ease) both;
}
.toast svg { width: 14px; height: 14px; color: var(--ok); }
.toast:has(use[href="#i-alert-triangle"]) svg { color: var(--warn); }
.toast:has(use[href="#i-info"]) svg { color: var(--text-3); }

/* ================= Overlays: dialogs, filters, settings ================= */

.sign-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: var(--overlay); animation: fade-in var(--t-dialog) ease both; }
.sign-card {
  display: flex;
  width: min(100%, 560px);
  max-height: calc(100dvh - 40px);
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-dialog);
  animation: dialog-in var(--t-dialog) var(--ease) both;
}
.sign-card header { display: flex; min-height: 46px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line-soft); }
.sign-card h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.sign-card footer { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface-2); border-top: 1px solid var(--line-soft); }
.sign-spacer { flex: 1; }
.sign-pad { position: relative; height: clamp(150px, 26vh, 210px); margin: 14px 16px; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-lg); touch-action: none; }
.sign-pad canvas { display: block; width: 100%; height: 100%; border-radius: var(--r-lg); cursor: crosshair; touch-action: none; }
.sign-baseline { position: absolute; right: 18px; bottom: 34px; left: 18px; border-bottom: 1.5px solid #c8ced3; pointer-events: none; }
body.modal-open { overflow: hidden; }

.admin-card { width: min(100%, 520px); }
.admin-fields { overflow-y: auto; padding: 14px 16px 4px; }
.admin-fields .form-field { margin-bottom: 12px; }
.admin-fields .filter-toggle { margin: 0 0 12px; }
.admin-pair { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 10px; }
.admin-lede { margin: 0 0 12px; color: var(--text-2); font-size: var(--fs-base); line-height: 1.5; }

.filter-wrap { position: relative; }
.filter-btn {
  display: inline-flex;
  height: var(--h-md);
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background-color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease);
}
.filter-btn:hover { border-color: var(--line-hover); }
.filter-btn[aria-expanded="true"] { background: var(--surface-2); }
.filter-btn.on { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.filter-btn b { display: inline-grid; min-width: 16px; height: 16px; place-items: center; padding: 0 4px; color: var(--on-accent); background: var(--accent); border-radius: 8px; font: 600 10px/1 var(--mono); }
.filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  width: 300px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  isolation: isolate;
  animation: pop-in var(--t-menu) var(--ease) both;
}
.filter-sec + .filter-sec { margin-top: 10px; }
.filter-sec p { margin: 0 0 5px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  height: 24px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  transition: background-color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-hover); }
.chip.on { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); font-weight: 600; }
.filter-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; }
.filter-foot { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.filter-chip {
  display: inline-flex;
  height: var(--h-xs);
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 8px;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  font: 500 var(--fs-xs) var(--mono);
}
.filter-chip svg { width: 12px; height: 12px; }
.filter-chip:hover { border-color: var(--accent); }

.settings { position: relative; }
.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(280px, calc(100vw - 24px));
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  animation: pop-in var(--t-menu) var(--ease) both;
}
.settings-panel h2 { margin: 0 0 8px; font-size: var(--fs-base); font-weight: 600; }
.settings-group { margin: 12px 0 6px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.theme-seg { display: flex; width: 100%; }
.theme-seg button { flex: 1; }
.switch-row { display: flex; min-height: 30px; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch-copy strong { color: var(--text); font-size: var(--fs-sm); font-weight: 500; }

/* ================= Overview ================= */

.ov-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; color: var(--text-3); font-size: var(--fs-sm); }
.ov-meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); gap: 16px; align-items: start; }
.ov-col { display: grid; min-width: 0; gap: 16px; }

.fleet-mini { margin: 0; padding: 0; list-style: none; }
.fleet-mini li { padding: 9px 14px 10px; border-bottom: 1px solid var(--line-soft); }
.fleet-mini li:last-child { border-bottom: 0; }
.fm-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; color: var(--text); background: none; border: 0; text-align: left; }
.fm-head:hover .fm-model { color: var(--accent-text); }
.fm-model { font: 600 var(--fs-sm) var(--mono); letter-spacing: -0.01em; transition: color var(--t-hover) var(--ease); }
.fm-name { min-width: 0; flex: 1; overflow: hidden; color: var(--text-3); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.fm-count { color: var(--text-2); font: 500 var(--fs-xs) var(--mono); }
.fm-tails { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 4px; padding-left: 15px; }
.fm-tails button { height: 20px; padding: 0; color: var(--text-2); background: none; border: 0; font: 500 var(--fs-xs) var(--mono); transition: color var(--t-hover) var(--ease); }
.fm-tails button:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

/* ================= Report detail ================= */

.back-link { display: inline-flex; height: var(--h-xs); align-items: center; gap: 3px; margin: 0 0 6px -6px; padding: 0 6px 0 3px; color: var(--text-3); background: none; border: 0; border-radius: var(--r-sm); font-size: var(--fs-sm); text-decoration: none; transition: color var(--t-hover) var(--ease), background-color var(--t-hover) var(--ease); }
.back-link svg { width: 14px; height: 14px; }
.back-link:hover { color: var(--text); background: var(--hover); }

.rd-head { position: relative; z-index: 30; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.rd-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-title h1 { margin: 0; font-family: var(--mono); font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; }
.rd-title .rd-tail { color: var(--text-2); font: 500 var(--fs-lg) var(--mono); letter-spacing: -0.02em; }
.rd-sub { display: flex; flex-wrap: wrap; gap: 3px 16px; margin: 5px 0 0; padding: 0; color: var(--text-3); font-size: var(--fs-sm); list-style: none; }
.rd-sub b { color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }

.rd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.74fr); gap: 16px; align-items: start; }
.rd-col { display: grid; min-width: 0; gap: 16px; }
.rd-side { position: sticky; top: calc(var(--topbar-h) + 16px); display: grid; gap: 16px; }

/* Engineering measurement: label, value, unit. Values are shown exactly as the printed report shows them;
   the stored value sits in the title when it carries more digits. */
.measures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.measure { min-width: 0; padding: 10px 14px 11px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.measure:nth-child(3n) { border-right: 0; }
.measure:nth-last-child(-n + 3) { border-bottom: 0; }
.measure dt { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.measure dd { margin: 3px 0 0; color: var(--text); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.measure dd .unit { font-size: var(--fs-xs); }
.measure.primary dd { font-size: 19px; }
.measure .na { color: var(--text-3); font-weight: 500; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.kv > div { display: grid; min-width: 0; grid-template-columns: 128px minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line-soft); }
.kv > div:nth-last-child(-n + 2):nth-child(odd), .kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--text-3); font-size: var(--fs-xs); }
.rd-side .kv { grid-template-columns: minmax(0, 1fr); }
.rd-side .kv > div:nth-last-child(-n + 2):nth-child(odd) { border-bottom: 1px solid var(--line-soft); }
.rd-side .kv > div:last-child { border-bottom: 0; }
.kv dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }

.eng th, .eng td { padding-inline: 14px; }
.eng td.label { color: var(--text-2); }
.eng td small { color: var(--text-3); font-size: var(--fs-xs); }
.eng td.hatch-cell { color: var(--text-3); }
.eng tr.blank-note td { color: var(--text-3); font-style: italic; }

.rd-notes { margin: 0; padding: 12px 14px; color: var(--text); font-size: var(--fs-base); line-height: 1.55; white-space: pre-wrap; }
.rd-notes.empty { color: var(--text-3); }
.sig-preview { display: block; max-width: 200px; max-height: 40px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); }

/* CG envelope drawn in the app (the same SVG the report prints, themed for the screen) */
.env-plot { padding: 10px 12px 12px; }
.env-plot svg { display: block; width: 100%; height: auto; stroke: none; }
.env-empty { display: grid; min-height: 300px; place-items: center; padding: 24px; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
.env-empty strong { display: block; margin-bottom: 4px; color: var(--text-2); font-weight: 600; }

/* ================= New report ================= */

.nr-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 34vw, 560px); gap: 16px; align-items: start; }
.nr-form { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); counter-reset: step; }
.nr-sec { padding: 14px 16px 16px; border-top: 1px solid var(--line-soft); }
.nr-form > .nr-sec:first-child, .nr-form > div > .nr-sec:first-child, .nr-sec.nr-first { border-top: 0; }
.nr-sec h2 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.nr-sec h2 small { color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0; }
.nr:not(.la-page) .nr-form .nr-sec h2::before { min-width: 14px; color: var(--text-3); font: 500 var(--fs-xs) var(--mono); content: counter(step); counter-increment: step; }
.nr-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.nr-sec-head h2 { margin: 0; }
.nr-sec-head .nr-load { margin-left: auto; }
.nr-load select { width: auto; min-width: 210px; height: var(--h-sm); font-size: var(--fs-sm); }

/* Aircraft picker: search, model filter and one compact list */
.acp { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); }
.acp-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.acp-bar .picker-search { width: auto; min-width: 200px; flex: 1; }
.acp-list { max-height: min(340px, 44vh); overflow-y: auto; margin: 0; padding: 0 0 4px; list-style: none; scrollbar-width: thin; }
.acp-group { position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; gap: 8px; padding: 8px 12px 4px; color: var(--text-3); background: var(--surface); font-size: var(--fs-xs); }
.acp-group b { color: var(--text-2); font: 600 var(--fs-xs) var(--mono); }
.acp-group em { margin-left: auto; font: 500 var(--fs-2xs) var(--mono); font-style: normal; }
.acp-opt {
  display: grid;
  width: 100%;
  height: 30px;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  color: var(--text);
  background: transparent;
  border: 0;
  font-size: var(--fs-sm);
  text-align: left;
  transition: background-color var(--t-hover) var(--ease);
}
.acp-opt:hover, .acp-opt.focus { background: var(--row-hover); }
.acp-opt.focus { box-shadow: inset 2px 0 0 var(--accent); }
.acp-opt:focus-visible { outline-offset: -2px; }
.acp-opt .t { font: 500 var(--fs-sm) var(--mono); letter-spacing: -0.01em; }
.acp-opt .s { min-width: 0; overflow: hidden; color: var(--text-3); text-overflow: ellipsis; white-space: nowrap; }
.acp-opt .g { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.acp-empty { margin: 0; padding: 20px; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }

.nr-plane { display: flex; align-items: center; gap: 10px 22px; flex-wrap: wrap; padding: 8px 10px 8px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.nr-plane-id { display: flex; align-items: baseline; gap: 8px; }
.nr-plane-id strong { font: 600 var(--fs-lg) var(--mono); letter-spacing: -0.02em; }
.nr-plane-id span { color: var(--text-2); font-size: var(--fs-sm); }
.nr-plane dl { display: flex; gap: 18px; flex-wrap: wrap; margin: 0; }
.nr-plane dt { color: var(--text-3); font-size: var(--fs-2xs); }
.nr-plane dd { margin: 0; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.nr-plane .link-btn { margin-left: auto; }
.nr-sec-bar { padding: 8px 12px 8px 16px; }
.nr-sec-bar .nr-plane { min-height: 32px; flex-wrap: nowrap; gap: 6px 18px; padding: 0; background: none; border: 0; }
.nr-sec-bar .nr-plane-id { min-width: 0; }
.nr-sec-bar .nr-plane-id span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-sec-bar dl, .nr-sec-bar h2, .nr-sec-bar .link-btn { flex: 0 0 auto; }
.nr-sec-bar dd { white-space: nowrap; }
.nr-sec-bar h2 { margin: 0; }
.nr-sec-bar dl { gap: 16px; }
.nr-sec-bar dl > div { display: flex; align-items: baseline; gap: 6px; }

/* Starting point and installation reference: the chosen record and configuration in full */
.nr-base, .nr-config { margin-top: 10px; padding: 10px 12px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.nr-base .nr-facts { margin: 0 0 4px; flex-wrap: wrap; gap: 6px 24px; }
.nr-base-h { margin: 10px 0 6px; color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; }
.nr-config .nr-base-h:first-child { margin-top: 0; }
.nr-base-lead { margin: 8px 0 0; color: var(--text); font-size: var(--fs-sm); line-height: 1.5; }
.nr-base-lead.warn { padding: 7px 10px; color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--r); }
.nr-base .nr-facts dd small { display: block; color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }
.nr-base-from { margin: 8px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.nr-base-notes { max-height: 7.6em; overflow-y: auto; margin: 0 0 6px; color: var(--text); font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; }
.nr-base .data-table-wrap, .nr-config .data-table-wrap { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.nr-base .data-table td, .nr-config .data-table td { height: 30px; }
.nr-config .button { margin-top: 10px; }
.nr-config-line { margin: 8px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.nr-inst-row { grid-template-columns: minmax(220px, 360px); margin-bottom: 0; }
.td-check { margin: 0; padding: 8px 14px; color: var(--text-2); border-top: 1px solid var(--line-soft); font-size: var(--fs-xs); }
.td-check b { color: var(--text); }
.td-check.ok b { color: var(--ok); }
.td-check.bad { color: var(--warn); }
.td-check.bad b { color: var(--warn); }
.nr-base .td-check { padding: 8px 0 0; border-top: 0; }
.nr-resume { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 6px 8px 6px 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r); font-size: var(--fs-sm); }
.nr-resume span { margin-right: auto; }

.nr-scale { display: grid; gap: 6px; }
.nr-row { display: grid; grid-template-columns: 88px repeat(3, minmax(0, 1fr)) 112px; align-items: center; gap: 8px; }
.nr-row > strong { color: var(--text-2); font-size: var(--fs-base); font-weight: 500; }
.nr-head { color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.nr-head span:last-child { text-align: right; }
.nr-in { text-align: right; }
.nr-adj .nr-in[data-adj="item"], .la-text { text-align: left; }

/* Calculated values: read-only, set on a quiet fill so they never look like inputs */
.nr-net, .calc {
  display: flex;
  height: var(--h-md);
  align-items: center;
  justify-content: flex-end;
  padding: 0 9px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nr-adjs { display: grid; gap: 6px; margin: 0 0 10px; }
.nr-adjs:empty { display: none; }
.nr-adj, .nr-adj-head { display: grid; grid-template-columns: minmax(140px, 2fr) repeat(2, minmax(0, 1fr)) 112px 32px; align-items: center; gap: 8px; }
.nr-adj-head { margin-bottom: 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.nr-adj-head span:nth-child(n + 2):nth-child(-n + 4) { text-align: right; }
.nr-x { width: var(--h-md); height: var(--h-md); color: var(--text-3); }
.nr-x:hover { color: var(--bad); background: var(--bad-soft); }
.field-hint { margin: 8px 0 0; color: var(--text-3); font-size: var(--fs-xs); }
.nr-facts { display: flex; gap: 24px; margin: 10px 0 0; }
.nr-facts dt { color: var(--text-3); font-size: var(--fs-xs); }
.nr-facts dd { margin: 2px 0 0; font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.nr-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; }
.nr-notes { grid-column: 1 / -1; }
.nr-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 10px 16px; background: var(--surface-2); border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.nr-need { display: flex; align-items: center; gap: 7px; margin-right: auto; color: var(--text-3); font-size: var(--fs-sm); }
.nr-need:not(:empty)::before { width: 6px; height: 6px; background: var(--warn); border-radius: 50%; content: ""; }
.nr-actions .button:disabled { opacity: 0.6; }

.nr-live { position: sticky; top: calc(var(--topbar-h) + 16px); min-width: 0; }
#nr-result { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.nr-result-head { display: flex; min-height: 40px; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--line-soft); }
.nr-result-head strong { font-size: var(--fs-md); font-weight: 600; }
.nr-stats { display: grid; grid-template-columns: 1.3fr 1fr 1fr; margin: 0; border-bottom: 1px solid var(--line-soft); }
.nr-stats > div { min-width: 0; padding: 9px 14px 10px; border-right: 1px solid var(--line-soft); }
.nr-stats > div:last-child { border-right: 0; }
.nr-stats dt { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.nr-stats dd { margin: 3px 0 0; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.nr-stats dd small { margin-left: 3px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
#nr-warn:not(:empty) { padding: 10px 14px 0; }
#nr-warn .validation-note { margin: 0; }
.nr-empty, .nr-note { padding: 32px 14px; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
.live-pt { transition: transform 200ms var(--ease); }

/* ================= Fleet ================= */


/* ================= Administration ================= */

.admin-page .page-head { margin-bottom: 12px; }
.fuel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fuel-unusable { display: flex; gap: 20px; margin: 0; }
.fuel-unusable dt { color: var(--text-3); font-size: var(--fs-xs); }
.fuel-unusable dd { margin: 1px 0 0; font-size: var(--fs-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.fuel-grid { display: grid; grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr); gap: 16px; align-items: start; }
.fuel-table { max-height: calc(100dvh / var(--pz) - var(--topbar-h) - 200px); min-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.fuel-table thead th { position: sticky; top: 0; z-index: 1; }
.fuel-table td { height: 30px; }
.fuel-table tbody tr.hot td { background: var(--accent-soft); }
.fuel-chart { position: relative; margin: 0; padding: 14px 14px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.fuel-chart svg { display: block; width: 100%; height: auto; overflow: visible; stroke: none; }
.fuel-chart svg text { stroke: none; }
.fuel-chart .gl { stroke: var(--line); stroke-dasharray: 2 4; stroke-width: 1; }
.fuel-chart .tk { fill: var(--text-3); font: 11px var(--mono); }
.fuel-chart .un { fill: var(--text-3); font-size: 11px; font-weight: 500; }
.fuel-chart .fc-s1 { stop-color: var(--accent); stop-opacity: 0.08; }
.fuel-chart .fc-s2 { stop-color: var(--accent); stop-opacity: 0.08; }
.fuel-chart .ar { fill: url(#fc-fill); stroke: none; }
.fuel-chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fuel-chart .end { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.fuel-chart .hl { stroke: var(--line-hover); stroke-width: 1; }
.fuel-chart .hd { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.fuel-chart .hit { fill: transparent; stroke: none; cursor: crosshair; }
.fc-tip { position: absolute; z-index: 2; display: grid; gap: 1px; padding: 6px 9px; color: var(--bg); background: var(--text); border-radius: var(--r); box-shadow: var(--shadow-pop); pointer-events: none; transform: translate(12px, -120%); white-space: nowrap; }
.fc-tip.flip { transform: translate(calc(-100% - 12px), -120%); }
.fc-tip strong { font: 600 var(--fs-base) var(--mono); }
.fc-tip span { font-size: var(--fs-xs); opacity: 0.75; }

.audit-table td { height: auto; padding-top: 8px; padding-bottom: 8px; vertical-align: top; white-space: normal; }
.audit-table td.nowrap { white-space: nowrap; }
.audit-table .cell-sub { display: inline; margin-left: 6px; }
.changes { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--fs-xs); }
.chg { color: var(--text-2); font-variant-numeric: tabular-nums; }
.chg b { color: var(--text-3); font-weight: 500; }
.chg i { color: var(--text-3); font-style: normal; }

/* ================= Fleet setup (Administration > Aircraft) ================= */

.fs-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.fs-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fs-sec { margin: 0 0 12px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.fs-sec > h2 { margin: 0; padding: 10px 14px; font-size: var(--fs-md); font-weight: 600; border-bottom: 1px solid var(--line-soft); }
.fs-model-head { display: flex; min-height: 40px; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line-soft); }
.fs-model-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font: 600 var(--fs-base) var(--mono); }
.fs-model-head .muted { font-size: var(--fs-sm); }
.fs-model-head .link-btn { margin-left: auto; }
.fs-count { color: var(--text-3); font: 500 var(--fs-xs) var(--mono); }
.fs-none { margin: 0; padding: 12px 14px; color: var(--text-3); font-size: var(--fs-sm); }
.fs-drafts { margin: 0; padding: 0; list-style: none; }
.fs-drafts li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-base); }
.fs-drafts li:last-child { border-bottom: 0; }
.fs-draft-actions { display: flex; gap: 2px; margin-left: auto; }
.fs-table { table-layout: fixed; }
.fs-table td { overflow: hidden; text-overflow: ellipsis; }
.fs-table td strong { font-family: var(--mono); font-size: var(--fs-sm); font-weight: 500; }

.fs-wiz { max-width: 1280px; }
.fs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.fs-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.015em; }
.fs-head-actions { display: flex; gap: 8px; }
.fs-steps { display: flex; gap: 2px; margin: 0 0 16px; padding: 0; overflow-x: auto; list-style: none; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.fs-step { display: inline-flex; height: 36px; align-items: center; gap: 8px; margin-bottom: -1px; padding: 0 10px 0 2px; color: var(--text-3); background: transparent; border: 0; border-bottom: 2px solid transparent; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; transition: color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease); }
.fs-step:hover { color: var(--text); }
.fs-step.current { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.fs-dot { display: inline-grid; width: 18px; height: 18px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font: 500 10.5px/1 var(--mono); }
.fs-step.current .fs-dot { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.fs-step.done .fs-dot { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.fs-dot svg { width: 11px; height: 11px; stroke-width: 2.6; }

.fs-cols { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 36vw, 500px); gap: 16px; align-items: start; }
.fs-main { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.fs-main > .fs-plist { margin: 0 16px 16px; }
.fs-one .fs-main { max-width: 860px; }
.fs-side { position: sticky; top: calc(var(--topbar-h) + 16px); min-width: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.fs-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.fs-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fs-fields.fs-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fs-fields .wide { grid-column: 1 / -1; }
.fs-fields.fs-gap { margin-top: 14px; }
.fs-err { margin-top: 4px; color: var(--bad); font-size: var(--fs-xs); line-height: 1.4; }
.fs-err p, .fs-plist p { margin: 0 0 2px; }
.fs-grp .fs-err { margin-top: 6px; }
.fs-note { margin: 14px 0 0; }
.fs-empty { padding: 28px 0; color: var(--text-3); font-size: var(--fs-sm); }
.fs-color { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--text-3); font-size: var(--fs-sm); }
.fs-swatch { display: inline-block; width: 10px; height: 10px; margin-right: 7px; vertical-align: -1px; background: var(--mc-l, var(--text-3)); border-radius: 2px; }
.fs-color .fs-swatch { width: 12px; height: 12px; margin: 0; }
:root[data-theme="dark"] .fs-swatch { background: var(--mc-d, var(--text-3)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fs-swatch { background: var(--mc-d, var(--text-3)); } }
.fs-opt { margin-left: 6px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.fs-dens { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; margin-left: auto; color: var(--text-3); font-size: var(--fs-sm); }
.fs-dens input { width: 64px; height: var(--h-sm); text-align: right; }

.fs-gridwrap { margin: -2px; overflow-x: auto; padding: 2px; }
.fs-grid { display: grid; min-width: 340px; gap: 4px; }
.fs-gh, .fs-gr { display: grid; grid-template-columns: var(--fs-cols); align-items: center; gap: 6px; }
.fs-gh { color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.fs-gh .r { padding-right: 10px; text-align: right; }
.fs-gn { color: var(--text-3); font: 500 var(--fs-2xs) var(--mono); text-align: right; }
.fs-gi { height: 30px; }
.fs-gi.fs-num { text-align: right; }
.fs-gsel { min-width: 0; }
.fs-gsel select { height: 30px; }
.fs-gl { overflow: hidden; color: var(--text); font-size: var(--fs-base); text-overflow: ellipsis; white-space: nowrap; }
.fs-x { width: 30px; height: 30px; color: var(--text-3); }
.fs-x:hover { color: var(--bad); background: var(--bad-soft); }
.fs-gfoot { padding-top: 6px; }
.fs-gfoot .link-btn { padding-left: 0; }

.fs-more { border-top: 1px solid var(--line-soft); }
.fs-more summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; font-size: var(--fs-base); font-weight: 500; list-style: none; cursor: pointer; }
.fs-more summary::-webkit-details-marker { display: none; }
.fs-more summary::after { margin-left: 8px; color: var(--text-3); content: "+"; font: 400 16px/1 var(--mono); }
.fs-more[open] summary::after { content: "\2212"; }
.fs-more summary .muted { margin-left: auto; font-size: var(--fs-sm); font-weight: 400; }
.fs-more-body { padding: 0 16px 16px; }
.fs-slim { margin-top: 14px; }
.fs-cfg { margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.fs-cfg-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.fs-cfg-fields { flex: 1; }
.fs-cfg-head .link-btn { margin-bottom: 4px; }

.fs-sum { display: grid; margin: 0; }
.fs-sum > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-base); }
.fs-sum dt { color: var(--text-3); }
.fs-sum dd { margin: 0; color: var(--text); }
.fs-sum dd .mdl { margin-right: 7px; }
.fs-h3 { margin: 20px 0 6px; font-size: var(--fs-base); font-weight: 600; }
.fs-problems { margin: 0; padding: 0; list-style: none; }
.fs-problems li { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 7px 0; color: var(--bad); border-bottom: 1px solid var(--line-soft); font-size: var(--fs-base); }
.fs-ready { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; color: var(--ok); font-size: var(--fs-base); font-weight: 600; }
.fs-ready svg { width: 15px; height: 15px; }
.fs-rv-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; align-items: start; }
.fs-side .fuel-chart, .fs-rv-charts .fuel-chart { padding: 0; border: 0; box-shadow: none; }
.fs-side .nr-result-head { min-height: 0; margin: -2px 0 8px; padding: 0 0 8px; }
.fs-side .env-plot, .fs-rv-charts .env-plot { padding: 0; }

/* ================= Station references ================= */

.sr-page .page-head { margin-bottom: 10px; }
.sr-model { display: flex; align-items: center; gap: 8px; }
.sr-model select { width: auto; min-width: 230px; height: var(--h-md); }

#sr-body:has(.sr-layout) { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }

.sr-controls { display: flex; min-height: 44px; flex: 0 0 auto; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.sr-check { display: inline-flex; height: var(--h-sm); align-items: center; gap: 7px; padding: 0 4px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.sr-goto { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; }
.sr-goto label { color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.sr-goto input { width: 110px; height: var(--h-sm); text-align: right; }
.sr-goto .button { height: var(--h-sm); }

.sr-layout { display: grid; min-height: 0; flex: 1; grid-template-columns: minmax(0, 1fr) 248px; }

.sr-stage { position: relative; height: clamp(440px, 70vh, 860px); overflow: hidden; background: var(--drawing-bg); outline: 0; touch-action: none; user-select: none; }
.sr-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.sr-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.sr-canvas.moving { will-change: transform; }
.sr-canvas img { display: block; width: 100%; height: 100%; pointer-events: none; }
.sr-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: none; pointer-events: none; }

.sr-line { stroke-width: 1.4px; opacity: 0.75; }
.sr-line.hov { stroke-width: 2.4px; opacity: 1; }
.sr-line.on { stroke-width: 3px; opacity: 1; }
.sr-label { font-family: var(--font); font-weight: 600; opacity: 0.9; paint-order: stroke; stroke: rgba(255, 255, 255, 0.9); stroke-width: calc(3px * var(--inv, 1)); }
.sr-label.on { font-weight: 700; opacity: 1; }
.sr-ref { stroke: #b45309; stroke-width: 1.5px; stroke-dasharray: 6 4; }
.sr-reftext { fill: #b45309; font-family: var(--font); font-weight: 600; paint-order: stroke; stroke: rgba(255, 255, 255, 0.9); stroke-width: calc(3px * var(--inv, 1)); }
.sr-refnote { fill: #92400e; font-weight: 500; }
.sr-probe-line { stroke: #17181a; stroke-width: 1.2px; stroke-dasharray: 5 4; opacity: 0.7; }
.sr-probe { fill: #2b59c3; stroke: #fff; }
.sr-tag { fill: #17181a; }
.sr-tagtext { fill: #fff; font-family: var(--mono); font-weight: 500; }

.sr-scan { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-left: 1px solid rgba(23, 24, 26, 0.35); pointer-events: none; }
.sr-scan span { position: absolute; top: 8px; left: 0; padding: 3px 7px; color: #fff; background: rgba(23, 24, 26, 0.86); border-radius: var(--r-sm); font: 500 11px var(--mono); white-space: nowrap; }
.sr-scan span.on-line { background: #2b59c3; }
.sr-help { position: absolute; right: 10px; bottom: 8px; margin: 0; padding: 3px 8px; color: #5c6066; background: rgba(255, 255, 255, 0.9); border-radius: var(--r-sm); font-size: 10.5px; pointer-events: none; }

.sr-stage, .sr-stage.dragging, .sr-stage.is-3d, .sr-stage canvas { cursor: none; }
.sr-cursor { position: absolute; top: 0; left: 0; z-index: 6; width: 0; height: 0; pointer-events: none; will-change: transform; }
.sr-cursor svg { position: absolute; top: -14px; left: -14px; width: 28px; height: 28px; overflow: visible; fill: none; stroke: none; }
.sr-cursor .halo { stroke: rgba(255, 255, 255, 0.95); stroke-width: 4px; stroke-linecap: round; }
.sr-cursor .ink { stroke: #17181a; stroke-width: 1.6px; stroke-linecap: round; }

.sr-zoom { position: absolute; right: 10px; bottom: 10px; z-index: 7; display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #dcdcd8; border-radius: var(--r); box-shadow: 0 1px 3px rgba(17, 18, 20, 0.12); }
.sr-zoom button { display: grid; width: 28px; height: 28px; place-items: center; padding: 0; color: #3e4146; background: transparent; border: 0; font-size: 16px; line-height: 1; transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease); }
.sr-zoom button + button { border-top: 1px solid #ececea; }
.sr-zoom button:hover { color: #17181a; background: #f4f4f2; }
.sr-zoom button:active { background: #ebebe8; }
.sr-zoom svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sr-stage .sr-zoom, .sr-stage .sr-zoom button, .sr-stage .sr-3d-views, .sr-stage .sr-3d-views button { cursor: pointer; }

.sr-side { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); }
.sr-readout { flex: 0 0 auto; min-height: 132px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sr-empty { margin: 0; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.5; }
.sr-empty strong { display: block; color: var(--text-2); font-weight: 600; }
.sr-kicker { margin: 0; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.sr-big { margin: 3px 0 2px; color: var(--text); font: 600 22px/1.2 var(--mono); letter-spacing: -0.03em; }
.sr-est { margin: 0; color: var(--warn); font-size: var(--fs-xs); font-weight: 500; }
.sr-nears { display: grid; margin-top: 8px; border-top: 1px solid var(--line-soft); }
.sr-near { display: grid; height: 30px; grid-template-columns: 50px 1fr auto; align-items: center; gap: 8px; padding: 0; color: var(--text-3); background: none; border: 0; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-xs); text-align: left; }
.sr-near strong { color: var(--text); font: 500 var(--fs-sm) var(--mono); transition: color var(--t-hover) var(--ease); }
.sr-near em { color: var(--text-3); font-style: normal; font-variant-numeric: tabular-nums; }
.sr-near:hover strong { color: var(--accent-text); }

.sr-list-wrap { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.sr-list-wrap h2 { display: flex; justify-content: space-between; margin: 0; padding: 10px 14px 6px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.sr-list { min-height: 0; flex: 1; overflow-y: auto; margin: 0; padding: 0 6px 8px; list-style: none; scrollbar-width: thin; }
.sr-list button { position: relative; display: flex; width: 100%; height: 26px; align-items: center; padding: 0 8px 0 10px; color: var(--text-2); background: transparent; border: 0; border-radius: var(--r-sm); text-align: left; transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease); }
.sr-list button b { font: 500 var(--fs-sm) var(--mono); letter-spacing: -0.01em; }
.sr-list button:hover { color: var(--text); background: var(--row-hover); }
.sr-list button.active { color: var(--accent-text); background: var(--accent-soft); }
.sr-list button.active b { font-weight: 600; }
.sr-list button.active::before { position: absolute; top: 6px; bottom: 6px; left: 2px; width: 2px; background: var(--accent); border-radius: 1px; content: ""; }
.sr-ref-item { margin: 6px 0 0; padding: 8px 10px 0; color: var(--warn); border-top: 1px dashed var(--line); font-size: var(--fs-xs); }
.sr-ref-item > span { display: flex; justify-content: space-between; gap: 10px; }
.sr-ref-item > span > span { color: var(--text-3); }

.sr-stage.is-3d { background: #e9eef1; }
.sr-3d { position: absolute; inset: 0; }
.sr-3d-canvas { display: block; width: 100%; height: 100%; outline: 0; }
.sr-3d-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: #4b4f55; background: rgba(233, 238, 241, 0.94); font-size: var(--fs-sm); text-align: center; }
.sr-3d-loading strong { color: #17181a; font-size: var(--fs-base); font-weight: 600; }
.sr-3d-loading i { display: block; width: 200px; height: 3px; overflow: hidden; background: #d4d8db; border-radius: 2px; }
.sr-3d-loading i b { display: block; width: 0; height: 100%; background: #2b59c3; transition: width var(--t-menu) ease; }
.sr-3d-error { padding: 24px; color: var(--text-2); }
.sr-3d-views { position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 2px; padding: 2px; background: #fff; border: 1px solid #dcdcd8; border-radius: var(--r); box-shadow: 0 1px 3px rgba(17, 18, 20, 0.1); }
.sr-3d-views button { height: 24px; padding: 0 9px; color: #51545a; background: transparent; border: 0; border-radius: 4px; font-size: var(--fs-xs); font-weight: 500; transition: color var(--t-hover) var(--ease), background-color var(--t-hover) var(--ease); }
.sr-3d-views button:hover { color: #17181a; background: #f1f1ef; }
.sr-3d-views button.active { color: #17181a; background: #eef2fb; font-weight: 600; }
.sr-3d-labels { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.sr-fs { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: center; will-change: transform; }
.sr-fs-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 9px; white-space: nowrap; background: #fff; border: 1px solid #d3d7da; border-left: 3px solid var(--sr-accent, #d946ef); border-radius: var(--r-sm); box-shadow: 0 2px 8px rgba(20, 30, 35, 0.14); }
.sr-fs-chip b { color: #6b7076; font: 600 10px/1 var(--font); letter-spacing: 0.06em; }
.sr-fs-chip i { color: #17181a; font: 500 13px/1 var(--mono); font-style: normal; }
.sr-fs-stem { width: 1px; height: 18px; background: var(--sr-accent, #d946ef); }
.sr-fs-dot { width: 7px; height: 7px; margin-top: -1px; background: var(--sr-accent, #d946ef); border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.sr-3d-tag { position: absolute; top: 0; left: 0; padding: 5px 9px; color: #17181a; background: #fff; border: 1px solid #d3d7da; border-radius: var(--r-sm); box-shadow: 0 2px 8px rgba(20, 30, 35, 0.14); font: 500 12px/1 var(--mono); white-space: nowrap; pointer-events: none; }
.sr-credit { position: absolute; bottom: 8px; left: 10px; z-index: 2; max-width: max-content; margin: 0; padding: 3px 8px; color: #5c6066; background: rgba(255, 255, 255, 0.9); border-radius: var(--r-sm); font-size: 10px; line-height: 1.4; pointer-events: none; }
.sr-stage.is-3d .sr-help { display: none; }

/* ================= Lever arm ================= */

.la-page .nr-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.la-page .nr-form { max-width: none; }
.la-coords { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.la-coords .nr-in { text-align: right; }
.select-wrap + .la-coords, .select-wrap + .la-facts { margin-top: 12px; }
.la-facts { margin-top: 12px; }
.la-eq-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.la-pick-btn { height: var(--h-sm); padding: 0 10px; font-size: var(--fs-sm); }
.la-pick-btn.on { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.la-eqname { margin-top: 10px; }
.la-eqname .form-field { max-width: 260px; }

.la-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.la-result-head strong { font-size: var(--fs-md); font-weight: 600; }
.la-axes { display: grid; }
.la-axis { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.la-axis:first-child { border-top: 0; }
.la-axis-name { display: flex; flex-direction: column; color: var(--text-2); font: 600 var(--fs-base)/1.1 var(--mono); }
.la-axis-name small { color: var(--text-3); font: 500 var(--fs-2xs) var(--font); }
.la-datum-note { margin: -2px 0 4px; color: var(--text-3); font-size: var(--fs-xs); }
.la-val { color: var(--text); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.15; }
.la-val small { margin-left: 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0; }
.la-dir { min-width: 64px; color: var(--text); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.05em; text-align: right; }
.la-dir small { margin-left: 6px; padding: 1px 4px; color: var(--text-2); background: var(--surface-3); border-radius: var(--r-sm); font: 500 var(--fs-2xs) var(--mono); letter-spacing: 0; }
.la-actions { display: flex; justify-content: flex-end; padding-top: 6px; }

.la-viewer { width: 100%; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.la-tools { display: flex; min-height: 42px; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.la-tools-end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.la-tg { height: var(--h-sm); padding: 0 9px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; transition: color var(--t-hover) var(--ease), background-color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease); }
.la-tg:hover { color: var(--text); border-color: var(--line-hover); }
.la-tg.on { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.la-zoom { display: inline-flex; height: var(--h-sm); overflow: hidden; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); }
.la-zoom button { width: 26px; padding: 0; color: var(--text-2); background: transparent; border: 0; font-size: 14px; line-height: 1; transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease); }
.la-zoom button + button { border-left: 1px solid var(--line); }
.la-zoom button:hover { color: var(--text); background: var(--hover); }
.la-3d { position: relative; height: max(440px, calc(100dvh / var(--pz) - var(--topbar-h) - 152px)); overflow: hidden; background: var(--viewer-bg); }
.la-3d.picking .la-3d-canvas { cursor: crosshair; }
.la-3d-canvas { display: block; width: 100%; height: 100%; }
/* markers, legs and labels: drawn in screen space over the canvas, never in the way of the pointer */
.la-ov { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; overflow: visible; pointer-events: none; fill: none; stroke: none; }
.la-model { position: absolute; top: 8px; right: 10px; z-index: 3; margin: 0; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; pointer-events: none; }
.la-3d-empty { position: absolute; top: 8px; right: 0; left: 0; z-index: 3; margin: 0; color: var(--text-3); font-size: var(--fs-sm); text-align: center; pointer-events: none; }
.la-legend { position: absolute; bottom: 10px; left: 10px; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: calc(100% - 20px); padding: 5px 9px; color: var(--text-2); background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: var(--r); font-size: var(--fs-xs); pointer-events: none; }
.la-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.la-key i { display: inline-block; flex: 0 0 auto; }
.la-key.gps i, .la-key.eq i { width: 9px; height: 9px; border: 1.5px solid #16798a; border-radius: 50%; box-shadow: inset 0 0 0 2.5px #fff, inset 0 0 0 4.5px #16798a; }
.la-key.eq i { border-color: #b06f0a; box-shadow: inset 0 0 0 2.5px #fff, inset 0 0 0 4.5px #b06f0a; outline: 1px solid #b06f0a; outline-offset: 1.5px; }
.la-key.axis i, .la-key.line i { width: 14px; height: 2px; background: var(--c, #3a3f47); border-radius: 1px; }
.la-key.axis { color: var(--text); font-family: var(--mono); }
.la-pick-tag { position: absolute; top: 0; left: 0; z-index: 4; display: flex; align-items: baseline; gap: 5px; padding: 4px 8px; color: #17181a; white-space: nowrap; background: rgba(255, 255, 255, 0.96); border: 1px solid rgba(30, 34, 40, 0.16); border-radius: var(--r-sm); box-shadow: 0 2px 6px rgba(20, 30, 35, 0.14); font: 500 11.5px/1 var(--mono); pointer-events: none; }
.la-pick-tag b { margin-left: 6px; color: #6b7076; font: 600 9.5px/1 var(--font); letter-spacing: 0.06em; }
.la-pick-tag b:first-child { margin-left: 0; }

.la-edit { max-width: 1000px; }
.la-erows { display: grid; gap: 6px; margin-bottom: 10px; }
.la-erow { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(160px, 2fr) repeat(3, minmax(80px, 0.8fr)) 32px; align-items: center; gap: 8px; }
.la-erow-eq { grid-template-columns: minmax(180px, 2.4fr) repeat(3, minmax(80px, 0.8fr)) 32px; }
.la-edit-head { margin-bottom: 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }

/* ================= Sign in ================= */

body.locked .sidebar, body.locked .topbar, body.locked .sidebar-scrim { display: none; }
body.locked .main-shell { margin-left: 0; }
body.locked #app-view { display: grid; min-height: 100dvh; place-items: center; padding: 24px; }
.auth { width: 100%; }
.auth-card { width: min(100%, 360px); margin: 0 auto; padding: 24px 24px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); animation: dialog-in 260ms var(--ease) both; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-brand strong { font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.auth-card h1 { margin: 0 0 16px; font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.auth-card .form-field { margin-bottom: 12px; }
.auth-card .form-field input { height: var(--h-lg); }
.auth-submit { width: 100%; height: var(--h-lg); margin-top: 4px; }
.auth-actions { display: flex; gap: 8px; }
.auth-actions .auth-submit { width: auto; flex: 1; }
/* ================= Official documents =================
   The printed W&B report (page 1 and the CG chart), its sign-off controls and the Lever Arm report sheet.
   The server makes the PDF by printing the report page in a headless browser, so these rules ARE the document.
   They are carried over unchanged from the previous stylesheet; restyle the app around them, never these. */

.paper-stage { --paper-zoom: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; padding: clamp(12px, 3vw, 32px); background: var(--ink-150); border-radius: 10px; }
.paper {
  position: relative; zoom: var(--paper-zoom); width: 816px; min-height: 1056px; padding: 44px 46px 0; overflow: hidden;
  color: #000; background: #fff; box-shadow: 0 2px 4px rgba(18, 23, 27, 0.12), 0 18px 40px -18px rgba(18, 23, 27, 0.35);
  font: 13px/1.25 Arial, Helvetica, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.paper-title { margin: 0 0 26px; font-size: 20px; font-weight: 700; text-align: center; letter-spacing: 0; }

.paper-head { display: grid; grid-template-columns: 1.05fr 1fr; gap: 12px; margin-bottom: 22px; }
.paper-facts { margin: 0; }
.paper-facts div { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; align-items: baseline; min-height: 20px; }
.paper-facts.right div { grid-template-columns: 1fr minmax(0, 1fr); }
.paper-facts dt { font-weight: 700; text-align: right; }
.paper-facts dd { margin: 0; }
.paper-facts .reg dd { font-size: 19px; font-weight: 700; }
.paper-input { min-width: 0; padding: 0 2px; color: #000; background: transparent; border: 0; border-bottom: 1px dashed #9aa3ab; border-radius: 0; font: inherit; appearance: none; -webkit-appearance: none; }
.paper-input:hover, .paper-input:focus { background: #fff9d6; outline: none; }
input.paper-input[type="date"] { width: 140px; }

.paper-table { width: 100%; margin: 0; border-collapse: collapse; table-layout: fixed; }
.paper-table caption { padding: 5px; font-weight: 700; text-align: center; border: 1px solid #000; border-bottom: 0; }
.paper-table th, .paper-table td { height: 19px; padding: 1px 6px; border: 1px solid #000; font-weight: 400; text-align: center; font-variant-numeric: tabular-nums; overflow: hidden; }
.paper-table thead th { font-weight: 700; }
.paper-table:not(.adjust) th:nth-child(1) { width: 12%; }
.paper-table:not(.adjust) th:nth-child(2) { width: 19%; }
.paper-table:not(.adjust) th:nth-child(3) { width: 21%; }
.paper-table:not(.adjust) th:nth-child(4) { width: 17%; }
.paper-table:not(.adjust) th:nth-child(5), .paper-table:not(.adjust) th:nth-child(6) { width: 15.5%; }
.paper-table.adjust th:nth-child(1) { width: 48%; }
.paper-table .total td { font-weight: 700; text-align: left; }
.paper-table .total td:nth-child(n + 2) { text-align: center; }
.paper-table .total td[colspan] { text-align: left; }
.paper-table .hatch { background: repeating-linear-gradient(45deg, #666 0 1px, #fff 1px 3px); }
.paper-table .lab { text-align: left; }
.paper-table .lab small { color: #666; }
.paper-table .subhead th { font-weight: 700; }
.paper-table .blank td { height: 19px; }
.paper-note { margin: 20px 0 14px; font-size: 12.5px; text-align: center; }
.paper-table.adjust { margin-bottom: 0; }

.paper-result { display: grid; grid-template-columns: 1.1fr 1fr; gap: 26px; margin-top: 18px; align-items: start; }
.paper-sum { margin: 0; }
.paper-sum div { display: grid; grid-template-columns: 210px 1fr; gap: 10px; align-items: baseline; min-height: 21px; }
.paper-sum dt { font-weight: 700; text-align: right; }
.paper-sum .em dt { font-size: 14px; font-style: italic; }
.paper-sum dd { margin: 0; }
.limits { display: inline-block; min-width: 175px; padding: 1px 6px; text-align: center; }
.limits.yes { background: #92d050; }
.limits.no { color: #fff; background: #d9352b; font-weight: 700; }
.limits.na { background: #e3e6e9; }
.paper-notes { min-height: 92px; border: 1px solid #000; }
.paper-notes span { display: block; padding: 1px 4px; }
.paper-notes p { margin: 0; padding: 0 4px 4px; font-size: 11px; white-space: pre-wrap; }

.paper-sign { display: flex; justify-content: space-between; gap: 18px; margin-top: 22px; }
.sign-left { flex: 1; }
.sign-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.sign-row label { font-weight: 700; }
.sign-row .paper-input { flex: 0 1 190px; border-bottom: 2px solid #000; text-align: center; }
.sign-row #f-cert { min-width: 120px; }
.sign-dates { margin: 0; min-width: 240px; }
.sign-dates div { display: grid; grid-template-columns: 1fr 120px; gap: 12px; margin-bottom: 4px; }
.sign-dates dt { font-weight: 700; text-align: right; }
.sign-dates dd { margin: 0; text-align: right; border-bottom: 2px solid #000; }

.paper-foot { position: relative; height: 124px; margin: 14px -46px 0; }
.paper-foot address { position: absolute; top: 0; left: 46px; z-index: 1; font-style: normal; font-size: 12.5px; line-height: 1.55; letter-spacing: 0.02em; }
.dst-mark { position: absolute; inset: auto 0 0 0; width: 100%; height: 100%; }

/* CG chart page */
.paper-chart { padding: 60px 46px; }
.cg-chart { display: block; width: 100%; height: auto; font-family: Calibri, Arial, sans-serif; }
.cg-chart .frame { fill: #fff; stroke: #000; stroke-width: 1.5; }
.cg-chart .g-major { stroke: #333; stroke-width: 1; }
.cg-chart .g-minor { stroke: #9a9a9a; stroke-width: 0.5; }
.cg-chart .envelope { fill: rgba(91, 155, 213, 0.22); stroke: #5b9bd5; stroke-width: 4; stroke-linejoin: round; }
.cg-chart .plot-box { fill: none; stroke: #1f3f8f; stroke-width: 2.5; }
.cg-chart .c-title { font-size: 30px; font-weight: 700; }
.cg-chart .c-ref { font-size: 14px; font-weight: 700; }
.cg-chart .tick { font-size: 15px; font-weight: 700; }
.cg-chart .axis-title { font-size: 19px; font-weight: 700; }
.cg-chart .vlabel rect { fill: #bcd7f0; stroke: #2b2b2b; stroke-width: 1; }
.cg-chart .vlabel line { stroke: #2b2b2b; stroke-width: 1; }
.cg-chart .vlabel text { font-size: 14px; }
.cg-chart .pt .plabel { fill: #b5df9b; stroke: #2b2b2b; }
.cg-chart .pt .ptext { font-size: 15px; font-weight: 700; }
.cg-chart .pt .leader { stroke: #2b2b2b; stroke-width: 1.5; }
.cg-chart .pt .diamond { fill: #7cc24a; stroke: #2d6a1f; stroke-width: 1.5; }
.cg-chart .pt.out .plabel { fill: #f3b0ab; }
.cg-chart .pt.out .diamond { fill: #d9352b; stroke: #7d1610; }
.chart-missing { padding: 60px 0; color: #555; text-align: center; }

@page { size: Letter; margin: 0.3in; }

@media print {
  html, body { height: auto !important; background: #fff !important; }
  .sidebar, .sidebar-scrim, .topbar, .no-print, .toast-region, .modal-backdrop { display: none !important; }
  .main-shell { margin: 0 !important; min-height: 0 !important; }
  #app-view { min-height: 0 !important; padding: 0 !important; }
  .report-page { width: auto; }
  .paper-stage { display: block; padding: 0; background: none; border-radius: 0; }
  .paper { zoom: 1 !important; width: auto; min-height: 0; margin: 0; padding: 0.12in 0.1in 0; box-shadow: none; overflow: visible; }
  .paper-input { border-bottom-color: transparent; }
  input.paper-input[type="date"] { width: auto; }
  .paper-foot { margin-inline: -0.1in; }
  .paper-foot address { left: 0.1in; }
  .paper-chart { break-before: page; page-break-before: always; padding: 0.4in 0.1in; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Report fixes: fit page 1, keep global svg styles out of the chart and logo */
.cg-chart, .dst-mark { fill: currentColor; stroke: none; stroke-width: 1; }
.cg-chart text, .dst-mark text { stroke: none; }
.cg-chart .frame { fill: #fff; stroke: #000; stroke-width: 1.5; }
.cg-chart .g-major { stroke: #333; stroke-width: 1; }
.cg-chart .g-minor { stroke: #9a9a9a; stroke-width: 0.5; }
.cg-chart .envelope { fill: rgba(91, 155, 213, 0.22); stroke: #5b9bd5; stroke-width: 4; }
.cg-chart .plot-box { fill: none; stroke: #1f3f8f; stroke-width: 2.5; }
.cg-chart .vlabel rect { fill: #bcd7f0; stroke: #2b2b2b; stroke-width: 1; }
.cg-chart .vlabel line { stroke: #2b2b2b; stroke-width: 1; }
.cg-chart .pt .plabel { fill: #b5df9b; stroke: #2b2b2b; stroke-width: 1; }
.cg-chart .pt .leader { stroke: #2b2b2b; stroke-width: 1.5; }
.cg-chart .pt .diamond { fill: #7cc24a; stroke: #2d6a1f; stroke-width: 1.5; }
.cg-chart .pt.out .plabel { fill: #f3b0ab; }
.cg-chart .pt.out .diamond { fill: #d9352b; stroke: #7d1610; }

.paper-head { grid-template-columns: 1.3fr 1fr; }
.paper-facts div { grid-template-columns: 196px minmax(0, 1fr); }
.paper-facts.right div { grid-template-columns: 1fr minmax(0, 1fr); }
.paper-facts dd { white-space: nowrap; }
.paper-table .lab { white-space: nowrap; }

.paper-title { margin-bottom: 18px; }
.paper-head { margin-bottom: 14px; }
.paper-table th, .paper-table td { height: 18px; padding-block: 0; }
.paper-note { margin: 12px 0 10px; }
.paper-result { margin-top: 12px; }
.paper-sign { margin-top: 14px; }
.sign-row { margin-bottom: 12px; }
.paper-foot { height: 112px; margin-top: 8px; }

@media print {
  .skip-link { display: none !important; }
  .paper { padding-top: 0.05in; }
  input.paper-input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
  .paper-table th, .paper-table td { height: 17.5px; }
  .paper-foot { height: 90px; }
}
.paper-table.adjust th:nth-child(1) { width: auto; }

.sign-row.sig { align-items: flex-end; }
.sig-line { position: relative; flex: 0 1 320px; height: 18px; padding: 0; background: transparent; border: 0; border-bottom: 1.5px solid #000; border-radius: 0; cursor: pointer; transition: background-color 140ms ease; }
.sig-line:hover, .sig-line:focus-visible { background: #fff9d6; outline: none; }
.sig-img { position: absolute; bottom: 2px; left: 8px; max-width: calc(100% - 16px); max-height: 30px; object-fit: contain; pointer-events: none; }
.sig-hint { position: absolute; bottom: 2px; left: 4px; color: #8a949c; font-size: 11px; opacity: 0; transition: opacity 140ms ease; }
.sig-line:hover .sig-hint, .sig-line:focus-visible .sig-hint { opacity: 1; }

@media print { .sig-line { background: transparent !important; } .sign-modal { display: none !important; } }

/* Date field on the white report paper: in dark mode the browser draws its calendar icon white, invisible on white. */
:root[data-theme="dark"] .paper-input::-webkit-calendar-picker-indicator { filter: invert(1) brightness(0.3); opacity: 0.85; cursor: pointer; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .paper-input::-webkit-calendar-picker-indicator { filter: invert(1) brightness(0.3); opacity: 0.85; cursor: pointer; } }
.paper-input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Scale-cal date: typed as mm/dd/yyyy, with an optional calendar button */
.cal-field { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.cal-field .paper-input { width: 104px; font-variant-numeric: tabular-nums; }
.cal-field .paper-input.invalid { border-bottom: 1px solid #d9352b; background: #fdecea; }
.cal-btn { display: inline-grid; width: 22px; height: 22px; place-items: center; padding: 0; color: #4b555d; background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.cal-btn:hover, .cal-btn:focus-visible { color: #000; background: #fff9d6; outline: none; }
.cal-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cal-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }

.prep-name { min-width: 150px; padding: 0 6px; font-weight: 600; border-bottom: 2px solid #000; text-align: center; }
.prep-btn { padding: 2px 10px; color: #0b5548; background: #e3f3ec; border: 1px solid #9fd2c0; border-radius: 5px; font: 600 12px/1.5 Arial, Helvetica, sans-serif; cursor: pointer; }
.prep-btn:hover { background: #cfeadd; }
.prep-x { display: inline-grid; width: 20px; height: 20px; place-items: center; padding: 0; color: #66707a; background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.prep-x:hover { color: #000; background: #fff9d6; }
.prep-x svg { width: 13px; height: 13px; }

.paper-stage { align-items: flex-start; max-height: calc(100dvh / var(--pz) - var(--topbar-h) - 150px); overflow: auto; overscroll-behavior: contain; }
.paper { flex: 0 0 auto; margin-inline: auto; }
@media print { .paper-stage { max-height: none; overflow: visible; } }

/* Admin: prepare / sign on someone's behalf, set the sign-off date */
.prep-admin { display: inline-flex; align-items: center; gap: 6px; }
.prep-admin select { height: 26px; max-width: 190px; padding: 0 6px; color: #111; background: #fff; border: 1px solid #9fd2c0; border-radius: 5px; font: 600 12px Arial, Helvetica, sans-serif; }
.sign-date-input { margin-left: 8px; height: 24px; padding: 0 4px; color: #111; background: #fff; border: 1px solid #c9ced3; border-radius: 4px; font: 12px Arial, Helvetica, sans-serif; }

.la-eqname { margin-top: 10px; }
.la-eqname .form-field { max-width: 260px; }

/* This later @page wins over the 0.3in one above, so it sets the printed W&B report's page margins; the PDFs were
   always made with it. (The Lever Arm report now prints from its own document with its own stylesheet.) */
@media print {
  @page { size: Letter; margin: 0.5in; }
}

/* ================= Document view (the printable report, on screen) =================
   Screen only, so none of this can reach the printed page or the PDF. */

@media screen {
  .report-page .report-toolbar { display: flex; min-height: var(--h-lg); align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
  .report-toolbar-title { min-width: 0; flex: 1; }
  .report-toolbar-title h1 { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.015em; }
  .report-toolbar-title h1 .code-id { font-size: var(--fs-lg); font-weight: 600; }
  .report-toolbar-title p { margin: 1px 0 0; overflow: hidden; color: var(--text-3); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
  .report-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

  .zoom-ctl { display: inline-flex; height: var(--h-md); align-items: stretch; overflow: hidden; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow-1); }
  .zoom-ctl button { min-width: 30px; padding: 0 8px; color: var(--text-2); background: transparent; border: 0; font-size: 15px; line-height: 1; transition: background-color var(--t-hover) var(--ease), color var(--t-hover) var(--ease); }
  .zoom-ctl button + button { border-left: 1px solid var(--line); }
  .zoom-ctl button:hover { color: var(--text); background: var(--surface-2); }
  .zoom-ctl #zoom-level { min-width: 54px; font: 500 var(--fs-xs) var(--mono); }

  .report-page .paper-stage { gap: 20px; max-height: calc(100dvh / var(--pz) - var(--topbar-h) - 100px); padding: 20px; background: var(--doc-stage); border: 1px solid var(--line); border-radius: var(--r-lg); scrollbar-width: thin; }
  .report-page .paper { box-shadow: 0 1px 2px rgba(17, 18, 20, 0.12), 0 12px 32px -14px rgba(17, 18, 20, 0.32); }
}

/* ================= CG envelope in the app =================
   The same SVG as the printed chart (same geometry and plotted point), recoloured for the screen.
   Scoped to .env-plot so the printed chart keeps its own colours. */

.env-plot .cg-chart { font-family: var(--font); }
.env-plot .cg-chart text { fill: var(--text); }
.env-plot .cg-chart .frame { fill: var(--surface); stroke: none; }
.env-plot .cg-chart .g-major { stroke: var(--chart-major); stroke-width: 1; }
.env-plot .cg-chart .g-minor { stroke: var(--chart-minor); stroke-width: 1; }
.env-plot .cg-chart .plot-box { fill: none; stroke: var(--chart-axis); stroke-width: 1.5; }
.env-plot .cg-chart .envelope { fill: var(--chart-env); stroke: var(--accent); stroke-width: 3; }
.env-plot .cg-chart .c-title { font-size: 27px; font-weight: 650; letter-spacing: -0.01em; }
.env-plot .cg-chart .c-ref { fill: var(--text-3); font-size: 17px; font-weight: 500; }
.env-plot .cg-chart .tick { fill: var(--text-2); font-family: var(--mono); font-size: 14.5px; font-weight: 500; }
.env-plot .cg-chart .axis-title { fill: var(--text-2); font-size: 16px; font-weight: 600; }
.env-plot .cg-chart .vlabel rect { fill: var(--surface); stroke: var(--accent-line); stroke-width: 1.5; }
.env-plot .cg-chart .vlabel line { stroke: var(--accent-line); stroke-width: 1.5; }
.env-plot .cg-chart .vlabel text { fill: var(--accent-text); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.env-plot .cg-chart .pt .plabel { fill: var(--surface); stroke: var(--ok); stroke-width: 2; }
.env-plot .cg-chart .pt .ptext { fill: var(--ok); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.env-plot .cg-chart .pt .leader { stroke: var(--ok); stroke-width: 1.5; }
.env-plot .cg-chart .pt .diamond { fill: var(--ok); stroke: var(--surface); stroke-width: 2; }
.env-plot .cg-chart .pt.out .plabel { fill: var(--surface); stroke: var(--bad); }
.env-plot .cg-chart .pt.out .ptext { fill: var(--bad); }
.env-plot .cg-chart .pt.out .leader { stroke: var(--bad); }
.env-plot .cg-chart .pt.out .diamond { fill: var(--bad); stroke: var(--surface); }

/* ================= Screens that fit the window =================
   Station References, Fuel data and the document view take the height that is left, so the page never scrolls. */

@media (min-width: 1101px) {
  #app-view:has(.sr-page), #app-view:has(.admin-page[data-section="fuel"]) { display: flex; height: calc(100dvh / var(--pz) - var(--topbar-h)); min-height: 0; flex-direction: column; overflow: hidden; padding-top: 16px; padding-bottom: 16px; }
  .sr-page { display: flex; width: 100%; min-height: 0; flex: 1; flex-direction: column; }
  .sr-page .page-head { flex: 0 0 auto; }
  .sr-page > #sr-body { min-height: 0; flex: 1; }
  .sr-page .sr-layout { min-height: 0; flex: 1; }
  .sr-page .sr-stage { height: 100%; min-height: 0; }

  /* record lists (Reports, Fleet, Historical, Users, Audit log): the panel takes the rest of the window and the
     table scrolls inside it, so the toolbar, column headings and model groups stay in view */
  #app-view:has(.page-shell.fill) { display: flex; height: calc(100dvh / var(--pz) - var(--topbar-h)); min-height: 0; flex-direction: column; overflow: hidden; padding-bottom: 16px; }
  .page-shell.fill, .page-shell.fill > #admin-body { display: flex; width: 100%; min-height: 0; flex: 1; flex-direction: column; }
  .page-shell.fill .page-head { flex: 0 0 auto; }
  .page-shell.fill .panel { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
  .page-shell.fill .toolbar { flex: 0 0 auto; }
  .page-shell.fill #list-results, .page-shell.fill #ah-list, .page-shell.fill #aa-list { display: flex; min-height: 0; flex: 1; flex-direction: column; }
  .page-shell.fill .data-table-wrap { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; }
  .page-shell.fill .data-table thead th { position: sticky; top: 0; z-index: 2; }
  .page-shell.fill .data-table tr.group-row td { position: sticky; top: 32px; z-index: 1; }
  .page-shell.fill .toolbar { overflow: visible; }

  .admin-page[data-section="fuel"] { display: flex; width: 100%; min-height: 0; flex: 1; flex-direction: column; }
  .admin-page[data-section="fuel"] .page-head { flex: 0 0 auto; }
  .admin-page[data-section="fuel"] #admin-body { display: flex; min-height: 0; flex: 1; flex-direction: column; }
  .admin-page[data-section="fuel"] .fuel-head { flex: 0 0 auto; }
  .admin-page[data-section="fuel"] .fuel-grid { min-height: 0; flex: 1; align-items: stretch; }
  .admin-page[data-section="fuel"] .fuel-table { height: 100%; max-height: none; min-height: 0; }
  .admin-page[data-section="fuel"] .fuel-chart { height: 100%; min-height: 0; }
  .admin-page[data-section="fuel"] .fuel-chart svg { width: 100%; height: 100%; }
}

/* ================= Responsive ================= */

/* Large monitors: scale the interface a little instead of leaving a small island */
@media (min-width: 2400px) { body { zoom: 1.2; } :root { --pz: 1.2; } }
@media (min-width: 3200px) { body { zoom: 1.6; } :root { --pz: 1.6; } }
body, .app-frame, .main-shell { min-height: calc(100dvh / var(--pz)); }

@media (max-width: 1500px) {
  .data-table .hide-lg { display: none; }
}

@media (max-width: 1100px) {
  .rd-grid { grid-template-columns: minmax(0, 1fr); }
  .rd-side { position: static; grid-template-columns: minmax(0, 1fr); }
  .rd-side .env-plot { max-width: 720px; }
}

@media (max-width: 1100px) {
  :root { --gutter: 20px; }
  .ov-grid, .nr-grid, .la-page .nr-grid, .fs-cols, .fuel-grid, .fs-rv-charts { grid-template-columns: minmax(0, 1fr); }
  .nr-live, .fs-side, .rd-side { position: static; }
  .sr-layout { grid-template-columns: minmax(0, 1fr); }
  .sr-side { border-top: 1px solid var(--line); border-left: 0; }
  .sr-stage { height: clamp(340px, 58vh, 620px); }
  .sr-list { max-height: 240px; }
  .sr-goto { margin-left: 0; }
  .la-3d { height: 420px; }
  .data-table .hide-md { display: none; }
}

/* Narrow windows: the sidebar slides over the page and the Menu button opens it */
@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .sidebar { transform: translateX(-100%); }
  .main-shell { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-dialog); }
  body.nav-open .sidebar-scrim { position: fixed; inset: 0; z-index: 45; display: block; background: var(--overlay); border: 0; animation: fade-in var(--t-menu) ease both; }
  .sidebar-collapse { display: none; }
  .search-shell kbd { display: none; }
  .admin-pair, .fs-fields.fs-six { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .search-shell { width: auto; flex: 1; }
  .crumbs { display: none; }
  .page-head h1, .rd-title h1 { font-size: 20px; }
  .measures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .measure:nth-child(3n) { border-right: 1px solid var(--line-soft); }
  .measure:nth-child(2n) { border-right: 0; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > div { grid-template-columns: 120px minmax(0, 1fr); }
  .kv > div:nth-last-child(-n + 2):nth-child(odd) { border-bottom: 1px solid var(--line-soft); }
  .data-table .hide-sm { display: none; }
  .nr-row { grid-template-columns: 1fr 1fr; }
  .nr-row > strong, .nr-head span:first-child { grid-column: 1 / -1; }
  .nr-adj { grid-template-columns: 1fr 1fr; }
  .nr-adj-head { display: none; }
  .nr-stats { grid-template-columns: minmax(0, 1fr); }
  .nr-stats > div { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .acp-opt { grid-template-columns: 96px minmax(0, 1fr); }
  .acp-opt .g { display: none; }
  .la-erow, .la-erow-eq { grid-template-columns: 1fr 1fr 1fr 32px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
  .la-erow .la-text { grid-column: 1 / -1; }
  .la-edit-head { display: none; }
  .fs-step:not(.current) .fs-lab { display: none; }
  .fs-sum > div { grid-template-columns: 120px minmax(0, 1fr); }
  .fs-fields { grid-template-columns: minmax(0, 1fr); }
  .filter-panel { position: fixed; top: auto; right: 16px; bottom: 16px; left: 16px; width: auto; max-height: 70dvh; overflow-y: auto; }
  .report-toolbar-actions { width: 100%; }
  .sign-card footer { flex-wrap: wrap; }
  .sign-spacer { display: none; }
}

/* Touch: the same layout with larger targets */
@media (pointer: coarse) {
  .button, .icon-button, .nav-item, .select-wrap select, .inline-search, .picker-search, .form-field input, .form-field select, .nr-in, .toggle-chip, .filter-btn { min-height: 40px; }
  .data-table tr.clickable td, .acp-opt, .sr-list button, .sr-near { min-height: 40px; }
  .sr-stage, .sr-stage canvas { cursor: auto; }
}
@media (hover: none) { .data-table tbody tr:hover td { background: transparent; } }

/* ================= Motion ================= */

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes pop-up { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* ================= Print (app pages) =================
   The report document's own print rules are in the official documents section above. */

/* No motion when printing or in the server's PDF render: headless Chrome's --print-to-pdf can print mid-animation,
   and an entrance animation starting at opacity 0 printed blank pages (BC06 and others) before this rule. */
html.pdf-mode *, html.pdf-mode *::before, html.pdf-mode *::after { animation: none !important; transition: none !important; }

@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sidebar, .sidebar-scrim, .topbar, .no-print, .toast-region { display: none !important; }
  .main-shell { margin: 0 !important; }
  .rd-head .page-actions, .back-link { display: none !important; }
  .panel { box-shadow: none; break-inside: avoid; }
}

/* ================= Customer W&B =================
   The form reuses New report's sections; the document is its own sheet (.cw-paper) next to the W&B report rules,
   which it does not change. */

.cw-fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.cw-wide { grid-column: 1 / -1; }
.cw-seg { margin-bottom: 12px; }
.cw-limits { margin-top: 12px; }
.cw-confirm { align-items: flex-start; margin: 12px 0 4px; color: var(--text); line-height: 1.45; }
.cw-confirm input { margin-top: 3px; }
.cw-ref-facts { flex-wrap: wrap; gap: 8px 24px; }
.cw-ref-facts dd { font-size: var(--fs-sm); font-weight: 500; }
.cw-tally { flex-wrap: wrap; gap: 6px 24px; margin: 0; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
.cw-tally dd { font-size: var(--fs-sm); font-weight: 500; }
#cw-result .nr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#cw-result .nr-stats > div { border-bottom: 1px solid var(--line-soft); }
#cw-result .nr-stats > div:nth-child(2n) { border-right: 0; }
.cw-env-empty { min-height: 220px; }
.data-table.eng tfoot td { font-weight: 600; border-top: 1px solid var(--line); }

.cw-paper { min-height: 0; padding-bottom: 28px; }
.cw-paper .paper-title { margin-bottom: 6px; }
.cw-status { margin: 0 0 14px; padding: 4px 8px; font-size: 11.5px; text-align: center; border: 1px solid #000; }
.cw-paper .paper-facts small { font-size: 11px; }
.cw-table { margin-bottom: 10px; }
.cw-table th:nth-child(1) { width: 46% !important; }
.cw-table th:nth-child(n + 2) { width: 18% !important; }
.cw-table .lab { white-space: normal; }
.cw-mac { margin: 0 0 8px; padding: 4px 6px; border: 1px solid #000; }
.cw-mac small { font-size: 11px; }
.cw-ref { margin-top: 12px; }
.cw-ref div { grid-template-columns: 210px 1fr; }
.cw-ref dd { font-size: 12px; }
.cw-foot { margin: 18px 0 0; color: #444; font-size: 11px; text-align: center; }
@media print { .cw-paper { padding-bottom: 0; } }
.cw-paper .sign-row label { white-space: nowrap; }
.cw-item .nr-in[data-item="description"] { text-align: left; }

/* ================= Temporary W&B entry: direction per change, result workspace, save bar ================= */

.nr-adj.signed, .nr-adj-head.signed { grid-template-columns: minmax(140px, 2fr) 104px repeat(2, minmax(0, 1fr)) 112px 32px; }
.nr-adj-head.signed span:nth-child(2) { text-align: left; }
.nr-adj-head.signed span:nth-child(n + 3):nth-child(-n + 5) { text-align: right; }
.nr-adj.signed .select-wrap select { width: 100%; text-align: left; }
.nr-dir.rem { color: var(--bad); font-weight: 600; }

.nr-ws { padding: 6px 14px 8px; border-bottom: 1px solid var(--line-soft); }
.nr-ws-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.nr-ws-table th, .nr-ws-table td { padding: 4px 0 4px 10px; text-align: right; white-space: nowrap; }
.nr-ws-table th:first-child { padding-left: 0; text-align: left; }
.nr-ws-table thead th { color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.nr-ws-table small { margin-left: 3px; color: var(--text-3); font-size: var(--fs-2xs); font-weight: 400; }
.nr-ws-table tbody th { color: var(--text-2); font-weight: 500; }
.nr-ws-table tr.total th, .nr-ws-table tr.total td { font-weight: 600; color: var(--text); border-top: 1px solid var(--line); }
.nr-ws-table tr.delta th, .nr-ws-table tr.delta td { color: var(--text-3); }

.nr-compact { padding-block: 10px 12px; }
.nr-compact h2 { margin-bottom: 6px; }
.nr-details { grid-template-columns: 170px minmax(0, 1fr); align-items: start; }
.nr-details .nr-notes { grid-column: auto; }
.nr-details textarea { min-height: 0; }
.nr-prep-line { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0; }
.nr-prep-line > div { display: flex; align-items: baseline; gap: 8px; }
.nr-prep-line dt { color: var(--text-3); font-size: var(--fs-xs); }
.nr-prep-line dd { margin: 0; font-size: var(--fs-base); }

.nr-problems { margin: 0; padding: 8px 16px 12px 34px; background: var(--warn-soft); border-top: 1px solid var(--warn-line); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: var(--fs-sm); }
.nr-problems li { margin: 2px 0; color: var(--warn); }
.nr-problems .link-btn { color: inherit; text-align: left; text-decoration: underline; }
.nr-actions:has(+ .nr-problems:not([hidden])) { border-radius: 0; }

@media (max-width: 760px) {
  .nr-adj.signed { grid-template-columns: 1fr 1fr; }
  .nr-adj.signed .nr-in[data-adj="item"] { grid-column: 1 / -1; }
  .nr-details { grid-template-columns: minmax(0, 1fr); }
  .nr-actions { flex-wrap: wrap; }
}
.nr-discard-btn:hover { color: var(--bad); border-color: var(--bad-line, var(--bad)); background: var(--bad-soft); }

/* Starting point: the selector and the chosen record's summary are one block; details open on request */
.nr-base-group.has-summary .select-wrap select { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.nr-base-group .nr-base { margin-top: -1px; padding: 8px 12px; border-top-left-radius: 0; border-top-right-radius: 0; }
.nr-base-group .nr-base .nr-facts { margin: 0; gap: 4px 22px; }
.nr-base-group .nr-base .nr-facts dd { font-size: var(--fs-base); font-weight: 600; }
.nr-base-line { margin: 6px 0 0; color: var(--text-2); font-size: var(--fs-sm); }
.nr-base-line.warn { color: var(--warn); }
.nr-base-more { margin-top: 6px; font-size: var(--fs-sm); }
.nr-base-more > summary { display: inline-block; color: var(--accent); font-size: var(--fs-xs); font-weight: 500; cursor: pointer; list-style: none; }
.nr-base-more > summary::-webkit-details-marker { display: none; }
.nr-base-more > summary:hover { text-decoration: underline; }
.nr-base-more[open] > summary { margin-bottom: 6px; }
.nr-base-more[open] > summary::after { content: " (hide)"; color: var(--text-3); }
.nr-base-kv { display: grid; gap: 4px; margin: 0; }
.nr-base-kv > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.nr-base-kv dt { color: var(--text-3); font-size: var(--fs-xs); }
.nr-base-kv dd { min-width: 0; margin: 0; }
.nr-base-kv .link-btn + .link-btn { margin-left: 14px; }
.nr-base-kv .nr-base-notes { display: block; margin: 0; }
.nr-base-hist { margin: 0; padding: 0; list-style: none; }
.nr-base-hist li + li { padding-left: 12px; }
@media (max-width: 760px) { .nr-base-kv > div { grid-template-columns: minmax(0, 1fr); gap: 0; } }
.nr-prep-line { align-items: center; }
.nr-prep-pick select { width: auto; min-width: 200px; height: var(--h-sm); font-size: var(--fs-sm); }

/* ================= Reports filter: aircraft tree, draft panel, active chips ================= */

.filter-panel.fp { display: flex; width: 360px; max-height: min(640px, calc(100dvh - 160px)); flex-direction: column; padding: 0; }
.fp-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: 10px 12px; overscroll-behavior: contain; }
.fp .filter-foot { flex: 0 0 auto; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; }
.fp .filter-foot [data-freset] { margin-right: auto; }
.fp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fp-head p { margin: 0 0 5px; }
.fp-count { color: var(--text-2); font-size: var(--fs-xs); }
.fp-tools { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.fp-search { min-width: 0; flex: 1; height: var(--h-sm); }
.fp-tree { max-height: 300px; overflow-y: auto; margin: 0 0 4px; padding: 2px 0; list-style: none; border: 1px solid var(--line-soft); border-radius: var(--r); }
.fp-tree ul { margin: 0; padding: 0 0 4px 30px; list-style: none; }
.fp-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 2px; padding: 0 8px 0 2px; }
.fp-row label, .fp-tails label { display: flex; min-width: 0; min-height: 26px; align-items: center; gap: 6px; font-size: var(--fs-sm); cursor: pointer; }
.fp-tails label { padding-right: 8px; }
.fp-name { white-space: nowrap; }
.fp-row .fp-name { font-weight: 600; }
.fp-sub { min-width: 0; overflow: hidden; color: var(--text-3); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.fp-n { margin-left: auto; color: var(--text-3); font: 500 var(--fs-2xs) var(--mono); }
.fp-fold { display: inline-grid; width: 22px; height: 22px; place-items: center; padding: 0; color: var(--text-3); background: transparent; border: 0; border-radius: var(--r-sm); }
.fp-fold:hover { color: var(--text); background: var(--row-hover); }
.fp-fold svg { width: 12px; height: 12px; transform: rotate(-90deg); transition: transform var(--t-hover) var(--ease); }
.fp-fold[aria-expanded="true"] svg { transform: none; }
.fp-empty { padding: 12px; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }
.fp input[type="checkbox"] { flex: 0 0 auto; accent-color: var(--accent); }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 12px; border-bottom: 1px solid var(--line-soft); }
.active-filters[hidden] { display: none; }
@media (max-width: 700px) { .filter-panel.fp { width: auto; max-height: 75dvh; } .fp-tree { max-height: none; } }

.la-pick-list + .la-coords, .la-pick-list + .la-facts { margin-top: 10px; }

/* Change lists: headings line up with the text inside the boxes below them, and read as headings */
.nr-adj-head { margin-bottom: 6px; color: var(--text); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.01em; }
.nr-adj-head span { padding: 0 9px; }
.nr-adj-head span:last-child { padding: 0; }
.nr-adj .nr-in[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.nr-adj .nr-in[type="number"]::-webkit-outer-spin-button, .nr-adj .nr-in[type="number"]::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.nr-adj.signed .select-wrap select { padding-left: 9px; }

/* Temporary W&B document: same sheet as the W&B report */
.tw-paper .paper-result { margin-top: 14px; }
.tw-paper .sign-row .prep-name { min-width: 160px; }
.tw-sig { display: inline-block; flex: 0 1 320px; height: 18px; border-bottom: 1.5px solid #000; cursor: default; }
.nr-adj-head span { white-space: nowrap; }
.tw-paper .sign-row label { white-space: nowrap; }
.tw-paper .paper-table thead th { font-size: 12px; white-space: nowrap; }
.la-3d-error { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; padding: 24px; color: var(--text-2); font-size: var(--fs-sm); text-align: center; }
.la-3d-error strong { color: var(--text); }
.la-3d-error p { max-width: 420px; margin: 0; line-height: 1.5; }
.la-3d-error .button { justify-self: center; }

/* One revision table on the printed temporary and customer W&B forms: section heading rows, subtotals, the result */
.rev-table { margin-bottom: 0; }
.rev-table thead th { font-size: 12px; white-space: nowrap; }
.paper-table.rev-table thead th:nth-child(1) { width: 46%; }
.paper-table.rev-table thead th:nth-child(n + 2) { width: 18%; }
.rev-table .lab { white-space: normal; }
.rev-table tr.sec th { padding: 1px 6px; font-weight: 700; text-align: left; background: #e8ebee; }
.rev-table tr.subtotal td { font-weight: 700; }
.rev-table tr.subtotal td.lab { font-style: italic; }
.rev-table tr.total td { font-size: 13.5px; border-top: 2px solid #000; }
.rev-table tr.total td.lab { text-align: left; }

/* Printed temporary and customer W&B forms: Lever Arm report style heading, and zero-margin pages with the margin
   inside the sheet, so the browser has no margin to print its own URL, title and date into. */
.doc-head { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 0 18px; margin: 0 0 18px; padding-bottom: 9px; border-bottom: 1.7px solid #111; }
.doc-head img { display: block; width: auto; height: 35px; }
.doc-head .kicker { margin: 0 0 2px; color: #555; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.doc-head h1.paper-title { margin: 0; font-size: 20px; font-weight: 700; text-align: left; letter-spacing: -0.01em; }
.cw-paper .doc-head + .cw-status { margin-top: 0; }
@page bare { size: Letter; margin: 0; }
@media print {
  /* the whole document uses the bare page; naming only the sheet put a blank default page in front of it */
  body:has(.doc-bare) { page: bare; }
  .paper.doc-bare { padding: 0.5in 0.6in 0.45in !important; }
  .paper.paper-chart.doc-bare { padding-top: 0.75in !important; }
}
