:root {
  --bg: #0b0c08;
  --bg-card: #16180f;
  --bg-elevated: #1c1f14;
  --lime: #d7ff3d;
  --lime-dim: #c2e62f;
  --ink: #0d0f0a;
  --white: #f3f4ec;
  --coral: #ff6b57;
  --coral-dim: #ef5540;
  --text: #f3f4ec;
  --text-muted: #8a8f7e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --radius: 26px;
  --radius-sm: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── Theme overrides ──────────────────────────────────────────────────── */
:root[data-theme="lime-light"] {
  --bg: #f5f8e8; --bg-card: #eef3d8; --bg-elevated: #e6edcc;
  --lime: #8aaa00; --lime-dim: #6e8e00; --ink: #0d0f0a;
  --text: #1a1d0e; --text-muted: #5a6040;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.20);
  color-scheme: light;
}
:root[data-theme="cherry-dark"] {
  --bg: #100808; --bg-card: #1a0f0f; --bg-elevated: #221515;
  --lime: #ff4d6d; --lime-dim: #e63358; --ink: #1a0000;
  --text: #f3ece8; --text-muted: #a07070;
}
:root[data-theme="cherry-light"] {
  --bg: #fff0f0; --bg-card: #ffe8e8; --bg-elevated: #ffd9d9;
  --lime: #cc1a35; --lime-dim: #aa1025; --ink: #1a0000;
  --text: #1a0a0a; --text-muted: #7a4040;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.20);
  color-scheme: light;
}
:root[data-theme="blueberry-dark"] {
  --bg: #080b12; --bg-card: #0f1520; --bg-elevated: #151e2a;
  --lime: #7b9fff; --lime-dim: #6088ee; --ink: #000614;
  --text: #e8edf8; --text-muted: #6070a8;
}
:root[data-theme="blueberry-light"] {
  --bg: #f0f3ff; --bg-card: #e4eaff; --bg-elevated: #d8e0ff;
  --lime: #3357e0; --lime-dim: #1a3ec8; --ink: #00073a;
  --text: #0a0f2a; --text-muted: #404880;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.20);
  color-scheme: light;
}
:root[data-theme="aqua-dark"] {
  --bg: #08100f; --bg-card: #0f1a18; --bg-elevated: #152220;
  --lime: #00e5c8; --lime-dim: #00c8ae; --ink: #001a16;
  --text: #e0f5f2; --text-muted: #508880;
}
:root[data-theme="aqua-light"] {
  --bg: #effffc; --bg-card: #d9fff9; --bg-elevated: #c0fff5;
  --lime: #007a6a; --lime-dim: #005c50; --ink: #001a16;
  --text: #0a1a18; --text-muted: #30655c;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.20);
  color-scheme: light;
}
:root[data-theme="amber-dark"] {
  --bg: #100d04; --bg-card: #1a1508; --bg-elevated: #221d0d;
  --lime: #ffb800; --lime-dim: #e0a000; --ink: #1a0d00;
  --text: #f5ede0; --text-muted: #907850;
}
:root[data-theme="amber-light"] {
  --bg: #fffbe8; --bg-card: #fff5cc; --bg-elevated: #ffeeaa;
  --lime: #b07800; --lime-dim: #8a5c00; --ink: #1a0800;
  --text: #1a1200; --text-muted: #6a5000;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.20);
  color-scheme: light;
}
:root[data-theme="rose-dark"] {
  --bg: #100810; --bg-card: #1a0f1a; --bg-elevated: #221522;
  --lime: #ff70c0; --lime-dim: #e858aa; --ink: #1a0018;
  --text: #f5e8f5; --text-muted: #906080;
}
:root[data-theme="rose-light"] {
  --bg: #fff0f8; --bg-card: #ffe4f0; --bg-elevated: #ffd6e8;
  --lime: #c0006a; --lime-dim: #9a0055; --ink: #1a0018;
  --text: #1a0018; --text-muted: #7a3060;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.20);
  color-scheme: light;
}
:root[data-theme="grape-dark"] {
  --bg: #0c0810; --bg-card: #15111a; --bg-elevated: #1d1824;
  --lime: #c084fc; --lime-dim: #a868e8; --ink: #0f0018;
  --text: #ede8f5; --text-muted: #705890;
}
:root[data-theme="grape-light"] {
  --bg: #f5f0ff; --bg-card: #ede4ff; --bg-elevated: #e4d8ff;
  --lime: #7c22d0; --lime-dim: #620fb0; --ink: #0f0018;
  --text: #150a2a; --text-muted: #5a4080;
  --border: rgba(0,0,0,0.10); --border-strong: rgba(0,0,0,0.20);
  color-scheme: light;
}
:root[data-theme="mono-dark"] {
  --bg: #0a0a0a; --bg-card: #141414; --bg-elevated: #1e1e1e;
  --lime: #e0e0e0; --lime-dim: #c8c8c8; --ink: #050505;
  --text: #e8e8e8; --text-muted: #888888;
}
:root[data-theme="mono-light"] {
  --bg: #f5f5f5; --bg-card: #ebebeb; --bg-elevated: #e0e0e0;
  --lime: #333333; --lime-dim: #1a1a1a; --ink: #f5f5f5;
  --text: #111111; --text-muted: #666666;
  --border: rgba(0,0,0,0.12); --border-strong: rgba(0,0,0,0.24);
  color-scheme: light;
}
:root[data-theme="retro"] {
  --bg: #1a1800; --bg-card: #252200; --bg-elevated: #2e2a00;
  --lime: #f5d000; --lime-dim: #d8b500; --ink: #1a1400;
  --text: #f0e8c8; --text-muted: #907848;
}
:root[data-theme="neon"] {
  --bg: #0a0015; --bg-card: #120025; --bg-elevated: #180030;
  --lime: #ff00ff; --lime-dim: #dd00dd; --ink: #0a0015;
  --text: #f0d0ff; --text-muted: #9060c0;
}
:root[data-theme="midnight"] {
  --bg: #050508; --bg-card: #0c0d14; --bg-elevated: #12131d;
  --lime: #00b4ff; --lime-dim: #0098e0; --ink: #00081a;
  --text: #d0e0ff; --text-muted: #5878a8;
}
:root[data-theme="forest"] {
  --bg: #080f08; --bg-card: #101a10; --bg-elevated: #162216;
  --lime: #70e060; --lime-dim: #58c848; --ink: #041004;
  --text: #d8f0d0; --text-muted: #507848;
}

/* ── Toggle switch (used in Theme Center auto toggle) ─────────────────── */
.toggle-switch { position:relative; width:46px; height:26px; flex-shrink:0; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-switch .slider {
  position:absolute; inset:0; background:var(--bg-elevated);
  border-radius:999px; border:1px solid var(--border-strong);
  transition:background 0.2s, border-color 0.2s;
  cursor:pointer;
}
.toggle-switch .slider::before {
  content:""; position:absolute; left:3px; top:50%;
  transform:translateY(-50%);
  width:18px; height:18px; border-radius:50%;
  background:var(--text-muted); transition:transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .slider { background:var(--lime); border-color:var(--lime); }
.toggle-switch input:checked + .slider::before { transform:translate(20px,-50%); background:var(--ink); }

/* ── Theme swatch ─────────────────────────────────────────────────────── */
.theme-swatch { width:36px; height:36px; flex-shrink:0; border-radius:50%; overflow:hidden; }
.theme-swatch svg { width:100%; height:100%; display:block; }
.theme-check { color:var(--lime); width:20px; height:20px; flex-shrink:0; margin-left:auto; opacity:0; transition:opacity 0.15s; }
.theme-check.visible { opacity:1; }

* {
  box-sizing: border-box;
  /* No text selection anywhere by default — re-enabled below for the
     actual form fields that need it (typing/editing requires a caret,
     which requires selection to still work there). */
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  /* Custom pull-to-refresh replaces the browser's native one so they don't
     both fire from the same gesture. */
  overscroll-behavior-y: contain;
  /* Blocks pinch-zoom gestures; double-tap zoom is blocked by the
     user-scalable=no viewport meta tag. */
  touch-action: pan-x pan-y;
}

input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* Pull to refresh */
.pull-refresh-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-70px);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px 8px 10px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.pull-refresh-indicator.animated { transition: transform 0.25s var(--ease); }

.pull-refresh-icon-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pull-refresh-ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.pull-refresh-ring-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 3; }

.pull-refresh-ring-progress {
  fill: none;
  stroke: var(--lime);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100.5;
  stroke-dashoffset: 100.5;
  visibility: hidden;
}

.pull-refresh-icon-wrap.holding .pull-refresh-ring-progress { visibility: visible; }

.pull-refresh-arrow {
  display: flex;
  color: var(--text);
  transition: transform 0.15s var(--ease);
}

.pull-refresh-arrow svg { width: 16px; height: 16px; }

.pull-refresh-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.pull-refresh-indicator.refreshing .pull-refresh-arrow { animation: pull-refresh-spin 0.8s linear infinite; }

@keyframes pull-refresh-spin {
  to { transform: rotate(360deg); }
}

/* ── Additional keyframes ─────────────────────────────────────────────── */
@keyframes slideInFromRight {
  from { opacity: 0; transform: translateX(44px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInFromLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes navTabPop {
  0%   { transform: scale(0.78); }
  55%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes checkPop {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes sectionFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Directional view transitions ────────────────────────────────────── */
/* Override the default viewIn with direction-specific variants */
.view.active.anim-slide-right { animation: slideInFromRight 0.3s var(--ease) both; }
.view.active.anim-slide-left  { animation: slideInFromLeft  0.26s var(--ease) both; }
.view.active.anim-fade        { animation: viewIn 0.38s var(--ease) both; }

/* ── Theme color crossfade (class toggled briefly by applyTheme) ──────── */
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color 0.38s var(--ease),
    border-color 0.32s var(--ease),
    color 0.28s var(--ease) !important;
}

/* ── Nav tab pop on activation ───────────────────────────────────────── */
.nav-btn { transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.14s var(--ease); }
.nav-btn.active { animation: navTabPop 0.3s var(--ease) both; }

/* ── Press states on all tappable elements ───────────────────────────── */
.settings-row {
  transition: background 0.12s var(--ease), transform 0.1s var(--ease);
}
.settings-row:not(.settings-row-disabled):active {
  transform: scale(0.982);
  background: rgba(255,255,255,0.07) !important;
}

.page-back-btn {
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
              background 0.18s var(--ease), transform 0.12s var(--ease);
}
.page-back-btn:active { transform: scale(0.86) !important; }

.profile-action-btn {
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
              transform 0.13s var(--ease) !important;
}
.profile-action-btn:active { transform: scale(0.9) !important; }

.social-icon-btn {
  transition: border-color 0.18s var(--ease), transform 0.14s var(--ease);
}

/* Workout + weight + food cards press */
.workout-card:active,
.food-item:active,
.weight-row:active { transform: scale(0.985) !important; }

/* ── Checkmark pop (theme selection) ────────────────────────────────── */
.theme-check.visible { animation: checkPop 0.28s var(--ease) both; }

/* ── Section stagger inside sub-page .view-content ──────────────────── */
/* Each direct child (a wrapper div containing a panel or label) fades up */
.view.active .view-content > *:nth-child(1) { animation: sectionFadeUp 0.32s var(--ease) 0.04s both; }
.view.active .view-content > *:nth-child(2) { animation: sectionFadeUp 0.32s var(--ease) 0.09s both; }
.view.active .view-content > *:nth-child(3) { animation: sectionFadeUp 0.32s var(--ease) 0.14s both; }
.view.active .view-content > *:nth-child(4) { animation: sectionFadeUp 0.32s var(--ease) 0.19s both; }
.view.active .view-content > *:nth-child(5) { animation: sectionFadeUp 0.32s var(--ease) 0.24s both; }
.view.active .view-content > *:nth-child(6) { animation: sectionFadeUp 0.32s var(--ease) 0.29s both; }
.view.active .view-content > *:nth-child(7) { animation: sectionFadeUp 0.32s var(--ease) 0.34s both; }
.view.active .view-content > *:nth-child(n+8) { animation: sectionFadeUp 0.32s var(--ease) 0.38s both; }

/* ── Input focus glow ────────────────────────────────────────────────── */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lime) 18%, transparent);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.app {
  display: flex;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Auth */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 36px 30px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lift);
  animation: fadeInUp 0.5s var(--ease) both;
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 20px;
}

.auth-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 24px;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.auth-form.active { display: flex; }

.auth-submit { width: 100%; }

.auth-error {
  color: var(--coral);
  font-size: 0.82rem;
  min-height: 1em;
  margin: -4px 0 0;
}

.auth-switch {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 16px 0 0;
}

.auth-switch.hidden { display: none; }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--lime);
  font-weight: 700;
  font-size: inherit;
  cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }

