:root {
  /* MyRunningPace: near-black, white type, and one electric lime (the speed lines in the logo).
     Dark is the brand and the default; "light" in settings, or "auto" on a light device, switches. */
  --bg: #0a0c10;
  --panel: #12151b;
  --panel-2: #1a1e26;
  --border: #262b35;
  --rule: #3a414f;
  --text: #f2f4f7;
  --text-2: #c9ced6;
  --muted: #8a93a3;
  --accent: #d4ff3a;
  --accent-ink: #d4ff3a;
  --on-accent: #0a0c10;
  --accent-2: #5cd18b;
  --good: #5cd18b;
  --warn: #f5b83d;
  --alert: #ff6b5b;
  --info: #6aa9ff;
  --grid: rgba(232, 236, 242, 0.08);
  --bar-bg: rgba(10, 12, 16, 0.94);
  color-scheme: dark;
  --radius: 8px;
  --num: 'Barlow Condensed', 'Heebo', system-ui, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f4f5f0;
    --panel: #ffffff;
    --panel-2: #eceee8;
    --border: #d9dcd3;
    --rule: #0a0c10;
    --text: #0a0c10;
    --text-2: #2b303a;
    --muted: #5e6573;
    --accent: #6b8f00;
    --accent-ink: #4a6300;
    --on-accent: #ffffff;
    --accent-2: #2e7d4f;
    --good: #2e7d4f;
    --warn: #a8690f;
    --alert: #b42318;
    --info: #2b5c8a;
    --grid: rgba(10, 12, 16, 0.08);
    --bar-bg: rgba(244, 245, 240, 0.94);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f5f0;
  --panel: #ffffff;
  --panel-2: #eceee8;
  --border: #d9dcd3;
  --rule: #0a0c10;
  --text: #0a0c10;
  --text-2: #2b303a;
  --muted: #5e6573;
  --accent: #6b8f00;
  --accent-ink: #4a6300;
  --on-accent: #ffffff;
  --accent-2: #2e7d4f;
  --good: #2e7d4f;
  --warn: #a8690f;
  --alert: #b42318;
  --info: #2b5c8a;
  --grid: rgba(10, 12, 16, 0.08);
  --bar-bg: rgba(244, 245, 240, 0.94);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
}

h1, h2, h3 { margin: 0; font-weight: 700; }
h3 { font-size: 1.05rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.85rem; margin: 2px 0 10px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 14px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  background: var(--bar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.3rem; font-weight: 800; }
.brand .sub { margin: 0; color: var(--muted); font-size: 0.85rem; }
.logo {
  width: 42px; height: 42px; padding: 8px;
  border-radius: 12px;
  fill: var(--bg);
  background: var(--text);
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit; font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 700; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--muted); }
.lbl-short { display: none; }
.icon-btn .ico { font-size: 0.95rem; line-height: 1; }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding-block: 24px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}

/* ---------- empty state ---------- */
.empty { display: grid; place-items: center; gap: 28px; min-height: 70vh; }
.hero { max-width: 640px; width: 100%; text-align: center; padding: 24px 8px 4px; }
.hero-eyebrow { color: var(--accent-ink); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.02em; margin: 0 0 10px; }
.hero h2 { font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.15; margin: 0 0 12px; }
.hero-lead { color: var(--text-2); font-size: 1.05rem; margin: 0 auto 22px; max-width: 34em; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn { min-height: 48px; padding-inline: 22px; font-size: 1rem; }
.hero-note { color: var(--muted); font-size: 0.85rem; margin: 14px 0 0; }
.dropzone {
  max-width: 640px; width: 100%;
  padding: 40px 32px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 20px;
  background: var(--panel);
  transition: border-color .15s, background .15s;
}
.dropzone.drag, body.drag .dropzone { border-color: var(--accent); background: var(--panel-2); }
.drop-icon { font-size: 44px; color: var(--accent); line-height: 1; margin-bottom: 8px; }
.dropzone h2 { font-size: 1.35rem; margin-bottom: 6px; }
.dropzone > p { color: var(--muted); margin: 0 0 24px; }
.howto { text-align: right; background: var(--panel-2); border-radius: 12px; padding: 16px 20px; }
.howto ol { margin: 8px 0; padding-inline-start: 20px; }
.howto .muted { font-size: 0.85rem; margin: 6px 0 0; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.meta { color: var(--muted); font-size: 0.85rem; margin: 0; }
.chips { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.chips { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.chips button {
  white-space: nowrap;
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 8px; font: inherit; cursor: pointer;
}
.chips button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.chips.small button { padding: 3px 10px; font-size: 0.85rem; }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 28px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 0.82rem; }
.kpi .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; direction: ltr; text-align: right; }
.kpi .value small { font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.kpi .sub { color: var(--muted); font-size: 0.78rem; }
.progress { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--accent); }

/* ---------- insights ---------- */
.section-title { font-size: 1.2rem; margin: 0 0 12px; }
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-bottom: 28px; }
.insight {
  background: var(--panel);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--info);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.insight.good { border-inline-start-color: var(--good); }
.insight.warn { border-inline-start-color: var(--warn); }
.insight.alert { border-inline-start-color: var(--alert); }
.insight .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.insight .badge {
  font-size: 0.72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: rgba(43, 92, 138, .15); color: var(--info);
}
.insight.good .badge { background: rgba(46, 125, 79, .15); color: var(--good); }
.insight.warn .badge { background: rgba(168, 105, 15, .15); color: var(--warn); }
.insight.alert .badge { background: rgba(180, 35, 24, .15); color: var(--alert); }
.insight p { margin: 0; color: var(--text-2); font-size: 0.92rem; }
.insight .tip { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); font-size: 0.88rem; }
.insight .tip::before { content: 'מה לעשות: '; font-weight: 700; color: var(--accent); }

