/* EngageTrack components: the person hub, goal meters, charts, plan sheets. Colour carries meaning: green progress, coral restriction, blue neutral. */
.hub { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.5rem 2rem; align-items: start; }
.hub-rail { position: sticky; top: 5rem; display: grid; gap: 1rem; }
@media (max-width: 64rem) { .hub { grid-template-columns: 1fr; } .hub-rail { position: static; order: -1; } }
.hub > div > section { margin-bottom: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 700; background: var(--brand-tint); color: var(--brand-deep); }
.chip::before { content: ''; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.chip-good { background: var(--calm-tint); color: #1b5e39; } .chip-watch { background: #fff3d6; color: #6a4a00; } .chip-restrict { background: var(--signal-tint); color: #8a2c0e; } .chip-quiet { background: #eef1f3; color: var(--muted); }
.chip-restrict::before { border-radius: 2px; transform: rotate(45deg); }
.goal { display: grid; gap: .5rem; padding: 1rem 0; border-top: 1px solid var(--rule); }
.goal:first-of-type { border-top: 0; padding-top: 0; }
.goal h3 { margin: 0; font-size: 1.05rem; }
.meter-svg { display: block; width: 100%; height: auto; }
.meter-svg .m-track { fill: #e4ebec; } .meter-svg .m-fill { fill: var(--brand); } .meter-svg.is-met .m-fill, .meter-svg.is-on_track .m-fill, .meter-svg.is-good .m-fill { fill: var(--calm); } .meter-svg.is-off_track .m-fill { fill: var(--signal); }
.meter-svg .m-exp { stroke: var(--ink); stroke-width: 2; }
.meter-legend { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.bars-svg { display: block; width: 100%; height: auto; margin-top: .25rem; }
.bars-svg .bar { fill: var(--brand); } .bars-svg.restraint .bar { fill: var(--signal); } .bars-svg .bar.is-now { stroke: var(--ink); stroke-width: 1.5; }
.bars-svg .bar-base { stroke: var(--rule); stroke-width: 1; } .bars-svg .bar-target { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 4 3; } .bars-svg .bar-target-label { fill: var(--ink); font-size: 7px; font-family: var(--font-body); }
.spark-axis { display: flex; gap: 0; margin-bottom: .25rem; font-size: .72rem; color: var(--muted); } .spark-axis span { flex: 1 1 0; text-align: center; overflow: hidden; }
.mt { margin-top: 1.25rem; }
.plan-sheet { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; }
.plan-sheet h3 { margin: 1rem 0 .25rem; font-size: 1rem; color: var(--brand-deep); } .plan-sheet h3:first-child { margin-top: 0; }
.plan-sheet p { margin: 0 0 .5rem; }
.restriction { border: 1px solid #e5a58f; background: #fff8f5; border-radius: var(--radius); padding: .75rem 1rem; margin: .5rem 0; }
.restriction h4 { margin: 0 0 .25rem; font-size: .95rem; color: #8a2c0e; }
.restriction p { margin: .15rem 0; font-size: .95rem; }
.version-list { list-style: none; margin: 0; padding: 0; } .version-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-top: 1px solid var(--rule-soft); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.count-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem 1rem; }
.rx { border: 1px dashed var(--field-border); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .75rem; }
.person-row td:first-child a { font-size: 1.05rem; }
.empty { padding: 1.25rem; border: 1px dashed var(--rule); border-radius: var(--radius); color: var(--muted); }
@media print { .hub { display: block; } .hub-rail { display: none; } .card, .plan-sheet { box-shadow: none; } }
.stat .figure { display: block; margin-bottom: .15rem; }
.stat > span:not(.figure) { display: block; }

/* Count-as-you-watch, built for a phone held in one hand: big targets, one column. */
.btn-big { min-height: 3.25rem; padding: .75rem 1.4rem; font-size: 1.05rem; }
.watch-clock { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin: 0; font-size: 1.15rem; }
.watch-bar { height: .6rem; border-radius: 999px; background: var(--rule, #d3dde0); overflow: hidden; }
.watch-bar span { display: block; height: 100%; background: var(--brand); width: 0; }
.watch-bar span.p5 { width: 5%; } .watch-bar span.p10 { width: 10%; } .watch-bar span.p15 { width: 15%; } .watch-bar span.p20 { width: 20%; } .watch-bar span.p25 { width: 25%; } .watch-bar span.p30 { width: 30%; } .watch-bar span.p35 { width: 35%; } .watch-bar span.p40 { width: 40%; } .watch-bar span.p45 { width: 45%; } .watch-bar span.p50 { width: 50%; } .watch-bar span.p55 { width: 55%; } .watch-bar span.p60 { width: 60%; } .watch-bar span.p65 { width: 65%; } .watch-bar span.p70 { width: 70%; } .watch-bar span.p75 { width: 75%; } .watch-bar span.p80 { width: 80%; } .watch-bar span.p85 { width: 85%; } .watch-bar span.p90 { width: 90%; } .watch-bar span.p95 { width: 95%; } .watch-bar span.p100 { width: 100%; }
.watch-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.watch-btn { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; min-height: 5rem; padding: 1rem 1.1rem; text-align: left; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: var(--radius, 8px); cursor: pointer; touch-action: manipulation; }
.watch-btn .watch-name { font-size: 1.15rem; font-weight: 700; }
.watch-btn .watch-tot { font-size: .9rem; color: var(--muted, #555); }
.watch-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.watch-btn.on .watch-tot { color: #fff; }
.watch-actions { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .watch-actions { grid-template-columns: repeat(auto-fit, minmax(10rem, max-content)); } }
.watch-actions .btn { width: 100%; text-align: center; justify-content: center; }
.watch-actions .btn:disabled { opacity: .45; }

/* Small screens, everywhere else in the app */
@media (max-width: 40rem) {
  .row2, .row3 { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 1rem; min-height: 2.75rem; }
  details > summary { min-height: 2.75rem; display: flex; align-items: center; }
  .btn { min-height: 2.75rem; }
}
[data-watch] [hidden] { display: none !important; }

/* Record what happened, on a phone: choices are big buttons, no script needed. */
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: .6rem; grid-template-columns: 1fr; }
.choice legend { font-weight: 700; margin-bottom: .5rem; }
@media (min-width: 40rem) { .choice { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pick { position: relative; display: block; margin: 0; }
.pick input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pick span { display: flex; align-items: center; min-height: 3.5rem; padding: .75rem 1rem; border: 2px solid var(--ink); border-radius: var(--radius, 8px); background: #fff; font-weight: 600; }
.pick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pick input:focus-visible + span { outline: 3px solid var(--signal); outline-offset: 2px; }
.quick-save { display: grid; gap: .6rem; grid-template-columns: 1fr; position: sticky; bottom: 0; padding: .75rem 0; background: var(--paper); }
@media (min-width: 40rem) { .quick-save { grid-template-columns: repeat(auto-fit, minmax(10rem, max-content)); position: static; } }
.quick textarea { min-height: 7rem; }

/* Small screens (320px): nothing may push the page wider than the screen. Grid and flex children shrink, rows of buttons wrap, long words break. */
.card, .sheet, section, .table-wrap, .row2 > *, .toolbar > * { min-width: 0; max-width: 100%; }
.row2, .toolbar, .no-print { flex-wrap: wrap; }
td, th, .muted, .small, .chip, .sheet p, .card p { overflow-wrap: break-word; }
.table-wrap { position: relative; }   /* a visually hidden (absolutely placed) cell label must be clipped by the scroller, not stretch the page */
@media (max-width: 52rem) { .hub, .case { grid-template-columns: minmax(0, 1fr); } }   /* the side column drops under the main one on a narrow screen */
@media (max-width: 52rem) { li, .chip { min-width: 0; } .chip { margin-left: 0; white-space: normal; max-width: 100%; } li:has(> .chip) { flex-wrap: wrap; } }
