/* PaceOS Connect - the look of the emulator page: dark, orange accent */
:root {
  --bg: #0c0d10; --panel: #15171c; --panel2: #1b1e23; --line: #23262d; --line2: #333842;
  --text: #e9ebee; --dim: #8a8f98; --accent: #ff6b1a; --accent-dim: #3a2412;
  --ok: #22c55e; --ok-bg: #12331f; --warn: #facc15; --warn-bg: #2f2a10; --bad: #f87171; --bad-bg: #3a1414;
  --blue: #38bdf8; --blue-bg: #0f2a38; --strava: #fc4c02;
  --radius: 12px; --nav-w: 216px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; }
a { color: var(--blue); }
code { background: #23262d; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
h1 { margin: 0; font-size: 24px; letter-spacing: .2px; }
h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
h2 .i { color: var(--accent); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }
/* no style attributes anywhere: the update server's Content-Security-Policy refuses them */
.sprite { position: absolute; }
.page-note { margin: 16px; }
.gap-top { margin-top: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.big { width: 40px; height: 40px; color: var(--accent); stroke-width: 1.6; }

/* ---------------------------------------------------------------- header + navigation */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  background: rgba(12, 13, 16, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 18px; margin-right: auto; white-space: nowrap; }
.brand .i { width: 26px; height: 26px; color: var(--accent); }
.brand b { color: var(--accent); }
.conn { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--dim); background: var(--panel); border: 1px solid var(--line);
  padding: 4px 11px; border-radius: 20px; min-width: 0; max-width: 46vw; }
.conn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: #50555e; flex: none; }
.conn[data-state="on"] { color: var(--text); } .conn[data-state="on"] .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.conn[data-state="busy"] .dot { background: var(--warn); animation: blink 1s infinite; }
.conn[data-state="lost"] { color: var(--bad); } .conn[data-state="lost"] .dot { background: var(--bad); }
@keyframes blink { 50% { opacity: .3; } }
.lang { background: none; border: 1px solid var(--line2); color: var(--dim); border-radius: 8px; padding: 4px 9px; font: 600 12px system-ui, sans-serif; cursor: pointer; }
.lang:hover { color: var(--text); border-color: var(--accent); }

.layout { flex: 1; display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); gap: 0; width: 100%; max-width: 1200px; margin: 0 auto; }
.nav { position: sticky; top: 57px; align-self: start; display: flex; flex-direction: column; gap: 2px; padding: 18px 10px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--dim); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--accent-dim); box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active .i { color: var(--accent); }
.nav a.disabled { opacity: .38; }
main { padding: 22px 22px 40px; min-width: 0; }
.page { max-width: 880px; display: flex; flex-direction: column; gap: 16px; }
.page-h { margin-bottom: 2px; }
.lead { color: var(--dim); margin: 6px 0 0; max-width: 70ch; }
.foot { text-align: center; color: #555a63; font-size: 12px; padding: 14px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav { top: 51px; z-index: 15; flex-direction: row; overflow-x: auto; padding: 6px 10px; gap: 4px; background: rgba(12, 13, 16, .95);
    border-bottom: 1px solid var(--line); scrollbar-width: none; backdrop-filter: blur(8px); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 7px 11px; font-size: 13px; }
  .nav a .i { width: 16px; height: 16px; }
  .nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .top { padding: 9px 14px; }
  main { padding: 16px 14px 32px; }
  h1 { font-size: 21px; }
}
@media (max-width: 420px) {
  .brand span { font-size: 16px; }
  .conn { max-width: 40vw; font-size: 12px; padding: 3px 9px; }
  .nav a .i { display: none; }
}

