/* ==========================================================================
   Gym - mobile first design system
   Type scale : 11 12 13 15 17 20 26 34      Weights: 400 600 700
   Radii      : 10 (controls) 16 (cards) 24 (hero/sheet) 999 (pills)
   Heights    : 32 40 48 56 64
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg:        #0B0D10;
  --bg-elev:   #14181D;
  --bg-elev-2: #1B2027;
  --bg-input:  #0E1216;
  --line:      #2A323C;   /* decorative edges */
  --line-ctl:  #5A6472;   /* control boundaries - meets 3:1 on cards */
  --line-soft: #1D2229;

  --txt:   #EDF0F3;
  --txt-2: #A8B2BE;
  --txt-3: #8A94A0;

  --accent:      #4ADE80;
  --accent-text: #4ADE80;
  --accent-ink:  #0B0D10;
  --accent-soft: rgba(74, 222, 128, .14);
  --accent-line: rgba(74, 222, 128, .40);

  --pos:    #4ADE80;
  --neg:    #F87171;
  --danger: #F87171;
  --warn:   #FBBF24;

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;

  --pad: 16px;
  --tap: 48px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 62px;
  --offbar-h: 0px;
  --kb-h: 0px;

  --shadow: 0 10px 34px rgba(0,0,0,.5);
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button, .tick, .step, .exdot, .daychip, .list-item, .pick-card, .nav button {
  touch-action: manipulation;   /* no double-tap zoom, so no phantom second click */
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body { min-height: 100dvh; }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
::-webkit-scrollbar { width: 0; height: 0; }

/* focus - one rule, everywhere */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}
.field .val:focus-visible, .formrow input:focus-visible,
.formrow textarea:focus-visible, .notefield:focus-visible { outline-offset: -3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* the single overline token */
.over, .section-h h2, .hero .eyebrow, .exhead .blk, .stat .k,
.daychip .n, .formrow label, .fieldwrap .cap {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--txt-3);
}

/* ------------------------------------------------------------- lock page -- */

.lock { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.lock-card { width: 100%; max-width: 360px; text-align: center; background: var(--bg-elev);
             border: 1px solid var(--line); border-radius: var(--r-l); padding: 32px 24px; }
.lock-logo { font-size: 34px; margin-bottom: 8px; }
.lock-card h1 { font-size: 20px; margin: 0 0 6px; font-weight: 700; }
.lock-card p { color: var(--txt-2); margin: 0 0 20px; font-size: 15px; }
.lock-card input { width: 100%; height: 56px; padding: 0 16px; border-radius: var(--r-s);
                   border: 1px solid var(--line-ctl); background: var(--bg-input);
                   font-size: 17px; text-align: center; }
.lock-card button, .lock-btn { display: flex; align-items: center; justify-content: center;
  width: 100%; height: 56px; margin-top: 12px; border-radius: var(--r-s);
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px; }
.lock-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* --------------------------------------------------------------- layout -- */

.screen { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.screen.no-nav { padding-bottom: calc(var(--safe-b) + 24px); }
body.has-rest .screen { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 104px); }
body.has-rest .screen.no-nav { padding-bottom: calc(var(--safe-b) + 104px); }

.topbar {
  position: sticky; top: var(--offbar-h); z-index: 40;
  padding: calc(var(--safe-t) + 10px) var(--pad) 10px;
  background: rgba(11,13,16,.85);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 8px; min-height: 56px;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.topbar .sub { font-size: 12px; color: var(--txt-2); margin-top: 1px; }
.topbar .grow { flex: 1; min-width: 0; }
.topbar.centered h1 { text-align: center; }

.icon-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%;
  display: grid; place-items: center; color: var(--txt-2);
  flex: 0 0 auto; transition: background .15s;
}
.icon-btn:active { background: var(--bg-elev-2); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.spacer { pointer-events: none; opacity: 0; }

.body { padding: 16px var(--pad) 0; }
.section-h { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; min-height: 24px; }
.section-h h2 { margin: 0; }
.section-h .link { margin-left: auto; font-size: 13px; color: var(--accent-text);
                   font-weight: 600; padding: 10px 4px; }

.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px; }
.card + .card { margin-top: 12px; }
.card-tight { padding: 14px; }

.muted { color: var(--txt-2); }
.dim { color: var(--txt-3); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.tiny { font-size: 12px; }
.big-num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }

/* --------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 20px; border-radius: var(--r-s);
  background: var(--bg-elev-2); color: var(--txt); font-weight: 600; font-size: 15px;
  border: 1px solid var(--line-ctl); transition: transform .1s var(--ease), opacity .15s;
}
.btn:active { transform: scale(.975); }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.btn-ghost { background: transparent; border-color: var(--line-ctl); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--txt-2); height: 48px; }
.btn-danger { background: transparent; color: var(--danger); border-color: transparent; height: 48px; font-weight: 600; }
.btn-lg { height: 64px; font-size: 17px; border-radius: var(--r-m); }
.btn-sm { height: 40px; font-size: 13px; padding: 0 14px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------- profiles -- */

.pick { min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end;
        padding: calc(var(--safe-t) + 40px) 20px calc(var(--safe-b) + 48px); }
.pick .mark { width: 56px; height: 56px; border-radius: var(--r-m); background: var(--accent-soft);
              display: grid; place-items: center; color: var(--accent-text); margin-bottom: 20px; }
.pick .mark svg { width: 30px; height: 30px; }
.pick h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 700; }
.pick p { color: var(--txt-2); margin: 0 0 28px; }
.pick-grid { display: grid; gap: 12px; }
.pick-card {
  display: flex; align-items: center; gap: 16px; text-align: left; min-height: 96px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 18px; transition: transform .12s var(--ease);
}
.pick-card:active { transform: scale(.98); }
.pick-av { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
           font-size: 26px; font-weight: 700; flex: 0 0 auto; }
