/* Coach Dex: royal blue on midnight, orange as the secondary accent (3px rails, ember glow).
   Tokens follow the Speed Lab theme in Build/frontend/tailwind.config.js (Royal Blue #4169E1, Midnight #1A1A2E family). */
:root {
  --bg: #080d1c; --glow1: rgba(255, 90, 31, .20); --glow2: rgba(65, 105, 225, .22);
  --card: #0f1730; --card2: #141e3b; --line: #243258; --ink: #f5f7ff; --mute: #9eacce;
  --blue: #6b8cff; --blue-solid: #4169e1; --blue-press: #3457cd; --orange: #ff6a33; --green: #34d27b; --danger: #ff6b6b;
  --on-solid: #ffffff; --shadow: 0 18px 60px rgba(0, 0, 0, .5);
  --ph1: #ff6a33; --ph2: #ffb02e; --ph3: #6b8cff; --ph4: #8c9abb; --ph5: #2fcfc0; --ph6: #b583ff; --ph7: #ff5d8f;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, Menlo, monospace;
  --nav-h: 64px; --top-h: 60px; --side-w: 236px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f1f4fc; --glow1: rgba(255, 106, 51, .13); --glow2: rgba(65, 105, 225, .14);
    --card: #ffffff; --card2: #eef2fb; --line: #d3dcf0; --ink: #0d1530; --mute: #54628a;
    --blue: #2c4fd0; --orange: #d8480f; --green: #12874a; --danger: #c93636; --shadow: 0 18px 50px rgba(20, 40, 90, .18);
    --ph1: #d8480f; --ph2: #a86b00; --ph3: #2c4fd0; --ph4: #5d6b8c; --ph5: #0a8f84; --ph6: #7a46d1; --ph7: #cc2f66;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f1f4fc; --glow1: rgba(255, 106, 51, .13); --glow2: rgba(65, 105, 225, .14);
  --card: #ffffff; --card2: #eef2fb; --line: #d3dcf0; --ink: #0d1530; --mute: #54628a;
  --blue: #2c4fd0; --orange: #d8480f; --green: #12874a; --danger: #c93636; --shadow: 0 18px 50px rgba(20, 40, 90, .18);
  --ph1: #d8480f; --ph2: #a86b00; --ph3: #2c4fd0; --ph4: #5d6b8c; --ph5: #0a8f84; --ph6: #7a46d1; --ph7: #cc2f66;
  color-scheme: light;
}
.ph1 { --pc: var(--ph1); } .ph2 { --pc: var(--ph2); } .ph3 { --pc: var(--ph3); } .ph4 { --pc: var(--ph4); }
.ph5 { --pc: var(--ph5); } .ph6 { --pc: var(--ph6); } .ph7 { --pc: var(--ph7); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 12px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; color: var(--ink); font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(60rem 26rem at 0% -4%, var(--glow1), transparent 70%), radial-gradient(52rem 24rem at 100% 0%, var(--glow2), transparent 70%), var(--bg);
  background-repeat: no-repeat; background-attachment: fixed; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--blue-solid); color: #fff; padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.skip:focus { top: calc(8px + env(safe-area-inset-top, 0px)); }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }

/* ---------- shell ---------- */
#app { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); }
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: var(--top-h);
  padding: calc(8px + env(safe-area-inset-top, 0px)) clamp(14px, 4vw, 28px) 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #4169e1 0%, #1a2e5a 100%); }
.brand-text b { display: block; font-size: 16px; font-weight: 700; line-height: 1.1; }
.brand-text span { display: block; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--mute); margin-top: 2px; }
.gsearch { flex: 1; max-width: 420px; margin-left: auto; }
.gsearch input { width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; }
.gsearch input::placeholder { color: var(--mute); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.net { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); border: 1px solid color-mix(in srgb, var(--orange) 45%, transparent); }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px); background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.nav a { display: grid; place-items: center; align-content: center; gap: 3px; min-height: 44px; color: var(--mute); text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--blue); }
.nav a[aria-current="page"] svg { stroke-width: 2.2; }
main { min-width: 0; padding: 22px clamp(14px, 4vw, 32px) calc(var(--nav-h) + 40px + env(safe-area-inset-bottom, 0px)); outline: none; }
.wrap { max-width: 1120px; margin-inline: auto; }