/* ---------------------------------------------------------------- cards, grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-h h2 { margin: 0 auto 0 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.grid2 .card { display: flex; flex-direction: column; gap: 10px; }
.grid2 .card h2 { margin-bottom: 0; }
.grid2 .card p { margin: 0; }
@media (max-width: 420px) { .card { padding: 14px; } }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: #22252b; color: var(--text);
  border: 1px solid var(--line2); border-radius: 9px; padding: 8px 14px; font: 500 14px system-ui, sans-serif; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s, opacity .15s; position: relative; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d04; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #ff8340; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad-bg); border-color: #6b2323; color: #fecaca; }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); }
.btn.danger-text { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 11px; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor;
  border-color: var(--text) transparent var(--text) transparent; animation: spin .8s linear infinite; }
.btn.primary.busy::after { border-color: #1a0d04 transparent #1a0d04 transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { background: none; border: 0; color: var(--dim); padding: 6px; border-radius: 8px; cursor: pointer; display: inline-flex; }
.icon-btn:hover:not(:disabled) { color: var(--text); background: #22252b; }
.icon-btn.danger:hover:not(:disabled) { color: var(--bad); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.file-btn { cursor: pointer; }
.file-btn.disabled { opacity: .45; pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel2); border: 1px solid var(--line2); color: var(--dim); border-radius: 16px; padding: 4px 11px; font: 12.5px system-ui, sans-serif; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--accent); }
a.chip { text-decoration: none; }

/* ---------------------------------------------------------------- forms */
input, select, textarea { font: inherit; color: var(--text); background: #101216; border: 1px solid var(--line2); border-radius: 9px;
  padding: 8px 11px; width: 100%; min-width: 0; outline: none; transition: border-color .15s; }
input::placeholder { color: #50555e; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #ff6b1a22; }
input:disabled, select:disabled { opacity: .5; }
input.invalid, .invalid input { border-color: var(--bad); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span:first-child { font-weight: 500; }
.hint { color: var(--dim); font-size: 12px; display: block; }
p.hint { margin: 4px 0 0; }
.error { color: var(--bad); font-size: 12px; display: block; }
.error:empty { display: none; }
.unit-input { display: flex; align-items: stretch; }
.unit-input input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.unit-input > span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line2); border-left: 0; border-radius: 0 9px 9px 0;
  background: var(--panel2); color: var(--dim); font-size: 13px; white-space: nowrap; }
