/* Coach PWA styles. Mobile-first, light/dark via prefers-color-scheme. */

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e5e8ed;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #111418;
  --text-2: #4f5866;
  --text-3: #7b8594;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-ink: #ffffff;
  --accent-text: #4338ca;
  --accent-soft: #eef0ff;
  --focus: #4f46e5;

  --ok: #0a7d33;
  --ok-fill: #12a150;
  --ok-soft: #e6f5eb;
  --warn: #9a5b00;
  --warn-fill: #f2a600;
  --warn-soft: #fff4d6;
  --alert: #c4282d;
  --alert-fill: #e5484d;
  --alert-soft: #fdeaea;
  --info: #2563c9;
  --info-soft: #e8f0fd;

  /* HR zones (lab zones). Same hues everywhere: map, charts, bars, legends. */
  --z1: #8a9bb0;
  --z2: #257de0;
  --z3: #00a35a;
  --z4: #f2a600;
  --z5: #e5484d;

  /* chart roles */
  --c-hr: #e5484d;
  --c-pace: #257de0;
  --c-gap: #6a4ce2;
  --c-alt: #8a9bb0;
  --c-cad: #c2418a;
  --c-weight: #8a9bb0;
  --c-avg: #257de0;
  --c-trend: #f47230;
  --c-band: rgba(18, 161, 80, 0.13);
  --grid: #eceef2;
  --axis: #c2c7cf;
  --axis-text: #6b7380;

  --radius: 16px;
  --radius-sm: 11px;
  --tap: 44px;
  --gutter: 16px;
  --header-h: 52px;
  --tabbar-h: 58px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0f12;
    --surface: #17191e;
    --surface-2: #1f2228;
    --surface-3: #2a2e36;
    --border: rgba(255, 255, 255, 0.075);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text: #eef0f3;
    --text-2: #a7afbb;
    --text-3: #77808c;
    --accent: #5b55ee;
    --accent-hover: #6d68f2;
    --accent-ink: #ffffff;
    --accent-text: #a5a6fb;
    --accent-soft: #23234a;
    --focus: #a5a6fb;
    --ok: #53c568;
    --ok-fill: #1fae52;
    --ok-soft: #14301d;
    --warn: #f5b938;
    --warn-fill: #e0a000;
    --warn-soft: #33270b;
    --alert: #ff7b7f;
    --alert-fill: #e5484d;
    --alert-soft: #3a1617;
    --info: #7fb0ff;
    --info-soft: #162640;
    --c-gap: #9887ef;
    --c-cad: #e06aa8;
    --c-band: rgba(31, 174, 82, 0.16);
    --grid: #262a31;
    --axis: #3a3f48;
    --axis-text: #8b93a0;
    --shadow: 0 0 0 rgba(0, 0, 0, 0);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f12; --surface: #17191e; --surface-2: #1f2228; --surface-3: #2a2e36;
  --border: rgba(255, 255, 255, 0.075); --border-strong: rgba(255, 255, 255, 0.15);
  --text: #eef0f3; --text-2: #a7afbb; --text-3: #77808c;
  --accent: #5b55ee; --accent-hover: #6d68f2; --accent-ink: #fff; --accent-text: #a5a6fb; --accent-soft: #23234a; --focus: #a5a6fb;
  --ok: #53c568; --ok-fill: #1fae52; --ok-soft: #14301d; --warn: #f5b938; --warn-fill: #e0a000; --warn-soft: #33270b;
  --alert: #ff7b7f; --alert-fill: #e5484d; --alert-soft: #3a1617; --info: #7fb0ff; --info-soft: #162640;
  --c-gap: #9887ef; --c-cad: #e06aa8; --c-band: rgba(31, 174, 82, 0.16);
  --grid: #262a31; --axis: #3a3f48; --axis-text: #8b93a0; --shadow: none; --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
.num, .tnum { font-variant-numeric: tabular-nums; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 10px; text-decoration: none;
}
.skip-link:focus { top: calc(var(--sat) + 8px); }
.noscript { padding: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ shell */
.app-header {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--sat);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
}
.app-header.is-scrolled { border-bottom-color: var(--border); }
.app-header__inner {
  height: var(--header-h);
  max-width: 760px; margin: 0 auto;
  padding: 0 calc(var(--gutter) - 6px + var(--sar)) 0 calc(var(--gutter) + var(--sal));
  display: flex; align-items: center; gap: 6px;
}
.app-header__back { margin-left: -10px; }
.app-header__title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header__badges { display: flex; gap: 6px; align-items: center; }
body.is-login .app-header, body.is-login .tabbar { display: none; }

.view {
  display: block;
  max-width: 760px; margin: 0 auto;
  padding: 8px calc(var(--gutter) + var(--sar)) calc(var(--tabbar-h) + var(--sab) + 28px) calc(var(--gutter) + var(--sal));
  min-height: calc(100dvh - var(--header-h));
}
.view--wide { max-width: 980px; }
body.has-timer .view { padding-bottom: calc(var(--tabbar-h) + var(--sab) + 96px); }
body.is-login .view { padding-top: calc(var(--sat) + 24px); padding-bottom: calc(var(--sab) + 24px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 0 var(--sar) var(--sab) var(--sal);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar__inner { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); max-width: 760px; margin: 0 auto; height: var(--tabbar-h); }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--tap); text-decoration: none; color: var(--text-3);
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent-text); }
.tab:active { opacity: 0.7; }

