/* ============================================================================
   fsi.css — canonical FSI design system, generated from the Fleet UI Kit.
   Source of truth: the "Fleet UI Kit" Claude Design project (tokens + components).
   Shared verbatim across FSI apps. Namespaced .fleet-* components for standalone
   apps; .fsi-* aliases for Bootstrap-layered apps. Dark mode via dual selectors.
   ============================================================================ */

:root {
  /* Neutrals — FSI light standard */
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface-alt: #e8e8e8;
  --border: #d8d8d8;
  --text: #111111;
  --text-muted: #555555;

  /* Brand accent — FSI blue ramp */
  --accent: #426ab3;
  --accent-hover: #001c54;
  --accent-subtle: #eef3fb;
  --accent-muted: #bfd0eb;

  /* Link colour. Separate from --accent because the dark accent (#001c54) only
     reaches 2.2:1 on the dark surface — well under the 4.5:1 WCAG AA needs for
     body text. In light the brand blue already passes at 5.2:1 on white. */
  --link: var(--accent);

  /* Operational status (semantic — never rebrand) */
  --success: #16a34a;
  --warning: #d97706;
  --danger:  #dc2626;
  --info:    #0891b2;

  /* Status chips (fg / bg / border) — status-tint pattern.
     The fills were opaque pastels (#f0fdf4 / #fffbeb / #fef2f2 / #ecfeff) that
     floated on the dark surface, which is why the dark block had to restate
     them. They are now translucent tints identical in both themes, so only the
     foreground flips: a dark, high-contrast hue in light, a bright tint in
     dark. Dark therefore only overrides the *-fg values. */
  --ok-fg: #166534;   --ok-bg: rgba(22,163,74,.12);   --ok-bd: rgba(22,163,74,.35);
  --warn-fg: #92400e; --warn-bg: rgba(217,119,6,.12); --warn-bd: rgba(217,119,6,.35);
  --bad-fg: #991b1b;  --bad-bg: rgba(220,38,38,.12);  --bad-bd: rgba(220,38,38,.35);
  --info-fg: #155e75; --info-bg: rgba(8,145,178,.12); --info-bd: rgba(8,145,178,.35);

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-pill: 9999px;

  /* Spacing scale */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px;

  /* Layout — page container width (fleet-ui-kit v1.6.0). Fluid ceiling
     for .app-main / .app-nav__inner so the shared wrapper tracks wide
     monitors instead of a hardcoded per-app max-width. */
  --container-max: clamp(1240px, 92vw, 1800px);

  /* Density — table cell / list row padding (fleet-ui-kit v1.7.0). One pair for
     every table and list row in the suite; 11x14 is the former 12x16 at ~90%.
     Reference these from th / td / row rules, never a literal padding. */
  --cell-py: 11px;
  --cell-px: 14px;

  /* Type scale */
  --text-xs: 12px; --text-sm: 14px; --text-base: 16px;
  --text-lg: 18px; --text-xl: 24px; --text-2xl: 32px;

  /* Type — FSI: Lato for body/UI, Bebas Neue for display headings */
  --font: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Bebas Neue', 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Elevation (neutral-black based, matching FSI #111) */
  --shadow: 0 1px 2px rgba(17, 17, 17, .06), 0 1px 3px rgba(17, 17, 17, .1);
  --shadow-lg: 0 4px 6px -1px rgba(17, 17, 17, .08), 0 10px 15px -3px rgba(17, 17, 17, .1);

  /* --- Legacy FSI token aliases (so .fsi-* consumers keep resolving) --- */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-text: var(--text);
  --color-muted: var(--text-muted);
  --color-border: var(--border);
  --color-primary: var(--accent);
  --color-primary-hover: var(--accent-hover);
  --brand-primary: var(--accent);
  --font-family-body: var(--font);
  --font-family-display: var(--font-display);
}

/* Dark mode — navy; blues taken from the site's darkest.
   Applies via dual explicit selectors (Bootstrap 5 data-bs-theme and custom
   data-theme) AND by OS preference, so the app is correct before the theme
   script runs and for anyone on "auto". Keep the two blocks in sync. */
