/* Dad's Crew — Test Drive redesign (Claude Design handoff, 2026-07-19).
   Tokens are the source of truth: tokens/*.css (colors, type, spacing, fonts).
   Display: Space Grotesk (Fractul stand-in) · Body: Wix Madefor Display. */

@import url('./tokens/fonts.css');
@import url('./tokens/colors.css');
@import url('./tokens/typography.css');
@import url('./tokens/spacing.css');

/* typography.css re-declares the font vars self-referentially (a DS export bug the
   reference prototype also patches inline) — re-assert the real stacks here. */
:root {
  --font-display: 'Space Grotesk', 'Fractul Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Wix Madefor Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-page);
  color: var(--text-primary);
  font: 400 15px/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
  display: flex; flex-direction: column;
}
.hidden { display: none !important; }
button { font-family: var(--font-body); }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
input::placeholder { color: var(--dads-warm-gray); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop  { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── Blueprint panels ─────────────────────────────────────────── */
.bp-blue {
  background:
    linear-gradient(var(--grid-line-on-blue) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-on-blue) 1px, transparent 1px),
    var(--dads-blue);
  background-size: var(--grid-size) var(--grid-size), var(--grid-size) var(--grid-size), auto;
  color: #fff;
}
.bp-paper {
  background:
    linear-gradient(var(--grid-line-on-paper) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-on-paper) 1px, transparent 1px),
    var(--dads-paper);
  background-size: 24px 24px, 24px 24px, auto;
}

/* ── PIN lock screen ──────────────────────────────────────────── */
#login { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
#login.bp-blue { background-size: 40px 40px, 40px 40px, auto; }
.pin-wrap { flex: 1; display: flex; flex-direction: column; padding: 34px 26px calc(env(safe-area-inset-bottom, 0px) + 30px); }
.pin-logo { display: flex; justify-content: center; animation: rise var(--dur-slow) var(--ease-out) both; }
.pin-logo svg { height: 30px; width: auto; color: #fff; }
.pin-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.pin-title {
  font-family: var(--font-display); font-weight: 500; font-size: 60px;
  line-height: .98; letter-spacing: -0.02em; color: #fff;
  animation: rise var(--dur-slow) var(--ease-out) .05s both;
}
.pin-divider { width: 56px; height: 3px; background: rgba(255,255,255,.55); border-radius: 999px; margin: 16px 0 12px; animation: pop var(--dur-slow) var(--ease-out) .1s both; }
.pin-sub { max-width: 270px; font-size: 14px; line-height: 1.55; color: rgba(255,255,255,.85); animation: rise var(--dur-slow) var(--ease-out) .12s both; }
.pin-bottom { flex: none; animation: rise var(--dur-slow) var(--ease-out) .16s both; }
.pin-dots { display: flex; justify-content: center; gap: 18px; margin-bottom: 6px; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.55); background: transparent; transition: all .15s; }
.pin-dot.fill { background: #fff; border-color: #fff; box-shadow: 0 0 12px rgba(255,255,255,.6); }
.pin-err { height: 20px; text-align: center; font-weight: 600; font-size: 12px; color: #fff; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; max-width: 300px; margin: 4px auto 0; }
.keypad button {
  aspect-ratio: 1.45; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.5);
  background: transparent; color: #fff; font-family: var(--font-display);
  font-weight: 500; font-size: 24px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}
.keypad button:active { background: #fff; color: var(--dads-blue); transform: scale(.97); }
.pin-foot { text-align: center; margin-top: 16px; font-size: 12px; color: rgba(255,255,255,.65); }

/* ── App frame ────────────────────────────────────────────────── */
#app { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.masthead {
  flex: none; padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 12px;
  background: var(--surface-card); border-bottom: 1px solid var(--dads-light-gray);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.mast-left { display: flex; align-items: center; gap: 10px; }
.mast-left svg { width: 28px; height: 28px; color: var(--dads-blue); flex: none; }
.mast-eyebrow { font-weight: 600; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--dads-blue); margin-bottom: 3px; line-height: 1; }
.mast-title { font-family: var(--font-display); font-weight: 500; font-size: 18px; letter-spacing: -0.01em; color: var(--dads-navy); line-height: 1; }
.mast-right { display: flex; align-items: center; gap: 10px; }
.signout { background: none; border: none; color: var(--dads-gray-400); font-size: 11px; text-decoration: underline; padding: 4px; cursor: pointer; }

#view { flex: 1; overflow-y: auto; padding: 18px 16px 100px; max-width: 640px; width: 100%; margin: 0 auto; }

/* ── Bottom tab bar ───────────────────────────────────────────── */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--surface-card); border-top: 1px solid var(--dads-light-gray);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs button {
  flex: 1; padding: 9px 2px 10px; background: none; border: none; cursor: pointer;
  border-top: 2.5px solid transparent; margin-top: -1px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-weight: 600; font-size: 10px; letter-spacing: .03em; color: var(--dads-gray-400);
}
.tabs button svg { width: 20px; height: 20px; }
.tabs button.on { color: var(--dads-blue); border-top-color: var(--dads-blue); }