.auth-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 22px 0 0;
}

/* Pill buttons */
.btn-pill {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn-pill:active { transform: scale(0.97); }

.btn-primary-pill {
  background: var(--lime);
  color: var(--ink);
}

.btn-primary-pill:hover { background: var(--lime-dim); transform: translateY(-1px); }

.auth-social-label {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.auth-social-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.social-icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.social-icon-btn:hover { border-color: var(--lime); transform: translateY(-2px); }
.social-icon-btn:active { transform: scale(0.94); }
.social-icon-btn svg { width: 20px; height: 20px; }
#apple-login-btn svg,
#github-login-btn svg { color: #fff; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 18px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Icon-prefixed inputs */
.input-icon-field { position: relative; }

.input-icon-field input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 13px 44px 13px 42px;
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.input-icon-field input:focus { border-color: var(--lime); }

.input-icon-field .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}

.input-icon-field .input-icon svg { width: 16px; height: 16px; }

/* Safari overlays its own "contacts autofill" person icon on fields it
   recognizes as a username/name/contact field, which collides with our own
   icon at the same spot — hide Safari's so only ours shows. */
.input-icon-field input::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.input-toggle-visibility {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
}

.input-toggle-visibility svg { width: 16px; height: 16px; }
.input-toggle-visibility:hover { color: var(--text); }

/* Sidebar */
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-icon { display: inline-flex; color: var(--lime); }
.brand-icon svg { width: 22px; height: 22px; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-btn:active { transform: scale(0.97); }

.nav-btn.active {
  background: var(--lime);
  color: var(--ink);
}

.nav-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.coming-soon-tag {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.nav-icon { display: inline-flex; }
.nav-icon svg { width: 17px; height: 17px; }

.mobile-nav { display: none; }

/* Content */
.content {
  flex: 1;
  padding: 28px 32px 60px;
  max-width: 1300px;
}

.view { display: none; }
.view.active { display: block; animation: viewIn 0.4s var(--ease) both; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutDown {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

.view-header { margin-bottom: 24px; }
.view-header h1 { margin: 0 0 4px; font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; }
.subtitle { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* Bento grid (dashboard) */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card--hero { grid-column: 1 / span 3; grid-row: 1; }
.stat-card--lime { grid-column: 1; grid-row: 2; }
.stat-card--dark { grid-column: 2; grid-row: 2; }
.stat-card--white { grid-column: 3; grid-row: 2; }

@media (max-width: 800px) {
  .bento-grid { grid-template-columns: 1fr 1fr 1fr; }
  .stat-card--hero { grid-column: 1 / span 3; grid-row: auto; }
  .stat-card--lime { grid-column: 1; grid-row: auto; }
  .stat-card--dark { grid-column: 2; grid-row: auto; }
  .stat-card--white { grid-column: 3; grid-row: auto; }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
  animation: fadeInUp 0.45s var(--ease) both;
}

.stat-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }

.stat-card--hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.stat-card--lime { background: var(--lime); color: var(--ink); border-color: transparent; }
.stat-card--white { background: var(--white); color: var(--ink); border-color: transparent; }
.stat-card--dark { background: var(--bg-card); }

.stat-card--lime .stat-label,
.stat-card--white .stat-label { color: rgba(13, 15, 10, 0.62); }

.stat-card--lime .stat-value,
.stat-card--white .stat-value { color: var(--ink); }

.stat-card--lime .stat-unit,
.stat-card--white .stat-unit { color: rgba(13, 15, 10, 0.62); }

.stat-card--lime:hover,
.stat-card--white:hover { border-color: transparent; }

.stat-card--macro { background: var(--bg-card); }

.stat-card:nth-child(1) { animation-delay: 0.02s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.14s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--lime);
  letter-spacing: -0.02em;
}

.stat-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Streak ring */
.ring-wrap { position: relative; width: 148px; height: 148px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 10; }
.ring-progress {
  fill: none;
  stroke: var(--lime);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.7s var(--ease);
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-value { font-size: 2.1rem; font-weight: 800; color: var(--lime); line-height: 1; }
.ring-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; font-weight: 600; }

/* Panel */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  animation: fadeInUp 0.45s var(--ease) both;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-header h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }

/* Forms */
.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.form-field.grow { flex: 1; }

label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s var(--ease);
  width: 100%;
}

input:focus, select:focus, textarea:focus { border-color: var(--lime); }

textarea { resize: vertical; font-family: inherit; }

/* Exercise picker trigger */
.exercise-picker-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  gap: 8px;
}
.exercise-picker-btn svg { flex-shrink: 0; color: var(--text-muted); }
.exercise-picker-placeholder { color: var(--text-muted); }

/* Exercise picker sub-page */
.exercise-picker-search-wrap {
  position: relative;
  padding: 12px 16px 8px;
}
.exercise-picker-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.exercise-picker-search {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 10px 16px 10px 40px;
  box-sizing: border-box;
}
.exercise-picker-search:focus { outline: none; border-color: var(--lime); }
.exercise-muscle-chips {
  display: flex;
  gap: 8px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.exercise-muscle-chips::-webkit-scrollbar { display: none; }
.muscle-chip-section {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0.55;
  align-self: center;
  padding: 0 2px 0 6px;
  pointer-events: none;
  user-select: none;
}
.exercise-equip-chips {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.exercise-equip-chips::-webkit-scrollbar { display: none; }
.exercise-equip-chip {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  padding: 4px 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.exercise-equip-chip.active {
  background: var(--lime-dim);
  border-color: var(--lime-dim);
  color: var(--ink);
}
.exercise-muscle-chip {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.exercise-muscle-chip.active {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--ink);
}
.exercise-picker-list {
  flex: 1;
  overflow-y: auto;
}
.exercise-letter-header {
  padding: 8px 16px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lime);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.exercise-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.exercise-row--custom { background: color-mix(in srgb, var(--lime) 8%, transparent); }
.exercise-row-select {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.exercise-row-select:hover { background: var(--bg-elevated); }
.exercise-row-select:active { background: color-mix(in srgb, var(--bg-elevated) 80%, var(--lime) 20%); }
.exercise-row-info { display: flex; flex-direction: column; gap: 2px; }
.exercise-row-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.exercise-row-muscle { font-size: 0.78rem; color: var(--text-muted); }
.exercise-row-info-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  margin-right: 4px;
  border-radius: 50%;
}
.exercise-row-info-btn:hover { color: var(--lime); background: color-mix(in srgb, var(--lime) 10%, transparent); }
.exercise-row-info-btn:active { color: var(--lime); background: color-mix(in srgb, var(--lime) 20%, transparent); }

/* Exercise info page */
.exercise-info-content { padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 24px; }
.exercise-info-section { display: flex; flex-direction: column; gap: 10px; }
.exercise-info-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}
.exercise-info-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.exercise-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 72px;
}
.exercise-info-card svg { width: 52px; height: 52px; border-radius: 12px; }
.exercise-info-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.exercise-info-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  counter-reset: steps;
}
.exercise-info-step {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  counter-increment: steps;
}
.exercise-info-step:last-child { border-bottom: none; }
.exercise-info-step::before {
  content: counter(steps);
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lime) 15%, transparent);
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.exercise-info-select-btn { width: 100%; }

