/* Scooby's Plan shell. Values come from tokens.css; nothing here is a raw colour.
   Phone first: bottom tabs under 768px, a left rail from 768px up. */

/* ---- base ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ground);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { touch-action: manipulation; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- type ------------------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-size: var(--text-greeting);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-body);
  color: var(--text-2);
}

.label {
  font-size: var(--text-label);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: var(--tracking-label);
  color: var(--text-3);
}
.label-accent { color: var(--accent); }

.dateline {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

.note {
  font-size: var(--text-md);
  line-height: 1.4;
  color: var(--text-2);
  text-align: center;
}
.note-alert { color: var(--attention); }

/* ---- marks ------------------------------------------------------------ */

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-mark);
  background: var(--mark-bg);
  color: var(--mark-fg);
  box-shadow: inset 0 0 0 1px var(--mark-edge);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}
.mark-sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 13px;
}

/* The visible circle is 36px; the link around it is a full 48px tap target. */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--tap);
  height: var(--tap);
  margin: -6px -6px -6px 0;
  padding: 6px;
  border-radius: 50%;
  background: var(--fill);
  background-clip: content-box;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: opacity var(--motion) var(--ease);
}
a.avatar:hover { color: var(--ink); opacity: 0.8; }
.avatar-sm {
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  font-size: 12px;
}

/* ---- cards and rows --------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
}

.empty {
  padding: var(--space-4);
  font-size: var(--text-base);
  color: var(--text-3);
}
.empty-plain { padding: 0 var(--space-1); }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-4);
  color: var(--ink);
  text-align: left;
}
.row-button {
  border: 0;
  margin: 0;
  background: var(--surface);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: background-color var(--motion) var(--ease), opacity var(--motion) var(--ease);
}
.row-button:hover { background: var(--accent-wash); }
.row-button:active { opacity: 0.7; }
.row-button:disabled { opacity: 0.6; cursor: default; }
.row-icon { flex-shrink: 0; color: var(--text-3); }
.row-text { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-title { font-size: var(--text-base); font-weight: 500; line-height: 1.35; }
.row-meta { font-size: var(--text-sm); color: var(--text-3); }
.row-quiet { justify-content: center; color: var(--attention); font-weight: 500; }

.list > li > .row { border-radius: 0; }
.list > li + li { border-top: 1px solid var(--hairline); }
.row-link { justify-content: space-between; transition: background-color var(--motion) var(--ease); }
.row-link:hover { color: var(--ink); background: var(--accent-wash); }
.list > li:first-child > .row-link { border-top-left-radius: var(--radius-card); border-top-right-radius: var(--radius-card); }
.list > li:last-child > .row-link { border-bottom-left-radius: var(--radius-card); border-bottom-right-radius: var(--radius-card); }
.chevron { flex-shrink: 0; color: var(--text-3); }

/* ---- buttons ---------------------------------------------------------- */

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: var(--button-h);
  padding: 0 var(--space-5);
  border: 0;
  border-radius: var(--radius-card);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--motion) var(--ease), transform var(--motion) var(--ease),
              opacity var(--motion) var(--ease);
}
.button:hover { background: var(--accent-hover); }
.button:active { transform: scale(0.98); }
.button:disabled { opacity: 0.6; cursor: default; transform: none; }
.button:focus-visible { border-radius: var(--radius-card); }

.text-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: var(--space-3);
  font-size: var(--text-md);
  font-weight: 500;
  text-align: center;
}

/* ---- shell: phone (bottom tabs) --------------------------------------- */

.main {
  padding:
    calc(var(--space-8) + env(safe-area-inset-top))
    max(var(--space-5), env(safe-area-inset-right))
    calc(104px + env(safe-area-inset-bottom))
    max(var(--space-5), env(safe-area-inset-left));
}

.page { display: flex; flex-direction: column; gap: var(--space-6); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 36px;
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding:
    var(--space-2)
    max(var(--space-2), env(safe-area-inset-right))
    max(var(--space-4), env(safe-area-inset-bottom))
    max(var(--space-2), env(safe-area-inset-left));
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hairline-2);
}

