/* SkyDock look, shared with the Hub (Skydock_Hub/admin-site/css/theme.css): the same colour
   tokens, header, buttons and tables, in a light and a dark theme. The typeface differs from the
   Hub's Arial: IBM Plex Sans and Mono (SIL Open Font License), served from assets/fonts.
   Loaded last. js/theme.js sets <html data-theme="light|dark"> before first paint.
   Brand: charcoal #1C1E22, neon green #00E58E, deep green #00A86B, amber #F5B83D. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../assets/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../assets/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-style: normal; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  --sd-charcoal: #1c1e22;
  --sd-neon: #00e58e;
  --sd-green: #00a86b;
  --sd-font-head: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sd-font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sd-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --content-max: 1360px;
  --content-gutter: 40px;
  --panel-pad: 20px;
  --radius: 6px;
}

:root, :root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f0f2f5;
  --surface-strong: #e6e9ee;
  --ink: #1c1e22;
  --ink-soft: #4a505b;
  --muted: #5d6471;
  --border: #e2e5ea;
  --border-strong: #c5cad2;
  --brand: #007a4d;
  --brand-strong: #00603b;
  --brand-pale: #dff9ee;
  --on-brand: #ffffff;
  --amber: #8f5300;
  --amber-pale: #fff3d6;
  --danger: #b3363b;
  --danger-strong: #8c2a2e;
  --danger-pale: #fbe8e8;
  --success: #006b43;
  --success-pale: #dff9ee;
  --shadow-sm: 0 1px 2px rgba(28, 30, 34, 0.05);
  --shadow-md: 0 12px 32px rgba(28, 30, 34, 0.09);
  --header-bg: #ffffff;
  --header-ink: #1c1e22;
  --header-ink-soft: #4a505b;
  --header-line: var(--border);
  --header-glow: 0 3px 0 var(--sd-neon);
  --nav-hover: var(--surface-muted);
  --nav-active-bg: transparent;
  --nav-active-ink: #1c1e22;
  --nav-active-line: var(--sd-neon);
  --focus: #007a4d;
  --focus-ring: rgba(0,229,142,.28);
  --placeholder: #6b7280;
  --btn-primary-bg: #00e58e;
  --btn-primary-ink: #1c1e22;
  --btn-primary-hover: #007a4d;
  --btn-primary-hover-ink: #ffffff;
  --input-bg: #ffffff;
  --row-hover: #f7fbf9;
  --stat-ink: var(--ink);
  --danger-quiet-line: #e5bcbc;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #141619;
  --surface: #1c1e22;
  --surface-muted: #23262b;
  --surface-strong: #2a2d33;
  --ink: #eceef2;
  --ink-soft: #c3c8d0;
  --muted: #a0a7b3;
  --border: #2f333a;
  --border-strong: #4a505b;
  --brand: #00e58e;
  --brand-strong: #7ff2c4;
  --brand-pale: rgba(0,229,142,.14);
  --on-brand: #1c1e22;
  --amber: #f5b83d;
  --amber-pale: rgba(245,184,61,.15);
  --danger: #ff7a7a;
  --danger-strong: #ff9a9a;
  --danger-pale: rgba(255,90,90,.16);
  --success: #00e58e;
  --success-pale: rgba(0,229,142,.14);
  --shadow-sm: none;
  --shadow-md: 0 0 0 1px rgba(0,229,142,.35), 0 8px 24px rgba(0,0,0,.4);
  --header-bg: #111315;
  --header-ink: #eceef2;
  --header-ink-soft: #c3c8d0;
  --header-line: var(--sd-neon);
  --header-glow: 0 1px 14px rgba(0,229,142,.35);
  --nav-hover: var(--surface-strong);
  --nav-active-bg: var(--brand-pale);
  --nav-active-ink: #00e58e;
  --nav-active-line: transparent;
  --focus: #00e58e;
  --focus-ring: rgba(0,229,142,.25);
  --placeholder: #9aa1ad;
  --btn-primary-bg: #00e58e;
  --btn-primary-ink: #1c1e22;
  --btn-primary-hover: #7ff2c4;
  --btn-primary-hover-ink: #1c1e22;
  --input-bg: #141619;
  --row-hover: #23262b;
  --stat-ink: #00e58e;
  --danger-quiet-line: #7a3a3d;
}

/* The names the page styles were written with, mapped onto the Hub tokens. */
:root {
  --bg: var(--page);
  --line: var(--border);
  --accent: var(--brand);
  --accent-ink: var(--on-brand);
  --accent-soft: var(--brand-pale);
  --ok: var(--success);
  --ok-soft: var(--success-pale);
  --warn: var(--amber);
  --warn-soft: var(--amber-pale);
  --crit: var(--danger);
  --crit-soft: var(--danger-pale);
  --none-soft: var(--surface-strong);
  --font-body: var(--sd-font-body);
  --font-mono: var(--sd-mono);
}