.sets-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin: 16px 0 8px; }

.sets-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.set-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  animation: fadeInUp 0.3s var(--ease) both;
}

.set-row.removing {
  animation: fadeOutDown 0.22s var(--ease) forwards;
  pointer-events: none;
}

.set-index {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.set-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s var(--ease);
}
.set-remove svg { width: 15px; height: 15px; }
.set-remove:hover { color: var(--coral); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--lime); color: var(--ink); }
.btn-primary:hover { background: var(--lime-dim); transform: translateY(-1px); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--lime); color: var(--lime); }

.btn-danger {
  background: transparent;
  border: 1px solid var(--coral);
  color: var(--coral);
}
.btn-danger:hover { background: var(--coral); color: var(--ink); border-color: transparent; }

.btn-danger-solid { background: var(--coral); color: var(--ink); border: none; }
.btn-danger-solid:hover { background: var(--coral-dim); transform: translateY(-1px); }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s var(--ease);
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { color: var(--coral); }

/* Activity rows (workout cards) */
.workout-list { display: flex; flex-direction: column; gap: 10px; }

.workout-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
  animation: fadeInUp 0.4s var(--ease) both;
}

.workout-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.workout-card.removing {
  animation: fadeOutDown 0.25s var(--ease) forwards;
  pointer-events: none;
}

