:root {
  color-scheme: dark;
  --bg: #080c11;
  --bg-soft: #0c1219;
  --surface: #111923;
  --surface-2: #16212d;
  --surface-3: #1c2a38;
  --border: #223140;
  --border-soft: #192633;
  --text: #e8eef5;
  --muted: #8fa0b5;
  --muted-2: #62748a;
  --accent: #b6f24b;
  --accent-ink: #10180a;
  --accent-2: #4dd7e8;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #fb7185;
  --info: #60a5fa;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --sidebar: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1e9;
  --bg-soft: #ede9df;
  --surface: #fffdf8;
  --surface-2: #f7f3ea;
  --surface-3: #ebe5d8;
  --border: #ddd5c6;
  --border-soft: #e8e1d4;
  --text: #1b2430;
  --muted: #667085;
  --muted-2: #8b95a5;
  --accent: #4d7c0f;
  --accent-ink: #f7fee7;
  --accent-2: #0e7490;
  --good: #15803d;
  --warn: #b45309;
  --bad: #be123c;
  --info: #1d4ed8;
  --shadow: 0 18px 50px rgba(30, 40, 50, 0.10);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1000px 600px at 85% -10%, rgba(182, 242, 75, 0.10), transparent 55%),
    radial-gradient(900px 500px at 10% 110%, rgba(77, 215, 232, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px 18px;
  border-right: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 900; font-size: 19px; letter-spacing: -0.05em;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18), 0 8px 24px rgba(182, 242, 75, 0.18);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.03em; }
.brand-sub { display: block; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-2); margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { padding: 12px 10px 5px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted-2); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--muted); font-size: 14px; font-weight: 600;
  transition: background 140ms ease, color 140ms ease;
}
.nav a svg { width: 17px; height: 17px; opacity: 0.9; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav a.active svg { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--accent); font-weight: 800; font-size: 13px; }
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted-2); }
.logout-btn { border: 0; background: transparent; color: var(--muted); padding: 4px; border-radius: 8px; }
.logout-btn svg { width: 16px; height: 16px; display: block; }
.logout-btn:hover { color: var(--bad); background: var(--surface-2); }

/* ---------- Main ---------- */
.main { min-width: 0; padding: 30px 36px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; font-weight: 700; }
h1 { margin: 4px 0 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.1; letter-spacing: -0.045em; }
h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: -0.02em; }
h3 { margin: 0 0 8px; font-size: 15px; }
p { margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.date-badge { border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; color: var(--muted); font-size: 12px; font-weight: 600; background: var(--surface); }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-start { align-items: start; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, white 4%), var(--surface));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-tight { padding: 15px 17px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; }
.card-sub { font-size: 12px; color: var(--muted); }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: auto -30px -55px auto; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.13em; color: var(--muted-2); font-weight: 800; }
.stat-value { margin-top: 8px; font-size: 31px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.stat-sub { margin-top: 7px; font-size: 12px; color: var(--muted); }
.stat-accent { color: var(--accent); }
.stat-good { color: var(--good); }
.stat-warn { color: var(--warn); }
.stat-bad { color: var(--bad); }

.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 13px; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800; letter-spacing: 0.02em; border: 1px solid var(--border); color: var(--muted); background: var(--surface-2); }
.badge-good { color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, var(--border)); background: color-mix(in srgb, var(--good) 9%, var(--surface)); }
.badge-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.badge-bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); background: color-mix(in srgb, var(--bad) 9%, var(--surface)); }
.badge-info { color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, var(--border)); background: color-mix(in srgb, var(--info) 9%, var(--surface)); }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.tall { height: 360px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted-2); font-size: 13px; text-align: center; padding: 20px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* ---------- Heatmap ---------- */
.heatmap-shell { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 4px; width: max-content; }
.heat-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-3); border: 1px solid transparent; }
.heat-cell:hover { border-color: var(--accent); }
.heat-l1 { background: color-mix(in srgb, var(--accent) 22%, var(--surface-3)); }
.heat-l2 { background: color-mix(in srgb, var(--accent) 38%, var(--surface-3)); }
.heat-l3 { background: color-mix(in srgb, var(--accent) 58%, var(--surface-3)); }
.heat-l4 { background: var(--accent); }
.heat-future { opacity: 0.18; }
.heatmap-legend { display: flex; align-items: center; gap: 6px; color: var(--muted-2); font-size: 11px; margin-top: 10px; }

