/* ============================================================
   MxBlox design tokens — true neutral greys with one confident
   blue accent, used sparingly (primary actions, active states,
   links, focus) so chart data-ink stays the only real color
   variety on screen. --brand-danger is reserved strictly for
   real alarm states, never decoration.
   ============================================================ */
:root {
  /* spacing scale */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px;

  /* radius scale */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-pill: 999px;

  /* type scale */
  --font-display: 28px; --font-h1: 20px; --font-h2: 15px;
  --font-body: 13.5px; --font-caption: 11.5px;

  /* type families — Archivo for display/wordmark carries a confident,
     slightly condensed technical weight; IBM Plex Sans for body text;
     Plex Mono for anything numeric/tabular (readouts, stat tiles) so
     digits line up and read like data, not styled text. */
  --font-display-family: 'Archivo', 'Arial Narrow', sans-serif;
  --font-body-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono-family: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* brand (chrome) colors — product UI, distinct from chart data-ink (PALETTE in common.js) */
  /* Page ground sits a step below the panel surface so panels read as
     raised without needing a shadow on every one. */
  --brand-bg: #eceef0;
  --brand-surface: #ffffff;
  --brand-ink: #18181b;
  --brand-ink-muted: #6b7280;
  --brand-ink-faint: #9ca3af;
  --brand-accent: #2563eb;
  --brand-accent-hover: #1d4ed8;
  --brand-accent-soft: #eff4ff;
  --brand-border: #e1e4e8;
  /* An inset fill for elements sitting *on* a panel (stat tiles, wells) —
     distinct from --brand-bg, which is the page behind the panels. */
  --brand-inset: #f5f6f8;
  /* Mixture page: descriptive rich/lean pair, deliberately not the
     danger token (a rich cylinder is not an alarm). */
  --mix-rich: #c2714a;
  --mix-rich-soft: #f6ebe5;
  --mix-rich-ink: #a85c38;
  --brand-danger: #dc2626;
  --brand-danger-soft: #fef0ef;
  --brand-good: #16a34a;
  --brand-good-soft: #eefaf0;
  --brand-warn: #d97706;
  --brand-warn-soft: #fef6e7;
  --brand-warn-border: #f5dca3;

  --shadow-sm: 0 1px 2px rgba(24,24,27,.05), 0 1px 3px rgba(24,24,27,.06);
  --shadow-md: 0 2px 10px rgba(24,24,27,.08), 0 1px 3px rgba(24,24,27,.05);
  --shadow-lg: 0 12px 32px rgba(24,24,27,.12), 0 2px 8px rgba(24,24,27,.07);
  --brand-accent-2: #71717a;

  /* legacy aliases kept so existing rules below keep working unmodified */
  --bg: var(--brand-bg);
  --panel: var(--brand-surface);
  --panel-bg: var(--brand-surface);
  --border: var(--brand-border);
  --text: var(--brand-ink);
  --text-muted: var(--brand-ink-muted);
  --text-secondary: var(--brand-ink-muted);
  --accent: var(--brand-accent);
  --accent-soft: var(--brand-accent-soft);
  --danger: var(--brand-danger);
  --warn: var(--brand-warn);
  --good: var(--brand-good);
  --radius: var(--radius-md);
  --shadow: var(--shadow-sm);
}

:root[data-theme="dark"] {
  --brand-bg: #0d0e10;
  --brand-surface: #17191d;
  --brand-ink: #f4f4f5;
  --brand-ink-muted: #a1a1aa;
  --brand-ink-faint: #71717a;
  --brand-accent: #60a5fa;
  --brand-accent-hover: #93c5fd;
  --brand-accent-2: #a1a1aa;
  --brand-accent-soft: #17233d;
  --brand-border: #2a2d32;
  --brand-inset: #202227;
  --mix-rich: #d98f63;
  --mix-rich-soft: #33241c;
  --mix-rich-ink: #e0a179;
  --brand-danger: #f87171;
  --brand-danger-soft: #2c1a1a;
  --brand-good: #4ade80;
  --brand-good-soft: #152218;
  --brand-warn: #fbbf24;
  --brand-warn-soft: #2a2110;
  --brand-warn-border: #4d3c15;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.35);
  --shadow-md: 0 2px 10px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-bg: #0d0e10;
    --brand-surface: #17191d;
    --brand-ink: #f4f4f5;
    --brand-ink-muted: #a1a1aa;
    --brand-ink-faint: #71717a;
    --brand-accent: #60a5fa;
    --brand-accent-hover: #93c5fd;
    --brand-accent-2: #a1a1aa;
    --brand-accent-soft: #17233d;
    --brand-border: #2a2d32;
    --brand-inset: #202227;
    --mix-rich: #d98f63;
    --mix-rich-soft: #33241c;
    --mix-rich-ink: #e0a179;
    --brand-danger: #f87171;
    --brand-danger-soft: #2c1a1a;
    --brand-good: #4ade80;
    --brand-good-soft: #152218;
    --brand-warn: #fbbf24;
    --brand-warn-soft: #2a2110;
    --brand-warn-border: #4d3c15;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.35);
    --shadow-md: 0 2px 10px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body-family);
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Left-rail navigation ---------- */

body.has-nav-rail {
  display: flex;
  min-height: 100vh;
}

.nav-rail {
  width: 240px;
  flex: 0 0 240px;
  background: var(--brand-surface);
  border-right: 1px solid var(--brand-border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

body.has-nav-rail .page-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.has-nav-rail .page-main > .container {
  flex: 1;
}

.page-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.page-topbar .back-link {
  font-weight: 600;
  font-size: var(--font-body);
  color: var(--brand-ink);
}
.page-topbar .back-link:hover { color: var(--brand-accent); text-decoration: none; }

.nav-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: var(--space-2) var(--space-2) var(--space-5);
}

.nav-logo {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.nav-logo svg {
  width: 28px;
  height: 28px;
}

.nav-wordmark {
  font-family: var(--font-display-family);
  font-size: 18px;
  letter-spacing: -.01em;
}
.nav-wordmark .wm-light { font-weight: 500; color: var(--brand-accent); }
.nav-wordmark .wm-bold { font-weight: 800; color: var(--brand-ink); }

.nav-beta {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--brand-accent-soft);
  color: var(--brand-accent);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-ink-faint);
  padding: 0 var(--space-2);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.nav-aircraft-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-aircraft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--brand-ink);
  font-weight: 500;
  font-size: var(--font-body);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background .12s ease, color .12s ease;
}