/* ------------------------------------------------------------------ primitives */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); flex: none;
  border: 0; border-radius: 12px; background: transparent; color: var(--text-2);
  text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--surface-3); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 15px; font-weight: 600; line-height: 1.1; text-decoration: none; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  transition: background-color .15s, transform .1s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ok { background: var(--ok-fill); color: #fff; }
.btn--ghost { background: transparent; color: var(--accent-text); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--outline { background: transparent; border-color: var(--border-strong); }
.btn--danger { background: var(--alert-soft); color: var(--alert); }
.btn--block { width: 100%; }
.btn--lg { min-height: 52px; font-size: 16px; border-radius: 14px; }
.btn--sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-3) transparent var(--text-3) transparent;
  animation: spin .8s linear infinite;
}
.btn--primary.is-busy::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.row { display: flex; align-items: center; gap: 8px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.strong { font-weight: 650; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 0 12px;
  min-width: 0;
}
.card--flush { padding: 0; overflow: hidden; }
.card--accent { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.card__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.card__head > .grow { min-width: 0; }
.card__head--tight { margin-bottom: 6px; }
.eyebrow { font-size: 12.5px; font-weight: 650; color: var(--text-2); letter-spacing: 0.01em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.eyebrow svg { width: 15px; height: 15px; }
.card__title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }
.card__sub { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 20px 4px 8px; letter-spacing: 0.01em; }
.section-title:first-child { margin-top: 4px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; border: 0; }

/* ------------------------------------------------------------------ chips, badges */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; }
.chip--accent { background: var(--accent-soft); color: var(--accent-text); }
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--alert { background: var(--alert-soft); color: var(--alert); }
.chip--info { background: var(--info-soft); color: var(--info); }
.chip--mock { background: var(--warn-soft); color: var(--warn); height: 22px; font-size: 11px; letter-spacing: .04em; }
.chip--offline { background: var(--alert-soft); color: var(--alert); height: 22px; font-size: 11px; }

.badge-kind { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--text-2); }
.badge-kind .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-kind--easy { color: var(--z2); background: color-mix(in srgb, var(--z2) 12%, transparent); }
.badge-kind--vo2, .badge-kind--tt_5k, .badge-kind--race { color: var(--alert); background: color-mix(in srgb, var(--z5) 12%, transparent); }
.badge-kind--threshold, .badge-kind--tt_30min { color: var(--warn); background: color-mix(in srgb, var(--z4) 16%, transparent); }
.badge-kind--submax_test { color: var(--ok); background: color-mix(in srgb, var(--z3) 12%, transparent); }

/* segmented control */
.seg { display: flex; padding: 3px; gap: 3px; border-radius: 13px; background: var(--surface-2); }
.seg button {
  flex: 1; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--border); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--surface-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"], :root:not([data-theme="light"]) .seg button[aria-checked="true"] { background: var(--surface-3); } }

/* ------------------------------------------------------------------ today */
.datebar { display: flex; align-items: center; gap: 4px; margin: 2px -10px 4px; }
.datebar__main { flex: 1; min-width: 0; text-align: center; }
.datebar__date { font-size: 21px; font-weight: 750; letter-spacing: -0.015em; }
.datebar__week { margin-top: 6px; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.today-link { display: flex; justify-content: center; margin-top: 4px; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); margin-bottom: 12px; }
.banner > svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.banner__title { font-weight: 700; font-size: 15px; }
.banner__body { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.banner--accent { background: var(--accent-soft); color: var(--accent-text); }
.banner--accent .banner__title { color: var(--text); }
.banner--info { background: var(--info-soft); color: var(--info); }
.banner--warn { background: var(--warn-soft); color: var(--warn); }
.banner--alert { background: var(--alert-soft); color: var(--alert); }
.banner--warn .banner__title, .banner--alert .banner__title, .banner--info .banner__title { color: var(--text); }

.alert-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.alert-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 14px; }
.alert-item > svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert-item__label { font-size: 12px; font-weight: 700; display: block; margin-bottom: 1px; }
.alert-item p { color: var(--text); }
.alert-item--info { background: var(--info-soft); color: var(--info); }
.alert-item--warn { background: var(--warn-soft); color: var(--warn); }
.alert-item--alert { background: var(--alert-soft); color: var(--alert); }