.pick-card .nm { font-size: 20px; font-weight: 700; }
.pick-card .mt { font-size: 13px; color: var(--txt-2); margin-top: 2px;
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ today hero -- */

.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(158deg, var(--accent-soft), transparent 62%), var(--bg-elev);
  border: 1px solid var(--accent-line); border-radius: var(--r-l); padding: 20px;
}
.hero .eyebrow { color: var(--accent-text); }
.hero h2 { font-size: 26px; margin: 6px 0 2px; letter-spacing: -.02em; font-weight: 700; }
.hero .sub { color: var(--txt-2); font-size: 13px; }
.hero .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }

.pill { text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center;
        gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
        background: var(--bg-elev-2); border: 1px solid var(--line); font-size: 12px;
        color: var(--txt-2); font-weight: 600; }
.pill.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.pill svg { width: 15px; height: 15px; }
a.pill { height: 40px; }

.daystrip { display: flex; gap: 8px; overflow-x: auto; padding: 2px var(--pad) 6px;
            margin: 0 calc(var(--pad) * -1); scroll-snap-type: x proximity; }
.daychip {
  flex: 0 0 auto; min-width: 124px; scroll-snap-align: start;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 12px 14px; text-align: left; transition: border-color .15s, background .15s;
}
.daychip .t { font-size: 15px; font-weight: 600; margin-top: 4px; }
.daychip .c { font-size: 12px; color: var(--txt-3); margin-top: 3px; }
.daychip.on { border-color: var(--accent-line); background: var(--accent-soft); }
.daychip.on .t { color: var(--accent-text); }
.daychip.on .n { color: var(--accent-text); }

/* --------------------------------------------------------------- lists --- */