/* ---------- Tables / lists ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-2); font-weight: 800; padding: 0 10px 9px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.empty { padding: 26px 14px; text-align: center; color: var(--muted-2); font-size: 13px; border: 1px dashed var(--border); border-radius: 12px; }
.list { display: flex; flex-direction: column; gap: 0; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.list-item:last-child { border-bottom: 0; }
.list-main { min-width: 0; }
.list-title { font-size: 13px; font-weight: 700; }
.list-sub { font-size: 11px; color: var(--muted); }
.list-value { font-family: var(--mono); font-weight: 700; font-size: 14px; white-space: nowrap; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.10em; }
.field .hint { font-size: 11px; color: var(--muted-2); font-weight: 400; text-transform: none; letter-spacing: 0; }
input, select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); padding: 10px 12px;
  outline: none; transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { min-height: 76px; resize: vertical; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 14px;
  background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 13px;
  transition: transform 100ms ease, background 120ms ease, border-color 120ms ease;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, white); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); }
.btn-sm { padding: 5px 9px; font-size: 11px; border-radius: 8px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; }
.inline-form { display: inline; }
.form-card { max-width: 820px; }
.form-section + .form-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border-soft); }
.form-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-2); font-weight: 800; margin-bottom: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.flash { border-radius: 12px; padding: 11px 14px; margin-bottom: 18px; font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); }
.flash-ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, var(--border)); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.flash-err { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }

/* ---------- Auth ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 32px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-card h1 { font-size: 28px; margin-bottom: 6px; }
.auth-card .sub { margin-bottom: 20px; }
.auth-card .field { margin-bottom: 14px; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--muted-2); }
.auth-link { color: var(--accent); font-weight: 700; }

/* ---------- Exercise library ---------- */
.exercise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 16px; }
.exercise-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.exercise-media { background: #f6f2e9; display: grid; place-items: center; height: 230px; padding: 14px; overflow: hidden; }
.exercise-media img { height: 200px; width: auto; max-width: 100%; object-fit: contain; mix-blend-mode: multiply; display: block; }
.exercise-body { padding: 15px 16px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.exercise-name { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.exercise-meta { color: var(--muted); font-size: 12px; }
.exercise-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 3px 7px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 11px; color: var(--muted); font-weight: 600; }
.pill b { color: var(--text); }

.exercise-hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 20px; align-items: start; }
.exercise-art { background: #f6f2e9; border-radius: 14px; padding: 18px; display: grid; place-items: center; min-height: 330px; overflow: hidden; }
.exercise-art img { max-height: 340px; max-width: 100%; object-fit: contain; mix-blend-mode: multiply; display: block; }
.art-toggle { margin-top: 10px; display: flex; justify-content: center; }
.exercise-detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.detail-block { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 15px; }
.detail-block h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-2); }
.detail-block ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.detail-block li + li { margin-top: 5px; }
.detail-block p { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------- Workout ---------- */
.workout-exercise { border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface-2); padding: 16px; }
.workout-exercise + .workout-exercise { margin-top: 14px; }
.workout-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.workout-thumb { width: 74px; height: 74px; border-radius: 12px; background: #f6f2e9; padding: 6px; object-fit: contain; mix-blend-mode: multiply; flex: none; }
.prescription { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 12px; }
.set-grid { display: grid; grid-template-columns: 44px 1fr 1fr 1fr; gap: 8px; align-items: center; }
.set-grid .set-label { font-size: 11px; color: var(--muted-2); font-weight: 800; text-align: center; }
.set-grid input { padding: 8px 9px; font-family: var(--mono); text-align: center; }
.set-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-2); font-weight: 800; text-align: center; }
.set-head:first-child { text-align: left; }
.rest-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.set-note { font-size: 12px; color: var(--muted); }
.session-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.workout-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }

/* ---------- Rest timer ---------- */
.rest-timer {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  display: none; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.rest-timer.show { display: flex; }
.rest-time { font-family: var(--mono); font-size: 24px; font-weight: 800; min-width: 66px; text-align: center; }
.rest-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-2); font-weight: 800; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted-2); }
.kv dd { margin: 0; font-weight: 600; }
.divider { height: 1px; background: var(--border-soft); margin: 16px 0; }
.note { border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--muted); font-size: 13px; }
.note.warn { border-left-color: var(--warn); }
.note.bad { border-left-color: var(--bad); }
.note.good { border-left-color: var(--good); }
.two-col { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 16px; align-items: start; }
.section-gap { margin-top: 20px; }
.link-arrow { color: var(--accent); font-weight: 700; font-size: 12px; }
.footer-note { margin-top: 28px; color: var(--muted-2); font-size: 11px; text-align: center; }
.footer-note a { color: var(--muted); text-decoration: underline; }
.mobile-top { display: none; }
.mobile-bar { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  :root { --sidebar: 220px; }
  .main { padding: 26px 24px 70px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { display: block; }
  .sidebar { display: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 14px; }
  .mobile-top .brand { padding: 0; }
  .mobile-top .brand-sub { display: none; }
  .mobile-top .brand-name { font-size: 16px; }
  .mobile-top .brand-mark { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
  .mobile-actions { display: flex; align-items: center; gap: 6px; }
  .mobile-actions .btn { padding: 6px 8px; }
  .main { padding: 16px 16px 100px; }
  .mobile-bar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50;
    justify-content: space-around; align-items: center;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--border); border-radius: 18px; padding: 7px 6px;
    backdrop-filter: blur(16px); box-shadow: var(--shadow);
  }
  .mobile-bar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9px; font-weight: 700; color: var(--muted-2); padding: 6px 8px; border-radius: 10px; }
  .mobile-bar a svg { width: 19px; height: 19px; }
  .mobile-bar a.active { color: var(--accent); background: var(--surface-2); }
  .page-head { flex-direction: column; gap: 10px; }
  .grid-3, .grid-2, .two-col, .exercise-hero { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .exercise-detail { grid-template-columns: 1fr; }
  .session-meta { grid-template-columns: 1fr; }
  .rest-timer { bottom: 86px; right: 16px; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .stat-value { font-size: 27px; }
  .card { padding: 16px; }
  .main { padding: 16px 12px 104px; }
  .set-grid { grid-template-columns: 34px 1fr 1fr 1fr; gap: 6px; }
  .set-grid input { padding: 8px 4px; }
  .exercise-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .exercise-media { height: 165px; padding: 8px; }
  .exercise-media img { height: 145px; }
  .exercise-body { padding: 11px; }
  .exercise-name { font-size: 13px; }
}
@media print {
  .sidebar, .mobile-bar, .head-actions, .actions, .rest-timer { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: white; color: black; }
}

/* ---------- Phase 3: nutrition / health ---------- */
.check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-soft); color: var(--muted); font-size: 12px; font-weight: 600;
}
.check-pill input { width: auto; accent-color: var(--accent); }
.check-pill:has(input:checked) { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }

.plate {
  width: 180px; height: 180px; border-radius: 50%;
  border: 8px solid var(--surface-3);
  background:
    linear-gradient(90deg, transparent 49.6%, var(--surface-3) 49.6%, var(--surface-3) 50.4%, transparent 50.4%),
    linear-gradient(0deg, transparent 49.6%, var(--surface-3) 49.6%, var(--surface-3) 50.4%, transparent 50.4%),
    #f6f2e9;
  position: relative; flex: none;
}
.plate span { position: absolute; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #4b5563; }
.plate .plate-veg { top: 20px; left: 14px; width: 62px; text-align: center; }
.plate .plate-protein { top: 20px; right: 14px; width: 62px; text-align: center; }
.plate .plate-starch { bottom: 20px; left: 42px; width: 92px; text-align: center; }
.plate .plate-note { bottom: -28px; left: 0; width: 100%; text-align: center; color: var(--muted); font-size: 10px; font-weight: 600; }
.plate-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.fasting-strip { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.fasting-cell { height: 26px; border-radius: 5px; background: var(--surface-3); border: 1px solid transparent; }
.fasting-cell:hover { border-color: var(--accent); }
.fasting-kept { background: color-mix(in srgb, var(--good) 72%, var(--surface-3)); }
.fasting-missed { background: color-mix(in srgb, var(--bad) 55%, var(--surface-3)); }
.fasting-unlogged { background: var(--surface-3); }
.fasting-legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted-2); font-size: 11px; margin-top: 9px; }
.fasting-legend i { width: 10px; height: 10px; display: inline-block; border-radius: 3px; margin-right: 4px; }

.habit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.habit-row:last-child { border-bottom: 0; }
.habit-main { min-width: 0; }
.habit-name { font-size: 13px; font-weight: 700; }
.habit-sub { font-size: 11px; color: var(--muted); }
.habit-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.habit-done { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, var(--border)); }

.med-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.med-row:last-child { border-bottom: 0; }
.med-name { font-size: 13px; font-weight: 700; }
.med-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.med-notes { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.med-actions { display: flex; gap: 6px; flex: none; }
.med-taken { color: var(--good); }

.trigger-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.trigger-grid .check-pill { font-size: 11px; padding: 5px 9px; }

.severity { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px; border-radius: 7px; font-family: var(--mono); font-weight: 800; font-size: 12px; }
.severity-good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.severity-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.severity-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }

.chart-wrap.small { height: 190px; }
.chart-wrap.tiny { height: 150px; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-title h2 { margin: 0; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-links a { text-decoration: none; }

.info-list { display: grid; gap: 9px; }
.info-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.info-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex: none; }
.info-item p { margin: 0; font-size: 12px; color: var(--muted); }
.info-item strong { color: var(--text); }

details.playbook { border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-2); padding: 10px 12px; }
details.playbook + details.playbook { margin-top: 8px; }
details.playbook summary { cursor: pointer; font-size: 13px; font-weight: 700; }
details.playbook p { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.review-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.review-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.review-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 18px; }
.review-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2); font-weight: 800; }
.review-value { font-size: 23px; font-weight: 800; letter-spacing: -.04em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.review-sub { font-size: 11px; color: var(--muted); margin-top: 5px; }
.focus-card { border-left: 4px solid var(--accent); }

@media (max-width: 900px) {
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .review-grid { grid-template-columns: 1fr; }
  .fasting-strip { gap: 3px; }
  .fasting-cell { height: 22px; }
  .plate { width: 150px; height: 150px; }
}

@media print {
  .flash, .mobile-bar, .mobile-top, .sidebar, .head-actions, .footer-note, .btn, .quick-links { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .review-card, .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; background: #fff !important; color: #111 !important; }
  body { background: #fff; color: #111; }
  .review-value, .stat-value { color: #111 !important; }
  .muted, .sub, .stat-sub, .review-sub, .card-sub, .list-sub, .footer-note { color: #444 !important; }
}

.quick-card { display: block; transition: transform 120ms ease, border-color 120ms ease; }
.quick-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); color: var(--text); }
.quick-card .stat-value { margin-top: 6px; }

/* ---------- Body map ---------- */
.body-map { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.body-figure { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.body-figure svg { width: 142px; height: 284px; }
.body-base { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.2; }
.muscle { fill: var(--surface-3); stroke: var(--border); stroke-width: 0.8; transition: fill 180ms ease; }
.muscle.on { fill: color-mix(in srgb, var(--accent) 78%, var(--surface-3)); stroke: color-mix(in srgb, var(--accent) 85%, var(--border)); }
.body-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2); font-weight: 800; }
.body-legend { flex: 1; min-width: 220px; }
@media (max-width: 560px) {
  .body-map { gap: 12px; }
  .body-figure svg { width: 112px; height: 224px; }
}