/* ---------- cards / grid ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card h3 { margin-bottom: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.grid > .card { margin-bottom: 0; }
.grid { margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 240px; }
.no-chart { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 0.9rem; text-align: center; }

/* ---------- plan ---------- */
.plan-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.plan-list li { display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.plan-list .day { color: var(--muted); font-size: 0.82rem; padding-top: 2px; }
.plan-list b { display: block; }
.plan-list .detail { color: var(--text-2); font-size: 0.88rem; }
.plan-summary { color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }
.tag { display: inline-block; font-size: 0.72rem; padding: 0 8px; border-radius: 999px; margin-inline-start: 6px; vertical-align: middle; color: #fff; font-weight: 700; }

/* ---------- predictions / records ---------- */
.pred-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 10px 0; }
.pred { background: var(--panel-2); border-radius: 10px; padding: 12px; text-align: center; }
.pred .name { color: var(--muted); font-size: 0.82rem; }
.pred .time { font-size: 1.4rem; font-weight: 800; direction: ltr; }
.pred .pace { color: var(--muted); font-size: 0.8rem; }
.note { color: var(--muted); font-size: 0.8rem; margin: 6px 0 0; }

.records { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.records li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--panel-2); border-radius: 10px; }
.records .r-label { color: var(--muted); font-size: 0.85rem; }
.records .r-date { color: var(--muted); font-size: 0.75rem; display: block; }
.records .r-value { font-weight: 700; text-align: left; white-space: nowrap; }

/* ---------- table ---------- */
#search {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 12px; font: inherit; min-width: 240px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 9px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel); }
th:hover { color: var(--text); }
th.sorted::after { content: ' ▾'; }
th.sorted.asc::after { content: ' ▴'; }
tbody tr:hover { background: var(--panel-2); }
td.title { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.num { direction: ltr; text-align: right; }
.kind-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; }

/* ---------- dialog / toast ---------- */
dialog {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; width: min(400px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog label { display: grid; gap: 4px; margin: 14px 0; color: var(--muted); font-size: 0.9rem; }
dialog input { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; }
dialog small { font-size: 0.78rem; }
.dialog-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 18px; }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 40px);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 20; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: var(--alert); }

/* ---------- layout: side navigation + panels ---------- */
.layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.sidenav {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 92px);
  display: grid; gap: 2px; padding: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.sidenav a:hover { color: var(--text); background: var(--panel-2); }