.nav-aircraft-item:hover { background: var(--brand-bg); }
.nav-aircraft-item.active { background: var(--brand-accent-soft); color: var(--brand-accent-hover); font-weight: 650; }

.nav-aircraft-item .tail { font-variant-numeric: tabular-nums; }

.role-pill {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-bg);
  color: var(--brand-ink-faint);
}
.role-pill.role-owner { background: var(--brand-good-soft); color: var(--brand-good); }

.nav-aircraft-add {
  margin-top: var(--space-2);
  background: transparent;
  color: var(--brand-ink-muted);
  border: 1px dashed var(--brand-border);
  padding: 7px 10px;
  font-size: var(--font-body);
  font-weight: 500;
  border-radius: var(--radius-sm);
  width: 100%;
  cursor: pointer;
}
.nav-aircraft-add:hover { background: var(--brand-bg); color: var(--brand-ink); }

.nav-upload-btn {
  display: block;
  margin-top: var(--space-4);
  background: linear-gradient(135deg, var(--brand-accent), var(--brand-accent-hover));
  color: #fff;
  border: none;
  padding: 9px 10px;
  font-size: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(37,99,235,.25);
  transition: box-shadow .15s ease, transform .15s ease;
}
.nav-upload-btn:hover {
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
  transform: translateY(-1px);
}

.nav-aircraft-empty {
  font-size: var(--font-body);
  color: var(--brand-ink-faint);
  padding: var(--space-2);
}

.nav-spacer { flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--brand-ink-muted);
  font-size: var(--font-body);
  font-weight: 500;
  position: relative;
  transition: background .12s ease, color .12s ease;
}
.nav-link-icon { width: 16px; height: 16px; flex: none; opacity: .75; }
.nav-link:hover { background: var(--brand-bg); text-decoration: none; }
.nav-link:hover .nav-link-icon { opacity: 1; }
.nav-link.active { color: var(--brand-accent); font-weight: 650; background: var(--brand-accent-soft); }
.nav-link.active .nav-link-icon { opacity: 1; }
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--brand-accent);
}

.nav-theme-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  margin-top: 2px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  box-shadow: none;
  color: var(--brand-ink-muted);
  font-size: var(--font-body);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s ease;
}
.nav-theme-toggle:hover { background: var(--brand-bg); box-shadow: none; transform: none; }
.nav-theme-toggle svg { flex: none; opacity: .75; }

@media (max-width: 900px) {
  body.has-nav-rail { display: block; }
  .nav-rail {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--brand-border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
  }
  .nav-brand { padding: var(--space-2); }
  .nav-section-label { display: none; }
  .nav-aircraft-list { flex-direction: row; flex-wrap: wrap; flex: 1; min-width: 0; }
  .nav-aircraft-item, .nav-aircraft-add { width: auto; }
  .nav-spacer { display: none; }
}

@media (max-width: 480px) {
  .nav-rail { padding: var(--space-2); }
  .nav-brand { padding: var(--space-1); }
}

/* ---------- Legacy topbar (kept for any page not yet using the rail) ---------- */

header.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}

header.topbar .nav {
  display: flex;
  gap: 18px;
  font-size: 14px;
}

/* Wide by design: this is a data tool, and the tables/charts inside have
   real use for the horizontal room. The cap only stops lines of running
   text getting unreadably long on an ultrawide display. */
.container {
  max-width: 1760px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-5) var(--space-6);
  box-sizing: border-box;
}

@media (max-width: 700px) {
  .container { padding: var(--space-4); }
}

/* Form-led pages read better in a single measured column than stretched
   across the full 1300px content width. */
.settings-container {
  max-width: 680px;
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.page-header-main { min-width: 0; }

.page-title {
  margin: 0;
  font-family: var(--font-display-family);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--brand-ink);
  text-wrap: balance;
}

.page-meta {
  margin: 5px 0 0;
  font-size: var(--font-body);
  color: var(--brand-ink-muted);
  font-variant-numeric: tabular-nums;
}

.page-header-action {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  background: var(--brand-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: var(--font-body);
  font-weight: 600;
  text-decoration: none;
  transition: background .14s ease;
}
.page-header-action:hover {
  background: var(--brand-accent-hover);
  color: #fff;
  text-decoration: none;
}

/* Panels are containers, not cards: a hairline and a surface, no shadow
   or hover lift. Spending border+radius+shadow on every block flattens
   the hierarchy — emphasis is reserved for things that earn it
   (.hero-panel, real alarm states) and for things that are actually
   interactive. */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

/* Left stripe reserved for genuine state, never decoration. */
.panel.accent-good { border-left: 3px solid var(--brand-good); }
.panel.accent-warn { border-left: 3px solid var(--brand-warn); }
.panel.accent-danger { border-left: 3px solid var(--brand-danger); }

/* Section headings read as quiet labels, not competing titles — the data
   inside each panel is the thing worth looking at. */
.panel h2 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-body-family);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .055em;
  color: var(--brand-ink-muted);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid > * { min-width: 0; }

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Auto-fit rather than a fixed 5 columns: at full width that stretched
   each card to ~340px around a single narrow box, wasting most of it.
   Capped card width keeps them compact and lets more fit per row. */
.grid-boxplots {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
}
@media (max-width: 480px) {
  .grid-boxplots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: var(--space-3);
}

/* Readouts, not buttons — no hover lift on a number you can't click. */
.stat-tile {
  background: var(--brand-inset);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  min-width: 0;
  border: 1px solid transparent;
}