.list { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.list-item { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 14px;
             padding: 12px 16px; width: 100%; text-align: left;
             border-bottom: 1px solid var(--line-soft); min-height: 64px; }
.list-item:last-child { border-bottom: 0; }
.list-item:active { background: var(--bg-elev-2); }
.list-item .t { font-weight: 600; font-size: 15px; color: var(--txt); }
.list-item .s { font-size: 12px; color: var(--txt-2); margin-top: 2px; }
.list-item .chev { color: var(--txt-3); flex: 0 0 auto; }
.list-item .chev svg, .chev svg { width: 18px; height: 18px; display: block; }
.list-item.disabled { opacity: .45; pointer-events: none; }

.badge { display: inline-grid; place-items: center; min-width: 40px; height: 40px; border-radius: var(--r-s);
         background: var(--bg-elev-2); font-weight: 700; font-size: 13px; flex: 0 0 auto; color: var(--txt-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge svg { width: 20px; height: 20px; }

.empty { text-align: center; padding: 40px 20px; color: var(--txt-3); }
.empty .ic { width: 56px; height: 56px; border-radius: var(--r-m); background: var(--bg-elev-2);
             display: grid; place-items: center; margin: 0 auto 14px; color: var(--txt-3); }
.empty .ic svg { width: 26px; height: 26px; }
.empty .t { color: var(--txt-2); font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.empty .s { font-size: 13px; }
.empty-tall { min-height: 380px; display: grid; place-content: center; }

/* -------------------------------------------------------------- statbar -- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-m); padding: 13px 12px; }
.sheet .stat, .sheet .list, .sheet .card { background: var(--bg-elev-2); }
.stat .v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.stat .v.none { color: var(--txt-3); font-weight: 400; }
.stat .k { margin-top: 3px; display: block; }
.up { color: var(--pos); } .down { color: var(--neg); }

/* ----------------------------------------------------------- bottom nav -- */

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(11,13,16,.92);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line-soft);
}
.nav button { position: relative; display: flex; flex-direction: column; align-items: center;
              justify-content: center; gap: 3px; color: var(--txt-2); font-size: 11px; font-weight: 600; }
.nav button svg { width: 23px; height: 23px; }
.nav button.on { color: var(--accent-text); }
.nav button.on::before { content: ""; position: absolute; top: 3px; width: 22px; height: 3px;
                         border-radius: 2px; background: var(--accent); }

/* ------------------------------------------------------------- workout --- */

.wk-top {
  position: sticky; top: var(--offbar-h); z-index: 45;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  background: rgba(11,13,16,.9);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.wk-top .line { display: flex; align-items: center; gap: 8px; }
.wk-top .ttl { font-size: 15px; font-weight: 700; }
.wk-top .tm { font-size: 12px; color: var(--txt-2); }
.wk-prog { height: 3px; border-radius: 2px; background: var(--line); margin: 8px 4px 2px; overflow: hidden; }
.wk-prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px;
             transition: width .35s var(--ease); }

.exstrip { display: flex; gap: 6px; overflow-x: auto; padding: 10px 4px 4px; }
.exdot {
  flex: 0 0 auto; min-width: 44px; height: 44px; border-radius: var(--r-s);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--bg-elev); border: 1px solid var(--line-ctl); color: var(--txt-2);
  position: relative;
}
.exdot.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.exdot.done { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.exdot.done::after { content: "\2713"; position: absolute; bottom: -2px; right: 3px; font-size: 10px; }
.exdot.part::after { content: "\2022"; position: absolute; bottom: 0; right: 5px; font-size: 15px; color: var(--warn); }
.exdot.skip { opacity: .55; text-decoration: line-through; }

.exhead { padding: 16px var(--pad) 0; }
.exhead h2 { font-size: 26px; margin: 5px 0 0; letter-spacing: -.02em; line-height: 1.15; font-weight: 700; }
.exhead .tgt { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.exhead .last { margin-top: 10px; font-size: 13px; color: var(--txt-2); }
.exhead .swapped { margin-top: 8px; font-size: 12px; color: var(--warn); }

.sets { padding: 14px var(--pad) 0; display: flex; flex-direction: column; gap: 10px; }
.setrow {
  display: grid; grid-template-columns: 1fr 1fr 56px; gap: 8px; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-m); padding: 14px 10px 10px;
  transition: border-color .2s, background .2s, opacity .2s;
}
.setrow.next { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.setrow.done { opacity: .6; }
.setmeta .idx { font-weight: 700; color: var(--txt-3); font-size: 12px; letter-spacing: .04em; }
.setrow.done .setmeta .idx { color: var(--accent-text); }
.setrow.time { grid-template-columns: 1fr 56px; }

.fieldwrap { position: relative; }
.fieldwrap .cap { position: absolute; top: -8px; left: 12px; background: var(--bg-elev);
                  padding: 0 5px; border-radius: 4px; }
.field { background: var(--bg-input); border: 1px solid var(--line-ctl); border-radius: var(--r-s);
         display: flex; align-items: center; overflow: hidden; height: 56px; }
.field .step { width: 40px; height: 100%; display: grid; place-items: center; color: var(--txt-2);
               font-size: 22px; font-weight: 600; flex: 0 0 auto; }
.field .step:active { background: var(--bg-elev-2); color: var(--accent-text); }
.field .val { flex: 1; min-width: 0; height: 100%; text-align: center; background: none; border: 0;
              font-size: 17px; font-weight: 700; padding: 0; width: 100%; }
.field .val.suggested { color: var(--txt-3); font-weight: 600; }
.field .val::-webkit-outer-spin-button, .field .val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.tick {
  width: 56px; height: 56px; border-radius: var(--r-s); display: grid; place-items: center;
  background: transparent; border: 2px solid var(--accent-line); color: var(--accent-text);
  transition: transform .12s var(--ease), background .2s;
}
.tick svg { width: 24px; height: 24px; }
.tick:active { transform: scale(.92); }
.tick.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }

.setmeta { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; padding: 2px 2px 0;
           min-height: 18px; }
.setmeta .ghost { font-size: 12px; color: var(--txt-3); }
.setmeta .pr { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--accent-ink);
               background: var(--accent); padding: 2px 8px; border-radius: 999px; }
.setmeta .tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--warn);
                border: 1px solid rgba(251,191,36,.4); padding: 1px 8px; border-radius: 999px; }

