/* ==========================================================================
   FitForge — styled after the Airbnb Design System (DLS)
   Brand: Rausch #FF385C · Babu #00A699 · Arches #FC642D
   Airbnb Cereal is proprietary, so the type stack falls back to the platform
   UI sans (SF on Apple, Segoe on Windows, Roboto on Android) which carries the
   same geometric, high-x-height feel.
   ========================================================================== */

:root {
  color-scheme: light;

  /* --- brand */
  --rausch:        #FF385C;
  --rausch-dark:   #D70466;
  --rausch-tint:   #FFF8F9;
  --rausch-soft:   #FFE1E7;
  --babu:          #00A699;
  --babu-soft:     #D6F2EF;
  --arches:        #FC642D;

  /* --- surfaces */
  --surface-1:     #FFFFFF;   /* cards */
  --plane:         #F7F7F7;   /* page */
  --surface-2:     #F7F7F7;   /* insets */
  --surface-3:     #EBEBEB;

  /* --- ink */
  --text-primary:  #222222;
  --text-secondary:#717171;
  --text-muted:    #B0B0B0;

  /* --- lines */
  --border:        #DDDDDD;
  --border-strong: #222222;
  --divider:       #EBEBEB;
  --grid:          #EBEBEB;
  --axis:          #DDDDDD;

  /* --- data viz (validated: adjacent CVD ΔE 10.9, normal ΔE 34.4, both modes) */
  --series-1:      #FF385C;
  --series-2:      #00A699;
  --series-1-soft: #FFE1E7;
  --series-2-soft: #D6F2EF;

  /* --- status */
  --good:          #008A05;
  --good-ink:      #008A05;
  --warning:       #FFB400;
  --serious:       #FC642D;
  --critical:      #C13515;

  /* --- shape */
  --radius-sm:  8px;
  --radius:    12px;
  --radius-lg: 16px;
  --pill:     999px;

  /* --- elevation (DLS: soft, wide, low opacity) */
  --shadow:       0 1px 2px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-hover: 0 2px 4px rgba(0,0,0,.10), 0 8px 24px rgba(0,0,0,.10);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          system-ui, "Noto Sans", sans-serif;

  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1:     #1C1C1E;
    --plane:         #000000;
    --surface-2:     #2C2C2E;
    --surface-3:     #3A3A3C;
    --text-primary:  #FFFFFF;
    --text-secondary:#A8A8A8;
    --text-muted:    #6E6E73;
    --border:        #3A3A3C;
    --border-strong: #FFFFFF;
    --divider:       #2C2C2E;
    --grid:          #2C2C2E;
    --axis:          #3A3A3C;
    --rausch-tint:   #2A1319;
    --rausch-soft:   #4A1626;
    --series-1-soft: #4A1626;
    --series-2-soft: #0C3B37;
    --babu-soft:     #0C3B37;
    --good-ink:      #34C759;
    --shadow:        0 1px 2px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.4);
    --shadow-hover:  0 2px 6px rgba(0,0,0,.6), 0 10px 28px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:#1C1C1E; --plane:#000; --surface-2:#2C2C2E; --surface-3:#3A3A3C;
  --text-primary:#fff; --text-secondary:#A8A8A8; --text-muted:#6E6E73;
  --border:#3A3A3C; --border-strong:#fff; --divider:#2C2C2E; --grid:#2C2C2E; --axis:#3A3A3C;
  --rausch-tint:#2A1319; --rausch-soft:#4A1626;
  --series-1-soft:#4A1626; --series-2-soft:#0C3B37; --babu-soft:#0C3B37;
  --good-ink:#34C759;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.4);
  --shadow-hover: 0 2px 6px rgba(0,0,0,.6), 0 10px 28px rgba(0,0,0,.5);
}

/* ================================================================= base == */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--plane);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.022em; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }
p { margin: 0 0 .6em; }
a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* =============================================================== layout == */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--divider);
  padding: 24px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 10px 20px; }
.brand strong { font-size: 1.3rem; letter-spacing: -.03em; color: var(--rausch); font-weight: 800; }
.brand span { font-size: .72rem; color: var(--text-secondary); }

