/* ------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;

  --bg:          #0e0e0d;
  --surface-1:   #1a1a19;
  --surface-2:   #232322;
  --surface-3:   #2b2b29;
  --border:      #302f2d;
  --border-soft: #262624;

  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #85857c;

  --accent:      #3987e5;
  --accent-soft: rgba(57, 135, 229, 0.14);
  --good:        #199e70;
  --good-soft:   rgba(25, 158, 112, 0.14);
  --warn:        #c98500;
  --danger:      #e66767;

  --radius:    14px;
  --radius-sm: 10px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --num: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

body {
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: calc(96px + var(--safe-b));
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ------------------------------------------------------------- layout */
.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(14, 14, 13, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 14px 0;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand small {
  font-weight: 450;
  font-size: 12px;
  color: var(--text-muted);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  padding: 0;
  flex: none;
}
.icon-btn:active { background: var(--surface-2); }

/* tabs */
.tabs {
  display: flex;
  gap: 2px;
}

.tab {
  flex: 1;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 9px 4px 11px;
  font-size: 14px;
  font-weight: 550;
  transition: color .15s;
}
.tab[aria-selected="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.view { padding-top: 16px; }
.view[hidden] { display: none; }

/* ------------------------------------------------------------- cards */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 22px 2px 9px;
}

/* ------------------------------------------------------------- workout picker */
.wsel {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.wsel button {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 15px;
  position: relative;
}
.wsel button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text-primary);
}
.wsel button .hint {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.datebar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.datebar input[type="date"] {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 44px;
}

.next-badge {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ------------------------------------------------------------- edit bar */
.edit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 2px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.edit-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 550;
  padding: 7px 13px;
  min-height: 36px;
  white-space: nowrap;
  flex: none;
}
.edit-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.edit-hint {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.ex.edit { padding: 13px 14px 14px; }

.edit-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}
.edit-head .ex-num { padding-top: 0; }

.edit-order { display: flex; gap: 5px; margin-left: auto; }
.edit-order button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.edit-order button[disabled] { opacity: .3; }

.edit-del {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 550;
  padding: 9px 12px;
  min-height: 38px;
}
.edit-del:active { background: rgba(230, 103, 103, 0.12); }

.edit-field { display: block; margin-bottom: 9px; }
.edit-field > span {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.edit-field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  min-height: 44px;
  font-size: 15px;
}
.edit-field input:focus { outline: none; border-color: var(--accent); }
.edit-field input[type="number"] {
  font-family: var(--num);
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
}
.edit-field input[type="number"]::-webkit-outer-spin-button,
.edit-field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.edit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.edit-grid .edit-field { margin-bottom: 0; }

.edit-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.edit-flags label { display: inline-flex; align-items: center; gap: 7px; }
.edit-flags input { width: 18px; height: 18px; accent-color: var(--accent); }
.edit-note {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-muted);
}

.add-ex { margin-bottom: 12px; }

.edit-actions {
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: calc(10px + var(--safe-b));
  background: rgba(14, 14, 13, 0.92);
  backdrop-filter: blur(10px);
  padding: 8px 0;
  border-radius: var(--radius-sm);
}
.edit-actions .btn { flex: 1; }

/* ------------------------------------------------------------- exercise */
.ex {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.ex.done { border-color: rgba(25, 158, 112, 0.4); }

.ex-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 14px 11px;
}

.ex-num {
  font-family: var(--num);
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 2px;
  min-width: 15px;
}

.ex-title {
  flex: 1;
  min-width: 0;
}

.ex-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.ex-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.ex-meta .rpe::before { content: 'RPE '; }

/* ------------------------------------------------------------- photo */
.ex-thumb {
  flex: none;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  display: block;
}
.ex-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ex-thumb:active { border-color: var(--accent); }

.ex-cue {
  font-size: 12.5px;
  color: #4fd3a0;
  margin-top: 5px;
  line-height: 1.35;
}