.nav > .nav-brand, .nav > .nav-rail-only, .nav > .nav-foot { display: none; }

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--tap);
  padding: var(--space-2) 0;
  color: var(--text-3);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.2;
  transition: color var(--motion) var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"], .nav-link.is-within { color: var(--accent); font-weight: 600; }
.nav-icon { display: block; flex-shrink: 0; }

.nav-home { order: 1; }
.nav-tasks { order: 2; }
.nav-goals { order: 3; }
.nav-fishon { order: 4; }
.nav-more { order: 5; }

/* ---- home ------------------------------------------------------------- */

.home { display: flex; flex-direction: column; gap: var(--space-6); }
.greeting { display: flex; flex-direction: column; gap: 10px; }
.blocks { display: flex; flex-direction: column; gap: var(--space-6); }
.block { display: flex; flex-direction: column; gap: var(--space-3); }
.device { display: flex; flex-direction: column; gap: var(--space-3); }
.device:not(:has(> :not([hidden]))) { display: none; }

/* Task rows: title, a Business/Personal tag with its meta, and a round done control. */
.task { transition: opacity var(--motion) var(--ease); }
.task.is-done { opacity: 0; }
.task-row { padding-right: var(--space-2); }
.task-row .row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
}
.tag-business { background: var(--accent-wash); color: var(--accent); }
.tag-personal { background: var(--fill); color: var(--text-2); }
.alert-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--attention);
}
.done-form { flex-shrink: 0; }
.done {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--motion) var(--ease), background-color var(--motion) var(--ease);
}
/* The visible ring is 30px inside the 48px target. */
.done svg {
  box-sizing: content-box;
  padding: 4px;
  border: 1px solid var(--hairline-2);
  border-radius: 50%;
  transition: border-color var(--motion) var(--ease), background-color var(--motion) var(--ease);
}
.done:hover { color: var(--accent); }
.done:hover svg { border-color: var(--accent); }
.done:active svg { background: var(--accent-wash); }
.done:focus-visible { border-radius: 50%; }
.row-more { position: relative; flex-shrink: 0; }
.row-more > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  color: var(--text-3);
  list-style: none;
  cursor: pointer;
}
.row-more > summary::-webkit-details-marker { display: none; }
.row-more[open] > summary { color: var(--ink); }

/* Business figures: 2 + 1 on the phone, 3 across from 1024px. */
.figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5) var(--space-4);
  padding: var(--space-5) var(--space-4);
}
.fig { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fig b {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.fig-none { font-size: var(--text-base); line-height: calc(var(--text-xl) * 1.2); color: var(--text-3); }
.fig-label { font-size: var(--text-sm); color: var(--text-3); }
.fig-sub { font-size: var(--text-sm); color: var(--text-2); }
.asof { font-size: var(--text-sm); color: var(--text-3); }
.asof-stale { color: var(--attention); }

/* The private block: closed on every load, opened in place with no script. */
.private > summary {
  justify-content: space-between;
  min-height: var(--tap);
  color: var(--text-2);
  list-style: none;
  cursor: pointer;
}
.private > summary::-webkit-details-marker { display: none; }
.private-show { font-size: var(--text-md); font-weight: 500; color: var(--accent); }
.private[open] .private-show { visibility: hidden; }
.private-body { border-top: 1px solid var(--hairline); }
.block > .empty { padding: var(--space-1) 0 0; }
.checkin { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4); }

/* ---- section placeholders and More ------------------------------------ */

.section-page { display: flex; flex-direction: column; gap: 10px; }
.more-page { display: flex; flex-direction: column; gap: var(--space-5); }
.more-page .display { margin-bottom: var(--space-2); }

/* ---- settings and devices --------------------------------------------- */

.settings-page { display: flex; flex-direction: column; gap: var(--space-6); max-width: 560px; }
.settings-page .display { margin-bottom: var(--space-2); }
.settings-page .block { gap: var(--space-3); }
.device-row { justify-content: space-between; }
.device-row form { flex-shrink: 0; }
.badge {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-wash);
  color: var(--accent);
  font-size: var(--text-label);
  font-weight: 600;
  vertical-align: 1px;
}
.row-action {
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: var(--attention);
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--motion) var(--ease);
}
.row-action:active { opacity: 0.6; }

