:root {
  --blue: #007aff; --green: #34c759; --amber: #ff9f0a; --red: #ff3b30; --gray: #8e8e93;
  --bg: #f2f2f7; --bg-elevated: #ffffff; --card: #ffffff;
  --separator: rgba(60,60,67,0.18); --text: #1c1c1e; --text-2: #3c3c43;
  --text-3: rgba(60,60,67,0.6); --fill: rgba(120,120,128,0.12); --fill-2: rgba(120,120,128,0.2);
  --nav-blur: rgba(242,242,247,0.8);
  --radius: 12px; --radius-lg: 18px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.05);
}
[data-theme="dark"], html[data-theme="system"] { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg:#000; --bg-elevated:#1c1c1e; --card:#1c1c1e; --separator:rgba(84,84,88,0.6);
    --text:#fff; --text-2:#ebebf5; --text-3:rgba(235,235,245,0.6);
    --fill:rgba(120,120,128,0.24); --fill-2:rgba(120,120,128,0.36); --nav-blur:rgba(20,20,22,0.8); --shadow:none;
  }
}
html[data-theme="dark"] {
  --bg:#000; --bg-elevated:#1c1c1e; --card:#1c1c1e; --separator:rgba(84,84,88,0.6);
  --text:#fff; --text-2:#ebebf5; --text-3:rgba(235,235,245,0.6);
  --fill:rgba(120,120,128,0.24); --fill-2:rgba(120,120,128,0.36); --nav-blur:rgba(20,20,22,0.8); --shadow:none;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin:0; height:100%; background:var(--bg); color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,"Segoe UI",Roboto,sans-serif;
  font-size:17px; line-height:1.4; -webkit-font-smoothing:antialiased; overscroll-behavior-y:contain;
}
#app { display:flex; flex-direction:column; min-height:100vh; min-height:100dvh; }
.nav { position:sticky; top:0; z-index:20; backdrop-filter:saturate(180%) blur(20px);
  -webkit-backdrop-filter:saturate(180%) blur(20px); background:var(--nav-blur);
  border-bottom:0.5px solid var(--separator); padding-top:env(safe-area-inset-top); }
.nav-inner { display:flex; align-items:flex-end; justify-content:space-between; padding:6px 20px 10px; }
.nav-title { font-size:34px; font-weight:700; letter-spacing:-0.02em; margin:0; }
.net-badge { font-size:12px; color:var(--green); }
.net-badge.offline { color:var(--gray); }
.main { flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:12px 16px calc(96px + env(safe-area-inset-bottom)); }
.card { background:var(--card); border-radius:var(--radius-lg); box-shadow:var(--shadow); padding:16px; margin-bottom:16px; }
.section-title { font-size:13px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-3); margin:22px 6px 8px; }
.list { background:var(--card); border-radius:var(--radius-lg); overflow:hidden; box-shadow:var(--shadow); }
.list-row { display:flex; align-items:center; gap:12px; padding:13px 16px; border-bottom:0.5px solid var(--separator); min-height:44px; }
.list-row:last-child { border-bottom:none; }
.list-row .grow { flex:1; min-width:0; }
.list-row .value { color:var(--text-3); }
.row-title { font-weight:500; }
.row-sub { font-size:13px; color:var(--text-3); }
.btn { appearance:none; border:none; cursor:pointer; font:inherit; font-weight:600; color:#fff; background:var(--blue);
  border-radius:var(--radius); padding:14px 18px; width:100%; transition:transform .08s ease, opacity .15s ease; }