.stat-tile .label {
  font-size: var(--font-caption);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-tile .value {
  font-family: var(--font-mono-family);
  font-size: var(--font-display);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-tile .value.value-range {
  font-size: 21px;
}

.stat-tiles-hero .stat-tile .value.value-compact {
  font-size: 22px;
}

.stat-tile .unit {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 3px;
  font-weight: 400;
}

.stat-tile .sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.hero-panel {
  background: var(--panel);
  border-color: var(--brand-border);
}

/* The headline figures. These DO earn emphasis — a surface that sits
   above the panel ground and a persistent left stripe encoding tone, so
   state reads at a glance instead of only on hover. */
.stat-tiles-hero .stat-tile {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  position: relative;
  overflow: hidden;
  padding-left: calc(var(--space-4) + 3px);
}

.stat-tiles-hero .stat-tile::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: var(--brand-border);
}

.stat-tiles-hero .stat-tile .value {
  font-size: 30px;
}

/* Emoji icons removed — they read as clip-art next to real instrument
   figures, and the tone stripe already encodes the same thing. */
.stat-tile-icon { display: none; }

/* Must match .stat-tiles-hero .stat-tile::before specificity (0,2,0) or
   the neutral default above wins and every stripe renders grey. */
.stat-tiles-hero .stat-tile-tone-accent::before { background: var(--brand-accent); }
.stat-tiles-hero .stat-tile-tone-good::before { background: var(--brand-good); }
.stat-tiles-hero .stat-tile-tone-warn::before { background: var(--brand-warn); }
.stat-tiles-hero .stat-tile-tone-danger::before { background: var(--brand-danger); }
.stat-tiles-hero .stat-tile-tone-accent-2::before { background: var(--brand-accent-2); }
.stat-tiles-hero .stat-tile[class*="stat-tile-tone-"]:hover::before { opacity: 1; }

.stat-tile-clickable {
  cursor: pointer;
  transition: background .1s;
}
.stat-tile-clickable:hover {
  background: var(--brand-accent-soft);
}

.fleet-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
}

.fleet-context-tile {
  background: var(--brand-inset);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.fleet-context-tile .label {
  font-size: var(--font-caption);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.fleet-context-tile .value-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 6px;
}

.fleet-context-tile .value {
  font-size: 18px;
  font-weight: 650;
  color: var(--text);
}

.fleet-context-tile .unit {
  font-size: 12px;
  color: var(--text-muted);
}

.fleet-context-tile .percentile-label {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

.fleet-context-bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

.fleet-context-bar .iqr-band {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--brand-accent);
  opacity: .35;
  border-radius: 3px;
}

.fleet-context-bar .marker {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--brand-accent);
  transform: translateX(-50%);
}

.fleet-context-bar .marker.flagged { background: var(--brand-danger); }

.fleet-context-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--brand-border);
  font-size: 11.5px;
  color: var(--text-muted);
}

.fleet-context-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fleet-context-legend .legend-swatch {
  display: inline-block;
  width: 16px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.fleet-context-legend .legend-swatch.track { background: var(--border); }
.fleet-context-legend .legend-swatch.iqr { background: var(--brand-accent); opacity: .35; }
.fleet-context-legend .legend-swatch.marker { background: var(--brand-accent); height: 12px; width: 3px; border-radius: 2px; }

.table-scroll {
  overflow-x: auto;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--brand-border);
}

.pagination-range {
  font-size: 12.5px;
  color: var(--brand-ink-muted);
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pagination-page {
  min-width: 30px;
  padding: 5px 8px;
  font-size: 12.5px;
}
.pagination-page.active {
  background: var(--brand-accent);
  color: #fff;
  border-color: var(--brand-accent);
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--brand-ink-faint);
  font-size: 12.5px;
}

.pagination-prev, .pagination-next {
  font-size: 12.5px;
  padding: 5px 10px;
}

/* ---------- Activity calendar + heatmap ---------- */

.panel-subnote {
  font-size: 11px;
  font-weight: 400;
  color: var(--brand-ink-faint);
  text-transform: none;
}

/* ---------- Lean / cylinder fuel-flow-spread analysis ---------- */

.lean-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.lean-select-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
}

.lean-select-chart-wrap canvas {
  width: 100%;
  height: 100%;
}

.lean-range-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lean-range-shade {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(37,99,235,.10);
  border-left: 1px solid var(--brand-accent);
  border-right: 1px solid var(--brand-accent);
}

.lean-range-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  margin-left: -7px;
  cursor: ew-resize;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lean-handle-grip {
  width: 4px;
  height: 36px;
  border-radius: 3px;
  background: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 1px 4px rgba(20,24,28,.25);
}

.lean-range-handle:hover .lean-handle-grip,
.lean-range-handle.dragging .lean-handle-grip {
  background: var(--brand-accent-hover);
}

.lean-range-readouts {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: 12.5px;
  color: var(--brand-ink-muted);
  flex-wrap: wrap;
}

.lean-range-readouts strong { color: var(--brand-ink); font-weight: 650; }

.lean-range-readout {
  font-size: 11px;
  color: var(--brand-ink-muted);
  font-variant-numeric: tabular-nums;
}

.lean-result {
  background: var(--brand-inset);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.lean-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.lean-spread-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand-ink);
}
.lean-spread-value .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-ink-muted);
}

.lean-result-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
}

.lean-cyl-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
}

.lean-cyl-row {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lean-cyl-name {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--brand-ink);
}

.lean-cyl-egt, .lean-cyl-ff {
  font-size: 11.5px;
  color: var(--brand-ink-muted);
  font-variant-numeric: tabular-nums;
}

.activity-calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.activity-year-row-grid {
  display: grid;
  grid-template-columns: 56px repeat(12, 1fr);
  gap: 3px;
  align-items: stretch;
}

.activity-month-head-row {
  margin-bottom: 2px;
}

.activity-month-head {
  font-size: 10px;
  font-weight: 600;
  color: var(--brand-ink-faint);
  text-align: center;
  padding-bottom: 2px;
}

.activity-year-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 650;
  color: var(--brand-ink-muted);
  font-variant-numeric: tabular-nums;
  padding-right: 6px;
}

.activity-year-total {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--brand-ink-faint);
}

/* A faint inset keeps the calendar lattice legible for months with no
   flights, without giving empty cells the visual weight of filled ones. */