.workout-list > :nth-child(1), .history-list > :nth-child(1) { animation-delay: 0.02s; }
.workout-list > :nth-child(2), .history-list > :nth-child(2) { animation-delay: 0.06s; }
.workout-list > :nth-child(3), .history-list > :nth-child(3) { animation-delay: 0.1s; }
.workout-list > :nth-child(4), .history-list > :nth-child(4) { animation-delay: 0.14s; }
.workout-list > :nth-child(5), .history-list > :nth-child(5) { animation-delay: 0.18s; }
.workout-list > :nth-child(6), .history-list > :nth-child(6) { animation-delay: 0.22s; }

.workout-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(215, 255, 61, 0.14);
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workout-icon svg { width: 18px; height: 18px; }

.workout-body { flex: 1; min-width: 0; }

.workout-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.workout-exercise {
  font-weight: 700;
  font-size: 1rem;
}

.workout-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.workout-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.set-chip {
  background: rgba(215, 255, 61, 0.14);
  color: var(--lime);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.workout-notes {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.workout-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 30px 0;
  font-size: 0.9rem;
  animation: fadeInUp 0.4s var(--ease) both;
}

/* History grouping */
.history-day-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 0 8px;
}
.history-day-label:first-child { margin-top: 0; }

/* PR list */
.pr-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.pr-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
  animation: fadeInUp 0.4s var(--ease) both;
}

