/* ============================================================================
   GYM PLANNER — Design System
   Dark-first. Token di :root = tema gelap (default).
   [data-theme="light"] menimpa token; mode "system" ikut prefers-color-scheme.
   Font: Barlow Condensed (display) + Barlow (body) — self-hosted.
   ========================================================================== */

@import url('/assets/fonts/barlow.css');

/* ---- 1. TOKENS ----------------------------------------------------------- */
:root {
  /* Permukaan (navy pekat — senada dengan biru merek, bukan abu netral;
     bukan hitam murni supaya tidak smear di layar OLED) */
  --bg:        #0D1117;
  --surface:   #141B24;
  --surface-2: #1B242F;
  --surface-3: #222E3B;
  --border:    #2A3949;
  --border-soft: #212D3A;

  /* Teks — #E3F2FD (Blue 50) dipakai sebagai tinta utama, jadi seluruh
     tema gelap punya rona biru yang sama, bukan putih netral yang lepas. */
  --ink:   #E3F2FD;
  --ink-2: #B3C5D6;
  --ink-3: #8A9CAF;   /* 4.90:1 di permukaan tersulit (--surface-3) */

  /* Merek: biru.
     DUA PERAN, JANGAN DITUKAR — ini yang menjaga kontras tetap lulus AA:
       --primary    = ISIAN (tombol, bar, sel heatmap). Cuma perlu 3:1.
       --primary-hi = TEKS & IKON aksen (tautan, .text-primary). Perlu 4.5:1.
     Blue 500 sebagai teks cuma dapat 4.42:1 di atas --surface-3 alias GAGAL,
     makanya teks memakai Blue 200 (7.89:1) dan Blue 500 tinggal jadi isian. */
  --primary:      #2196F3;
  --primary-hi:   #90CAF9;
  --on-primary:   #04243F;   /* teks gelap di atas isian biru: 5.06:1 walau di ujung gradien tergelap */
  --primary-wash: rgba(33, 150, 243, .14);

  /* Semantik */
  --go:        #2FC468;   /* set selesai, sukses */
  --go-wash:   rgba(47, 196, 104, .13);
  --danger:    #EF4444;
  --danger-wash: rgba(239, 68, 68, .12);
  --warn:      #EAB308;
  --warn-wash: rgba(234, 179, 8, .12);

  --ring: var(--primary);

  /* Elevasi */
  --shadow-1: 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 4px 14px -4px rgba(0,0,0,.45);
  --shadow-3: 0 16px 40px -12px rgba(0,0,0,.6);

  /* Bentuk & ruang */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* Tipografi */
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', 'Segoe UI', system-ui, sans-serif;

  /* Lapisan tetap */
  --nav-h: 64px;
  --topbar-h: 56px;

  /* Cahaya ambien (anti-monoton) — Blue 500 di satu sudut, Blue 900 di sudut
     lain: dua kutub biru yang sama supaya kedalamannya terasa tanpa warna asing. */
  --glow-a: rgba(33, 150, 243, .14);
  --glow-b: rgba(13, 71, 161, .12);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:        #F1F4F8;
  --surface:   #FFFFFF;
  --surface-2: #F6F9FC;
  --surface-3: #EAF0F6;
  --border:    #D3DEE9;
  --border-soft: #E2EAF2;

  --ink:   #101B26;
  --ink-2: #42525F;
  --ink-3: #5A6875;   /* 4.98:1 di permukaan tersulit (--surface-3) */

  /* Perannya kebalikan dari tema gelap: di latar terang justru biru TUA yang
     terbaca. Blue 500 cuma dapat 3.12:1 di atas putih — tidak pernah dipakai
     sebagai teks di sini. */
  --primary:      #0D47A1;
  --primary-hi:   #1565C0;   /* satu langkah antara Blue 500 dan Blue 900; 5.75:1 di atas putih */
  --on-primary:   #FFFFFF;   /* putih aman di kedua ujung gradien: 5.75:1 dan 8.63:1 */
  --primary-wash: #E3F2FD;   /* Blue 50 — latar pil/badge, 5.03:1 dengan --primary-hi */

  --go:      #16A34A;
  --go-wash: rgba(22, 163, 74, .1);
  --danger:  #DC2626;
  --danger-wash: rgba(220, 38, 38, .08);
  --warn:    #A16207;
  --warn-wash: rgba(161, 98, 7, .1);

  --shadow-1: 0 1px 2px rgba(16,27,38,.06);
  --shadow-2: 0 4px 14px -4px rgba(16,27,38,.12);
  --shadow-3: 0 16px 40px -12px rgba(16,27,38,.18);

  --glow-a: rgba(33, 150, 243, .10);
  --glow-b: rgba(13, 71, 161, .05);

  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]).theme-system {
    /* Salinan persis blok [data-theme="light"] di atas — kalau salah satu
       diubah, yang lain WAJIB ikut, kalau tidak mode "system" akan berbeda
       dari mode terang yang dipilih manual. */
    --bg:        #F1F4F8;
    --surface:   #FFFFFF;
    --surface-2: #F6F9FC;
    --surface-3: #EAF0F6;
    --border:    #D3DEE9;
    --border-soft: #E2EAF2;
    --ink:   #101B26;
    --ink-2: #42525F;
    --ink-3: #5A6875;
    --primary:      #0D47A1;
    --primary-hi:   #1565C0;
    --on-primary:   #FFFFFF;
    --primary-wash: #E3F2FD;
    --go:      #16A34A;
    --go-wash: rgba(22, 163, 74, .1);
    --danger:  #DC2626;
    --danger-wash: rgba(220, 38, 38, .08);
    --warn:    #A16207;
    --warn-wash: rgba(161, 98, 7, .1);
    --shadow-1: 0 1px 2px rgba(16,27,38,.06);
    --shadow-2: 0 4px 14px -4px rgba(16,27,38,.12);
    --shadow-3: 0 16px 40px -12px rgba(16,27,38,.18);
    --glow-a: rgba(33, 150, 243, .10);
    --glow-b: rgba(13, 71, 161, .05);
    color-scheme: light;
  }
}

/* ---- 2. RESET & DASAR ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* JANGAN memberi <html> warna latar. Warna body inilah yang dipakai sebagai
     latar kanvas, dan itu yang membuat lapisan cahaya `body::before` (§20)
     tampil di atasnya, bukan tertutup. */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