.activity-month-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 5px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--brand-ink-muted);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}
/* Filled cells carry their own color and don't need the outline; only the
   transparent (zero-activity) ones keep it. */
.activity-month-cell:not([style*="transparent"]) {
  box-shadow: none;
}

.activity-month-cell.on-dark {
  color: #fff;
}

@media (max-width: 560px) {
  .activity-year-row-grid { grid-template-columns: 38px repeat(12, 1fr); }
  .activity-month-cell { min-height: 22px; font-size: 10px; }
}

#activity-heatmap-wrap {
  margin-top: var(--space-5);
}

.activity-heatmap-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-ink-muted);
  margin-bottom: var(--space-2);
}

.activity-hour-row-grid {
  grid-template-columns: 56px repeat(24, 1fr);
}

.activity-hour-head {
  justify-content: flex-start;
  font-weight: 600;
  font-size: 11px;
}

.activity-hour-cell {
  min-height: 16px;
}

@media (max-width: 560px) {
  .activity-hour-row-grid { grid-template-columns: 38px repeat(24, 1fr); }
  .activity-hour-cell { min-height: 12px; }
}

table.flights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-body);
}

table.flights-table th {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

table.flights-table th:hover { color: var(--accent); }

table.flights-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.flights-table tbody tr {
  cursor: pointer;
  transition: background .12s ease;
}

table.flights-table tbody tr:hover {
  background: var(--brand-accent-soft);
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-4);
}

.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-accent-soft);
  color: var(--brand-accent-hover);
  border-radius: var(--radius-pill);
  padding: 5px 8px 5px 14px;
  font-size: 12.5px;
  margin-bottom: var(--space-3);
}

.active-filter-pill button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  box-shadow: none;
}
.active-filter-pill button:hover { background: rgba(37,99,235,.12); box-shadow: none; transform: none; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: var(--font-caption);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .03em;
}

.field-checkbox {
  flex-direction: row;
  align-items: center;
}

.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--font-body);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.field-checkbox input[type="checkbox"] {
  width: auto;
  padding: 0;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 0;
}
.panel-header-row h2 { margin: 0; }

input, select, button {
  font-family: inherit;
  font-size: var(--font-body);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--brand-surface);
  color: var(--text);
}

input, select {
  transition: border-color .12s ease, box-shadow .12s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--brand-accent-soft);
}

button {
  background: linear-gradient(135deg, var(--brand-accent), var(--brand-accent-hover));
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: box-shadow .15s ease, transform .15s ease, background .15s ease;
}

button:hover { box-shadow: 0 3px 10px rgba(37,99,235,.3); transform: translateY(-1px); }
button:active { transform: translateY(0); box-shadow: none; }
button.secondary {
  background: var(--brand-surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}
button.secondary:hover { background: var(--brand-bg); box-shadow: none; transform: none; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.settings-field-group {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.settings-field-group .field { flex: 1; }
.settings-field-group input { width: 100%; }

.settings-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

/* ---------- Shared access (Settings) ---------- */

.access-invite-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-4);
}
.access-invite-row input { width: 100%; }
.access-invite-row button { flex: none; }

.access-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--brand-border);
}

.access-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--brand-border);
}

.access-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.access-email {
  font-size: var(--font-body);
  font-weight: 500;
  color: var(--brand-ink);
  overflow-wrap: anywhere;
}

.access-state {
  font-size: var(--font-caption);
  color: var(--brand-ink-muted);
}
.access-state.is-pending { color: var(--brand-warn); }

.access-revoke {
  flex: none;
  background: transparent;
  border: 1px solid var(--brand-border);
  color: var(--brand-ink-muted);
  padding: 5px 11px;
  font-size: var(--font-caption);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: none;
}
.access-revoke:hover {
  border-color: var(--brand-danger);
  color: var(--brand-danger);
  background: var(--brand-danger-soft);
  box-shadow: none;
  transform: none;
}

.access-empty {
  padding: var(--space-4) 0;
  font-size: var(--font-body);
  color: var(--brand-ink-faint);
}

@media (max-width: 560px) {
  .access-invite-row { flex-direction: column; align-items: stretch; }
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
  transition: border-color .15s, background .15s;
  cursor: pointer;
}

.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--brand-accent-soft);
}

/* ---------- Upload progress ---------- */

#upload-progress-container {
  margin-top: var(--space-4);
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-body);
  color: var(--brand-ink);
  margin-bottom: var(--space-2);
}

#upload-progress-count {
  color: var(--brand-ink-muted);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}

.upload-progress-bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-inset);
  overflow: hidden;
}

.upload-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--brand-accent);
  border-radius: var(--radius-pill);
  transition: width .2s ease-out;
}

.upload-progress-log {
  max-height: 160px;
  overflow-y: auto;
  margin-top: var(--space-3);
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: var(--brand-ink-muted);
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.upload-progress-log-row.imported { color: var(--brand-good); }
.upload-progress-log-row.duplicate { color: var(--brand-ink-faint); }
.upload-progress-log-row.skipped { color: var(--brand-warn); }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--font-caption);
  font-weight: 600;
}

.pill.good { background: var(--brand-good-soft); color: var(--brand-good); }
.pill.muted { background: var(--brand-border); color: var(--text-muted); }
.pill.info { background: var(--brand-accent-soft); color: var(--brand-accent); }
.pill.warn { background: var(--brand-warn-soft); color: var(--brand-warn); }
.pill.danger { background: var(--brand-danger-soft); color: var(--brand-danger); }

.row-export-link {
  font-size: 12px;
  color: var(--brand-accent);
  text-decoration: none;
}
.row-export-link:hover { text-decoration: underline; }

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--font-body);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 400px;
  z-index: 1000;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { background: var(--danger); }

.chart-wrap { position: relative; height: 220px; margin-bottom: 8px; min-width: 0; }
.chart-wrap.tall { height: 320px; }
.chart-wrap canvas { max-width: 100%; }

.boxplot-card {
  background: var(--brand-inset);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 9px 10px 7px;
}

.boxplot-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 4px;
}

/* The metric name is what you scan for — it was set smaller than the
   axis tick numbers, so the scale read louder than the subject. */
