:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface-1: #fcfcfb;
  --border: #e3e2de;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #8a8984;
  --accent: #2a78d6;
  --series-1: #2a78d6; /* deep */
  --series-2: #eb6834; /* core */
  --series-3: #1baf7a; /* rem */
  --series-4: #eda100; /* unspecified */
  --good: #1f7a3a;
  --bad: #b3261e;
  --warn-bg: #fdf3dc;
  --warn-border: #ecd9a6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110;
    --surface-1: #1a1a19;
    --border: #2c2c2a;
    --grid: #262624;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --good: #5cc27a;
    --bad: #f07a72;
    --warn-bg: #2d2615;
    --warn-border: #4a3d1c;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font: 13px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
button, input, select { font: inherit; color: inherit; }

.topbar {
  -webkit-app-region: drag;
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px 10px 88px; /* room for traffic lights */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar button, .topbar .range { -webkit-app-region: no-drag; }
.brand { font-weight: 650; font-size: 14px; }
.range { display: inline-flex; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.range button { border: 0; background: none; padding: 3px 10px; border-radius: 6px; cursor: pointer; color: var(--text-secondary); }
.range button.on { background: var(--bg); color: var(--text-primary); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status { color: var(--text-muted); font-size: 12px; margin-right: 4px; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.err { color: var(--bad); }

.btn { border: 1px solid var(--border); background: var(--surface-1); padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.btn:hover { border-color: var(--text-muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.icon { padding: 5px 9px; }
.btn:disabled { opacity: .55; cursor: progress; }

main { padding: 20px; display: flex; flex-direction: column; gap: 16px; max-width: 1400px; margin: 0 auto; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1050px) { .grid.two { grid-template-columns: 1fr; } }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px; position: relative; min-width: 0; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.sub { color: var(--text-muted); font-size: 12px; }
.chart-wrap { position: relative; height: 240px; }
.empty { position: absolute; inset: 48px 16px 16px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--text-secondary); background: var(--surface-1); }
.empty p { margin: 4px 0; max-width: 420px; }
code { font: 12px ui-monospace, SFMono-Regular, monospace; background: var(--bg); padding: 1px 4px; border-radius: 4px; }

.legend { display: flex; gap: 12px; margin-left: auto; color: var(--text-secondary); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1050px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi .label { color: var(--text-secondary); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.kpi .delta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.delta .up { color: var(--good); } .delta .down { color: var(--bad); }

.insight { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.insight .bucket { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.bucket h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.bucket .big { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.bucket .meta { color: var(--text-muted); font-size: 12px; }
.insight-note { margin: 12px 0 0; color: var(--text-secondary); }
.muted { color: var(--text-muted); }

.lifts { display: flex; flex-direction: column; gap: 8px; }
.lift { display: grid; grid-template-columns: minmax(0, 1fr) 70px 80px; gap: 10px; align-items: center; }
.lift .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lift .bar { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.lift .bar i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.lift .val { text-align: right; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }

.tooltip { position: fixed; z-index: 20; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 12px; min-width: 150px; }
.tooltip .t { font-weight: 600; margin-bottom: 4px; }
.tooltip .r { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tooltip .r b { margin-left: auto; color: var(--text-primary); font-weight: 600; padding-left: 12px; }
.tooltip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-1); color: var(--text-primary); padding: 20px; width: 480px; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin: 0 0 14px; font-size: 15px; }
dialog label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--text-secondary); font-size: 12px; }
dialog input, dialog select { padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text-primary); font-size: 13px; }
dialog .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog small { color: var(--text-muted); }
dialog details { margin: 4px 0 8px; } dialog summary { cursor: pointer; color: var(--text-secondary); margin-bottom: 8px; }
.hint { color: var(--text-muted); font-size: 12px; margin: 0 0 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
[hidden] { display: none !important; }

/* ---------- pages & analytics ---------- */
.tabs { -webkit-app-region: no-drag; display: inline-flex; gap: 2px; }
.tabs button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--text-secondary); font-weight: 500; }
.tabs button.on { color: var(--text-primary); background: var(--surface-1); box-shadow: 0 0 0 1px var(--border); }
.page-head { display: flex; align-items: center; justify-content: space-between; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.section-title { margin: 12px 0 -4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.empty-inline { padding: 24px; text-align: center; color: var(--text-secondary); background: var(--surface-1); border: 1px dashed var(--border); border-radius: 12px; }
.grid.two.tight { gap: 20px; }
.chart-wrap.short { height: 170px; }
.mini-title { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }

.lift-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.chip button { border: 0; background: none; cursor: pointer; color: var(--text-muted); font-size: 14px; line-height: 1; padding: 0 4px; border-radius: 999px; }
.chip button:hover { color: var(--text-primary); background: var(--grid); }
.lift-picker select { padding: 3px 6px; border: 1px dashed var(--border); border-radius: 999px; background: none; font-size: 12px; color: var(--text-secondary); max-width: 220px; }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0 4px; }

.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status i { font-style: normal; font-size: 10px; }
.status.up i { color: var(--good); } .status.down i { color: var(--bad); } .status.flat i, .status.idle i { color: var(--text-muted); }
.chg { font-size: 11px; color: var(--text-muted); }
.chg.pos::before, .chg.neg::before { content: ''; }
svg.spark { display: block; }

.multiples { display: flex; flex-direction: column; gap: 10px; }
.multiples:empty { display: none; }
.multiples-legend { display: flex; gap: 16px; color: var(--text-secondary); font-size: 12px; padding-left: 2px; }
.multiples-legend span { display: inline-flex; align-items: center; gap: 6px; }
.multiples-legend .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--series-1); display: inline-block; }
.multiples-legend .dot.faint { opacity: .35; }
.multiples-legend .dot.pr { width: 10px; height: 10px; box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 3px var(--border); }
.multiples-legend .line { width: 16px; height: 2px; border-radius: 1px; background: var(--series-1); display: inline-block; }
.multiples-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1150px) { .multiples-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card.mini { padding: 12px 12px 8px; }
.card.mini .card-head { margin-bottom: 6px; }
.card.mini h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }

.insights { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text-secondary); }
.insights strong { color: var(--text-primary); font-weight: 600; }

.heatmap { display: grid; gap: 3px; align-items: center; }
.hm-day { font-size: 11px; color: var(--text-muted); }
.hm-cell { height: 18px; border-radius: 3px; }
.hm-total { font-size: 11px; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.hm-hour { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.hm-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.hm-legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.metric-switch { margin-left: auto; }
.metric-about { margin: -4px 0 12px; color: var(--text-muted); font-size: 12px; }

/* help tooltips + why rows */
.has-help { display: inline-flex; align-items: center; gap: 4px; cursor: help; border-radius: 4px; }
.has-help:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.help-dot { font-style: normal; font-size: 9px; font-weight: 700; width: 13px; height: 13px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); }
.help-tip { max-width: 320px; white-space: normal; line-height: 1.45; color: var(--text-secondary); }
.help-tip b { color: var(--text-primary); }
.why-toggle { border: 0; background: none; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chev { display: inline-block; color: var(--text-muted); transition: transform .15s; width: 8px; }
.lift-row.open .chev { transform: rotate(90deg); }
.why-link { margin-left: 4px; }
tr.why > td { background: var(--bg); padding: 14px 16px; border-bottom: 1px solid var(--grid); white-space: normal; }
.why-body { display: grid; grid-template-columns: minmax(280px, 1fr) 1.4fr; gap: 24px; }
@media (max-width: 1050px) { .why-body { grid-template-columns: 1fr; } }
.why-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.why-table th, .why-table td { padding: 5px 8px; font-size: 12px; }
.why-table td:first-child { color: var(--text-secondary); }
.why-foot { font-size: 11px; margin: 10px 0 0; }

/* clickable rows + workout dialog */
tr.clickable { cursor: pointer; }
tr.clickable:hover td, tr.clickable:focus-visible td { background: var(--bg); }
tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.open-hint { color: var(--text-muted); margin-left: 2px; opacity: 0; transition: opacity .1s; }
tr.clickable:hover .open-hint, tr.clickable:focus-visible .open-hint { opacity: 1; }

dialog.workout-dialog { width: min(820px, calc(100vw - 48px)); max-height: calc(100vh - 64px); padding: 0; display: flex; flex-direction: column; }
dialog.workout-dialog:not([open]) { display: none; }
.wd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.wd-head h2 { margin: 0 0 2px; font-size: 17px; }
.wd-nav { display: flex; gap: 6px; }
.wd-nav .btn:disabled { opacity: .35; cursor: default; }
#wd-body { overflow-y: auto; padding: 16px 20px 20px; }
.wd-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.wd-stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.wd-stat .label { font-size: 11px; color: var(--text-secondary); }
.wd-stat .value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.wd-stat .sub { font-size: 11px; color: var(--text-muted); }
.wd-notes { margin: 0 0 12px; padding: 8px 10px; background: var(--bg); border-radius: 8px; color: var(--text-secondary); white-space: pre-wrap; }
.wd-ex { padding: 12px 0; border-top: 1px solid var(--grid); }
.wd-ex-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.wd-ex-head h3 { margin: 0; font-size: 14px; }
.wd-sets th, .wd-sets td { padding: 4px 8px; font-size: 12px; }
.wd-sets tr.warm td { color: var(--text-muted); }
.wd-sets tr.top td { font-weight: 600; }
.set-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.set-badge.warmup, .set-badge.dropset, .set-badge.failure { background: none; border-style: dashed; }
.tag { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); vertical-align: 1px; }
.tag.pr { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.wd-vs { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

/* ---------- Today page ---------- */
.today-actions { display: flex; align-items: center; gap: 12px; }
.today-actions .status { max-width: 420px; white-space: normal; text-align: right; font-size: 12px; color: var(--text-secondary); }
.today-actions .status.err { color: var(--bad); }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.suggest-reason { margin: 0 0 12px; color: var(--text-secondary); line-height: 1.5; }
.type-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.chip-btn { border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 3px 12px; cursor: pointer; font-size: 12px; }
.chip-btn:hover { border-color: var(--text-muted); }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.plan-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.plan-title { flex: 1; font-size: 17px; font-weight: 650; border: 1px solid transparent; background: none; border-radius: 6px; padding: 4px 6px; margin-left: -6px; color: var(--text-primary); }
.plan-title:hover, .plan-title:focus { border-color: var(--border); background: var(--bg); outline: none; }
.plan-notes { width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 8px 10px; color: var(--text-primary); font: inherit; font-size: 12px; margin-bottom: 12px; }
.plan-empty { padding: 16px 0; }

.plan-ex { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface-1); }
.plan-ex-head { display: flex; align-items: center; gap: 10px; }
.plan-ex-head h3 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-ex-num { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--grid); color: var(--text-secondary); flex: none; }
.plan-ex-head .rest { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.plan-ex-tools { display: inline-flex; gap: 2px; }
.icon-btn { border: 1px solid transparent; background: none; color: var(--text-muted); width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; }
.icon-btn:hover:not(:disabled) { border-color: var(--border); color: var(--text-primary); background: var(--bg); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.plan-why { margin: 6px 0 8px 32px; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.plan-sets { margin-left: 26px; width: auto; }
.plan-sets td { padding: 3px 8px; border: 0; }
.plan-sets tr.warm td { opacity: .75; }
.plan-ex select, .plan-ex input { border: 1px solid var(--border); background: var(--bg); color: var(--text-primary); border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12px; }
.num-in { width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.num-in.reps { width: 52px; }
.plan-ex-foot { display: flex; align-items: center; gap: 12px; margin: 6px 0 0 32px; }
.plan-ex-notes { flex: 1; }

.add-ex { position: relative; margin-top: 4px; }
.add-ex > input { width: 100%; border: 1px dashed var(--border); background: var(--bg); color: var(--text-primary); border-radius: 10px; padding: 10px 12px; font: inherit; }
.add-ex > input:focus { outline: none; border-style: solid; border-color: var(--accent); }
.add-ex-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); max-height: 360px; overflow: auto; padding: 4px; }
.add-ex-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 8px 10px 4px; }
.add-ex-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--text-primary); }
.add-ex-item:hover, .add-ex-item:focus { background: var(--bg); outline: none; }
.add-ex-item.search-hevy { color: var(--accent); }
.add-ex-note { padding: 8px 10px; font-size: 12px; }
.add-ex-note.err { color: var(--bad); }

/* ---------- polish: icons, brand, sync split button, progress ---------- */
.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.btn { display: inline-flex; align-items: center; gap: 6px; }
.btn.icon { padding: 5px 7px; color: var(--text-secondary); }
.btn.icon:hover { color: var(--text-primary); }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn .ic { width: 15px; height: 15px; }
.brand { display: inline-flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.brand-icon { width: 22px; height: 22px; }
.topbar { position: sticky; }
.actions .status { font-size: 12px; cursor: default; }

.split { position: relative; display: inline-flex; }
.split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-caret { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 5px 6px; border-left: 1px solid color-mix(in srgb, #fff 30%, var(--accent)); }
.split .btn:disabled { opacity: .7; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; padding: 4px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; color: var(--text-primary); }
.menu button:hover, .menu button:focus-visible { background: var(--bg); outline: none; }
.menu .ic { color: var(--text-secondary); }

.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress.indeterminate i { width: 30%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .progress.indeterminate i { animation: none; width: 100%; opacity: .5; } }

.open-hint .ic { width: 14px; height: 14px; vertical-align: -2px; }
.chev { width: 14px !important; display: inline-grid !important; place-items: center; }
.chev .ic { width: 13px; height: 13px; }
.chip button .ic { width: 12px; height: 12px; vertical-align: -1px; }
#page-overview .page-head { margin-bottom: 0; }
.lifts .lift { grid-template-columns: minmax(0, 1fr) 64px 80px 90px; padding: 4px 0; border-bottom: 1px solid var(--grid); }
.lifts .lift:last-child { border-bottom: 0; }
.lifts .lift.head { font-size: 11px; color: var(--text-muted); padding-top: 0; }
.lifts .lift .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link.goto { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; padding: 0; font-size: 12px; }
.link.goto .ic { width: 13px; height: 13px; }
.head-left { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.jump { display: inline-flex; gap: 14px; font-size: 13px; }
.jump a { color: var(--text-secondary); text-decoration: none; }
.jump a:hover { color: var(--accent); }
#sec-strength, #sec-records, #sec-habits { scroll-margin-top: 72px; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* offline banner (desktop: showing the saved copy because the server is unreachable) */
.offline-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 20px; background: var(--warn-bg); border-bottom: 1px solid var(--warn-border); color: var(--text-primary); font-size: 12px; }
.offline-banner[hidden] { display: none; }
.offline-banner .btn { padding: 3px 10px; font-size: 12px; }

/* settings: server connection (desktop) */
dialog fieldset.connection { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 2px; margin: 4px 0 8px; }
dialog fieldset.connection legend { color: var(--text-secondary); font-size: 12px; padding: 0 4px; }
dialog fieldset.connection > small { display: block; margin: -6px 0 8px; font-size: 12px; }
dialog label.check { flex-direction: row; margin-bottom: 10px; }
dialog label.check[hidden] { display: none; }
.form-error { color: var(--bad); font-size: 12px; margin: 0; min-height: 1em; }

/* settings: devices (browser) */
dialog fieldset.connection > small.hint { margin: 0 0 10px; }
dialog fieldset.devices[hidden], dialog .token-reveal[hidden], dialog #device-new[hidden] { display: none; }
.device-list { list-style: none; margin: 0 0 10px; padding: 0; }
.device-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.device-list li:first-child { border-top: 0; }
.device-list .dev-main { flex: 1; min-width: 0; }
.device-list .dev-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-list .dev-meta { font-size: 11.5px; color: var(--text-muted); }
.device-list li.revoked .dev-name { color: var(--text-muted); text-decoration: line-through; }
.device-list .btn { padding: 4px 10px; font-size: 12px; }
.device-note { font-size: 12px; margin: 0 0 10px; }
#device-create { margin-bottom: 10px; }
.token-reveal { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 8px 10px; margin-bottom: 10px; font-size: 12px; }
.token-reveal p { margin: 0 0 6px; }
.token-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.token-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; user-select: all; font-size: 12px; padding: 4px 6px; background: var(--surface-1); }
dialog details#device-new summary { font-size: 12px; }

/* signed in / out (auth.js): nothing shows until it knows which; signed out shows only #auth */
body.booting > header, body.booting > main, body.booting > .offline-banner, body.booting > .auth { visibility: hidden; }
body.signed-out > header, body.signed-out > main, body.signed-out > .offline-banner { display: none !important; }
.auth[hidden] { display: none; }
.auth { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 72px 16px 40px; -webkit-app-region: drag; }
.auth-card { -webkit-app-region: no-drag; width: min(400px, 100%); background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 24px 26px 20px; }
.auth-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 18px; }
.auth-card h1 { margin: 0 0 10px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.auth-card p { margin: 0 0 12px; color: var(--text-secondary); }
.auth-card label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--text-secondary); font-size: 12px; }
.auth-card input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text-primary); font-size: 13px; }
.auth-card input:focus, dialog input:focus, .admin-form input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
.auth-card small { color: var(--text-muted); }
.auth-card .auth-note { font-size: 12.5px; }
.auth-card .auth-ok, .good { color: var(--good); }
.auth-card .form-error { margin-bottom: 10px; }
.auth-card .form-error:empty { display: none; }
.btn.wide { width: 100%; justify-content: center; padding: 8px 12px; font-weight: 600; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--text-muted); }
.auth-links button.link { padding: 0; }
.auth-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.auth-actions[hidden] { display: none; }
.auth-server { margin: -2px 0 12px; font-size: 12px; color: var(--text-muted); }
.auth-server summary { cursor: pointer; margin-bottom: 8px; }
.turnstile { margin: 2px 0 12px; min-height: 65px; }

/* unverified banner */
.verify-banner .banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.verify-banner .status { max-width: 280px; }

/* settings: account and Hevy */
dialog#settings { max-height: calc(100vh - 48px); overflow-y: auto; }
.acct-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.acct-row .dev-main { flex: 1; min-width: 0; }
.acct-row .dev-meta { font-size: 11.5px; color: var(--text-muted); }
dialog fieldset details { margin: 2px 0 10px; }
dialog fieldset details summary { font-size: 12px; }
.danger-note { font-size: 12px; color: var(--text-secondary); margin: 0 0 10px; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, var(--surface-1)); }
.hevy-state { font-size: 12.5px; margin: 0 0 10px; color: var(--text-secondary); }
.hevy-state code, .server-line code { font-size: 12px; }
.server-line { font-size: 12px; color: var(--text-secondary); margin: 0 0 10px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 10px; }
.form-actions .check { margin-right: auto; }
#hevy-edit[hidden], #hevy-remove[hidden] { display: none; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); vertical-align: 1px; }
.tag.used, .tag.expired, .tag.revoked { background: var(--grid); color: var(--text-muted); }

/* admin page */
.admin-form .form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-form label:not(.check) { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--text-secondary); font-size: 12px; }
.admin-form label.grow { flex: 1; min-width: 220px; }
.admin-form input:not([type="checkbox"]) { padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text-primary); font-size: 13px; }
.admin-form input[type="number"] { width: 130px; }
.admin-form input:disabled { opacity: .5; }
.admin-form .form-error:empty, #waitlist-error:empty, #invites-error:empty { display: none; }
.invite-codes { margin: 10px 0 0; }
.invite-codes[hidden] { display: none; }
.invite-codes code { flex: 0 0 auto; font-size: 13px; letter-spacing: .04em; }
.invite-codes .invite-for { flex: 1; font-size: 12px; }
.admin-table td.pick, .admin-table th.pick { width: 28px; padding-right: 0; }
.admin-table tr.inactive td { color: var(--text-muted); }
.admin-table .btn { padding: 3px 10px; font-size: 12px; }
#page-admin .card > .form-actions { margin: 12px 0 0; }
