/* PitStop — page and feature layouts. Tokens and primitives live in
 * theme.css; nothing here introduces a colour of its own. */

/* ── shell ────────────────────────────────────────────────────────────── */

.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.topbar-inner {
  display: flex; align-items: center; gap: 18px;
  max-width: 1280px; margin: 0 auto; padding: 14px 22px 10px;
}
.topbar form { margin: 0; display: flex; }
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 700; letter-spacing: -.015em;
  color: var(--text); text-decoration: none;
}
.brand svg { color: var(--accent); }

/* Pill nav: the active item is a filled pill, everything else is quiet. */
.mainnav {
  display: flex; gap: 3px; margin-right: auto; padding: 3px;
  background: var(--surface); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.mainnav a {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 550; color: var(--text-muted); text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.mainnav a:hover { background: var(--surface-hover); color: var(--text); }
.mainnav a[aria-current='page'] { background: var(--accent); color: var(--accent-text); }
.mainnav a[aria-current='page'] .navcount { background: var(--accent-text); color: var(--accent); }
.navcount {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-text);
  font-size: 10.5px; font-weight: 700;
}
.who { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* Three-state theme control: system, light, dark. */
.themetoggle {
  display: inline-flex; padding: 3px; gap: 1px;
  border-radius: var(--radius-pill); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.themetoggle button {
  display: grid; place-items: center; width: 27px; height: 25px; padding: 0;
  border: 0; border-radius: var(--radius-pill); background: none;
  cursor: pointer; color: var(--text-faint);
}
.themetoggle button:hover { color: var(--text); }
.themetoggle button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.page { max-width: 1280px; margin: 0 auto; padding: 6px 22px 60px; }

/* ── page head ────────────────────────────────────────────────────────── */

.pagehead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin: 10px 0 20px;
}
.pagehead h1 { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.pagehead .sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pagehead .crumb { font-size: 12px; color: var(--text-faint); margin-bottom: 6px; }
.pagehead .crumb a { color: var(--text-muted); text-decoration: none; }
.pagehead .crumb a:hover { color: var(--accent); }
.headactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.headactions form { margin: 0; }

.flash {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 0 0 18px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent); font-size: 13px;
}
.flash-error { background: var(--over-soft); color: var(--over-text); }

.sectionhead { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; }
.sectionhead:first-child { margin-top: 0; }
.sectionhead h2 { font-size: 15px; }
.sectionhead .sub { font-size: 12.5px; font-weight: 400; color: var(--text-muted); }

.empty {
  padding: 52px 24px; text-align: center; color: var(--text-muted); font-size: 13.5px;
}
.empty h2 { margin-bottom: 7px; color: var(--text); }
.empty p { max-width: 400px; margin-inline: auto; }
.empty .btn { margin-top: 16px; text-decoration: none; }

/* ── status language ──────────────────────────────────────────────────── */

.plain  { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.na     { color: var(--text-faint); }
.struck { color: var(--text-faint); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.t-over { color: var(--over-text); }
.t-soon { color: var(--soon-text); }
.t-ok   { color: var(--ok-text); }
.t-snoozed { color: var(--text-muted); }

/* ── dashboard: bento ─────────────────────────────────────────────────── */

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
/* Each tile is a soft tinted panel — the tint carries the status, so the
   number does not have to shout. */
.tile {
  display: flex; flex-direction: column; gap: 3px;
  padding: 18px 20px; border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none;
  transition: transform .14s ease, box-shadow .14s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile b {
  font-size: 30px; font-weight: 650; line-height: 1.1;
  letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums;
}
.tile span { font-size: 12.5px; color: var(--text-muted); }
.tile.over { background: var(--over-soft); }
.tile.over b, .tile.over span { color: var(--over-text); }
.tile.soon { background: var(--soon-soft); }
.tile.soon b, .tile.soon span { color: var(--soon-text); }
.tile.ok { background: var(--ok-soft); }
.tile.ok b, .tile.ok span { color: var(--ok-text); }

.queue { overflow: hidden; }
.qrow {
  display: flex; align-items: center; gap: 15px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.qrow:first-child { border-top: 0; }
.qrow:hover { background: var(--surface-hover); }
.qrow.snoozed { opacity: .66; }
.qdot {
  width: 34px; height: 34px; flex: none; border-radius: var(--radius-pill);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.qdot.over { background: var(--over-soft); color: var(--over-text); }
.qdot.soon { background: var(--soon-soft); color: var(--soon-text); }
.qdot.snoozed { background: var(--surface-sunk); color: var(--text-muted); }
.qmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qtop { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.qname { font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none; }
.qname:hover { color: var(--accent); }
.qline { font-size: 13px; }
.qmeta { font-size: 11.5px; color: var(--text-faint); }

/* ── the document matrix ──────────────────────────────────────────────── */

.scroll-x { overflow-x: auto; border-radius: var(--radius-lg); }
.matrix { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.matrix th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-sunk); white-space: nowrap;
}
.matrix th:first-child { border-top-left-radius: var(--radius-lg); }
.matrix th:last-child  { border-top-right-radius: var(--radius-lg); }
.matrix td { padding: 0; border-top: 1px solid var(--border); }
.matrix tbody tr:hover { background: var(--surface-hover); }
.matrix .vcell { padding: 11px 16px; }
.vname { font-size: 13.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.vname:hover { color: var(--accent); }
.vreg { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* A document cell is a button filling its td, so the whole cell is the
   target. This is the matrix cell's style only — the dialog hook is the
   `data-doc` attribute, which other pages put on ordinary buttons. */
td > .doc {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 11px 16px; min-height: 48px;
  border: 0; background: none; font: inherit; text-align: left;
  color: var(--text-muted); cursor: pointer;
}
td > .doc:hover { background: var(--accent-soft); }
td > .doc:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── timeline ─────────────────────────────────────────────────────────── */

.tl-axis, .tl-row { display: grid; grid-template-columns: 180px 1fr; align-items: center; }
.tl-axis { padding: 14px 20px 10px; }
.tl-axis .rail { height: 14px; }
.tl-row { padding: 9px 20px; border-top: 1px solid var(--border); }
.tl-row:hover { background: var(--surface-hover); }
.tl-label { text-decoration: none; padding-right: 16px; }
.tl-label .vname { display: block; }
.rail { position: relative; height: 26px; }
.tick {
  position: absolute; top: 1px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em;
  color: var(--text-faint); white-space: nowrap;
}
.tick:first-child { transform: none; }
.tick.today { color: var(--accent); font-weight: 700; }
.nowline {
  position: absolute; top: 0; bottom: 0; width: 2px; border-radius: 2px;
  background: var(--accent); opacity: .35;
}
.mark {
  position: absolute; top: 3px; transform: translateX(-6px);
  padding: 3px 9px; border-radius: var(--radius-pill); white-space: nowrap;
  font-size: 11px; font-weight: 600; line-height: 1.45;
}
.mark.over    { background: var(--over-soft); color: var(--over-text); }
.mark.soon    { background: var(--soon-soft); color: var(--soon-text); }
.mark.ok      { background: var(--ok-soft);   color: var(--ok-text); }
.mark.snoozed { background: var(--surface-sunk); color: var(--text-muted); }
.tl-note { font-size: 12px; color: var(--text-faint); margin-top: 14px; }

/* ── vehicle detail ───────────────────────────────────────────────────── */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.sidecol { display: flex; flex-direction: column; gap: 18px; }

.docrow {
  display: block; width: 100%; padding: 14px 20px;
  border: 0; border-top: 1px solid var(--border);
  background: none; font: inherit; text-align: left; color: inherit; cursor: pointer;
}
.docrow:first-of-type { border-top: 0; }
.docrow:hover { background: var(--surface-hover); }
.docrow-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.docrow-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.docrow-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* The nine cron offsets, lit as they fire, with today's divider after the
   fourth step (−7, −3, −1, 0 | +1, +3, +7, +15, +30). */
.ladder { display: flex; align-items: center; gap: 3px; margin-top: 10px; }
.step { flex: 1; height: 4px; border-radius: var(--radius-pill); background: var(--border); }
.step.fired.over    { background: var(--over); }
.step.fired.soon    { background: var(--soon); }
.step.fired.ok      { background: var(--ok); }
.step.fired.snoozed { background: var(--border-strong); }
.step.next { box-shadow: 0 0 0 2px var(--accent-soft); }
.nowtick { width: 2px; height: 11px; border-radius: 2px; background: var(--accent); opacity: .45; margin: 0 4px; flex: none; }

.fieldlist { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 13px; padding: 16px 20px; }
.fieldlist dt { color: var(--text-muted); }
.fieldlist dd { color: var(--text); font-weight: 500; }

/* ── forms (add / edit vehicle) ───────────────────────────────────────── */

.form { max-width: 760px; }
.formsection { padding: 20px; border-top: 1px solid var(--border); }
.formsection:first-of-type { border-top: 0; }
.formsection h2 { font-size: 14px; margin-bottom: 3px; }
.formsection .sub { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.formactions {
  display: flex; justify-content: flex-end; gap: 8px; align-items: center;
  padding: 16px 20px; background: var(--surface-sunk);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.formactions .btn { text-decoration: none; }
.formactions .spacer { margin-right: auto; font-size: 12px; color: var(--text-muted); }

/* ── users ────────────────────────────────────────────────────────────── */

.users .uname { display: block; font-weight: 600; color: var(--text); }
.users .uemail { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.users tr.pending { background: var(--soon-soft); }
.uactions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.uactions form { margin: 0; }

/* ── sign-in / waiting room ───────────────────────────────────────────── */

.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.authcard { width: min(410px, 100%); padding: 34px 30px; box-shadow: var(--shadow-md); }
.authcard .brand { justify-content: center; font-size: 17px; margin-bottom: 22px; }
.authcard h1 { font-size: 21px; text-align: center; margin-bottom: 7px; letter-spacing: -.02em; }
.authlead { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 22px; text-wrap: pretty; }
.authnote {
  margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 11.5px; line-height: 1.6; color: var(--text-faint); text-align: center;
}
.authcard form { margin: 0; }
.waitactions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.waitactions form { margin: 0; }
.waitactions .btn { text-decoration: none; }

/* ── narrow ───────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 12px 16px 8px; }
  .mainnav { order: 3; width: 100%; margin-right: 0; overflow-x: auto; }
  .who { margin-left: auto; }
  .page { padding: 4px 16px 44px; }
  .pagehead h1 { font-size: 22px; }
  .tl-axis, .tl-row { grid-template-columns: 130px 1fr; }
}

/* ── row actions ──────────────────────────────────────────────────────── */

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

.matrix th.acts-head { width: 1%; }
.matrix td.acts { padding: 8px 14px 8px 4px; }
.rowacts { display: flex; gap: 2px; justify-content: flex-end; }
.rowacts form { margin: 0; display: flex; }

/* Quiet until the row is hovered — the actions are always reachable by
   keyboard, but they should not compete with the expiry dates for attention. */
.iconbtn {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text-faint); cursor: pointer; opacity: .45;
  transition: opacity .14s ease, background .14s ease, color .14s ease;
}
.iconbtn svg { width: 15px; height: 15px; display: block; }
tr:hover .iconbtn, .iconbtn:focus-visible { opacity: 1; }
.iconbtn:hover { background: var(--surface-hover); color: var(--text); }
.iconbtn.danger:hover { background: var(--over-soft); color: var(--over-text); }

/* ── add-recipient row ────────────────────────────────────────────────── */

.addrow { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.addrow .btn { flex: none; }

/* ── dev-mode banner ──────────────────────────────────────────────────── */

.devbanner {
  padding: 9px 22px; text-align: center;
  font-size: 12.5px; line-height: 1.5;
  background: var(--over-soft); color: var(--over-text);
  border-bottom: 1px solid color-mix(in srgb, var(--over) 30%, transparent);
}
.devbanner strong { font-weight: 700; }
.devbanner code {
  font-family: var(--font-mono); font-size: 11.5px;
  padding: 1px 5px; border-radius: 4px;
  background: color-mix(in srgb, var(--over) 12%, transparent);
}