/* ---- sign in ---------------------------------------------------------- */

.auth-page {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-7);
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(120px + env(safe-area-inset-top))
    max(var(--space-5), env(safe-area-inset-right))
    max(56px, calc(env(safe-area-inset-bottom) + var(--space-5)))
    max(var(--space-5), env(safe-area-inset-left));
}
.auth-head { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-head .display { margin-top: var(--space-4); }
.auth-actions { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-4); }
.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-form .auth-actions { margin-top: var(--space-3); }

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field label { font-size: var(--text-sm); font-weight: 500; color: var(--text-3); }
.field input {
  width: 100%;
  height: 52px;
  padding: 0 var(--space-4);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-lg);   /* 16px or more stops iOS zooming into the field */
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.field input:focus-visible { outline: none; }

/* ---- quick add: the + button, the bottom sheet, the toast -------------- */

.fab {
  position: fixed;
  right: max(var(--space-5), env(safe-area-inset-right));
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--button-h);
  height: var(--button-h);
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  transition: background-color var(--motion) var(--ease), transform var(--motion) var(--ease);
}
.fab:hover { background: var(--accent-hover); color: var(--on-accent); }
.fab:active { transform: scale(0.94); }
.fab:focus-visible { border-radius: 50%; }

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - var(--space-7));
  margin: auto 0 0;
  padding: var(--space-5) max(var(--space-5), env(safe-area-inset-right))
           calc(var(--space-5) + env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left));
  border: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.16);
  overflow-y: auto;
}
.sheet[open] { animation: sheet-rise 220ms var(--ease); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.36); }
@keyframes sheet-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-form { display: flex; flex-direction: column; gap: var(--space-4); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-close {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-2);
  font-size: var(--text-md);
  font-weight: 500;
}
.sheet-title, .sheet-date {
  width: 100%;
  height: 52px;
  padding: 0 var(--space-4);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius-md);
  background: var(--ground);
  color: var(--ink);
  font-size: var(--text-lg);   /* 16px or more stops iOS zooming into the field */
  -webkit-appearance: none;
  appearance: none;
}
.sheet-title:focus, .sheet-date:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.sheet-title:focus-visible, .sheet-date:focus-visible { outline: none; }
.sheet .button { width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.chips > legend { float: left; width: 100%; padding: 0 0 var(--space-1); }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--ground);
  color: var(--text-2);
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--motion) var(--ease), color var(--motion) var(--ease);
}
.chip > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: var(--radius-pill);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.chip:has(:checked) { background: var(--ink); color: var(--ground); }
.chip:has(:focus-visible) { box-shadow: 0 0 0 3px var(--focus); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(150px + env(safe-area-inset-bottom));
  z-index: 30;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--ground);
  font-size: var(--text-md);
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

/* ---- shell: tablet and laptop (left rail) ----------------------------- */

/* ---- Fish On ---------------------------------------------------------- */

.fishon-page { display: flex; flex-direction: column; gap: var(--space-5); }
.subnav { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-weight: 500;
}
.subnav a.is-current { background: var(--accent-wash); color: var(--accent); font-weight: 600; }