.photo-sheet {
  max-width: 560px;
  width: calc(100% - 24px);
}
.photo-body { padding: 12px; }
.photo-body img {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  background: var(--surface-2);
}
.photo-caption { padding: 12px 4px 14px; }
.photo-title {
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.photo-cue {
  font-size: 13.5px;
  color: #4fd3a0;
  margin-top: 6px;
}

.edit-photo {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 11px 0 2px;
}
.edit-photo-preview {
  width: 58px;
  height: 58px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.edit-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.edit-photo-preview span {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}
.edit-photo-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.edit-photo-actions button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 550;
  padding: 9px 13px;
  min-height: 40px;
}
.edit-photo-actions button:active { background: var(--surface-3); }
.edit-photo-actions button[disabled] { opacity: .6; }

.prev {
  margin: 0 14px 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  width: calc(100% - 28px);
  text-align: left;
}
.prev:active { background: var(--surface-3); }
.prev .prev-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 2px;
}
.prev .prev-sets { font-family: var(--num); color: var(--text-primary); }
.prev .copy {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  font-weight: 600;
}

.progress-cue {
  margin: 0 14px 10px;
  padding: 7px 10px;
  background: var(--good-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: #4fd3a0;
  font-weight: 550;
}

/* set rows */
.sets { padding: 0 14px 12px; }

.set-row {
  display: grid;
  grid-template-columns: 22px 1fr 14px 1fr 38px;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.set-idx {
  font-family: var(--num);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.set-row input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  min-height: 46px;
  text-align: center;
  font-family: var(--num);
  font-size: 17px;
  font-weight: 600;
  -moz-appearance: textfield;
}
.set-row input::-webkit-outer-spin-button,
.set-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-3);
}
/* Подсказка не должна читаться как уже введённое число. */
.set-row input::placeholder,
.field input::placeholder {
  color: var(--text-muted);
  opacity: 0.4;
  font-weight: 500;
}
.set-row input.filled { border-color: rgba(25, 158, 112, 0.45); }

.set-x {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Прошлый результат этого же подхода — под полями, второй строкой грида. */
.set-prev {
  grid-column: 2 / 5;
  text-align: center;
  font-size: 11px;
  font-family: var(--num);
  color: var(--text-muted);
  opacity: .75;
  margin: -4px 0 3px;
}

.set-del {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 20px;
  padding: 6px;
  line-height: 1;
  border-radius: 8px;
}
.set-del:active { background: var(--surface-3); color: var(--danger); }

.units {
  display: grid;
  grid-template-columns: 22px 1fr 14px 1fr 38px;
  gap: 7px;
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  padding: 0 0 0 0;
}
.units span { text-align: center; }

.add-set {
  width: 100%;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 11px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 550;
}
.add-set:active { background: var(--surface-3); }

/* ------------------------------------------------------------- note */
textarea.note {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 76px;
  resize: vertical;
  line-height: 1.5;
}
textarea.note:focus { outline: none; border-color: var(--accent); }

/* ------------------------------------------------------------- finish */
.finish-btn {
  width: 100%;
  background: var(--good);
  border: 0;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 650;
  font-size: 15.5px;
  padding: 15px;
  min-height: 52px;
  margin-top: 4px;
}
.finish-btn:active { filter: brightness(.92); }
.finish-btn[disabled] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 550;
}

.finished-card {
  background: var(--good-soft);
  border: 1px solid rgba(25, 158, 112, 0.42);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.finished-card .done-title {
  font-weight: 620;
  font-size: 14.5px;
  color: #4fd3a0;
}
.finished-card .done-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.finished-card button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 8px 12px;
  min-height: 40px;
  white-space: nowrap;
}
.finished-card button:active { background: var(--surface-2); }

/* ------------------------------------------------------------- rest timer */
.rest-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: rgba(18, 18, 17, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(110%);
  transition: transform .22s ease;
}
.rest-bar.on { transform: translateY(0); }