.ex-list { list-style: none; margin: 0 -4px; }
.ex-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--border); }
.ex-list li:first-child { border-top: 0; }
.ex-list__idx { width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ex-list__name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.ex-list__meta { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.ex-list__kg { font-size: 15px; font-weight: 700; text-align: right; white-space: nowrap; }
.ex-list__kg small { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-3); }

.structure { font-size: 15px; line-height: 1.45; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

.target-rows { display: flex; flex-direction: column; gap: 8px; }
.target-row { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.target-row .zdot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.target-row .grow { color: var(--text-2); }
.target-row strong { font-weight: 700; }

.actions { display: flex; gap: 8px; margin-top: 14px; }
.actions > * { flex: 1; }
.done-pill { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 650; font-size: 15px; margin-top: 14px; }
.done-pill svg { width: 20px; height: 20px; }
.done-pill .grow { color: var(--text); }

.macro-hero { display: flex; align-items: baseline; gap: 6px; }
.macro-hero__kcal { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; }
.macro-hero__unit { font-size: 15px; font-weight: 600; color: var(--text-2); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.macro { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.macro__label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.macro__value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.macro__value small { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.macro__bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.macro__bar span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.module { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border-strong); }
.module__title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.module__title svg { width: 16px; height: 16px; color: var(--warn); }
.module ul { margin-top: 6px; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.module li + li { margin-top: 3px; }

.progress-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); margin-top: 10px; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: 1; }
.meter > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s; }
.meter--ok > span { background: var(--ok-fill); }

.check-list { list-style: none; margin: 0 -6px; }
.check-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px;
  padding: 8px 6px; border: 0; border-radius: 12px; background: transparent; text-align: left;
}
.check-row:hover { background: var(--surface-2); }
.check-box {
  width: 28px; height: 28px; flex: none; border-radius: 9px; border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; color: transparent; transition: all .15s;
}
.check-box svg { width: 18px; height: 18px; }
.check-row[aria-checked="true"] .check-box { background: var(--ok-fill); border-color: var(--ok-fill); color: #fff; }
.check-row[aria-checked="true"] .check-row__label { color: var(--text-2); }
.check-row__label { font-size: 15px; font-weight: 550; line-height: 1.3; }
.check-row__target { font-size: 12.5px; color: var(--text-3); font-weight: 600; white-space: nowrap; }

.tips { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.tips li { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; }
.tips li > svg { width: 20px; height: 20px; flex: none; color: var(--accent-text); margin-top: 1px; }
.tips strong { display: block; font-size: 15px; }
.tips span { color: var(--text-2); }

.bullets { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; }
.bullets li::marker { color: var(--text-3); }

/* ------------------------------------------------------------------ gym */
.session-picker { margin-bottom: 12px; }
.gym-summary .meter { height: 6px; }
.ex-card { padding: 0; overflow: hidden; }
.ex-card__head {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px;
  padding: 12px 14px; border: 0; background: transparent; text-align: left;
}
.ex-card__head:hover { background: var(--surface-2); }
.ex-card__num { width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--surface-2); color: var(--text-2); font-weight: 750; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.ex-card.is-complete .ex-card__num { background: var(--ok-fill); color: #fff; }
.ex-card__name { font-size: 16px; font-weight: 650; line-height: 1.25; }
.ex-card__alt { font-size: 12px; font-weight: 650; color: var(--accent-text); }
.ex-card__meta { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.ex-card__progress { font-size: 13px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.ex-card__chev { width: 20px; height: 20px; color: var(--text-3); transition: transform .2s; flex: none; }
.ex-card.is-open .ex-card__chev { transform: rotate(180deg); }
.ex-card__body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }

.suggest { border-radius: 12px; padding: 12px 14px; background: var(--accent-soft); }
.suggest__label { font-size: 12px; font-weight: 700; color: var(--accent-text); display: flex; align-items: center; gap: 6px; }
.suggest__label svg { width: 14px; height: 14px; }
.suggest__value { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; margin-top: 2px; }
.suggest__value small { font-size: 14px; font-weight: 600; color: var(--text-2); }
.suggest__reason { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.suggest.is-updated { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.last-line { font-size: 13px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.last-line strong { color: var(--text); font-weight: 650; }
.spark { display: flex; align-items: center; gap: 10px; }
.spark svg { width: 96px; height: 30px; flex: none; }
.spark__val { font-size: 13px; color: var(--text-2); }
.spark__val strong { color: var(--text); font-size: 14px; }
.cue { font-size: 13.5px; color: var(--text-2); display: flex; gap: 8px; }
.cue svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--text-3); }
.alt-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.alt-row .btn { min-height: 40px; font-size: 13.5px; font-weight: 600; }
.alt-row .btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

.set-row { border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.set-row.is-saved { background: var(--surface-2); border-color: transparent; }
.set-row__head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.set-row__head .grow { color: var(--text); }
.set-row__state { font-size: 12.5px; font-weight: 650; color: var(--ok); display: inline-flex; gap: 4px; align-items: center; }
.set-row__state svg { width: 15px; height: 15px; }
.set-row__state--queued { color: var(--warn); }
.set-row__summary { display: flex; align-items: center; gap: 10px; }
.set-row__summary .val { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: stretch; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.stepper button { border: 0; background: transparent; height: 48px; width: 44px; border-radius: 12px; color: var(--text); display: flex; align-items: center; justify-content: center; }
.stepper button:active { background: var(--surface-3); }
.stepper button svg { width: 18px; height: 18px; }
.stepper label { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.stepper input { width: 100%; min-width: 0; border: 0; background: transparent; text-align: center; font-size: 19px; font-weight: 700; padding: 0; height: 28px; font-variant-numeric: tabular-nums; }
.stepper input:focus { outline: none; }
.stepper:focus-within { box-shadow: 0 0 0 2px var(--focus); }
.stepper .unit { font-size: 11px; font-weight: 650; color: var(--text-3); line-height: 1; margin-top: -2px; }
.rpe-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rpe-grid button {
  min-height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-size: 14.5px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; padding: 0;
}
.rpe-grid button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rpe-grid button.is-target:not([aria-checked="true"]) { border-color: var(--accent); color: var(--accent-text); }
.rpe-label { font-size: 12px; font-weight: 650; color: var(--text-2); display: flex; justify-content: space-between; }

/* rest timer */
.timer-bar {
  position: fixed; left: 0; right: 0; z-index: 35;
  bottom: calc(var(--tabbar-h) + var(--sab) + 8px);
  padding: 0 calc(12px + var(--sar)) 0 calc(12px + var(--sal));
}
.timer-bar__inner {
  max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--text); color: var(--surface);
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.timer-bar__inner > svg { width: 24px; height: 24px; flex: none; }
.timer-bar__time { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; min-width: 66px; }
.timer-bar__label { font-size: 13px; opacity: .75; line-height: 1.25; }
.timer-bar .icon-btn { color: var(--surface); }
.timer-bar .icon-btn:hover { background: rgba(127,127,127,.25); }
.timer-bar .btn { background: rgba(127,127,127,.25); color: var(--surface); min-height: 40px; }
.timer-bar__progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.timer-bar.is-done .timer-bar__inner { background: var(--ok-fill); color: #fff; }
.timer-bar.is-done .icon-btn, .timer-bar.is-done .btn { color: #fff; }

/* review table (screenshot) */
.review-ex { border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.review-ex.is-low { border-color: var(--warn-fill); background: var(--warn-soft); }
.review-ex.is-skipped { opacity: .55; }
.review-ex__raw { font-size: 13px; color: var(--text-2); }
.review-sets { width: 100%; border-collapse: collapse; table-layout: fixed; }
.review-sets th { font-size: 12px; color: var(--text-2); font-weight: 650; text-align: left; padding: 0 4px 4px; }
.review-sets td { padding: 3px 4px; }
.review-sets td:last-child, .review-sets th:last-child { width: 48px; }
.review-sets th:first-child, .review-sets td:first-child { width: 28px; color: var(--text-3); font-size: 13px; }
.field-input, .select {
  width: 100%; min-height: var(--tap); border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface); padding: 0 12px; font-size: 16px; font-variant-numeric: tabular-nums;
}
.select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-input:focus, .select:focus, textarea.field-input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
textarea.field-input { min-height: 84px; padding: 10px 12px; line-height: 1.4; resize: vertical; }
.review-sets .field-input { padding: 0 8px; text-align: center; }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.input-unit { position: relative; }
.input-unit .field-input { padding-right: 46px; }
.input-unit__u { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-3); font-weight: 600; pointer-events: none; }
.scale5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale5 button { min-height: 44px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 16px; }
.scale5 button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.scale-hint { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ------------------------------------------------------------------ runs */
.run-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: inherit;
  border-top: 1px solid var(--border); min-height: 72px;
}
.run-row:first-child { border-top: 0; }
.run-row:hover { background: var(--surface-2); }
.run-row__name { font-size: 15.5px; font-weight: 650; line-height: 1.25; }
.run-row__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 3px; }
.run-row__stats { font-size: 13px; color: var(--text-2); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.run-row__stats b { color: var(--text); font-weight: 650; }
.run-row__flags { display: flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 700; }
.run-row__flags svg { width: 16px; height: 16px; }
.run-row__chev { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.ring { width: 46px; height: 46px; flex: none; position: relative; }
.ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.ring__val { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; }
.ring--lg, .ring--lg svg { width: 64px; height: 64px; }
.ring--lg .ring__val { font-size: 17px; }

.run-title { margin: 4px 0 12px; }
.run-title__name { font-size: 22px; font-weight: 750; letter-spacing: -0.015em; }
.run-title__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 14px; color: var(--text-2); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 11px 13px; box-shadow: var(--shadow); min-width: 0; }
.tile__label { font-size: 12px; font-weight: 650; color: var(--text-2); }
.tile__value { font-size: 20px; font-weight: 720; letter-spacing: -0.01em; margin-top: 1px; white-space: nowrap; }
.tile__value small { font-size: 13px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.tile__sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile__sub svg { width: 13px; height: 13px; flex: none; }
.tile__sub.is-ok { color: var(--ok); } .tile__sub.is-warn { color: var(--warn); } .tile__sub.is-alert { color: var(--alert); }

.pva { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.pva__label { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.pva__notes { margin-top: 12px; }

.flags { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.map { height: 260px; border-radius: 0; background: var(--surface-2); position: relative; z-index: 0; }
.map-wrap { position: relative; }
.map-legend { display: flex; gap: 10px; flex-wrap: wrap; padding: 10px 14px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 12px; color: var(--text-2); }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-item i.line { width: 14px; height: 3px; border-radius: 2px; }
.legend-item i.dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-item i.band { width: 14px; height: 10px; border-radius: 2px; }

.charts-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.charts-head .seg { flex: none; }
.readout {
  position: sticky; top: calc(var(--sat) + var(--header-h)); z-index: 5;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px 8px;
  padding: 8px 14px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums; min-height: 56px;
}
.readout__cell { min-width: 0; }
.readout__k { font-size: 10.5px; font-weight: 700; color: var(--text-3); display: flex; align-items: center; gap: 4px; letter-spacing: .02em; }
.readout__k i { width: 8px; height: 3px; border-radius: 2px; display: inline-block; }
.readout__v { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout__hint { grid-column: 1 / -1; align-self: center; font-size: 13px; color: var(--text-3); text-align: center; }
.chart-block { padding: 8px 6px 2px 2px; }
.chart-block + .chart-block { border-top: 1px solid var(--border); }
.chart-block__title { display: flex; align-items: center; gap: 10px; padding: 2px 10px 0 14px; font-size: 12.5px; font-weight: 700; color: var(--text-2); flex-wrap: wrap; }
.chart-block__title .grow { color: var(--text); }
.chart { width: 100%; position: relative; touch-action: pan-y; }
.chart .u-over { touch-action: pan-y; }
.uplot, .uplot *, .uplot *::before, .uplot *::after { box-sizing: border-box; }
.uplot { font-family: var(--font); width: 100%; }
.u-legend { display: none; }
.u-cursor-x { border-right: 1px solid var(--text-3) !important; }
.u-cursor-y { display: none; }

.zonebar { display: flex; gap: 2px; height: 28px; border-radius: 6px; overflow: hidden; }
.zonebar > div { height: 100%; display: flex; align-items: center; padding-left: 6px; font-size: 12px; font-weight: 700; color: #fff; min-width: 0; border-radius: 4px; overflow: hidden; white-space: nowrap; }
.zonebar > div.ink-dark { color: #0b0b0b; }
.zonebar--thin { height: 8px; border-radius: 4px; gap: 2px; }
.zonebar--thin > div { padding: 0; border-radius: 4px; }
.zone-legend { display: flex; flex-direction: column; margin-top: 10px; }
.zone-legend__row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 44px 46px; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; font-variant-numeric: tabular-nums; }
.zone-legend__row:first-child { border-top: 0; }
.zone-legend__row i { width: 12px; height: 12px; border-radius: 3px; }
.zone-legend__row .r { text-align: right; font-weight: 650; }
.zone-legend__row .rng { color: var(--text-3); font-size: 12.5px; text-align: right; }
.cap-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.cap-line svg { width: 18px; height: 18px; flex: none; }
.cap-line.is-warn { background: var(--warn-soft); color: var(--warn); }
.cap-line.is-warn span { color: var(--text); }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table th { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-align: right; padding: 0 6px 8px; white-space: nowrap; letter-spacing: .02em; }
.table td { padding: 9px 6px; text-align: right; border-top: 1px solid var(--border); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table td .sub { display: block; font-size: 11.5px; color: var(--text-3); }
.table tr.is-work td { font-weight: 650; }
.table tr.is-best td:nth-child(2) { color: var(--ok); font-weight: 700; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: var(--surface-2); }
.table tr.is-selected td { background: var(--accent-soft); }
.iv-kind { display: inline-flex; align-items: center; gap: 6px; }
.iv-kind i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.iv-kind--work i { background: var(--alert-fill); }
.iv-kind--recovery i { background: var(--z2); }

.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmp__cell { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.delta svg { width: 14px; height: 14px; }
.delta.is-good { color: var(--ok); } .delta.is-bad { color: var(--alert); } .delta.is-neutral { color: var(--text-2); }

/* ------------------------------------------------------------------ body / progress */
.gauge { position: relative; height: 34px; margin-top: 8px; }
.gauge__track { position: absolute; left: 0; right: 0; top: 10px; height: 10px; border-radius: 5px; background: var(--surface-3); }
.gauge__band { position: absolute; top: 10px; height: 10px; background: var(--ok-fill); opacity: .55; border-radius: 3px; }
.gauge__marker { position: absolute; top: 4px; width: 4px; height: 22px; margin-left: -2px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.gauge__ticks { position: relative; height: 16px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.gauge__ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.stat__label { font-size: 12px; font-weight: 650; color: var(--text-2); }
.stat__value { font-size: 18px; font-weight: 720; margin-top: 1px; }
.stat__value small { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hero-num { font-size: 40px; font-weight: 750; letter-spacing: -0.025em; line-height: 1.05; }
.hero-num small { font-size: 17px; font-weight: 650; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 0 6px; }
.chart-card .chart { margin: 0 -8px 0 -10px; width: calc(100% + 18px); }
.chart-readout { font-size: 13px; color: var(--text-2); min-height: 20px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.chart-readout strong { color: var(--text); }
.range-seg { margin-left: auto; }
.range-seg button { min-height: 40px; min-width: 42px; padding: 0 8px; font-size: 13px; }
.bullet-rows { display: flex; flex-direction: column; gap: 10px; }
.bullet { display: grid; grid-template-columns: 118px minmax(0, 1fr) 54px; align-items: center; gap: 10px; font-size: 13.5px; }
.bullet__label { color: var(--text); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bullet__track { position: relative; height: 14px; border-radius: 4px; background: var(--surface-2); }
.bullet__done { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--accent); }
.bullet__done.is-under { background: var(--warn-fill); }
.bullet__plan { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.bullet__val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bullet__val small { color: var(--text-3); font-weight: 600; }
.week-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.week-nav__label { font-size: 14px; font-weight: 700; min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.svgchart { width: 100%; height: auto; overflow: visible; }
.svgchart text { font-family: var(--font); font-size: 11px; fill: var(--axis-text); font-variant-numeric: tabular-nums; }
.svgchart .grid { stroke: var(--grid); stroke-width: 1; }
.svgchart .axis { stroke: var(--axis); stroke-width: 1; }
.svgchart .hit { fill: transparent; cursor: pointer; }
.svgchart .is-active-col .hit { fill: var(--text); fill-opacity: .05; }
.svgchart text.total { fill: var(--text); font-weight: 700; }

.body-list .table td:first-child { font-weight: 600; }

/* ------------------------------------------------------------------ settings */
.week-list { list-style: none; }
.week-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--border); font-size: 14px; }
.week-row:first-child { border-top: 0; }
.week-row__n { font-weight: 750; font-variant-numeric: tabular-nums; }
.week-row__dates { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.week-row.is-current { background: var(--accent-soft); border-radius: 10px; border-top-color: transparent; padding-left: 10px; padding-right: 10px; margin: 0 -8px; }
.week-row.is-current + .week-row { border-top-color: transparent; }
.week-row.is-past { color: var(--text-2); }
.meso-head { margin-top: 16px; }
.meso-head:first-child { margin-top: 0; }
.meso-head__title { font-size: 15px; font-weight: 700; }
.meso-head__focus { font-size: 13px; color: var(--text-2); margin: 2px 0 6px; }
.criteria { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.criteria li { display: flex; gap: 10px; font-size: 14px; }
.criteria li svg { width: 18px; height: 18px; flex: none; color: var(--text-3); margin-top: 1px; }
.gate { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin-top: 10px; }
.gate__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gate__title { font-weight: 700; font-size: 15px; flex: 1; }
.race-hero { display: flex; gap: 14px; align-items: center; }
.race-hero__date { width: 58px; height: 62px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.race-hero__date b { font-size: 24px; line-height: 1; }
.race-hero__date span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* ------------------------------------------------------------------ login */
.login { max-width: 380px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 16px; }
.login__logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto; box-shadow: var(--shadow-lg); }
.login__title { text-align: center; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.login__sub { text-align: center; color: var(--text-2); margin-top: -10px; }
.login__err { color: var(--alert); font-size: 14px; font-weight: 600; min-height: 20px; }

/* ------------------------------------------------------------------ dialogs, toasts */
dialog.sheet {
  border: 0; padding: 0; margin: 0; max-width: none; max-height: none;
  width: 100%; height: 100%; background: transparent; color: var(--text);
}
dialog.sheet::backdrop { background: rgba(8, 10, 14, 0.5); }
.sheet__wrap { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.sheet__panel {
  width: 100%; max-width: 560px; max-height: calc(100dvh - var(--sat) - 24px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  padding-bottom: var(--sab);
  animation: sheet-in .22s ease-out;
}
.sheet--full .sheet__panel { height: calc(100dvh - var(--sat) - 12px); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 18px; }
.sheet__title { font-size: 18px; font-weight: 750; flex: 1; }
.sheet__body { overflow-y: auto; padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.sheet__foot { display: flex; gap: 8px; padding: 12px 18px 14px; border-top: 1px solid var(--border); }
.sheet__foot > * { flex: 1; }
@media (min-width: 700px) {
  .sheet__wrap { align-items: center; }
  .sheet__panel { border-radius: 20px; padding-bottom: 0; }
  .sheet--full .sheet__panel { height: min(820px, calc(100dvh - 48px)); }
}

.toasts { position: fixed; left: 0; right: 0; top: calc(var(--sat) + 8px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 480px; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; background: var(--text); color: var(--surface); font-size: 14.5px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--ok svg { color: var(--ok-fill); }
.toast--warn svg { color: var(--warn-fill); }
.toast--alert svg { color: var(--alert-fill); }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ states */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--radius); margin-bottom: 12px; }
.skeleton--title { height: 56px; border-radius: 14px; }
.skeleton--card { height: 180px; }
.skeleton--tiles { height: 220px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.empty { text-align: center; padding: 28px 16px; color: var(--text-2); }
.empty svg { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--text-3); }
.empty__title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.error-card { border-color: var(--alert-soft); }
.mock-note { font-size: 12px; color: var(--warn); display: flex; gap: 6px; align-items: center; margin: 4px 4px 12px; }
.mock-note svg { width: 14px; height: 14px; flex: none; }

/* ------------------------------------------------------------------ leaflet tweaks */
.leaflet-container { font-family: var(--font); background: var(--surface-2); }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 20px; }
.leaflet-touch .leaflet-bar, .leaflet-bar { border-radius: 12px; overflow: hidden; border: 1px solid var(--border-strong) !important; box-shadow: var(--shadow); }
.leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-control-attribution { font-size: 10.5px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--text-2); }
.leaflet-control-attribution a { color: var(--text-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.6); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.6); }

/* ------------------------------------------------------------------ wider screens */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map { height: 340px; }
  .readout { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .two-col > .card { margin-bottom: 0; }
  .two-col + * { margin-top: 12px; }
}
@media (max-width: 370px) {
  :root { --gutter: 12px; }
  .tile__value { font-size: 18px; }
  .macro { padding: 9px 10px; }
  .macro__value { font-size: 16px; }
  .bullet { grid-template-columns: 100px minmax(0, 1fr) 50px; gap: 8px; }
  .zone-legend__row { grid-template-columns: 12px minmax(0, 1fr) auto 40px 42px; gap: 8px; font-size: 13.5px; }
  .table { font-size: 13px; }
  .table th, .table td { padding-left: 4px; padding-right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- week re-planner (views/schedule.js) */
.sched-strip { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0; }
.sched-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; border-radius: 10px; background: var(--surface-2); border: 1.5px solid transparent; min-width: 0; }
.sched-day__wd { font-size: 11px; font-weight: 650; color: var(--text-3); }
.sched-day__s { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sched-day__mark { height: 14px; display: flex; color: var(--text-3); }
.sched-day__mark svg { width: 13px; height: 13px; }
.sched-day--rest .sched-day__s { color: var(--text-3); font-weight: 600; }
.sched-day--gym .sched-day__s { color: var(--accent-text); }
.sched-day.is-hard .sched-day__s { color: var(--alert); }
.sched-day.is-today { border-color: var(--accent); }
.sched-day.is-done .sched-day__mark { color: var(--ok); }
.sched-day.is-moved { background: var(--warn-soft); }
.sched-day.is-moved .sched-day__mark { color: var(--warn); }
.sched-day.is-changed { background: var(--warn-soft); border-style: dashed; border-color: var(--warn-fill); }
.sched-day.is-changed.is-today { border-style: solid; border-color: var(--accent); }
.sched-day.is-missed .sched-day__s { text-decoration: line-through; color: var(--text-3); }
.sched-choices { display: flex; flex-direction: column; gap: 8px; }
.sched-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.sched-choice:active { background: var(--surface-2); }
.sched-choice > svg { width: 22px; height: 22px; color: var(--accent-text); flex: none; }
.sched-choice__l { display: block; font-size: 15.5px; font-weight: 650; }
.sched-choice__s { display: block; font-size: 13px; color: var(--text-2); margin-top: 1px; }
.sched-swap .row { gap: 6px; }
.sched-other summary { min-height: 44px; display: flex; align-items: center; font-size: 14px; font-weight: 600; color: var(--accent-text); cursor: pointer; }
.sched-other__row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.sched-other__row .select { min-height: 44px; max-width: 150px; }
.sched-opt__title { font-size: 16px; font-weight: 700; }
.sched-tabs button { min-height: 40px; flex: 1; }
.sched-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sched-changes li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.sched-changes svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--warn); }
.sched-block { margin-bottom: 0; }
.sched-block .sched-list { gap: 4px; margin-top: 2px; }
.sched-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sched-stat { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: var(--surface-2); }
.sched-stat__v { font-size: 20px; font-weight: 750; }
.sched-stat__l { font-size: 12px; color: var(--text-2); font-weight: 600; }
.sched-stat--ok .sched-stat__v { color: var(--ok); }
.sched-stat--warn .sched-stat__v { color: var(--warn); }
.sched-stat--alert .sched-stat__v { color: var(--alert); }
.sched-card .actions { flex-wrap: wrap; }
.sched-foot { display: flex; gap: 8px; width: 100%; }
.sched-foot > * { flex: 1; }
/* ------------------------------------------------------------------ food (Φαγητό): meal timeline, menu, list, out */
:root {
  --m-breakfast: #c25e0c; --m-lunch: #2d6bb3; --m-main: #2e8653; --m-pre: #7543b3; --m-evening: #66757f;
  --m-rest: #8a96a0; --m-out: #c0374b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --m-breakfast: #f08a34; --m-lunch: #5c9be6; --m-main: #4fb577; --m-pre: #a67be6; --m-evening: #93a3ad;
    --m-rest: #6f7b85; --m-out: #ee6478;
  }
}
:root[data-theme="dark"] {
  --m-breakfast: #f08a34; --m-lunch: #5c9be6; --m-main: #4fb577; --m-pre: #a67be6; --m-evening: #93a3ad;
  --m-rest: #6f7b85; --m-out: #ee6478;
}
@media (max-width: 370px) { .tab { font-size: 10.5px; letter-spacing: 0; } .tab svg { width: 22px; height: 22px; } }

.food-seg { margin-bottom: 12px; }
.food-seg--slot { margin-bottom: 12px; }
.food-intro { margin: 0 4px 12px; }
.food-note { font-size: 13px; color: var(--text-2); margin: -2px 4px 12px; }
.food-week { margin: 0 -6px 8px; }
.food-out__date { text-align: center; margin-bottom: 10px; }
.food-meter__label { width: 72px; flex: none; }
.food-eaten { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.food-eaten svg { width: 16px; height: 16px; color: var(--ok); flex: none; }
.warn-text { color: var(--warn); font-weight: 650; }
.btn--wrap { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }

.meal-tl { list-style: none; position: relative; margin: 4px 0 12px; padding-left: 58px; }
.meal-tl::before { content: ""; position: absolute; left: 47px; top: 10px; bottom: 10px; width: 2px; background: var(--surface-3); border-radius: 1px; }
.meal { position: relative; margin-bottom: 12px; --c: var(--m-main); }
.meal--breakfast { --c: var(--m-breakfast); } .meal--lunch { --c: var(--m-lunch); } .meal--main { --c: var(--m-main); }
.meal--pre { --c: var(--m-pre); } .meal--evening { --c: var(--m-evening); } .meal--rest { --c: var(--m-rest); } .meal--out { --c: var(--m-out); }
.meal__time { position: absolute; left: -58px; top: 12px; width: 38px; text-align: right; font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.meal__node { position: absolute; left: -16px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--bg); }
.meal__card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); min-width: 0; }
.meal--module .meal__card { background: color-mix(in srgb, var(--c) 9%, var(--surface)); border-color: color-mix(in srgb, var(--c) 40%, transparent); border-left-color: var(--c); }
.meal.is-eaten .meal__card { opacity: .78; }
.meal.is-skip .meal__card { opacity: .72; border-style: dashed; border-left-style: solid; }
.meal__head { display: flex; align-items: flex-start; gap: 8px; }
.meal__kind { font-size: 12px; font-weight: 700; color: var(--c); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.meal__kind svg { width: 14px; height: 14px; }
.meal__name { font-size: 16px; font-weight: 700; line-height: 1.25; margin-top: 1px; }
.meal__kcal { text-align: right; white-space: nowrap; font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; }
.meal__kcal b { font-size: 14px; color: var(--text); }
.meal__sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.meal__note { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.meal__carry { font-size: 12.5px; font-weight: 650; margin-top: 6px; }
.meal__carry.is-up { color: var(--ok); } .meal__carry.is-down { color: var(--warn); }
.meal--session .meal__node { background: var(--surface); border: 3px solid var(--accent); width: 14px; height: 14px; left: -17px; top: 11px; }
.meal__session { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-size: 13.5px; font-weight: 650; }
.meal__session svg { width: 18px; height: 18px; flex: none; }

.meal-items { list-style: none; margin: 6px 0 0; }
.meal-items > li { border-top: 1px dashed var(--border-strong); }
.meal-items > li:first-child { border-top: 0; }
.meal-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; min-height: 40px; width: 100%; }
.meal-items > li.meal-item:first-child { border-top: 0; }
.meal-item--btn { border: 0; background: transparent; text-align: left; color: inherit; padding: 6px 0; border-radius: 8px; }
.meal-item--btn:hover { background: var(--surface-2); }
.meal-item__name { min-width: 0; flex: 1; }
.meal-item__name small { display: block; font-size: 12px; color: var(--text-2); }
.meal-item__name small.is-swap { color: var(--accent-text); }
.meal-item__name small.is-carry { color: var(--ok); }
.meal-item__g { text-align: right; white-space: nowrap; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.meal-item__g b { font-weight: 700; }
.meal-item__g small { font-size: 11.5px; color: var(--text-2); white-space: normal; }
.meal-item__g { max-width: 48%; }
.meal-item__swap { width: 16px; height: 16px; color: var(--accent-text); flex: none; }
.meal-acts { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.meal-acts .btn--sm { flex: 1 1 auto; min-width: 0; padding: 0 8px; gap: 4px; font-size: 13.5px; }
.meal-acts .btn svg { width: 16px; height: 16px; }
.meal-acts .meal__icon { width: 40px; height: 40px; flex: none; border: 1px solid var(--border); }
.meal-act--ok { background: var(--ok-soft); color: var(--ok); }
.meal-act--no { background: var(--surface-2); color: var(--text-2); }
@media (max-width: 370px) { .meal-acts .btn--sm svg { display: none; } .meal-tl { padding-left: 56px; } .meal__time { left: -56px; width: 37px; font-size: 11.5px; } .meal-tl::before { left: 45px; } }

.meal-line { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-top: 12px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.meal-line > svg { width: 20px; height: 20px; color: var(--m-main); flex: none; }
.meal-line__text { display: block; font-size: 14.5px; font-weight: 650; }
.meal-line__sub { display: block; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-line__chev { width: 18px !important; height: 18px !important; color: var(--text-3) !important; }

.pick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 12px; color: var(--text); }
.pick[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.pick small { color: var(--text-2); font-size: 12.5px; }
.pick__sub { display: block; }
.pick__right { text-align: right; white-space: nowrap; display: flex; flex-direction: column; }
.edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px 64px 40px 40px; gap: 4px; align-items: center; font-size: 14px; }
.edit-row .icon-btn { width: 40px; height: 40px; }
.edit-row__g { text-align: center; padding: 0 4px; }
.edit-add { display: grid; grid-template-columns: minmax(0, 1fr) 64px auto; gap: 6px; }
.edit-sum { font-weight: 650; padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); }
.edit-sum.is-off { background: var(--warn-soft); color: var(--warn); }

.menu-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; align-items: center; margin-top: 8px; --c: var(--m-main); }
.menu-row--breakfast { --c: var(--m-breakfast); } .menu-row--lunch { --c: var(--m-lunch); } .menu-row--evening { --c: var(--m-evening); } .menu-row--pre { --c: var(--m-pre); }
.menu-row__label { font-size: 13px; font-weight: 700; color: var(--c); }
.menu-row .select { min-width: 0; font-size: 15px; }
.menu-day { padding: 12px 14px; }
.menu-day__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.menu-day__head h3 { font-size: 15.5px; }
.prep-day { font-size: 14px; font-weight: 700; color: var(--text-2); margin: 14px 4px 8px; }
.prep-card { border-left: 4px solid var(--m-main); }
.prep-card__name { font-size: 16px; }

.cost-card .hero-num small { font-size: 20px; }
.shop-row { align-items: center; }
.shop-row .grow { display: flex; flex-direction: column; }
.shop-row__q { font-size: 12.5px; color: var(--text-2); }
.shop-row__eur { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.shop-row[aria-checked="true"] .check-row__label { text-decoration: line-through; }
.out-card.is-selected { border: 2px solid var(--m-out); }
.out-card__name { font-size: 17px; }

/* ------------------------------------------------------------------ /* ------------------------------------------------------------------ sleep (Ύπνος): stage colours validated for CVD */
:root { --st-deep: #2a78d6; --st-light: #158f63; --st-rem: #d95926; --st-awake: #9aa5ab; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --st-deep: #3987e5; --st-light: #199e70; --st-rem: #d95926; --st-awake: #e3c25b; } }
:root[data-theme="dark"] { --st-deep: #3987e5; --st-light: #199e70; --st-rem: #d95926; --st-awake: #e3c25b; }
.st-0 { fill: var(--st-deep); } .st-1 { fill: var(--st-light); } .st-2 { fill: var(--st-rem); } .st-3 { fill: var(--st-awake); }
.st-area { stroke: var(--surface); stroke-width: 1.5; stroke-linejoin: round; }
.st-swatch.st-0 { background: var(--st-deep); } .st-swatch.st-1 { background: var(--st-light); }
.st-swatch.st-2 { background: var(--st-rem); } .st-swatch.st-3 { background: var(--st-awake); }
.sleep-chart { width: 100%; overflow: hidden; touch-action: pan-y; }
.sleep-chart svg { display: block; }
.svg-tick { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.svg-tick.strong { fill: var(--text); font-weight: 700; }
.svg-grid { stroke: var(--border); }
.sleep-band { fill: var(--surface); fill-opacity: .38; stroke: var(--text); stroke-dasharray: 3 3; }
.sleep-alarm { stroke: var(--text); stroke-width: 2.5; }
.sleep-cursor { stroke: var(--text); stroke-width: 1; }
.sleep-cycle { stroke: var(--text); stroke-opacity: .35; stroke-dasharray: 2 3; }
.sleep-link { stroke: var(--text-3); stroke-opacity: .6; }
.sleep-mini { cursor: pointer; }
.sleep-mini__sel { fill: var(--text); fill-opacity: .08; }
.sleep-hero__row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.sleep-hero__arrow { width: 22px; height: 22px; color: var(--text-3); }
.sleep-hero--ok { border-left: 4px solid var(--ok-fill); }
.sleep-hero--warn { border-left: 4px solid var(--warn-fill); }
.table tr.is-current td { background: var(--accent-soft); font-weight: 650; }
details.card > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; }
.link-card { display: block; color: inherit; text-decoration: none; }
.link-card:active { opacity: .8; }
.link-card { display: block; color: inherit; text-decoration: none; }
.link-card:active { opacity: .8; }
.food-shop__q { display: block; }