body { min-height: 100vh; background: var(--page); color: var(--ink); font-family: var(--sd-font-body); font-size: 15px; line-height: 1.45; overflow-x: hidden; }
h1, h2, h3, .eyebrow, .brand-sub, th, .listhead, .group, .tile .lbl, .pill { font-family: var(--sd-font-head); }
h1, h2 { letter-spacing: -.01em; font-weight: 600; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Header */
.app-header { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 18px; min-height: 62px; padding: 8px clamp(18px, 4vw, 48px); background: var(--header-bg); color: var(--header-ink); border-bottom: 1px solid var(--header-line); box-shadow: var(--header-glow); }
.header-left { display: flex; align-items: center; gap: 28px; min-width: 0; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.brand-logo { display: block; width: 92px; height: 27px; }
.brand-logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }
.brand-sub { padding-left: 11px; border-left: 2px solid var(--sd-neon); color: var(--header-ink-soft); font-size: .9rem; font-weight: 600; }
.header-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.header-nav a { color: var(--header-ink-soft); padding: 9px 13px; box-shadow: inset 0 -3px 0 transparent; font-size: .9rem; font-family: var(--sd-font-head); font-weight: 600; text-decoration: none; transition: background .15s ease, color .15s ease; }
.header-nav a:hover { background: var(--nav-hover); color: var(--header-ink); }
.header-nav a.active { background: var(--nav-active-bg); color: var(--nav-active-ink); box-shadow: inset 0 -3px 0 var(--nav-active-line); }
.header-account { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.who { color: var(--header-ink-soft); font-size: .8rem; }
.who b { color: var(--header-ink); }
.btn-header { min-height: 34px; padding: 6px 11px; border-color: var(--border-strong); color: var(--header-ink); background: transparent; }
.btn-header:hover { background: var(--nav-hover); }
.theme-toggle { display: inline-grid; place-items: center; flex: 0 0 auto; width: 36px; min-height: 34px; padding: 0; cursor: pointer; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-float { position: fixed; top: 14px; right: 14px; z-index: 30; background: var(--surface); color: var(--ink); }

/* Page frame */
.wrap { max-width: none; width: min(var(--content-max), calc(100% - var(--content-gutter))); margin: 0 auto; padding: 30px 0 56px; gap: 18px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-heading h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.12; font-weight: 600; letter-spacing: -.015em; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.page-subtitle { margin: 6px 0 0; color: var(--ink-soft); font-size: .88rem; }
h2.sec { font-size: 1.1rem; font-weight: 600; }

/* Summary strip (the tiles): one bar with a neon top edge, as on the Hub's fleet page */
.tiles { gap: 1px; background: var(--border); border: 1px solid var(--border); border-top: 3px solid var(--sd-neon); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.tile { border: 0; border-radius: 0; background: var(--surface); padding: 14px 20px; min-height: 82px; text-decoration: none; color: inherit; }
.tile:hover { background: var(--surface-muted); }
.tile.static:hover { background: var(--surface); }
.tile .lbl { color: var(--ink-soft); font-size: .82rem; font-weight: 600; }
.tile .num { font-family: var(--sd-font-head); font-size: 1.8rem; font-weight: 600; color: var(--stat-ink); }
.tile.warn .num { color: var(--amber); }
.tile.crit .num { color: var(--danger); }
.tile.active { box-shadow: inset 0 -3px 0 var(--sd-neon); }
.tile.active, .tile.link { border: 0; }

/* Panels, lists and tables */
.list, .panel, aside.log, .card { border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .list, :root[data-theme="dark"] .panel, :root[data-theme="dark"] aside.log { border-top: 2px solid var(--border-strong); }
.listhead, table.grid th { background: var(--surface-muted); color: var(--ink-soft); font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.group, table.grid tr.sechead td { background: var(--surface-muted); color: var(--ink-soft); font-size: .82rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
.row:hover, table.grid tbody tr:hover td { background: var(--row-hover); }
.row.s-low, .row.s-low:hover { background: var(--amber-pale); }
.row.s-out, .row.s-out:hover { background: var(--danger-pale); }
table.grid tr.short td, table.grid tr.short:hover td { background: var(--danger-pale); }
table.grid tr.sechead:hover td { background: var(--surface-muted); }
aside.log h2 { font-size: 1.05rem; }
.banner { border-radius: var(--radius); }
.notice { border-radius: var(--radius); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font-size: .88rem; font-weight: 600; text-decoration: none; transition: background .15s ease, border-color .15s ease; }
.btn:hover:not(:disabled) { background: var(--surface-muted); border-color: var(--sd-green); }
:root[data-theme="dark"] .btn { background: var(--surface-muted); }
:root[data-theme="dark"] .btn:hover:not(:disabled) { background: var(--surface-strong); border-color: var(--sd-neon); }
.btn:disabled { opacity: .55; }
.btn.primary, :root[data-theme="dark"] .btn.primary { background: var(--btn-primary-bg); color: var(--btn-primary-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled), :root[data-theme="dark"] .btn.primary:hover:not(:disabled) { background: var(--btn-primary-hover); color: var(--btn-primary-hover-ink); border-color: transparent; filter: none; }
.btn.danger, :root[data-theme="dark"] .btn.danger { background: transparent; border-color: var(--danger-quiet-line); color: var(--danger); }
.btn.danger:hover:not(:disabled), :root[data-theme="dark"] .btn.danger:hover:not(:disabled) { background: var(--danger-pale); border-color: var(--danger); }
.btn.danger.confirm, :root[data-theme="dark"] .btn.danger.confirm { background: var(--danger); color: var(--on-brand); border-color: var(--danger); }
.btn.btn-header, :root[data-theme="dark"] .btn.btn-header { background: transparent; }
.linkbtn { color: var(--brand); }

.search input, select.sel, dialog input, dialog select, dialog textarea, .field input, .field select, input.in, select.in, input.qty, .planrow input.n {
  min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--input-bg); color: var(--ink);
}
dialog input[type="checkbox"], input[type="checkbox"] { min-height: 0; accent-color: var(--sd-green); }
input::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
select option { background: var(--input-bg); color: var(--ink); }
input.qty.changed { border-color: var(--focus); background: var(--brand-pale); }

.pill { min-height: 22px; display: inline-flex; align-items: center; padding: 2px 9px; font-size: .74rem; font-weight: 600; }
.pill.open { background: var(--brand-pale); color: var(--brand); }
.pinfo .bin { background: var(--surface-strong); }

.seg { background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.seg button { background: transparent; color: var(--ink-soft); font-weight: 600; min-height: 40px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: inset 0 -3px 0 var(--sd-neon); }
:root[data-theme="dark"] .seg button.on { background: var(--surface-strong); color: var(--sd-neon); box-shadow: none; }
.chips button { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.chips button.on { border-color: var(--brand); background: var(--brand-pale); color: var(--ink); }

dialog { border-radius: 8px; border: 1px solid var(--border); box-shadow: var(--shadow-md); }
dialog h2 { font-size: 1.2rem; font-weight: 600; }
dialog::backdrop { background: rgba(10, 12, 14, .55); }
.toast { border-radius: var(--radius); box-shadow: var(--shadow-md); }

/* Builds */
.card { border-left: 3px solid var(--border-strong); }
a.card:hover { border-color: var(--border); border-left-color: var(--sd-neon); background: var(--surface-muted); }
.card .unit, .buildhead h2 { font-family: var(--sd-mono); }
.bar i { background: var(--sd-green); }
:root[data-theme="dark"] .bar i { background: var(--sd-neon); }
.verdict { border-radius: var(--radius); }

/* Sign-in */
.login { max-width: 440px; }
.login .panel { padding: 26px; display: grid; gap: 16px; border-top: 3px solid var(--sd-neon); }
.login .brand-logo { width: 150px; height: 44px; }
.login h1 { font-size: 1.5rem; }
.login .btn { justify-content: flex-start; min-height: 44px; }
.login .btn.primary { justify-content: center; }
.login form .btn { justify-content: center; }
.login .or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; }
.login .or::before, .login .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

@media (max-width: 760px) {
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .wrap { width: min(100% - 22px, var(--content-max)); padding: 22px 0 48px; }
  .app-header { min-height: 56px; }
  .brand-sub { display: none; }
  .header-left { gap: 10px; }
  .header-nav a { padding: 8px 10px; }
}