img, svg, video { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .015em;
  line-height: 1.05;
  margin: 0 0 var(--sp-3);
  text-wrap: balance;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; letter-spacing: .04em; }

p { margin: 0 0 var(--sp-4); }

a { color: var(--primary-hi); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

button { font-family: inherit; }

::selection { background: var(--primary); color: var(--on-primary); }

/* Angka sejajar di kolom (beban, rep, timer) */
.tnum { font-variant-numeric: tabular-nums; }

/* Teks khusus pembaca layar.
   `left: 0` BUKAN hiasan — tanpa itu elemen ini memakai posisi statisnya, yaitu
   di titik tempat ia ditulis. Kalau titik itu ada jauh di dalam tabel lebar
   (mis. <th class="act"> di kolom terakhir), ia mendarat di x=723 sementara
   layar cuma 360. Karena ia position:absolute dan blok penampungnya BUKAN
   .table-wrap, `overflow: auto` di pembungkus itu tidak ikut memotongnya —
   overflow hanya memotong keturunan yang blok penampungnya ada di dalamnya.
   Akibatnya seluruh HALAMAN jadi bisa digeser ke samping di HP.
   Dengan left: 0 ia selalu menempel tepi kiri dan tidak pernah melebarkan
   area gulir. Tidak ada dampak visual: ukurannya 1px dan sudah di-clip. */
.sr-only {
  position: absolute; left: 0; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- 3. SHELL APLIKASI --------------------------------------------------- */
.app-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--sp-4) calc(var(--nav-h) + var(--sp-6) + env(safe-area-inset-bottom));
  min-height: 100dvh;
}

@media (min-width: 900px) {
  .app-shell { max-width: 960px; }
}

.page-head { padding: var(--sp-5) 0 var(--sp-4); }
.page-title { margin-bottom: 2px; }
.page-sub { color: var(--ink-3); font-size: .92rem; margin: 0; }

/* ---- 4. TOPBAR ----------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: 0 calc(-1 * var(--sp-4));
  padding: 0 var(--sp-4);
  padding-top: env(safe-area-inset-top);
  /* Latar buram TANPA backdrop-filter: batang ini menempel saat digulir, dan
     blur di belakangnya harus dihitung ulang tiap frame — itu penyebab utama
     scroll patah-patah di perangkat ber-GPU sederhana. */
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--ink);
}
.topbar-brand .ic { color: var(--primary); }

.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* Jam live di tengah topbar */
.topbar-clock {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  pointer-events: none;
}
.clock-time {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: .05em;
}
.clock-date { font-size: .62rem; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }

/* Dropdown profil */
.dropdown { position: relative; }
.avatar-btn { border: 1px solid var(--border); cursor: pointer; padding: 0; }
.avatar-btn:hover { border-color: var(--ink-3); }
.dropdown.open .avatar-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-wash); }

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 80;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: var(--sp-2);
  display: none;
}
.dropdown.open .dropdown-menu {
  display: block;
  animation: dropdown-in .18s cubic-bezier(.16, 1, .3, 1);
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.dropdown-head {
  display: flex;
  flex-direction: column;
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--sp-2);
}
.dropdown-name { font-weight: 700; font-family: var(--font-display); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; }
.dropdown-email { font-size: .78rem; color: var(--ink-3); }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.dropdown-item .ic { color: var(--ink-3); }
.dropdown-item:hover .ic { color: var(--primary-hi); }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger .ic { color: var(--danger); }
.dropdown-item-danger:hover { background: var(--danger-wash); color: var(--danger); }
.dropdown-item-danger:hover .ic { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--border-soft); margin: var(--sp-2) var(--sp-2); }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  text-transform: uppercase;
  overflow: hidden;
  border: 1px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- 5. BOTTOM NAV + FAB -------------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);       /* lihat catatan di .topbar: tanpa blur */
  border-top: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
}

.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  color: var(--ink-3);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  transition: color .15s ease;
}
.bnav-item:hover { color: var(--ink-2); text-decoration: none; }
.bnav-item.active { color: var(--primary-hi); }
.bnav-item .ic { width: 22px; height: 22px; }

.bnav-fab {
  align-self: center;
  justify-self: center;
  width: 54px; height: 54px;
  margin-top: -26px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, var(--primary-hi), var(--primary));
  color: var(--on-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  /* Diturunkan dari --primary, bukan hex tetap: sekali warna merek diganti,
     bayangannya ikut sendiri dan tidak tertinggal di warna lama. */
  box-shadow: 0 6px 20px -4px color-mix(in srgb, var(--primary) 55%, transparent);
  transition: transform .15s ease, box-shadow .15s ease;
}
.bnav-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -6px color-mix(in srgb, var(--primary) 65%, transparent); }
.bnav-fab:active { transform: scale(.96); }
.bnav-fab .ic { width: 26px; height: 26px; }

/* ---- 6. TOMBOL ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease,
              transform .12s ease, box-shadow .15s ease, opacity .15s ease;
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(145deg, var(--primary-hi), var(--primary));
  color: var(--on-primary);
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--primary) 45%, transparent);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-go { background: var(--go); color: #08150C; }
.btn-go:hover { filter: brightness(1.08); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink-3); background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-danger { background: var(--danger-wash); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .87rem; border-radius: var(--r-sm); }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 1.05rem; border-radius: var(--r-lg); }
.btn-block { width: 100%; }

.btn-icon {
  min-width: 44px; min-height: 44px;
  padding: 0;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  color: var(--ink-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }

/* Tombol tema: matahari & bulan ditumpuk di sel grid yang sama, lalu yang
   sesuai tema aktif diputar masuk. Dipakai di topbar app, auth, dan landing. */
.theme-form { display: flex; }
.theme-toggle { position: relative; overflow: hidden; }
.theme-toggle .theme-ic {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  transition: rotate .35s cubic-bezier(.34,1.4,.64,1), opacity .2s ease, scale .35s ease;
}
.theme-toggle .ic { width: 20px; height: 20px; }
[data-theme="dark"] .theme-toggle .theme-ic-moon,
[data-theme="light"] .theme-toggle .theme-ic-sun {
  opacity: 0; rotate: -70deg; scale: .5; pointer-events: none;
}
[data-theme="dark"] .theme-toggle .theme-ic-sun,
[data-theme="light"] .theme-toggle .theme-ic-moon {
  opacity: 1; rotate: 0deg; scale: 1;
}
[data-theme="dark"] .theme-toggle:hover { color: var(--warn); }
[data-theme="light"] .theme-toggle:hover { color: var(--primary); }
@media (prefers-reduced-motion: reduce) {
  .theme-toggle .theme-ic { transition: none; rotate: none !important; scale: none !important; }
}