.btn:active { transform:scale(0.98); opacity:0.85; }
.btn.secondary { background:var(--fill); color:var(--blue); }
.btn.danger { background:var(--fill); color:var(--red); }
.btn.small { width:auto; padding:8px 14px; font-size:15px; border-radius:10px; }
.segmented { display:flex; background:var(--fill); border-radius:10px; padding:2px; margin:4px 0 16px; }
.segmented button { flex:1; border:none; background:transparent; font:inherit; font-weight:500; color:var(--text); padding:7px 0; border-radius:8px; cursor:pointer; }
.segmented button.active { background:var(--bg-elevated); box-shadow:0 1px 3px rgba(0,0,0,.12); font-weight:600; }
.switch { position:relative; width:51px; height:31px; flex:none; }
.switch input { opacity:0; width:0; height:0; }
.switch .track { position:absolute; inset:0; background:var(--fill-2); border-radius:999px; transition:background .2s ease; }
.switch .track::before { content:""; position:absolute; top:2px; left:2px; width:27px; height:27px; background:#fff; border-radius:50%; box-shadow:0 2px 4px rgba(0,0,0,.2); transition:transform .2s ease; }
.switch input:checked + .track { background:var(--green); }
.switch input:checked + .track::before { transform:translateX(20px); }
.field { display:flex; align-items:center; gap:10px; }
.field label { flex:1; }
input[type="text"], input[type="number"], select, textarea { font:inherit; color:var(--text); background:var(--fill); border:none; border-radius:10px; padding:10px 12px; width:100%; }
input[type="number"] { text-align:right; }
.lift-card { margin-bottom:14px; }
.lift-head { display:flex; align-items:baseline; justify-content:space-between; margin-bottom:10px; }
.lift-name { font-size:20px; font-weight:700; letter-spacing:-0.01em; }
.lift-scheme { color:var(--text-3); font-size:14px; }
.lift-weight { display:flex; align-items:center; gap:8px; }
.lift-weight .plate-btn { background:var(--fill); color:var(--blue); border:none; border-radius:8px; padding:6px 10px; font-weight:600; cursor:pointer; }
.sets { display:flex; gap:10px; flex-wrap:wrap; margin-top:4px; }
.set { width:46px; height:46px; border-radius:50%; border:2px solid var(--fill-2); background:transparent; color:var(--text); font-weight:700; font-size:17px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .12s ease; }
.set.pending { color:var(--text-3); border-style:dashed; }
.set.success { background:var(--green); border-color:var(--green); color:#fff; }
.set.partial { background:var(--amber); border-color:var(--amber); color:#fff; }
.set.fail { background:var(--red); border-color:var(--red); color:#fff; }
.set:active { transform:scale(0.92); }
.tabbar { position:fixed; bottom:0; left:0; right:0; z-index:20; display:flex; justify-content:space-around;
  padding:8px 8px calc(6px + env(safe-area-inset-bottom)); background:var(--nav-blur);
  backdrop-filter:saturate(180%) blur(20px); -webkit-backdrop-filter:saturate(180%) blur(20px); border-top:0.5px solid var(--separator); }
.tab { flex:1; border:none; background:none; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:2px; color:var(--gray); font-size:10px; font-weight:500; padding:4px 0; }
.tab svg { width:26px; height:26px; }
.tab.active { color:var(--blue); }
.timer-bar { position:fixed; left:12px; right:12px; bottom:calc(72px + env(safe-area-inset-bottom)); z-index:25; display:flex; align-items:center; gap:12px; background:var(--blue); color:#fff; border-radius:14px; padding:12px 16px; box-shadow:0 8px 24px rgba(0,0,0,.25); }
.timer-bar #timer-value { font-variant-numeric:tabular-nums; font-weight:700; font-size:20px; flex:1; text-align:right; }
.timer-stop { background:rgba(255,255,255,.25); border:none; color:#fff; border-radius:8px; padding:6px 12px; font:inherit; font-weight:600; cursor:pointer; }
.sheet-backdrop { position:fixed; inset:0; z-index:40; background:rgba(0,0,0,.4); display:flex; align-items:flex-end; justify-content:center; }
.sheet { background:var(--bg-elevated); width:100%; max-width:520px; border-radius:20px 20px 0 0; padding:20px 20px calc(24px + env(safe-area-inset-bottom)); animation:sheet-up .28s cubic-bezier(.32,.72,0,1); }
@keyframes sheet-up { from { transform:translateY(100%); } to { transform:translateY(0); } }
.sheet h2 { margin:4px 0 16px; font-size:20px; }
.plate-visual { display:flex; align-items:center; justify-content:center; gap:3px; margin:12px 0 18px; min-height:90px; }
.plate { border-radius:4px; width:22px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:11px; font-weight:700; writing-mode:vertical-rl; }
.bar-graphic { height:6px; width:30px; background:var(--gray); border-radius:3px; }
.hidden { display:none !important; }
.empty { text-align:center; color:var(--text-3); padding:48px 20px; }
.empty .big { font-size:44px; margin-bottom:8px; }
.chart-wrap { width:100%; }
canvas { width:100%; height:auto; display:block; }
.stat-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.stat { background:var(--card); border-radius:var(--radius); padding:14px; box-shadow:var(--shadow); }
.stat .n { font-size:26px; font-weight:700; letter-spacing:-0.02em; }
.stat .l { font-size:13px; color:var(--text-3); }
.pill { display:inline-block; font-size:12px; font-weight:600; padding:3px 8px; border-radius:999px; }
.pill.a { background:rgba(0,122,255,.15); color:var(--blue); }
.pill.b { background:rgba(52,199,89,.15); color:var(--green); }
.banner { background:var(--fill); border-radius:12px; padding:12px 14px; margin-bottom:14px; font-size:14px; color:var(--text-2); }
.banner.warn { background:rgba(255,159,10,.15); color:var(--amber); }
@media (min-width:700px) {
  .main { max-width:640px; margin:0 auto; width:100%; }
  .nav-inner, .tabbar { max-width:672px; margin:0 auto; width:100%; }
}