.exfoot { padding: 16px var(--pad) 24px; display: flex; flex-direction: column; gap: 10px; }
.exfoot .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.notefield, .sheet textarea { width: 100%; background: var(--bg-input); border: 1px solid var(--line-ctl);
  border-radius: var(--r-s); padding: 12px 14px; min-height: 56px; resize: vertical; font-size: 15px; }

/* --------------------------------------------------------- rest timer ---- */

.rest {
  position: fixed; left: 12px; right: 12px; z-index: 60;
  bottom: calc(var(--safe-b) + 12px);
  background: var(--bg-elev-2); border: 1px solid var(--accent-line); border-radius: var(--r-m);
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow);
  animation: slideup .28s var(--ease);
}
body.with-nav .rest { bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }
body.kb-open .rest, body.kb-open .nav, body.kb-open .toast-host { display: none; }
@keyframes slideup { from { transform: translateY(120%); opacity: 0 } to { transform: none; opacity: 1 } }
.rest .ring { width: 44px; height: 44px; flex: 0 0 auto; position: relative; }
.rest .ring svg { transform: rotate(-90deg); }
.rest .ring .t { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.rest .lb { font-size: 12px; color: var(--txt-2); min-width: 0; }
.rest .lb b { display: block; color: var(--txt); font-size: 15px; font-weight: 600; }
.rest .lb span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rest .acts { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }
.rest .acts button { padding: 0 12px; height: 44px; border-radius: var(--r-s); background: var(--bg-elev);
                     border: 1px solid var(--line-ctl); font-size: 13px; font-weight: 600; }
.rest.over { border-color: var(--warn); }

/* -------------------------------------------------------------- charts --- */

.chart { width: 100%; display: block; }
.chart-wrap { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-m);
              padding: 16px 10px 10px; }
.chart-empty { height: 150px; display: grid; place-items: center; color: var(--txt-3); font-size: 13px; }

