/* Lifting — Ops-Dashboard theme (docs/THEME.md). Flat neutral dark: solid surfaces, hairline borders,
   no glows, gradients or blur. Color is reserved for meaning. Restyle here, never per component. */

:root {
  color-scheme: dark;
  --zinc-50: #fafafa; --zinc-100: #f4f4f5; --zinc-200: #e4e4e7; --zinc-300: #d4d4d8; --zinc-400: #a1a1aa;
  --zinc-500: #71717a; --zinc-600: #52525b; --zinc-800: #27272a; --zinc-900: #18181b; --zinc-950: #09090b;
  --emerald: #34d399; --emerald-300: #6ee7b7; --emerald-rgb: 16 185 129;
  --amber: #fbbf24; --amber-300: #fcd34d; --amber-rgb: 245 158 11;
  --red: #f87171; --red-300: #fca5a5; --red-rgb: 239 68 68;
  --cyan: #22d3ee; --cyan-300: #67e8f9; --cyan-rgb: 6 182 212;
  --violet: #a78bfa; --violet-300: #c4b5fd; --violet-rgb: 139 92 246;
  --hair: rgba(255, 255, 255, .08);
  --font: ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --nav-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { background: #09090b; color: #d4d4d8; margin: 0; padding: 0; }
html { scrollbar-width: thin; scrollbar-color: rgb(161 161 170 / .2) transparent; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.45; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
::selection { background: rgb(34 211 238 / .25); }
:focus-visible { outline: 2px solid rgb(161 161 170 / .6); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .45; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* ---- type ---- */
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: #fafafa; }
.page-sub { font-size: 14px; color: #71717a; margin-top: 2px; }
.microlabel { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: #71717a; }
.card-title { font-size: 16px; font-weight: 600; color: #fafafa; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.muted { color: #71717a; }
.dim { color: #a1a1aa; }
.strong { color: #fafafa; }
.faint { color: #52525b; }
.ok-text { color: var(--emerald); }
.warn-text { color: var(--amber); }
.danger-text { color: var(--red); }
.info-text { color: var(--cyan); }
.violet-text { color: var(--violet); }
.link { color: #22d3ee; text-decoration: none; }
.link:hover { color: #67e8f9; }

/* ---- surfaces ---- */
.panel, .card { border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(24, 24, 27, .6); }
.card-hover:hover { border-color: rgba(255, 255, 255, .16); background: #18181b; }
@media (hover: none) { .card-hover:hover { border-color: rgba(255, 255, 255, .08); background: rgba(24, 24, 27, .6); } }
.card-quiet { border-radius: 12px; border: 1px solid rgba(255, 255, 255, .05); background: transparent; opacity: .7; }
.card-dashed { border-radius: 12px; border: 1px dashed rgba(255, 255, 255, .1); }
.card-inset { border-radius: 8px; border: 1px solid rgba(255, 255, 255, .06); background: rgba(9, 9, 11, .6); }
.pad { padding: 12px; }
.pad-lg { padding: 16px; }

/* ---- chips + tones ---- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .1);
  padding: 2px 6px; font-size: 11px; font-weight: 500; line-height: 16px; color: #a1a1aa; white-space: nowrap;
}
.tone-ok { border-color: rgb(var(--emerald-rgb) / .3); background: rgb(var(--emerald-rgb) / .1); color: var(--emerald-300); }
.tone-warn { border-color: rgb(var(--amber-rgb) / .3); background: rgb(var(--amber-rgb) / .1); color: var(--amber-300); }
.tone-danger { border-color: rgb(var(--red-rgb) / .3); background: rgb(var(--red-rgb) / .1); color: var(--red-300); }
.tone-info { border-color: rgb(var(--cyan-rgb) / .3); background: rgb(var(--cyan-rgb) / .1); color: var(--cyan-300); }
.tone-violet { border-color: rgb(var(--violet-rgb) / .3); background: rgb(var(--violet-rgb) / .1); color: var(--violet-300); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 9999px; background: #71717a; flex: none; }
.dot-ok { background: var(--emerald); } .dot-warn { background: var(--amber); } .dot-danger { background: var(--red); }
.dot-info { background: var(--cyan); } .dot-violet { background: var(--violet); }
.status-ok { border-left: 2px solid var(--emerald); }
.status-warn { border-left: 2px solid var(--amber); }
.status-danger { border-left: 2px solid var(--red); }
.status-info { border-left: 2px solid var(--cyan); }
.status-violet { border-left: 2px solid var(--violet); }
.status-none { border-left: 2px solid transparent; }

/* ---- segmented ---- */
.seg { display: flex; gap: 2px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(24, 24, 27, .6); padding: 2px; }
.seg-item {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; padding: 6px 12px;
  font-size: 14px; color: #a1a1aa; min-height: 40px; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.seg-item-active { background: #27272a; color: #fafafa; }
.seg-fill .seg-item { flex: 1 1 0; padding: 6px 0; }

/* ---- buttons ---- */
.btn-primary, .btn-ghost, .btn-quiet, .btn-danger-quiet, .btn-ok, .btn-warn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; padding: 8px 14px;
  min-height: 44px; font-size: 14px; font-weight: 500; white-space: nowrap; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn-primary { background: #f4f4f5; color: #18181b; }
.btn-primary:active { background: #e4e4e7; }
.btn-ghost { border: 1px solid rgba(255, 255, 255, .1); color: #e4e4e7; }
.btn-ghost:hover { border-color: rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .05); }
.btn-ghost.is-on { border-color: rgb(var(--cyan-rgb) / .3); background: rgb(var(--cyan-rgb) / .1); color: var(--cyan-300); }
.btn-quiet { color: #71717a; }
.btn-quiet:hover { color: #e4e4e7; }
.btn-danger-quiet { color: #71717a; }
.btn-danger-quiet:hover, .btn-danger-quiet:active { color: var(--red-300); }
.btn-ok { border: 1px solid rgb(16 185 129 / .3); background: rgb(16 185 129 / .1); color: #6ee7b7; }
.btn-warn { border: 1px solid rgb(249 115 22 / .3); background: rgb(249 115 22 / .1); color: #fdba74; }
.btn-sm { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---- forms ---- */
.input {
  width: 100%; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .1); background: #09090b; padding: 8px 10px;
  color: #f4f4f5; font-size: 16px; min-height: 44px; outline: none;
}
.input::placeholder { color: #52525b; }
.input:focus { border-color: rgba(255, 255, 255, .25); outline: none; }
textarea.input { min-height: 80px; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; background-image: none; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: #d4d4d8; }
.check input { width: 20px; height: 20px; accent-color: #f4f4f5; }

/* ---- meter ---- */
.meter { height: 4px; border-radius: 9999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 9999px; background: #a1a1aa; }
.meter > span.fill-warn { background: var(--amber); }
.meter > span.fill-danger { background: var(--red); }
.meter > span.fill-info { background: var(--cyan); }

/* ---- layout ---- */
.shell { min-height: 100dvh; }
.app-header {
  position: sticky; top: 0; z-index: 20; background: #09090b; border-bottom: 1px solid rgba(255, 255, 255, .06);
  padding: calc(var(--safe-top) + 8px) 16px 8px;
}
.app-header-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 8px; min-height: 32px; }
.brand { font-size: 15px; font-weight: 600; color: #fafafa; letter-spacing: -0.01em; }
.page { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 96px); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-top { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.hr { height: 1px; background: rgba(255, 255, 255, .06); border: 0; margin: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ---- bottom nav ---- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #09090b; border-top: 1px solid rgba(255, 255, 255, .06);
  padding: 6px 8px calc(var(--safe-bottom) + 6px);
}
.bottom-nav .seg { max-width: 640px; margin: 0 auto; }
.bottom-nav .seg-item { flex: 1 1 0; padding: 6px 0; font-size: 13px; min-height: 44px; text-decoration: none; }

/* ---- exercise cards + set rows ---- */
.ex-card { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ex-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: #a1a1aa; }
.dagger { color: var(--amber); font-weight: 600; }
.last-line { font-size: 13px; color: #71717a; }
.set-row { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.set-row.compact { padding: 1px 8px; }
.set-row.is-next { border-left: 2px solid var(--cyan); }
.set-row.is-done { opacity: .55; }
.set-row.is-active.is-done { opacity: 1; }
.set-compact { display: flex; align-items: center; gap: 8px; min-height: 44px; width: 100%; text-align: left; padding: 0 4px; }
.set-label { font-size: 13px; color: #a1a1aa; min-width: 44px; }
.set-value { font-size: 17px; color: #fafafa; font-variant-numeric: tabular-nums; }
.check-mark { color: var(--emerald); font-size: 15px; width: 16px; text-align: center; }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stepper { display: flex; align-items: stretch; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(24, 24, 27, .6); min-width: 0; }
.stepper-btn {
  width: 44px; min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; color: #d4d4d8; border-radius: 8px; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.stepper-btn:active { background: #27272a; }
.stepper-val {
  flex: 1 1 auto; min-width: 0; width: 100%; text-align: center; border: 0; background: transparent; color: #fafafa;
  font-size: 18px; font-variant-numeric: tabular-nums; outline: none; padding: 0;
}
.stepper-val::placeholder { color: #52525b; font-size: 14px; }
.stepper-unit { font-size: 11px; color: #71717a; text-align: center; margin-top: 2px; }
.rir-line { display: flex; gap: 8px; align-items: stretch; }
.rir-line .seg { flex: 1 1 auto; }
.rir-line .seg-item { font-size: 17px; min-height: 44px; }
.neck-toggle { min-width: 64px; }
.rir-line .seg-item.rir-band { color: var(--cyan-300); box-shadow: inset 0 -2px 0 rgb(var(--cyan-rgb) / .55); }
.rir-line .seg-item.rir-band.seg-item-active { color: #fafafa; }
.rir-line .seg-item.rir-muted { opacity: .4; }
.help-btn {
  width: 36px; height: 36px; flex: none; border-radius: 9999px; border: 1px solid rgba(255, 255, 255, .12); color: #a1a1aa;
  font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.chip.ticker { cursor: pointer; font-variant-numeric: tabular-nums; min-height: 24px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; text-align: left; }
.tile-value { font-size: 24px; font-weight: 600; color: #fafafa; font-variant-numeric: tabular-nums; line-height: 1.15; letter-spacing: -0.01em; }
.tile-sub { font-size: 12px; color: #71717a; }
.tile > .chip { align-self: flex-start; }
.hero-line { font-size: 14px; color: #a1a1aa; font-variant-numeric: tabular-nums; }
.nudge { font-size: 13px; color: var(--amber-300); }
.plates { font-size: 12px; color: #a1a1aa; }

/* ---- toggles ---- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; width: 100%; text-align: left; }
.switch { width: 44px; height: 26px; border-radius: 9999px; background: #27272a; position: relative; flex: none; border: 1px solid rgba(255, 255, 255, .1); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 9999px; background: #a1a1aa; transition: transform .15s; }
.switch.on { background: rgb(var(--cyan-rgb) / .25); border-color: rgb(var(--cyan-rgb) / .4); }
.switch.on::after { transform: translateX(18px); background: var(--cyan-300); }

/* ---- sheets ---- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; overflow-y: auto; background: #18181b; border: 1px solid rgba(255, 255, 255, .08);
  border-bottom: 0; border-radius: 12px 12px 0 0; padding: 16px 16px calc(var(--safe-bottom) + 16px);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.option { width: 100%; text-align: left; padding: 10px 12px; min-height: 52px; display: flex; flex-direction: column; gap: 2px; }
.option.is-selected { border-color: rgba(255, 255, 255, .3); background: #27272a; }

/* ---- timer + banner ---- */
.timer-bar {
  position: fixed; left: 0; right: 0; z-index: 25; bottom: calc(var(--nav-h) + var(--safe-bottom));
  padding: 0 12px 8px; pointer-events: none;
}
.timer-inner {
  pointer-events: auto; max-width: 616px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); background: #18181b;
}
.timer-tap { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; text-align: left; min-height: 44px; }
.timer-time { font-size: 22px; font-weight: 600; color: #fafafa; font-variant-numeric: tabular-nums; }
.timer-time.over { color: var(--amber); }
.rest-banner {
  position: fixed; left: 0; right: 0; top: 0; z-index: 60; padding: calc(var(--safe-top) + 14px) 16px 14px; text-align: center; width: 100%;
  background: #083344; border-bottom: 1px solid rgb(var(--cyan-rgb) / .4); color: var(--cyan-300); display: block;
}
.rest-banner .big { font-size: 24px; font-weight: 600; color: #fafafa; }

/* ---- toasts ---- */
.toasts { position: fixed; left: 0; right: 0; z-index: 70; top: calc(var(--safe-top) + 56px); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast { pointer-events: auto; max-width: 600px; width: 100%; padding: 10px 12px; border-radius: 8px; background: #27272a; border: 1px solid rgba(255, 255, 255, .1); color: #f4f4f5; font-size: 14px; }
.toast.tone-danger { background: #2a1215; } .toast.tone-ok { background: #0f2a20; } .toast.tone-warn { background: #2a2010; }

/* ---- lists, tables, charts ---- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.list-row:last-child { border-bottom: 0; }
button.list-row { width: 100%; text-align: left; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: #71717a; padding: 6px 8px; }
.table td { padding: 8px; border-top: 1px solid rgba(255, 255, 255, .05); vertical-align: top; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: #71717a; font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: #71717a; }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 4px; background: #71717a; }
.legend i.cyan { background: var(--cyan); }

/* ---- login ---- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px); }
.login-card { width: 100%; max-width: 360px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
