/* progress screens: owned by that module (Progress, Coach, and the server-drawn charts).
   Colours come only from the tokens in app.css, so dark mode follows the phone by itself.
   Series colours are for marks; every piece of text uses an ink colour. */

/* ---------------------------------------------------------------- charts */

.ch { margin: 0; }
.ch-what { font-size: 13.5px; color: var(--ink-2); margin: 0 0 10px; }
.ch-sub { font-size: 14px; margin: 16px 0 4px; }
.ch-sub:first-of-type { margin-top: 4px; }
.ch-svg { display: block; width: 100%; height: auto; max-width: 560px; overflow: visible; -webkit-tap-highlight-color: transparent; }
.ch-svg text { fill: var(--ink-3); font-family: var(--font); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-svg .ch-unit { font-weight: 650; }
.ch-svg .ch-now { fill: var(--ink); font-weight: 700; }
.ch-svg .ch-label { fill: var(--ink); font-weight: 700; font-size: 11.5px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.ch-grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.ch-grid line.ch-base { stroke: var(--rule-strong); }

.ch-bar.s1 { fill: var(--series-1); }
.ch-bar.s2 { fill: var(--series-2); }
.ch-bar.s3 { fill: var(--series-3); }
.ch-target { fill: color-mix(in srgb, var(--ink-3) 8%, transparent); stroke: var(--ink-3); stroke-width: 1.25; stroke-linejoin: round; }
.ch-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-line.s1 { stroke: var(--series-1); }
.ch-line.s2 { stroke: var(--series-2); }
.ch-line.s3 { stroke: var(--series-3); }
.ch-line.is-dashed { stroke-dasharray: 5 4; }
.ch-dot { stroke: var(--surface); stroke-width: 2; }
.ch-dot.s1 { fill: var(--series-1); }
.ch-dot.s2 { fill: var(--series-2); }
.ch-dot.s3 { fill: var(--series-3); }
.ch-dot.is-soft { fill-opacity: 0.55; }
.ch-band { fill: color-mix(in srgb, var(--ink-3) 13%, transparent); }
.ch-hit { fill: var(--ink); fill-opacity: 0; cursor: pointer; }
.ch-hit.is-on { fill-opacity: 0.06; }

.ch-readout { font-size: 13px; color: var(--ink-2); margin: 6px 0 0; min-height: 1.5em; font-variant-numeric: tabular-nums; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0 0 8px; padding: 0; font-size: 12.5px; color: var(--ink-2); }
.ch-legend li { margin: 0; display: inline-flex; align-items: center; }
.ch-key { display: inline-block; flex: none; width: 12px; height: 10px; margin-right: 6px; }
.ch-key-bar { border-radius: 3px 3px 0 0; }
.ch-key-bar.s1 { background: var(--series-1); }
.ch-key-bar.s2 { background: var(--series-2); }
.ch-key-bar.s3 { background: var(--series-3); }
.ch-key-target { border: 1.25px solid var(--ink-3); border-bottom: 0; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--ink-3) 8%, transparent); }
.ch-key-line { width: 18px; height: 2px; border-radius: 1px; }
.ch-key-line.s1 { background: var(--series-1); }
.ch-key-line.s2 { background: var(--series-2); }
.ch-key-line.s3 { background: var(--series-3); }
.ch-key-line.is-dashed.s1 { background: repeating-linear-gradient(90deg, var(--series-1) 0 5px, transparent 5px 8px); }
.ch-key-line.is-dashed.s2 { background: repeating-linear-gradient(90deg, var(--series-2) 0 5px, transparent 5px 8px); }
.ch-key-dot { width: 9px; height: 9px; border-radius: 50%; }
.ch-key-dot.s1 { background: var(--series-1); }
.ch-key-band { width: 14px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--ink-3) 13%, transparent); }