.pr-card:hover { transform: translateY(-2px); }

.pr-list > :nth-child(3n+1) { background: var(--lime); color: var(--ink); border-color: transparent; }
.pr-list > :nth-child(3n+1) .pr-exercise { color: rgba(13, 15, 10, 0.62); }
.pr-list > :nth-child(3n+1) .pr-value { color: var(--ink); }

.pr-list > :nth-child(3n+2) { background: var(--white); color: var(--ink); border-color: transparent; }
.pr-list > :nth-child(3n+2) .pr-exercise { color: rgba(13, 15, 10, 0.55); }
.pr-list > :nth-child(3n+2) .pr-value { color: var(--ink); }

.pr-list > :nth-child(1) { animation-delay: 0.02s; }
.pr-list > :nth-child(2) { animation-delay: 0.06s; }
.pr-list > :nth-child(3) { animation-delay: 0.1s; }
.pr-list > :nth-child(4) { animation-delay: 0.14s; }
.pr-list > :nth-child(5) { animation-delay: 0.18s; }
.pr-list > :nth-child(6) { animation-delay: 0.22s; }

.pr-exercise { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.pr-value { font-size: 1.25rem; font-weight: 800; color: var(--lime); }

/* Weight list */
.weight-list { display: flex; flex-direction: column; gap: 8px; }

.weight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
  animation: fadeInUp 0.35s var(--ease) both;
}

.weight-row:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.weight-row.removing {
  animation: fadeOutDown 0.22s var(--ease) forwards;
  pointer-events: none;
}

.weight-list > :nth-child(1) { animation-delay: 0.02s; }
.weight-list > :nth-child(2) { animation-delay: 0.06s; }
.weight-list > :nth-child(3) { animation-delay: 0.1s; }
.weight-list > :nth-child(4) { animation-delay: 0.14s; }
.weight-list > :nth-child(5) { animation-delay: 0.18s; }

.weight-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(215, 255, 61, 0.14);
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.weight-icon svg { width: 15px; height: 15px; }

.weight-row-body { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.weight-row-date { color: var(--text-muted); font-size: 0.85rem; }
.weight-row-value { font-weight: 700; }

/* Radio group */
.radio-group { display: flex; gap: 10px; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.radio-option:has(input:checked) {
  background: var(--lime);
  color: var(--ink);
  border-color: transparent;
}
.radio-option input { position: absolute; opacity: 0; width: 0; height: 0; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px) scale(0.95);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 100;
  box-shadow: var(--shadow-lift);
}
.toast::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  margin-right: 9px;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* Confirm dialog */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}

.confirm-overlay.show { opacity: 1; pointer-events: auto; }

.confirm-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  max-width: 340px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow-lift);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.28s var(--ease);
}

.confirm-overlay.show .confirm-dialog { transform: scale(1) translateY(0); }

.confirm-message {
  margin: 0 0 22px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Add Food / Add Custom Food / Create Meal are real full pages (like
   Nutrition, Dashboard, etc. — toggled via .view/.view.active) rather than
   a floating/centered popup, since a fixed-position centered dialog was
   unreliable on iPad Safari (misrendered/unreachable Cancel button).
   Being a normal .view also means the sidebar stays visible on desktop and
   there's no background page left underneath to accidentally scroll. */
.view-header-back {
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-header-back h1 { margin: 0; }

.page-back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.page-back-btn:hover { color: var(--lime); border-color: var(--lime); }
.page-back-btn svg { width: 18px; height: 18px; }

.food-dialog { max-width: 900px; }

#food-dialog-meal { color: var(--lime); }

.food-dialog form .form-field { margin-bottom: 14px; }
.food-dialog form .form-row { gap: 10px; }
.food-dialog form .form-row .form-field { margin-bottom: 0; min-width: 0; }

.food-source-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}

.food-source-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.food-source-tab.active { background: var(--lime); color: var(--ink); }

.food-source-panel { display: none; margin-bottom: 16px; }
.food-source-panel.active { display: block; }

.food-find-header { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }

.food-quick-add-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.food-quick-add-btn svg { width: 17px; height: 17px; }
.food-quick-add-btn:hover { border-color: var(--lime); color: var(--lime); }

.food-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 2px;
}

.food-filter-chip {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.food-filter-chip.active { background: var(--lime); color: var(--ink); border-color: transparent; }

.food-filter-panel { display: none; }
.food-filter-panel.active { display: block; }

.food-filter-cta { width: 100%; margin-top: 10px; }

.food-db-search-input { margin-bottom: 10px; }

.food-category-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 2px;
}

.food-category-chip {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.food-category-chip.active { border-color: var(--lime); color: var(--lime); }

.food-db-credit {
  margin: 10px 0 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

.food-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
}

.food-search-result {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: border-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.food-search-result:hover { border-color: var(--lime); transform: translateY(-1px); }

.food-search-result-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.food-star-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}
.food-star-btn svg { width: 16px; height: 16px; }
.food-star-btn:hover { color: var(--lime); transform: scale(1.1); }
.food-star-btn.starred { color: var(--lime); }

/* Food detail page (shown when a search/barcode/photo/saved result is
   selected, before it's actually added to the log) */
.food-detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.food-detail-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
}

