/* DASH platform pages. Colours and type follow the design canvas of
   2026-11-02 (Aliova design system): black navigation, white cards, blue
   actions, Avenir Next. */

:root {
  --black: #000000;
  --ink: #000000;
  --ink-2: #2E2E2E;
  --ink-3: #4A4A4A;
  --ink-4: #6B6B6B;
  --ink-5: #8E8E8E;
  --line: #E6E6E6;
  --line-2: #D8D8D8;
  --soft: #F0F0F0;
  --page: #F7F7F7;
  --card: #FFFFFF;
  --blue: #0476E8;
  --blue-hover: #0363C7;
  --blue-dark: #024FA0;
  --ok-bg: #C8E6E1; --ok: #186A6C;
  --warn-bg: #F6E5B6; --warn: #7A5A00;
  --bad-bg: #E6CCE0; --bad: #912E56;
  --info-bg: #BAD8ED; --info: #04487C;
  --yellow: #FBC740;
  --teal: #66D2D6;
  --pink: #E56997;
  --shadow: 0 4px 10px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --font: 'Avenir Next LT Pro', 'Avenir Next', 'Segoe UI', Calibri, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
button { font-family: inherit; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
.noscript { padding: 24px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { flex: 0 0 248px; background: var(--black); color: #FFFFFF; padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-body { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px; text-decoration: none; color: #FFFFFF; }
.brand:hover { text-decoration: none; color: #FFFFFF; }
.brand-mark { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.brand-name { font-size: 13px; font-weight: 700; padding-left: 12px; border-left: 1px solid var(--ink-3); line-height: 20px; }
.menu-btn { display: none; width: 40px; height: 40px; border: 1px solid #2E2E2E; border-radius: 6px; background: #1A1A1A; color: #FFFFFF; cursor: pointer; align-items: center; justify-content: center; }
.jurisdiction { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 6px; border: 1px solid #2E2E2E; background: #1A1A1A; }
.jurisdiction-label { font-size: 11px; color: #B8B8B8; }
.jurisdiction-name { font-size: 14px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 6px; color: #B8B8B8; font-size: 14px; font-weight: 600; text-decoration: none; }
.nav a:hover { background: #1A1A1A; color: #FFFFFF; text-decoration: none; }
.nav a[aria-current="page"] { background: #2E2E2E; color: #FFFFFF; }
.nav .grp { display: block; padding: 18px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-5); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.status-box { padding: 12px; border-radius: 6px; background: #1A1A1A; display: flex; flex-direction: column; gap: 4px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-5); flex: none; }
.dot.ok { background: var(--teal); }
.dot.bad { background: var(--pink); }
.status-version { font-size: 12px; color: #B8B8B8; }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--yellow); color: #000000; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.who-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.who-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.who-org { font-size: 12px; color: #B8B8B8; }

.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; min-height: 64px; }
.crumbs { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-4); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
main { flex: 1; display: flex; flex-direction: column; }

/* Shared pieces */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; text-decoration: none; border: 1px solid transparent; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--blue); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); color: #FFFFFF; }
.btn-secondary { background: #FFFFFF; color: #000000; border-color: var(--line-2); }
.btn-secondary:hover:not(:disabled) { background: var(--page); color: #000000; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 6px; border: none; background: transparent; color: var(--ink-3); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--soft); color: #000000; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; line-height: 1.2; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-ok { background: var(--ok-bg); color: var(--ok); }
.p-warn { background: var(--warn-bg); color: var(--warn); }
.p-bad { background: var(--bad-bg); color: var(--bad); }
.p-info { background: var(--info-bg); color: var(--info); }
.p-neutral { background: #FFFFFF; color: var(--ink-2); border: 1px solid var(--line-2); }
.mono { font-family: var(--mono); font-size: 13px; }
.input { font-family: inherit; font-size: 14px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--ink-5); border-radius: 6px; background: #FFFFFF; color: #000000; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(4,118,232,0.28); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); }
.muted { color: var(--ink-4); }
.small { font-size: 12px; line-height: 1.5; }
.note { margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--page); font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.note.warn { background: #FBF4DF; color: var(--warn); }
.page { padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 24px; max-width: 1200px; width: 100%; }
.page-head h1 { font-size: 28px; font-weight: 700; }
.page-head p { margin: 6px 0 0; color: var(--ink-3); max-width: 760px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 20px; align-items: start; }
.card-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { font-size: 17px; font-weight: 700; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--soft); }
.row:last-child { border-bottom: none; }
.row > :first-child { min-width: 0; }
.row > :last-child { text-align: right; flex: none; max-width: 60%; }
.row > :only-child { text-align: left; flex: 1; max-width: none; }
.copy-field { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--page); }
.copy-field .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-4); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--soft); vertical-align: top; }
tr:last-child td { border-bottom: none; }
/* People (#429): a feature switch per person. */
.switch-cell { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: left 0.15s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { left: 18px; }
.switch:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(4,118,232,0.28); }
.switch:disabled { opacity: 0.5; cursor: wait; }
table.people td { vertical-align: middle; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #000000; color: #FFFFFF; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; z-index: 50; box-shadow: var(--shadow); }

/* Map page */
.map-page { padding: 20px 24px 24px; display: flex; flex-wrap: wrap; gap: 20px; flex: 1; align-items: stretch; }
.map-wrap { flex: 999 1 520px; min-width: 0; position: relative; min-height: 640px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
#map { position: absolute; inset: 0; }
.float { position: absolute; background: #FFFFFF; border-radius: 10px; box-shadow: var(--shadow); z-index: 2; }
.search { z-index: 3; top: 16px; left: 16px; width: 360px; max-width: calc(100% - 88px); padding: 6px 8px; display: flex; flex-direction: column; }
.search-row { display: flex; gap: 6px; align-items: center; }
.search input::-webkit-search-cancel-button { display: none; }
.search input { flex: 1; min-width: 0; border: none; font-family: inherit; font-size: 15px; padding: 8px 4px; outline: none; background: transparent; }
.search-results { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; }
.search-results button { text-align: left; border: none; background: transparent; padding: 8px 6px; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.search-results button:hover, .search-results button:focus { background: var(--page); outline: none; }
.search-msg { padding: 8px 6px; font-size: 13px; color: var(--ink-3); }
.map-ctrls { top: 16px; right: 16px; display: flex; flex-direction: column; gap: 10px; background: transparent; box-shadow: none; }
.ctrl-group { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); background: #FFFFFF; }
.ctrl-group span { height: 1px; background: var(--line); }
.map-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: none; background: #FFFFFF; color: #000000; cursor: pointer; }
.map-btn:hover { background: var(--page); }
.map-btn.solo { border-radius: 10px; box-shadow: var(--shadow); }
/* The layer list sits under the search box, clear of the attribution, and
   scrolls inside itself; folded, only its heading shows. */
.layers { left: 16px; top: 76px; width: 250px; max-width: calc(100% - 32px); max-height: calc(100% - 160px); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.layers-head { display: flex; align-items: center; justify-content: space-between; flex: none; }
.layers-head span { font-size: 12px; font-weight: 600; color: var(--ink-4); }
.layers-toggle { display: inline-block; border: none; background: transparent; color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.layers-list { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; }
.layers.collapsed .layers-list { display: none; }
.layer { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; cursor: pointer; }
.layer input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.layer .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.layer .note-z { margin-left: auto; font-size: 11px; color: var(--ink-5); }
.attrib { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 7px 16px; background: rgba(255,255,255,0.94); border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3); z-index: 2; }
.maplibregl-ctrl-bottom-right { bottom: 34px; }
.maplibregl-ctrl-scale { border-color: #000000; color: #000000; font-family: var(--font); font-weight: 600; }
.maplibregl-ctrl-attrib { display: none; }
.map-loading { position: absolute; top: 76px; left: 16px; padding: 8px 12px; font-size: 13px; }

.panel { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; overflow: hidden; max-height: calc(100vh - 108px); position: sticky; top: 20px; }
.panel-head { padding: 20px 22px 0; display: flex; flex-direction: column; gap: 8px; }
.panel-head h1 { font-size: 22px; font-weight: 700; }
.panel-id { display: flex; align-items: center; gap: 6px; color: var(--ink-3); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-top: 8px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; padding: 12px 0; font-size: 14px; font-weight: 600; color: var(--ink-4); border: none; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; white-space: nowrap; }
.tab:hover { color: #000000; }
.tab[aria-selected="true"] { color: #000000; border-bottom-color: #000000; }
.panel-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 20px; flex: 1; overflow-y: auto; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.fact { display: flex; flex-direction: column; gap: 2px; }
.fact span:first-child { font-size: 12px; color: var(--ink-4); }
.fact span:last-child { font-size: 16px; font-weight: 600; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section h2 { font-size: 15px; font-weight: 700; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.bar div { height: 100%; border-radius: 4px; background: var(--blue); }
.value { font-family: var(--mono); font-size: 14px; color: #000000; }
.cond { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--soft); }
.cond:last-child { border-bottom: none; }
.cond-name { flex: 1; min-width: 0; }
.cond-name small { display: block; color: var(--ink-4); font-size: 12px; line-height: 1.45; margin-top: 2px; }
.cond-val { font-weight: 600; text-align: right; max-width: 50%; }
.panel-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; }
.panel-foot > .btn-primary { flex: 1 1 auto; }
.panel-foot .foot-note { flex-basis: 100%; margin: 0; }
.foot-form { flex-basis: 100%; display: flex; flex-direction: column; gap: 10px; }
.empty-panel { padding: 28px 22px; display: flex; flex-direction: column; gap: 12px; color: var(--ink-3); }
.empty-panel h1 { font-size: 20px; color: #000000; }
.src { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--soft); }
.src:last-child { border-bottom: none; }
.src-title { font-weight: 600; }

/* Key gate */
.gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.gate { flex-direction: column; gap: 16px; }
.gate .card { max-width: 480px; width: 100%; }
.gate form { display: flex; flex-direction: column; gap: 12px; }
/* Signed out, the page is the sign-in card alone: no navigation, no top bar. */
.signed-out .side, .signed-out .top { display: none; }
.signed-out main { min-height: 100vh; }
.field-label { font-size: 13px; font-weight: 600; }
.error { color: var(--bad); font-size: 13px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { position: static; height: auto; flex: none; padding: 12px 16px; gap: 0; }
  .menu-btn { display: inline-flex; }
  .side-body { display: none; padding-top: 16px; }
  .side.open .side-body { display: flex; }
  .top { padding: 10px 16px; min-height: 0; }
  .map-page { padding: 12px 16px 16px; gap: 16px; }
  .map-wrap { flex-basis: 100%; min-height: 0; display: flex; flex-direction: column; }
  #map { position: relative; inset: auto; height: 62vh; min-height: 360px; }
  .attrib { position: static; }
  .panel { max-height: none; position: static; flex-basis: 100%; }
  .page { padding: 20px 16px 32px; }
  .layers { top: 72px; bottom: auto; width: auto; right: 72px; max-height: calc(62vh - 88px); }
  .search { width: auto; right: 72px; max-width: none; }
  .row > :last-child { max-width: 55%; }
}

/* Maintain pages: manufacturer profiles and design programs */
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions .input { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px 16px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 2fr) minmax(min(280px, 100%), 1fr); }
.sheet-row { display: flex; flex-wrap: wrap; gap: 10px; }
.limit-table .input { width: 100%; min-width: 90px; }
.limit-table td { padding: 8px; }
.checks { display: flex; flex-direction: column; gap: 4px; }
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 10px 12px; border-radius: 8px; background: var(--page); display: flex; flex-direction: column; gap: 4px; white-space: pre-wrap; }
.msg.reviewer { background: #EEF5FD; }
.group-row td { background: var(--page); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); padding: 8px 12px; }
textarea.input { resize: vertical; }
details > summary { list-style-position: inside; }
@media (max-width: 860px) {
  .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); }
}
.error:empty { display: none; }
.grid-2 > * { min-width: 0; }

/* Manufacturer profile form: the limits drawn on a sample wall, as the
   add-ins' Limits tab draws them (#282), and a card per limit. The verdict
   colours are the add-ins' wall colours. */
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; }
.form-row .sheet-row { margin-left: auto; }
.profile-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; align-self: center; }
.profile-id .mono { overflow-wrap: anywhere; }
.field-inline { display: grid; grid-template-columns: auto auto; align-items: center; gap: 4px 10px; }
.field-inline .small { grid-column: 1 / -1; }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn-quiet:hover { color: #000000; background: var(--soft); }
.lim-editor { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.lim-figure { position: sticky; top: 16px; }
.lim-wall-box { width: 100%; max-width: 540px; margin: 0 auto; }
.lim-wall { display: block; width: 100%; height: auto; overflow: visible; }
.lim-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-4); }
.lim-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.lim-sw { width: 14px; height: 5px; border-radius: 1px; }
.lim-sw-green { background: #009933; }
.lim-sw-yellow { background: #FFCC00; }
.lim-sw-red { background: #E62E2E; }
.lim-sw-split { background: repeating-linear-gradient(90deg, #009933 0 3px, transparent 3px 5px); }

.lim-pill-wrap { display: flex; width: 100%; height: 100%; align-items: flex-start; pointer-events: none; font-family: var(--font); }
.lim-pill-start { justify-content: flex-start; }
.lim-pill-middle { justify-content: center; }
.lim-pill-end { justify-content: flex-end; }
.lim-pill { pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px 0 2px; border-radius: 9px; border: 1px solid #C9CCD1; background: #FFFFFF; color: #1F2124; font-family: var(--font); font-size: 11px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap; }
.lim-pill-tall { height: 20px; padding: 0 7px 0 3px; border-radius: 10px; }
.lim-pill-n { width: 13px; height: 13px; border-radius: 7px; background: #45484D; color: #FFFFFF; font-size: 9px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.lim-pill-tall .lim-pill-n { width: 14px; height: 14px; font-size: 9.5px; }
.lim-pill:hover { border-color: var(--blue); }
.lim-pill:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.lim-pill.unstated { border-style: dashed; border-color: #8A8F96; color: #5C6168; }
.lim-pill.unstated .lim-pill-n { background: #FFFFFF; color: #45484D; box-shadow: inset 0 0 0 1px #8A8F96; }
.lim-pill.edited { background: #FFF8E6; border-color: #E8C77A; color: #6B4C00; }
.lim-pill.edited .lim-pill-n { background: #6B4C00; color: #FFFFFF; box-shadow: none; }
.lim-pill.bad { background: #FDECEC; border-color: #C5221F; color: #8C1D18; }
.lim-pill.bad .lim-pill-n { background: #C5221F; color: #FFFFFF; box-shadow: none; }
.lim-pill.on { background: var(--blue); border: 1px solid var(--blue); color: #FFFFFF; }
.lim-pill.on .lim-pill-n { background: #FFFFFF; color: var(--blue); box-shadow: none; }

.lim-list { display: flex; flex-direction: column; gap: 10px; }
.lim-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 2px 4px 0; }
.lim-group-head h2 { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.lim-cards + .lim-group-head { margin-top: 12px; }
.lim-cards { display: flex; flex-direction: column; gap: 10px; }
.lim-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; scroll-margin-top: 16px; scroll-margin-bottom: 96px; }
.lim-card.on { border-color: var(--blue); box-shadow: 0 0 0 1px rgba(4,118,232,0.25); }
.lim-head { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 14px 16px; border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 12px; font: inherit; color: inherit; }
.lim-head:hover { background: #F7F8FA; }
.lim-head:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.lim-n { flex: none; width: 22px; height: 22px; border-radius: 11px; background: #45484D; color: #FFFFFF; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.lim-n.edited { background: #6B4C00; }
.lim-card.on .lim-n { background: var(--blue); }
.lim-n-more, .lim-card.on .lim-n-more { background: transparent; box-shadow: inset 0 0 0 1.5px #C9CCD1; }
.lim-card.on .lim-n-more { box-shadow: inset 0 0 0 1.5px var(--blue); }
.lim-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lim-name { font-weight: 600; font-size: 15px; }
.lim-summary { font-size: 13px; color: var(--ink-4); }
.lim-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.chip { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.chip-edit { background: #FFF1C7; color: #6B4C00; }
.chip-bad { background: #FDECEC; color: #B3261E; }
.chip-muted { background: var(--soft); color: var(--ink-4); }
.lim-chev { flex: none; margin-top: 6px; color: var(--ink-4); transition: transform 0.15s; }
.lim-head[aria-expanded="true"] .lim-chev { transform: rotate(90deg); }
.lim-body { padding: 0 16px 14px 50px; display: flex; flex-direction: column; gap: 12px; }
.lim-range { position: relative; height: 34px; }
.lim-bands { position: absolute; left: 0; right: 0; top: 4px; height: 8px; border-radius: 4px; overflow: hidden; display: flex; gap: 1px; }
.lim-ticks { position: absolute; inset: 0; }
.lim-tick { position: absolute; top: 0; width: 2px; height: 16px; background: var(--ink-3); transform: translateX(-50%); }
.lim-tick.changed { background: #6B4C00; }
.lim-tick-label { position: absolute; top: 18px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.lim-tick-label.changed { color: #6B4C00; font-weight: 600; }
.lim-unstated { margin: 0; }
.lim-parts { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.lim-part { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.lim-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.lim-input-row { display: flex; align-items: center; gap: 8px; }
.input.lim-num { width: 128px; min-height: 36px; padding: 6px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.input.lim-num.changed { border-color: #D9A21B; background: #FFF8E6; }
.input.lim-num.invalid { border-color: var(--bad); background: #FDF3F6; }
.lim-unit { font-size: 13px; color: var(--ink-4); }
.lim-read, .lim-was, .lim-err { font-size: 12px; }
.lim-read { color: var(--ink-4); }
.lim-was { color: #6B4C00; }
.lim-err { color: var(--bad); max-width: 260px; }
.lim-read:empty, .lim-was:empty, .lim-err:empty, .lim-problem:empty, .lim-source:empty, .lim-effect:empty, .lim-stock:empty { display: none; }
.lim-hint { margin: -4px 0 0; }
.lim-cond .input { width: 100%; }
/* What sets a limit, how panels travel and the steps of a transport limit (FR-D3.18, FR-D3.21). */
.lim-road { display: flex; flex-direction: column; gap: 10px; }
.lim-select { min-width: 180px; }
.lim-steps-part { min-width: 0; }
.lim-steps { display: flex; flex-direction: column; gap: 6px; }
.lim-step { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.lim-step .lim-num { width: 96px; }
.lim-step .input:not(.lim-num):not(select) { flex: 1 1 200px; min-width: 0; }
.lim-step-add { align-self: flex-start; }
.lim-steps-lines { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-2); }
.lim-steps-lines li { display: flex; align-items: center; gap: 8px; }
.lim-effect { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.lim-problem { margin: 0; padding: 8px 10px; border-radius: 6px; background: #FDF3F6; color: var(--bad); font-size: 13px; }
.lim-source { margin: 0; }
.lim-body-foot { display: flex; justify-content: flex-end; }
.lim-next { border: 0; background: transparent; color: var(--blue); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.lim-next:hover { color: var(--blue-dark); text-decoration: underline; }

/* The bar that stays at the bottom of the form while it is filled in. */
.lim-actionbar { position: sticky; bottom: 0; z-index: 5; margin: 0 -32px -40px; padding: 12px 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(0,0,0,0.05); }
.lim-actionbar.has-changes { background: #FFF8E6; border-top-color: #E8C77A; }
.lim-status { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 280px; font-size: 13px; }
.lim-status .error { margin: 2px 0 0; }
.lim-status-text { display: block; color: var(--ink-2); }
.lim-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-5); flex: none; }
.has-changes .lim-dot { background: #D9A21B; }
.has-problems .lim-dot { background: var(--bad); }

@media (max-width: 1023px) {
  .lim-editor { grid-template-columns: minmax(0, 1fr); }
  .lim-figure { position: static; }
}
@media (max-width: 860px) {
  .lim-actionbar { margin: 0 -16px -32px; padding: 10px 16px; gap: 8px; }
  .lim-actionbar .actions { gap: 6px; flex-wrap: nowrap; width: 100%; }
  .lim-actionbar .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .lim-actionbar .btn-primary { flex: 1 1 auto; }
  .form-row .sheet-row { margin-left: 0; }
  .lim-body { padding-left: 16px; }
  .lim-head { padding: 12px 14px; }
}

/* User guide (#443): the text and screenshots come from GET /guide, rendered from docs/guide.
   The reading surface follows the light or dark theme; the side menu is dark in both. */
.guide-page { max-width: 1280px; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.guide-card { color: var(--ink); text-decoration: none; }
.guide-card:hover { text-decoration: none; border-color: var(--blue); }
.guide-card p { margin: 0; }
.guide-search-wrap { position: relative; display: flex; align-items: center; max-width: 560px; }
.guide-search-wrap svg { position: absolute; left: 12px; color: var(--ink-4); pointer-events: none; }
.guide-search { width: 100%; padding-left: 36px; }
.guide-results { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.guide-hit { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.guide-hit:hover { border-color: var(--blue); text-decoration: none; }
.guide-hit-where { font-size: 12px; font-weight: 600; color: var(--blue); }
.guide-hit-text { font-size: 13px; color: var(--ink-3); }
.guide-hit mark, .guide-results mark { background: var(--warn-bg); color: inherit; padding: 0 1px; border-radius: 2px; }
.guide-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 32px; align-items: start; }
.guide-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow-y: auto; padding-bottom: 16px; }
.guide-home { font-size: 13px; font-weight: 600; }
.guide-picker { width: 100%; }
.guide-toc-list, .guide-toc-sub { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.guide-toc-list > li > a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.guide-toc-list > li > a:hover { background: var(--soft); text-decoration: none; }
.guide-toc-list > li > a[aria-current="page"] { background: var(--ink); color: var(--card); }
.guide-toc-sub { padding: 4px 0 6px 12px; border-left: 2px solid var(--line); margin: 4px 0 4px 10px; }
.guide-toc-sub a { display: block; padding: 3px 8px; font-size: 13px; color: var(--ink-3); }
.guide-reading { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.guide-article { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 36px 32px; max-width: 900px; }
.guide-article > h1 { font-size: 30px; margin: 6px 0 18px; }
.guide-body { font-size: 15px; line-height: 1.6; color: var(--ink); }
.guide-body h2 { font-size: 21px; margin: 30px 0 10px; display: flex; align-items: center; gap: 8px; scroll-margin-top: 16px; }
.guide-body h3 { font-size: 17px; margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; scroll-margin-top: 16px; }
.guide-body p { margin: 0 0 12px; }
.guide-body ul, .guide-body ol { margin: 0 0 14px; padding-left: 26px; }
.guide-body li { margin: 0 0 6px; }
.guide-body li.step { position: relative; margin-bottom: 14px; padding: 2px 0; scroll-margin-top: 16px; border-radius: 6px; }
.guide-body li.step::marker { font-weight: 700; color: var(--blue); }
.guide-body code { font-family: var(--mono); font-size: 0.9em; background: var(--soft); padding: 1px 4px; border-radius: 4px; }
.guide-body pre { background: var(--soft); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.guide-body pre code { background: none; padding: 0; }
.guide-body blockquote { margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--blue); background: var(--soft); border-radius: 0 8px 8px 0; }
.guide-body blockquote p:last-child { margin: 0; }
.guide-body .table-wrap { overflow-x: auto; margin: 8px 0 16px; }
.guide-body table { border-collapse: collapse; width: 100%; font-size: 14px; }
.guide-body th, .guide-body td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.guide-body th { background: var(--soft); }
.guide-body img.shot { display: block; max-width: 100%; height: auto; margin: 10px 0 6px; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; background: var(--soft); }
.guide-body img.shot:not(.loaded) { min-height: 120px; width: min(100%, 480px); }
.guide-body .shot-pending { display: block; margin: 10px 0 6px; padding: 22px 16px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--ink-4); font-size: 13px; text-align: center; }
.guide-anchor { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: none; border-radius: 4px; background: transparent; color: var(--ink-5); cursor: pointer; opacity: 0; flex: none; }
.guide-body h2:hover .guide-anchor, .guide-body h3:hover .guide-anchor, .guide-body li.step:hover > .guide-anchor, .guide-anchor:focus-visible { opacity: 1; }
.guide-anchor:hover { color: var(--blue); background: var(--soft); }
.guide-body li.step > .guide-anchor { position: absolute; left: -54px; top: 2px; }
.guide-target { animation: guide-flash 2s ease-out; }
@keyframes guide-flash { from { background: var(--info-bg); } to { background: transparent; } }
.guide-pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.shot-view { border: none; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; cursor: zoom-out; }
.shot-view::backdrop { background: rgba(0, 0, 0, 0.78); }
.shot-view img { display: block; max-width: 96vw; max-height: 88vh; border-radius: 6px; }
.shot-view p { margin: 8px 0 0; color: #FFFFFF; font-size: 13px; text-align: center; }
@media (max-width: 1023px) {
  .guide-layout { grid-template-columns: minmax(0, 1fr); }
  .guide-toc { position: static; max-height: none; }
  .guide-body li.step > .guide-anchor { display: none; }
}
@media (max-width: 860px) {
  .guide-article { padding: 20px 18px 24px; border-radius: 12px; }
  .guide-article > h1 { font-size: 24px; }
}
@media (prefers-color-scheme: dark) {
  body[data-page="guide"] {
    --ink: #EDEDED; --ink-2: #DADADA; --ink-3: #BDBDBD; --ink-4: #9A9A9A; --ink-5: #7A7A7A;
    --line: #2C2C2C; --line-2: #3A3A3A; --soft: #232323; --page: #0F0F0F; --card: #181818;
    --blue: #4EA1F5; --blue-dark: #7BB9F7; --info-bg: #10324F; --warn-bg: #4A3A10;
    background: var(--page); color: var(--ink); color-scheme: dark;
  }
  body[data-page="guide"] .btn-secondary { background: var(--card); color: var(--ink); }
  body[data-page="guide"] .btn-secondary:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
  body[data-page="guide"] .input { background: var(--card); color: var(--ink); border-color: var(--line-2); }
  body[data-page="guide"] .p-neutral { background: var(--card); color: var(--ink-2); }
  body[data-page="guide"] .guide-body img.shot { border-color: var(--line-2); }
}
