/* Dad's Fleet — customer-facing fleet portal.
   Same design system as the ops and exec dashboards (tokens/*.css): warm
   off-white ground, white cards with a hairline border, big tabular numbers
   over small grey labels, blue used as an accent and not as a surface.
   Written fresh rather than inherited from dads-ops/style.css — that file is
   full of shop-floor components this page doesn't have. */
@import url('./tokens/colors.css');
@import url('./tokens/spacing.css');

:root {
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Wix Madefor Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --ground: #F2F3F5;
  --card: #FFFFFF;
  --hair: #E4E6EA;
  --ink: #1B1D21;
  --muted: #6E747E;
  --blue: var(--dads-blue);

  /* Status colors. Red is reserved for genuinely overdue — if everything is
     red nothing is. */
  --red-bg: #FDECEC;   --red-ink: #A11B1B;   --red-line: #E9B6B6;
  --amber-bg: #FEF5E3; --amber-ink: #8A5B08; --amber-line: #EBD5A6;
  --green-bg: #E7F5EC; --green-ink: #14653A; --green-line: #BEE0CB;
  --blue-bg: #ECF0FE;  --blue-ink: #012FDC;  --blue-line: #C3CFF9;
  --grey-bg: #F1F2F4;  --grey-ink: #5C626C;  --grey-line: #E0E2E6;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 32, .05), 0 1px 10px rgba(20, 24, 32, .04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-body);
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
a { color: var(--blue); }

/* ── Masthead ─────────────────────────────────────────────────────────── */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--card); border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brandmark img { width: 30px; height: 30px; display: block; }
.brand-shop {
  margin: 0; font-size: .68rem; letter-spacing: .10em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.masthead h1 {
  margin: 1px 0 0; font-family: var(--font-display); font-size: 1.22rem;
  font-weight: 700; letter-spacing: -.01em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.call {
  font-weight: 600; font-size: .85rem; text-decoration: none; white-space: nowrap;
  padding: 9px 13px; border: 1px solid var(--hair); border-radius: 999px;
  background: var(--card); color: var(--ink);
}

/* Fore Mobility works from a desk, so the wide layout is the primary one and
   the phone layout is the fallback — the reverse of the ops dashboards. */
.screen { max-width: 1180px; margin: 0 auto; padding: 0 24px 56px; }

/* Two shapes for the roster: a dense table to scan at a desk, stacked cards for
   a phone. Both render; CSS picks. */
.only-wide { display: none; }
.only-narrow { display: block; }
@media (min-width: 860px) {
  .only-wide { display: block; }
  .only-narrow { display: none; }
}

/* ── Fleet table ──────────────────────────────────────────────────────── */
.fleet-t { font-size: .88rem; }
.fleet-t th { padding: 16px 14px 11px; white-space: nowrap; }
.fleet-t th:first-child, .fleet-t td:first-child { padding-left: 20px; }
.fleet-t th:last-child, .fleet-t td:last-child { padding-right: 20px; }
.fleet-t td { padding: 13px 14px; border-top: 1px solid var(--hair); vertical-align: middle; }
.fleet-t tbody tr:first-child td { border-top: 1px solid var(--hair); }
.fleet-t th.sortable { cursor: pointer; user-select: none; }
.fleet-t th.sortable:hover { color: var(--ink); }
.fleet-t th.on { color: var(--blue); }
.fleet-t .row-click { cursor: pointer; }
.fleet-t .row-click:hover { background: #F7F8FA; }
.fleet-t small.dim { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.fleet-t td.dim { color: var(--muted); }
.fleet-t td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fleet-t th.num { text-align: right; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 6px; padding: 14px 0 12px; position: sticky; top: 0;
  background: var(--ground); z-index: 5;
  /* Four tabs don't fit across a phone — let the row scroll rather than
     letting the last one fall off the edge where nobody finds it. */
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 9px 15px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hair); background: var(--card); color: var(--muted);
  font: 600 .85rem var(--font-body);
}
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px;
}
.pad { padding: 18px; }
h2 {
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 700;
  margin: 22px 0 10px; letter-spacing: -.01em;
}
h2:first-child { margin-top: 0; }
h3 {
  font-size: .70rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 8px;
}
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
.lede { color: var(--muted); font-size: .88rem; margin: -4px 0 14px; }

/* ── The headline strip ───────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.stat.flag-green .stat-n { color: var(--green-ink); }
.stat {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 14px;
}
.stat-n {
  font-family: var(--font-display); font-size: 1.85rem; font-weight: 700;
  line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.stat-l {
  font-size: .70rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-top: 5px;
}
.stat.flag-red .stat-n { color: var(--red-ink); }
.stat.flag-amber .stat-n { color: var(--amber-ink); }
.stat.flag-blue .stat-n { color: var(--blue-ink); }

/* ── Car rows ─────────────────────────────────────────────────────────── */
.car {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 16px; margin-bottom: 10px; cursor: pointer;
  font: inherit; color: inherit;
}
.car:hover { border-color: #D2D6DD; }
.car-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--grey-line); flex: 0 0 4px; }
.car.s-in_shop  .car-bar { background: var(--blue-ink); }
.car.s-overdue  .car-bar { background: var(--red-ink); }
.car.s-due_soon .car-bar { background: var(--amber-ink); }
.car.s-ok       .car-bar { background: var(--green-ink); }
.car-main { flex: 1 1 auto; min-width: 0; }
.car-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.car-sub { font-size: .81rem; color: var(--muted); margin-top: 2px; }
.car-next { font-size: .86rem; margin-top: 6px; font-weight: 500; }
.car-next b { font-weight: 700; }
.car-chev { color: #C3C7CE; font-size: 1.2rem; flex: 0 0 auto; }

/* ── Pills ────────────────────────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .70rem; font-weight: 700; letter-spacing: .03em;
  border: 1px solid var(--grey-line); background: var(--grey-bg); color: var(--grey-ink);
  white-space: nowrap;
}
.pill.red   { background: var(--red-bg);   color: var(--red-ink);   border-color: var(--red-line); }
.pill.amber { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); }
.pill.green { background: var(--green-bg); color: var(--green-ink); border-color: var(--green-line); }
.pill.blue  { background: var(--blue-bg);  color: var(--blue-ink);  border-color: var(--blue-line); }

/* ── Callout ──────────────────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius); padding: 15px 17px; margin-bottom: 12px;
  border: 1px solid var(--blue-line); background: var(--blue-bg); color: var(--blue-ink);
  font-size: .9rem;
}
.callout b { font-weight: 700; }
.callout.amber { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber-ink); }
.callout.grey  { border-color: var(--grey-line);  background: var(--grey-bg);  color: var(--grey-ink); }

/* ── Rows / tables ────────────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--hair);
}
.row:last-child { border-bottom: 0; }
.row-k { font-size: .88rem; }
.row-k small { display: block; color: var(--muted); font-size: .77rem; margin-top: 1px; }
.row-v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-v.muted { color: var(--muted); font-weight: 500; }

.scroller { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th {
  text-align: left; font-size: .68rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 0 12px 8px 0; white-space: nowrap;
}
td { padding: 10px 12px 10px 0; border-top: 1px solid var(--hair); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
tr.tot td { border-top: 2px solid var(--ink); font-weight: 700; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 12px 18px; border-radius: 10px; cursor: pointer;
  font: 600 .88rem var(--font-body); text-decoration: none; text-align: center;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
}
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--hair); }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 4px; }

/* ── Detail sheet ─────────────────────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; background: rgba(20, 24, 32, .45);
  /* flex-start, not flex-end: with a scrolling flex container, content taller
     than the viewport overflows past the START edge and the browser will not
     let you scroll back up to it. Bottom-anchoring this sheet made the car's
     title and its due dates permanently unreachable. */
  display: flex; align-items: flex-start; justify-content: center; z-index: 40;
  overflow-y: auto; padding: 40px 0 0;
}
.sheet-inner {
  position: relative; background: var(--ground); width: 100%; max-width: 640px;
  border-radius: 20px 20px 0 0; padding: 26px 18px 40px; min-height: 60vh;
}
.sheet-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 999px; border: 1px solid var(--hair); background: var(--card);
  color: var(--muted); cursor: pointer; font-size: .9rem; line-height: 1;
}
.sheet h2:first-of-type { margin-top: 0; padding-right: 40px; }

/* ── Plan tab ─────────────────────────────────────────────────────────── */
.tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tier { padding: 16px; }
.tier.on { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), var(--shadow); }
.tier-name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.tier-when { font-size: .77rem; color: var(--muted); margin: 2px 0 12px; }
.tier-off { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.tier-off small { font-size: .75rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.ticks { list-style: none; margin: 12px 0 0; padding: 0; font-size: .84rem; }
.ticks li { padding-left: 19px; position: relative; margin-bottom: 7px; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--blue); font-weight: 700; }
.ticks.x li::before { content: "✕"; color: var(--muted); }

.price-hero {
  display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 4px;
}
.price-hero .n {
  font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; letter-spacing: -.03em;
}
.price-hero .u { color: var(--muted); font-size: .9rem; }

/* ── Approvals ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; margin-left: 7px; min-width: 19px; padding: 1px 6px;
  border-radius: 999px; background: var(--red-ink); color: #fff;
  font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.tab.active .badge { background: #fff; color: var(--ink); }
.appr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.appr-amt {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.appr.done { opacity: .62; }
.appr.sending { opacity: .5; pointer-events: none; }
.ta {
  width: 100%; padding: 12px; border: 1px solid var(--hair); border-radius: 10px;
  font: 400 .95rem/1.5 var(--font-body); background: var(--card); color: var(--ink);
  resize: vertical;
}
.ta:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }

/* The headline plan card — the one thing on the page that gets the blue edge. */
.hero-card { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), var(--shadow); }

.foot {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--hair);
  font-size: .78rem; color: var(--muted);
}
.foot p { margin: 0 0 3px; }
.stamp { margin-top: 8px !important; font-variant-numeric: tabular-nums; }

.banner {
  background: var(--ink); color: #fff; text-align: center; padding: 8px 14px;
  font-size: .76rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
}

@media (max-width: 620px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .tier-grid { grid-template-columns: 1fr; }
  .masthead { padding: 12px 14px; }
  .screen { padding: 0 12px 48px; }
  /* On a phone the shop name wraps to two lines and shoves the fleet name
     down; tighten it so the header stays one tidy block. */
  .brand-shop { font-size: .60rem; letter-spacing: .07em; }
  .masthead h1 { font-size: 1.08rem; }
  .call { padding: 8px 11px; font-size: .8rem; }
}
