/* =====================================================================
   Orbit — design tokens
   ===================================================================== */
:root {
  --bg: #f4f4f7;
  --surface: #ffffff;
  --surface-2: #eeeef3;
  --surface-3: #e4e4ec;
  --line: rgba(14, 14, 24, 0.08);
  --text: #0d0d14;
  --text-2: #4d4d5c;
  --muted: #7c7c8c;
  --accent: #5b45f5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 69, 245, 0.1);
  --brand-a: #7b61ff;
  --brand-b: #2fd6f5;
  --pos: #006300;
  --neg: #c02626;
  /* chart roles — reference categorical palette (fixed order), light steps */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --s7: #4a3aa7;
  --s8: #e34948;
  --other: #a9a8a1;
  /* sequential (blue ramp) for heatmaps; q0 = empty */
  --q0: var(--surface-3);
  --q1: #b7d3f6;
  --q2: #6da7ec;
  --q3: #2a78d6;
  --q4: #184f95;
  --edge-a: rgba(91, 69, 245, 0.22);
  --edge-b: rgba(47, 214, 245, 0.22);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --status-good: #0ca30c;
  --status-warn: #fab219;
  --status-crit: #d03b3b;
  --shadow: 0 1px 2px rgba(10, 10, 30, 0.04), 0 8px 24px rgba(10, 10, 30, 0.05);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", -apple-system, "Segoe UI", sans-serif;
  --num: var(--display);
  /* one colour per metric, everywhere it appears */
  --m-kcal: var(--s1);
  --m-protein: var(--s2);
  --m-steps: var(--s3);
  --m-study: var(--s4);
  --m-weight: #0e9f8e;
  --m-sleep: var(--s7);
  --m-water: #1592b8;
  --m-workout: var(--s8);
  --m-money: var(--s5);
  --streak: #f2711c;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07070c;
    --surface: #121219;
    --surface-2: #1b1b25;
    --surface-3: #262632;
    --line: rgba(255, 255, 255, 0.07);
    --text: #f3f3f8;
    --text-2: #c2c2d0;
    --muted: #8a8a9c;
    --accent: #8f7dff;
    --accent-ink: #0b0918;
    --accent-soft: rgba(143, 125, 255, 0.14);
    --pos: #2fbf5b;
    --neg: #ff6b6b;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #008300;
    --s7: #9085e9;
    --s8: #e66767;
    --other: #6b6a66;
    --q1: #104281;
    --q2: #1c5cab;
    --q3: #3987e5;
    --q4: #86b6ef;
    --edge-a: rgba(143, 125, 255, 0.38);
    --edge-b: rgba(47, 214, 245, 0.28);
    --grid: #26262c;
    --m-weight: #2cc4b0;
    --m-water: #3cc3e6;
    --streak: #ff8f3d;
    --axis: #3a3a42;
    --shadow: none;
    color-scheme: dark;
  }
}