:root[data-bs-theme='dark'],
:root[data-theme='dark'] {
  --bg: #030f26;
  --surface: #0a1c3d;
  --surface-alt: #172b47;
  --border: #16305e;
  --text: #eaf1fa;
  --text-muted: #9fb6d8;

  --accent: #426ab3;
  --accent-hover: #4586c6;
  --accent-subtle: #0f2247;
  --accent-muted: #bfd0eb;
  --link: #6ea8e6;   /* 6.5:1 on --surface, 7.3:1 on --bg */

  /* Only the chip foregrounds flip — the tints above already track the page. */
  --ok-fg: #86efac;
  --warn-fg: #fcd34d;
  --bad-fg: #fca5a5;
  --info-fg: #67e8f9;

  --shadow: 0 1px 2px rgba(0, 0, 0, .40), 0 1px 3px rgba(0, 0, 0, .50);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, .50), 0 10px 15px -3px rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-bs-theme='light']) {
    --bg: #030f26;
    --surface: #0a1c3d;
    --surface-alt: #172b47;
    --border: #16305e;
    --text: #eaf1fa;
    --text-muted: #9fb6d8;

    --accent: #426ab3;
    --accent-hover: #4586c6;
    --accent-subtle: #0f2247;
    --accent-muted: #bfd0eb;
    --link: #6ea8e6;   /* 6.5:1 on --surface, 7.3:1 on --bg */

    --ok-fg: #86efac;
    --warn-fg: #fcd34d;
    --bad-fg: #fca5a5;
    --info-fg: #67e8f9;

    --shadow: 0 1px 2px rgba(0, 0, 0, .40), 0 1px 3px rgba(0, 0, 0, .50);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, .50), 0 10px 15px -3px rgba(0, 0, 0, .55);
  }
}

/* ---------------------------------------------------------------- Base ---- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--text); line-height: 1.2; margin: 0 0 var(--space-3); }

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.eyebrow {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
}

.app-main { max-width: var(--container-max); margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-12); }

/* ------------------------------------------------------------- Top nav ---- */
.app-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 40;
}
.app-nav__inner {
  max-width: var(--container-max); margin: 0 auto;
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}
.app-nav__brand {
  font-weight: 700; font-size: var(--text-lg); color: var(--text);
  display: inline-flex; align-items: center; gap: var(--space-2);
}
.app-nav__brand:hover { text-decoration: none; }
.app-nav__brand .mark {
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff; font-size: var(--text-xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.app-nav__links { display: flex; align-items: center; gap: var(--space-1); }
.app-nav__spacer { flex: 1; }
.app-nav__link {
  font-size: var(--text-sm); font-weight: 500; color: var(--text-muted);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
}
.app-nav__link:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.app-nav__link.is-active { color: var(--link); background: var(--accent-subtle); font-weight: 600; }

/* ---------------------------------------------------------- Page header --- */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6);
}
.page-title { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.01em; margin: 0 0 var(--space-1); }
.page-subtitle { color: var(--text-muted); margin: 0; }
.section-title { font-size: var(--text-lg); font-weight: 600; margin: 0 0 var(--space-3); }

/* ------------------------------------------------------------- Buttons ---- */
.fleet-btn {
  font-family: inherit; font-weight: 600; font-size: var(--text-sm);
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2);
  line-height: 1; transition: background .12s, border-color .12s, filter .12s;
}
.fleet-btn:hover { text-decoration: none; }
.fleet-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fleet-btn--sm { font-size: var(--text-xs); padding: 7px 12px; }
.fleet-btn--lg { font-size: 15px; padding: 12px 20px; }
.fleet-btn--primary { background: var(--accent); color: #fff; }
.fleet-btn--primary:hover { background: var(--accent-hover); }
.fleet-btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.fleet-btn--secondary:hover { background: var(--surface-alt); }
.fleet-btn--ghost { background: transparent; color: var(--link); }
.fleet-btn--ghost:hover { background: var(--accent-subtle); }
.fleet-btn--danger { background: var(--danger); color: #fff; }
.fleet-btn--danger:hover { filter: brightness(.94); }
.fleet-btn:disabled, .fleet-btn.is-disabled { opacity: .5; cursor: not-allowed; }

/* -------------------------------------------------------------- Cards ----- */
.fleet-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.fleet-card__header {
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  font-weight: 600;
}
.fleet-card__body { padding: var(--space-4); }

/* --------------------------------------------------------- Stat cards ----- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.stat-card.is-ok::before { background: var(--success); }
.stat-card.is-warn::before { background: var(--warning); }
.stat-card.is-bad::before { background: var(--danger); }
.stat-card__label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.stat-card__value { font-size: var(--text-2xl); font-weight: 700; margin: var(--space-2) 0 var(--space-1); letter-spacing: -.01em; }
.stat-card__trend { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.stat-card__trend.up { color: var(--success); }
.stat-card__trend.down { color: var(--danger); }
.stat-card__trend.flat { color: var(--text-muted); }

/* -------------------------------------------------------- Data table ------ */
.fleet-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto;
}
.fleet-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.fleet-table thead th {
  text-align: left; font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--text-muted); padding: var(--cell-py) var(--cell-px);
  background: var(--surface-alt); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.fleet-table tbody td, .fleet-table tbody th { padding: var(--cell-py) var(--cell-px); border-bottom: 1px solid var(--border); text-align: left; }
.fleet-table tbody tr:last-child td, .fleet-table tbody tr:last-child th { border-bottom: none; }
.fleet-table tbody tr:hover td, .fleet-table tbody tr:hover th { background: var(--surface-alt); }
.fleet-table .num { text-align: right; font-family: var(--font-mono); color: var(--text-muted); }
.fleet-table .unit { font-family: var(--font-mono); font-weight: 600; }

/* Grid variant: dense, sticky first column, status-tinted cells */
.fleet-table--grid { white-space: nowrap; }
.fleet-table--grid thead th { position: sticky; top: 0; z-index: 2; }
.fleet-table--grid .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); white-space: normal; min-width: 14rem; max-width: 18rem; }
.fleet-table--grid thead .sticky-col { z-index: 3; background: var(--surface-alt); }
/* tbody in the selector: .fleet-table tbody td (left) otherwise wins on specificity. */
.fleet-table--grid tbody td { text-align: center; font-variant-numeric: tabular-nums; }
.cell--low { background: var(--bad-bg) !important; color: var(--bad-fg); font-weight: 600; }
.cell--missing { background: var(--warn-bg) !important; color: var(--warn-fg); font-weight: 600; }
.cell--untracked { color: var(--text-muted); opacity: .65; }
.row--low > * { background: var(--bad-bg); }
.row--missing > * { background: var(--warn-bg); }

/* ------------------------------------------------------- Badges / pills --- */
.fleet-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid transparent;
}
.fleet-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.fleet-badge.is-ok { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.fleet-badge.is-ok .dot { background: var(--success); }
.fleet-badge.is-missing { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-bd); }
.fleet-badge.is-missing .dot { background: var(--warning); }
.fleet-badge.is-low { color: var(--bad-fg); background: var(--bad-bg); border-color: var(--bad-bd); }
.fleet-badge.is-low .dot { background: var(--danger); }
.fleet-badge.is-info { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-bd); }
.fleet-badge.is-info .dot { background: var(--info); }
.fleet-badge.is-muted { color: var(--text-muted); background: var(--surface-alt); border-color: var(--border); }
.fleet-badge.is-muted .dot { background: var(--text-muted); }

/* --------------------------------------------------------------- Alerts --- */
.fleet-alert {
  display: flex; gap: var(--space-3); padding: 13px 16px; border-radius: var(--radius);
  border: 1px solid; font-size: var(--text-sm); line-height: 1.45; margin-bottom: var(--space-3);
}
.fleet-alert__icon { flex: 0 0 20px; font-weight: 700; }
.fleet-alert__body strong { display: block; margin-bottom: 2px; }
.fleet-alert.is-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--text); }
.fleet-alert.is-info .fleet-alert__icon { color: var(--info); }
.fleet-alert.is-ok, .fleet-alert.is-success { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--text); }
.fleet-alert.is-ok .fleet-alert__icon, .fleet-alert.is-success .fleet-alert__icon { color: var(--success); }
.fleet-alert.is-warn, .fleet-alert.is-warning { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--text); }
.fleet-alert.is-warn .fleet-alert__icon, .fleet-alert.is-warning .fleet-alert__icon { color: var(--warning); }
.fleet-alert.is-bad, .fleet-alert.is-danger { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--text); }
.fleet-alert.is-bad .fleet-alert__icon, .fleet-alert.is-danger .fleet-alert__icon { color: var(--danger); }

/* ----------------------------------------------------------- Form fields -- */
.fleet-field { margin-bottom: var(--space-4); }
.fleet-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.fleet-field .hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: 6px; }
.fleet-field .err { font-size: var(--text-xs); color: var(--danger); margin-top: 6px; }
.fleet-input, .fleet-field input, .fleet-field select, .fleet-field textarea {
  width: 100%; font-family: inherit; font-size: var(--text-sm); padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none;
}
.fleet-field input:focus, .fleet-field select:focus, .fleet-field textarea:focus, .fleet-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle);
}
.fleet-field input::placeholder { color: var(--text-muted); opacity: .7; }
.fleet-field.is-invalid input { border-color: var(--danger); }
.fleet-field input:disabled { background: var(--surface-alt); color: var(--text-muted); cursor: not-allowed; }