.boxplot-title {
  font-size: 12.5px;
  color: var(--brand-ink);
  font-weight: 700;
  letter-spacing: -.005em;
  line-height: 1.25;
}

/* Ten of these sit in one grid; as outlined accent pills they out-shouted
   the charts they belong to. Recede to a quiet caption and only read as a
   control on hover/focus. */
.boxplot-range-toggle {
  flex: none;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 6px;
  background: transparent;
  color: var(--brand-ink-faint);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: none;
  transition: color .12s ease, border-color .12s ease;
}
.boxplot-card:hover .boxplot-range-toggle { color: var(--brand-ink-muted); }
.boxplot-range-toggle:hover,
.boxplot-range-toggle:focus-visible {
  color: var(--brand-accent);
  border-color: var(--brand-border);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.flight-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

.flight-header .title { font-size: var(--font-h1); font-weight: 650; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.flight-header .subtitle { color: var(--text-muted); font-size: var(--font-body); margin-top: 4px; }

.flag-note {
  font-size: var(--font-body);
  color: var(--text-muted);
  background: var(--brand-inset);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
}

.channel-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.channel-toggle {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--brand-surface);
  cursor: pointer;
  user-select: none;
}

/* Fuel flow isn't a cylinder — it's the input driving them, on its own
   axis. Set apart so the toggle row doesn't read as "7 cylinders". */
.channel-toggle-ff {
  margin-left: var(--space-3);
  position: relative;
}
.channel-toggle-ff::before {
  content: '';
  position: absolute;
  left: calc(var(--space-3) / -2 - 1px);
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: var(--brand-border);
}

.channel-toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#map { height: 420px; border-radius: var(--radius); }
.fleet-map { height: 360px; border-radius: var(--radius); }
.fleet-map .route-line-clickable { cursor: pointer; }

/* Leaflet draws its own chrome (zoom buttons, attribution, popups) inline
   with fixed light-mode colors — none of it reacts to our theme tokens on
   its own, so it needs explicit dark-mode overrides here. */
:root[data-theme="dark"] .leaflet-bar a,
:root[data-theme="dark"] .leaflet-control-layers,
:root[data-theme="dark"] .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .leaflet-popup-tip {
  background: var(--brand-surface);
  color: var(--brand-ink);
  border-color: var(--brand-border);
}
:root[data-theme="dark"] .leaflet-bar a:hover {
  background: var(--brand-inset);
}
:root[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(29, 33, 39, .8);
  color: var(--brand-ink-muted);
}
:root[data-theme="dark"] .leaflet-control-attribution a {
  color: var(--brand-accent);
}

.map-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2, 8px);
}

.map-card-header h2 { margin: 0; }

.map-card-actions {
  display: flex;
  gap: var(--space-1, 4px);
  flex-shrink: 0;
}

.map-fullscreen-btn,
.map-basemap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  padding: 0;
  line-height: 1;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  box-shadow: none;
  transform: none;
}

.map-fullscreen-btn:hover,
.map-basemap-btn:hover {
  background: var(--border);
  box-shadow: none;
  transform: none;
}

.map-card.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--panel-bg);
  padding: var(--space-4, 16px);
  display: flex;
  flex-direction: column;
}

.map-card.is-fullscreen .fleet-map {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

/* ---------- Flight-detail chart cards: fullscreen + custom builder ---------- */

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.chart-card-header h2 { margin: 0; }

.chart-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.chart-fullscreen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  padding: 0;
  line-height: 1;
  font-size: 15px;
  cursor: pointer;
  color: var(--brand-ink-muted);
  flex-shrink: 0;
  box-shadow: none;
  transform: none;
  transition: background .12s ease;
}
.chart-fullscreen-btn:hover { background: var(--brand-bg); box-shadow: none; transform: none; }

.chart-card.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--brand-surface);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.custom-chart-launcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Centered-dialog modal pattern — distinct from .custom-chart-modal's
   full-page takeover, used for smaller focused tasks (e.g. the export
   flight picker) that don't need the whole viewport. */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(10, 12, 15, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--brand-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: min(640px, 90vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--brand-border);
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: var(--font-h1); }

.modal-close {
  background: none;
  border: none;
  box-shadow: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text); box-shadow: none; transform: none; }

.modal-body {
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--brand-border);
  flex-shrink: 0;
}

.export-selection-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space-3);
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
}

.export-selection-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  border-bottom: 1px solid var(--brand-border);
}
.export-selection-row:last-child { border-bottom: none; }
.export-selection-row:hover { background: var(--brand-bg); }
.export-selection-row .flight-export-raw-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--brand-accent);
}

.custom-chart-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--brand-surface);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  margin: 0;
  border-radius: 0;
}

.custom-chart-modal[hidden] { display: none; }

.custom-chart-modal .custom-chart-layout {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.custom-chart-modal .custom-chart-main {
  min-height: 0;
}

.custom-chart-modal .custom-chart-main .chart-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.chart-card.is-fullscreen .chart-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 320px;
}

.chart-card.is-fullscreen .custom-chart-layout {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.chart-card.is-fullscreen .custom-chart-main {
  min-height: 0;
}

.chart-card.is-fullscreen .custom-chart-main .chart-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

/* Custom chart builder */

.custom-chart-layout {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.custom-chart-metric-list {
  flex: 0 0 170px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.custom-chart-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.custom-metric-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--brand-inset);
  border: 1px solid var(--brand-border);
  font-size: 12.5px;
  cursor: grab;
  user-select: none;
  transition: border-color .12s ease, background .12s ease;
}
.custom-metric-chip:hover { border-color: var(--brand-accent); }
.custom-metric-chip.dragging { opacity: .4; }
.custom-metric-chip.placed { opacity: .45; cursor: default; }

.custom-metric-chip .swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.custom-chart-dropzones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.custom-chart-dropzone {
  border: 1.5px dashed var(--brand-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  min-height: 56px;
  transition: border-color .12s ease, background .12s ease;
}

.custom-chart-dropzone.drag-over {
  border-color: var(--brand-accent);
  background: var(--brand-accent-soft);
}

.custom-chart-dropzone-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand-ink-faint);
  margin-bottom: 6px;
}