@media (min-width: 960px) {
  #app { grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-areas: "top top" "nav main"; }
  .top { grid-area: top; }
  .nav { grid-area: nav; position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); inset: auto; align-self: start; z-index: 20; display: flex; flex-direction: column; gap: 4px; height: auto; padding: 18px 14px; background: none; backdrop-filter: none; border: 0; }
  .nav a { grid-auto-flow: column; justify-content: start; justify-items: start; gap: 12px; padding: 0 14px; min-height: 46px; border-radius: 12px; font-size: 15px; }
  .nav a:hover { background: var(--card); color: var(--ink); }
  .nav a[aria-current="page"] { background: var(--card); box-shadow: inset 3px 0 0 var(--orange); color: var(--ink); }
  .nav a[aria-current="page"] svg { color: var(--blue); }
  main { grid-area: main; padding-bottom: 60px; }
}

/* ---------- type ---------- */
.eyebrow { font: 700 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--blue); }
.eyebrow.o { color: var(--orange); }
h1 { font: 800 clamp(30px, 5.4vw, 52px)/1.05 var(--sans); letter-spacing: -.02em; text-wrap: balance; }
h2 { font: 800 clamp(24px, 3.4vw, 34px)/1.1 var(--sans); letter-spacing: -.015em; text-wrap: balance; }
h3 { font: 700 18px/1.25 var(--sans); }
.lead { color: var(--mute); max-width: 64ch; font-size: 17px; }
.src { font-size: 12.5px; color: var(--mute); }
.src b { color: var(--ink); }
.txt { color: var(--mute); }
.stack { display: grid; gap: 18px; min-width: 0; }
.stack > * { min-width: 0; }
.sec { display: grid; gap: 16px; margin-top: 44px; }
.sec > header { display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; transition: border-color .15s, background .15s, transform .1s; }
.btn:hover { border-color: var(--blue); }
.btn:active { transform: scale(.98); }
.btn.solid { background: var(--blue-solid); border-color: var(--blue-solid); color: var(--on-solid); }
.btn.solid:hover { background: var(--blue-press); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; }
.btn.ghost { background: none; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg, .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .lbl { font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.field input, .field select, .field textarea { min-height: 46px; width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; }
.field textarea { padding: 12px 14px; resize: none; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 28%, transparent); }
.field .hint { font-size: 12.5px; color: var(--mute); text-transform: none; letter-spacing: 0; font-weight: 400; }
.field .err, .err { color: var(--danger); font-size: 14px; min-height: 1.2em; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.seg button { min-height: 38px; padding: 0 16px; border-radius: 10px; border: 0; background: none; font-weight: 600; font-size: 14px; color: var(--mute); white-space: nowrap; }
.seg button[aria-pressed="true"], .seg button[aria-current="page"] { background: var(--blue-solid); color: #fff; }
.tog { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13.5px; }
.tog[aria-pressed="true"] { background: var(--blue-solid); border-color: var(--blue-solid); color: #fff; }
.togs { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font: 600 12.5px/1.2 var(--sans); border: 1px solid color-mix(in srgb, var(--c, var(--mute)) 45%, transparent); color: var(--c, var(--mute)); background: color-mix(in srgb, var(--c, var(--mute)) 12%, transparent); }
.chip.plain { --c: var(--mute); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.k-rest, .k-active { --c: var(--ph4); } .k-mandatory { --c: var(--ph1); } .k-optional, .k-build { --c: var(--ph2); }
.k-primary { --c: var(--ph3); } .k-strength { --c: var(--ph5); } .k-competition { --c: var(--ph7); } .k-now { --c: var(--blue); } .k-coach { --c: var(--ph2); }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--blue-solid); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ---------- cards and day content ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: clamp(16px, 3vw, 24px); display: grid; gap: 12px; min-width: 0; }
.card.rail { border-left: 4px solid var(--orange); }
.cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); align-items: start; }
.blk { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; display: grid; gap: 12px; min-width: 0; }
.blk.wide { grid-column: 1 / -1; }
.blk h4 { font: 700 12px/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.blk p { margin: 0; }
.lst { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.lst li::marker { color: var(--orange); }
.cues { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cues li { padding: 9px 13px; border-radius: 10px; background: var(--card2); font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--card2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; min-width: 0; }
.stat span { font: 700 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.stat b { font: 600 15px/1.25 var(--mono); overflow-wrap: anywhere; }
.callout { grid-column: 1 / -1; padding: 12px 14px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--ph2) 60%, transparent); background: color-mix(in srgb, var(--ph2) 9%, transparent); font-size: 14.5px; }
.callout b { color: var(--ph2); }
.tblwrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 700 11px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); background: var(--card2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.cur td { background: color-mix(in srgb, var(--blue-solid) 22%, transparent); font-weight: 600; }
td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lifts { display: grid; gap: 10px; }
.lift { background: var(--card2); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.lift header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: baseline; }
.lift header b { font-size: 16px; }
.lift header span { font: 600 13.5px/1 var(--mono); color: var(--orange); }
.lift dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 14px; }
.lift dt { color: var(--mute); }
.lift dd { margin: 0; }
.note { font-size: 12.5px; color: var(--mute); }
.note b { color: var(--ink); }

/* day header + week strip */
.dayhead { display: grid; grid-template-columns: auto 1fr; gap: 8px 24px; align-items: center; padding: clamp(18px, 3vw, 28px); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--pc, var(--orange)); border-radius: 18px; }
.bignum { display: grid; gap: 2px; }
.bignum small { font: 700 12px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--mute); }
.bignum b { font: 800 clamp(54px, 9vw, 92px)/.95 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.dayhead h2 { margin: 0 0 6px; font-size: clamp(24px, 3.6vw, 38px); }
.dayhead .chips { margin-bottom: 10px; }
.dayhead .when { font: 500 13.5px/1.3 var(--mono); color: var(--mute); margin-bottom: 8px; }
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); gap: 8px; }
.wd { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; gap: 2px; min-width: 0; text-decoration: none; color: var(--ink); }
.wd:hover { border-color: var(--blue); }
.wd small { font: 700 11px/1 var(--sans); letter-spacing: .1em; color: var(--mute); text-transform: uppercase; }
.wd b { font: 700 15px/1.2 var(--mono); }
.wd span { font-size: 12.5px; color: var(--mute); overflow-wrap: anywhere; line-height: 1.3; }
.wd[aria-current="true"] { background: var(--blue-solid); border-color: var(--blue-solid); color: #fff; }
.wd[aria-current="true"] small, .wd[aria-current="true"] span { color: color-mix(in srgb, #fff 82%, transparent); }
.wd.today:not([aria-current="true"]) { box-shadow: inset 0 3px 0 var(--orange); }
.finder { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); z-index: 15; margin: -22px calc(-1 * clamp(14px, 4vw, 32px)) 0; padding: 12px clamp(14px, 4vw, 32px); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.finder .inner { max-width: 1120px; margin-inline: auto; display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; }
.finder .field input { width: 9.5rem; font: 700 18px/1 var(--mono); }
.finder .hint { align-self: center; font-size: 13px; color: var(--mute); min-height: 1.2em; }
.finder .hint.bad { color: var(--orange); }
.pair { display: flex; gap: 8px; }
.racebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); font-size: 14.5px; }
.racebar > span { min-width: 0; flex: 1 1 280px; color: var(--mute); }
.racebar b { color: var(--ink); }
.menu { display: grid; gap: 10px; }
.menu > h3 { font: 700 12px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.sess { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.sess > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; min-height: 44px; }
.sess > summary::-webkit-details-marker { display: none; }
.sess > summary::after { content: "+"; grid-column: 2; grid-row: 1 / span 3; font: 600 22px/1 var(--mono); color: var(--blue); }
.sess[open] > summary::after { content: "–"; }
.sess .sn { font: 700 11px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--orange); }
.sess .st { font-weight: 700; font-size: 16.5px; }
.sess .sv { font: 500 12.5px/1.3 var(--mono); color: var(--mute); }
.sess .sbody { padding: 4px 16px 18px; display: grid; gap: 14px; }
.sess .sbody .blk { background: var(--card2); border-color: transparent; }

/* ---------- today ---------- */
.hello { display: grid; gap: 8px; margin-bottom: 20px; }
.hello h1 em { font-style: normal; color: var(--blue); }
.today-card { display: grid; gap: 14px; padding: clamp(18px, 3vw, 28px); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 20px; }
.today-card .top-row { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: baseline; }
.today-card .daynum { font: 800 clamp(44px, 8vw, 72px)/.95 var(--sans); letter-spacing: -.03em; }
.today-card h2 { font-size: clamp(24px, 4vw, 36px); }
.cue { padding: 14px 16px; border-left: 4px solid var(--orange); background: color-mix(in srgb, var(--orange) 9%, transparent); border-radius: 0 12px 12px 0; }
.cue small { display: block; font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--orange); margin-bottom: 4px; }
.cue p { font-size: 18px; font-weight: 700; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--ph2) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--ph2) 50%, var(--line)); font-size: 14.5px; }
.banner > span { flex: 1 1 260px; min-width: 0; }
.banner.info { background: var(--card2); border-color: var(--line); }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-chip { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; text-align: left; }
.ask-chip:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- plan overview ---------- */
.timeline { display: flex; gap: 4px; min-width: 0; }
.tseg { flex: var(--len) 1 0; min-width: 0; border: 0; padding: 0; background: none; text-align: left; display: grid; gap: 6px; align-content: start; text-decoration: none; }
.tseg i { display: block; height: 14px; border-radius: 7px; background: var(--pc); }
.tseg span { font: 700 11px/1.25 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); overflow-wrap: anywhere; }
.tseg:hover i { filter: brightness(1.2); }
.phases { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.pcard { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--pc); border-radius: 16px; padding: 16px 18px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.pcard h3 { font-size: 18px; }
.pcard .pn { font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--pc); }
.pcard p { font-size: 14.5px; color: var(--mute); }
.pcard .dates { font: 500 13px/1.3 var(--mono); }
.pcard .btn { justify-self: start; }
.two { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.rocks { display: grid; gap: 10px; }
.rock { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: baseline; padding: 11px 14px; background: var(--card2); border-radius: 12px; }
.rock b { color: var(--orange); }
.rock span { color: var(--mute); }
.map { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; overflow-x: auto; }
.mapgrid { display: grid; grid-template-columns: 30px repeat(48, minmax(15px, 1fr)); gap: 3px; min-width: 840px; align-items: center; }
.mapgrid .rl { font: 600 10px/1 var(--sans); color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
.mapgrid .ml { font: 700 10px/1 var(--sans); color: var(--mute); text-transform: uppercase; height: 14px; white-space: nowrap; overflow: visible; }
.cell { aspect-ratio: 1; min-width: 0; border: 0; border-radius: 4px; padding: 0; display: block; background: color-mix(in srgb, var(--pc) 78%, var(--card)); }
.cell:hover { filter: brightness(1.25); }
.cell[aria-current="true"] { outline: 2px solid var(--ink); outline-offset: 1px; position: relative; z-index: 1; }
.cell.today { box-shadow: inset 0 0 0 2px var(--bg); background: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 12.5px; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--pc); }
.tpl h3 { margin: 0 0 8px; font-size: 15px; }
details.about { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; }
details.about summary { cursor: pointer; font-weight: 700; min-height: 28px; }
details.about ul { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 8px; color: var(--mute); }

/* ---------- library ---------- */
.libbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { width: 100%; max-width: 520px; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; }
.search:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 28%, transparent); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); align-items: start; }
.dcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: grid; gap: 10px; min-width: 0; }
.dcard h3 { font-size: 17px; }
.dcard .kind { font: 700 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--orange); }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-size: 14.5px; }
.vidrow { display: flex; flex-wrap: wrap; gap: 8px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.tcard > summary { list-style: none; cursor: pointer; padding: 13px 16px; display: grid; gap: 3px; min-height: 44px; }
.tcard > summary::-webkit-details-marker { display: none; }
.tcard .tn { font-weight: 700; font-size: 16px; }
.tcard .tcat { font: 700 10.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--orange); }
.tcard .tb { padding: 0 16px 16px; display: grid; gap: 10px; }
.tcard .tprog { padding: 10px 12px; border-radius: 10px; background: var(--card2); font-size: 14px; }
.tcard .tsrc { font-size: 12px; color: var(--mute); }
.alpha { display: flex; flex-wrap: wrap; gap: 6px; }
.alpha a { min-width: 34px; min-height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--card); text-decoration: none; font: 600 13px/1 var(--mono); color: var(--ink); }
.term { display: inline; background: none; border: 0; padding: 0; margin: 0; font: inherit; line-height: inherit; text-align: inherit; white-space: normal; color: inherit; cursor: help; text-decoration: underline dotted var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1.5px; border-radius: 3px; }
.term:hover { color: var(--blue); }
.term:focus-visible { outline-offset: 1px; }
.results h3 { margin: 22px 0 10px; font: 700 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.hit { display: grid; gap: 2px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.hit:hover { border-color: var(--blue); }
.hit b { font-size: 15.5px; }
.hit span { color: var(--mute); font-size: 13.5px; }
.empty { padding: 28px 18px; text-align: center; color: var(--mute); border: 1px dashed var(--line); border-radius: 16px; }

/* ---------- coach ---------- */
.coach { display: grid; grid-template-rows: auto 1fr auto; gap: 12px; height: calc(100dvh - var(--top-h) - var(--nav-h) - 74px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 420px; max-width: 860px; margin-inline: auto; }
@media (min-width: 960px) { .coach { height: calc(100dvh - var(--top-h) - 70px); } }
.coach-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.coach-head h2 { font-size: 24px; }
.msgs { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 8px; overscroll-behavior: contain; min-height: 0; }
.msg { max-width: min(92%, 640px); padding: 12px 16px; border-radius: 18px; line-height: 1.6; overflow-wrap: anywhere; min-width: 0; font-size: 15.5px; }
.msg.bot { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.me { background: var(--blue-solid); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.msg p { margin: 0 0 8px; }
.msg p:last-child, .msg ul:last-child, .msg ol:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 4px; }
.msg a { color: var(--blue); font-weight: 600; }
.msg.me a { color: #fff; }
.msg .daylink { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px; font: 600 13.5px/1.6 var(--mono); color: var(--blue); text-decoration: none; white-space: nowrap; }
.msg .ext::after { content: " ↗"; font-size: .85em; }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.srcs a, .srcs button { min-height: 30px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card2); font-size: 12px; font-weight: 600; text-decoration: none; color: var(--mute); }
.srcs .lbl { font: 700 10px/30px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.msg .mode { font-size: 12px; color: var(--ph2); margin-top: 8px; }
.msg .local-confirm { margin-top: 8px; }
.status { min-height: 22px; font-size: 13px; color: var(--mute); padding: 0 4px; }
.dots::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.composer textarea { min-height: 48px; max-height: 140px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 12px 14px; resize: none; font-size: 16px; line-height: 1.4; width: 100%; }
.composer textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 28%, transparent); }
.composer .btn { min-height: 48px; }
.fine { font-size: 12px; color: var(--mute); text-align: center; }

/* ---------- me ---------- */
.set { display: grid; gap: 16px; max-width: 760px; }
.set .card h3 { font-size: 17px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.weeks { display: grid; gap: 8px; }
.wkrow { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 10px 12px; background: var(--card2); border-radius: 12px; }
.wkrow b { font-size: 14.5px; }
.wkrow small { display: block; color: var(--mute); font-size: 12px; }

/* ---------- onboarding / auth ---------- */
.welcome { display: grid; gap: 22px; max-width: 760px; margin-inline: auto; }
.welcome .intro { display: grid; gap: 12px; }
.checkin { display: grid; gap: 14px; padding: clamp(18px, 3vw, 26px); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 20px; }
.checkin h2 { font-size: clamp(22px, 3.4vw, 30px); }
.feat { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.feat div { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-size: 14px; color: var(--mute); }
.feat b { display: block; color: var(--ink); margin-bottom: 2px; }
.codebox { font: 700 28px/1 var(--mono); letter-spacing: .3em; text-align: center; }

/* ---------- sheet (term definitions) + toast ---------- */
dialog.sheet { border: 1px solid var(--line); border-radius: 22px; background: var(--card); color: var(--ink); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: min(84dvh, 720px); box-shadow: var(--shadow); overflow: hidden; }
dialog.sheet::backdrop { background: rgba(4, 8, 20, .62); backdrop-filter: blur(3px); }
dialog.sheet[open] { display: grid; grid-template-rows: auto 1fr auto; }
@media (max-width: 640px) { dialog.sheet { margin: auto 0 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); } }
.sheet-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 18px 20px 8px; }
.sheet-head h3 { font-size: 22px; }
.sheet-body { padding: 4px 20px 16px; overflow-y: auto; display: grid; gap: 12px; align-content: start; }
.sheet-foot { padding: 12px 20px 18px; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); }
.xbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); display: grid; place-items: center; flex-shrink: 0; }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(440px, calc(100vw - 28px)); pointer-events: none; }
@media (min-width: 960px) { #toast { bottom: 24px; } }
#toast .t { padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow); animation: tin .25s ease-out; pointer-events: auto; }
#toast .t.bad { background: var(--danger); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.skel { border-radius: 14px; background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%); background-size: 200% 100%; animation: sk 1.4s infinite; min-height: 80px; }
@keyframes sk { to { background-position: -200% 0; } }
footer.foot { margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--mute); font-size: 12.5px; }

