:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #15181d;
  --muted: #5b6573;
  --border: #d5d9e0;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --danger: #c62828;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #1a1f26;
    --text: #e8ebf0;
    --muted: #9aa5b4;
    --border: #2d3540;
    --accent: #4c8dff;
    --accent-text: #08111f;
    --danger: #ff6b6b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; letter-spacing: .04em; color: var(--text); text-decoration: none; }
.who { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; }
.who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
a { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
label { font-weight: 600; }
input, select, textarea, button, .btn {
  font: inherit; min-height: 48px; border-radius: var(--radius);
}
input, select, textarea {
  width: 100%; padding: 8px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border);
}
button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.wide { width: 100%; }
button.link { background: none; border: none; color: var(--accent); padding: 8px; }
.users { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.users form { margin: 0; }
.error { color: var(--danger); margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.eyebrow { margin: 0; color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.next h1 { margin: 0; }
.btn.big { min-height: 64px; font-size: 1.25rem; }
.btn.danger { color: var(--danger); }
form { margin: 0; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; }
h3 { font-size: 1rem; margin: 1.25rem 0 .25rem; color: var(--muted); }
.day { margin: .5rem 0; }
.daylabel { font-weight: 700; margin-bottom: 4px; }
.slot { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.slot .icon { width: 1.5rem; text-align: center; font-size: 1.2rem; }
.slot .wname { flex: 1; min-width: 0; }
.slot .st { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.slot.completed .icon { color: var(--accent); }
.slot.skipped .st { color: var(--danger); font-weight: 600; }
.exercise { margin: .5rem 0; }
.exercise h3 { margin: .75rem 0 .25rem; color: var(--text); }
.vrow { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.vrow .side { width: 3.5rem; color: var(--muted); }
button.val { flex: 1; min-height: 48px; font-size: 1.1rem; }
button.val .empty { color: var(--muted); font-size: .85rem; }
.banner { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 600; }
.banner.skipped { color: var(--danger); }
.note { display: grid; gap: 8px; margin: 1rem 0; }
.exhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
button.mini { min-height: 48px; padding: 4px 12px; font-size: .9rem; }
button.val.unsaved { border: 2px dashed var(--danger); }
.toolbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; background: var(--bg); }
.savestate { min-height: 48px; border-color: transparent; background: none; color: var(--muted); }
.savestate[data-state="failed"] { color: var(--danger); font-weight: 700; border-color: var(--danger); }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 10; }
.backdrop[hidden], .sheet[hidden], [hidden] { display: none !important; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; margin: 0 auto; max-width: 640px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 16px 16px 0 0; box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
  display: grid; gap: 10px; max-height: 90vh; overflow-y: auto;
}
.sheet:focus { outline: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet-title { font-weight: 600; color: var(--muted); min-width: 0; }
.sheet-main { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: center; }
.sheet .display { text-align: center; font-size: 2.5rem; font-weight: 700; min-height: 64px; padding: 0; }
.sheet .step { min-height: 64px; font-size: 2rem; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad button { min-height: 56px; font-size: 1.5rem; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.sheet-actions .primary, .sheet .primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.sheet button:disabled { opacity: .4; }
body.sheet-open main { padding-bottom: var(--sheet-h, 60vh); }
.who a.name { text-decoration: underline; }
button.wake { margin-left: auto; font-size: 0.85rem; color: var(--muted); }
button.wake.on { color: var(--accent); font-weight: 600; }
button.wake:disabled { opacity: 0.6; }
.pad .zero { grid-column: span 2; }
.sheet-next { margin: 0; font-size: .9rem; color: var(--muted); }
