/* AeroLink cockpit (ADR 0025 §5). Calm: white page in light, navy in dark,
 * hairline rules, no gradient or glow. Colour only for status and always with
 * a word or an icon: red = to decide now, amber = watch, green = good change.
 * Montserrat 700 for titles only, Manrope for everything else, tabular
 * figures everywhere (docs/design/typography.md). Phone first at 360 px;
 * desktop is the same cards in a grid, with a left rail. */

@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/montserrat-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/montserrat-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/manrope-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(fonts/manrope-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Montserrat Fallback'; src: local('Arial'); ascent-override: 85.8%; descent-override: 22.3%; line-gap-override: 0%; size-adjust: 112.8%; }
@font-face { font-family: 'Manrope Fallback'; src: local('Arial'); ascent-override: 102.7%; descent-override: 28.9%; line-gap-override: 0%; size-adjust: 103.8%; }

:root {
  --page: #FFFFFF;
  --panel: #FFFFFF;
  --well: #F3F6F9;
  --ink: #0B1526;
  --ink-2: #33405A;
  --muted: #5B6677;
  --rule: #D5DBE3;
  --rule-strong: #8A94A6;
  --accent: #0B1526;
  --accent-ink: #FFFFFF;
  --link: #2E5A86;
  --focus: #2E5A86;
  --red: #B42318;
  --red-pale: #FDECEA;
  --amber: #8A5A00;
  --amber-pale: #FFF4DC;
  --green: #1F7A4C;
  --green-pale: #E3F1E9;
  --grey-bar: #C5CDD9;
  --bar: #33405A;
  --display: 'Montserrat', 'Montserrat Fallback', system-ui, sans-serif;
  --sans: 'Manrope', 'Manrope Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 8px;
  --bar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0B1526; --panel: #132038; --well: #0F1B30; --ink: #E6EAF1; --ink-2: #C5CDD9; --muted: #9AA7BB;
    --rule: #26365A; --rule-strong: #6B7A96; --accent: #9ED0F0; --accent-ink: #0B1526; --link: #9ED0F0; --focus: #9ED0F0;
    --red: #FF8A7A; --red-pale: rgba(255, 138, 122, .12); --amber: #F5C46A; --amber-pale: rgba(245, 165, 36, .12);
    --green: #5BC48F; --green-pale: rgba(91, 196, 143, .14); --grey-bar: #33405A; --bar: #9AA7BB; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0B1526; --panel: #132038; --well: #0F1B30; --ink: #E6EAF1; --ink-2: #C5CDD9; --muted: #9AA7BB;
  --rule: #26365A; --rule-strong: #6B7A96; --accent: #9ED0F0; --accent-ink: #0B1526; --link: #9ED0F0; --focus: #9ED0F0;
  --red: #FF8A7A; --red-pale: rgba(255, 138, 122, .12); --amber: #F5C46A; --amber-pale: rgba(245, 165, 36, .12);
  --green: #5BC48F; --green-pale: rgba(91, 196, 143, .14); --grey-bar: #33405A; --bar: #9AA7BB; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--page); color: var(--ink);
  font: 400 16px/1.5 var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 20px; line-height: 1.2; }
.top h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .brand-long { display: none; } .top h1 { font-size: 18px; } .top { gap: 6px; padding: 8px 12px; } .icon-btn { min-width: 40px; padding: 0 8px; } }
h2 { font-size: 20px; line-height: 1.25; margin: 24px 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }

/* ---------- sign-in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin-box { width: 100%; max-width: 380px; }
.signin-box h1 { font-size: 24px; margin-bottom: 8px; }
.signin-box p { margin: 0 0 20px; color: var(--ink-2); }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--page); border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 56px;
}
.top .titles { flex: 1; min-width: 0; }
.top .updated { font-size: 12px; color: var(--muted); }
.icon-btn { background: none; border: 1px solid var(--rule); border-radius: var(--r); min-width: 44px; height: 40px; padding: 0 10px; cursor: pointer; font-size: 14px; }
.icon-btn:hover { border-color: var(--rule-strong); }
main { padding: 16px 16px calc(var(--bar-h) + 24px); max-width: 1200px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: var(--bar-h);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel); border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button, .rail button {
  background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px; min-width: 0;
}
.tabs button svg, .rail button svg { width: 22px; height: 22px; }
.tabs button[aria-current="page"], .rail button[aria-current="page"] { color: var(--ink); }
.tabs button[aria-current="page"] svg, .rail button[aria-current="page"] svg { stroke: var(--ink); }
.rail { display: none; }
.more-sheet { position: fixed; left: 0; right: 0; bottom: var(--bar-h); z-index: 29; background: var(--panel); border-top: 1px solid var(--rule); padding: 8px 16px; display: grid; gap: 4px; }
.more-sheet button { text-align: left; background: none; border: 0; padding: 12px 4px; font-size: 16px; cursor: pointer; border-bottom: 1px solid var(--rule); }
.more-sheet button:last-child { border-bottom: 0; }

@media (min-width: 900px) {
  .tabs, .more-sheet { display: none !important; }
  .rail { display: flex; flex-direction: column; position: fixed; top: 56px; bottom: 0; left: 0; width: 200px; border-right: 1px solid var(--rule); padding: 12px 8px; gap: 2px; background: var(--page); }
  .rail button { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 15px; padding: 10px 12px; border-radius: var(--r); }
  .rail button[aria-current="page"] { background: var(--well); }
  main { margin-left: 200px; padding: 24px 32px 48px; }
}

/* ---------- building blocks ---------- */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.grid.one { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } .grid.cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .grid.cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; min-width: 0; }
.card + .card { margin-top: 0; }
.stack > * + * { margin-top: 12px; }
.empty { padding: 16px; border: 1px dashed var(--rule); border-radius: var(--r); color: var(--muted); text-align: center; }