.custom-chart-dropzone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.custom-chart-dropzone-chips .custom-metric-chip {
  cursor: default;
  padding: 4px 8px 4px 9px;
}

.custom-chart-dropzone-chips .remove-chip {
  background: none;
  border: none;
  color: var(--brand-ink-faint);
  cursor: pointer;
  padding: 0 0 0 4px;
  font-size: 13px;
  line-height: 1;
}
.custom-chart-dropzone-chips .remove-chip:hover { color: var(--brand-danger); }

@media (max-width: 760px) {
  .custom-chart-layout { flex-direction: column; }
  .custom-chart-metric-list { flex: none; width: 100%; max-height: 160px; flex-direction: row; flex-wrap: wrap; }
  .custom-chart-dropzones { grid-template-columns: 1fr; }
}


.route-map-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  margin-bottom: var(--space-2, 8px);
  flex-wrap: wrap;
}

.route-map-controls label {
  font-size: 12px;
  color: var(--text-secondary, #52514e);
  white-space: nowrap;
}

.route-map-controls input[type="range"] {
  flex: 1 1 120px;
  max-width: 180px;
}

.route-map-controls .hint {
  font-size: 11px;
  color: var(--text-muted, #898781);
}

/* ---------- Top airports / routes ---------- */

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 7px 0;
  border-bottom: 1px solid var(--brand-border);
  font-size: var(--font-body);
}
.rank-row:last-child { border-bottom: none; }

.rank-row-clickable {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--brand-border);
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .12s ease;
}
.rank-row-clickable:last-child { border-bottom: none; }
.rank-row-clickable:hover { background: var(--brand-accent-soft); box-shadow: none; transform: none; }

.lean-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lean-history-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 4px;
  border-bottom: 1px solid var(--brand-border);
  font-size: var(--font-body);
  color: var(--brand-ink);
  transition: background .12s ease;
}
.lean-history-row:last-child { border-bottom: none; }
.lean-history-row:hover { background: var(--brand-bg); text-decoration: none; }

.lean-history-date { color: var(--brand-ink-muted); font-size: 12px; width: 140px; flex: none; }
.lean-history-flight { flex: 1; font-weight: 500; }
.lean-history-spread { font-weight: 650; font-variant-numeric: tabular-nums; }

.rank-index {
  width: 18px;
  flex: none;
  color: var(--brand-ink-faint);
  font-size: 12px;
  text-align: right;
}

.rank-label {
  flex: 1;
  color: var(--brand-ink);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-label .rank-sub {
  color: var(--brand-ink-muted);
  font-weight: 400;
  font-size: 12px;
}

.rank-bar-wrap {
  flex: none;
  width: 90px;
  height: 6px;
  background: var(--brand-inset);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.rank-bar {
  height: 100%;
  background: var(--brand-accent);
  border-radius: var(--radius-pill);
}

.rank-count {
  flex: none;
  width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--brand-ink-muted);
  font-size: 12.5px;
}

.replay-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.replay-controls input[type=range] { flex: 1; min-width: 160px; }
.replay-time { font-family: ui-monospace, monospace; font-size: 13px; min-width: 150px; }

/* Left-aligned and modestly padded: a one-line "nothing here" message
   doesn't need a 40px-tall centered void to announce itself. */
.empty-state {
  padding: var(--space-4) 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-body);
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ---------- Upload summary panel ---------- */

.upload-summary {
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-top: var(--space-4);
  background: var(--brand-inset);
  position: relative;
}

.upload-summary .dismiss-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: transparent;
  color: var(--brand-ink-muted);
  border: none;
  padding: 2px 8px;
  font-size: 16px;
  line-height: 1;
}
.upload-summary .dismiss-btn:hover { color: var(--brand-ink); background: transparent; }

.upload-summary h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--font-body);
  font-weight: 650;
}

.upload-summary .imported-list, .upload-summary .skipped-list {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--brand-ink-muted);
}
.upload-summary .imported-list li, .upload-summary .skipped-list li {
  padding: 3px 0;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--brand-border);
  padding: var(--space-3) 0;
  color: var(--brand-ink-faint);
  font-size: 11px;
}

.site-footer .container {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.site-footer a {
  color: var(--brand-ink-faint);
  text-decoration: underline;
}
.site-footer a:hover { color: var(--brand-ink-muted); }

.site-footer-version {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  opacity: .75;
}

/* ---------- Anomaly badge + banner ---------- */

.anomaly-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-warn-soft);
  color: var(--brand-warn);
}

.anomaly-banner {
  background: var(--brand-warn-soft);
  border: 1px solid var(--brand-warn-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}

.anomaly-banner.threshold-banner {
  background: var(--brand-danger-soft);
  border-color: var(--brand-danger);
}

.anomaly-banner-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.anomaly-banner-icon {
  font-size: 20px;
  line-height: 1;
}

.anomaly-banner-title {
  font-weight: 700;
  font-size: var(--font-body);
  color: var(--brand-ink);
}

.anomaly-banner-subtitle {
  font-size: 12.5px;
  color: var(--brand-ink-muted);
  margin-top: 2px;
}

.anomaly-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.anomaly-row {
  font-size: 13px;
  padding: var(--space-2) var(--space-3);
  background: var(--brand-surface);
  border-radius: var(--radius-sm);
  color: var(--brand-ink);
}

.anomaly-row-metric {
  font-weight: 650;
  margin-bottom: 2px;
}

.anomaly-row-detail {
  color: var(--brand-ink-muted);
}
.anomaly-row-detail strong { color: var(--brand-ink); font-weight: 650; }

.anomaly-row-bar {
  margin-top: var(--space-2);
  max-width: 260px;
}

/* ---------- Fleet anomaly summary panel ---------- */

.anomaly-range-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.anomaly-range-btns {
  display: flex;
  gap: var(--space-2);
}

.anomaly-range-btn.active {
  background: var(--brand-accent);
  color: #fff;
  border-color: var(--brand-accent);
}

.anomaly-range-custom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--text-muted);
}