/* ---- 7. FORM -------------------------------------------------------------- */
.field { margin-bottom: var(--sp-4); }

.label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: var(--sp-2);
  letter-spacing: .01em;
}

.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;                /* >=16px: cegah zoom otomatis iOS */
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 90px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-wash);
}
.input[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--danger);
}

.select {
  appearance: none;
  /* var() tidak bisa masuk ke dalam url(), jadi panah ini satu-satunya warna
     yang tidak ikut token. #7C8FA3 dipilih karena terbaca di KEDUA tema
     (4.4:1 di atas putih, 4.2:1 di atas --surface-3) — sengaja abu kebiruan
     supaya senada dengan palet biru, bukan abu netral yang terasa asing. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237C8FA3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.hint { font-size: .8rem; color: var(--ink-3); margin-top: var(--sp-1); }

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--danger);
  margin-top: var(--sp-1);
}
.field-error .ic { width: 14px; height: 14px; flex: none; }

/* Nomor kecil untuk kg/rep (dipakai builder & sesi) */
.input-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding-left: 6px;
  padding-right: 6px;
}

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.switch-track {
  width: 46px; height: 27px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background .18s ease, border-color .18s ease;
}
.switch-thumb {
  position: absolute;
  top: 50%; left: 3px;
  translate: 0 -50%;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: left .18s ease, background .18s ease;
}
.switch input:checked ~ .switch-track { background: var(--primary-wash); border-color: var(--primary); }
.switch input:checked ~ .switch-thumb { left: 22px; background: var(--primary); }
.switch input:focus-visible ~ .switch-track { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Segmented control (kg/lb, bahasa, tema) */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segmented label { position: relative; }
.segmented input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 4px 16px;
  border-radius: calc(var(--r-md) - 4px);
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented input:focus-visible + span { outline: 2px solid var(--ring); }

/* ---- 8. KARTU & LIST ------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--sp-4); }
.card + .card { margin-top: var(--sp-3); }

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.card-title h3 { margin: 0; }

a.card { color: inherit; display: block; transition: border-color .15s ease, transform .15s ease; cursor: pointer; }
a.card:hover { text-decoration: none; border-color: var(--border); transform: translateY(-1px); }

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  min-height: 56px;
  border-bottom: 1px solid var(--border-soft);
  color: inherit;
}
.list-item:last-child { border-bottom: none; }
a.list-item { cursor: pointer; transition: background .15s ease; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-sub { font-size: .82rem; color: var(--ink-3); }

/* Stat tile (beranda & progres) */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: .78rem; color: var(--ink-3); margin-top: 4px; letter-spacing: .02em; }
.stat-tile .ic { color: var(--primary); margin-bottom: var(--sp-2); }

/* ---- 9. CHIP & BADGE ------------------------------------------------------ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  user-select: none;
  text-decoration: none;
}
.chip:hover { border-color: var(--ink-3); text-decoration: none; }
.chip.active {
  background: var(--primary-wash);
  border-color: var(--primary);
  color: var(--primary-hi);
}
.chip-row { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-2); scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row .chip { flex: none; }

/* Deret chip halaman Progres (partials/progress-nav.php). Dulu disalin di gaya
   masing-masing halaman; sekarang satu tempat, karena partialnya juga satu. */
.subnav { margin-bottom: var(--sp-4); }
.subnav .chip { min-height: 44px; padding-left: 16px; padding-right: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-pr { background: var(--primary); color: var(--on-primary); }
.badge-go { background: var(--go-wash); color: var(--go); }
.badge-muted { background: var(--surface-3); color: var(--ink-2); }
.badge-warn { background: var(--warn-wash); color: var(--warn); }
.badge-danger { background: var(--danger-wash); color: var(--danger); }

/* ---- 10. PAPAN MINGGU (routine builder) -----------------------------------
   Gaya papan Senin–Minggu (kelas .wk-*) tinggal di app/Views/routine/index.php
   karena hanya halaman itu yang memakainya — sama seperti halaman landing dan
   editor hari. Nomor seksi sengaja dipertahankan supaya rujukan §11 dst. tetap
   cocok dengan CONVENTIONS.md. */

/* ---- 11. MODE LATIHAN AKTIF ------------------------------------------------
   Aturan: dipakai satu tangan sambil berdiri.
   Target sentuh centang set = 56px. Angka besar, tabular-nums.
--------------------------------------------------------------------------- */
.focus-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--sp-4) calc(140px + env(safe-area-inset-bottom));
}

.focus-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  height: var(--topbar-h);
  margin: 0 calc(-1 * var(--sp-4));
  padding: 0 var(--sp-4);
  background: var(--bg);            /* lihat catatan di .topbar: tanpa blur */
  border-bottom: 1px solid var(--border-soft);
}

.workout-timer {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  color: var(--primary-hi);
}

/* Kartu gerakan dalam sesi */
.exercise-card { margin-top: var(--sp-3); }
.exercise-card .card-title h3 { font-size: 1.25rem; }
.exercise-target { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Grid set: no | terakhir | kg | rep | centang */
.set-grid {
  display: grid;
  grid-template-columns: 2rem minmax(4.4rem, 1fr) 4.4rem 4rem 56px;
  gap: var(--sp-2);
  align-items: center;
}
.set-grid-head {
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.set-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-3);
}
.set-prev {
  font-size: .8rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.set-grid .input-num { min-height: 48px; font-size: 1.05rem; }

/* Tombol centang set — 56px, di atas standar 44px */
.set-check {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
}
.set-check:active { transform: scale(.94); }
.set-check .ic { width: 24px; height: 24px; }
.set-check.done {
  background: var(--go);
  border-color: var(--go);
  color: #08150C;
}

/* Baris set selesai */
.set-row-done .input-num {
  background: var(--go-wash);
  border-color: color-mix(in srgb, var(--go) 45%, var(--border));
  color: var(--go);
}
.set-row-done .set-num { color: var(--go); }

/* Set pemanasan / dropset */
.set-type-warmup .set-num { color: var(--warn); }
.set-type-drop .set-num { color: var(--primary-hi); }

/* Bar istirahat melayang */
.rest-bar {
  position: fixed;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
  z-index: 60;
  width: min(600px, calc(100vw - var(--sp-5)));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
}
.rest-bar[hidden] { display: none; }
.rest-time {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary-hi);
  line-height: 1;
}
.rest-label { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.rest-actions { display: flex; gap: var(--sp-2); }

/* Progress bar tipis di rest bar */
.rest-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  overflow: hidden;
  background: var(--border-soft);
}
.rest-progress > span {
  display: block;
  height: 100%;
  background: var(--primary);
  transition: width 1s linear;
}