.pw { display: flex; position: relative; }
.pw input { padding-right: 40px; }
.pw .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.row { display: flex; align-items: center; gap: 10px; }
.row select { width: auto; flex: 1; min-width: 74px; }
.pace-range input { width: 84px; text-align: center; flex: 1; }
/* the coach group: a race (date + distance) and the pacer (pace, or a time for a distance) */
.wide-field { grid-column: 1 / -1; }
.row.wrap { flex-wrap: wrap; }
.row.wrap select { flex: 1 1 150px; }
.row.wrap input[type=date] { width: auto; flex: 0 1 170px; }
.row.wrap .unit-input { flex: 0 1 140px; }
.row.wrap input[name=pacer_time] { flex: 0 1 120px; }
/* the data pages: per profile the pages a run cycles through, each with what the watch draws (app.js renderPages) */
.pages-tabs { justify-self: start; }
.pages-tabs label.changed span::after { content: " •"; color: var(--accent); }
.pages-tabs label.bad span::after { content: " !"; color: var(--bad); font-weight: 700; }
.pages-panel.off { display: none; }
.wp-list { display: flex; flex-direction: column; gap: 10px; }
.wpage { display: flex; gap: 16px; align-items: flex-start; border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; background: #121418; }
.wp-ctl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.wp-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wp-h .wp-num { margin-right: 4px; }
.wp-h select { width: auto; min-width: 120px; }
.wp-slots { display: flex; flex-direction: column; gap: 6px; }
.wp-slot { display: flex; align-items: center; gap: 6px; }
.wp-slot select { flex: 1; min-width: 0; max-width: 320px; }
.wp-sn { width: 18px; text-align: center; color: var(--dim); font-size: 12.5px; flex: none; }
.wp-slots > .btn { align-self: flex-start; }
.wp-notes { display: flex; flex-direction: column; gap: 2px; }
.wp-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.wp-foot .dim { margin-left: auto; }
.pages-raw code { display: inline-block; margin-top: 4px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .wpage { flex-direction: column; align-items: stretch; } .wp { align-self: center; } }
/* the preview: the round panel, black; values white and large, labels small and dim */
.wp { width: 170px; height: auto; flex: none; display: block; }
.wp text { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wp-bg { fill: #000; stroke: #3a3e46; stroke-width: 5; }
.wp-v { fill: #fff; font-weight: 700; }
.wp-u { fill: #9aa0a8; font-weight: 500; }
.wp-l { fill: #8a8f98; font-weight: 600; letter-spacing: .5px; }
.wp-o { fill: var(--accent); }
.wp-div { stroke: #2a2e35; stroke-width: 2; }
.wp-track { fill: none; stroke: #1f2329; stroke-width: 9; stroke-linecap: round; }
.wp-ring { fill: none; stroke: var(--ok); stroke-width: 9; stroke-linecap: round; }
.wp-pill { fill: var(--ok); }
.wp-pill-t { fill: #04210f; font-weight: 700; }
.wp-bar { fill: #23262d; }
.wp-bar-f { fill: var(--accent); }
.wp-route { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linejoin: round; }
.wp-me { fill: #fff; stroke: #000; stroke-width: 3; }
.wp-scale { fill: none; stroke: #8a8f98; stroke-width: 2; }
.wp-key { fill: #23262d; }
.wp-key.play { fill: var(--accent); }
.wp-ico { fill: #fff; }
/* the watch face: cards to pick one, then its slots + colour with a live preview (app.js renderFaces); the accent colour is a class (CSP: no style attributes) */
.fc-orange { --fc: #FF6B1A; } .fc-red { --fc: #EF4444; } .fc-yellow { --fc: #FACC15; } .fc-green { --fc: #22C55E; }
.fc-cyan { --fc: #22D3EE; } .fc-blue { --fc: #3B82F6; } .fc-white { --fc: #FFFFFF; }
.face-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.face-card { position: relative; display: block; cursor: pointer; }
.face-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.face-box { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border: 1px solid var(--line2); border-radius: 10px; background: #121418; color: var(--dim); }
.face-box svg { width: 96px; height: 96px; display: block; }
.face-box b { font-weight: 500; font-size: 13.5px; }
.face-card:hover .face-box { border-color: var(--accent); }
.face-card input:checked + .face-box { border-color: var(--accent); background: var(--accent-dim); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.face-card input:focus-visible + .face-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.fm-bg, .fp-bg { fill: #000; stroke: #3a3e46; stroke-width: 3; }
.fm-t, .fp-t { fill: #fff; font-weight: 700; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.fm-bar { fill: #c8ccd2; }
.fm-tick, .fm-hand { stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.fm-hand { stroke-width: 3; }
.fm-hub { fill: #fff; }
.fm-div { stroke: #2a2e35; stroke-width: 1.5; }
.fm-ring { fill: none; stroke-width: 4; stroke-linecap: round; }
.fm-acc { fill: var(--fc, var(--accent)); }
.fm-tick.fm-acc, .fm-hand.fm-acc, .fm-ring.fm-acc { fill: none; stroke: var(--fc, var(--accent)); }
.face-panel { display: flex; gap: 18px; align-items: flex-start; border: 1px solid var(--line2); border-radius: 10px; padding: 12px; background: #121418; }
.face-panel.off { display: none; }
.face-prev { flex: none; }
.face-ctl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.face-slots { display: flex; flex-direction: column; gap: 6px; }
.face-slot { display: flex; align-items: center; gap: 8px; }
.face-slot > span { flex: 0 0 104px; color: var(--dim); font-size: 13px; }
.face-slot select, .face-colorsel select { flex: 1; min-width: 0; max-width: 320px; }
.face-colorsel { display: flex; align-items: center; gap: 8px; }
.face-sw { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--fc); border: 1px solid #3a3e46; }
.fp { width: 220px; height: auto; display: block; }
.fp-s { fill: #fff; font-weight: 600; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.fp-a { fill: var(--fc, var(--accent)); }
.fp-l { fill: #8a8f98; font-weight: 600; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.fp-tick { stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.fp-tick.fp-a, .fp-hand.fp-a, .fp-ring.fp-a { fill: none; stroke: var(--fc, var(--accent)); }
.fp-hand { stroke: #fff; stroke-width: 5; stroke-linecap: round; }
.fp-hub { fill: #fff; }
.fp-div { stroke: #2a2e35; stroke-width: 2; }
.fp-track { fill: none; stroke: #1f2329; stroke-width: 8; stroke-linecap: round; }
.fp-ring { fill: none; stroke-width: 8; stroke-linecap: round; }
@media (max-width: 560px) { .face-panel { flex-direction: column; align-items: stretch; } .fp { margin: 0 auto; } .face-slot > span { flex-basis: 88px; } }
/* the alarms: one box per alarm (app.js renderAlarms), the days as chips */
.alarm-list { display: flex; flex-direction: column; gap: 10px; }
.alarm { border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; background: #121418; }
.al-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.al-h input[type=time] { width: auto; flex: 0 0 auto; }
.al-h select { width: auto; flex: 0 1 150px; }
.al-h .al-label { flex: 1 1 160px; }
.al-days { margin-top: 8px; }
.chip.on { background: var(--accent-dim); color: var(--text); border-color: var(--accent); }
.alarm-foot { display: flex; align-items: center; gap: 10px; }
.readonly { padding: 8px 11px; border: 1px dashed var(--line2); border-radius: 9px; color: var(--text); }
.readonly .dim { font-size: 12.5px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; margin: 4px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.form-foot > .dim:first-child { margin-right: auto; font-size: 13px; }
.toggle-field { flex-direction: row; align-items: flex-start; gap: 12px; }
.toggle-field > div { display: flex; flex-direction: column; gap: 2px; }
.toggle-field > div > span { font-weight: 500; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #2a2e35; border-radius: 12px; transition: background .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #c9cdd3; transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px #ff6b1a44; }

.seg { display: inline-flex; background: #101216; border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; align-self: flex-start; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; padding: 5px 13px; border-radius: 7px; cursor: pointer; color: var(--dim); font-size: 13.5px; }
.seg input:checked + span { background: var(--accent-dim); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------------------------------------------------------------- notes, badges */
.note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px; border-radius: 10px; font-size: 13px;
  background: var(--panel2); border: 1px solid var(--line); flex-wrap: wrap; }
.note .i { margin-top: 1px; }
.note.warn { background: var(--warn-bg); border-color: #5a4c12; color: #fde68a; }
.note.bad { background: var(--bad-bg); border-color: #6b2323; color: #fecaca; }
.note.info { background: var(--blue-bg); border-color: #164e63; color: #bae6fd; }
.note a { color: inherit; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 10px; font-size: 12px; background: #23262d; color: var(--dim); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.strava { background: #3b1a0b; color: #ff8a50; }
.badge.intervals { background: var(--blue-bg); color: var(--blue); }
.badge.accent { background: var(--accent-dim); color: var(--accent); }
.badge .i { width: 12px; height: 12px; }

details.more summary { cursor: pointer; color: var(--dim); font-size: 13px; padding: 4px 0; user-select: none; }
details.more summary:hover { color: var(--text); }
details.more[open] summary { margin-bottom: 8px; }
details.more ol { margin: 0; padding-left: 20px; font-size: 13px; }

/* ---------------------------------------------------------------- watch card */
.watch-card { display: flex; flex-direction: column; gap: 14px; border-color: #3a2a20;
  background: linear-gradient(160deg, #1d1712, var(--panel) 45%); }
.watch-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.watch-name { font-size: 18px; font-weight: 600; }
.pair-box { display: flex; flex-direction: column; gap: 10px; }
.pair-form { background: #101216; border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.pair-form p { margin: 0; }
.pair-code { width: 140px; flex: 0 0 140px; font: 600 18px/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 3px; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: #101216; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.stat .k { color: var(--dim); font-size: 12px; }
.stat .v { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.stat .s { color: var(--dim); font-size: 12px; }
.stat .bar { margin-top: 6px; }
.bar { height: 6px; background: #23262d; border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .3s; }
.bar.ok > div { background: var(--ok); } .bar.warn > div { background: var(--warn); } .bar.bad > div { background: var(--bad); }

/* ---------------------------------------------------------------- lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); min-width: 0; }
.list li:first-child { border-top: 0; }
.list li.empty { color: var(--dim); justify-content: center; padding: 18px; }
.list .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--panel2); display: flex; align-items: center; justify-content: center; flex: none; color: var(--dim); }
.list .ico.accent { color: var(--accent); background: var(--accent-dim); }
.list .main { flex: 1; min-width: 0; }
.list .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { color: var(--dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.list .acts { display: flex; gap: 2px; flex: none; align-items: center; }
.list .bar { margin-top: 6px; }
.list pre { white-space: pre-wrap; }
.list li.expand { flex-wrap: wrap; }
.list li .text { flex-basis: 100%; margin: 4px 0 0 46px; }
@media (max-width: 480px) {
  .list li { flex-wrap: wrap; }
  .list .ico { display: none; }
  .list li .text { margin-left: 0; }
  .list .acts { margin-left: auto; }
}

/* ---------------------------------------------------------------- progress */
.progress-slot:empty { display: none; }
.progress-slot { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.prog { background: #101216; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.prog-h { display: flex; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 7px; }
.prog-h .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.prog-h .pct { color: var(--dim); font-variant-numeric: tabular-nums; }
.prog .meta { color: var(--dim); font-size: 12px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.prog.done .bar > div { background: var(--ok); }
.prog.fail .bar > div { background: var(--bad); }
.prog.fail .meta { color: var(--bad); }

/* ---------------------------------------------------------------- workout builder */
.presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.steps { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 6px; }
.step { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.part select { width: auto; min-width: 150px; }
.part input { width: 120px; }
.tag { display: inline-block; min-width: 82px; padding: 3px 9px; border-radius: 7px; font-size: 12.5px; font-weight: 600; text-align: center; }
.tag.warm { background: var(--blue-bg); color: var(--blue); }
.tag.cool { background: var(--blue-bg); color: var(--blue); }
.tag.run { background: var(--accent-dim); color: var(--accent); }
.tag.rec { background: var(--ok-bg); color: var(--ok); }
.block { border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 9px; background: #121418; }
.block-h { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.block-h .reps { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--dim); }
.block-h .reps input { width: 70px; }
.block select { width: auto; }
.block input.v { width: 110px; }
.block input.p { width: 74px; text-align: center; }
.block .lbl { color: var(--dim); font-size: 13px; }
.add-block { align-self: flex-start; }
.preview { margin-top: 12px; }
.preview-h { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
pre { background: #0a0b0d; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; overflow: auto;
  font: 12.5px/1.55 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: #d6d9de; }
@media (max-width: 480px) {
  .part select, .block select { min-width: 0; flex: 1; }
  .part input, .block input.v { flex: 1; width: auto; }
  .tag { min-width: 0; }
}

/* ---------------------------------------------------------------- system */
.install { margin-top: 12px; background: #101216; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.install-h { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 500; }
.install-ready { margin-top: 12px; }
.install-ready p { margin: 0 0 10px; color: var(--dim); }
.server { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.server-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.server-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.server p.hint { margin: 0; }
.notes { background: #101216; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; max-height: 260px; overflow: auto; }
.notes h3 { margin: 0 0 6px; font-size: 13px; color: var(--dim); font-weight: 500; }
.notes p { margin: 0 0 6px; } .notes ul { margin: 0 0 6px; padding-left: 20px; }
.server + details.more { margin-top: 10px; }
.clock { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.log { max-height: 320px; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; margin: 8px 0; }
.log-card summary { font-size: 14px; }

/* ---------------------------------------------------------------- toasts, dialog, overlay */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #1f2228; border: 1px solid var(--line2); border-left: 4px solid var(--blue);
  border-radius: 10px; padding: 10px 12px; box-shadow: 0 10px 30px #000a; animation: tin .2s ease-out; font-size: 13.5px; }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.toast .grow { overflow-wrap: anywhere; }
.toast button { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 0 2px; font-size: 16px; line-height: 1; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 480px) { .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; } }
.dlg { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 14px; padding: 18px 20px; width: min(440px, calc(100vw - 32px)); }
.dlg::backdrop { background: #000a; }
.dlg h3 { margin: 0 0 8px; font-size: 17px; }
.dlg p { margin: 0 0 14px; color: var(--dim); white-space: pre-line; }
.overlay { position: fixed; inset: 0; z-index: 60; background: #000b; display: flex; align-items: center; justify-content: center; padding: 20px; }
.overlay-box { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 24px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 360px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #333842; border-top-color: var(--accent); animation: spin .9s linear infinite; }
/* a page whose data from the watch is loading, did not load, or failed to reload (app.js renderLoad) */
.spinner.small { width: 16px; height: 16px; border-width: 2px; flex: none; }
.load-note { align-items: center; }
.card[inert] { opacity: .45; }

/* settings backup: the preview of a restore */
.backup-preview { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.backup-preview h3 { margin: 0; font-size: 15px; }
.diff { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.diff li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 7px 11px; background: #101216; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.diff li > b { font-weight: 600; flex: 0 0 auto; }
.diff .vals { color: var(--dim); overflow-wrap: anywhere; min-width: 0; }
.diff .vals .new { color: var(--text); }
.diff.skipped li { border-color: #5a4c12; }

/* reset: a danger card with two options and the watch's answer */
.danger-card { border-color: #6b2323; }
.danger-card > h2 { display: flex; align-items: center; gap: 8px; color: #fecaca; }
.reset-opt { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.reset-opt .btn { flex: none; }
.reset-box { align-items: center; margin-top: 6px; }
.reset-box.ok { background: var(--ok-bg); border-color: #14532d; color: #bbf7d0; }