/* Sits under the chips: the chips are the summary, this opens the detail. */
.anomaly-summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-3);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--brand-accent);
  box-shadow: none;
}
.anomaly-summary-toggle:hover {
  color: var(--brand-accent-hover);
  text-decoration: underline;
  box-shadow: none;
  transform: none;
  background: none;
}

.anomaly-summary-toggle .anomaly-summary-chevron {
  transition: transform .15s;
  flex: none;
  line-height: 1;
}
.anomaly-summary-toggle.expanded .anomaly-summary-chevron { transform: rotate(180deg); }

.anomaly-summary-intro {
  font-size: var(--font-body);
  color: var(--brand-ink-muted);
  margin: 0;
}

.anomaly-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.anomaly-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-inset);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-size: 12px;
}

.anomaly-chip-label {
  font-weight: 600;
  color: var(--brand-ink);
}

.anomaly-chip-high { color: var(--brand-danger); font-weight: 600; }
.anomaly-chip-low { color: var(--brand-accent); font-weight: 600; }

.anomaly-summary-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.anomaly-summary-row {
  border: 1px solid var(--brand-border);
  border-left: 3px solid var(--brand-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-left-color .15s ease;
}
.anomaly-summary-row:has(.anomaly-summary-direction.high) { border-left-color: var(--brand-danger); }
.anomaly-summary-row:has(.anomaly-summary-direction.low) { border-left-color: var(--brand-accent); }

.anomaly-summary-row-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--brand-surface);
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .12s ease;
}
.anomaly-summary-row-head:hover { background: var(--brand-bg); }

.anomaly-summary-direction {
  font-size: 13px;
  font-weight: 700;
  width: 18px;
  flex: none;
  text-align: center;
}
.anomaly-summary-direction.high { color: var(--brand-danger); }
.anomaly-summary-direction.low { color: var(--brand-accent); }

.anomaly-summary-label {
  flex: 1;
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--brand-ink);
}

.anomaly-summary-chevron {
  color: var(--brand-ink-faint);
  transition: transform .15s;
  flex: none;
}
.anomaly-summary-row.expanded .anomaly-summary-chevron { transform: rotate(180deg); }

.anomaly-summary-detail {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--brand-border);
}
.anomaly-summary-row.expanded .anomaly-summary-detail { display: flex; }

.anomaly-summary-detail > .range-bar {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--brand-border);
}

.anomaly-summary-flights {
  display: flex;
  flex-direction: column;
}

.anomaly-summary-flight {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  font-size: 13px;
  color: var(--brand-ink);
  border-bottom: 1px solid var(--brand-border);
}
.anomaly-summary-flight:last-child { border-bottom: none; }
.anomaly-summary-flight:hover { background: var(--brand-bg); text-decoration: none; }

.anomaly-summary-flight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
}
.anomaly-summary-flight .value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--brand-ink-muted);
}

.range-bar {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.range-bar-track {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--brand-border);
}

.range-bar-typical {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--brand-accent-soft);
  border-radius: 4px;
}

.range-bar-marker {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--brand-ink-muted);
  transform: translateX(-50%);
}
.range-bar-marker.flagged { background: var(--brand-danger); }

.range-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--brand-ink-faint);
  font-variant-numeric: tabular-nums;
}

.range-bar-typical-label {
  font-variant-numeric: normal;
}

/* ---------- Admin dashboard ---------- */

.admin-aircraft-card {
  background: var(--brand-inset);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}

.admin-aircraft-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.admin-aircraft-head .hint { margin-left: auto; color: var(--text-muted); font-size: 12px; }

.admin-access-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.admin-access-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  padding: var(--space-2) var(--space-3);
  background: var(--brand-surface);
  border-radius: var(--radius-sm);
}
.admin-access-row span:first-child { flex: 1; }

.admin-grant-form {
  display: flex;
  gap: var(--space-2);
}
.admin-grant-form input { flex: 1; }

/* ---------- Mixture analysis (lean.html) ---------- */

.lean-empty-body {
  font-size: var(--font-body);
  color: var(--brand-ink-muted);
  line-height: 1.65;
  max-width: 62ch;
  margin: 0 0 var(--space-4);
}

.lean-explainer {
  display: block;
  max-width: 78ch;
  line-height: 1.6;
  margin: calc(var(--space-4) * -1 + 2px) 0 var(--space-4);
}

.lean-verdict { margin-bottom: var(--space-5); }

.lean-verdict-card {
  border-left: 3px solid var(--brand-border);
  padding: var(--space-3) 0 var(--space-3) var(--space-4);
}
.lean-verdict-warn { border-left-color: var(--brand-warn); }
.lean-verdict-good { border-left-color: var(--brand-good); }
.lean-verdict-neutral { border-left-color: var(--brand-ink-faint); }

.lean-verdict-title {
  font-family: var(--font-display-family);
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-ink);
  margin-bottom: 5px;
}
.lean-verdict-body {
  margin: 0;
  font-size: var(--font-body);
  color: var(--brand-ink-muted);
  line-height: 1.65;
  max-width: 76ch;
}

/* Diverging per-cylinder offset chart */
.lean-cyl-chart { display: flex; flex-direction: column; gap: 2px; }

/* Must use the same column template and gap as .lean-cyl-row so the
   "run midpoint" caption sits exactly over the centre line. */
.lean-cyl-axis {
  display: grid;
  grid-template-columns: 76px 1fr 64px 190px;
  gap: var(--space-3);
  align-items: center;
  font-size: var(--font-caption);
  color: var(--brand-ink-faint);
  margin-bottom: var(--space-2);
}
.lean-cyl-axis .lean-axis-end { grid-column: 2; grid-row: 1; justify-self: start; }
.lean-cyl-axis .lean-axis-mid { grid-column: 2; grid-row: 1; justify-self: center; }
.lean-cyl-axis .lean-axis-end-right { grid-column: 2; grid-row: 1; justify-self: end; }

.lean-cyl-row {
  display: grid;
  grid-template-columns: 76px 1fr 64px 190px;
  align-items: center;
  gap: var(--space-3);
  padding: 7px 0;
  border-bottom: 1px solid var(--brand-border);
}
.lean-cyl-row:last-of-type { border-bottom: none; }