/* ---- 12. KARTU KONSISTENSI ------------------------------------------------
   Kalender sungguhan: satu bulan, angka tanggal, Senin-Minggu, judul
   "Agustus 2026", navigasi bulan lewat tautan biasa (jalan tanpa JS).
   Bentuk-bentuk sebelumnya (grid GitHub tegak, lalu diputar) sama-sama
   ditolak user karena tidak terbaca sebagai sesuatu yang nyata.            */

/* Meter target mingguan — satu rasio terhadap batas. Bukan grafik: satu nilai
   berbanding satu batas memang bentuknya meter (grafik satu batang itu salah
   bentuk). */
.cs-goal { margin-bottom: var(--sp-4); }
.cs-goal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: 6px;
}
.cs-goal-label {
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
/* Angka utama sengaja TANPA tnum: digit selebar sama bikin angka besar
   terlihat renggang. tnum hanya untuk angka yang berjajar vertikal. */
.cs-goal-value { color: var(--ink); font-size: .9rem; }
.cs-goal-value b { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.cs-goal-of { color: var(--ink-3); }

.cs-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.cs-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width .45s cubic-bezier(.16, 1, .3, 1);
}
.cs-meter-fill.is-done { background: var(--go); }
.cs-goal-note { margin: 6px 0 0; font-size: .78rem; color: var(--ink-3); }
.cs-goal-note.is-done { color: var(--go); }

/* Navigasi bulan. Fragmen #cal pada tautannya butuh scroll-margin supaya
   kartu tidak mendarat di kolong topbar yang lengket. */
#cal { scroll-margin-top: calc(var(--topbar-h, 56px) + 12px); }
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: var(--sp-4) 0 var(--sp-2);
}
.cal-title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.cal-off { opacity: .3; }

.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
  font-size: .62rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
/* Hari TANPA latihan sengaja polos — cuma angka. Kotak abu-abu untuk tiap
   hari kosong itulah yang membuat versi lama terbaca sebagai lapangan mati. */
.cal-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
}
.cal-day.is-out { opacity: .35; }
.cal-day.is-future { color: var(--ink-3); font-weight: 400; }
/* Hari ini: cincin ganda (celah 2px warna kartu + 2px biru) supaya tetap
   terlihat baik di sel polos maupun di atas isian biru penuh. */
.cal-day.is-today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }

/* Legenda ikut ramp yang sama lewat data-level. */
.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-3);
}

.cs-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
}
.cs-foot p { margin: 0; }
.heat-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: var(--ink-3);
}
.heat-legend .heat-cell { width: 11px; height: 11px; aspect-ratio: auto; }

@media (prefers-reduced-motion: reduce) {
  .cs-meter-fill { transition: none; }
}
/* TIGA level, bukan empat/lima, dan campurannya 26%/46%/100% — bukan angka
   cantik: dihitung supaya angka tanggal lolos AA di atas TIAP isian pada
   kedua tema (gelap 8.2/6.0/5.1, terang 9.8/6.7/8.6). Campuran biru tingkat
   menengah (~60-92%) adalah zona mati: teks gelap maupun terang dua-duanya
   gagal 4.5:1 di sana. Jangan menambah level tanpa mengukur ulang. */
.cal-day[data-level="1"], .heat-cell[data-level="1"] { background: color-mix(in srgb, var(--primary) 26%, var(--surface-3)); }
.cal-day[data-level="2"], .heat-cell[data-level="2"] { background: color-mix(in srgb, var(--primary) 46%, var(--surface-3)); }
.cal-day[data-level="3"], .heat-cell[data-level="3"] { background: var(--primary); }
.cal-day[data-level="1"], .cal-day[data-level="2"] { color: var(--ink); }
.cal-day[data-level="3"] { color: var(--on-primary); }

/* Ring target mingguan (SVG <circle> pakai stroke-dasharray dari server/JS) */
.ring { --size: 64px; width: var(--size); height: var(--size); }
.ring circle { fill: none; stroke-width: 6; }
.ring .ring-bg { stroke: var(--surface-3); }
.ring .ring-val { stroke: var(--primary); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }

/* ---- 13. MODAL ------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 11, 14, .66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: grid;
  place-items: end center;
  padding: var(--sp-4);
}
@media (min-width: 640px) { .modal-backdrop { place-items: center; } }
.modal-backdrop[hidden] { display: none; }

.modal {
  width: min(560px, 100%);
  max-height: min(82dvh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: modal-in .22s cubic-bezier(.16, 1, .3, 1);
}
/* Di layar kecil modal jadi lembar-bawah selebar layar penuh: lebih pas untuk
   jempol, dan tidak menyisakan ruang di kiri/kanan yang bisa membuatnya
   terlihat melenceng.
   HARUS ditulis SESUDAH aturan .modal di atas — spesifisitasnya sama, jadi
   kalau ditaruh lebih dulu justru aturan di ataslah yang menang. */