.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--r); overflow: hidden; }
.seg button { background: none; border: 0; padding: 8px 16px; min-height: 40px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.btn { border: 1px solid var(--rule-strong); background: var(--panel); border-radius: var(--r); padding: 8px 14px; min-height: 40px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; color: var(--link); cursor: pointer; padding: 4px 0; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* metric tile: value + comparison; colour only with the word */
.tile { display: block; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px; cursor: pointer; min-width: 0; }
.tile:hover { border-color: var(--rule-strong); }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .value { font-size: 24px; font-weight: 700; line-height: 1.2; margin: 4px 0 2px; overflow-wrap: anywhere; }
.tile .cmp { font-size: 13px; color: var(--ink-2); }
.cmp.good { color: var(--green); }
.cmp.bad { color: var(--red); }
.na { color: var(--muted); font-weight: 600; }
.tile .value.na { font-size: 15px; line-height: 1.35; margin: 8px 0 4px; }

/* decision cards */
.decision { border-left: 4px solid var(--rule-strong); }
.decision.urgent { border-left-color: var(--red); }
.decision.warn { border-left-color: var(--amber); }
.sev { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; display: inline-flex; gap: 6px; align-items: center; }
.sev.urgent { color: var(--red); }
.sev.warn { color: var(--amber); }
.sev.info { color: var(--muted); }
.decision h3 { margin: 6px 0 6px; font-size: 16px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 10px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.status-line { padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font: inherit; }
.status-line.ok { background: var(--green-pale); color: var(--green); border-color: transparent; }
.status-line.bad { background: var(--red-pale); color: var(--red); border-color: transparent; }

/* bars */
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.bar-row .track { height: 12px; background: var(--well); border-radius: 3px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--bar); }
.bar-row .fill.grey { background: var(--grey-bar); }
.bar-row .n { min-width: 2.5em; text-align: right; }
.flag-red { color: var(--red); font-weight: 600; }
.vbars { display: flex; align-items: flex-end; gap: 4px; height: 120px; border-bottom: 1px solid var(--rule); }
.vbars div { flex: 1; background: var(--bar); min-height: 1px; border-radius: 2px 2px 0 0; }
.vbars-labels { display: flex; gap: 4px; font-size: 12px; color: var(--muted); }
.vbars-labels span { flex: 1; text-align: left; white-space: nowrap; overflow: visible; }

/* tables */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.list li:last-child { border-bottom: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--ink-2); }
.badge.red { color: var(--red); border-color: var(--red); }
.badge.amber { color: var(--amber); border-color: var(--amber); }
.badge.green { color: var(--green); border-color: var(--green); }
.changed { color: var(--amber); font-size: 12px; font-weight: 700; margin-left: 6px; }
details summary { cursor: pointer; }
pre.diff { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.45 var(--sans); background: var(--well); padding: 8px; border-radius: 6px; margin: 6px 0 0; }

/* forms */
label { display: block; font-size: 14px; font-weight: 600; margin: 10px 0 4px; }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--panel);
}
input.num { text-align: right; }
.fields { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 600px) { .fields { grid-template-columns: 1fr 1fr; } }
fieldset { border: 1px solid var(--rule); border-radius: var(--r); padding: 4px 12px 12px; margin: 12px 0; min-width: 0; }
legend { font-weight: 600; padding: 0 4px; }
.form-err { color: var(--red); font-size: 14px; margin: 8px 0 0; }

/* The empty seat and the CEO account creation (migration 0015). The enrolment
   steps come from ../js/admin-security.js, which uses AeroAdmin's class names. */
input[type="password"], input[type="email"], .setup-box input:not([type]), .setup-box input[inputmode] {
  width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--panel); color: var(--ink);
}
.setup-box { max-width: 520px; }
.setup-box h1 { font-size: 24px; margin-bottom: 8px; }
.setup-box h2 { font-size: 16px; margin: 0 0 8px; }
.setup-box .card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.setup-box button.primary, .setup-box button.secondary, .setup-box button.ghost {
  border: 1px solid var(--rule-strong); background: var(--panel); color: var(--ink); border-radius: var(--r); padding: 8px 14px; min-height: 44px; cursor: pointer; font-weight: 600;
}
.setup-box button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.setup-box button:disabled { opacity: .55; cursor: default; }
.setup-box .pw-box { border: 1px solid var(--rule-strong); border-radius: var(--r); padding: 12px 14px; margin: 12px 0; }
.setup-box .pw-box code { display: block; font-size: 16px; margin: 6px 0; word-break: break-all; }
.setup-box .pw-box small { display: block; color: var(--muted); }
.setup-box ul { padding-left: 20px; }

/* dialog */
.dialog-bg { position: fixed; inset: 0; z-index: 50; background: rgba(11, 21, 38, .45); display: grid; place-items: end center; }
@media (min-width: 600px) { .dialog-bg { place-items: center; } }
.dialog { background: var(--panel); color: var(--ink); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; border-radius: 12px 12px 0 0; padding: 18px 16px 20px; }
@media (min-width: 600px) { .dialog { border-radius: 12px; } }
.dialog h2 { margin-top: 0; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--bar-h) + 12px); z-index: 60; background: var(--ink); color: var(--page); border-radius: var(--r); padding: 12px 14px; max-width: 480px; margin: 0 auto; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.pw-box { background: var(--well); border-radius: var(--r); padding: 12px; margin-top: 10px; font-size: 18px; font-weight: 700; letter-spacing: .04em; overflow-wrap: anywhere; }

/* pricing preview: one example per row, readable at 360 px */
.examples li { display: grid; gap: 2px; }
.examples .prices { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.sev + * { margin-left: 2px; }