@media (max-width: 760px) { .tseg span { display: none; } .timeline { gap: 3px; } }
@media (max-width: 560px) {
  .dayhead { grid-template-columns: 1fr; }
  .bignum { display: flex; align-items: baseline; gap: 12px; }
  .rock { grid-template-columns: 1fr; gap: 2px; }
  .finder .field input { width: 8rem; }
  .week { grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); }
  .gsearch { display: none; }
  .wkrow { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media print { .nav, .top, .finder, .composer, #toast { display: none !important; } body { background: #fff; color: #000; } }

/* phase-coloured chips and shared bits */
.chip.ph1 { --c: var(--ph1); } .chip.ph2 { --c: var(--ph2); } .chip.ph3 { --c: var(--ph3); } .chip.ph4 { --c: var(--ph4); }
.chip.ph5 { --c: var(--ph5); } .chip.ph6 { --c: var(--ph6); } .chip.ph7 { --c: var(--ph7); }
.tprog { padding: 10px 12px; border-radius: 10px; background: var(--card2); font-size: 14px; }
.togs { display: flex; flex-wrap: wrap; gap: 8px; }
.vidrow { display: flex; flex-wrap: wrap; gap: 8px; }
.feat { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.feat div { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-size: 14px; color: var(--mute); }
.feat b { display: block; color: var(--ink); margin-bottom: 2px; }
a.banner { text-decoration: none; color: var(--ink); justify-content: space-between; }
a.banner:hover { border-color: var(--blue); }
.msgs .ask-chips { margin-top: 2px; }
a.ask-chip { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
@media (max-width: 560px) {
  .finder { position: static; padding-block: 10px; }
  .finder .inner { gap: 8px 10px; }
  .finder .field select { max-width: 11rem; }
}
.composer textarea { overflow-y: auto; }
/* main is focused on navigation for screen readers; it is not interactive, so no outline */
main:focus, main:focus-visible { outline: none; }
/* grid children may shrink below their content (wide tables scroll inside .tblwrap instead of widening the page) */
.sec { grid-template-columns: minmax(0, 1fr); }
.sec > * { min-width: 0; }
.two > *, .phases > *, .grid > * { min-width: 0; }

/* ---------- accessibility pass (contrast, target size, focus clearance) ---------- */
:root { --ctl: color-mix(in srgb, var(--ink) 40%, var(--card)); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --ctl: color-mix(in srgb, var(--ink) 50%, var(--card)); --orange: #b83a00; --ph1: #b83a00; --ph2: #8a5600; --ph5: #066a61; --ph7: #b02458; }
}
:root[data-theme="light"] { --ctl: color-mix(in srgb, var(--ink) 50%, var(--card)); --orange: #b83a00; --ph1: #b83a00; --ph2: #8a5600; --ph5: #066a61; --ph7: #b02458; }
/* form controls and the switch track need 3:1 against their surroundings (WCAG 1.4.11) */
.field input, .field select, .field textarea, .search, .composer textarea, .gsearch input { border-color: var(--ctl); }
.switch input { background: var(--ctl); }
.switch input:checked { background: var(--blue-solid); }
/* white on the error red must reach 4.5:1 in both themes */
#toast .t.bad { background: #c93636; color: #fff; }
.wd[aria-current="true"] small, .wd[aria-current="true"] span { color: #fff; }
/* sticky day finder and fixed bottom nav must not cover the control that has focus */
html { scroll-padding-top: calc(var(--top-h) + 84px); scroll-padding-bottom: calc(var(--nav-h) + 24px); }
@media (pointer: coarse) {
  .btn.sm, .tog, .seg button, .srcs a, .srcs button { min-height: 44px; }
  .alpha a { min-width: 44px; min-height: 44px; }
}
.coach-head .h-sm { font: 800 24px/1.1 var(--sans); letter-spacing: -.015em; }
.dayhead .day-title { margin: 0 0 6px; font: 800 clamp(24px, 3.6vw, 38px)/1.1 var(--sans); letter-spacing: -.01em; text-wrap: balance; }

/* ---------- age check, release and the "waiting for a parent" screen ---------- */
[hidden] { display: none !important; }
.age-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.agebox { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card2); }
.legal-box { border: 1px solid var(--line); border-radius: 14px; background: var(--card2); overflow: hidden; }
.legal-box > summary { display: flex; align-items: center; min-height: 44px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.legal-text { max-height: min(46dvh, 420px); overflow: auto; padding: 2px 16px 12px; border-top: 1px solid var(--line); font-size: 14.5px; line-height: 1.55; }
.legal-text h4 { margin: 16px 0 6px; font-size: 15px; }
.legal-text p, .legal-text li { color: var(--ink); }
.legal-text ul, .legal-text ol { margin: 0 0 10px; padding-left: 20px; }
.legal-text:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; cursor: pointer; }
.check-row input { flex: none; width: 22px; height: 22px; margin-top: 2px; accent-color: var(--blue); }
.stop-inline { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--orange); background: color-mix(in srgb, var(--orange) 10%, var(--card)); }
.checkin.stop, .checkin.gate { border-left-color: var(--orange); }

/* before the app has loaded for a complete account there is nothing to navigate or search */
body[data-mode="public"] #nav, body[data-mode="public"] #gsearch { display: none; }

/* ---------- programs: the picker at sign-up, the Programs screen, written programs, and the Admin screen ---------- */
.pick { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.pick legend { padding: 0; margin-bottom: 6px; font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.ptile { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; min-height: 56px; }
.ptile:hover { border-color: var(--blue); }
.ptile:has(input:checked) { border-color: var(--blue-solid); box-shadow: 0 0 0 1px var(--blue-solid) inset; }
.ptile:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.ptile input { flex: none; width: 22px; height: 22px; margin-top: 2px; accent-color: var(--blue-solid); }
.ptile b { display: block; line-height: 1.35; }
.ptile small { display: block; margin-top: 2px; color: var(--mute); font-size: 13.5px; line-height: 1.45; }

.row.between { justify-content: space-between; }
.prog h3 { font-size: 18px; }
.lst.plain { list-style: none; padding-left: 0; gap: 10px; }
.lst.plain li::marker { content: none; }
.lst.small { font-size: 12.5px; gap: 4px; }
.sub { font-size: 15px; font-weight: 700; margin-top: 6px; }

.part > summary { cursor: pointer; font-weight: 700; font-size: 16.5px; line-height: 1.35; min-height: 28px; }
.part[open] > summary { margin-bottom: 4px; }
.part .txt + .txt, .part .lst + .txt, .part .tblwrap + .txt { margin-top: 2px; }
.doc-table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 13.5px; line-height: 1.45; }
.doc-table th { text-align: left; font: 700 10.5px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); background: var(--card2); }
.doc-table th, .doc-table td { padding: 8px 10px; vertical-align: top; }
.doc-table td { border-top: 1px solid var(--line); }
.toc { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.people { display: grid; gap: 8px; margin-top: 4px; }
.person { text-align: left; display: grid; gap: 8px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card2); color: var(--ink); min-height: 44px; }
.person:hover { border-color: var(--blue); }
.person .who b { display: block; }
.person .who small { color: var(--mute); overflow-wrap: anywhere; }
.person .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.part > *, .prog > * { min-width: 0; }
.part .tblwrap { max-width: 100%; }
.part .txt, .part li, .person .who { overflow-wrap: anywhere; }
.part { grid-template-columns: minmax(0, 1fr); }
.sel { min-height: 44px; flex: 1 1 14rem; min-width: 0; border-radius: 12px; border: 1px solid var(--ctl, var(--line)); background: var(--card); padding: 0 12px; font-size: 15px; }
.sel:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 28%, transparent); }

/* ---------- your log and notes to Coach Dex ---------- */
.log h3 { font-size: 17px; }
.log .lbl { font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.log textarea { width: 100%; min-height: 96px; border-radius: 12px; border: 1px solid var(--ctl, var(--line)); background: var(--card); padding: 12px 14px; font-size: 16px; line-height: 1.5; resize: vertical; }
.log textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 28%, transparent); }
.log .field .hint { font-size: 12.5px; }
.lst.sent li { border-left: 3px solid var(--orange); padding: 2px 0 2px 12px; }
.lst.sent small { color: var(--mute); }
.lst.sent p, .notebody { white-space: pre-wrap; overflow-wrap: anywhere; }
.noteitem { border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; background: var(--card2); min-width: 0; }
.wd.done { border-color: color-mix(in srgb, var(--green) 60%, var(--line)); }
.wd.done b::after { content: " \2713"; color: var(--green); font-size: .78em; }
.log .seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
.log .seg button { padding: 0 2px; min-height: 46px; font-size: 13px; line-height: 1.1; white-space: normal; }

/* ---------- pages Coach Dex wrote for one person ---------- */
.page h2 { font-size: 21px; }
.editor textarea, .editor input:not([type="checkbox"]) { width: 100%; border-radius: 12px; border: 1px solid var(--ctl, var(--line)); background: var(--card); padding: 11px 14px; font-size: 16px; line-height: 1.5; }
.editor textarea { min-height: 110px; resize: vertical; }
.editor textarea:focus, .editor input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 28%, transparent); }
.preview { padding: 4px 2px 2px; }