.food-detail-icon svg { width: 24px; height: 24px; }

.food-detail-hero-info { flex: 1; min-width: 0; }
.food-detail-hero-info h2 { margin: 0; font-size: 1.15rem; font-weight: 800; overflow-wrap: break-word; }

.food-detail-star {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.food-detail-meal-row { display: flex; gap: 6px; flex-wrap: wrap; }

.food-detail-meal-btn {
  flex: 1;
  min-width: 70px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.food-detail-meal-btn.active { background: var(--lime); color: var(--ink); border-color: transparent; }

#food-detail-serving { margin-bottom: 4px; }

.food-detail-macros-row { display: flex; gap: 10px; }

.food-detail-calorie-card {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.food-detail-calorie-value { font-size: 1.8rem; font-weight: 800; }
.food-detail-calorie-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.food-detail-macro-list {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.food-detail-macro-line { display: flex; justify-content: space-between; font-size: 0.88rem; }
.food-detail-macro-line span:first-child { color: var(--text-muted); }
.food-detail-macro-line span:last-child { font-weight: 700; }

.food-detail-list-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 14px;
}

.food-detail-list-card .food-detail-macro-line {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.food-detail-list-card .food-detail-macro-line:last-child { border-bottom: none; }

.food-search-result-name { font-weight: 700; font-size: 0.88rem; color: var(--text); }
.food-search-result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.food-source-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--lime);
  background: rgba(215, 255, 61, 0.12);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

.meal-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.meal-item-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  animation: fadeInUp 0.25s var(--ease) both;
}

.meal-item-row.removing {
  animation: fadeOutDown 0.2s var(--ease) forwards;
  pointer-events: none;
}

.meal-item-row .meal-item-name { width: 100%; margin-bottom: 6px; }

.meal-item-macros {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}

.meal-item-macros input { padding: 8px; font-size: 0.85rem; }

.meal-item-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: color 0.15s var(--ease);
}
.meal-item-remove svg { width: 15px; height: 15px; }
.meal-item-remove:hover { color: var(--coral); }

/* Date nav */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
}

.date-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.date-nav-btn svg { width: 16px; height: 16px; }
.date-nav-btn:hover { border-color: var(--lime); color: var(--lime); }
.date-nav-btn:active { transform: scale(0.92); }

.date-nav-label {
  font-weight: 700;
  font-size: 1rem;
  min-width: 140px;
  text-align: center;
}

/* Food items */
.food-list { display: flex; flex-direction: column; gap: 8px; }

.food-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
  animation: fadeInUp 0.35s var(--ease) both;
}

.food-item:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.food-item.removing {
  animation: fadeOutDown 0.22s var(--ease) forwards;
  pointer-events: none;
}

.food-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(215, 255, 61, 0.14);
  color: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.food-icon svg { width: 15px; height: 15px; }

.food-item-body { flex: 1; min-width: 0; }
.food-item-name { font-weight: 700; font-size: 0.92rem; }
.food-item-macros { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }
.food-item-calories { font-weight: 700; color: var(--lime); white-space: nowrap; }

/* Responsive */
@media (max-width: 800px) {
  .sidebar { display: none; }
  .app { flex-direction: column; }
  .content { padding: 16px 16px 100px; max-width: 100%; }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    justify-content: space-around;
    align-items: center;
    padding: 8px;
    z-index: 50;
    box-shadow: var(--shadow-lift);
  }
  .mobile-nav .nav-btn {
    background: transparent;
    border: none;
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }
  .mobile-nav .nav-btn:active { transform: scale(0.92); }
  .mobile-nav .nav-btn:disabled { opacity: 0.32; cursor: not-allowed; pointer-events: none; }
  .mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
  }
  .mobile-nav-icon svg { width: 19px; height: 19px; flex-shrink: 0; }
  .mobile-nav .nav-btn.active .mobile-nav-icon { background: var(--lime); color: var(--ink); }
}

@media (max-width: 480px) {
  .set-row { grid-template-columns: 24px 1fr 1fr auto; }
}

/* Statistics */
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted); font-size: 0.9rem; }
.stat-value { font-weight: 600; font-size: 0.9rem; text-align: right; }
.stat-coming-soon { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; color: var(--text-muted); font-size: 0.9rem; border-bottom: 1px solid rgba(255,255,255,0.05); opacity: 0.5; }
.stat-coming-soon:last-child { border-bottom: none; }

/* Connected accounts */
.connected-accounts-list { display: flex; flex-direction: column; margin-top: 12px; }
.connected-account-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; opacity: 0.5;
}
.connected-account-row--active { opacity: 1; }
.connected-account-icon { width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; }
.connected-account-icon svg { width: 20px; height: 20px; }
.connected-account-label { flex: 1; font-size: 0.95rem; font-weight: 500; }
.connected-account-status { font-size: 0.78rem; font-weight: 600; }
.connected-account-status--on { color: var(--lime); }
.connected-account-divider { height: 1px; background: rgba(255,255,255,0.06); }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }

/* Settings sections */
.settings-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 20px 0 6px 4px;
  margin: 0;
}
.panel-rows { padding: 0; overflow: hidden; }
.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.settings-row:hover { background: rgba(255,255,255,0.04); }
.settings-row-disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.settings-row-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.settings-row-icon svg { width: 18px; height: 18px; }
.settings-row-label { flex: 1; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.settings-row-arrow { color: var(--text-muted); font-size: 1.2rem; }
.settings-row-value { font-size: 0.85rem; color: var(--text-muted); margin-right: 4px; }
.settings-row-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 0 20px; }

