/**
 * gpacket design system — layer 1: tokens, reset, typography, utilities.
 *
 * Single visual language for the customer and staff control planes.
 * Layers: this file (tokens) → components.css (primitives) → app.css (shell).
 * Views compose primitives; they do not invent colours, radii, or type sizes.
 *
 * Type: Inter for all UI. Geist Mono only for console, commands, logs,
 * addresses, ports, code and technical identifiers — never for copy.
 *   display 18/600  page titles
 *   metric  20/600  statistics
 *   h2      15/500  section and panel titles
 *   body    14/400  default copy
 *   sm      13/400  navigation, buttons, tables, secondary
 *   xs      12/400  metadata, hints
 *   label   12/500  uppercase: nav groups, table heads, stat labels
 *   mono    13/400  technical values only
 *
 * Form labels are sentence case at 12/500. Status badges stay uppercase.
 * Do not bold the whole UI — 600 is titles and figures only.
 *
 * Space: 4px base (s-1…s-8) plus semantic layout tokens so page padding,
 * section gaps, table density and form rhythm stay identical across views.
 */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2-variations"), url("/fonts/inter-latin-ext.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: Inter;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin.woff2") format("woff2-variations"), url("/fonts/inter-latin.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: "Geist Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/geist-mono-latin.woff2") format("woff2-variations"), url("/fonts/geist-mono-latin.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;
}

:root {
  color-scheme: dark;

  /* --- surfaces ---------------------------------------------------------- */
  /* Near-black with a slight indigo cast. Cool and quiet, so the panel feels
     steady rather than neon. Body text stays neutral so it stays easy to read. */
  --canvas: #0c0b12;
  --surface: #13121a;
  --surface-2: #18171f;
  --raised: #1e1d28;
  --hover: #272633;
  --inset: #09080f;
  --overlay: rgba(8, 6, 14, 0.72);

  /* --- lines ------------------------------------------------------------- */
  --border: #2c2a38;
  --border-strong: #3e3b4e;
  --border-soft: #201e2a;
  --border-hover: #4c4860;

  /* --- text -------------------------------------------------------------- */
  --text: #eef0f4;
  --text-2: #a8b0ba;
  --text-3: #8b939d;
  --text-on-accent: #140c22;
  --text-on-ok: #061008;

  /* --- brand and semantics ----------------------------------------------- */
  /* Indigo-violet for the brand. Green is reserved for healthy status:
     on, TPS, MSPT, and Start. Danger and warn stay red and amber. */
  --ok: #6fbf68;
  --ok-strong: #87d07f;
  --ok-solid: #4f9a4a;
  --ok-quiet: rgba(111, 191, 104, 0.12);
  --ok-line: rgba(111, 191, 104, 0.36);

  --accent: #c9beff;
  --accent-strong: #ddd6ff;
  --accent-solid: #8e7cf6;
  --accent-quiet: rgba(201, 190, 255, 0.14);
  --accent-line: rgba(201, 190, 255, 0.4);

  --danger: #e5686e;
  --danger-quiet: rgba(229, 104, 110, 0.12);
  --danger-line: rgba(229, 104, 110, 0.4);

  --warn: #d9ae4a;
  --warn-quiet: rgba(217, 174, 74, 0.12);
  --warn-line: rgba(217, 174, 74, 0.38);

  --info: var(--accent);
  --info-quiet: var(--accent-quiet);
  --info-line: var(--accent-line);

  --focus: var(--accent-strong);
  --ring: 0 0 0 3px var(--accent-quiet);
  --selection: rgba(201, 190, 255, 0.28);

  /* --- type -------------------------------------------------------------- */
  --font-sans: Inter, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", "Cascadia Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;

  --fs-display: 1.125rem;   /* 18px — page titles, nothing larger */
  --fs-metric: 1.25rem;     /* 20px — dashboard figures */
  --fs-h2: 0.9375rem;       /* 15px — panel and section titles */
  --fs-body: 0.875rem;      /* 14px */
  --fs-sm: 0.8125rem;       /* 13px */
  --fs-xs: 0.75rem;         /* 12px — meta, hints */
  --fs-label: 0.75rem;      /* 12px — uppercase labels */
  --fs-mono: 0.8125rem;     /* 13px — console and code */
  --fs-chart: 0.6875rem;    /* 11px — axis ticks */

  --lh-tight: 1.2;
  --lh-ui: 1.35;
  --lh-body: 1.5;
  --lh-mono: 1.6;
  --tracking-display: -0.018em;
  --tracking-tight: -0.012em;
  --tracking-label: 0.04em;

  /* --- space (4px base) --------------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;

  /* --- layout rhythm ----------------------------------------------------- */
  --page-pad-x: var(--s-6);
  --page-pad-y: var(--s-6);
  --page-pad-bottom: 48px;
  --section-gap: var(--s-6);
  --block-gap: var(--s-4);
  --grid-gap: var(--s-3);
  --sidebar-pad-x: 12px;
  --sidebar-pad-y: 16px;
  --nav-item-h: 36px;
  --tab-h: 28px;
  --table-pad-y: 7px;
  --table-pad-x: 12px;
  --form-gap: var(--s-4);
  --field-gap: 6px;
  --modal-pad: var(--s-5);
  --panel-pad-x: var(--s-4);
  --panel-pad-y: var(--s-4);
  --panel-head-h: 44px;

  /* --- shape: 3 / 4 / 6. Dots are the only full-round element. ----------- */
  --r-1: 3px;
  --r-2: 4px;
  --r-3: 6px;
  --r-full: 999px;

  /* --- elevation (menus, dialogs, toasts only) --------------------------- */
  --shadow-menu: 0 8px 24px -10px rgba(0, 0, 0, 0.72), 0 1px 4px rgba(0, 0, 0, 0.32);
  --shadow-modal: 0 24px 56px -20px rgba(0, 0, 0, 0.78);

  /* --- motion ------------------------------------------------------------ */
  --t-fast: 80ms;
  --t-base: 120ms;
  --ease: cubic-bezier(0.2, 0, 0.2, 1);

  /* --- layout metrics ---------------------------------------------------- */
  --topbar-h: 48px;
  --sidebar-w: 240px;
  --content-max: none;
  --control-h: 32px;
  --control-h-sm: 26px;
  --row-h: 32px;
  --table-head-h: 28px;
  --z-sticky: 20;
  --z-drawer: 40;
  --z-modal: 60;
  --z-toast: 70;

  /* --- legacy aliases (referenced from JS and older markup) --------------- */
  --bg: var(--canvas);
  --bg-2: var(--surface);
  --bg-3: var(--raised);
  --line: var(--border);
  --muted: var(--text-3);
  --accent-dim: var(--accent-line);
  --console: var(--inset);
}