@media (max-width: 639px) {
  .modal-backdrop { padding: 0; }
  .modal {
    /* DIPAKU ke tepi viewport, bukan dipusatkan lewat grid. Elemen yang
       dipusatkan masih bisa berakhir di luar layar kalau halaman sempat bisa
       digulir mendatar; yang dipaku left:0/right:0 tidak pernah bisa. */
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: min(88dvh, 760px);
    border-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { margin: 0; }
.modal-body { padding: var(--sp-4); overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border-soft);
}

/* ---- 13b. LEMBAR PILIHAN MULAI LATIHAN ------------------------------------
   Dipakai halaman /workout/pick DAN lembar bawah dari tombol mulai. Barisnya
   sengaja setinggi 60px+: ini elemen yang ditekan sambil berdiri di gym, sering
   dengan tangan berkeringat, jadi jauh di atas ambang 44px.                    */
/* Dua tingkat jarak: renggang antar kelompok, rapat antar baris di dalamnya. */
.pick { display: flex; flex-direction: column; gap: var(--sp-4); }
.pick > [data-pick-step],
.pick > [data-pick-days] { display: flex; flex-direction: column; gap: var(--sp-2); }
/* WAJIB ada, dan HARUS sesudah aturan di atas.
   `display: none` milik [hidden] datang dari stylesheet BAWAAN browser, yang
   kalah dari aturan penulis mana pun. Tanpa baris ini, menyembunyikan tingkat
   lewat el.hidden = true memasang atributnya tapi elemennya tetap tergambar —
   dan pemeriksaan yang cuma membaca .hidden akan bilang semuanya beres. */
.pick > [data-pick-step][hidden],
.pick > [data-pick-days][hidden] { display: none; }
.pick .eyebrow { margin: var(--sp-2) 0 0; }
.pick .eyebrow:first-child { margin-top: 0; }
.pick-hint { margin: 0; font-size: .8rem; color: var(--ink-3); }
/* display:contents supaya tombol di dalam form tetap jadi anak flex langsung —
   tanpa ini tiap form jadi kotak sendiri dan jaraknya berantakan. */
.pick-form { display: contents; }

.pick-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 60px;
  padding: var(--sp-3);
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
/* text-decoration:none karena sebagian .pick-row adalah <a>: tanpa ini aturan
   a:hover menggarisbawahi teks di dalam baris yang sudah punya penanda
   hover sendiri berupa latar. */
.pick-row:hover { background: var(--surface-3); border-color: var(--border); text-decoration: none; }
.pick-row:active { transform: scale(.985); }
.pick-row:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Baris yang tidak ada isinya (kategori kosong) tetap terlihat tapi tidak bisa
   ditekan — menyembunyikannya justru bikin bingung: pengguna tahu ia punya
   kategori itu dan malah mengira daftarnya rusak. */
.pick-row:disabled { opacity: .5; cursor: not-allowed; }
.pick-row:disabled:hover { background: var(--surface-2); border-color: var(--border-soft); }

.pick-ic {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-wash);
  /* Ikon = teks, jadi --primary-hi. Memakai --primary di sini gagal AA di
     tema gelap (lihat catatan dua peran di §1). */
  color: var(--primary-hi);
}
.pick-ic-go { background: color-mix(in srgb, var(--go) 16%, transparent); color: var(--go); }

.pick-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-name {
  display: flex; align-items: center; gap: var(--sp-2);
  font-weight: 600; font-size: .95rem; line-height: 1.25;
}
/* Nama program bisa sepanjang apa pun; tanpa ini barisnya melebar dan
   mendorong tanda panah keluar layar. */
.pick-meta {
  font-size: .78rem; color: var(--ink-3); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-badge { flex: 0 0 auto; font-size: .62rem; }
.pick-arrow { flex: 0 0 auto; color: var(--ink-3); }

.pick-row-primary { background: var(--primary-wash); border-color: color-mix(in srgb, var(--primary) 38%, transparent); }
.pick-row-primary:hover { background: color-mix(in srgb, var(--primary) 20%, var(--surface-2)); }
.pick-row-primary .pick-name { color: var(--primary-hi); }

.pick-row-resume { text-decoration: none; border-color: color-mix(in srgb, var(--go) 34%, transparent); }
.pick-row-resume .pick-name { color: var(--go); }

.pick-back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 var(--sp-2) 0 4px;
  font: inherit; font-size: .85rem; font-weight: 600;
  color: var(--primary-hi);
  background: none; border: 0; border-radius: var(--r-sm);
  cursor: pointer;
}
.pick-back:hover { text-decoration: underline; }
.pick-back:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.pick-back[hidden] { display: none; }

/* Perpindahan antar tingkat: masuk dari kanan saat menyelam ke daftar hari,
   dari kiri saat kembali. Arahnya yang memberi tahu user ia ada di mana. */
@keyframes pick-in-right { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes pick-in-left  { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.pick-enter-right { animation: pick-in-right .2s cubic-bezier(.16, 1, .3, 1); }
.pick-enter-left  { animation: pick-in-left  .2s cubic-bezier(.16, 1, .3, 1); }

@media (prefers-reduced-motion: reduce) {
  .pick-row { transition: none; }
  .pick-row:active { transform: none; }
  .pick-enter-right, .pick-enter-left { animation: none; }
}

/* ---- 13c. PIL "LATIHAN SEDANG BERJALAN" (global) --------------------------
   Melayang di semua halaman app-layout selama ada sesi aktif — nyambungnya
   Dynamic Island jeda ke luar layar latihan. Ketuk untuk kembali.            */
.aw-pill {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  left: 50%;
  z-index: 60;                    /* di atas konten, di bawah modal (z-90) */
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #0B0F14;            /* nyaris hitam, apa pun temanya */
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .7);
  transform: translateX(-50%);
  animation: island-in .3s cubic-bezier(.16, 1, .3, 1);
  max-width: calc(100vw - var(--sp-4) * 2);
}
.aw-pill[hidden] { display: none; }
.aw-pill:hover { text-decoration: none; }
.aw-pill:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@keyframes island-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.9); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.aw-ring { position: relative; width: 40px; height: 40px; flex: none; }
.aw-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.aw-ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.aw-track { stroke: rgba(227, 242, 253, .16); }
.aw-value { stroke: var(--primary); transition: stroke-dashoffset .3s linear, stroke .3s ease; }
/* Ikon play di tengah cincin — muncul saat TIDAK sedang jeda (sekadar aksen). */
.aw-dot {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--primary-hi);
}
.aw-dot .ic { width: 16px; height: 16px; display: block; }
.aw-pill.is-resting .aw-dot { display: none; }   /* saat jeda: cincin progres saja */