/* Grades are solid badges: A green, B gold. */
.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 28px;
  height: 28px;
  border: 1.5px solid currentColor;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1;
}
.grade-a { color: var(--on-fishon); background: var(--win); border-color: var(--win); }
.grade-b { color: #1F1400; background: var(--gold); border-color: var(--gold); }
.display .grade { vertical-align: middle; }
.edge-price { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.factor-row { justify-content: space-between; }
.factor { font-size: var(--text-md); font-weight: 600; }
.factor-pass { color: var(--win); }
.factor-fail { color: var(--loss); }

/* Fish On: a deep green band over the page head, sport tags, and money in win and loss colours. */
.fishon-band {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, var(--fishon) 0%, var(--fishon-2) 100%);
  color: var(--on-fishon);
}
.fishon-band .display { color: var(--on-fishon); }
.fishon-band .subnav a { color: var(--on-fishon); opacity: 0.85; background: rgba(255, 255, 255, 0.08); }
.fishon-band .subnav a.is-current { opacity: 1; background: rgba(255, 255, 255, 0.22); color: var(--on-fishon); }
.fishon-band-meta { font-size: var(--text-sm); opacity: 0.85; }
.sport {
  display: inline-block; padding: 1px 7px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; line-height: 1.5;
  color: #FFFFFF; background: var(--text-3); vertical-align: 1px;
}
.sport-nfl { background: var(--nfl); }
.sport-nhl { background: var(--nhl); }
.sport-nba { background: var(--nba); }
.edge-pct { color: var(--win); font-weight: 600; }
.money-pos { color: var(--win); font-weight: 600; }
.money-neg { color: var(--loss); font-weight: 600; }
.result { font-weight: 700; }
.result-won { color: var(--win); }
.result-lost { color: var(--loss); }
.result-push, .result-void { color: var(--text-3); }
.edge-row .grade-a ~ .row-text .row-title { font-weight: 600; }
[data-block="fishon"] .card { border-top: 4px solid var(--fishon-2); }
[data-block="fishon"] .label { color: var(--fishon-2); }

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.log-form { padding: var(--space-4); }
.paused { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }

.bet-row { flex-wrap: wrap; align-items: flex-start; }
.bet-row > .row-text { color: var(--ink); }
.bet-row > .row-more > summary { min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 var(--space-2); }
.bet-actions { display: flex; flex-direction: column; gap: var(--space-4); padding-top: var(--space-3); }
.row-more[open] { flex-basis: 100%; }
button.chip { border: 1px solid var(--hairline-2); background: var(--surface); font: inherit; cursor: pointer; }
button.chip:hover { background: var(--accent-wash); }

.table-wrap { overflow-x: auto; }
.record-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.record-table th, .record-table td { padding: var(--space-2) var(--space-3); text-align: right; white-space: nowrap; }
.record-table th[scope="row"], .record-table thead th:first-child { text-align: left; }
.record-table thead th { color: var(--text-3); font-weight: 600; }
.record-table tbody tr + tr { border-top: 1px solid var(--hairline); }

/* The alerts switch: a native checkbox drawn as a switch. */
.switch-row { justify-content: space-between; cursor: pointer; }
.switch {
  position: relative;
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--fill);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color var(--motion) var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform var(--motion) var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.5; cursor: default; }
.switch:focus-visible { box-shadow: 0 0 0 3px var(--focus); outline: none; }

@media (min-width: 768px) {
  body.shell {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    align-items: start;
  }

  .nav {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    height: 100vh;
    height: 100dvh;
    padding: var(--space-6) var(--space-4);
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-top: 0;
    border-right: 1px solid var(--hairline-2);
    overflow-y: auto;
  }

  .nav > .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 var(--space-3) 28px;
  }
  .wordmark { font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; }

  .nav > .nav-rail-only { display: flex; }
  .nav > .nav-more, .nav-icon { display: none; }

  .nav-link {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    min-height: 44px;
    padding: 10px var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-nav);
    font-size: var(--text-md);
    font-weight: 400;
    line-height: 1.33;
    transition: background-color var(--motion) var(--ease), color var(--motion) var(--ease);
  }
  .nav-link:hover { background: var(--hairline); color: var(--ink); }
  .nav-link[aria-current="page"] { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
  .nav-home, .nav-tasks, .nav-goals, .nav-fishon { order: 0; }

  .nav > .nav-foot {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: auto;
    padding-top: var(--space-5);
  }
  .nav-person {
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: 10px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-nav);
    font-size: var(--text-md);
    transition: background-color var(--motion) var(--ease);
  }
  .nav-person:hover { background: var(--hairline); color: var(--ink); }
  .nav-signout {
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-3);
    font-size: var(--text-sm);
    text-align: left;
    cursor: pointer;
    transition: background-color var(--motion) var(--ease), color var(--motion) var(--ease);
  }
  .nav-signout:hover { background: var(--hairline); color: var(--ink); }

  .main {
    min-width: 0;
    padding:
      56px
      max(var(--space-8), env(safe-area-inset-right))
      var(--space-8)
      var(--space-8);
  }
  .page { max-width: 960px; gap: 10px; }
  .topbar { min-height: 0; }
  .topbar .avatar { display: none; }
  .shell:not(.is-home) .topbar { display: none; }

  .display { font-size: var(--text-greeting-lg); }
  .lede { font-size: 18px; }

  .home { gap: var(--space-7); }
  .card > .empty { padding: 18px; }
  .empty-plain { padding: 18px var(--space-1); }

  .more-page { max-width: 560px; }
  .device { max-width: 420px; }

  .fab { bottom: 32px; right: 32px; }
  .sheet {
    max-width: 440px;
    margin: auto auto 0;
    padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
  }
  .toast { bottom: 40px; left: calc(50% + var(--rail-w) / 2); }

  .auth-page {
    justify-content: center;
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  :root { --rail-w: 220px; }
  .main { padding: var(--space-7) var(--space-6) var(--space-7); }
}