.navlink {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
  font-size: .92rem; font-weight: 600; border: 0; background: none;
  cursor: pointer; width: 100%; text-align: left; min-height: 44px;
}
.navlink:hover { background: var(--surface-2); color: var(--text-primary); }
.navlink[aria-current="page"] { background: var(--rausch-tint); color: var(--rausch); }
.navlink .ico { width: 20px; text-align: center; font-size: 1.05rem; }
.nav-spacer { flex: 1; }
.nav-more { display: none; }

.main { padding: 32px 40px 96px; max-width: 1200px; }
.view-head { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-head .sub { color: var(--text-secondary); font-size: .92rem; margin-top: 6px; }

.mobile-bar { display: none; }

/* ================================================================ cards == */
.card {
  background: var(--surface-1);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: inline-flex; align-items: center; }
.hico { margin-right: 9px; font-size: 1.05em; line-height: 1; }
.grid { display: grid; gap: 18px; align-items: start; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ================================================================= bits == */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 600; padding: 5px 11px;
  border-radius: var(--pill); background: var(--surface-1);
  color: var(--text-secondary); border: 1px solid var(--border);
  white-space: nowrap;
}
.tag.blue { background: var(--rausch-tint); color: var(--rausch); border-color: var(--rausch-soft); }
.tag.good { color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 42%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.tag.warn { color: var(--text-primary); border-color: color-mix(in srgb, var(--warning) 70%, transparent); background: color-mix(in srgb, var(--warning) 16%, transparent); }
.tag.bad  { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.tag.tiny { font-size: .68rem; padding: 3px 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-1);
  color: var(--text-primary); cursor: pointer; font-size: .9rem; font-weight: 600;
  min-height: 44px; transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(to right, #E61E4D 0%, #E31C5F 50%, #D70466 100%);
  border-color: transparent; color: #fff;
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: var(--shadow-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn.danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.btn.sm { padding: 8px 14px; font-size: .82rem; min-height: 36px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

input[type=text], input[type=number], input[type=date], input[type=time], select, textarea {
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-1);
  width: 100%; font-size: 16px;      /* 16px stops iOS zooming on focus */
  min-height: 44px;
}
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--rausch); }
input:focus-visible, select:focus-visible, textarea:focus-visible,
.btn:focus-visible, .navlink:focus-visible, .cal-day:focus-visible {
  outline: 2px solid var(--border-strong); outline-offset: 2px;
}
input:focus, textarea:focus, select:focus { border-color: var(--text-primary); outline: none; }
label.field { display: block; font-size: .8rem; color: var(--text-primary); font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.nums { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.empty { padding: 32px; text-align: center; color: var(--text-secondary); font-size: .9rem; }

/* ================================================================ stats == */
.stat { background: var(--surface-1); border: 1px solid var(--divider); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); font-weight: 700; }
.stat .value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; line-height: 1.05; }
.stat .value small { font-size: .9rem; font-weight: 600; color: var(--text-secondary); margin-left: 4px; }
.stat .foot { font-size: .8rem; color: var(--text-secondary); margin-top: 7px; }
.delta { font-weight: 600; font-size: .82rem; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical); }
.delta.flat { color: var(--text-secondary); }

/* =============================================================== meters == */
.meter { margin-bottom: 16px; }
.meter:last-child { margin-bottom: 0; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; margin-bottom: 7px; }
.meter-top b { font-weight: 700; font-size: .95rem; }
.meter-track { height: 8px; background: var(--surface-3); border-radius: var(--pill); overflow: hidden; position: relative; }
.meter-fill { height: 100%; border-radius: var(--pill); background: var(--text-primary); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.meter-fill.done { background: var(--good); }
.meter-fill.over { background: var(--warning); }
.meter-target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text-primary); opacity: .55; }

/* ================================================================ lists == */
.list { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--divider); }
.list-row { background: var(--surface-1); padding: 14px 16px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--divider); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; font-size: .92rem; }
.list-row .meta { font-size: .82rem; color: var(--text-secondary); margin-top: 1px; }
.clickable { cursor: pointer; }