.aw-info { display: flex; flex-direction: column; line-height: 1.02; min-width: 0; }
.aw-time { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: #E3F2FD; }
.aw-time[hidden] { display: none; }
.aw-label {
  font-size: .72rem; color: #8A9CAF;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw;
}
.aw-pill.is-resting .aw-label {
  font-size: .58rem; letter-spacing: .12em; text-transform: uppercase;
}
.aw-chev { display: grid; place-items: center; color: #8A9CAF; flex: none; }
.aw-chev .ic { display: block; }

.aw-pill.is-low .aw-value { stroke: var(--warn); }
.aw-pill.is-low .aw-time { color: var(--warn); }

@media (prefers-reduced-motion: reduce) {
  .aw-pill { animation: none; }
  .aw-value { transition: none; }
}

/* ---- 13d. ASISTEN CHAT ----------------------------------------------------
   Tombol melayang di kanan bawah + panel percakapan. Jawabannya dirakit server
   dari database sendiri, jadi ini murni lapisan tampilan.                     */

/* Tombol melayang. Duduk di atas bottom-nav, menjauh dari tombol tengahnya. */
.chat-fab {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-3));
  z-index: 55;                     /* di atas konten, di bawah panel (85) */
  display: grid;
  place-items: center;
  width: 52px;                     /* > 44px: target sentuh aman */
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 10px 24px -8px rgba(33, 150, 243, .7), var(--shadow-2);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.chat-fab[hidden] { display: none; }
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab:active { transform: scale(.94); }
.chat-fab:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.chat-fab .ic { width: 24px; height: 24px; }

/* Panel. Di ponsel memenuhi layar antara topbar dan bottom-nav; di layar lebar
   menyusut jadi kartu yang menempel di kanan bawah. */
.chat-panel {
  position: fixed;
  z-index: 85;                     /* di bawah modal (90) & toast (100) */
  left: var(--sp-4);
  right: var(--sp-4);
  top: calc(var(--topbar-h) + var(--sp-3));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-3));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .7);
  animation: chat-in .22s cubic-bezier(.16, 1, .3, 1);
}
/* [hidden] harus dipasangkan eksplisit: aturan display di atas mengalahkan
   bawaan browser (lihat CONVENTIONS.md §7d). */
.chat-panel[hidden] { display: none; }

@keyframes chat-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 560px) {
  .chat-panel {
    left: auto;
    top: auto;
    width: 380px;
    height: min(560px, calc(100dvh - var(--topbar-h) - var(--nav-h) - 48px));
  }
}

/* Kepala */
.chat-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.chat-head-icon { display: grid; place-items: center; color: var(--primary-hi); }
.chat-head-title {
  flex: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.chat-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;                     /* target sentuh penuh walau ikonnya kecil */
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.chat-icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.chat-icon-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }

/* Badan percakapan */
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.chat-empty {
  margin: auto;
  padding: var(--sp-4);
  text-align: center;
  color: var(--ink-3);
}
.chat-empty[hidden] { display: none; }
.chat-empty .ic { color: var(--primary-hi); opacity: .65; margin-bottom: var(--sp-3); }
.chat-empty-title { margin: 0; font-size: .9rem; line-height: 1.55; }

/* Gelembung. Milik pengguna rata kanan dengan rona merek; milik asisten rata
   kiri di permukaan netral — kontras arah bicara tanpa mengandalkan warna saja. */
.chat-msg { display: flex; max-width: 100%; }
.chat-msg.is-user { justify-content: flex-end; }

.chat-bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.55;
  overflow-wrap: anywhere;         /* nama gerakan panjang tidak menjebol panel */
}
.chat-msg.is-user .chat-bubble {
  border-bottom-right-radius: 4px;
  background: var(--primary-wash);
  border: 1px solid rgba(33, 150, 243, .3);
  color: var(--ink);
}
.chat-msg.is-bot .chat-bubble {
  border-bottom-left-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--ink);
}
.chat-bubble p { margin: 0 0 var(--sp-2); }
.chat-bubble p:last-child { margin-bottom: 0; }

.chat-bubble ul {
  margin: var(--sp-2) 0 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-bubble li { color: var(--ink-2); }
.chat-bubble li::marker { color: var(--primary-hi); }

/* Deret label-nilai (rekor, statistik, data badan) */
.chat-stats {
  margin: var(--sp-2) 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-soft);
}
.chat-stat:last-child { border-bottom: 0; }
.chat-stat-label { color: var(--ink-3); font-size: .82rem; }
.chat-stat-value { color: var(--ink); font-weight: 600; text-align: right; }

.chat-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--primary-hi);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}
.chat-link:hover { border-color: var(--primary); text-decoration: none; }
.chat-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Titik "sedang mengetik" */
.chat-typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: chat-dot 1.1s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: .16s; }
.chat-typing span:nth-child(3) { animation-delay: .32s; }
@keyframes chat-dot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30%           { opacity: 1;  transform: translateY(-3px); }
}

/* Saran pertanyaan */
.chat-chips {
  flex: none;
  padding: var(--sp-2) var(--sp-4) 0;
}
.chat-chips[hidden] { display: none; }
.chat-chips-label {
  display: block;
  margin-bottom: 6px;
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.chat-chips-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;                /* menggulir di dalam dirinya, bukan halaman */
  padding-bottom: var(--sp-2);
  scrollbar-width: none;
}
.chat-chips-row::-webkit-scrollbar { display: none; }
.chat-chip {
  flex: none;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: .8rem;
  white-space: nowrap;
  cursor: pointer;
}
.chat-chip:hover { border-color: var(--primary); color: var(--ink); }
.chat-chip:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Pengisian pesan */
.chat-form {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  line-height: 1.45;
  resize: none;
}
.chat-input::placeholder { color: var(--ink-3); }
.chat-input:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px var(--primary-wash); }

.chat-send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
}
.chat-send:disabled { opacity: .45; cursor: default; }
.chat-send:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .chat-panel { animation: none; }
  .chat-fab { transition: none; }
  .chat-typing span { animation: none; opacity: .6; }
}

/* ---- 14. TOAST ------------------------------------------------------------ */
.toasts {
  position: fixed;
  top: calc(var(--sp-4) + env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(420px, calc(100vw - var(--sp-6)));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: .92rem;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  animation: toast-in .25s cubic-bezier(.16, 1, .3, 1);
  pointer-events: auto;
  /* Geser ke atas untuk menutup (app.js). touch-action dimatikan supaya
     gerakan vertikal sampai ke kita, bukan diambil browser jadi gulir halaman.
     user-select mati supaya menyeret tidak malah menyorot teksnya. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  cursor: grab;
}
.toast:active { cursor: grabbing; }
.toast .ic { flex: none; }
.toast-success .ic { color: var(--go); }
.toast-error .ic { color: var(--danger); }
.toast-info .ic { color: var(--primary-hi); }
.toast.leaving { animation: toast-out .18s ease forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---- 15. TABEL ------------------------------------------------------------ */
/* position: relative menjadikan pembungkus ini blok penampung, supaya keturunan
   yang position:absolute (lihat .sr-only) ikut terpotong di sini dan tidak
   bocor menggeser seluruh halaman. Sabuk kedua setelah `left: 0` di .sr-only. */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 480px; }
.table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }

/* ---- 16. EMPTY STATE & SKELETON ------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-7) var(--sp-5);
  color: var(--ink-3);
}
.empty .ic { width: 44px; height: 44px; opacity: .5; }
.empty-title { font-weight: 600; color: var(--ink-2); font-size: 1.02rem; }
.empty p { max-width: 34ch; margin: 0; font-size: .9rem; }
.empty .btn { margin-top: var(--sp-3); }

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- 17. LAYOUT AUTH ------------------------------------------------------ */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-5) var(--sp-4);
  background:
    radial-gradient(60% 40% at 85% -10%, var(--primary-wash), transparent 70%),
    var(--bg);
}
/* Tombol tema + bahasa mengambang di pojok halaman auth */
.auth-float {
  position: absolute;
  z-index: 10;
  top: calc(env(safe-area-inset-top) + var(--sp-3));
  right: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: var(--sp-6) var(--sp-5);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--sp-5);
}
.auth-logo .ic { width: 28px; height: 28px; color: var(--primary); }
.auth-foot { text-align: center; font-size: .9rem; color: var(--ink-3); margin-top: var(--sp-4); }

/* Stepper onboarding */
.steps { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.step-dot { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-3); }
.step-dot.active { background: var(--primary); }

/* ---- 18. IKON & UTILITAS --------------------------------------------------- */
.ic { width: 20px; height: 20px; flex: none; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }

.flex { display: flex; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }

.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); }

.muted { color: var(--ink-3); }
.small { font-size: .84rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-go { color: var(--go); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary-hi); }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.divider { height: 1px; background: var(--border-soft); border: none; margin: var(--sp-4) 0; }

@media (max-width: 639px) { .hide-mobile { display: none !important; } }
@media (min-width: 640px) { .hide-desktop { display: none !important; } }