.sidenav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset -3px 0 0 var(--accent); }
.sidenav .ico { width: 18px; text-align: center; color: var(--accent); font-size: 0.95rem; }
.sidenav .count {
  margin-inline-start: auto; font-size: 0.72rem; font-weight: 700;
  padding: 0 7px; border-radius: 999px; background: rgba(180, 35, 24, .18); color: var(--alert);
}
.sidenav .count:empty { display: none; }
.sidenav .nav-coach { margin-top: 6px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
.content { min-width: 0; }
.panel { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack > .card { margin-bottom: 0; }
.link { color: var(--accent); text-decoration: none; font-size: 0.88rem; }
.link:hover { text-decoration: underline; }
.insights.compact { grid-template-columns: minmax(0, 1fr); margin: 8px 0 0; }
.insights.compact .tip { display: none; }

/* ---------- goal ---------- */
.goal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.goal-race { font-size: 1.35rem; font-weight: 800; }
.goal-days { color: var(--muted); font-size: 0.88rem; }
.goal-rows { display: grid; gap: 6px; margin-top: 12px; }
.goal-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; background: var(--panel-2); border-radius: 10px; font-size: 0.9rem; }
.goal-rows span:first-child { color: var(--muted); }
.goal-rows b { font-variant-numeric: tabular-nums; }
.goal-verdict { margin: 10px 0 0; font-size: 0.9rem; }
.goal-verdict.good { color: var(--good); }
.goal-verdict.warn { color: var(--warn); }
.goal-empty { color: var(--muted); font-size: 0.9rem; margin: 6px 0 10px; }

/* ---------- technique + zones ---------- */
.pill { font-size: 0.72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.pill.good { background: rgba(46, 125, 79, .15); color: var(--good); }
.pill.warn { background: rgba(168, 105, 15, .15); color: var(--warn); }
.pill.info { background: rgba(43, 92, 138, .15); color: var(--info); }
.zones-table { display: grid; gap: 6px; margin-top: 8px; }
.zones-table div { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel-2); border-radius: 10px; font-size: 0.9rem; }
.zones-table i { width: 10px; height: 10px; border-radius: 50%; }
.zones-table b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.zones-table small { color: var(--muted); display: block; font-size: 0.78rem; }

/* ---------- beta ---------- */
.beta-badge {
  font-size: 0.7rem; font-weight: 700; vertical-align: middle;
  padding: 1px 8px; border-radius: 999px; margin-inline-start: 4px;
  background: rgba(47, 93, 80, 0.15); color: var(--accent-2);
}
.btn.feedback { text-decoration: none; border-color: rgba(47, 93, 80, 0.5); }
.demo-banner {
  margin-bottom: 16px; padding: 10px 14px; border-radius: 10px;
  background: rgba(168, 105, 15, 0.1); border: 1px solid rgba(168, 105, 15, 0.35);
  color: var(--text); font-size: 0.9rem;
}
.demo-banner b { color: var(--warn); }

/* ---------- AI coach ---------- */
.ai-card { border-top: 3px solid var(--accent); }
.ai-actions { display: flex; gap: 8px; }
.ai-status { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }
.ai-status.error { color: var(--alert); }
.ai-status.busy::before {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-inline-end: 8px;
  border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
.ai-result { display: grid; gap: 16px; }
.ai-headline { font-size: 1.15rem; font-weight: 700; margin: 0; text-wrap: balance; }
.ai-result > p { margin: 0; color: var(--text-2); max-width: 75ch; }
.ai-result h4 { margin: 0 0 8px; font-size: 0.95rem; color: var(--accent); }
.ai-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ai-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ai-list li { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; color: var(--text-2); }
.ai-list li b { color: var(--text); }
.ai-list .why { display: block; margin-top: 2px; }
.ai-list .action { display: block; margin-top: 6px; color: var(--text); }
.ai-list .action::before { content: 'מה לעשות: '; font-weight: 700; color: var(--accent); }
.prio { font-size: 0.7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-inline-start: 6px; vertical-align: middle; }
.prio.high { background: rgba(180, 35, 24, .15); color: var(--alert); }
.prio.medium { background: rgba(168, 105, 15, .15); color: var(--warn); }
.prio.low { background: rgba(43, 92, 138, .15); color: var(--info); }
.ai-week li { display: grid; grid-template-columns: 74px 1fr; gap: 12px; }
.ai-week .day { color: var(--muted); font-size: 0.82rem; }

.ai-chat { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.ai-chat h4 { margin: 0 0 10px; font-size: 0.95rem; }
.chat-log { display: grid; gap: 10px; margin-bottom: 10px; max-height: 480px; overflow-y: auto; }
.chat-log:empty { display: none; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.92rem; min-width: 0; overflow-wrap: anywhere; }
.msg.user { justify-self: start; background: color-mix(in srgb, var(--accent) 16%, transparent); border-start-start-radius: 4px; }
.msg.assistant { justify-self: end; background: var(--panel-2); border-start-end-radius: 4px; color: var(--text-2); }
.msg p { margin: 0 0 6px; }
.msg p:last-child { margin: 0; }
.msg ul, .msg ol { margin: 4px 0; padding-inline-start: 20px; }
.msg.error { color: var(--alert); }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.suggestions button {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 0.82rem; cursor: pointer;
}
.suggestions button:hover { color: var(--text); border-color: var(--accent); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea {
  flex: 1; min-width: 0; resize: vertical; min-height: 46px; max-height: 200px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit;
}
.chat-buttons { display: grid; gap: 6px; }

.coach .chat-log { max-height: none; min-height: 120px; padding: 4px 0; }
.coach .chat-log:empty { display: grid; }
.coach .chat-log:empty::before {
  content: 'השיחה תופיע כאן. אפשר להתחיל משאלה מוכנה או לכתוב שאלה משלך.';
  color: var(--muted); font-size: 0.9rem; align-self: center; text-align: center;
}
.suggest-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.suggest-groups > div { display: grid; gap: 6px; align-content: start; }
.suggest-groups span { font-size: 0.75rem; font-weight: 700; letter-spacing: .02em; color: var(--accent); }
.suggest-groups button {
  text-align: right; border: 1px solid var(--border); background: var(--panel-2); color: var(--text-2);
  border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.suggest-groups button:hover { border-color: var(--accent); color: var(--text); }
.suggest-groups.small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.suggest-groups.small span { display: none; }
.suggest-groups.small > div button:nth-of-type(2) { display: none; }

dialog fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 4px 14px; margin: 14px 0 0; }
dialog legend { color: var(--text); font-weight: 700; padding: 0 6px; }
dialog select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; }
dialog label { margin: 10px 0; }
button:focus-visible, input:focus-visible, .btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ai-status.busy::before { animation: none; } }

@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  /* the header's buttons wrap at this width, so the tab strip becomes the sticky element */
  .topbar { position: static; }
  .sidenav {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
    display: flex; overflow-x: auto; scrollbar-width: none; padding: 6px;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav a { white-space: nowrap; padding: 7px 12px; }
  .sidenav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidenav .nav-coach { margin-top: 0; }
}
@media (max-width: 900px) {
  .ai-cols { grid-template-columns: minmax(0, 1fr); }
  .grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  main, .topbar {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  main { padding-block: 16px; }
  .topbar { padding-block: 12px; }
  .insights { grid-template-columns: minmax(0, 1fr); }
  #search { min-width: 0; width: 100%; }
}
.ai-link { margin: 0 0 12px; text-decoration: none; }

/* ---------- phone: one-row header, two cards per row, tighter type and charts ---------- */
@media (max-width: 600px) {
  body { font-size: 14px; }

  .topbar { flex-wrap: nowrap; gap: 8px; padding-block: 8px; }
  .brand { gap: 8px; min-width: 0; }
  .logo { width: 34px; height: 34px; border-radius: 9px; flex: none; }
  .brand h1 { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand .sub { display: none; }
  .beta-badge { display: none; } /* no room beside the title; the example-data banner already marks the beta */
  .actions { gap: 5px; flex-wrap: nowrap; margin-inline-start: auto; flex: none; }
  .actions .btn { padding: 6px 10px; font-size: 0.82rem; border-radius: 9px; }
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  .icon-btn { min-width: 34px; justify-content: center; padding-inline: 8px; }
  .icon-btn .lbl { display: none; }
  .icon-btn.armed .lbl { display: inline; }

  main { padding-block: 10px; }
  .layout { gap: 8px; }
  .sidenav {
    padding: 4px; border-radius: 12px;
    /* fade the far edge so it reads as a strip that scrolls */
    -webkit-mask-image: linear-gradient(to left, transparent 0, #000 28px);
    mask-image: linear-gradient(to left, transparent 0, #000 28px);
  }
  .sidenav a { padding: 6px 10px; font-size: 0.84rem; gap: 6px; }
  .sidenav .ico { width: auto; font-size: 0.8rem; }

  .toolbar { gap: 6px; margin-bottom: 10px; }
  .chips { padding: 3px; border-radius: 10px; }
  .chips button { padding: 4px 9px; font-size: 0.78rem; }
  .meta { font-size: 0.7rem; }
  .demo-banner { font-size: 0.78rem; padding: 8px 10px; margin-bottom: 10px; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 9px 11px; border-radius: 12px; }
  .kpi .label { font-size: 0.72rem; }
  .kpi .value { font-size: 1.18rem; letter-spacing: -0.3px; }
  .kpi .value small { font-size: 0.68rem; }
  .kpi .sub { font-size: 0.66rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .card { padding: 12px; margin-bottom: 10px; border-radius: 12px; }
  .grid, .grid > .card { margin-bottom: 0; }
  .grid { gap: 10px; margin-bottom: 10px; }
  .stack { gap: 10px; }
  .card h3 { font-size: 0.94rem; }
  .card-head { margin-bottom: 6px; gap: 8px; }
  .hint { font-size: 0.74rem; margin-bottom: 6px; }
  .chart-box { height: 210px; }
  .chart-box.tall { height: 230px; }
  .chart-box.short { height: 190px; }
  .section-title { font-size: 1rem; margin-bottom: 8px; }

  .insights { gap: 8px; margin-bottom: 14px; }
  .insight { padding: 10px 12px; border-radius: 12px; }
  .insight .head { gap: 6px; margin-bottom: 4px; }
  .insight .head h3 { font-size: 0.88rem; }
  .insight .badge { font-size: 0.64rem; }
  .insight p { font-size: 0.8rem; line-height: 1.5; }
  .insight .tip { font-size: 0.78rem; padding: 7px 9px; margin-top: 6px; }

  .plan-list { gap: 6px; }
  .plan-list li { grid-template-columns: 50px 1fr; gap: 8px; padding: 8px 10px; }
  .plan-list .day { font-size: 0.72rem; }
  .plan-list .detail, .plan-summary { font-size: 0.78rem; }
  .pred-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .pred { padding: 8px 4px; }
  .pred .time { font-size: 1.02rem; }
  .pred .name, .pred .pace { font-size: 0.68rem; }
  .goal-race { font-size: 1.08rem; }
  .goal-rows div { font-size: 0.78rem; padding: 6px 8px; }
  .goal-verdict, .goal-empty { font-size: 0.8rem; }
  .records { gap: 6px; }
  .records li { padding: 7px 9px; }
  .records .r-label { font-size: 0.78rem; }
  .note { font-size: 0.7rem; }

  .pill { font-size: 0.62rem; padding: 0 6px; }
  .zones-table div { font-size: 0.78rem; padding: 6px 8px; }

  table { font-size: 0.76rem; }
  th, td { padding: 7px 8px; }

  .ai-headline { font-size: 0.98rem; }
  .ai-list li { font-size: 0.8rem; padding: 8px 10px; }
  .suggest-groups { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .suggest-groups button { font-size: 0.8rem; padding: 6px 9px; }
  .msg { max-width: 92%; font-size: 0.84rem; }
}

/* ---------- install-as-app banner ---------- */
.install-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 0.86rem;
}
.install-banner > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.install-banner span { color: var(--muted); }
.install-banner .btn { flex: none; }
.install-banner .close {
  flex: none; background: none; border: 0; color: var(--muted); font-size: 1rem;
  padding: 4px 6px; cursor: pointer; border-radius: 8px;
}
.install-banner .close:hover { color: var(--text); background: var(--panel-2); }

/* ---------- phone: app-style bottom tab bar ---------- */
.tabbar, .more-sheet { display: none; }

@media (max-width: 600px) {
  .layout .sidenav { display: none; }
  body:has(#dashboard:not([hidden])) { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; inset: auto 0 0; z-index: 15;
    padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background: var(--bar-bg); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .tabbar a, .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 6px 2px 4px; min-height: 52px; justify-content: center;
    background: none; border: 0; color: var(--muted); font: inherit; font-size: 0.68rem;
    text-decoration: none; cursor: pointer; border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar .ico { font-size: 1.15rem; line-height: 1.2; }
  .tabbar .active { color: var(--accent); }
  .tabbar .active .ico { transform: translateY(-1px); }
  .tabbar .dot {
    position: absolute; top: 6px; inset-inline-start: calc(50% + 8px);
    width: 7px; height: 7px; border-radius: 50%; background: var(--warn);
  }

  .more-sheet:not([hidden]) {
    display: block; position: fixed; inset: 0; z-index: 14;
    background: rgba(0, 0, 0, 0.45);
  }
  .more-sheet .sheet {
    position: absolute; inset: auto 8px calc(68px + env(safe-area-inset-bottom, 0px));
    background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
    padding: 6px; display: grid; gap: 2px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
  .more-sheet a, .more-sheet button {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    background: none; border: 0; border-radius: 10px; color: var(--text);
    font: inherit; font-size: 0.95rem; text-decoration: none; text-align: start; cursor: pointer;
  }
  .more-sheet a.active { background: var(--panel-2); color: var(--accent); }
  .more-sheet .ico { width: 20px; text-align: center; color: var(--accent); }

  #toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .install-banner { font-size: 0.78rem; padding: 8px 10px; margin-bottom: 10px; }
}

/* installed app: no browser bar above, so the header sits under the status bar */
@media (display-mode: standalone) {
  .install-banner { display: none !important; }
}


/* ================= Track design layer =================
   Fewer boxes, thin rules, big condensed numbers, one accent. */
.brand h1 { font-weight: 800; letter-spacing: -0.2px; }
.topbar { border-bottom: 1px solid var(--rule); }
.btn { border-radius: 6px; background: var(--panel); }
.btn:hover { border-color: var(--text); }
.btn.ghost { background: transparent; }

.kpi .value, .pred .time, .records .r-value, .goal-race, .goal-rows b, .zones-table b, .num {
  font-family: var(--num); font-variant-numeric: tabular-nums;
}
.kpi .value { font-weight: 700; letter-spacing: 0; }
.kpi .value small { font-family: 'Heebo', sans-serif; }
td.num { font-size: 1.05em; }

/* KPI row: one ruled strip instead of a grid of boxes */
.kpis { gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--border); }
.kpi { background: none; border: 0; border-radius: 0; border-inline-start: 1px solid var(--border); padding: 12px 16px 14px; }
.kpi .value { font-size: 2.1rem; line-height: 1.1; }

/* cards: flat paper sheets with a heavy top rule */
.card { background: var(--panel); border: 1px solid var(--border); border-top: 2px solid var(--rule); border-radius: 0 0 var(--radius) var(--radius); }
.ai-card { border-top: 3px solid var(--accent); }
.card h3 { font-weight: 800; }
.insight { background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0; border-inline-start-width: 3px; }
.insight .badge, .pill, .prio { border-radius: 4px; }
.insight .tip { background: var(--panel-2); }
.insight .tip::before, .ai-list .action::before { color: var(--accent-ink); }
.plan-list li, .records li, .goal-rows div, .zones-table div, .ai-list li { background: none; border-radius: 0; border-bottom: 1px solid var(--border); padding-inline: 0; }
.pred { background: none; border-radius: 0; border-inline-start: 1px solid var(--border); }
.pred:first-child { border-inline-start: 0; }
.pred .time { font-size: 1.8rem; font-weight: 700; }
.dropzone { border-color: var(--muted); background: var(--panel); border-radius: var(--radius); }
.howto { border-radius: var(--radius); }

/* navigation */
.sidenav { background: none; border: 0; border-top: 2px solid var(--rule); border-radius: 0; padding: 6px 0; }
.sidenav a { border-radius: 4px; color: var(--muted); }
.sidenav a:hover { background: var(--panel-2); }
.sidenav a.active { background: none; color: var(--text); font-weight: 700; box-shadow: inset -3px 0 0 var(--accent); }
.sidenav .ico { color: var(--muted); }
.sidenav a.active .ico { color: var(--accent); }
.sidenav .nav-coach { border: 1px solid var(--border); }
.chips { background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0; gap: 2px; }
.chips button { border-radius: 0; padding: 6px 12px; }
.chips button.active { background: none; box-shadow: inset 0 -2px 0 var(--accent); color: var(--text); font-weight: 700; }
.msg.user { background: var(--text); color: var(--bg); }
.msg.assistant { background: var(--panel); border: 1px solid var(--border); }
.demo-banner { background: var(--panel); border: 1px solid var(--border); border-inline-start: 3px solid var(--warn); border-radius: 0 var(--radius) var(--radius) 0; }
.install-banner { border-color: var(--border); border-inline-start: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; }
dialog { background: var(--bg); border-top: 3px solid var(--accent); }
dialog input, dialog select, #search, .chat-form textarea { background: var(--panel); }
#toast { background: var(--text); color: var(--bg); border-color: var(--text); }
#toast.error { background: var(--alert); border-color: var(--alert); }

/* ---------- overview hero: this week ---------- */
.week-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: end;
  padding: 4px 0 22px;
}
.week-hero .eyebrow { color: var(--muted); font-size: 0.88rem; margin: 0; }
.week-hero .big { font-family: var(--num); font-weight: 700; font-size: 5.6rem; line-height: 0.88; letter-spacing: -1px; margin: 6px 0 12px; }
.week-hero .big .u { font-size: 1.7rem; color: var(--accent); margin-inline-start: 8px; letter-spacing: 0; font-family: 'Heebo', sans-serif; font-weight: 700; }
.week-hero .bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.week-hero .bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.week-hero .bar-text { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.84rem; margin-top: 6px; }
.week-hero .bar-text b { color: var(--text); font-weight: 700; }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; }
.week-days .d { display: grid; gap: 6px; justify-items: center; }
.week-days .km { font-family: var(--num); font-size: 1rem; font-weight: 600; min-height: 1.25em; }
.week-days .col { width: 100%; height: 96px; display: flex; align-items: flex-end; border-bottom: 2px solid var(--rule); }
.week-days .col i { display: block; width: 100%; background: var(--text); border-radius: 3px 3px 0 0; }
.week-days .d.today .col i { background: var(--accent); }
.week-days .d.future .col { border-bottom: 2px dashed var(--border); }
.week-days .lbl { color: var(--muted); font-size: 0.8rem; }
.week-days .d.today .lbl { color: var(--accent-ink); font-weight: 700; }

@media (max-width: 600px) {
  .week-hero { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-bottom: 14px; }
  .week-hero .big { font-size: 3.8rem; margin-bottom: 8px; }
  .week-hero .big .u { font-size: 1.15rem; }
  .week-days { gap: 5px; }
  .week-days .col { height: 54px; }
  .week-days .km { font-size: 0.82rem; }
  .week-days .lbl { font-size: 0.7rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .kpi { padding: 8px 10px 9px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .kpi:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .kpi .value { font-size: 1.65rem; }
  .card { border-radius: 0 0 6px 6px; }
  .pred .time { font-size: 1.3rem; }
}
@media (min-width: 601px) {
  .kpi:first-child { border-inline-start: 0; padding-inline-start: 0; }
}


/* ---------- line icons ---------- */
svg.ico { width: 18px; height: 18px; flex: none; }
.sidenav svg.ico { width: 18px; height: 18px; }
.tabbar svg.ico { width: 22px; height: 22px; margin-bottom: 1px; }
.more-sheet svg.ico { width: 20px; height: 20px; color: var(--accent); }
.icon-btn svg.ico { width: 17px; height: 17px; }
.install-banner .close svg.ico { width: 16px; height: 16px; display: block; }
.drop-icon svg { width: 44px; height: 44px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-icon use { stroke: inherit; }
.tabbar .active svg.ico { stroke-width: 2.2; }

/* ---------- insights: a numbered coach's notebook ---------- */
.insights { grid-template-columns: minmax(0, 1fr); gap: 0; max-width: 860px; border-top: 2px solid var(--rule); }
.insight {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 14px;
  background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 16px 0;
}
.insight .n { font-size: 1.7rem; font-weight: 700; line-height: 1; color: var(--muted); padding-top: 2px; }
.insight.alert .n { color: var(--alert); }
.insight.warn .n { color: var(--warn); }
.insight.good .n { color: var(--good); }
.insight .head { display: block; margin-bottom: 4px; }
.insight .head h3 { font-size: 1.02rem; font-weight: 800; }
.insight .badge { display: block; background: none !important; padding: 0; margin-bottom: 2px; font-size: 0.74rem; letter-spacing: .02em; }
.insight p { color: var(--text-2); max-width: 70ch; }
.insight .tip { background: none; padding: 0; margin-top: 8px; color: var(--text); }
.insight .tip::before { content: 'מה לעשות  '; color: var(--accent-ink); font-weight: 800; }
.insights.compact { border-top: 0; }
.insights.compact .insight { padding: 12px 0; grid-template-columns: 34px minmax(0, 1fr); }
.insights.compact .insight:last-child { border-bottom: 0; }
.insights.compact .n { font-size: 1.35rem; }

/* ---------- training types: stacked bar + list ---------- */
.kinds-bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; gap: 2px; margin: 8px 0 12px; }
.kinds-bar span { min-width: 3px; }
.kinds-list { list-style: none; margin: 0; padding: 0; }
.kinds-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kinds-list li:last-child { border-bottom: 0; }
.kinds-list i { width: 10px; height: 10px; border-radius: 2px; }
.kinds-list b { font-size: 1.25rem; font-weight: 700; }
.kinds-list small { grid-column: 2 / -1; color: var(--muted); font-size: 0.78rem; margin-top: -4px; }

/* ---------- small polish ---------- */
.week-days .col i.rest { width: 6px; height: 6px; border-radius: 50%; background: var(--border); margin: 0 auto 6px; }
.demo-short { display: none; }
@media (max-width: 600px) {
  .demo-long { display: none; }
  .demo-short { display: inline; }
  .insight { grid-template-columns: 30px minmax(0, 1fr); gap: 2px 10px; padding: 12px 0; }
  .insight .n { font-size: 1.25rem; }
  .insight .head h3 { font-size: 0.92rem; }
}

/* ---------- data sources ---------- */
.dropzone { text-align: right; }
.dropzone h2, .dropzone > p { text-align: center; }
.sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; border-top: 2px solid var(--rule); margin: 8px 0 4px; }
.src { padding: 12px 0 14px; border-bottom: 1px solid var(--border); min-width: 0; }
.src h4 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; }
.src h4 small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.src p { margin: 0 0 8px; color: var(--text-2); font-size: 0.86rem; }
.src .or { color: var(--muted); font-size: 0.78rem; margin: 10px 0 2px; }
.src-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.src .btn { cursor: pointer; font-size: 0.86rem; padding: 6px 14px; text-decoration: none; }
.btn.strava { background: #fc4c02; color: #fff; border-color: transparent; font-weight: 700; }
.btn.strava:hover { background: #e34402; }
.powered { color: var(--muted); font-size: 0.72rem !important; margin: 8px 0 0 !important; }
.drop-hint { color: var(--muted); font-size: 0.82rem; margin: 10px 0 4px; }
.sources-dialog { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-head .close { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.dialog-head .close:hover { color: var(--text); background: var(--panel-2); }
.sources-dialog > .muted { font-size: 0.84rem; margin: 4px 0 10px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- calendar ---------- */
.cal { margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--rule); }
.cal h4 { margin: 0 0 8px; font-size: 0.95rem; font-weight: 800; }
.cal-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-row label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.86rem; }
.cal-row input { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: inherit; }
.cal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-list .gcal {
  display: flex; width: fit-content; align-items: center; gap: 6px; margin-top: 8px;
  padding: 4px 10px 4px 12px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; color: var(--text-2); text-decoration: none; background: var(--panel);
  transition: border-color .15s, color .15s, background .15s;
}
.plan-list .gcal .ico { width: 15px; height: 15px; color: var(--accent); }
.plan-list .gcal:hover, .plan-list .gcal:focus-visible { border-color: var(--accent); color: var(--text); background: var(--bg); }

@media (max-width: 600px) {
  .sources { grid-template-columns: minmax(0, 1fr); }
  .dropzone { padding: 22px 16px; }
  .sources-dialog { padding: 16px; }
}


/* ---------- settings tab ---------- */
.settings { max-width: 780px; }
.set-group { border-top: 2px solid var(--rule); padding-top: 12px; margin-bottom: 22px; }
.set-group h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 2px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row > div:first-child { min-width: 0; }
.set-row b { display: block; font-weight: 700; }
.set-row small { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.45; margin-top: 2px; }
.set-row input, .set-row select {
  flex: none; width: 190px; max-width: 100%;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font: inherit;
}
.set-row input:focus, .set-row select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.set-actions { display: flex; gap: 8px; flex: none; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg label { position: relative; padding: 7px 14px; cursor: pointer; font-size: 0.88rem; color: var(--muted); white-space: nowrap; }
.seg label + label { border-inline-start: 1px solid var(--border); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--text); color: var(--bg); font-weight: 700; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.btn.danger { color: var(--alert); border-color: var(--alert); background: transparent; }
.btn.danger.armed { background: var(--alert); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.about p { color: var(--text-2); font-size: 0.88rem; margin: 6px 0; max-width: 70ch; }
.sidenav .nav-settings { margin-top: 6px; }

@media (max-width: 600px) {
  .set-row { flex-wrap: wrap; gap: 8px 12px; padding: 10px 0; }
  .set-row > div:first-child { flex: 1 1 100%; }
  .set-row input, .set-row select { width: 100%; }
  .set-actions, .seg { flex: 1 1 auto; }
  .seg label { flex: 1; text-align: center; padding: 8px 6px; }
  .set-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- weekly review ---------- */
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.review-head > div { text-align: center; min-width: 0; }
.review-head h2 { font-size: 1.3rem; font-weight: 800; }
.review-head p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.review-head .btn { flex: none; font-size: 0.85rem; }
.review-score { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--rule); border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.review-score .score { display: grid; gap: 2px; align-content: center; padding: 14px 16px; border-inline-start: 1px solid var(--border); }
.review-score .score:first-child { border-inline-start: 0; padding-inline-start: 0; }
.review-score .big { font-family: var(--num); font-weight: 700; font-size: 2.6rem; line-height: 1; direction: ltr; text-align: right; }
.review-score .big small { font-size: 1rem; color: var(--muted); font-weight: 600; margin-inline-start: 3px; }
.review-score .lbl { color: var(--muted); font-size: 0.82rem; }
.review-score .verdict { font-size: 1.5rem; font-weight: 800; color: var(--accent-ink); line-height: 1.15; }
.pva { list-style: none; margin: 6px 0 0; padding: 0; }
.pva-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pva-item:last-child { border-bottom: 0; }
.pva-item b { display: block; font-weight: 700; }
.pva-run { color: var(--muted); font-size: 0.84rem; }
.pva-status { font-size: 0.74rem; font-weight: 800; text-align: center; padding: 3px 0; border-radius: 4px; border: 1px solid currentColor; }
.pva-item.done .pva-status { color: var(--good); }
.pva-item.partial .pva-status { color: var(--warn); }
.pva-item.missed .pva-status { color: var(--alert); }
.pva-item.pending .pva-status { color: var(--muted); border-style: dashed; }
.pva-item.extra .pva-status { color: var(--info); }
.pva-item.missed b, .pva-item.pending b { color: var(--text-2); }
.review-notes { list-style: none; margin: 6px 0 12px; padding: 0; }
.review-notes li { position: relative; padding: 8px 18px 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; color: var(--text-2); }
.review-notes li:last-child { border-bottom: 0; }
.review-notes li::before { content: ''; position: absolute; right: 0; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--info); }
.review-notes li.good::before { background: var(--good); }
.review-notes li.warn::before { background: var(--warn); }
.review-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hero-link { display: inline-block; margin-top: 10px; font-weight: 700; }

@media (max-width: 600px) {
  .review-head h2 { font-size: 1.05rem; }
  .review-head .btn { padding: 6px 9px; font-size: 0.78rem; }
  .review-score { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-score .score { padding: 10px 10px; }
  .review-score .score:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; }
  .review-score .verdict-box { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-inline-start: 0; }
  .review-score .big { font-size: 2rem; }
  .review-score .verdict { font-size: 1.2rem; }
  .pva-item { grid-template-columns: 54px minmax(0, 1fr); gap: 10px; }
  .pva-run, .review-notes li { font-size: 0.8rem; }
}

/* ---------- phone uploads ---------- */
.phone-tip { grid-column: 1 / -1; margin: 10px 0 0; padding: 8px 12px; background: var(--panel-2); border-radius: 6px; font-size: 0.84rem; color: var(--text-2); }
.stale-banner { border-inline-start-color: var(--warn); }
@media (max-width: 600px) {
  .stale-banner { flex-wrap: wrap; }
  .stale-banner > div { flex: 1 1 calc(100% - 40px); }
  .stale-banner .btn { order: 3; }
}



/* ---------- phone readability: nothing that carries information below ~11.5px ---------- */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .meta { font-size: 0.78rem; }
  .chips button { font-size: 0.84rem; padding: 6px 11px; min-height: 34px; }
  .kpi .label { font-size: 0.78rem; }
  .kpi .sub { font-size: 0.74rem; }
  .kpi .value small { font-size: 0.74rem; }
  .hint, .note { font-size: 0.8rem; }
  .card h3 { font-size: 1rem; }
  .week-hero .eyebrow, .week-hero .bar-text { font-size: 0.82rem; }
  .week-days .lbl { font-size: 0.78rem; }
  .week-days .km { font-size: 0.88rem; }
  .insight p, .insight .tip { font-size: 0.88rem; line-height: 1.55; }
  .insight .head h3 { font-size: 0.98rem; }
  .insight .badge { font-size: 0.74rem; }
  .plan-list .detail, .plan-summary { font-size: 0.86rem; }
  .plan-list .day { font-size: 0.78rem; }
  .pva-run, .review-notes li { font-size: 0.86rem; }
  .review-score .lbl { font-size: 0.8rem; }
  .pred .name, .pred .pace { font-size: 0.74rem; }
  .goal-rows div, .records .r-label { font-size: 0.84rem; }
  .records .r-date { font-size: 0.76rem; }
  .pill { font-size: 0.7rem; padding: 1px 7px; }
  .zones-table div { font-size: 0.84rem; }
  .zones-table small { font-size: 0.76rem; }
  table { font-size: 0.82rem; }
  .src p, .set-row small { font-size: 0.84rem; }
  .tabbar a, .tabbar button { font-size: 0.74rem; }
  .demo-banner, .install-banner { font-size: 0.84rem; }
  .msg { font-size: 0.92rem; }
}

/* ---------- logo: a 400 m track with the runner on the bend ---------- */
.logo { width: 44px; height: 44px; padding: 0; background: none; color: var(--text); }

/* ---------- one run in detail ---------- */
tbody tr[data-run] { cursor: pointer; }
tbody tr[data-run]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.run-link { background: none; border: 0; padding: 0; font: inherit; color: var(--text); font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.run-link:hover { text-decoration-color: var(--accent); }
.run-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; padding: 0 22px 22px; }
.rd-bar { position: sticky; top: 0; background: var(--bg); padding: 12px 0 8px; z-index: 1; }
.rd-bar-title { color: var(--muted); font-size: 0.85rem; }
.rd-head h3 { font-size: 1.4rem; font-weight: 800; margin: 2px 0 6px; }
.rd-when { margin: 0; color: var(--muted); font-size: 0.86rem; }
.rd-tags { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.rd-tags .tag { margin: 0; }
.rd-tag { font-size: 0.72rem; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }
.rd-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--rule); border-bottom: 1px solid var(--border); margin: 14px 0 6px; }
.rd-hero > div { display: grid; padding: 10px 14px; border-inline-start: 1px solid var(--border); }
.rd-hero > div:first-child { border-inline-start: 0; padding-inline-start: 0; }
.rd-hero .big { font-family: var(--num); font-weight: 700; font-size: 2.3rem; line-height: 1.05; text-align: right; }
.rd-hero span:last-child { color: var(--muted); font-size: 0.8rem; }
.rd-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 18px; margin-bottom: 8px; }
.rd-stat { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rd-stat span { color: var(--muted); font-size: 0.85rem; }
.rd-stat b { font-family: var(--num); font-size: 1.15rem; font-weight: 700; }
.rd-stat small { font-family: 'Heebo', sans-serif; font-size: 0.72rem; font-weight: 400; color: var(--muted); }
.rd-section { margin-top: 16px; border-top: 2px solid var(--rule); padding-top: 10px; }
.rd-section h4 { margin: 0 0 6px; font-size: 1rem; font-weight: 800; }
.rd-compare-intro { color: var(--text-2); font-size: 0.88rem; margin: 0 0 6px; }
.rd-compare { list-style: none; margin: 0 0 10px; padding: 0; }
.rd-compare li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.rd-compare span { color: var(--muted); }
.rd-compare em { font-style: normal; font-weight: 700; font-size: 0.84rem; color: var(--muted); }
.rd-compare em.good { color: var(--good); }
.rd-compare em.warn { color: var(--warn); }
@media (max-width: 600px) {
  .run-dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; padding: 0 16px 20px; }
  .rd-head h3 { font-size: 1.2rem; }
  .rd-hero .big { font-size: 1.7rem; }
  .rd-hero > div { padding: 8px 8px; }
  .rd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
  .rd-stat { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 0; }
  .rd-compare li { grid-template-columns: 44px minmax(0, 1fr); }
  .rd-compare em { grid-column: 2; }
}

/* ---------- fitness, fatigue and form ---------- */
.fit-now { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 8px 0; }
.fit-now > div { display: grid; padding: 8px 12px; border-inline-start: 1px solid var(--border); }
.fit-now > div:first-child { border-inline-start: 0; padding-inline-start: 0; }
.fit-now span { color: var(--muted); font-size: 0.82rem; }
.fit-now b { font-family: var(--num); font-size: 2rem; font-weight: 700; line-height: 1.1; text-align: right; }
.fit-now small { color: var(--muted); font-size: 0.78rem; }
.fit-now .good { color: var(--good); }
.fit-now .warn { color: var(--warn); }
.fit-text { margin: 4px 0 10px; color: var(--text-2); font-size: 0.9rem; }
@media (max-width: 600px) {
  .fit-now > div { padding: 6px 8px; }
  .fit-now b { font-size: 1.6rem; }
}

/* ---------- today card ---------- */
.today-card { margin-bottom: 14px; border-top: 3px solid var(--accent); }
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.today-head .eyebrow { color: var(--muted); font-size: 0.88rem; margin: 0; }
.today-title { margin: 6px 0 4px; font-size: 1.35rem; font-weight: 800; }
.today-detail { margin: 0 0 6px; color: var(--muted); }
.today-notes { margin-bottom: 0; }
@media (max-width: 600px) {
  .today-title { font-size: 1.15rem; }
}

/* ---------- Pro plans ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pro-dialog { width: min(820px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0 18px; }
.plan-tier { border: 1px solid var(--border); border-top: 3px solid var(--text); padding: 12px 14px; background: var(--panel); }
.plan-tier.featured { border-top-color: var(--accent); }
.plan-tier h4 { margin: 0; font-size: 1rem; }
.plan-tier .price { margin: 2px 0 8px; color: var(--muted); }
.plan-tier .price b { font-family: var(--num); font-size: 2rem; color: var(--text); }
.plan-tier ul { margin: 0; padding-inline-start: 18px; font-size: 0.88rem; }
.plan-tier li { margin: 3px 0; }
.tier-note { margin: 8px 0 0; font-size: 0.8rem; color: var(--good); font-weight: 700; }
.waitlist { border-top: 2px solid var(--text); padding-top: 12px; }
.waitlist p { margin: 0 0 8px; }
.wl-row { display: flex; gap: 8px; flex-wrap: wrap; }
.wl-row input { flex: 1 1 200px; min-width: 0; }
dialog label.wl-consent { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; font-size: 0.82rem; }
.wl-consent input { margin-top: 3px; }
.wl-msg { min-height: 1.4em; font-weight: 700; margin-top: 8px !important; }
.about-links { line-height: 2; }
@media (max-width: 700px) {
  .plans { grid-template-columns: minmax(0, 1fr); }
  .pro-dialog { padding: 16px; }
}

/* ---------- plain-language analytics ---------- */
.takeaway { font-weight: 700; font-size: 1rem; margin: 2px 0 8px; padding-inline-start: 10px; border-inline-start: 3px solid var(--accent); }
.takeaway.good { border-inline-start-color: var(--good); }
.takeaway.warn { border-inline-start-color: var(--warn); }
.takeaway:empty { display: none; }
.effort-bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; gap: 2px; margin: 10px 0; }
.effort-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.effort-legend li { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; }
.effort-legend i { width: 10px; height: 10px; border-radius: 2px; }
.effort-legend .num { grid-column: 2; font-family: var(--num); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.effort-legend small { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; }
.easy-cap { margin: 12px 0 0; padding: 8px 12px; background: var(--panel-2); border-radius: 8px; }

/* ---------- my running year ---------- */
.year-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.year-card .card-head { margin-bottom: 4px; }
.year-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
#yearPreview { width: 200px; aspect-ratio: 9 / 16; height: auto; border-radius: 14px; border: 1px solid var(--border); cursor: pointer; background: #0a0c10; }
@media (max-width: 600px) {
  .year-card { grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; }
  #yearPreview { width: 120px; border-radius: 10px; }
}

/* ---------- MyRunningPace brand ---------- */
.brand .logo { width: 46px; height: 36px; flex: none; }
.brand h1 .pace { color: var(--accent); }
.brand h1 { letter-spacing: -0.01em; }