/* ── Type helpers ─────────────────────────────────────────────── */
.display-hi {
  font-family: var(--font-display); font-weight: 500; font-size: 32px;
  line-height: 1.02; letter-spacing: -0.02em; color: var(--dads-blue);
  margin: 0 0 16px; animation: rise var(--dur-slow) var(--ease-out) both;
}
.display-md { font-family: var(--font-display); font-weight: 500; font-size: 30px; line-height: 1.05; letter-spacing: -0.02em; color: var(--dads-blue); margin: 0 0 4px; animation: rise var(--dur-slow) var(--ease-out) both; }
.eyebrow { font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dads-gray-400); }
.helper { font-size: 12.5px; line-height: 1.45; color: var(--dads-gray-400); }
.footnote { font-size: 11.5px; line-height: 1.5; color: var(--dads-gray-400); margin-top: 12px; }
.lede { color: var(--dads-gray-600); margin-top: 0; }
.fine { font-size: 12.5px; line-height: 1.45; color: var(--dads-gray-400); }
.err { color: var(--dads-danger-text); font-weight: 600; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface-card); border: none; border-radius: var(--radius-lg);
  padding: 18px; margin: 0 0 12px; box-shadow: var(--shadow-card);
}
.card h3 { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dads-gray-400); }
.card .big { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; color: var(--dads-navy); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }

.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; animation: rise var(--dur-slow) var(--ease-out) .04s both; }
.stat { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 14px 6px; text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 26px; line-height: 1; color: var(--dads-navy); }
.stat span { display: block; font-weight: 600; font-size: 9px; letter-spacing: .07em; text-transform: uppercase; color: var(--dads-gray-400); margin-top: 6px; }
.stat.invert { background: var(--dads-blue); }
.stat.invert b { color: #fff; }
.stat.invert span { color: rgba(255,255,255,.8); }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: rgba(128,162,249,.28); color: var(--dads-blue);
}
.badge.solid, .badge.rookie { background: var(--dads-blue); color: #fff; }
.badge.done, .badge.success { background: var(--dads-success-bg); color: var(--dads-success-text); }
.badge.req { font-size: 9px; letter-spacing: .05em; text-transform: uppercase; background: var(--dads-light-gray); color: var(--dads-gray-600); padding: 2px 7px; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: block; width: 100%; margin-top: 12px; padding: 14px;
  font-size: 15px; font-weight: 600; border-radius: 999px; border: 1.5px solid var(--dads-blue);
  background: var(--surface-card); color: var(--dads-blue); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--dads-blue); border-color: var(--dads-blue); color: #fff; }
.btn.primary:active { background: var(--dads-blue-deep); }
.btn:disabled { opacity: .5; }
.btn.kudos, .btn.addci { width: auto; display: inline-block; padding: 10px 18px; font-size: 13px; margin-right: 8px; }

/* ── Checklist rows (tap-to-toggle) ───────────────────────────── */
.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 0;
  border-top: 1px solid var(--dads-light-gray); cursor: pointer;
}
.ckbox {
  width: 24px; height: 24px; flex: none; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; transition: all .12s;
  background: #fff; border: 1.5px solid var(--dads-warm-gray); color: transparent;
}
.check.done .ckbox { background: var(--dads-blue); border-color: var(--dads-blue); color: #fff; }
.check label, .check .cklabel { flex: 1; font-size: 14px; line-height: 1.4; color: var(--dads-ink); cursor: pointer; }
.check.done .cklabel, .check.done label { color: var(--dads-gray-400); text-decoration: line-through; }
.check input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--dads-blue); flex: none; margin-top: 1px; }

/* ── Earn table rows ──────────────────────────────────────────── */
.earnrow { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--dads-light-gray); }
.earnrow div:first-child { font-size: 13px; line-height: 1.35; color: var(--dads-gray-700); }
.earnrow div:last-child { font-weight: 600; font-size: 13px; color: var(--dads-blue); white-space: nowrap; }