@media (min-width: 1024px) {
  /* The three groups sit side by side; figures and Personal run full width under them. */
  .blocks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-5);
    align-items: start;
  }
  .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: var(--space-5); }
}

/* ---- app colour (2026-10-28) -------------------------------------------
   Mike: "it doesn't look like an app, needs color". Each section owns a colour pair (tokens.css);
   <body data-section> picks it, and the header, active tab, buttons, chips and the + follow it. */

body { --tint: var(--c-more); --tint-2: var(--c-more-2); --tint-wash: var(--accent-wash); }
[data-section="home"] { --tint: var(--c-home); --tint-2: var(--c-home-2); }
[data-section="tasks"] { --tint: var(--c-tasks); --tint-2: var(--c-tasks-2); }
[data-section="goals"] { --tint: var(--c-goals); --tint-2: var(--c-goals-2); }
[data-section="fishon"] { --tint: var(--c-fishon); --tint-2: var(--c-fishon-2); }
[data-section="personal"] { --tint: var(--c-personal); --tint-2: var(--c-personal-2); }
[data-section="business"] { --tint: var(--c-business); --tint-2: var(--c-business-2); }
[data-section="finance"] { --tint: var(--c-finance); --tint-2: var(--c-finance-2); }
[data-section="calendar"] { --tint: var(--c-calendar); --tint-2: var(--c-calendar-2); }
[data-section="intelligence"] { --tint: var(--c-intelligence); --tint-2: var(--c-intelligence-2); }
@supports (color: color-mix(in srgb, red 50%, blue)) {
  body { --tint-wash: color-mix(in srgb, var(--tint) 12%, var(--surface)); }
}

/* A soft glow of the section colour behind the top of every page. */
body.shell {
  background:
    radial-gradient(120% 420px at 50% -120px, color-mix(in srgb, var(--tint-2) 24%, transparent), transparent 72%) no-repeat,
    var(--ground);
}