/* =====================================================================
   Base
   ===================================================================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 16px/1.42 var(--font);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 85% -8%, var(--edge-a), transparent 62%),
    radial-gradient(700px 460px at -15% 18%, var(--edge-b), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100dvh;
}
/* a faint starfield, dark mode only */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.55;
    background-image:
      radial-gradient(1px 1px at 23px 41px, rgba(255,255,255,.55), transparent 60%),
      radial-gradient(1px 1px at 141px 97px, rgba(255,255,255,.35), transparent 60%),
      radial-gradient(1.5px 1.5px at 87px 173px, rgba(190,180,255,.45), transparent 60%),
      radial-gradient(1px 1px at 199px 13px, rgba(255,255,255,.3), transparent 60%),
      radial-gradient(1px 1px at 61px 229px, rgba(160,230,255,.35), transparent 60%);
    background-size: 240px 260px;
  }
}
#app, #auth { position: relative; z-index: 1; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { font: inherit; color: inherit; font-size: 16px; font-family: var(--font); } /* 16px stops iOS zoom */
input:not([type="checkbox"]):not([type="range"]), select, textarea {
  width: 100%; min-width: 0; padding: 12px 14px; border-radius: 14px;
  border: 1px solid transparent; background: var(--surface-2); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.strong { font-weight: 650; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.center { text-align: center; }
.error { color: var(--neg); font-size: 14px; margin: 0; }
.ic { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; }
.ic svg { width: 100%; height: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* =====================================================================
   Auth
   ===================================================================== */
.auth { min-height: 100dvh; display: grid; align-content: center; padding: calc(env(safe-area-inset-top) + 32px) 20px 40px; max-width: 420px; margin: 0 auto; }
.brand { text-align: center; margin-bottom: 28px; }
.brand img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 12px 40px rgba(91, 69, 245, 0.35); }
.brand h1 { font-family: var(--num); font-size: 34px; font-weight: 700; margin-top: 16px; letter-spacing: -0.02em; }
.brand p { margin: 6px 0 0; color: var(--muted); }
.form { display: grid; gap: 14px; }

/* =====================================================================
   App shell
   ===================================================================== */
#app { max-width: 600px; margin: 0 auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 112px); }
.topbar { padding: calc(env(safe-area-inset-top) + 10px) 0 14px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.topbar h1 { font-size: 31px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; margin-top: 6px; }
.brandmark { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; text-transform: none; color: var(--text); }
.brandmark img { width: 22px; height: 22px; border-radius: 6px; }
.brandmark b { background: linear-gradient(90deg, var(--brand-a), var(--brand-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .sub { color: var(--muted); font-size: 14px; font-weight: 550; text-transform: capitalize; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
}
.navpill { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.navpill button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.navpill button:disabled { opacity: 0.3; }
.navpill .label { padding: 0 6px; font-size: 14px; font-weight: 600; white-space: nowrap; }

.tabbar {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  width: min(560px, calc(100% - 24px));
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  padding: 6px; border-radius: 26px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.8) blur(22px); -webkit-backdrop-filter: saturate(1.8) blur(22px);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}
.tabbar button { display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 10.5px; font-weight: 600; color: var(--muted); border-radius: 18px; }
.tabbar button[aria-current="page"] { color: var(--text); }
.tabbar button[aria-current="page"] .ic { color: var(--accent); }
.tabbar button[data-tab] { position: relative; }
.tabbar button[aria-current="page"]::after {
  content: ""; position: absolute; bottom: 1px; left: 50%; width: 16px; height: 3px; border-radius: 2px; transform: translateX(-50%);
  background: linear-gradient(90deg, var(--brand-a), var(--brand-b));
}
.fab {
  justify-self: center; width: 52px; height: 52px; border-radius: 18px !important; padding: 0 !important;
  display: grid !important; place-items: center; color: #fff !important;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  box-shadow: 0 8px 22px rgba(91, 69, 245, 0.45);
}
.fab .ic { width: 26px; height: 26px; color: #fff !important; }

.timer-bar {
  position: sticky; top: calc(env(safe-area-inset-top) + 6px); z-index: 15; margin: 8px 0 0;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-a), #4f8dff); color: #fff; box-shadow: 0 8px 24px rgba(91, 69, 245, 0.35);
}
.timer-bar .grow { flex: 1; min-width: 0; }
.timer-bar .t { font-family: var(--num); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-bar button { background: rgba(255, 255, 255, 0.2); color: #fff; padding: 8px 14px; border-radius: 12px; font-weight: 650; font-size: 14px; }

/* =====================================================================
   Cards & building blocks
   ===================================================================== */
.card, .tile, .list {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(140deg, var(--edge-a), var(--line) 38%, var(--line) 62%, var(--edge-b)) border-box;
  border: 1px solid transparent;
}
.card { border-radius: var(--radius); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.glow {
  background:
    radial-gradient(240px 170px at 20% 50%, var(--edge-a), transparent 72%) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(140deg, var(--edge-a), var(--line) 38%, var(--line) 62%, var(--edge-b)) border-box;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 650; }
.card-head .ic { color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kpi { font-family: var(--num); font-size: 44px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
.kpi-sm { font-family: var(--num); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.kpi small, .kpi-sm small { font-size: 0.5em; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.row-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 4px 10px; }

.tile {
  display: grid; gap: 6px; align-content: start; text-align: left; min-height: 112px;
  border-radius: 20px; padding: 14px; box-shadow: var(--shadow);
}
.tile-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.tile-head .ic { width: 18px; height: 18px; }
.tile .sub { font-size: 12.5px; color: var(--muted); }
.tile .act { justify-self: start; margin-top: 2px; }

.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); width: 0; transition: width 0.5s ease; }
.meter.warn > span { background: var(--status-warn); }
.meter.over > span { background: var(--status-crit); }
.meter.good > span { background: var(--status-good); }
.meter.thin { height: 5px; }

/* rings */
.rings { display: grid; grid-template-columns: 132px 1fr; gap: 18px; align-items: center; }
.rings svg { width: 132px; height: 132px; display: block; }
.rings .track { stroke: var(--surface-3); }
.rings .arc { transition: stroke-dashoffset 0.8s ease; }
.ring-legend { display: grid; gap: 10px; }
.ring-legend .r { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.ring-legend .v { font-family: var(--num); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.ring-legend .v small { color: var(--muted); font-weight: 500; }
.dot { width: 10px; height: 10px; border-radius: 3px; }
.c1, .k1, .s1 { --c: var(--s1); } .c2, .k2, .s2 { --c: var(--s2); } .c3, .k3, .s3 { --c: var(--s3); } .c4, .k4, .s4 { --c: var(--s4); }
.k5 { --c: var(--s5); } .k6 { --c: var(--s6); } .k7 { --c: var(--s7); } .k8 { --c: var(--s8); } .kother { --c: var(--other); }
.dot { background: var(--c); }
.rings .arc { stroke: var(--c); }

/* lists */
.list { border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.list.flat { box-shadow: none; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  width: 100%; text-align: left; padding: 12px 14px; min-height: 56px;
}
.row + .row { border-top: 1px solid var(--line); }
.row-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 21px; }
.row-ico .ic { width: 20px; height: 20px; color: var(--text-2); }
.row-main { min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; white-space: nowrap; }
.row-end .v { font-family: var(--num); font-weight: 650; font-variant-numeric: tabular-nums; }
.row-end .s { font-size: 12px; color: var(--muted); }
.row .chev { color: var(--muted); }
.row.compact { min-height: 48px; padding: 10px 14px; }
.badge { display: inline-block; font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: 1px; margin-left: 4px; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .big { display: block; font-size: 40px; margin-bottom: 8px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; padding: 14px 18px; font-weight: 650; width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.brand { background: linear-gradient(135deg, var(--brand-a), var(--brand-b)); color: #fff; }
.btn.secondary { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: transparent; color: var(--neg); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.5; }
.btn .ic { width: 20px; height: 20px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 13.5px; }
.pill .ic { width: 16px; height: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); }
.icon-btn:active, .row:active, .tile:active, .chip:active { opacity: 0.7; }
.link { color: var(--accent); font-weight: 600; padding: 6px 2px; }
.danger-text { color: var(--neg); }

/* segmented & chips */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 14px; padding: 3px; gap: 2px; }
.segmented button { padding: 8px 6px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 12px; border-radius: 999px; background: var(--surface-2); font-size: 14px; font-weight: 550; border: 1.5px solid transparent; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.scroll-x::-webkit-scrollbar { display: none; }

/* forms */
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.unit-input { position: relative; }
.unit-input input { padding-right: 52px; }
.unit-input .u { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.big-input input { font-family: var(--num); font-size: 34px; font-weight: 700; padding: 12px 56px 12px 16px; }
.fields2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fields3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
details.more { background: var(--surface); border-radius: 16px; padding: 4px 14px; border: 1px solid var(--line); }
details.more summary { padding: 12px 0; font-weight: 650; color: var(--accent); cursor: pointer; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] { padding-bottom: 14px; }
.nutri-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 10px; }
.nutri-form .field-label { font-weight: 600; font-size: 12.5px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 550; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }

/* sheet */
dialog.sheet {
  border: 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 18px);
  width: 100%; max-width: 600px; max-height: 94dvh;
  margin: auto auto 0; border-radius: 26px 26px 0 0;
  background: var(--bg); color: var(--text); overflow-y: auto; overscroll-behavior: contain;
}
dialog.sheet[open] { animation: sheet-up 0.24s cubic-bezier(0.2, 0.9, 0.3, 1); }
dialog.sheet::backdrop { background: rgba(4, 4, 12, 0.5); backdrop-filter: blur(2px); }
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 8px auto 2px; }
.sheet-head { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 6px 0 10px; background: var(--bg); }
.sheet-head h2 { text-align: center; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* keep the back button's slot even when there's no back step, so the title stays centred */
#sheet-back[hidden] { display: grid !important; visibility: hidden; }
.sheet-body { display: grid; gap: 14px; padding-bottom: 6px; }

/* quick add grid */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid button {
  display: grid; justify-items: center; gap: 8px; padding: 16px 6px 14px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.quick-grid .qi { width: 46px; height: 46px; border-radius: 15px; }
.quick-grid .qi .ic { width: 23px; height: 23px; }
.quick-grid .q-income { --c: var(--pos); }
.quick-scan { margin-top: 12px; }

/* food */
.meal { padding: 6px 0 4px; }
.meal-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px 8px; }
.meal-head h3 { font-size: 16px; font-weight: 650; flex: 1; }
.meal-head .k { font-family: var(--num); font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.meal-add { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.meal-add .ic { width: 18px; height: 18px; }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.macro { display: grid; gap: 5px; }
.macro .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.macro .v { font-family: var(--num); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.macro .v small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.macro .v, .macro .g { white-space: nowrap; }
.macro .g { font-size: 11px; color: var(--muted); margin-top: -1px; }
.macro .meter > span { background: var(--c, var(--accent)); }
.preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--surface); border-radius: 16px; padding: 12px; border: 1px solid var(--line); text-align: center; }
.preview .v { font-family: var(--num); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.preview .l { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.nrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.nrow:first-child { border-top: 0; }
.nrow.sub .nl { padding-left: 12px; color: var(--text-2); }
.nrow .nv { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 600; }
.nrow .nv small { color: var(--muted); font-weight: 500; }
.nrow .meter { grid-column: 1 / -1; height: 5px; }
.nrow .flag { font-size: 12px; font-weight: 650; }
.nrow .nl { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; min-width: 0; }
.nrow .nl > span, .nrow .nv { white-space: nowrap; }
.nrow .nv { text-align: right; }
.flag.low { color: color-mix(in srgb, var(--status-warn) 70%, var(--text)); }
.flag.high { color: var(--status-crit); }
.flag.ok { color: var(--pos); }

/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text, .donut text, .heat text { fill: var(--muted); font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .goalline { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.7; }
.chart .avgline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .bar { fill: var(--c, var(--s1)); }
.chart .bar.active, .slice.active, .cell.active { opacity: 0.72; }
.chart .line { fill: none; stroke: var(--c, var(--s1)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--c, var(--s1)); opacity: 0.1; }
.chart .pt { fill: var(--c, var(--s1)); stroke: var(--surface); stroke-width: 2; }
.chart .trend { stroke: var(--text-2); stroke-width: 1.5; opacity: 0.55; }
.chart .endlabel { fill: var(--text-2); font-weight: 600; font-size: 11px; }
.chart .axis-title { fill: var(--muted); font-size: 10.5px; }
.axis-title-y { font-size: 11px; color: var(--muted); margin: -4px 0 4px; }
.chart .hit { fill: transparent; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-2); margin: -2px 0 10px; }
.legend .dot { display: inline-block; margin-right: 6px; vertical-align: -1px; }
.lkey { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--c); margin-right: 6px; vertical-align: 3px; }
.stat-row { display: flex; gap: 18px; margin: -4px 0 12px; flex-wrap: wrap; }
.stat-row > div { display: grid; }
.stat-row .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-row .v { font-family: var(--num); font-weight: 700; font-size: 18px; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 5px 8px; font-size: 14px; }
.hbar .track { grid-column: 1 / -1; height: 8px; }
.hbar .track span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--c, var(--s1)); min-width: 2px; }
/* donut */
.donut-wrap { display: grid; grid-template-columns: 118px 1fr; gap: 14px; align-items: center; }
.donut { width: 118px; height: 118px; display: block; }
.donut .donut-track { stroke: var(--surface-2); }
.donut .slice { stroke: var(--c); transition: opacity .15s; }
.donut .donut-center { fill: var(--text); font-size: 19px; font-weight: 700; font-variant-numeric: normal; }
.donut .donut-sub { fill: var(--muted); font-size: 10.5px; }
.donut-legend { display: grid; gap: 7px; font-size: 13.5px; min-width: 0; }
.dl { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.dl .dot { align-self: start; margin-top: 5px; }
.dl-label { display: grid; min-width: 0; line-height: 1.25; }
.dl-label > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 550; }
.dl-label small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dl-p { color: var(--text-2); font-size: 13px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
/* heatmap */
.heat { display: block; width: 100%; height: auto; }
.q0 { fill: var(--q0); background: var(--q0); }
.q1 { fill: var(--q1); background: var(--q1); }
.q2 { fill: var(--q2); background: var(--q2); }
.q3 { fill: var(--q3); background: var(--q3); }
.q4 { fill: var(--q4); background: var(--q4); }
.heat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.heat-stack { display: grid; gap: 14px; }
.heat-title { font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.heat-grid .heat-legend, .heat-stack .heat-legend { display: none; }
.heat-grid > div:last-child .heat-legend, .heat-stack > div:last-child .heat-legend { display: flex; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
/* sparkline in stat tiles: de-emphasis line, latest point in the accent */
.spark { width: 100%; height: 30px; display: block; margin-top: 2px; }
.spark-line { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; opacity: .8; }
.spark-dot, .p-dot { fill: none; stroke: var(--c, var(--accent)); stroke-width: 6; stroke-linecap: round; }
.spark-dot-halo, .p-dot-halo { fill: none; stroke: var(--surface); stroke-width: 9.5; stroke-linecap: round; }
.p-dot { stroke-width: 7.5; } .p-dot-halo { stroke-width: 11; }
.chips-scroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips-scroll .chip { flex: none; padding: 6px 11px; font-size: 13px; }
.insight { font-size: 13.5px; color: var(--text-2); margin: 8px 0 0; }
.table-view { margin-top: 10px; font-size: 13px; }
.table-view summary { color: var(--accent); cursor: pointer; font-weight: 600; }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi-row .tile { min-height: 0; gap: 2px; }
.kpi-row .tile .kpi-sm { font-size: 22px; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500; padding: 7px 10px; border-radius: 10px; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.tooltip .tt-title { font-size: 12px; opacity: .75; margin-bottom: 2px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.tooltip .tt-row span { opacity: .75; }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; background: var(--c); display: inline-block; }
.toast {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 96px);
  max-width: calc(100% - 32px); background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 550;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; word-break: break-all;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; user-select: all;
}
ol.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  dialog.sheet[open] { animation: none; }
  .meter > span, .rings .arc { transition: none; }
}

/* =====================================================================
   v7 — intuitive & graphical components
   ===================================================================== */
/* toast with an action (Undo) */
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  left: 0; right: 0; margin-inline: auto; width: max-content; transform: none;
}
.toast-action { color: var(--brand-b); font-weight: 700; padding: 2px 4px; pointer-events: auto; }

/* tile tap cue */
.tile { position: relative; }
.tile-plus { margin-left: auto; width: 22px; height: 22px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile-plus .ic { width: 14px; height: 14px; }

/* macro bar: where an item's calories come from (protein / carbs / fat) */
.mbar { display: flex; gap: 2px; height: 4px; margin-top: 6px; max-width: 180px; }
.mbar i { display: block; height: 100%; border-radius: 2px; background: var(--c); min-width: 3px; }

/* add-food search */
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 12px; }
.search-box .ic { color: var(--muted); width: 20px; height: 20px; }
.search-box input:not([type="checkbox"]) { background: transparent; border: 0; padding: 13px 0; border-radius: 0; }
.search-box:focus-within { border-color: var(--accent); }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.action {
  display: grid; justify-items: center; gap: 3px; padding: 12px 4px 10px; border-radius: 18px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px;
}
.action-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 2px; }
.action small { font-size: 11px; color: var(--muted); line-height: 1.2; }
.results { display: grid; gap: 14px; }
.rsec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 4px 6px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rsec-head small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.rsec-status { margin: 0 4px; }
.row.result { display: flex; align-items: center; gap: 4px; padding: 0 8px 0 0; }
.result-main { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; text-align: left; padding: 11px 0 11px 14px; }
.quick-add { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; }
.quick-add .ic { width: 20px; height: 20px; }
.quick-add:active { transform: scale(.94); }
.show-more { width: 100%; padding: 12px; color: var(--accent); font-weight: 600; border-top: 1px solid var(--line); }
.hint-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint { display: grid; gap: 4px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.hint .ic { color: var(--accent); }
.hint small { color: var(--muted); font-size: 12px; line-height: 1.3; }

/* quantity: where this item puts your day */
.goal-after { display: grid; gap: 6px; }
.goal-bar { position: relative; display: flex; height: 10px; border-radius: 5px; background: var(--surface-3); overflow: visible; }
.goal-bar i { display: block; height: 100%; }
.goal-bar .before { background: var(--other); border-radius: 5px 0 0 5px; }
.goal-bar .this { background: linear-gradient(90deg, var(--brand-a), var(--brand-b)); border-radius: 0 5px 5px 0; margin-left: 2px; }
.goal-bar .this.over { background: var(--status-crit); }
.goal-tick { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--text); border-radius: 1px; }

/* food screen */
.meal-head .dot { flex: none; }
.meal-empty { display: block; width: 100%; text-align: left; padding: 4px 14px 14px; color: var(--muted); font-size: 14px; }

/* weight stepper */
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; align-items: center; }
.stepper > button { height: 56px; border-radius: 16px; background: var(--surface-2); font-size: 28px; font-weight: 500; }
.stepper .big-input input { text-align: center; padding-right: 48px; padding-left: 48px; }

/* sleep timeline 18:00 -> 14:00 */
.sleep-line { display: grid; gap: 6px; }
.sl-track { position: relative; height: 34px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3) 30%, var(--surface-3) 60%, var(--surface-2)); }
.sl-sleep { position: absolute; top: 4px; bottom: 4px; border-radius: 9px; background: linear-gradient(90deg, #6b5bd8, var(--s7)); min-width: 6px; }
.sl-l, .sl-r { position: absolute; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; }
.sl-l { left: 8px; } .sl-r { right: 8px; }
.sl-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* big emoji choices (sleep quality) and workout type tiles */
.emoji-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.emoji-row button, .type-grid button {
  display: grid; justify-items: center; gap: 2px; padding: 10px 2px 8px; border-radius: 16px;
  background: var(--surface); border: 2px solid transparent; font-size: 11.5px; color: var(--text-2);
}
.emoji-row .em { font-size: 28px; line-height: 1.1; filter: grayscale(.6); opacity: .8; }
.emoji-row button[aria-checked="true"], .type-grid button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 650; }
.emoji-row button[aria-checked="true"] .em { filter: none; opacity: 1; transform: scale(1.08); }
.type-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.type-grid .em { font-size: 24px; line-height: 1.15; }

/* water glasses */
.glasses { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 4px 0; }
.glass {
  position: relative; width: 34px; height: 44px; border: 2px solid var(--axis); border-top-width: 1px;
  border-radius: 3px 3px 10px 10px; overflow: hidden; background: transparent;
}
.glass i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #6fb6f5, var(--s1)); transition: height .25s ease; }
.glass.full, .glass.part { border-color: var(--s1); }
@media (prefers-reduced-motion: reduce) { .glass i { transition: none; } }

/* quantity sheet: full-width macro bar with its legend */
.sheet-body > div > .mbar { max-width: none; height: 6px; margin: 0 0 8px; }

/* scanner viewfinder */
.scan-view { position: relative; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden; background: #000; isolation: isolate; }
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-guide { position: absolute; left: 14%; right: 14%; top: 24%; bottom: 24%; border-radius: 16px; box-shadow: 0 0 0 999px rgba(4, 6, 20, 0.45); }
.scan-corner { position: absolute; width: 26px; height: 26px; border: 3px solid #fff; filter: drop-shadow(0 0 6px rgba(47, 214, 245, 0.7)); }
.scan-corner.tl { left: -3px; top: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.scan-corner.tr { right: -3px; top: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.scan-corner.bl { left: -3px; bottom: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.scan-corner.br { right: -3px; bottom: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }
.scan-laser {
  position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; border-radius: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-b), transparent);
  box-shadow: 0 0 12px var(--brand-b); animation: scan-sweep 1.8s ease-in-out infinite;
}
@keyframes scan-sweep { 0%, 100% { top: 14%; } 50% { top: 86%; } }
.scan-tip {
  position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-size: 12.5px; font-weight: 600;
  color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); pointer-events: none;
}
.scan-ok {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle, rgba(18, 183, 106, 0.75), rgba(18, 183, 106, 0.35)); animation: scan-pop 0.35s ease-out;
}
.scan-ok .ic { width: 76px; height: 76px; }
.scan-ok .ic svg { stroke-width: 2.6; }
@keyframes scan-pop { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: none; } }
.scan-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.scan-controls:empty, .scan-diag:empty { display: none; }
.scan-controls .chip .ic, .btn .ic.inline { width: 16px; height: 16px; vertical-align: -3px; }
.scan-diag { margin: 0; opacity: 0.75; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .scan-laser, .scan-ok { animation: none; } }

/* =====================================================================
   Display type, metric identity, motion
   ===================================================================== */
h1, h2, h3, .kpi, .kpi-sm, .brandmark, .brand h1, .topbar h1, .timer-bar .t { font-family: var(--display); }
.topbar h1 { letter-spacing: -0.04em; }

.m-kcal { --c: var(--m-kcal); } .m-protein { --c: var(--m-protein); } .m-steps { --c: var(--m-steps); }
.m-study { --c: var(--m-study); } .m-weight { --c: var(--m-weight); } .m-sleep { --c: var(--m-sleep); }
.m-water { --c: var(--m-water); } .m-workout { --c: var(--m-workout); } .m-money { --c: var(--m-money); }

/* stat tiles: tinted icon chip, coloured trend with a soft area */
.tile { position: relative; overflow: hidden; isolation: isolate; }
.tile[class*="m-"]::before {
  content: ""; position: absolute; z-index: -1; right: -40px; top: -50px; width: 150px; height: 130px; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 16%, transparent), transparent);
}
.ic-chip {
  width: 28px; height: 28px; border-radius: 9px; display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c, var(--accent)) 17%, transparent); color: var(--c, var(--accent));
}
.ic-chip .ic { width: 16px; height: 16px; }
.tile-head { color: var(--text-2); }
.tile .tile-plus { background: color-mix(in srgb, var(--c, var(--accent)) 15%, transparent); color: var(--c, var(--accent)); }
.tile .spark { height: 34px; }
.tile[class*="m-"] .spark-line { stroke: var(--c); stroke-width: 2; opacity: 1; }
.spark-stop-a { stop-color: var(--c, var(--accent)); stop-opacity: 0.32; }
.spark-stop-b { stop-color: var(--c, var(--accent)); stop-opacity: 0; }
.spark-area { stroke: none; }
.tile .meter > span { background: var(--c, var(--accent)); }
.q-dots { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: 4px; }
.q-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.q-dots i.on { background: var(--c, var(--accent)); }

/* coloured section marks on Progress */
.card[class*="m-"] > .card-head h2::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 9px; vertical-align: 2px; background: var(--c);
}
.card[id] { scroll-margin-top: calc(env(safe-area-inset-top) + 64px); }
.jump {
  position: sticky; top: env(safe-area-inset-top); z-index: 12; margin: 0 -16px 12px; padding: 8px 16px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  transition: background-color 0.25s, box-shadow 0.25s;
}
.jump.stuck {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: 0 1px 0 var(--line);
}
.jump::-webkit-scrollbar { display: none; }
.jump .chip { flex: none; display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; }
.jump .chip .dot { width: 8px; height: 8px; border-radius: 3px; }

/* week strip */
.week { margin: 2px 0 14px; }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 8px; }
.week-head .eyebrow { display: flex; align-items: center; gap: 6px; }
.week-nav { display: flex; gap: 6px; }
.week-nav button { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); background: var(--surface-2); }
.week-nav button:disabled { opacity: 0.3; }
.week-nav .ic { width: 16px; height: 16px; }
.streak { display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px 4px 6px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--streak); background: color-mix(in srgb, var(--streak) 14%, transparent); }
.streak .ic { width: 15px; height: 15px; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { display: grid; justify-items: center; gap: 3px; padding: 7px 0 6px; border-radius: 16px; color: var(--muted); font-size: 11px; font-weight: 650; border: 1px solid transparent; }
.wd svg { width: 38px; height: 38px; display: block; overflow: visible; }
.wd .wd-track { stroke: var(--surface-3); }
.wd .wd-arc { stroke: url(#wd-grad); transition: stroke-dashoffset 0.8s var(--ease-out); }
.wd .wd-n { font-family: var(--num); font-size: 13px; font-weight: 700; fill: var(--text-2); }
.wd.today .wd-n { fill: var(--accent); }
.wd.full .wd-arc { filter: drop-shadow(0 0 3px var(--brand-b)); }
.wd[aria-current="date"] {
  color: var(--text);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(160deg, var(--edge-a), var(--line), var(--edge-b)) border-box;
  box-shadow: var(--shadow);
}
.wd:disabled { opacity: 0.35; }
.wd-stop-a { stop-color: var(--brand-a); }
.wd-stop-b { stop-color: var(--brand-b); }
.row-ico .ic-chip { width: 40px; height: 40px; border-radius: 12px; }
.row-ico .ic-chip .ic { width: 20px; height: 20px; color: var(--c); }
.row-ico[class*="m-"] { background: none; }

/* money hero: this month's pace against last month */
.pace { display: block; width: 100%; height: 64px; margin: 6px 0 2px; overflow: visible; }
.pace .p-prev { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: 0.8; }
.pace .p-now { fill: none; stroke: var(--c, var(--accent)); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.pace-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }


/* press feedback */
.tile, .btn, .chip, .pill, .wd, .fab, .icon-btn, .avatar { transition: transform 0.18s var(--ease-out), opacity 0.18s; }
.tile:active, .btn:active, .chip:active, .pill:active, .wd:active, .avatar:active { transform: scale(0.965); }
.fab:active { transform: scale(0.9); }

/* entrance: cards rise in one after the other when a tab opens */
@media (prefers-reduced-motion: no-preference) {
  .enter > * { animation: rise 0.55s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
  .enter .spark-line, .enter .pace .p-now { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s 0.2s var(--ease-out) forwards; }
  .enter .spark-area { animation: fade 0.8s 0.5s ease backwards; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }
