/* Polaris UI */
:root, [data-theme="dark"] {
  --bg: #0a0f1e;
  --bg-2: #0e1528;
  --surface: #121a30;
  --surface-2: #19233d;
  --border: #243150;
  --text: #e6ebf5;
  --text-dim: #93a0bb;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --accent-ink: #04121c;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ecg: #34d399;
  --chart-grid: rgba(148, 163, 184, .13);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-2: #eef2f8;
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --border: #dbe2ee;
  --text: #111a2e;
  --text-dim: #5b6782;
  --accent: #0284c7;
  --accent-2: #7c3aed;
  --accent-ink: #ffffff;
  --ecg: #059669;
  --chart-grid: rgba(71, 85, 105, .14);
  --shadow: 0 10px 30px rgba(15, 23, 42, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 650; }
p { margin: .4rem 0; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
.muted { color: var(--text-dim); }
.small { font-size: .85rem; }
.center { text-align: center; justify-content: center; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; }
.row.gap { gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; align-items: flex-end; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.icon { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.warn-text { color: var(--warn); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.2rem .9rem; background: var(--bg-2); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.2rem; letter-spacing: .01em; padding: .2rem .5rem; }
.brand-mark { color: var(--accent); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 50%, transparent)); }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.nav-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px; color: var(--text-dim); font-weight: 550; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.nav-link.active .icon { color: var(--accent); }
.side-foot { margin-top: auto; padding: 0 .6rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .7rem;
  padding: .7rem 1.5rem; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.mobile-only { display: none; }
.view { padding: 1.5rem; max-width: 1240px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 1.2rem; padding-bottom: 5rem; }
.bottom-nav { display: none; }

.sensor-pill {
  display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: .4rem .85rem; border-radius: 999px; cursor: pointer; font: inherit; font-size: .9rem;
}
.sensor-pill:hover { border-color: var(--accent); }
.sensor-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.sensor-pill.connected .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.sensor-pill.connecting .dot, .sensor-pill.reconnecting .dot { background: var(--warn); animation: pulse 1s infinite; }
.sensor-pill.disconnected { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.sensor-pill .beat { color: var(--danger); animation: beat 1s infinite; }
.pill-hr { font-variant-numeric: tabular-nums; min-width: 2ch; }
.pill-name { color: var(--text-dim); }
.pill-batt { display: inline-flex; align-items: center; gap: .2rem; color: var(--text-dim); }
.rec-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem; border-radius: 999px; background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.rec-pill .dot, .banner .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.rec-pill.paused .dot { background: var(--warn); animation: none; }
.dot.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600; font-size: .92rem;
  padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #1a1200; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: .95rem 1.6rem; font-size: 1.05rem; border-radius: 14px; min-width: 130px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger); }
.icon-btn:disabled { opacity: .3; cursor: default; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: .5rem .65rem; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--accent); padding: 0; }
input[type="range"] { accent-color: var(--accent); padding: 0; border: 0; background: transparent; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > input, .field > select { width: 100%; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.field-hint { font-size: .8rem; color: var(--text-dim); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; }
.check { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; }
.check.disabled { opacity: .7; cursor: default; }
.inline { display: inline-flex; align-items: center; gap: .45rem; color: var(--text-dim); font-size: .9rem; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; min-width: 0; }
.card.inset { background: var(--bg-2); padding: .8rem 1rem; }
.card-label { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: .6rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .4rem; }
.card-head .card-label { margin-bottom: 0; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.section { display: flex; flex-direction: column; gap: .8rem; }
.section-head, .page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.link { display: inline-flex; align-items: center; gap: .25rem; color: var(--accent); font-weight: 600; font-size: .9rem; }
.badge { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); margin-left: .4rem; }
.badge.rec { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--text); border-color: transparent; }
.badge.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--text); border-color: transparent; }
.callout { display: flex; gap: .7rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.callout.warn .icon { color: var(--warn); }
.banner { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-radius: 12px; background: color-mix(in srgb, var(--danger) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); font-weight: 600; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 3rem 1.5rem 2rem; border-radius: 22px; border: 1px solid var(--border);
  background: radial-gradient(ellipse at top, color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%), var(--surface); }
.hero h1 { font-size: 2rem; margin: .8rem 0 .4rem; }
.hero p { max-width: 560px; margin: 0 auto 1.4rem; }
.hero-mark { display: inline-flex; width: 84px; height: 84px; border-radius: 26px; align-items: center; justify-content: center; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 13%, transparent); }
.hero-mark .icon { animation: beat 1.1s infinite; }

/* ---------- live ---------- */
.live-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.hr-card { --zc: var(--text-dim); position: relative; overflow: hidden; }
.hr-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--zc); }
.hr-line { display: flex; align-items: baseline; gap: .5rem; }
.hr-value { font-size: 4.6rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.hr-value.xl { font-size: 5.8rem; }
.hr-unit { font-size: 1.1rem; color: var(--text-dim); font-weight: 600; }
.hr-zone { margin-top: .4rem; font-weight: 650; color: var(--zc); }
.hr-pct { font-size: .88rem; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .38rem 0; border-bottom: 1px dashed var(--border); font-size: .93rem; }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--text-dim); }
.kv b { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; font-size: .9rem; word-break: break-all; }

.chart { position: relative; width: 100%; }
.chart canvas { display: block; width: 100%; height: 100%; }
.chart-tip { display: none; position: absolute; top: -4px; padding: .2rem .5rem; border-radius: 6px; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart.strip { border-radius: 10px; background: var(--bg-2); margin-top: .6rem; }
.zone-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .78rem; color: var(--text-dim); }
.zone-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.zone-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- presets ---------- */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.preset-list { display: flex; flex-direction: column; gap: .6rem; }
.preset-card {
  --pc: var(--accent); display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: border-color .15s, transform .1s;
}
.preset-card:hover { border-color: var(--pc); }
.preset-card:active { transform: scale(.995); }
.preset-icon {
  --pc: var(--accent); flex: none; width: 46px; height: 46px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.45rem;
  background: color-mix(in srgb, var(--pc) 20%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 45%, transparent);
}
.preset-icon.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 1.1rem; }
.preset-text { flex: 1; min-width: 0; }
.preset-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-meta { font-size: .82rem; color: var(--text-dim); }
.preset-go { color: var(--pc); opacity: .8; }
.preset-actions { display: flex; gap: .15rem; flex-wrap: wrap; justify-content: flex-end; }
.preset-preview { display: inline-flex; align-items: center; gap: .7rem; font-size: 1.05rem; }
.picker { display: flex; flex-wrap: wrap; gap: .35rem; }
.pick { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); font-size: 1.2rem; cursor: pointer; }
.pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.phases { display: flex; flex-direction: column; gap: .4rem; }
.phase-row { --zc: var(--border); display: flex; align-items: center; gap: .45rem; padding: .4rem .5rem; border-radius: 10px; background: var(--bg-2); border-left: 4px solid var(--zc); flex-wrap: wrap; }
.phase-row select { max-width: 130px; }
.phase-n { width: 1.6rem; text-align: center; color: var(--text-dim); font-weight: 700; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: .6rem; }

/* ---------- workout ---------- */
.workout-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.workout-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.hr-card.big { display: flex; flex-direction: column; gap: .2rem; }
.timer { font-size: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; margin-bottom: .6rem; }
.is-paused .timer { color: var(--warn); animation: pulse 1.4s infinite; }
.ladder { display: flex; flex-direction: column; gap: 3px; margin-top: .7rem; }
.ladder-step { --zc: var(--text-dim); display: flex; justify-content: space-between; padding: .25rem .6rem; border-radius: 7px; font-size: .82rem; color: var(--text-dim); background: var(--bg-2); border-left: 4px solid var(--zc); }
.ladder-step.on { background: color-mix(in srgb, var(--zc) 30%, transparent); color: var(--text); font-weight: 700; }
.phase-card .phase-name { font-size: 1.25rem; font-weight: 700; }
.phase-card .phase-remain { font-size: 2.4rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin: .5rem 0 .3rem; }
.bar.thin { height: 5px; margin-top: .9rem; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s linear; }
.bar-fill.alt { background: var(--accent-2); }
.controls { position: sticky; bottom: 1rem; z-index: 10; display: flex; justify-content: center; gap: .8rem; padding: .8rem; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); font-weight: 700; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.table td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }

/* ---------- diary ---------- */
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.toolbar input[type="search"] { min-width: 200px; }
.totals { display: flex; gap: 1.2rem; color: var(--text-dim); font-size: .92rem; }
.totals b { color: var(--text); }
.list-head { padding: 0 .3rem; }
.diary-list { display: flex; flex-direction: column; gap: .45rem; }
.month { margin: .9rem 0 .2rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--text-dim); }
.diary-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: .3rem .9rem;
  padding: .75rem 1rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); cursor: pointer;
}
.diary-row:hover { border-color: var(--accent); }
.diary-row .cb { grid-row: 1 / 3; display: flex; padding: .2rem; }
.diary-row .preset-icon { grid-row: 1 / 3; }
.diary-title { font-weight: 650; }
.diary-stats { display: flex; gap: 1rem; font-size: .88rem; font-variant-numeric: tabular-nums; color: var(--text-dim); flex-wrap: wrap; justify-content: flex-end; }
.diary-stats span { display: inline-flex; align-items: center; gap: .3rem; }
.diary-row .zone-strip { grid-column: 3 / 5; }
.zone-strip { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--bg-2); }
.zone-strip span { display: block; height: 100%; }

/* ---------- session ---------- */
.session-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.title-input { font-size: 1.5rem; font-weight: 700; background: transparent; border-color: transparent; padding: .1rem .3rem; margin-left: -.3rem; width: 100%; }
.title-input:hover { border-color: var(--border); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; }
.stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); font-weight: 700; }
.stat-value { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-big .stat-value { font-size: 1.8rem; }
.stat-unit { font-size: .8rem; color: var(--text-dim); font-weight: 600; margin-left: .3rem; }
.zone-bars { display: flex; flex-direction: column; gap: .45rem; }
.zone-row { display: grid; grid-template-columns: 34px 72px 1fr 60px 40px; align-items: center; gap: .6rem; font-size: .88rem; font-variant-numeric: tabular-nums; }
.zone-tag { display: inline-flex; justify-content: center; padding: .1rem 0; border-radius: 6px; color: #08101f; font-weight: 800; font-size: .75rem; }
.zone-range { color: var(--text-dim); font-size: .8rem; }
.zone-track { height: 12px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.zone-fill { height: 100%; border-radius: 99px; }
.zone-pct { color: var(--text-dim); text-align: right; }
.feelings { display: inline-flex; gap: .25rem; }
.feel { font-size: 1.3rem; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); cursor: pointer; filter: grayscale(.8); opacity: .7; }
.feel.on { filter: none; opacity: 1; border-color: var(--accent); }

/* ---------- settings ---------- */
.zone-edit { display: flex; flex-direction: column; gap: .4rem; }
.zone-edit-row { display: flex; align-items: center; gap: .6rem; }
.zone-edit-row input { width: 76px; }

/* ---------- modal / toast / empty ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(3, 6, 14, .6); display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fade .12s; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); animation: rise .15s; }
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem .4rem; }
.modal-body { padding: .4rem 1.2rem 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.2rem 1.1rem; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.connect .steps { padding-left: 1.2rem; color: var(--text-dim); margin: .2rem 0 1rem; }
.connect .steps li { margin: .25rem 0; }
.known { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .9rem; }
.export-list { display: flex; flex-direction: column; gap: .45rem; }
.export-item { display: flex; align-items: center; gap: .8rem; text-align: left; font: inherit; color: var(--text); padding: .75rem .9rem; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); cursor: pointer; }
.export-item:hover { border-color: var(--accent); }
.export-item span { display: flex; flex-direction: column; }
.export-item small { color: var(--text-dim); }
.export-item.busy { opacity: .6; pointer-events: none; }
.export-item.busy::after { content: "Preparing…"; margin-left: auto; color: var(--text-dim); font-size: .85rem; }
#toasts { position: fixed; z-index: 200; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; max-width: calc(100vw - 2rem); }
.toast { display: flex; align-items: center; gap: .6rem; padding: .65rem .75rem .65rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--shadow); animation: rise .15s; font-size: .92rem; }
.toast-ok { border-left: 4px solid var(--ok); }
.toast-warn { border-left: 4px solid var(--warn); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-x { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; display: inline-flex; }
.empty { text-align: center; padding: 2.5rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-icon { color: var(--accent); margin-bottom: .5rem; }
.empty h3 { margin: .2rem 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .live-grid, .workout-grid, .grid.two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-only { display: flex; }
  .topbar { padding: .6rem 1rem; }
  .view { padding: 1rem; padding-bottom: 6.5rem; }
  .bottom-nav { display: flex; position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; justify-content: space-around; padding: .35rem .2rem calc(.35rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg-2) 95%, transparent); border-top: 1px solid var(--border); backdrop-filter: blur(10px); }
  .bnav-link { display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .66rem; color: var(--text-dim); padding: .25rem .1rem; border-radius: 8px; flex: 1 1 0; min-width: 0; white-space: nowrap; }
  .bnav-link.active { color: var(--accent); }
  .controls { bottom: 4.6rem; }
  .hr-value { font-size: 3.6rem; }
  .hr-value.xl { font-size: 4.4rem; }
  .timer { font-size: 2.4rem; }
  .btn-lg { min-width: 0; padding: .8rem 1.1rem; }
  .diary-row { grid-template-columns: auto auto minmax(0, 1fr); }
  .diary-stats { grid-column: 3; justify-content: flex-start; }
  .diary-row .zone-strip { grid-column: 1 / -1; }
  .pill-name { display: none; }
  .zone-row { grid-template-columns: 30px 64px 1fr 52px 36px; }
  .h1, h1 { font-size: 1.35rem; }
}