/* ── My Card: hero, odometer, criteria, markers, ledger ───────── */
.hero-band { border-radius: var(--radius-lg); padding: 18px 16px; margin-bottom: 18px; animation: pop var(--dur-slow) var(--ease-out) both; background-size: 26px 26px, 26px 26px, auto; }
.hero-band .t { font-family: var(--font-display); font-weight: 500; font-size: 22px; letter-spacing: -0.01em; line-height: 1; }
.hero-band .s { font-size: 12px; color: rgba(255,255,255,.85); margin-top: 6px; }

.odo-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 22px; animation: rise var(--dur-slow) var(--ease-out) .04s both; }
.odo-ring { position: relative; width: 228px; height: 228px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.odo-inner {
  position: absolute; inset: 14px; border-radius: 50%; background: var(--surface-card);
  box-shadow: var(--shadow-card); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.odo-miles { font-family: var(--font-display); font-weight: 500; font-size: 46px; line-height: 1; letter-spacing: -0.02em; color: var(--dads-navy); }
.odo-cap { font-weight: 600; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--dads-gray-400); margin-top: 6px; }
.odo-pct { font-weight: 600; font-size: 13px; color: var(--dads-blue); margin-top: 6px; }
.odo-next { font-size: 12.5px; line-height: 1.45; color: var(--dads-gray-600); text-align: center; max-width: 260px; margin-top: 14px; }

.crit { display: flex; gap: 13px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--dads-light-gray); }
.crit-dot {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
  background: transparent; border: 1.5px solid var(--dads-warm-gray); color: var(--dads-warm-gray);
}
.crit.pass .crit-dot { background: var(--dads-success-bg); border: none; color: var(--dads-success-text); }
.crit.work .crit-dot { background: rgba(128,162,249,.28); border: none; color: var(--dads-blue); }
.crit-body { flex: 1; }
.crit-body b { font-weight: 600; font-size: 14px; color: var(--dads-ink); }
.crit-how { font-size: 12px; line-height: 1.4; color: var(--dads-gray-400); margin-top: 2px; }
.coach { font-style: italic; font-size: 12px; line-height: 1.4; color: var(--dads-navy); margin-top: 5px; }
.crit-status { font-weight: 700; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; padding-top: 2px; color: var(--dads-gray-400); }
.crit.pass .crit-status { color: var(--dads-success-text); }
.crit.work .crit-status { color: var(--dads-blue); }

.msbar { height: 8px; background: var(--dads-light-gray); border-radius: 999px; overflow: hidden; margin: 0 0 14px; }
.msfill { height: 100%; background: var(--dads-blue); border-radius: 999px; transition: width .6s var(--ease-out); }
.marker { display: flex; gap: 11px; padding: 7px 0; }
.marker .mdot { width: 11px; height: 11px; flex: none; border-radius: 50%; margin-top: 4px; background: transparent; border: 1.5px solid var(--dads-warm-gray); }
.marker.hit .mdot { background: var(--dads-success-text); border: none; }
.marker .mtext { flex: 1; font-size: 13px; line-height: 1.4; color: var(--dads-gray-400); }
.marker.hit .mtext { color: var(--dads-success-text); font-weight: 600; }

.trophy { border: 1px solid var(--dads-light-gray); background: var(--bg-page); border-radius: 12px; padding: 14px 15px; margin: 0; }
.trophy .tt { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--dads-navy); }
.trophy .tt svg { width: 18px; height: 18px; color: var(--dads-blue); }
.trophy .req-line { font-size: 12.5px; line-height: 1.45; color: var(--dads-gray-600); margin-top: 4px; }
.trophy .prize { font-weight: 600; font-size: 13px; color: var(--dads-success-text); margin-top: 6px; }

.ledger-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--dads-light-gray); }
.ledger-row .lr { font-size: 13px; line-height: 1.35; color: var(--dads-ink); }
.ledger-row .ld { font-size: 11px; color: var(--dads-gray-400); margin-top: 2px; }
.ledger-row .lp { font-weight: 600; font-size: 14px; color: var(--dads-success-text); white-space: nowrap; }