/* --------------------------------------------------------------- Legend --- */
.legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-2) 0 var(--space-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 14px; border: 1px solid var(--border); border-radius: 3px; }
.legend .swatch.low { background: var(--bad-bg); }
.legend .swatch.missing { background: var(--warn-bg); }
.legend .swatch.untracked { background: var(--surface-alt); }

/* --------------------------------------------- Legacy .fsi-* compat aliases -
   Consumed by Bootstrap-layered FSI apps (e.g. fsi_STRUCTURE_EXAMPLE). Styled
   with Fleet tokens so those apps inherit the Fleet look without template edits. */
.fsi-navbar { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.fsi-navbar__container { display: flex; align-items: center; gap: var(--space-4); }
.fsi-navbar__brand { font-weight: 700; color: var(--text); }
.fsi-navbar__menu .nav-link { color: var(--text-muted); }
.fsi-navbar__menu .nav-link:hover { color: var(--text); }
.fsi-display { font-family: var(--font-display); font-weight: 400; letter-spacing: .02em; text-transform: uppercase; }

.fsi-button-primary, .fsi-primary-btn { background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 600; border-radius: var(--radius-sm); }
.fsi-button-primary:hover, .fsi-button-primary:focus, .fsi-primary-btn:hover, .fsi-primary-btn:focus { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.fsi-button-secondary, .fsi-secondary-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; border-radius: var(--radius-sm); }
.fsi-button-secondary:hover, .fsi-button-secondary:focus, .fsi-secondary-btn:hover, .fsi-secondary-btn:focus { background: var(--surface-alt); color: var(--text); }
.fsi-nav-action { background: transparent; border: 1px solid var(--border); color: var(--text-muted); border-radius: var(--radius-sm); }
.fsi-nav-action:hover { background: var(--surface-alt); color: var(--text); }
/* Keyboard focus indicator (WCAG 2.4.7) on the legacy button classes. */
.fsi-button-primary:focus-visible, .fsi-primary-btn:focus-visible,
.fsi-button-secondary:focus-visible, .fsi-secondary-btn:focus-visible,
.fsi-nav-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.fsi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.fsi-badge, .fsi-badge-success, .fsi-badge-primary {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid transparent;
}
.fsi-badge { color: var(--text-muted); background: var(--surface-alt); border-color: var(--border); }
.fsi-badge-success { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.fsi-badge-primary { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-bd); }
.fsi-section-title { font-size: var(--text-lg); font-weight: 600; }
.fsi-text-success { color: var(--success); }
.fsi-text-danger { color: var(--danger); }

/* Map Bootstrap contextual alerts onto Fleet status chips for .fsi-* apps. */
.alert.alert-success { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg); }
.alert.alert-danger { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-fg); }
.alert.alert-warning { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }
.alert.alert-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-fg); }

/* Map Bootstrap form controls onto Fleet tokens so inputs stay consistent
   (notably in dark mode) in .fsi-* apps that use standard Bootstrap fields. */
.form-control, .form-select, .form-check-input {
  background-color: var(--surface); color: var(--text); border-color: var(--border);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  background-color: var(--surface); color: var(--text);
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle);
}
.form-control::placeholder { color: var(--text-muted); opacity: .7; }

/* ---- Mizuho OSI Inventory additions (tokens only; no literal colours) ---- */
.tip { display: inline-block; position: relative; margin-left: var(--space-1); vertical-align: middle; }
.tip > summary { list-style: none; cursor: pointer; width: 20px; height: 20px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); color: var(--link); font-size: var(--text-xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; background: var(--surface); }
.tip > summary::-webkit-details-marker { display: none; }
.tip > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tip__body { position: absolute; z-index: 20; top: 26px; left: -8px; width: min(320px, 80vw);
  padding: var(--space-3); background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: var(--text-sm); font-weight: 400; }
.tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-6); border-bottom: 1px solid var(--border); }
.tabs a { padding: var(--space-2) var(--space-4); color: var(--text-muted); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a.is-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 700; }
.ref-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-alt); }
.ref-thumb--lg { width: 100%; max-width: 360px; height: auto; }
.item-row { display: grid; grid-template-columns: 96px 1fr 120px; gap: var(--space-4); align-items: center;
  padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
@media (max-width: 560px) { .item-row { grid-template-columns: 72px 1fr 88px; gap: var(--space-2); } .ref-thumb { width: 72px; height: 54px; } }
.cell--scope { color: var(--text-muted); background: var(--surface-alt); }
.choice-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); max-width: 720px; }
.choice-grid .fleet-btn { justify-content: center; padding: var(--space-6); font-size: var(--text-lg); }
.inline-form { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: end; }
.inline-form .fleet-field { margin-bottom: 0; }
[hidden] { display: none !important; }

/* Full-width pages (dashboard, table history): the grid uses the whole monitor
   instead of the --container-max ceiling, so no sideways scroll when there is room. */
.app-main--full { max-width: none; }
/* Dense grid: 20+ table columns must fit a 1920px monitor without sideways
   scroll. Narrows the kit's own cell-padding token for this table only (no
   literal padding on cells). */
.fleet-table--grid.is-dense { --cell-px: 6px; }
.grid-col-head .meta { font-weight: 400; font-size: var(--text-xs); color: var(--text-muted); }
/* Zebra rows so long rows are easy to follow across (Dave, 2026-11-19).
   Uses the kit's --accent-subtle (distinct from the --surface-alt hover).
   Skips hovered rows, status rows and status/scope cells so red/amber/grey
   still read; includes the sticky first column so a row is one band. */
.fleet-table tbody tr:nth-child(even):not(:hover):not(.row--low):not(.row--missing) > *:not(.cell--low):not(.cell--missing):not(.cell--scope) {
  background: var(--accent-subtle);
}

/* ---- Survey-style count (templates/count.html + static/js/survey.js) ---- */
.js-survey .survey-step { display: none; }
.js-survey .survey-step.is-current { display: block; }
.survey-step { margin-bottom: var(--space-6); }
.survey-progress { height: 6px; background: var(--surface-alt); border-radius: var(--radius-pill); overflow: hidden; margin: var(--space-2) 0; }
.survey-progress__bar { height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.survey-progress__text { font-size: var(--text-sm); margin: 0 0 var(--space-4); }
.survey-q { margin-bottom: var(--space-4); border: 1px solid var(--border); }
.survey-q.has-error, .survey-step.has-error .fleet-card__body { outline: 2px solid var(--danger); outline-offset: 2px; }
.survey-q__title { display: block; font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-2); }
.survey-error { color: var(--danger); font-weight: 700; margin: var(--space-2) 0 0; }
.survey-nav { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) 0; background: var(--bg); border-top: 1px solid var(--border); }
.survey-nav [data-next] { margin-left: auto; min-width: 140px; justify-content: center; }
/* Answer buttons: the radio stays in the DOM (keyboard + screen readers); the span is the target. */
.answer-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.answer-buttons label { position: relative; }
.answer-buttons input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.answer-buttons span { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; min-height: 48px;
  padding: 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font-size: var(--text-lg); font-weight: 700; cursor: pointer; }
.answer-buttons .answer-skip span { font-size: var(--text-sm); font-weight: 400; }
.answer-buttons input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.answer-buttons input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.choice-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; font-weight: 700; }
.choice-card img { width: 100%; height: 120px; object-fit: contain; background: var(--surface-alt); border-radius: var(--radius-sm); }
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-subtle); }
.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.review-list li .fleet-btn { margin-left: auto; }
.review-list li.is-short { background: var(--bad-bg); }
/* Headings get programmatic focus on each screen (for screen readers); no box around them. */
.survey-step [tabindex="-1"]:focus { outline: none; }
/* Survey photos must be usable on a phone (Dave, 2026-11-19): full card width
   at every size. Two classes so it outranks the 560px .ref-thumb thumbnail
   rule, which used to shrink these back to 72px on phones. */
.ref-thumb.ref-thumb--lg { width: 100%; max-width: 640px; height: auto; max-height: 70vh; object-fit: contain; }
.survey-q a:has(> .ref-thumb--lg) { display: block; }
/* Bigger photo button for thumbs at a loading dock. */
.survey-q input[type=file] { font-size: var(--text-base); padding: var(--space-3); min-height: 52px; }
.survey-q input[type=file]::file-selector-button { font-size: var(--text-base); padding: var(--space-2) var(--space-4); margin-right: var(--space-3); }