/* Units segmented rows */
.units-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 16px; }
.units-row-label { font-size: 0.9rem; color: var(--text-muted); }
.units-seg { display: flex; gap: 6px; }
.units-seg-btn { padding: 6px 14px; border-radius: 12px; border: none; background: var(--bg-elevated); color: var(--text-muted); font-size: 0.85rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.18s, color 0.18s; }
.units-seg-btn.active { background: var(--lime); color: var(--ink); }

/* Disclaimer modal (first-login) */
.disclaimer-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0,0,0,0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.disclaimer-modal-overlay.show { opacity: 1; pointer-events: auto; }
.disclaimer-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  box-shadow: var(--shadow-lift);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.3s var(--ease);
}
.disclaimer-modal-overlay.show .disclaimer-modal-card { transform: scale(1) translateY(0); }
.disclaimer-modal-icon { display: flex; justify-content: center; margin-bottom: 14px; color: var(--lime); }
.disclaimer-modal-title { font-size: 1.15rem; font-weight: 700; text-align: center; margin: 0 0 14px; }
.disclaimer-modal-body { font-size: 0.88rem; line-height: 1.55; color: var(--text-muted); margin: 0 0 10px; }

/* Contextual disclaimer banners */
.disclaimer-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(215,255,61,0.06);
  border: 1px solid rgba(215,255,61,0.18);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.disclaimer-banner--standalone {
  margin: 12px 16px 8px;
}
.disclaimer-banner-icon { flex-shrink: 0; width: 15px; height: 15px; margin-top: 2px; color: var(--lime); opacity: 0.7; }

/* Nutrition edit-goals button (on hero ring card) */
.nutrition-edit-goals-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 10px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s, color 0.15s;
}
.nutrition-edit-goals-btn:active { background: rgba(255,255,255,0.14); color: var(--text); }

/* Macro goals edit sheet rows */
.macro-goals-rows { display: flex; flex-direction: column; gap: 12px; }
.macro-goals-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.macro-goals-label { width: 70px; flex-shrink: 0; font-size: 0.95rem; font-weight: 500; color: var(--text); }
.macro-goals-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  padding: 8px 12px;
  text-align: center;
}
.macro-goals-input:focus { outline: none; border-color: var(--lime); }

/* Mini calendar */
.mini-cal { background: var(--bg-card); border-radius: var(--radius-sm); padding: 16px; }
.mini-cal-header { text-align: center; font-weight: 700; font-size: 1rem; color: var(--text); margin-bottom: 12px; }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mini-cal-day-head { text-align: center; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); padding: 4px 0; }
.mini-cal-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; color: var(--text-muted); border-radius: 50%; }
.mini-cal-today { background: var(--lime); color: var(--ink); font-weight: 700; }

/* Import app cards */
.import-app-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.import-app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 16px 12px;
  cursor: pointer;
  width: calc(33.33% - 8px);
  min-width: 88px;
  transition: background 0.15s, border-color 0.15s;
}
.import-app-card:active {
  background: var(--hover-bg, rgba(0,0,0,0.06));
}
.import-app-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
}
.import-app-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.import-app-card--soon {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}
.import-app-icon--white-bg {
  background: #fff;
  padding: 6px;
  box-sizing: border-box;
}