/* The page header: a colour card with the title in white. */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5) var(--space-5);
  border-radius: var(--radius-hero);
  background: linear-gradient(135deg, var(--tint) 0%, var(--tint-2) 100%);
  color: #FFFFFF;
  box-shadow: 0 16px 36px -16px color-mix(in srgb, var(--tint) 70%, transparent);
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  pointer-events: none;
}
.hero::before { width: 240px; height: 240px; right: -70px; top: -110px; }
.hero::after { width: 150px; height: 150px; right: 70px; bottom: -100px; background: rgba(255, 255, 255, 0.08); }
.hero .display { color: #FFFFFF; }
.hero .dateline {
  color: #FFFFFF;
  opacity: 0.85;
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.hero-sub { font-size: var(--text-md); color: #FFFFFF; opacity: 0.9; }
.hero-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: #FFFFFF;
  opacity: 0.85;
  font-size: var(--text-sm);
  font-weight: 600;
}
.hero-back::before { content: "\2039"; margin-right: 6px; font-size: 20px; line-height: 1; }
.hero-back:hover { color: #FFFFFF; opacity: 1; }
.hero-stats { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.hero-stat {
  display: flex;
  flex-direction: column;
  min-width: 84px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.17);
  color: #FFFFFF;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background-color var(--motion) var(--ease);
}
.hero-stat:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.26); }
.hero-stat b { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.85; }
.hero .grade-a { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
.hero .grade-b { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
.hero .sport { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5); }

/* Cards lift off the page. */
.card { box-shadow: var(--shadow-card); }
.row-link:hover, .row-button:hover { background: var(--tint-wash); }

/* Section labels carry a colour dot; on Home each block has its own colour and a matching strip. */
.block > .label { display: flex; align-items: center; gap: var(--space-2); color: var(--ink); }
.block > .label::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--tint));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--tint)) 22%, transparent);
}
.block > .label-accent { color: var(--ink); }
[data-group="now"] { --dot: var(--attention); }
[data-group="today"] { --dot: var(--c-tasks); }
[data-group="up_next"] { --dot: var(--c-home-2); }
[data-block="coming"] { --dot: var(--c-personal); }
[data-block="figures"] { --dot: var(--c-business-2); }
[data-block="fishon"] { --dot: var(--c-fishon-2); }
[data-block="private"] { --dot: var(--c-personal-2); }
.home .block > .card { border-top: 4px solid var(--dot); }
[data-block="fishon"] .card { border-top-color: var(--c-fishon-2); }
[data-block="fishon"] .label { color: var(--ink); }

/* Figures are coloured tiles: each number sits on a wash of its own colour. */
.figures { gap: var(--space-3); padding: var(--space-3); }
.fig {
  --fig: var(--tint);
  gap: 4px;
  padding: var(--space-4);
  border-radius: 14px;
  background: color-mix(in srgb, var(--fig) 10%, var(--surface));
}
.figures > .fig:nth-child(1) { --fig: var(--c-tasks); }
.figures > .fig:nth-child(2) { --fig: var(--c-business-2); }
.figures > .fig:nth-child(3) { --fig: var(--c-home-2); }
[data-section="fishon"] .figures > .fig:nth-child(1) { --fig: var(--c-fishon-2); }
[data-section="fishon"] .figures > .fig:nth-child(3) { --fig: var(--win); }

/* Phone: the colour header sits close under the status bar. */
@media (max-width: 767px) {
  .main { padding-top: calc(var(--space-5) + env(safe-area-inset-top)); }
  .page { gap: var(--space-5); }
}
.fig b { color: color-mix(in srgb, var(--fig) 72%, var(--ink)); }
.fig-label { color: color-mix(in srgb, var(--fig) 55%, var(--text-3)); font-weight: 600; }
.fig b.edge-pct { color: var(--win); }

/* Tags and the done ring. */
.tag-business { background: color-mix(in srgb, var(--c-tasks) 13%, var(--surface)); color: color-mix(in srgb, var(--c-tasks) 80%, var(--ink)); }
.tag-personal { background: color-mix(in srgb, var(--c-personal) 13%, var(--surface)); color: color-mix(in srgb, var(--c-personal) 80%, var(--ink)); }
.done:hover { color: var(--win); }
.done:hover svg { border-color: var(--win); }
.done:active svg { background: var(--win-wash); }
.done svg { border-width: 1.5px; border-color: color-mix(in srgb, var(--tint) 35%, var(--hairline-2)); }