table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--divider); }
table.data td { padding: 10px; border-bottom: 1px solid var(--divider); font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================= calendar == */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); font-weight: 700; text-align: center; padding-bottom: 6px; }
.cal-day {
  min-height: 88px; border-radius: var(--radius); border: 1px solid var(--divider);
  background: var(--surface-1); padding: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cal-day:hover { border-color: var(--text-primary); box-shadow: var(--shadow); }
.cal-day.blank { background: transparent; border-color: transparent; cursor: default; box-shadow: none; }
.cal-day.blank:hover { border-color: transparent; box-shadow: none; }
.cal-day.rest { background: var(--plane); border-style: dashed; }
.cal-day.today { border-color: var(--rausch); box-shadow: 0 0 0 2px var(--rausch-soft); }
.cal-day.selected { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--text-primary); }
.cal-day .d { font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day .w { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: var(--pill); background: var(--rausch-tint); color: var(--rausch); align-self: flex-start; }
.cal-day.done .w { background: var(--good); color: #fff; }
.cal-day.missed .w { background: var(--critical); color: #fff; }
.cal-day.moved .w { background: var(--babu-soft); color: var(--babu); }
.cal-day .mini { font-size: .68rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; margin-top: auto; }

/* ============================================================== workout == */
.ex-card { border: 1px solid var(--divider); border-radius: var(--radius); background: var(--surface-1); margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow); }
.ex-head { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.ex-head .grow { flex: 1; min-width: 0; }
.ex-idx { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--divider); display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.ex-body { padding: 0 20px 18px; }
.suggestion { border-left: 3px solid var(--rausch); background: var(--rausch-tint); padding: 14px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 16px; }
.suggestion.increase { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 6%, transparent); }
.suggestion.deload, .suggestion.stalled { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.suggestion b { font-size: .98rem; }
.suggestion p { margin: 5px 0 0; font-size: .86rem; color: var(--text-secondary); }

.setgrid { display: grid; grid-template-columns: 36px 1fr 1fr 1fr auto; gap: 8px; align-items: center; }
.setgrid .hdr { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); font-weight: 700; }
.setgrid input { text-align: center; padding: 10px 6px; font-variant-numeric: tabular-nums; }
.set-done { color: var(--good-ink); font-weight: 700; font-size: .88rem; font-variant-numeric: tabular-nums; text-align: center; }

.alt-list { margin-top: 14px; border-top: 1px solid var(--divider); padding-top: 14px; }

/* ================================================================ timer == */
.timer-bar {
  position: fixed; bottom: 0; left: 248px; right: 0; z-index: 40;
  background: var(--text-primary); color: var(--surface-1);
  padding: 14px 24px; display: flex; align-items: center; gap: 18px;
  box-shadow: 0 -2px 20px rgba(0,0,0,.2);
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.timer-bar .t { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-bar .btn { background: transparent; border-color: currentColor; color: inherit; }
.timer-bar .btn:hover { background: rgba(255,255,255,.12); }

/* =============================================================== dialog == */
dialog {
  border: 0; border-radius: var(--radius-lg);
  background: var(--surface-1); color: var(--text-primary);
  padding: 0; max-width: 640px; width: calc(100% - 32px);
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(0,0,0,.5); }
.dlg-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--divider); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dlg-body { padding: 20px 22px; max-height: 64vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dlg-foot { padding: 16px 22px; border-top: 1px solid var(--divider); display: flex; justify-content: flex-end; gap: 10px; }

/* =============================================================== charts == */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--text-secondary); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--text-secondary); font-size: 11px; }
.chart .series-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { stroke: var(--surface-1); stroke-width: 2; }
.chart .band { fill: var(--series-1); opacity: .10; }
.chart .hover-line { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--text-secondary); margin-top: 10px; }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tooltip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--text-primary); color: var(--surface-1);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: .8rem;
  box-shadow: var(--shadow-hover); max-width: 240px;
}
.tooltip .tt-title { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.tooltip .secondary { color: var(--text-muted); }

/* =============================================================== action == */
.action { display: flex; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--divider); }
.action:last-child { border-bottom: 0; }
.action .ico { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; }
.action.good .ico { background: var(--good); }
.action.warn .ico { background: var(--warning); color: #222; }
.action.bad  .ico { background: var(--critical); }
.action h4 { margin-bottom: 4px; }
.action p { font-size: .88rem; color: var(--text-secondary); margin: 0; }

/* ================================================================ prose == */
.prose { font-size: .95rem; line-height: 1.7; color: var(--text-secondary); max-width: 74ch; }
.prose h1 { font-size: 1.6rem; color: var(--text-primary); margin: 0 0 .5em; }
.prose h2 { font-size: 1.25rem; color: var(--text-primary); margin: 1.7em 0 .5em; padding-top: .7em; border-top: 1px solid var(--divider); }
.prose h3 { font-size: 1.05rem; color: var(--text-primary); margin: 1.4em 0 .4em; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: .88rem; }
.prose th, .prose td { border: 1px solid var(--divider); padding: 9px 12px; text-align: left; }
.prose th { background: var(--surface-2); color: var(--text-primary); font-weight: 700; }
.prose strong { color: var(--text-primary); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin-bottom: .35em; }
.prose hr { border: 0; border-top: 1px solid var(--divider); margin: 1.8em 0; }
.prose em { color: var(--text-muted); }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: .88em; }

