/* Bullet Dashboard — app layout & components. Tokens live in theme.css and
   follow the Brand Guide: navy text on white cards over an off-white page,
   the gradient only as an accent (top strip, section underlines, hover edges),
   teal focus rings, cyan for links / active states. */

[hidden] { display: none !important; } /* author display rules must not defeat the hidden attribute */

/* ---------- type helpers ---------- */
h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; }
a { color: var(--accent); }
.hint { font-size: .78rem; color: var(--muted); }
/* short gradient rule under section headings */
.rule::after, .card > h2::after, .card-head h2::after, .home-dept-head h2::after {
  content: ""; display: block; width: 44px; height: 3px; border-radius: 2px;
  background: var(--gradient-bright); margin-top: 6px;
}

/* ---------- buttons ---------- */
button { font-family: inherit; }
.btn-brand {
  background: var(--navy); color: #fff; border: 1px solid var(--navy); border-radius: 8px;
  padding: 12px 18px; font: inherit; font-weight: 700; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-brand:hover { background: #0B2D57; box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 28%, transparent); }
.btn-brand:active { transform: translateY(1px); }
.btn-brand:disabled { opacity: .6; cursor: default; }
:root[data-theme="dark"] .btn-brand { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
:root[data-theme="dark"] .btn-brand:hover { background: #2FC2DB; }
.ghost {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--ink); padding: 7px 12px; font: inherit; font-size: .78rem;
  font-weight: 600; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.ghost:hover { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.ghost[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.ghost.small { padding: 4px 9px; font-size: .72rem; }
.ghost.danger { color: var(--crit); }
.linkish { background: none; border: 0; color: var(--accent); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; padding: 4px; align-self: center; }
.linkish:hover { text-decoration: underline; }

/* ---------- inputs ---------- */
input, select, textarea { font-family: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], select, textarea {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 9px 12px; font: inherit; font-size: .85rem; color: var(--ink);
}
input::placeholder { color: var(--muted); }

/* ---------- login ---------- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ground); }
.login-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 36px 36px 32px; width: min(420px, 100%);
  display: flex; flex-direction: column; gap: 20px;
}
.login-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--gradient); }
.auth-brand { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.auth-brand .lockup { width: 230px; height: auto; display: block; }
:root[data-theme="dark"] .auth-brand .lockup { content: url("/assets/bullet-ev-lockup-white.png"); }
.auth-titles h1 { font-size: 1.05rem; margin: 0; font-weight: 700; }
.auth-titles .sub { color: var(--muted); font-size: .85rem; margin: 2px 0 0; }
.login-card input { width: 100%; padding: 11px 13px; background: var(--surface-2); }
.err { color: var(--crit); font-size: .85rem; min-height: 1.2em; margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .hint { margin: 0 0 4px; }
.auth-form p { margin: 0; font-size: .9rem; color: var(--ink-2); line-height: 1.5; }

/* ---------- shell: navy header with the white lockup ---------- */
.topbar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 10px 22px; background: var(--bar-bg); color: var(--bar-ink);
  position: sticky; top: 0; z-index: 20; margin-top: 4px;   /* below the gradient strip */
  box-shadow: 0 1px 0 var(--bar-line), 0 6px 20px -12px rgba(6, 33, 65, .6);
}
.brand { display: flex; align-items: center; gap: 12px; }
a.brand { color: inherit; text-decoration: none; }
.brand .lockup { height: 34px; width: auto; display: block; }
.brand-sep { width: 1px; height: 26px; background: var(--bar-line); }
.brand .title { font-weight: 600; font-size: .9rem; letter-spacing: .04em; text-transform: uppercase; color: var(--bar-muted); }
a.brand:hover .title { color: var(--bar-ink); }
.topbar .ghost { background: transparent; border-color: var(--bar-line); color: var(--bar-ink); }
.topbar .ghost:hover { background: var(--bar-hover); border-color: var(--teal); box-shadow: none; }
.topbar .ghost[aria-pressed="true"], .topbar .navbtn[aria-expanded="true"] { background: var(--bar-hover); border-color: var(--cyan); color: var(--bar-ink); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync { font-size: .72rem; color: var(--bar-muted); }
.who { font-size: .74rem; color: var(--bar-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- navigation: sidebar + ⚙ system menu + ☰ drawer ---------- */
.navbtn { font-size: .82rem; }
.crumb { font-size: .85rem; color: var(--bar-muted); }
.crumb b { color: var(--bar-ink); font-weight: 700; }
.crumb-dept { color: var(--bar-muted); }
.navtoggle { display: none; padding: 6px 10px; font-size: 1rem; line-height: 1; }
.sysmenu-wrap { position: relative; }
.sysmenu { left: auto; right: 0; min-width: 220px; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); align-items: start; }
.sidebar {
  position: sticky; top: 62px; max-height: calc(100vh - 62px); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 2px;
}
.sidebar a { display: block; padding: 7px 10px; border-radius: 7px; font-size: .84rem; color: var(--ink); text-decoration: none; }
.sidebar a:hover, .sidebar a:focus-visible { background: var(--surface-2); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--cyan); }
.side-home { font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-bottom: 10px !important; border-radius: 7px 7px 0 0 !important; }
.side-group { padding-top: 8px; }
.side-dept { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 4px; }
.content { min-width: 0; }
@media (max-width: 900px) {
  .navtoggle { display: inline-block; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 264px; max-height: none; z-index: 40;
    padding-top: 74px; box-shadow: var(--shadow-hover);
    transform: translateX(-100%);
  }
  body.nav-open .sidebar { transform: none; }
  /* Animate the slide only for people who have not asked for reduced motion
     (same gate the funnel bars use). */
  @media (prefers-reduced-motion: no-preference) { .sidebar { transition: transform .2s ease; } }
}
.navmenu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 30; min-width: 270px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: var(--shadow-hover); padding: 8px; display: flex; flex-direction: column; gap: 2px; color: var(--ink);
}
.navmenu::before { content: ""; position: absolute; top: 0; left: 12px; right: 12px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gradient); }
.navmenu a { display: block; padding: 7px 10px; border-radius: 7px; font-size: .84rem; color: var(--ink); text-decoration: none; }
.navmenu a:hover, .navmenu a:focus-visible { background: var(--surface-2); }
.navmenu a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- home ---------- */
.home-head h1 { font-size: 1.5rem; margin: 8px 0 2px; }
.home-head .hint { margin: 0 0 6px; font-size: .9rem; }
.home-dept { display: flex; flex-direction: column; gap: 12px; }
.home-dept-head { display: flex; align-items: baseline; gap: 12px; }
.home-dept-head h2 { font-size: 1.02rem; margin: 0; }
.home-dept-head .hint { margin: 0; }
.dash-cards { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.dash-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.dash-card:hover, .dash-card:focus-visible { border-color: var(--teal); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.dash-title { font-weight: 700; font-size: .98rem; }
.dash-blurb { margin: 0; font-size: .8rem; color: var(--ink-2); line-height: 1.5; flex: 1; }
.dash-open { font-size: .78rem; font-weight: 700; color: var(--accent); }
.dash-card:hover .dash-open::after { content: " →"; }

/* ---------- pipeline multiselect + source bar ---------- */
.pipebar, .sourcebar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 22px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.pipebar-label { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: .78rem; font-weight: 600;
  color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--teal); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--chip-color, var(--muted)); }
.chip[aria-pressed="false"] { opacity: .5; border-style: dashed; }
.chip[aria-pressed="true"] { border-color: var(--chip-color, var(--cyan)); background: color-mix(in srgb, var(--chip-color, var(--cyan)) 10%, var(--surface)); color: var(--ink); }

/* ---------- main / cards ---------- */
.main { padding: 22px; max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card h2 { font-size: .98rem; font-weight: 700; margin: 0 0 8px; }
.card .hint { font-size: .78rem; color: var(--muted); margin: 0 0 12px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-head > div { flex: 1; min-width: 0; }
.card-head .ghost { flex: none; }
/* KPI tiles carry the brand's "card top bar" */
.kpi { position: relative; overflow: hidden; padding: 16px 18px 14px; }
.kpi::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--gradient); }
.kpi .k { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .s { font-size: .74rem; color: var(--muted); }
.kpi.crit .v { color: var(--crit); }
.kpi.good .v { color: var(--good); }
.kpi.crit::before { background: var(--crit); }
.kpi.good::before { background: var(--gradient-bright); }

/* ---------- pills / flags ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 2px 8px; font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.neut { background: var(--surface-3); color: var(--ink-2); }
.flags { display: flex; flex-direction: column; gap: 9px; }
.flag { display: flex; gap: 10px; align-items: baseline; font-size: .85rem; color: var(--ink-2); }
.flag .pill { flex: none; }

/* ---------- charts ---------- */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: inherit; }
.axis-label { font-size: 10.5px; fill: var(--muted); }
.grid-line { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: .76rem; color: var(--ink-2); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
details.tblview { margin-top: 10px; }
details.tblview summary { font-size: .74rem; color: var(--muted); cursor: pointer; }

/* ---------- funnel bars ---------- */
.fun-pipe { margin-bottom: 4px; }
.fun-row { display: grid; grid-template-columns: 200px 1fr 120px; gap: 12px; align-items: center; padding: 5px 0; }
.fun-row .nm { font-size: .8rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fun-row .track { background: var(--surface-3); border-radius: 4px; height: 20px; overflow: hidden; }
.fun-row .fill { height: 100%; border-radius: 4px 0 0 4px; min-width: 2px; }
.fun-row .num { font-size: .78rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.fun-row .num small { color: var(--muted); }
.xfun { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: start; }
.xfun .arrow { align-self: center; font-size: 1.3rem; color: var(--accent); }

/* ---------- tables ---------- */
.tblwrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .82rem; }
table.data th, table.data td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.data thead th { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; border-bottom: 2px solid var(--line-strong); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-2); }

/* ---------- heatmap ---------- */
.heat { border-collapse: collapse; width: 100%; font-size: .78rem; }
.heat th, .heat td { padding: 7px 10px; border: 2px solid var(--surface); }
.heat thead th { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); text-align: center; }
.heat td { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; border-radius: 4px; }
.heat td.rowname { text-align: left; font-weight: 500; color: var(--ink-2); background: none; white-space: nowrap; }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--navy); color: #fff; border: 0; border-radius: 8px;
  box-shadow: var(--shadow-hover); padding: 8px 11px; font-size: .77rem; max-width: 260px;
}
.tooltip .t-title { font-weight: 700; margin-bottom: 3px; color: var(--green); }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 14px; color: #D5E0EC; }
.tooltip .t-row b { color: #fff; }

.empty { color: var(--muted); font-size: .85rem; padding: 18px 0; text-align: center; }

@media (max-width: 760px) {
  .fun-row { grid-template-columns: 130px 1fr 90px; }
  .xfun { grid-template-columns: 1fr; }
  .xfun .arrow { transform: rotate(90deg); justify-self: center; }
  .brand .lockup { height: 28px; }
  .brand .title, .brand-sep { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .fun-row .fill { transition: width .45s cubic-bezier(.2,.8,.3,1); }
}

/* ---------- report grids (WIP, reconciliation, …) ---------- */
.wip-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.wip-toolbar select, .wip-toolbar input[type="search"] {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 7px 10px; font: inherit; font-size: .8rem; color: var(--ink);
}
.wip-toolbar input[type="search"] { min-width: 240px; }
.wip-toolbar select:focus, .wip-toolbar input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.wip-fresh { font-size: .74rem; color: var(--muted); margin-left: auto; }
.gridwrap { max-height: 72vh; overflow: auto; }
table.report { font-size: .78rem; }
table.report th, table.report td { padding: 7px 10px; }
table.report thead th { position: sticky; background: var(--surface); z-index: 2; cursor: pointer; user-select: none; color: var(--ink-2); }
table.report thead tr:first-child th { top: 0; }
table.report thead tr:last-child th { top: 30px; border-bottom: 1px solid var(--line-strong); }
table.report th.grp { text-align: center; color: var(--ink-2); border-bottom: none; cursor: default; letter-spacing: .12em; }
table.report th[aria-sort="ascending"]::after { content: " ▲"; color: var(--accent); }
table.report th[aria-sort="descending"]::after { content: " ▼"; color: var(--accent); }
table.report tbody tr { cursor: pointer; }
table.report tbody tr:hover td, table.report tbody tr:focus-visible td { background: var(--surface-2); }
table.report td.code { font-weight: 600; white-space: nowrap; }
table.report td.nowrap { white-space: nowrap; }
table.report tbody td { white-space: nowrap; }   /* report grids scroll sideways; never let a cell wrap and double the row */
table.report td.nm { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.report .neg, table.data .neg { color: var(--crit); }
table.report tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: none; background: var(--surface-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* frozen (pinned) leading columns — left offsets are set inline by applyFreeze() */
table.report .frozen { position: sticky; z-index: 1; background: var(--surface); }
table.report thead th.frozen { z-index: 3; }
table.report tfoot td.frozen { background: var(--surface-2); }
table.report tbody tr:hover td.frozen { background: var(--surface-2); }
table.report .frozen-last { box-shadow: inset -2px 0 var(--line-strong); }
table.report td.frozen.g-budget, table.report th.frozen.g-budget         { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
table.report td.frozen.g-actual, table.report th.frozen.g-actual         { background: color-mix(in srgb, var(--accent-2) 9%, var(--surface)); }
table.report td.frozen.g-completion, table.report th.frozen.g-completion { background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }

/* column-group shading: Budget (blue) · Actual (green) · Completion (amber) */
table.report td.g-budget     { background: color-mix(in srgb, var(--accent) 8%, transparent); }
table.report td.g-actual     { background: color-mix(in srgb, var(--accent-2) 9%, transparent); }
table.report td.g-completion { background: color-mix(in srgb, var(--warn) 9%, transparent); }
table.report thead th.g-budget     { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
table.report thead th.g-actual     { background: color-mix(in srgb, var(--accent-2) 20%, var(--surface)); }
table.report thead th.g-completion { background: color-mix(in srgb, var(--warn) 20%, var(--surface)); }
table.report th.grp.g-budget     { color: var(--accent); border-top: 3px solid var(--cyan); }
table.report th.grp.g-actual     { color: var(--accent-2); border-top: 3px solid var(--teal); }
table.report th.grp.g-completion { color: var(--warn); border-top: 3px solid var(--warn); }
table.report tfoot td.g-budget     { background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
table.report tfoot td.g-actual     { background: color-mix(in srgb, var(--accent-2) 16%, var(--surface-2)); }
table.report tfoot td.g-completion { background: color-mix(in srgb, var(--warn) 16%, var(--surface-2)); }
table.report tbody tr:hover td.g-budget, table.report tbody tr:hover td.g-actual, table.report tbody tr:hover td.g-completion { filter: brightness(1.12); }


/* full-screen (maximized) report: fixed overlay + table zoomed to fit */
.card.grid-max {
  position: fixed; inset: 0; z-index: 45; margin: 0; border-radius: 0; border: 0;
  display: flex; flex-direction: column; overflow: hidden; padding: 12px 16px 10px;
}
.card.grid-max .gridwrap { flex: 1; max-height: none; min-height: 0; overflow: auto; }
/* compact density in full screen: shorter natural table → less zoom needed to fit */
.card.grid-max table.report { font-size: .72rem; }
.card.grid-max table.report td, .card.grid-max table.report th { white-space: nowrap; padding: 3px 7px; }
.card.grid-max table.report thead tr:last-child th { top: 22px; }
.card.grid-max table.report .pill { padding: 1px 6px; font-size: .68rem; }
.card.grid-max table.report td.nm { max-width: 190px; }
.card.grid-max .card-head .hint { margin-bottom: 8px; }
body.has-max { overflow: hidden; }

/* transaction drawer */
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(820px, 100%);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  z-index: 40; display: flex; flex-direction: column;
}
.drawer::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--gradient); }
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head h2 { margin: 0 0 3px; font-size: 1rem; }
.drawer-head .sub { color: var(--muted); font-size: .78rem; }
.drawer .close { margin-left: auto; flex: none; }
.drawer-body { overflow: auto; padding: 14px 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.wip-dstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.wip-dstats .kpi { padding: 10px 12px; }
.wip-dstats .kpi .v { font-size: 1.05rem; }
.drawer table.data { font-size: .78rem; }
.drawer table.data td.desc { max-width: 260px; white-space: normal; color: var(--ink-2); }
.drawer table.data td.acct { max-width: 240px; white-space: normal; font-size: .74rem; }
@media (max-width: 760px) { .wip-fresh { margin-left: 0; } }

/* ---------- fleet ---------- */
.fleet-dates { font-size: .76rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.fleet-dates input[type="date"] { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 8px; font: inherit; font-size: .76rem; color: var(--ink); }
.fleet-body { display: flex; flex-direction: column; gap: 18px; }
table.fleet-grid tbody tr.static { cursor: default; }
.fleet-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.vcard { display: flex; flex-direction: column; gap: 10px; }
.vcard.dim { opacity: .65; }
.vcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.vcard-plate { font-weight: 700; font-size: 1.05rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.vcard-driver { font-size: .84rem; color: var(--ink-2); }
.vcard-driver small { color: var(--muted); }
.fuel { position: relative; height: 18px; background: var(--surface-3); border-radius: 5px; overflow: hidden; font-size: .68rem; font-weight: 700; }
.fuel-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px 0 0 5px; }
.fuel span { position: relative; padding: 0 8px; line-height: 18px; color: var(--ink); }
.vcard-stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: .78rem; }
.vcard-stats dt { color: var(--muted); }
.vcard-stats dd { margin: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.vcard-stats a { color: var(--accent); text-decoration: none; }
.vcard-stats a:hover { text-decoration: underline; }
.vcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); font-size: .78rem; }
.vcard-foot a { color: var(--accent); font-weight: 700; text-decoration: none; }
.fleet-retired summary { font-size: .8rem; color: var(--muted); cursor: pointer; margin-bottom: 10px; }
.card-crit { border-color: var(--crit); }
.fleet-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.fleet-form label { display: flex; flex-direction: column; gap: 4px; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fleet-form label.grow { flex: 1; min-width: 160px; }
.fleet-form input, .fleet-form select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 9px; font: inherit; font-size: .8rem; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 500; }
.fleet-form input:focus, .fleet-form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-brand.small { padding: 8px 12px; font-size: .78rem; border-radius: 6px; }
.ghost.danger { color: var(--crit); }
table.data tr.editing td { background: var(--surface-2); }
table.data tr.dim { opacity: .55; }
table.data input.inline { background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; font: inherit; font-size: .8rem; color: var(--ink); width: 100%; min-width: 120px; }
table.data input.inline:hover, table.data input.inline:focus { border-color: var(--line-strong); background: var(--surface); outline: none; }
.trip-svg { width: 100%; height: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.trip-path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.trip-start { fill: var(--good); stroke: var(--surface); stroke-width: 2; }
.trip-end { fill: var(--crit); stroke: var(--surface); stroke-width: 2; }

/* ---------- data sources: the Manual UI ---------- */
.sourcebar { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.sourcebar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 22px; }
.srcchip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: .78rem; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.srcchip small { color: var(--muted); font-weight: 500; }
.srcchip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.srcchip.good .dot { background: var(--good); }
.srcchip.warn .dot { background: var(--warn); }
.srcchip.crit .dot { background: var(--crit); }
.srcchip.crit { border-color: var(--crit); }
.srcchip.warn { border-color: var(--warn); }
.srcchip[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.srcchip-cta { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.srcpanel {
  display: grid; grid-template-columns: minmax(260px, 1.2fr) minmax(240px, 1fr); gap: 18px;
  padding: 4px 22px 16px; align-items: start;
}
.srcpanel h3, .src-card h3 { font-size: .92rem; margin: 0 0 4px; }
.srcpanel-info p { margin: 0 0 7px; }
.srcpanel-where { font-size: .82rem; color: var(--ink-2); line-height: 1.5; margin: 0 0 7px; }
.src-status { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }

/* drop targets */
.dropzone {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 2px dashed var(--line-strong); border-radius: 10px; padding: 16px 18px;
  background: var(--surface-2); cursor: pointer; color: var(--ink-2);
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone.compact { padding: 12px 14px; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dropzone.busy { opacity: .6; pointer-events: none; border-style: solid; }
.dropzone.busy .dz-icon { animation: dzspin 1s linear infinite; }
.dz-icon { font-size: 1.5rem; color: var(--accent); flex: none; }
@keyframes dzspin { to { transform: rotate(360deg); } }

.drop-overlay { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--ground) 88%, transparent); display: grid; place-items: center; padding: 24px; }
.drop-overlay-inner { width: min(680px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 26px; }
.drop-overlay h2 { margin: 0 0 16px; font-size: 1.05rem; text-align: center; }
.drop-targets { display: flex; flex-direction: column; gap: 10px; }

.src-cards { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.src-card { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.src-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.src-card-head .hint { margin: 0; }
.src-feeds { font-size: .76rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.src-feeds a { color: var(--accent); text-decoration: none; font-weight: 600; }
.src-feeds a:hover { text-decoration: underline; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 14px; max-width: min(560px, 92vw);
  background: var(--surface); border: 1px solid var(--line-strong); border-left-width: 4px;
  border-radius: 9px; box-shadow: var(--shadow); padding: 12px 14px; font-size: .84rem; color: var(--ink);
}
.toast.good { border-left-color: var(--good); }
.toast.warn { border-left-color: var(--warn); }
.toast.crit { border-left-color: var(--crit); }
.toast.neut { border-left-color: var(--accent); }

@media (max-width: 760px) { .srcpanel { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------- Refresh Tracker
   Two signals per feed, kept visually distinct: the dot is "current right
   now" (observed), the pill is "finished" (declared). They are different
   questions and must never collapse into one badge. */
.fr-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.fr-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 10px;
  background: var(--surface); border-left: 3px solid var(--line-strong); box-shadow: var(--shadow); }
.fr-tile.good { border-left-color: var(--good); }
.fr-tile.warn { border-left-color: var(--warn); }
.fr-tile.bad  { border-left-color: var(--crit); }
.fr-tile.neut { border-left-color: var(--muted); }
.fr-tile-v { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fr-tile-l { font-size: 12px; color: var(--muted); }

.fr-legend { max-width: 90ch; margin: 0 0 18px; }
.fr-mod { margin-bottom: 26px; }
.fr-modh { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; font-size: 15px; }
.fr-modh .hint { font-weight: 400; }

/* one grid template shared by the header and every row, so columns line up */
.fr-head, .fr-row {
  display: grid;
  grid-template-columns: 14px minmax(160px, 2.4fr) 110px 110px 90px 90px 70px 18px;
  gap: 12px; align-items: center;
}
.fr-head { padding: 0 12px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fr-row {
  width: 100%; text-align: left; padding: 11px 12px; border: 0; border-radius: 8px;
  background: var(--surface); cursor: pointer; margin-bottom: 4px; font: inherit; color: inherit;
}
.fr-row:hover { background: var(--surface-2); }
.fr-row.open { background: var(--surface-2); border-radius: 8px 8px 0 0; margin-bottom: 0; }
.fr-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.fr-dot.st-ok { background: var(--good); }
.fr-dot.st-catchup { background: var(--accent); }
.fr-dot.st-late, .fr-dot.st-never { background: var(--warn); }
.fr-dot.st-failing, .fr-dot.st-hung { background: var(--crit); }
.fr-dot.st-unwired { background: transparent; border: 1.5px dashed var(--line-strong); }
.fr-name { display: flex; flex-direction: column; min-width: 0; }
.fr-name b { font-weight: 600; font-size: 13.5px; }
.fr-sys { font-size: 11.5px; color: var(--muted); }
.fr-mat { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; justify-self: start; white-space: nowrap; }
.fr-mat.m-complete { background: var(--good-soft); color: var(--good); }
.fr-mat.m-partial  { background: var(--warn-soft); color: var(--warn); }
.fr-mat.m-unwired, .fr-mat.m-planned { background: var(--surface-3); color: var(--muted); }
.fr-when, .fr-cad, .fr-rows, .fr-rel { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.fr-rows, .fr-rel { text-align: right; }
.fr-caret { color: var(--muted); font-size: 11px; }

.fr-detail { padding: 4px 14px 16px 40px; background: var(--surface-2); border-radius: 0 0 8px 8px; margin-bottom: 6px; }
.fr-what { margin: 4px 0; max-width: 80ch; }
.fr-h4 { margin: 14px 0 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fr-note { margin: 8px 0; padding: 9px 12px; border-radius: 8px; background: var(--surface-3); font-size: 12.5px; max-width: 100ch; }
.fr-note.warn { background: var(--warn-soft); }
.fr-note.bad  { background: var(--crit-soft); }
.fr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 12px 0; }
.fr-stat { display: flex; flex-direction: column; }
.fr-stat-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fr-stat-l { font-size: 11px; color: var(--muted); }

.fr-strip { display: flex; gap: 2px; align-items: flex-end; margin: 6px 0 10px; flex-wrap: wrap; }
.fr-tick { width: 7px; height: 18px; border-radius: 2px; background: var(--good); }
.fr-tick.bad { background: var(--crit); }
.fr-tick.unfinished { background: var(--warn); }

@media (max-width: 900px) {
  .fr-head { display: none; }
  .fr-row { grid-template-columns: 14px 1fr auto; grid-template-areas: "dot name mat" ". when cad"; row-gap: 4px; }
  .fr-row .fr-dot { grid-area: dot; } .fr-row .fr-name { grid-area: name; }
  .fr-row .fr-mat { grid-area: mat; } .fr-row .fr-when { grid-area: when; } .fr-row .fr-cad { grid-area: cad; }
  .fr-rows, .fr-rel, .fr-caret { display: none; }
  .fr-detail { padding-left: 16px; }
}

/* Master View link — a peer of the header's ghost buttons, not a call to
   action. It leaves the app, so it carries an outbound marker. */
a.ghost.masterview { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
a.ghost.masterview::after { content: "↗"; font-size: 11px; opacity: .65; }

/* Outstanding cleanup on a feed that is otherwise working. Numbered because
   they get worked through one at a time, not read as a block. */
.fr-todo { margin: 6px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; max-width: 100ch; }
.fr-todo li { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.fr-todo li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Users & Access ---------- */
.invite-form { display: grid; grid-template-columns: minmax(200px, 1.2fr) minmax(160px, 1fr) 120px; gap: 10px; align-items: center; margin-bottom: 8px; }
.invite-form input, .invite-form select {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 9px 11px; font: inherit; font-size: .85rem; color: var(--ink);
}
.invite-form .deptpick { grid-column: 1 / -1; }
.invite-form .btn-brand.small { grid-column: 1 / -1; justify-self: start; padding: 9px 16px; font-size: .85rem; }
.deptpick .chip { font-size: .74rem; padding: 4px 10px; }
table.admin-users td { vertical-align: top; }
table.admin-users td.actions { white-space: nowrap; }
table.admin-users td.actions .ghost { margin-right: 6px; }
table.admin-users .code { font-weight: 600; margin-bottom: 4px; }
table.admin-users input.inline { background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 3px 6px; font: inherit; font-size: .78rem; color: var(--ink-2); min-width: 140px; }
table.admin-users input.inline:hover, table.admin-users input.inline:focus { border-color: var(--line-strong); background: var(--surface); outline: none; }
table.admin-users select { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 8px; font: inherit; font-size: .8rem; color: var(--ink); }
@media (max-width: 760px) { .invite-form { grid-template-columns: 1fr; } }
