:root {
  --bg: #111418;
  --card: #1b2027;
  --line: #2a313b;
  --text: #eef1f5;
  --muted: #8b95a3;
  --accent: #f5a524;
  --accent-text: #1a1200;
  --good: #3ccf7a;
  --bad: #ff6b6b;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: rgba(17, 20, 24, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header h1 { flex: 1; margin: 0; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main { max-width: 640px; margin: 0 auto; padding: 14px 14px 0; }
button, input { font: inherit; color: inherit; }
button {
  border: 0; border-radius: 12px; padding: 12px 16px; background: var(--line); cursor: pointer;
}
button:active { opacity: .7; }
button.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
button.ghost { background: transparent; color: var(--muted); }
button.danger { background: transparent; color: var(--bad); }
button.icon { background: transparent; font-size: 28px; line-height: 1; padding: 4px 10px; min-width: 44px; }
button.block { width: 100%; }
input {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0c0f12; outline: none;
}
input:focus { border-color: var(--accent); }
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 15px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px;
}
.plan { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); padding: 18px 16px; margin-bottom: 10px; }
.plan .name { font-size: 20px; font-weight: 600; flex: 1; }
.plan .meta { color: var(--muted); font-size: 14px; text-align: right; }
.badge { display: inline-block; background: var(--accent); color: var(--accent-text); border-radius: 8px; padding: 1px 7px; font-size: 13px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.ex-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ex-head h2 { flex: 1; margin: 0; font-size: 19px; }
.ex-head button { padding: 6px 10px; font-size: 14px; }
.last { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.last b { color: var(--text); font-weight: 600; }
table.sets { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
table.sets td { padding: 6px 4px; border-top: 1px solid var(--line); }
table.sets td.n { color: var(--muted); width: 2.2em; }
table.sets td.prev { color: var(--muted); font-size: 14px; text-align: right; }
table.sets td.x { width: 44px; text-align: right; }
table.sets td.x button { padding: 4px 10px; background: transparent; color: var(--muted); }
.up { color: var(--good); }
.down { color: var(--bad); }
.entry { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.entry label { margin: 0 0 4px; font-size: 13px; }
.entry input { text-align: center; font-size: 20px; padding: 10px 6px; }
.entry button { height: 48px; padding: 0 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.actions > * { flex: 1; }
.error { color: var(--bad); min-height: 1.4em; margin: 10px 0; font-size: 15px; }
.history .day { font-weight: 600; margin-bottom: 4px; }
.history .sets { color: var(--muted); }
.edit-tools { display: flex; gap: 6px; margin-top: 8px; }
.edit-tools button { flex: 1; padding: 8px; font-size: 14px; }
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #2b3340; padding: 10px 16px; border-radius: 10px; font-size: 15px; z-index: 10;
}
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--card); border-radius: 16px 16px 0 0; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); }
.sheet button { width: 100%; margin-top: 8px; text-align: left; background: var(--line); }
