/* Baseline -- service stylesheet. Loaded LAST. Maps Baseline's own components onto the
 * Wrong Train workspace system tokens; adds only the layouts the system lacks
 * (the clear-time clock, the urge flow, the month calendar, the career graph, the
 * evidence cards, the chromeless /now page). No colours outside the token set. */

/* ------------------------------------------------------------------ shell ---- */
.gate-now-link { margin: 18px 0 0; font-size: 13.5px; }
.gate-now-link a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.gate-now-link a:hover { color: var(--accent); }
.navlink-urge { display: none; }
.shell.is-focus .app-sidebar, .shell.is-focus .app-nav { display: none; }
.shell.is-focus .app-main { max-width: 640px; padding-top: 6vh; }
#view { min-height: 40vh; }
.view-loading { color: var(--ink-3); padding: 40px 0; text-align: center; }
.stack-lg { display: grid; gap: 24px; }
.hairline { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.mt { margin-top: 12px; } .mt-lg { margin-top: 24px; } .mb0 { margin-bottom: 0; }
.right { text-align: right; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bar { position: relative; height: 8px; background: var(--surface-raised); border-radius: 999px; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; display: block; }
.bar-ok > i { background: var(--ok); } .bar-warn > i { background: var(--warn); } .bar-bad > i { background: var(--bad); }
.bar-thin { height: 5px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 150px) 1fr auto; gap: 12px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.bar-row .mono { color: var(--ink-2); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; }

/* ------------------------------------------------------------- home: clock ---- */
.clear-hero { padding: 8px 0 4px; }
.clear-hero .eyebrow { margin-bottom: 8px; }
.clear-clock { font-family: var(--font-mono); font-weight: 500; font-size: clamp(30px, 7vw, 46px); letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); margin: 0; font-variant-numeric: tabular-nums; }
.clear-clock small { font-size: 0.42em; color: var(--ink-2); font-weight: 400; margin: 0 10px 0 2px; letter-spacing: 0; }
.clear-since { margin: 12px 0 0; color: var(--ink-2); font-family: var(--font-read); font-size: 15.5px; }
.quiet-line { margin: 0; color: var(--ink-2); font-family: var(--font-read); font-size: 15.5px; line-height: 1.55; }
.chain { display: grid; gap: 4px; margin: 4px 0 16px; }
.chain-step { display: grid; gap: 2px; }
.chain-step .eyebrow { color: var(--ink-3); }
.chain-step strong { font-size: 16px; font-weight: 600; }
.chain-arrow { color: var(--ink-3); font-size: 16px; padding: 2px 0 2px 2px; }
.bench { display: grid; gap: 8px; }
.bench-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.bench-row:first-child { border-top: 0; padding-top: 0; }
.bench-row .mono { color: var(--ink); }
.grad-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.grad-pct { font-family: var(--font-mono); color: var(--ink-2); font-size: 13px; }
.grad-remaining { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; }
.priority-add { display: flex; gap: 8px; margin-top: 10px; }
.priority-add .field-input { flex: 1; min-width: 0; }
.cta-wrap { padding: 8px 0 24px; display: grid; gap: 10px; }
.cta-urge { width: 100%; min-height: 64px; font-size: 19px; font-weight: 650; border-radius: var(--radius-card); letter-spacing: -0.01em; }
.cta-note { margin: 0; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.open-craving { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- urge flow ---- */
.urge { display: grid; gap: 22px; }
.urge-q { margin: 0; font-size: clamp(22px, 4.5vw, 28px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.urge-copy { margin: 0; font-family: var(--font-read); font-size: 17px; line-height: 1.6; color: var(--ink); max-width: 46ch; }
.urge-copy.muted { color: var(--ink-2); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.choice { min-height: 52px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 500; text-align: left; transition: border-color 120ms ease, background 120ms ease; }
.choice:hover { border-color: var(--ink-3); }
.choice[aria-pressed="true"], .choice.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice-wide { grid-column: 1 / -1; }
.slider { display: grid; gap: 10px; }
.slider input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }
.slider-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); color: var(--ink-3); font-size: 12px; }
.slider-value { font-family: var(--font-mono); font-size: 34px; font-weight: 500; text-align: center; margin: 0; font-variant-numeric: tabular-nums; }
.slider-value small { font-size: 0.45em; color: var(--ink-3); }
.countdown { font-family: var(--font-mono); font-size: clamp(56px, 16vw, 84px); font-weight: 500; letter-spacing: -0.03em; line-height: 1; text-align: center; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.countdown.is-done { color: var(--ok); }
.card-rotor { min-height: 116px; display: grid; align-items: center; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.card-rotor p { margin: 0; font-family: var(--font-read); font-size: 17px; line-height: 1.6; transition: opacity 240ms ease; }
.card-rotor p.is-fading { opacity: 0; }
.card-rotor .eyebrow { margin-bottom: 8px; color: var(--ink-3); }
.urge-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.urge-actions .btn-primary { min-height: 48px; padding: 12px 22px; font-size: 16px; }
.before-after { display: flex; gap: 22px; font-family: var(--font-mono); color: var(--ink-2); font-size: 14px; }
.before-after strong { color: var(--ink); font-weight: 500; }
.urge-done { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 20px 0; }
.urge-done h2 { font-size: 28px; margin: 0; letter-spacing: -0.02em; }
.scale-list { display: grid; gap: 18px; }
.scale-list .field-label { display: flex; justify-content: space-between; }
.scale-list .field-label .mono { color: var(--ink); }

/* ---------------------------------------------------------------- progress ---- */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.month-nav h2 { margin: 0; font-size: 18px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 11.5px; color: var(--ink-3); text-align: center; font-weight: 600; padding-bottom: 4px; }
.cal-day { aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 12.5px; border: 1px solid var(--line-soft); color: var(--ink-3); background: transparent; }
.cal-day.is-clear { background: var(--ok-soft); border-color: rgba(141, 190, 158, 0.35); color: var(--ok); }
.cal-day.is-use { background: var(--warn-soft); border-color: rgba(217, 179, 110, 0.4); color: var(--warn); }
.cal-day.is-future { color: var(--ink-3); border-style: dashed; }
.cal-day.is-before { opacity: 0.5; }
.cal-day.is-today { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--ink); }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.cal-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cal-legend .lg-clear::before { background: var(--ok); } .cal-legend .lg-use::before { background: var(--warn); } .cal-legend .lg-future::before { border: 1px dashed var(--ink-3); }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; align-items: end; height: 64px; margin-top: 8px; }
.hours i { display: block; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: 0.85; }
.hours-axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.insight { display: grid; gap: 10px; }
.insight-line { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: 14.5px; }
.insight-line:first-child { border-top: 0; padding-top: 0; }
.insight-line strong { font-weight: 600; text-align: right; }
.stat-value { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ future ---- */
.road { position: relative; margin: 18px 0 8px; }
.road-line { position: relative; height: 3px; background: var(--surface-raised); border-radius: 999px; }
.road-line > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; }
.road-today { position: absolute; top: -26px; transform: translateX(-50%); font-size: 11.5px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.road-today::after { content: ""; display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin: 4px auto 0; }
.road-ends { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.graph { display: grid; gap: 0; }
.graph-node { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; }
.graph-node .dot-col { display: grid; justify-items: center; align-content: start; height: 100%; }
.graph-node .dot-col i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink-3); background: var(--field); margin-top: 6px; }
.graph-node.is-current .dot-col i { border-color: var(--accent); background: var(--accent); }
.graph-node .dot-col b { flex: 1; width: 2px; background: var(--line); min-height: 22px; margin-top: 4px; }
.graph-node:last-child .dot-col b { display: none; }
.graph-body { padding-bottom: 14px; }
.graph-body summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.graph-body summary::-webkit-details-marker { display: none; }
.graph-body summary strong { font-size: 16px; font-weight: 600; }
.graph-body summary .mono { color: var(--ink-2); font-size: 12.5px; }
.graph-body[open] summary strong { color: var(--accent); }
.graph-detail { margin-top: 12px; display: grid; gap: 12px; padding: 14px 16px; background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: 10px; }
.graph-branch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-left: 34px; }
.graph-branch .graph-node { grid-template-columns: 1fr; }
.graph-branch .dot-col { display: none; }
.graph-branch-label { grid-column: 1 / -1; color: var(--ink-3); font-size: 12.5px; margin: -6px 0 2px; }
.skill-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.skill-row input[type=range] { width: 100%; accent-color: var(--accent); }
.ladder { display: grid; gap: 12px; }
.ladder-row { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; }
.ladder-row .mono { font-size: 15px; font-weight: 500; }
.ladder-row small { display: block; color: var(--ink-2); font-size: 12.5px; }
.paths { display: grid; grid-template-columns: 1fr; gap: var(--gap-card); }
.path-list { margin: 8px 0 0; padding: 0 0 0 18px; color: var(--ink-2); line-height: 1.6; font-size: 14px; }
.goal-row { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.goal-row:first-child { border-top: 0; padding-top: 0; }
.goal-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.goal-head strong { font-weight: 600; }
.goal-head .mono { color: var(--ink-2); font-size: 12.5px; }
.goal-edit { display: grid; gap: 10px; padding: 10px 0 2px; }
.goal-edit input[type=range] { accent-color: var(--accent); width: 100%; }
.reassess-explain { font-family: var(--font-read); font-size: 15.5px; line-height: 1.6; color: var(--ink); }

/* ---------------------------------------------------------------- evidence ---- */
.tier-legend { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.tier-legend b { font-family: var(--font-mono); color: var(--ink); font-weight: 500; margin-right: 8px; }
.claim { display: grid; gap: 10px; }
.claim-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.claim-topic { font-size: 14px; font-weight: 600; text-transform: capitalize; }
.strength { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.strength .blocks { display: inline-flex; gap: 2px; }
.strength .blocks i { width: 7px; height: 12px; border-radius: 2px; background: var(--surface-raised); }
.strength .blocks i.on { background: var(--accent); }
.claim-finding { margin: 0; font-family: var(--font-read); font-size: 16px; line-height: 1.6; }
.claim-source { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.claim-source a { color: var(--accent); }
.not-prove { border-left: 2px solid var(--line); padding: 4px 0 4px 12px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.not-prove b { display: block; color: var(--ink); font-size: 12.5px; margin-bottom: 4px; font-weight: 600; }
.words { display: grid; gap: 18px; }
.words textarea { width: 100%; min-height: 140px; resize: vertical; font-family: var(--font-read); font-size: 15.5px; line-height: 1.6; }
.words-prompt { color: var(--ink-3); font-size: 13px; margin: 4px 0 8px; }
.section-note { margin: 0 0 14px; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }

/* ---------------------------------------------------------------- settings ---- */
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.settings-grid .field { margin: 0; }
.settings-grid .field-input { width: 100%; }
.danger-zone { border-color: rgba(224, 138, 128, 0.35); }

/* -------------------------------------------------------------------- /now ---- */
.now-body { background: var(--field); color: var(--ink); min-height: 100vh; }
.now-wrap { min-height: 100vh; max-width: 560px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); display: grid; align-content: center; }
.now-step { display: grid; gap: 18px; }
.now-title { margin: 0; font-size: clamp(30px, 8vw, 40px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.now-copy { margin: 0; font-size: 18px; line-height: 1.6; color: var(--ink-2); }
.now-emph { color: var(--ink); font-weight: 500; }
.now-start { width: 100%; min-height: 64px; font-size: 19px; font-weight: 650; border-radius: var(--radius-card); margin-top: 8px; }
.now-foot { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.now-foot a { color: var(--ink-3); }
.now-offline { font-size: 12.5px; color: var(--ink-3); }

/* ------------------------------------------------------------------- wide ---- */
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .paths { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .choice-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 899px) {
  .navlink-urge { display: flex; }
  .toolbar-logout { display: none; }
}
@media (prefers-reduced-motion: reduce), (data-motion="reduced") {
  .card-rotor p { transition: none; }
}

/* ------------------------------------------------------------------ fixes ---- */
/* The system's display:grid/flex classes must never beat the hidden attribute. */
[hidden] { display: none !important; }
.btn-primary:disabled, .btn-quiet:disabled, .choice:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--btn-bg); }
.priority-add { flex-wrap: wrap; }
.priority-add > .field-input { flex: 1 1 140px; min-width: 0; }
.priority-add > input[type=date] { flex: 0 1 160px; }
.choice-suggested { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.suggest .pill { margin-left: 8px; }
.pk-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.pk-list li:first-child { border-top: 0; }

/* Saturday moderation, alongside the existing school and clarity cards. */
.schedule-date { font-family: var(--font-serif); font-size: clamp(22px, 4vw, 30px); margin: 12px 0 6px; }
.schedule-timeline { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.schedule-timeline li { border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px; display: grid; gap: 4px; }
.cal-day.is-on_plan, .cal-day.is-skipped { background: var(--ok-soft); color: var(--ok); }
.cal-day.is-planned { background: var(--accent-soft); border: 2px solid var(--accent); color: var(--ink); }
.cal-day.is-lapse { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.cal-day.is-available, .cal-day.is-scheduled { border: 2px dashed var(--accent); color: var(--ink); }
.cal-day.is-historical { opacity: .5; }
.cal-legend .lg-planned::before { background: var(--accent); }
.cal-legend .lg-scheduled::before { border: 2px dashed var(--accent); }
@media (max-width: 480px) { .schedule-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.cal-day.is-historical_clear { background: var(--ok-soft); color: var(--ok); opacity: .65; }
.cal-day.is-historical_use { background: var(--warn-soft); color: var(--warn); opacity: .65; }

.cal-day.is-monthly_limit { border: 2px dotted var(--warn); color: var(--warn); opacity: .75; }
.cal-day.is-capped { border-color: var(--warn); color: var(--ink-2); }
.cal-legend .lg-cap::before { border: 2px dotted var(--warn); }

/* Coach uses the shared workspace tokens; responses remain plain text. */
.coach-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.coach-side { display: grid; gap: 20px; }
.coach-chat { min-width: 0; }
.coach-actions, .coach-prompts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.coach-actions { justify-content: space-between; }
.coach-preferences summary { cursor: pointer; font-weight: 600; }
.coach-preferences[open] summary { margin-bottom: 20px; }
.coach-enable { display: flex; gap: 10px; align-items: start; }
.coach-enable input { margin-top: 4px; }
.coach-transcript { max-height: 55vh; overflow-y: auto; overflow-wrap: anywhere; margin-block: 20px; }
.coach-turn { padding-block: 18px; border-bottom: 1px solid var(--line); }
.coach-turn .eyebrow { margin-top: 14px; }
.coach-text { white-space: pre-wrap; line-height: 1.7; }
.coach-sources { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--ink-2); }
.coach-sources a { text-decoration: underline; }
.coach-empty { padding: 28px 0; color: var(--ink-2); }
.coach-composer { margin-top: 24px; }
.coach-composer textarea, .coach-preferences textarea { resize: vertical; width: 100%; }
@media (max-width: 900px) {
  .coach-layout { grid-template-columns: minmax(0, 1fr); }
  .coach-side { display: contents; }
  .coach-preferences { grid-row: 1; }
  .coach-chat { grid-row: 2; }
}

/* ------------------------------------------------------------------ Today ---- */
/* What matters now, whether the plan holds, what to do next: before any chart. */
.today-head { padding: 4px 0 0; }
.today-head .page-title { margin-top: 4px; }
.today-headline { margin: 4px 0 2px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.why-row { margin-bottom: 0; }
.quick-grid .choice { display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; }
.checkin-row { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; padding: 4px 0; }
.checkin-row .rating { margin-bottom: 0; }
.checkin-row .field-label { margin: 0; }
.focus-goal { display: grid; gap: 2px; }
.focus-goal small { color: var(--ink-3); }
.milestone-list { display: grid; gap: 6px; }
.milestone-list .done { text-decoration: none; color: var(--ink-3); }
.target-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.target-pick .field-input { max-width: 200px; }

/* ------------------------------------------------------------------ Coach 2.0 ---- */
.coach-quick { display: grid; gap: 8px; margin: 4px 0 8px; }
.coach-quick .coach-prompts { margin: 0; }
.coach-quick .small { align-self: center; }

/* -------------------------------------------------------------- navigation ---- */
/* Sections on the rail; five items on a phone (Today, Coach, Urge, Plan, More). */
.primary-nav .rail-section { margin: 12px 0 2px; }
@media (max-width: 900px) { .primary-nav .rail-section, .primary-nav .nav-secondary { display: none; } }
@media (min-width: 901px) { .primary-nav .nav-more { display: none; } }
.more-list .row { align-items: center; }
.more-list .row-meta { margin: 0; }

/* -------------------------------------------------------------- reflection ---- */
.journal-filters { margin-bottom: 12px; }
.journal-item .row-title { display: block; }
.journal-body { white-space: pre-wrap; margin: 6px 0 0; font-family: var(--font-read); font-size: 14.5px; line-height: 1.5; }
.review-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.review-figures .stat { padding: 12px 14px; }
.review-list { margin: 0 0 12px 18px; padding: 0; }
.review-list li { margin: 4px 0; }
.experiment-days { display: inline-flex; gap: 6px; }

/* ------------------------------------------------------------ progress 2.0 ---- */
.trend-row { display: grid; gap: 4px; }
.trend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.trend-head .field-label { margin: 0; }
.trend { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.trend i { flex: 1; min-width: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.85; }
.trend i.is-empty { background: var(--line); opacity: 1; }