/* Connection type tags on app cards */
.import-app-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
}
.import-app-tag--import { background: #e8f5e9; color: #2e7d32; }
.import-app-tag--sync    { background: #e3f2fd; color: #1565c0; }
.import-app-tag--connect { background: #fff3e0; color: #e65100; }

/* ---- Profile page ---- */
.profile-hero {
  position: relative;
  background: var(--bg-card);
}
.profile-banner {
  width: 100%;
  height: 110px;
  background: linear-gradient(135deg, #1a237e, #42a5f5);
  background-size: cover;
  background-position: center;
  transition: background 0.2s;
}
.profile-banner--none {
  background: var(--bg-elevated) !important;
}
.profile-hero-body {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 0 16px 16px;
  margin-top: -32px;
}
.profile-avatar-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  /* box-shadow applied by JS to create gap + optional colour ring */
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  box-sizing: border-box;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.profile-hero-info { flex: 1; min-width: 0; padding-bottom: 2px; }
.profile-card-title {
  margin: 0 0 1px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.profile-card-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-card-username {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.profile-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.profile-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.profile-action-btn svg { stroke: var(--text); }
.profile-action-btn:hover { background: var(--bg-card); border-color: var(--border-strong); }
.profile-action-btn.active {
  background: var(--bg-card);
  border-color: var(--text);
}
.profile-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 0 4px;
}
.profile-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.profile-swatch:hover { transform: scale(1.15); }
.profile-swatch.selected { border-color: var(--text); transform: scale(1.1); }
.profile-banner-swatch {
  width: 48px;
  height: 30px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.profile-banner-swatch:hover { transform: scale(1.08); }
.profile-banner-swatch.selected { border-color: var(--text); transform: scale(1.05); }

/* ---- Log Hub ---- */
.log-hub-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 16px 8px;
}
.log-hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  text-align: left;
  min-width: 0;
}
.log-hub-card:hover { background: var(--bg-elevated); border-color: var(--lime); transform: translateY(-1px); }
.log-hub-card-icon { color: var(--lime); margin-bottom: 2px; }
.log-hub-card-icon svg { width: 22px; height: 22px; }
.log-hub-card-title { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.log-hub-card-sub { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.log-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}
.log-section-title { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

/* ---- Routine Cards ---- */
.routine-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 16px 10px;
  padding: 14px 14px 12px;
  animation: fadeInUp 0.3s var(--ease) both;
}
.routine-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.routine-card-name { font-size: 0.97rem; font-weight: 700; color: var(--text); }
.routine-card-actions { display: flex; gap: 4px; }
.routine-exercises-preview { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.routine-ex-item { font-size: 0.82rem; color: var(--text-muted); }
.routine-ex-more { color: var(--lime); font-weight: 600; }
.routine-card-footer { display: flex; align-items: center; justify-content: space-between; }
.routine-count { font-size: 0.8rem; color: var(--text-muted); }

/* ---- Create Routine / Exercise list ---- */
.routine-ex-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.routine-ex-num { font-size: 0.8rem; color: var(--text-muted); min-width: 18px; }
.routine-ex-name-text { flex: 1; font-size: 0.9rem; color: var(--text); }

/* ---- Workout Session ---- */
.session-ex-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 8px 16px;
  padding: 12px 14px 8px;
}
.session-ex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.session-ex-name { font-size: 0.95rem; font-weight: 700; color: var(--lime); }
.session-sets-head {
  display: grid;
  grid-template-columns: 28px 52px 1fr 1fr 36px;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0 4px;
}
.session-set-row {
  display: grid;
  grid-template-columns: 28px 52px 1fr 1fr 36px;
  gap: 6px;
  align-items: center;
  margin-bottom: 5px;
  border-radius: 6px;
  padding: 2px 0;
  transition: background 0.15s;
}
.session-set-done { background: rgba(var(--lime-rgb, 163,184,20), 0.12); }
.set-index { font-size: 0.8rem; color: var(--text-muted); text-align: center; }
.set-prev { font-size: 0.78rem; color: var(--text-muted); text-align: center; }
.session-set-row input[type="number"] {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 6px 6px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}
.session-set-row input[type="number"]:focus { outline: none; border-color: var(--lime); }
.session-set-check {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.session-set-check:hover { border-color: var(--lime); color: var(--lime); }
.session-set-check-done { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.session-add-set { margin: 6px 0 8px; font-size: 0.82rem; }
.session-notes {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 8px 0 4px;
  margin-top: 4px;
  outline: none;
}
.session-notes::placeholder { color: var(--text-muted); opacity: 0.6; }

/* ---- Choose Routine ---- */
.choose-routine-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
  transition: background 0.12s;
}
.choose-routine-row:hover { background: var(--bg-card); }
.choose-routine-empty { font-weight: 600; color: var(--lime); }
.choose-routine-name { font-weight: 600; }
.choose-routine-count { font-size: 0.8rem; color: var(--text-muted); }

/* ---- Icon button (small ghost) ---- */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--bg-elevated); }

/* ---- Session header timer ---- */
.session-header { gap: 0; }
.session-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}
.session-timer {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.session-heading-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.session-set-done { background: rgba(215,255,61,0.1); }

/* ---- Sync badge ---- */
.sync-badge {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}
.sync-ok { background: var(--lime); }
.sync-syncing { background: #f5a623; animation: pulse 1s infinite; }
.sync-fail { background: var(--coral); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- Cardio session rows (duration instead of weight/reps) ---- */
.session-sets-head-cardio,
.session-set-row-cardio {
  grid-template-columns: 28px 60px 1fr 36px;
}

/* ---- Cardio (running/cycling/etc) session rows: min/km/kcal ---- */
.session-sets-head-run,
.session-set-row-run {
  grid-template-columns: 24px 1fr 1fr 1fr 36px;
}
.session-cardio-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 2px 8px;
}
.session-pace { color: var(--lime); font-weight: 600; }

/* ---- Live GPS tracking ---- */
.gps-track-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.gps-start-btn { width: 100%; display: flex; align-items: center; justify-content: center; }
.gps-live-stats {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}

/* ---- GPS route map ---- */
.gps-map {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.gps-map .leaflet-control-attribution { display: none; }
.gps-map--dark .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.8);
}

/* ---- Bluetooth equipment connect bar ---- */
.gps-track-bar { gap: 8px; }

/* ---- Start Activity flow ---- */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 8px 16px 32px;
}
.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--lime);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.activity-card:hover { background: var(--bg-elevated); border-color: var(--lime); transform: translateY(-1px); }
.activity-card span { color: var(--text); font-size: 0.9rem; font-weight: 600; }

.live-activity-map {
  height: 260px;
  margin: 8px 16px 14px;
}
.live-activity-stats {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 16px 16px;
  font-variant-numeric: tabular-nums;
}
.live-activity-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 16px;
}
.live-activity-actions .btn { display: flex; align-items: center; justify-content: center; }

/* ---- Live Activity manual fallback ---- */
.live-activity-manual-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 4px 16px 6px;
  margin: 0;
}
.live-activity-manual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 8px;
}
.live-activity-manual-grid label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.live-activity-manual-grid input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}
.live-activity-actions .btn:disabled,
.live-activity-manual-grid input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Activity section labels (Cardio / Team Sports) ---- */
.activity-section-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 16px 4px;
}
.activity-section-label:first-child { padding-top: 4px; }

/* ---- Sport-specific match stats (Live Activity) ---- */
.sport-position-chips {
  display: flex;
  gap: 8px;
  padding: 0 16px 10px;
  flex-wrap: wrap;
}
.sport-position-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sport-position-chip.active { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.sport-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px 14px;
}
.sport-stats-grid label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}
.sport-stats-grid input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

/* ---- Sport stats in History cards ---- */
.workout-sport-stats {
  font-size: 0.8rem;
  color: var(--lime);
  font-weight: 600;
  margin-top: 4px;
}
.workout-position-tag {
  background: var(--bg-elevated);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 4px;
}