/* ── Playbook ─────────────────────────────────────────────────── */
.sopsearch { position: relative; margin-bottom: 12px; }
.sopsearch svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--dads-gray-400); }
.sopsearch input {
  width: 100%; padding: 13px 16px 13px 42px; border-radius: 999px;
  border: 1.5px solid var(--dads-light-gray); background: var(--surface-card);
  color: var(--dads-ink); font-family: var(--font-body); font-size: 14px; outline: none;
}
.sopsearch input:focus { border-color: var(--dads-blue); }
details.sop { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); margin: 0 0 10px; padding: 2px 16px; }
details.sop summary { padding: 13px 0; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; color: var(--dads-ink); }
details.sop summary svg { width: 20px; height: 20px; flex: none; color: var(--dads-blue); }
details.sop summary .st { flex: 1; }
details.sop .body { padding: 0 0 14px; }
.sopline { display: flex; gap: 9px; padding: 5px 0; font-size: 13px; line-height: 1.5; color: var(--dads-gray-700); }
.sopline .dash { color: var(--dads-blue); flex: none; }
.refhead { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--dads-gray-400); margin: 20px 0 8px; }
.refwrap { overflow-x: auto; padding-bottom: 4px; }
table.hist { width: 100%; border-collapse: collapse; font-size: 13px; }
table.hist td, table.hist th { padding: 8px 6px; border-bottom: 1px solid var(--dads-light-gray); text-align: left; vertical-align: top; }
table.hist th { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--dads-gray-400); }
table.earns td:last-child { text-align: right; white-space: nowrap; font-weight: 600; color: var(--dads-blue); }
.pts { color: var(--dads-blue); font-weight: 600; }

/* ── Day One ──────────────────────────────────────────────────── */
.dayone-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; animation: rise var(--dur-slow) var(--ease-out) both; }
.paper-panel { border-radius: var(--radius-lg); padding: 15px 16px; margin-bottom: 12px; animation: rise var(--dur-slow) var(--ease-out) .04s both; }
.paper-panel .t { font-weight: 600; font-size: 15px; color: var(--dads-navy); margin-bottom: 4px; }
.paper-panel .s { font-size: 12.5px; line-height: 1.5; color: var(--dads-gray-600); }
.paper-panel b { color: var(--dads-ink); }

.field { margin: 12px 0 0; }
.field label { display: block; font-weight: 500; font-size: 12px; color: var(--dads-gray-600); margin-bottom: 5px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--dads-light-gray); background: var(--surface-card);
  color: var(--dads-ink); font-family: var(--font-body); font-size: 15px; outline: none;
}
.field input:focus { border-color: var(--dads-blue); }
.center-foot { font-size: 11.5px; line-height: 1.5; color: var(--dads-gray-400); margin-top: 10px; text-align: center; }

/* ── Week + payday split (kept from Charlie's spec) ───────────── */
.card.weekpay { display: flex; gap: 16px; }
.card.weekpay .wp { flex: 1; }
.card.weekpay .wp + .wp { border-left: 1px solid var(--dads-light-gray); padding-left: 14px; }
.card.weekpay .wp .v { font-size: 13px; color: var(--dads-gray-600); line-height: 1.45; }
.card.weekpay .wp .v b { color: var(--dads-navy); }

/* ── Crew (tech/lead) legacy views, restyled with tokens ──────── */
.scorebar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.scorebar > div { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); text-align: center; padding: 14px 4px; }
.scorebar b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 26px; line-height: 1; color: var(--dads-navy); }
.scorebar > div:first-child { background: var(--dads-blue); }
.scorebar > div:first-child b { color: #fff; }
.scorebar > div:first-child span { color: rgba(255,255,255,.8); }
.scorebar span { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--dads-gray-400); }
.goal {
  border-radius: var(--radius-lg); padding: 14px 16px; margin: 4px 0 12px; text-align: center;
  font-family: var(--font-display); font-weight: 500; font-size: 13px; letter-spacing: .03em;
}
.goal b { color: #FFD23F; }
.rung { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--dads-light-gray); }
.rung .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--dads-warm-gray); flex: none; }
.rung.hit .dot { background: var(--dads-blue); border-color: var(--dads-blue); }
.rung.now .dot { background: var(--dads-navy); border-color: var(--dads-navy); }
.rung.now { font-weight: 600; }
ul.fine li.hit { text-decoration: line-through; color: var(--dads-success-text); }
.checkin { border-left: 3px solid var(--dads-blue); padding: 6px 10px; margin: 8px 0; }
.lead-crit { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--dads-light-gray); }
.lc-title { font-size: 13.5px; }
.seg { display: flex; border: 1.5px solid var(--dads-light-gray); border-radius: 999px; overflow: hidden; flex: none; }
.seg button { border: none; background: var(--surface-card); padding: 8px 13px; font-weight: 600; font-size: 14px; color: var(--dads-warm-gray); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--dads-light-gray); }
.seg button.on { color: #fff; background: var(--dads-navy); }
.seg button.on.pass { background: var(--dads-success-text); }
.seg button.on.work { background: var(--dads-blue); }

/* PIN fallback text input (crew login on desktop etc.) */
.pinlabel { display: block; margin: 24px 0 8px; }
#pin { position: absolute; opacity: 0; pointer-events: none; }