.lean-cyl-name {
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}

.lean-cyl-track {
  position: relative;
  height: 22px;
  background: var(--brand-inset);
  border-radius: var(--radius-sm);
}

/* The zero line every bar is measured from — needs to be clearly visible
   or the diverging bars have no readable reference. */
.lean-cyl-center {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--brand-ink-muted);
  opacity: .85;
  border-radius: 1px;
}

.lean-cyl-bar {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 2px;
  min-width: 2px;
}
/* Lean and rich are descriptive, not good/bad — a cylinder peaking richer
   isn't an alarm state. Two ends of one cool/warm pair, with --brand-danger
   deliberately not used so it stays reserved for real limit exceedances. */
.lean-cyl-bar-lean { background: var(--brand-accent); }
.lean-cyl-bar-rich { background: var(--mix-rich); }

.lean-run-dot {
  position: absolute;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--brand-ink);
  opacity: .28;
  pointer-events: auto;
}

.lean-cyl-value {
  font-family: var(--font-mono-family);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.lean-cyl-value-lean { color: var(--brand-accent); }
.lean-cyl-value-rich { color: var(--mix-rich); }

.lean-cyl-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--font-caption);
  color: var(--brand-ink-faint);
}

.lean-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}
.lean-tag-lean { background: var(--brand-accent-soft); color: var(--brand-accent); }
.lean-tag-rich { background: var(--mix-rich-soft); color: var(--mix-rich-ink); }

.lean-consistency { font-variant-numeric: tabular-nums; }

.lean-cyl-legend {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--font-caption);
  color: var(--brand-ink-faint);
}
.lean-cyl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lean-legend-bar {
  width: 16px; height: 8px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-accent) 50%, var(--mix-rich) 50%);
  display: inline-block;
}
.lean-legend-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-ink); opacity: .28; display: inline-block;
}

table.lean-runs { width: 100%; border-collapse: collapse; }
table.lean-runs th {
  text-align: left;
  font-size: var(--font-caption);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand-ink-faint);
  font-weight: 600;
  padding: 0 var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--brand-border);
}
table.lean-runs td {
  padding: 9px var(--space-3);
  font-size: var(--font-body);
  border-bottom: 1px solid var(--brand-border);
}
table.lean-runs tbody tr { cursor: pointer; }
table.lean-runs tbody tr:hover { background: var(--brand-inset); }
table.lean-runs .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono-family); }
.lean-order-cell { font-family: var(--font-mono-family); letter-spacing: .02em; color: var(--brand-ink-muted); }

@media (max-width: 900px) {
  .lean-cyl-row, .lean-cyl-axis { grid-template-columns: 60px 1fr 56px; }
  .lean-cyl-meta { display: none; }
}

/* Airport identifier labels on the routes map. Placed by a collision
   check at the current zoom (see updateRouteAirportLabels), so they thin
   out when zoomed out rather than piling into an unreadable mass. */
.route-airport-label {
  background: none;
  border: none;
  white-space: nowrap;
  pointer-events: none;
}
.route-airport-label span {
  font-family: var(--font-mono-family);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--brand-ink);
  background: color-mix(in srgb, var(--brand-surface) 82%, transparent);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ---------- Per-cylinder CHT distribution ---------- */

.cyl-health-explainer {
  display: block;
  max-width: 78ch;
  line-height: 1.6;
  margin: calc(var(--space-4) * -1 + 2px) 0 var(--space-4);
}

.cyl-chart { display: flex; flex-direction: column; gap: 2px; }

.cyl-row {
  display: grid;
  grid-template-columns: 62px 1fr 66px 62px;
  align-items: center;
  gap: var(--space-3);
  padding: 7px 0;
  border-bottom: 1px solid var(--brand-border);
}
.cyl-row:last-of-type { border-bottom: none; }

.cyl-label {
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--brand-ink);
}

.cyl-track {
  position: relative;
  height: 20px;
  background: var(--brand-inset);
  border-radius: var(--radius-sm);
}

/* Interquartile band: where this cylinder's peak lands on a typical flight. */
.cyl-band {
  position: absolute;
  top: 5px;
  bottom: 5px;
  background: var(--brand-accent);
  opacity: .32;
  border-radius: 2px;
}
.cyl-row-hot .cyl-band { background: var(--brand-warn); opacity: .38; }

.cyl-median {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 2px;
  margin-left: -1px;
  background: var(--brand-accent);
  border-radius: 1px;
}
.cyl-row-hot .cyl-median { background: var(--brand-warn); }

.cyl-p95 {
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--brand-ink-muted);
}

/* The configured alarm limit, drawn through every row at the same x so
   you can see how much headroom each cylinder actually has. */
.cyl-alarm {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 1px;
  background: var(--brand-danger);
  opacity: .5;
}

.cyl-readout {
  font-family: var(--font-mono-family);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--brand-ink);
}
.cyl-unit { color: var(--brand-ink-faint); font-size: 10.5px; margin-left: 1px; }

.cyl-flag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand-warn);
}

.cyl-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  font-size: var(--font-caption);
  color: var(--brand-ink-faint);
  font-variant-numeric: tabular-nums;
}
.cyl-legend { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.cyl-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.cyl-key-band { width: 14px; height: 7px; border-radius: 2px; background: var(--brand-accent); opacity: .32; }
.cyl-key-median { width: 2px; height: 11px; background: var(--brand-accent); }
.cyl-key-p95 { width: 5px; height: 5px; border-radius: 50%; background: var(--brand-ink-muted); }
.cyl-key-alarm { width: 1px; height: 11px; background: var(--brand-danger); opacity: .6; }

@media (max-width: 760px) {
  .cyl-row { grid-template-columns: 52px 1fr 58px; }
  .cyl-flag { display: none; }
  .cyl-legend { display: none; }
}

/* Keeps an unavailable metric the same height as its populated siblings
   so the grid doesn't develop ragged rows. */
.boxplot-empty {
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--font-caption);
  line-height: 1.5;
  color: var(--brand-ink-faint);
  padding: 0 6px;
}
