/* Scratch Support dashboard. Navy ink, a pink accent used sparingly, one serif for headline numbers. */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e2e5ea;
  --ink: #141a2e;
  --muted: #586074;
  --accent: #c2305c;
  --accent-ink: #ffffff;
  --good: #1d7349;
  --bad: #b8322a;
  --warn-bg: #fff6e0;
  --warn-ink: #6b4a00;
  --good-bg: #e8f5ee;
  --bad-bg: #fdeceb;
  --series-1: #1e2f5c;
  --series-2: #c2305c;
  --series-3: #3a8fa3;
  --grid: #eceef2;
  --axis: #8a91a3;
  --goal: #b8322a;
  --ref: #9aa1b2;
  --tip-bg: #141a2e;
  --tip-ink: #ffffff;
  --radius: 10px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1120;
    --panel: #161a2b;
    --line: #272d44;
    --ink: #e8eaf2;
    --muted: #a3a9bb;
    --accent: #ff6f98;
    --accent-ink: #1a0b12;
    --good: #5fd09a;
    --bad: #ff8577;
    --warn-bg: #3a2e0f;
    --warn-ink: #ffe3a1;
    --good-bg: #12301f;
    --bad-bg: #3b1715;
    --series-1: #9db4ff;
    --series-2: #ff6f98;
    --series-3: #5cc4d6;
    --grid: #22283d;
    --axis: #7d849a;
    --goal: #ff8577;
    --ref: #5d647c;
    --tip-bg: #e8eaf2;
    --tip-ink: #141a2e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }  /* keeps focused and linked items clear of the sticky bar */
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: inherit; text-underline-offset: 2px; }
b { font-weight: 600; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 18px; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 7px; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--bg); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--bg); box-shadow: inset 0 -2px 0 var(--accent); }
.who { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.who form { margin: 0; }
.who-link { color: var(--muted); padding: 4px 2px; min-height: 24px; display: inline-flex; align-items: center; }

/* ---------- Page ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 40px; }
.head { display: flex; flex-direction: column; gap: 8px; max-width: 78ch; }
.title { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.15; margin: 0; }
.lede { font-size: 17px; line-height: 1.55; margin: 0; }
.window { font-size: 13px; color: var(--muted); margin: 0; }
.section { display: flex; flex-direction: column; gap: 14px; }
.section > h2 { font-size: 19px; font-weight: 600; margin: 0; }
.sub { font-size: 13.5px; color: var(--muted); margin: 0; max-width: 84ch; line-height: 1.55; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 16px; }
.grid-form { grid-template-columns: minmax(min(100%, 20rem), 1fr) minmax(min(100%, 28rem), 2fr); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 16px; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 16px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3 { font-size: 16px; font-weight: 600; margin: 0; }
.kicker { font-size: 12.5px; color: var(--muted); margin: 0; letter-spacing: .02em; }
.label { font-size: 13px; color: var(--muted); margin: 0; }
.note { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.note b { color: var(--ink); }
.big { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }
.headline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.delta { font-size: 13px; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.goal-status { margin: -2px 0 0; font-size: 14px; font-weight: 600; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.flat { color: var(--muted); }

/* ---------- Notices ---------- */
.notice { margin: 0; padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; max-width: 78ch; }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.notice-good { background: var(--good-bg); border-color: transparent; }
.notice-bad { background: var(--bad-bg); border-color: transparent; }

/* ---------- Bonus check ---------- */
.checks { display: flex; flex-direction: column; }
.check { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 6px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check-name { margin: 0; }
.check-val { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.status { font-size: 13px; font-weight: 600; min-width: 6.5rem; text-align: right; }
.outcome { margin: 0; line-height: 1.55; }

/* ---------- Billy's phases ---------- */
.phases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 16px; }
.phase { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.phase-done { background: var(--bg); }
.done-tag { color: var(--muted); }
.phase-now { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.phase-when { font-size: 13px; color: var(--muted); margin: 0; }
.phase-name { font-weight: 600; margin: 0; }
.now-tag { color: var(--accent); font-weight: 600; }

/* ---------- 1:1 cards ---------- */
.prows { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px 16px; align-items: baseline; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.prows .ph { color: var(--muted); font-size: 12.5px; text-align: right; }
.prows .ph:first-child { text-align: left; }
.prows .pv { text-align: right; font-weight: 600; }
.prows .pa { text-align: right; color: var(--muted); }
.prows .pc { text-align: right; font-weight: 600; min-width: 3.6rem; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; min-height: 230px; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--muted); font: 12px var(--sans); }
.chart .grid-line { stroke: var(--grid); }
.chart .goal-line { stroke: var(--goal); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .ref-line { stroke: var(--ref); stroke-dasharray: 2 3; }
.chart .end-label { fill: var(--ink); font-weight: 600; }
.chart .hover-band { fill: transparent; }
.tip { position: absolute; z-index: 3; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink); border-radius: 7px; padding: 6px 10px; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.tip .tip-h { opacity: .75; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); margin: 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.swatch-1 { background: var(--series-1); }
.swatch-2 { background: var(--series-2); }
.swatch-3 { background: var(--series-3); }

/* ---------- Tables ---------- */
.tablebox { overflow: auto; max-height: 18rem; }
.tablebox-tall { max-height: 32rem; }
.tablebox-full { max-height: none; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th:first-child, .table td:first-child { text-align: left; }
.table th { position: sticky; top: 0; background: var(--panel); font-weight: 600; color: var(--muted); font-size: 12.5px; }
.table .muted { color: var(--muted); }
.table .details { text-align: left; color: var(--muted); white-space: normal; min-width: 14rem; }
.table-runs td:nth-child(2), .table-runs th:nth-child(2) { text-align: left; }
.cell-note { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; margin-left: 10px; }

/* ---------- Forms and buttons ---------- */
.form .field { display: flex; flex-direction: column; gap: 5px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { font-size: 13px; font-weight: 600; }
.optional { font-weight: 400; color: var(--muted); }
input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[readonly] { color: var(--muted); }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.button { font: inherit; font-weight: 600; font-size: 14px; border: 0; border-radius: 8px; padding: 10px 16px; background: var(--ink); color: var(--panel); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; justify-content: center; white-space: nowrap; }
.button:hover { opacity: .9; }
.button:disabled { opacity: .55; cursor: default; }
.button-quiet { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.linkish { font: inherit; font-size: 13px; background: none; border: 0; padding: 4px 2px; min-height: 24px; display: inline-flex; align-items: center; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--ink); }
.linkish-bad:hover { color: var(--bad); }
.refresh-form { margin: 0 0 6px; }

/* ---------- Disclosure ---------- */
.disclosure { gap: 14px; }
.disclosure > summary { cursor: pointer; font-weight: 600; min-height: 24px; }
.disclosure:not([open]) { padding-block: 16px; }

/* ---------- Sign in ---------- */
.page-login { min-height: 100vh; justify-content: center; }
.login { width: 100%; max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.login-title { font-family: var(--serif); font-weight: 400; font-size: 32px; margin: 0; }
.login-sub { margin: -8px 0 0; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-row { display: flex; gap: 8px; }
.login-leaders { border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.login-or { margin: 0; font-size: 13px; font-weight: 600; }
.button-google { align-self: flex-start; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Method ---------- */
.method { font-size: 13.5px; color: var(--muted); line-height: 1.6; display: flex; flex-direction: column; gap: 8px; max-width: 84ch; }
.method p { margin: 0; }
.method b { color: var(--ink); font-weight: 600; }

@media (max-width: 900px) {
  .grid-form { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 8px 16px 0; gap: 4px 16px; }
  .brand { order: 1; }
  .who { order: 2; margin-left: auto; }
  .nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -6px; padding-bottom: 6px; }
  .page { padding: 24px 16px 48px; gap: 32px; }
  .title { font-size: 28px; }
  .card { padding: 18px; }
  .check { grid-template-columns: minmax(0, 1fr) auto; }
  .check .status { grid-column: 2; min-width: 0; }
  .big { font-size: 32px; }
  .prows { gap: 6px 10px; }
  .prows .pc { min-width: 0; }
}

@media print {
  .topbar, .refresh-form, .row-actions { display: none; }
  body { background: #fff; }
  .card { break-inside: avoid; }
}