.ch .fold { margin-top: 8px; }
.ch .fold > summary { font-size: 14px; color: var(--ink-2); min-height: 44px; padding: 10px 0; }
.ch-table { font-size: 13.5px; }
.ch-table td.num { white-space: nowrap; }
.ch-table th[scope="row"] { font-weight: 550; color: var(--ink); text-align: left; text-transform: none; letter-spacing: 0; font-size: 13.5px; padding: 8px; border-bottom: 1px solid var(--rule); }
.ch-table tr:last-child th[scope="row"] { border-bottom: 0; }
.ch-cell-main { display: block; }
.ch-cell-note { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.ch-empty { padding: 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-3); font-size: 14px; }
.ch-empty p { margin: 0; }
.ch-empty .ch-empty-title { font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.ch-missing { margin-top: 12px; }

.ch-meters { display: flex; flex-direction: column; gap: 12px; }
.ch-meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.ch-meter-label { font-weight: 600; }
.ch-meter-value { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.ch-meter { display: block; }
.ch-meter-track { fill: var(--surface-3); }
.ch-meter-fill { fill: var(--series-1); }
.ch-meter-note { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 0; }

/* ---------------------------------------------------------------- readiness */

.ms-next { font-weight: 650; font-size: 15px; padding: 10px 12px; border-radius: 11px; background: var(--accent-soft); color: var(--ink); margin: 0 0 12px; }
.ms-blocks { margin-top: 6px; border-top: 1px solid var(--rule); }
.ms-blocks > .fold > summary { min-height: 44px; font-size: 15px; }
.ms-list { list-style: none; margin: 0; padding: 0; }
.ms { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule); margin: 0; }
.ms:first-child { border-top: 0; }
.ms-icon { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.ms-icon.is-done { background: var(--green-soft); color: var(--green); }
.ms-icon.is-open { border: 2px solid var(--rule-strong); }
.ms-icon.is-info::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.ms-body { min-width: 0; }
.ms-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 0 0 2px; }
.ms-label { font-weight: 650; flex: 1 1 auto; min-width: 0; }
.ms-head .pill { margin-top: 1px; }
.ms-value { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ms-detail { font-size: 13.5px; color: var(--ink-3); margin: 0; }

.finish { margin-top: 14px; padding: 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--rule); }
.finish .eyebrow { margin-bottom: 2px; }
.finish-range, .finish-none { font-size: 22px; font-weight: 780; letter-spacing: -0.02em; margin: 0 0 6px; }
.finish-none { color: var(--ink-2); }
.finish .row { margin-bottom: 6px; }
.finish p:last-child { margin-bottom: 0; }

.perf-list { list-style: none; margin: 0; padding: 0; }
.perf-list .list-row { align-items: flex-start; margin: 0; }
.perf-list .list-row .title { margin: 0 0 2px; }
.perf-list .list-row .small { margin: 0; }
.perf-list .perf-chosen { margin: 6px 0 0; }

/* ---------------------------------------------------------------- coach */

/* a form sends James back to its card: never hide the card's heading under the sticky top bar */
#latest, #changes, #long-cap { scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 72px); }
.rv-flash { margin: 0 0 12px; }
.rv-changes > .rv-flash { margin-top: 8px; }

.rv-next { font-size: 14px; color: var(--ink-2); padding: 10px 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--rule); margin: 0 0 12px; }
.rv-next.is-due { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--rule)); font-weight: 600; }
.rv-when { font-size: 13px; color: var(--ink-3); margin: -4px 0 8px; }
.rv-summary { font-size: 15px; }
.rv-held { padding: 10px 12px; border-radius: 11px; background: var(--amber-soft); color: var(--ink); font-size: 14px; }
.rv-sub { font-size: 12px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); margin: 16px 0 4px; }
.rv-metrics { display: grid; gap: 8px; margin: 0; }
.rv-metrics > div { display: grid; grid-template-columns: minmax(104px, 36%) 1fr; gap: 10px; }
.rv-metrics dt { color: var(--ink-3); font-size: 13.5px; }
.rv-metrics dd { margin: 0; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rv-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.rv-note { font-size: 12.5px; color: var(--ink-3); }
.rv-limits { font-size: 13.5px; color: var(--ink-2); }
.rv-earlier .fold:first-child { border-top: 0; }
.rv-more > .fold:first-child { border-top: 0; }
.rv-more { padding-top: 4px; padding-bottom: 4px; }
.rv-old > summary { justify-content: space-between; flex-wrap: wrap; min-height: 44px; }
.rv-old-title { flex: 1; min-width: 0; }
.rv-old-changes { font-size: 13.5px; }
.rv-old-changes li { margin: 6px 0; }

.chg { padding: 12px 0; border-top: 1px solid var(--rule); }
.rv-sub + .chg { border-top: 0; padding-top: 4px; }
.chg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; margin-bottom: 4px; }
.chg-title { font-weight: 650; margin: 0; flex: 1 1 200px; min-width: 0; }
.chg-why { font-size: 14px; color: var(--ink-2); margin: 0 0 4px; }
.chg-late { font-size: 13.5px; color: var(--ink-3); margin: 0 0 4px; }
.chg-evidence { font-size: 13.5px; color: var(--ink-2); }
.chg .fold { border-top: 0; }
.chg .fold > summary { font-size: 14px; color: var(--ink-2); min-height: 44px; padding: 10px 0; }
.chg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.chg-actions .btn { width: 100%; min-height: 50px; font-size: 16px; }

.ph-list { list-style: none; margin: 0 0 8px; padding: 0; }
.ph { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; padding: 7px 0; border-top: 1px solid var(--rule); margin: 0; }
.ph:first-child { border-top: 0; }
.ph-label { font-weight: 650; min-width: 9.5em; }
.ph-dates { font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ph.is-now .ph-label { color: var(--accent-text); }
.ph-focus { font-size: 13.5px; color: var(--ink-2); padding: 10px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--rule); }

.wk-list { list-style: none; margin: 0; padding: 0; }
.wk { margin: 0; border-top: 1px solid var(--rule); }
.wk:first-child { border-top: 0; }
.wk-sum { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 4px 9px 10px; border-left: 3px solid transparent; min-height: 44px; }
.wk.is-now .wk-sum { border-left-color: var(--accent); background: var(--accent-soft); border-radius: 0 9px 9px 0; }
.wk-date { font-weight: 650; }
.wk-pills { display: inline-flex; gap: 4px; justify-self: end; }
.wk-line { grid-column: 1 / -1; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wk.is-past .wk-date, .wk.is-past .wk-line { color: var(--ink-3); }
.wk-fold > summary { list-style: none; cursor: pointer; }
.wk-fold > summary::-webkit-details-marker { display: none; }
.wk-fold > summary .wk-date::after { content: " ›"; color: var(--ink-3); font-weight: 400; }
.wk-fold[open] > summary .wk-date::after { content: " ⌄"; }
.wk-notes { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; padding: 0 8px 0 30px; }