/* ================================================================ toast == */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--text-primary); color: var(--surface-1); border-radius: var(--radius-sm); padding: 14px 18px; box-shadow: var(--shadow-hover); font-size: .88rem; font-weight: 500; max-width: 340px; }
.toast.good { background: var(--good); color: #fff; }
.toast.bad { background: var(--critical); color: #fff; }

/* =========================================================== responsive == */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  /* --- DLS bottom tab bar */
  .sidebar {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto;
    flex-direction: row; justify-content: space-around; align-items: stretch;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    gap: 0; z-index: 50; overflow: visible;
    border-right: 0; border-top: 1px solid var(--divider);
    box-shadow: 0 -1px 12px rgba(0,0,0,.06);
  }
  .brand, .nav-spacer, .nav-foot { display: none; }
  .navlink {
    flex-direction: column; justify-content: center; gap: 4px;
    font-size: .64rem; font-weight: 600; padding: 7px 4px;
    min-width: 0; flex: 1; text-align: center; border-radius: var(--radius-sm);
  }
  .navlink .ico { font-size: 1.3rem; width: auto; }
  .navlink[aria-current="page"] { background: transparent; color: var(--rausch); }
  .navlink[data-primary="false"] { display: none; }
  .nav-more { display: flex; }

  /* --- sticky app header */
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 30;
    background: var(--surface-1); border-bottom: 1px solid var(--divider);
    padding: 12px 16px calc(12px);
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .mobile-bar strong { color: var(--rausch); font-size: 1.15rem; font-weight: 800; letter-spacing: -.03em; }

  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .view-head { margin-bottom: 18px; }
  h1 { font-size: 1.4rem; }
  .card { padding: 18px 16px; border-radius: var(--radius); }
  .grid { gap: 14px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: repeat(2, 1fr); }

  .timer-bar { left: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: 14px; border-radius: var(--radius) var(--radius) 0 0; }

  .cal { gap: 4px; }
  .cal-day { min-height: 62px; padding: 5px 4px; border-radius: var(--radius-sm); gap: 2px; }
  .cal-day .d { font-size: .78rem; }
  .cal-day .w { font-size: .64rem; padding: 2px 6px; }
  .cal-day .mini { display: none; }
  .cal-dow { font-size: .62rem; }

  .setgrid { grid-template-columns: 28px 1fr 1fr 1fr auto; gap: 6px; }
  .setgrid input { padding: 10px 2px; }
  .setgrid .hdr { font-size: .6rem; }

  .ex-head { padding: 16px; }
  .ex-body { padding: 0 16px 16px; }

  dialog { width: 100%; max-width: 100%; margin: 0; margin-top: auto;
           border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
  .dlg-body { max-height: 66vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .toast-wrap { top: auto; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); left: 16px; right: 16px; }
  .toast { max-width: none; }
}

@media (max-width: 380px) {
  .navlink { font-size: .58rem; }
  .navlink .ico { font-size: 1.2rem; }
  .grid.four { grid-template-columns: 1fr; }
}

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