.rest-time {
  font-family: var(--num);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 84px;
  font-variant-numeric: tabular-nums;
}
.rest-time.over { color: var(--good); }

.rest-track {
  flex: 1;
  height: 5px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.rest-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .95s linear;
}
.rest-fill.done { background: var(--good); }

.rest-actions { display: flex; gap: 7px; }
.rest-actions button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  min-height: 42px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------- stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 13px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.stat-value {
  font-family: var(--num);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 3px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.stat-sub.up { color: var(--good); }
.stat-sub.down { color: var(--danger); }

/* ------------------------------------------------------------- chart */
.chart-card { padding: 14px 8px 10px; }
.chart-card .chart-head { padding: 0 6px; margin-bottom: 8px; }

.chart-title {
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.01em;
}
.chart-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

svg.chart { display: block; width: 100%; height: auto; touch-action: pan-y; }

.grid-line { stroke: var(--border-soft); stroke-width: 1; }
.axis-text { fill: var(--text-muted); font-size: 10.5px; font-family: var(--font); }
.series-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-dot { fill: var(--accent); stroke: var(--surface-1); stroke-width: 2; }
.raw-dot { fill: var(--text-muted); opacity: .55; }
.goal-line { fill: none; stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .6; }
.area-fill { fill: url(#accentFade); }
.crosshair { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 6px 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i {
  width: 11px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
  opacity: 0;
  transition: opacity .12s;
  z-index: 5;
}
.tooltip.on { opacity: 1; }
.tooltip b { font-family: var(--num); font-size: 13px; }
.chart-wrap { position: relative; }

/* ------------------------------------------------------------- select */
select.picker {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 46px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select.picker:focus { outline: none; border-color: var(--accent); }

/* ------------------------------------------------------------- weight form */
.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}

.field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 10px;
  min-height: 46px;
  font-family: var(--num);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}
.field input:focus { outline: none; border-color: var(--accent); }

.btn {
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 650;
  padding: 12px 18px;
  min-height: 46px;
  font-size: 15px;
}
.btn:active { filter: brightness(.9); }
.btn.ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 550;
}
.btn.full { width: 100%; }

/* ------------------------------------------------------------- table */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 300px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-secondary);
  white-space: nowrap;
}
table.data td.num { font-family: var(--num); color: var(--text-primary); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.wide { white-space: normal; min-width: 150px; }

.row-del {
  background: none;
  border: 0;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
}
.row-del:active { color: var(--danger); background: var(--surface-3); }

/* ------------------------------------------------------------- login */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
/* display у .login перебивает браузерный [hidden] — возвращаем скрытие явно. */
.login[hidden] { display: none; }
.login form {
  width: 100%;
  max-width: 320px;
}
.login h1 {
  font-size: 21px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.login p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 0 0 20px;
}
.login input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  min-height: 48px;
  margin-bottom: 10px;
  text-align: center;
  font-size: 16px;
}
.login input:focus { outline: none; border-color: var(--accent); }
.login .err {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
  text-align: center;
}

/* ------------------------------------------------------------- misc */
.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 26px 16px;
  line-height: 1.6;
}

.saved-flag {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 50;
  pointer-events: none;
}
.saved-flag.on { opacity: 1; transform: translateX(-50%) translateY(0); }

dialog.sheet {
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
}
dialog.sheet::backdrop { background: rgba(0,0,0,.6); }
.sheet-body { padding: 18px; }
.sheet-body h2 { font-size: 17px; margin: 0 0 14px; letter-spacing: -0.01em; }
.sheet-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.sheet-row .btn { flex: 1; }
.sheet-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 12px 0 0;
}

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }

@media (min-width: 620px) {
  .set-row, .units { grid-template-columns: 26px 1fr 16px 1fr 42px; }
  body { font-size: 16px; }
}