/* ---- 19. ANIMASI MAKNA ----------------------------------------------------- */
@keyframes pop {
  0% { transform: scale(.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.anim-pop { animation: pop .3s cubic-bezier(.34, 1.4, .64, 1); }

@keyframes pulse-pr {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
.anim-pr { animation: pulse-pr 1.1s ease 2; }

.stagger-in > * {
  animation: rise-in .35s cubic-bezier(.16, 1, .3, 1) backwards;
}
.stagger-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-in > *:nth-child(2) { animation-delay: 45ms; }
.stagger-in > *:nth-child(3) { animation-delay: 90ms; }
.stagger-in > *:nth-child(4) { animation-delay: 135ms; }
.stagger-in > *:nth-child(5) { animation-delay: 180ms; }
.stagger-in > *:nth-child(6) { animation-delay: 225ms; }
.stagger-in > *:nth-child(7) { animation-delay: 270ms; }
.stagger-in > *:nth-child(n+8) { animation-delay: 300ms; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---- 20. ATMOSFER & AKSEN (anti-monoton) ----------------------------------- */
/* Cahaya ambien lembut: oranye dari kanan-atas, hijau samar kiri-bawah.
   JANGAN pakai `background-attachment: fixed` di sini. Itu memaksa browser
   mengecat ulang seluruh latar viewport pada SETIAP frame gulir dan bikin
   scroll patah-patah. Lapisan tetap di bawah ini dapat layer komposit
   sendiri: digulir tanpa mengecat ulang apa pun. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(46% 32% at 90% -8%, var(--glow-a), transparent 70%),
    radial-gradient(38% 30% at -12% 106%, var(--glow-b), transparent 72%);
}

/* Judul angka besar bergradien (dipakai stat unggulan, hero, ringkasan) */
.text-gradient {
  /* Dua henti saja. Henti ketiga dulu berupa hex tetap yang lebih tua dari
     --primary; di tema gelap warna setua itu nyaris lenyap di latar navy
     (2.17:1), jadi ujung gradiennya justru menghilangkan teksnya. */
  background: linear-gradient(115deg, var(--primary-hi), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Varian kartu dengan strip aksen kiri (kartu "hari ini", PR, resume) */
.card-accent { position: relative; overflow: hidden; }
.card-accent::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary-hi), var(--primary));
}
.card-accent-go::before { background: linear-gradient(180deg, var(--go), #1E9B52); }

/* Kartu "glass" di atas area ber-glow (header profil, ringkasan) */
.card-glass {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  /* Blur kecil saja. Elemen ini ikut tergulir, jadi blur-nya dihitung ulang
     terus; 12px terasa berat di GPU sederhana, 6px hampir tak beda dilihat. */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Ikon dalam lingkaran wash berwarna — hidupkan stat & daftar fitur */
.icon-chip {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary-wash);
  color: var(--primary-hi);
}
.icon-chip-go { background: var(--go-wash); color: var(--go); }
.icon-chip-warn { background: var(--warn-wash); color: var(--warn); }

/* Bento grid — tata letak modular ukuran campur (dashboard, progres, landing) */
.bento {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(2, 1fr);
  grid-auto-flow: dense;
}
@media (min-width: 720px) { .bento { grid-template-columns: repeat(4, 1fr); } }
.bento > * { min-width: 0; margin: 0; }
.bento-2w { grid-column: span 2; }
.bento-2h { grid-row: span 2; }
@media (min-width: 720px) { .bento-3w { grid-column: span 3; } .bento-4w { grid-column: span 4; } }
@media (max-width: 719px) { .bento-3w, .bento-4w { grid-column: span 2; } }

/* Label eyebrow — pengantar seksi, huruf kecil berjarak */
.eyebrow {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary-hi);
  margin-bottom: var(--sp-1);
}

/* Titik level kesulitan (1=pemula 2=menengah 3=lanjut) */
.diff-dots { display: inline-flex; gap: 3px; align-items: center; }
.diff-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.diff-dots[data-level="1"] i:nth-child(1) { background: var(--go); }
.diff-dots[data-level="2"] i:nth-child(-n+2) { background: var(--warn); }
.diff-dots[data-level="3"] i { background: var(--danger); }

/* Peta otot tubuh — region menyala sesuai volume latihan (data-level 0-4) */
.body-map { width: 100%; max-width: 180px; height: auto; margin: 0 auto; display: block; }
.body-map .bm-base { fill: var(--surface-2); }
.body-map [data-muscle] * , .body-map [data-muscle] path { transition: fill .35s ease; }
.body-map [data-muscle] { fill: var(--surface-3); }
.body-map [data-muscle][data-level="1"] { fill: color-mix(in srgb, var(--primary) 28%, var(--surface-3)); }
.body-map [data-muscle][data-level="2"] { fill: color-mix(in srgb, var(--primary) 52%, var(--surface-3)); }
.body-map [data-muscle][data-level="3"] { fill: color-mix(in srgb, var(--primary) 76%, var(--surface-3)); }
.body-map [data-muscle][data-level="4"] { fill: var(--primary); }

/* Speedometer BMI (partials/bmi-gauge.php) — dipakai /bmi dan halaman depan.
   Warnanya membentuk huruf U: kedua ujung berisiko, tengahnya sehat. Itu memang
   gambaran medisnya — terlalu kurus sama tidak amannya dengan terlalu berat.
   Warna TIDAK pernah jadi satu-satunya penanda: tiap pita selalu punya kembaran
   tertulis di legenda, dan hasilnya disebut dengan kata, bukan cuma warna. */
.gauge { width: 100%; max-width: 340px; margin: 0 auto; }
.gauge-svg { display: block; width: 100%; height: auto; }
/* Tiap pita menetapkan `stroke` (untuk busur SVG) DAN `color` (agar kotak kecil
   di legenda bisa memakai currentColor) — satu warna, satu tempat. */
.g-track { stroke: var(--surface-3); }
.g-under  { stroke: var(--warn); color: var(--warn); }
.g-normal { stroke: var(--go);   color: var(--go); }
.g-over   { stroke: var(--warn); color: var(--warn); }
.g-obese1 { stroke: color-mix(in srgb, var(--danger) 55%, var(--warn)); color: color-mix(in srgb, var(--danger) 55%, var(--warn)); }
.g-obese2 { stroke: var(--danger); color: var(--danger); }
.g-tick {
  fill: var(--ink-3);
  font-family: var(--font-body);
  font-size: 8.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.g-needle line { stroke: var(--ink); }
.g-hub { fill: var(--ink); stroke: var(--surface); stroke-width: 3; }
/* transform-box: view-box membuat titik putar dihitung dalam satuan viewBox,
   jadi 100/104 di bawah ini adalah titik pusat busur apa pun ukuran layarnya. */
.g-needle {
  transform-box: view-box;
  transform-origin: 100px 104px;
  /* Sedikit melewati sasaran lalu balik — begitulah jarum sungguhan bergerak.
     Lampauannya sengaja kecil supaya di ujung skala tidak keluar dari busur. */
  transition: transform 1.1s cubic-bezier(.28, 1.14, .38, 1);
}
/* Dipasang sesaat oleh JS untuk memulangkan jarum ke titik nol tanpa terlihat,
   sebelum sapuannya dimulai. */
.g-needle.is-instant { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .g-needle { transition: none; }
}
.gauge-ends {
  display: flex;
  justify-content: space-between;
  margin: -6px 6px 0;
  font-size: .72rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Legenda pita — kembaran tertulis dari warna busur di atasnya. */
.gauge-legend { display: grid; gap: 4px; margin-top: var(--sp-4); }
.gauge-legend-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-2);
  border-radius: var(--r-sm);
  font-size: .82rem;
}
.gauge-legend-row.is-active { background: var(--surface-2); font-weight: 700; }
.gauge-legend-row i { flex: none; width: 12px; height: 12px; border-radius: 4px; background: currentColor; }
.gauge-legend-row .rng { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 400; }
.gauge-legend-row.is-active .rng { color: var(--ink-2); }

/* Bar XP / level */
.xp-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.xp-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-hi), var(--primary));
  transition: width .6s cubic-bezier(.16, 1, .3, 1);
}
.level-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-wash);
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
  color: var(--primary-hi);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Visual plat barbel (kalkulator plat) */
.plate-viz { display: flex; align-items: center; gap: 2px; min-height: 64px; }
.plate-viz .bar { height: 8px; background: var(--ink-3); border-radius: 4px; flex: 1; min-width: 24px; }
.plate-viz .plate {
  width: 12px;
  border-radius: 3px;
  background: var(--primary);
  border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
}
.plate-viz .plate[data-kg="25"] { height: 64px; background: #DC2626; }
.plate-viz .plate[data-kg="20"] { height: 60px; background: #2563EB; }
.plate-viz .plate[data-kg="15"] { height: 52px; background: #EAB308; }
.plate-viz .plate[data-kg="10"] { height: 44px; background: #16A34A; }
.plate-viz .plate[data-kg="5"]  { height: 34px; background: #E7EDF2; }
.plate-viz .plate[data-kg="2.5"] { height: 26px; background: var(--ink-3); }
.plate-viz .plate[data-kg="1.25"] { height: 20px; background: var(--surface-3); }

/* Swipe hint pada baris set (geser kanan = selesai) */
.set-swipe { position: relative; touch-action: pan-y; }
.set-swipe.swiping { transition: none; }
.set-swipe.swipe-return { transition: transform .2s ease; }

/* Konfeti perayaan PR (partikel dibuat Gym.celebrate()) */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  overflow: hidden;
}
.celebrate i {
  position: absolute;
  top: -12px;
  width: 8px; height: 14px;
  border-radius: 2px;
  animation: confetti-fall var(--dur, 1.4s) cubic-bezier(.25,.4,.6,1) forwards;
}
@keyframes confetti-fall {
  to {
    transform: translate3d(var(--tx, 0), 105vh, 0) rotate(var(--rot, 540deg));
    opacity: .9;
  }
}

/* Kilau halus saat hover tombol utama */
@media (hover: hover) {
  .btn-primary { position: relative; overflow: hidden; }
  .btn-primary::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent);
    transform: skewX(-18deg);
    transition: left .45s ease;
  }
  .btn-primary:hover::after { left: 120%; }
}

/* ---- 21. CETAK (ringkasan sesi) -------------------------------------------- */
@media print {
  .topbar, .bottom-nav, .rest-bar, .toasts { display: none !important; }
  body::before { display: none; }          /* lapisan cahaya ambien */
  body { background: #fff; color: #000; }
}
