/* ────────────────────────────────────────────────────────────────
   CHARIOT OPS — design tokens follow the Chariot proposal system
   and client dashboard (navy / cream / signal-yellow).
   Dark mode is default; light mode via [data-theme="light"].
   Layout targets 1280px → 2560px. Not built for mobile (by design).
──────────────────────────────────────────────────────────────── */

:root {
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Montserrat", -apple-system, sans-serif;

  /* dark (default) */
  --bg: #0a1f33;
  --bg-2: #0d2540;
  --card: #103050;
  --card-edge: rgba(255, 255, 255, 0.07);
  --ink: #f2f5f8;
  --ink-muted: #9fb2c4;
  --accent: #e6ff3a;          /* signal yellow */
  --accent-ink: #0a1f33;
  --link: #cfe4ff;
  --ok: #35d29a;
  --warn: #f5b83d;
  --err: #f06a6a;
  --pill-bg: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --bg: #f7f5f0;              /* cream */
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-edge: rgba(10, 31, 51, 0.10);
  --ink: #14273b;
  --ink-muted: #5b6d7f;
  --accent: #1b5d8c;          /* light mode uses the deep blue accent */
  --accent-ink: #ffffff;
  --link: #1b5d8c;
  --pill-bg: rgba(10, 31, 51, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { min-width: 1100px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; width: min(1560px, 92vw); margin: 0 auto; padding: 40px 0 64px; }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; gap: 40px;
  padding: 18px 4vw;
  background: var(--bg-2);
  border-bottom: 2px solid var(--accent);
}
.brand { font-weight: 700; letter-spacing: 0.35em; font-size: 17px; }
.brand-sub { color: var(--accent); letter-spacing: 0.35em; }
.nav { display: flex; gap: 28px; flex: 1; }
.nav a {
  color: var(--ink-muted); text-decoration: none; font-weight: 600;
  font-size: 13px; letter-spacing: 0.04em; padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.nav a.on, .nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 16px; }
.whoami { color: var(--ink-muted); font-size: 13px; }
.logout { color: var(--link); font-size: 13px; text-decoration: none; }
.theme-btn {
  background: transparent; color: var(--ink); border: 1.5px solid var(--card-edge);
  border-radius: 50%; width: 34px; height: 34px; font-size: 16px; cursor: pointer;
}
.theme-btn:hover { border-color: var(--accent); }

/* ── Type ── */
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.28em;
  color: var(--ink-muted); margin-bottom: 6px;
}
.display {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(34px, 3vw, 52px); line-height: 1.1; margin-bottom: 28px;
}
.muted { color: var(--ink-muted); }
.small { font-size: 12.5px; margin-top: 12px; }
.accent { color: var(--accent); }

/* ── Cards ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 22px; margin-bottom: 22px; }
.card {
  background: var(--card); border: 1px solid var(--card-edge);
  border-radius: 14px; padding: 26px 28px;
}
.card-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.24em;
  color: var(--ink-muted); margin-bottom: 16px;
}

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; }
.table td, .table th { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--card-edge); text-align: left; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.thead th { font-size: 11px; letter-spacing: 0.14em; color: var(--ink-muted); font-weight: 700; }
.num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tcell { max-width: 420px; }

/* ── Pills ── */
.pill {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; background: var(--pill-bg);
}
.pill-ok { color: var(--ok); }
.pill-err { color: var(--err); }
.pill-wait { color: var(--warn); }