/* Buttons, the + and chosen chips take the section colour. */
.button {
  background: linear-gradient(135deg, var(--tint) 0%, var(--tint-2) 100%);
  color: #FFFFFF;
  box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--tint) 80%, transparent);
}
.button:hover { background: linear-gradient(135deg, var(--tint) 0%, var(--tint-2) 100%); color: #FFFFFF; filter: brightness(1.06); }
.fab {
  background: linear-gradient(135deg, var(--tint) 0%, var(--tint-2) 100%);
  color: #FFFFFF;
  box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--tint) 75%, transparent);
}
.fab:hover { background: linear-gradient(135deg, var(--tint) 0%, var(--tint-2) 100%); color: #FFFFFF; filter: brightness(1.06); }
.chip:has(:checked) { background: var(--tint); color: #FFFFFF; }
.sheet-title:focus, .sheet-date:focus, .field input:focus { border-color: var(--tint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 28%, transparent); }
.switch:checked { background: var(--win); }
.sheet .label, .sheet-close { color: var(--tint); }

/* The brand mark. */
.mark { background: linear-gradient(135deg, var(--c-home) 0%, var(--c-home-2) 100%); color: #FFFFFF; box-shadow: none; }
.avatar { background: linear-gradient(135deg, var(--tint) 0%, var(--tint-2) 100%); background-clip: content-box; color: #FFFFFF; }
a.avatar:hover { color: #FFFFFF; }

/* More: a coloured tile in front of each section. */
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--tc, var(--c-more)) 0%, var(--tc-2, var(--c-more-2)) 100%);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.more-page .row-link { justify-content: flex-start; }
.more-page .row-link .chevron { margin-left: auto; }
.tile-business { --tc: var(--c-business); --tc-2: var(--c-business-2); }
.tile-personal { --tc: var(--c-personal); --tc-2: var(--c-personal-2); }
.tile-finance { --tc: var(--c-finance); --tc-2: var(--c-finance-2); }
.tile-calendar { --tc: var(--c-calendar); --tc-2: var(--c-calendar-2); }
.tile-intelligence { --tc: var(--c-intelligence); --tc-2: var(--c-intelligence-2); }
.tile-fishon { --tc: var(--c-fishon); --tc-2: var(--c-fishon-2); }

/* Navigation: every tab has its own colour; the current one gets a pill behind its icon. */
.nav-link { --tab: var(--c-more); --tab-2: var(--c-more-2); }
.nav-home { --tab: var(--c-home); --tab-2: var(--c-home-2); }
.nav-tasks { --tab: var(--c-tasks); --tab-2: var(--c-tasks-2); }
.nav-goals { --tab: var(--c-goals); --tab-2: var(--c-goals-2); }
.nav-fishon { --tab: var(--c-fishon); --tab-2: var(--c-fishon-2); }
.nav-personal { --tab: var(--c-personal); --tab-2: var(--c-personal-2); }
.nav-business { --tab: var(--c-business); --tab-2: var(--c-business-2); }
.nav-finance { --tab: var(--c-finance); --tab-2: var(--c-finance-2); }
.nav-calendar { --tab: var(--c-calendar); --tab-2: var(--c-calendar-2); }
.nav-intelligence { --tab: var(--c-intelligence); --tab-2: var(--c-intelligence-2); }
.nav-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 32px;
  border-radius: var(--radius-pill);
  transition: background-color var(--motion) var(--ease), color var(--motion) var(--ease);
}
.nav-link[aria-current="page"], .nav-link.is-within { color: color-mix(in srgb, var(--tab) 80%, var(--ink)); }
.nav-link[aria-current="page"] .nav-icon-wrap, .nav-link.is-within .nav-icon-wrap {
  background: linear-gradient(135deg, var(--tab) 0%, var(--tab-2) 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--tab) 80%, transparent);
}
.nav { box-shadow: 0 -8px 28px rgba(17, 24, 39, 0.07); }

@media (min-width: 768px) {
  .nav { background: var(--surface); box-shadow: 1px 0 0 var(--hairline-2); border-right: 0; }
  .nav-icon-wrap {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--tab) 13%, var(--surface));
    color: color-mix(in srgb, var(--tab) 85%, var(--ink));
  }
  .nav-icon { display: block; width: 18px; height: 18px; }
  .nav-link { gap: 12px; }
  .nav-link:hover { background: color-mix(in srgb, var(--tab) 8%, var(--surface)); }
  .nav-link[aria-current="page"] {
    background: color-mix(in srgb, var(--tab) 12%, var(--surface));
    color: color-mix(in srgb, var(--tab) 85%, var(--ink));
  }
  .nav-link[aria-current="page"] .nav-icon-wrap { box-shadow: none; }
  .hero { padding: var(--space-7) var(--space-6) var(--space-6); }
  .page { gap: var(--space-5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