.segmented { display: flex; gap: 4px; background: var(--bg-elev); border: 1px solid var(--line);
             border-radius: 12px; padding: 4px; }
.segmented button { flex: 1; height: 40px; border-radius: 8px; font-size: 13px; font-weight: 600;
                    color: var(--txt-2); }
.segmented button.on { background: var(--accent-soft); color: var(--accent-text);
                       box-shadow: inset 0 0 0 1px var(--accent-line); }

/* --------------------------------------------------------------- sheet --- */

.scrim { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.65);
         animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
  background: var(--bg-elev); border-top-left-radius: var(--r-l); border-top-right-radius: var(--r-l);
  border-top: 1px solid var(--line);
  padding: 8px var(--pad) calc(var(--safe-b) + 20px);
  max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: sheetup .3s var(--ease);
}
@keyframes sheetup { from { transform: translateY(100%) } to { transform: none } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-ctl); margin: 4px auto 8px; }
.sheet .sh-top { display: flex; align-items: flex-start; gap: 8px; }
.sheet h3 { font-size: 20px; margin: 8px 0 4px; font-weight: 700; flex: 1; }
.sheet .sh-sub { color: var(--txt-2); font-size: 13px; margin: 0 0 18px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }

.formrow { margin-bottom: 14px; }
.formrow label { display: block; margin-bottom: 6px; }
.formrow input, .formrow select, .formrow textarea {
  width: 100%; height: 56px; background: var(--bg-input); border: 1px solid var(--line-ctl);
  border-radius: var(--r-s); padding: 0 14px; font-size: 17px;
}
.formrow textarea { height: auto; padding: 14px; font-size: 15px; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.optrow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.optrow:last-child { border-bottom: 0; }
.optrow .t { font-weight: 600; font-size: 15px; }
.optrow .s { font-size: 12px; color: var(--txt-2); margin-top: 2px; }

.switch { width: 52px; height: 32px; border-radius: 999px; background: var(--bg-elev-2);
          border: 1px solid var(--line-ctl); position: relative; flex: 0 0 auto; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
            background: var(--txt-2); transition: transform .2s var(--ease), background .2s; }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on i { transform: translateX(20px); background: #fff; }

/* -------------------------------------------------------------- toasts --- */

.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
              z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px;
              pointer-events: none; padding: 0 16px; }
.toast { background: var(--bg-elev-2); border: 1px solid var(--line-ctl); border-radius: 999px;
         padding: 12px 18px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
         animation: toastin .25s var(--ease); max-width: 100%; text-align: center; }
.toast.good { border-color: var(--accent-line); color: var(--accent-text); }
.toast.bad  { border-color: rgba(248,113,113,.45); color: var(--danger); }
@keyframes toastin { from { transform: translateY(12px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ------------------------------------------------------------- offline --- */

.offbar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; text-align: center;
          padding: calc(var(--safe-t) + 7px) 12px 7px; font-size: 12px; font-weight: 600;
          background: rgba(251,191,36,.16); color: var(--warn); border-bottom: 1px solid rgba(251,191,36,.32); }

/* ------------------------------------------------------------ skeleton --- */

.sk { background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-elev-2) 37%, var(--bg-elev) 63%);
      background-size: 400% 100%; animation: shine 1.2s ease infinite; border-radius: var(--r-m); }
@keyframes shine { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }

/* ------------------------------------------------------------ utility ---- */

.sp8 { height: 8px } .sp12 { height: 12px } .sp16 { height: 16px } .sp24 { height: 24px }
.fade-in { animation: fadein .25s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (min-width: 620px) {
  .screen, .nav, .toast-host { max-width: 560px; margin-left: auto; margin-right: auto; }
  .nav { left: 50%; transform: translateX(-50%); border-left: 1px solid var(--line-soft);
         border-right: 1px solid var(--line-soft); border-top-left-radius: 18px; border-top-right-radius: 18px; }
  .sheet { max-width: 560px; left: 50%; transform: translateX(-50%); }
  .rest { max-width: 536px; left: 50%; transform: translateX(-50%); }
}