/* ── Forms ── */
label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink-muted); margin: 16px 0 6px; }
input, select {
  width: 100%; padding: 11px 14px; border-radius: 8px;
  border: 1.5px solid var(--card-edge); background: var(--bg-2); color: var(--ink);
  font-family: var(--font-body); font-size: 14.5px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.code-input { letter-spacing: 0.5em; font-size: 22px; text-align: center; }

.btn-primary {
  display: inline-block; margin-top: 22px; padding: 13px 30px;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px; font-family: var(--font-body);
  font-weight: 700; font-size: 14.5px; cursor: pointer; text-decoration: none;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-mini {
  padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--card-edge);
  background: transparent; color: var(--ink); font-size: 12px; cursor: pointer;
}
.btn-mini:hover { border-color: var(--accent); }
.btn-mini:disabled { opacity: 0.35; cursor: default; }
.inline { display: inline-flex; gap: 6px; }
.actions { white-space: nowrap; }

/* ── Auth screens ── */
.auth-wrap { display: flex; justify-content: center; padding: 7vh 0; }
.auth-card {
  width: 460px; background: var(--card); border: 1px solid var(--card-edge);
  border-radius: 16px; padding: 44px 48px;
}
.auth-card.wide { width: 620px; }
.brand-lg { font-weight: 700; letter-spacing: 0.4em; font-size: 15px; margin-bottom: 26px; }
.auth-foot { margin-top: 22px; font-size: 13px; }
.auth-foot a { color: var(--link); }

.notice { border-radius: 8px; padding: 11px 14px; font-size: 13.5px; margin: 14px 0; }
.notice.ok { background: rgba(53, 210, 154, 0.12); color: var(--ok); }
.notice.err { background: rgba(240, 106, 106, 0.12); color: var(--err); }

.steps { margin: 0 0 18px 18px; color: var(--ink-muted); }
.steps li { margin-bottom: 6px; }
.qr-box { background: #ffffff; width: 216px; padding: 12px; border-radius: 10px; margin: 8px 0 14px; }
.secret { user-select: all; font-size: 14px; letter-spacing: 0.06em; }
.codes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 22px 0; }
.codes-grid code {
  background: var(--bg-2); border: 1px solid var(--card-edge); border-radius: 8px;
  padding: 10px; text-align: center; font-size: 14px; letter-spacing: 0.08em;
}

.footer {
  padding: 22px 4vw; color: var(--ink-muted); font-size: 12px;
  border-top: 1px solid var(--card-edge);
}

/* ── Phase 1: filter bar, tiles, meters ── */
.filterbar {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 18px;
  background: var(--card); border: 1px solid var(--card-edge);
  border-radius: 14px; padding: 16px 22px; margin-bottom: 22px;
}
.filter-group { display: flex; flex-direction: column; }
.filter-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em; color: var(--ink-muted); margin: 0 0 6px; }
.filterbar select, .filterbar input[type=date] {
  width: auto; min-width: 150px; padding: 8px 12px; font-size: 13.5px;
}
.dates-pair { display: flex; gap: 8px; }
.btn-filter {
  padding: 9px 22px; border-radius: 999px; border: 1.5px solid var(--accent);
  background: transparent; color: var(--ink); font-weight: 700; font-size: 13px; cursor: pointer;
}
.btn-filter:hover { background: var(--accent); color: var(--accent-ink); }
.filter-range-note { margin-left: auto; color: var(--ink-muted); font-size: 12.5px; align-self: center; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-bottom: 22px; }
.tile {
  background: var(--card); border: 1px solid var(--card-edge);
  border-radius: 14px; padding: 20px 24px;
}
.tile-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.2em; color: var(--ink-muted); }
.tile-value { font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 6px 0 2px; }
.tile-sub { font-size: 12.5px; color: var(--ink-muted); }
.tile-warn { border-color: rgba(245, 184, 61, 0.55); }
.tile-warn .tile-value { color: var(--warn); }

.chart { width: 100%; }

.meter-cell { min-width: 120px; }
.meter {
  display: inline-block; width: 110px; height: 8px; border-radius: 999px;
  background: var(--pill-bg); overflow: hidden; vertical-align: middle;
}
.meter-fill { display: block; height: 100%; border-radius: 999px; }
.meter-good { background: #2fae83; }
.meter-warn { background: #d99a26; }
.meter-low  { background: #3d8fd1; }
.meter-over { background: #e05c5c; }

.ribbon-warn { border-color: rgba(245, 184, 61, 0.55); }
.small-table td, .small-table th { padding: 6px 10px 6px 0; font-size: 13px; }
.ext { color: var(--link); text-decoration: none; }
.ext:hover { text-decoration: underline; }
a.small { font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: 10px; }

/* ── Server-rendered bars ── */
:root { --neutral-seg: #6b7c8d; }
[data-theme="light"] { --neutral-seg: #8a99a8; }
.hbars { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.hbar-row { display: grid; grid-template-columns: 170px 1fr 74px; align-items: center; gap: 12px; }
.hbar-label { font-size: 13px; color: var(--ink); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { background: var(--pill-bg); border-radius: 4px; height: 18px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 4px; }
.hbar-stack { display: flex; height: 100%; gap: 2px; }
.hseg { display: block; height: 100%; border-radius: 3px; min-width: 3px; }
.hbar-value { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.hbar-legend { display: flex; gap: 18px; margin-bottom: 12px; }
.legend-item { font-size: 12px; color: var(--ink-muted); display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── UX fixes (July 13 feedback) ── */
[hidden] { display: none !important; }              /* custom dates truly hide */
a { color: var(--link); }                           /* no default browser blue */
select {
  appearance: none; -webkit-appearance: none;       /* consistent chevron, inset from edge */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239fb2c4' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
input[type=date]:disabled { opacity: 0.45; cursor: not-allowed; }
.page-note { margin: 0 0 22px; }                    /* consistent gap before section cards */