/* --- reset ---------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--border-strong) transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--canvas);
  color: var(--text);
  /* Literal stack — never inherit, never var-only. inherit on body is Times. */
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

body {
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  font-synthesis: none;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 0;
  font-optical-sizing: auto;
  letter-spacing: -0.011em;
  /* Aligned columns of numbers are the point of an ops console. */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

input, button, select, textarea { font-family: Inter, "Segoe UI", system-ui, sans-serif; }

#app { min-height: 100%; }

h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }

/* Inter is loaded at 400/500/600 only — do not let the UA synthesize 700. */
b, strong { font-weight: var(--fw-medium); }

h1 {
  font-size: var(--fs-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
}

h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}

h3 {
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-variant-ligatures: none;
  letter-spacing: 0;
}

hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

img, svg { vertical-align: middle; }

::selection { background: var(--selection); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--border-hover); background-clip: padding-box; }

/* --- focus ---------------------------------------------------------------- */

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

.skip-link {
  position: absolute;
  left: var(--s-3);
  top: -100px;
  z-index: 100;
  background: var(--raised);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-2);
  padding: var(--s-2) var(--s-3);
  color: var(--text);
  text-decoration: none;
  transition: top var(--t-base) var(--ease);
}
.skip-link:focus-visible { top: var(--s-3); }

/* --- typography roles ----------------------------------------------------- */

.mono,
.type-mono {
  font-family: var(--font-mono);
  font-weight: var(--fw-regular);
  font-variant-ligatures: none;
  letter-spacing: 0;
}

.meta,
.type-meta {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-regular);
  line-height: var(--lh-ui);
  letter-spacing: 0;
}

.sub,
.type-secondary {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  max-width: 72ch;
}

.label,
.stat-label,
.type-label {
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-3);
}

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.num { font-variant-numeric: tabular-nums; }

.tone-muted { color: var(--text-3); }
.tone-ok { color: var(--ok); }
.tone-warn { color: var(--warn); }
.tone-danger { color: var(--danger); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

label .meta,
label .optional {
  font-size: inherit;
  font-weight: var(--fw-regular);
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
}

/* --- layout primitives ---------------------------------------------------- */

.page {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.stack-4 { display: flex; flex-direction: column; gap: var(--block-gap); }
.stack-5 { display: flex; flex-direction: column; gap: var(--s-5); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.cluster-3 { gap: var(--s-3); }
.cluster.end { justify-content: flex-end; }

.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.spacer { flex: 1 1 auto; }
.grow { flex: 1 1 140px; min-width: 0; }

.grid { display: grid; gap: var(--grid-gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.row.flush { margin-top: 0; }
.table-follow { margin-top: var(--block-gap); }

/* Inside a page stack, children must not add their own outer margin. */
.page > .page-head,
.page > .page-lead,
.page > .section-head,
.page > .banner,
.page > .callout,
.page > .split,
.page > .fleet-summary,
.page > .loc-block,
.page > .site-grid,
.page > .pager,
.page > .pager-meta,
.page > .table-wrap,
.page > .dtable-wrap,
.page > .table-toolbar,
.page > .table-foot,
.page > .ops-strip,
.page > .section,
.page > #ov-page,
.page > #load-page,
.page > .ticket-desk,
.page > .ticket-stage,
.page > .ticket-new { margin: 0; }

.page > .card + .card,
.page > .panel + .panel { margin-top: 0; }

.section > .section-head { margin: 0; }

.page-lead {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.page-lead > .page-head { margin: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
  text-decoration: none;
}
.back-link:hover { color: var(--text-2); }
.back-link .ico { flex: 0 0 auto; }

/* --- motion preferences --------------------------------------------------- */

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

@media (forced-colors: active) {
  .btn, .panel, .card, .badge, .input, .select { border: 1px solid ButtonBorder; }
  :focus-visible { outline: 2px solid Highlight; }
}
