/* SlantFitness — Dark Fitness Theme
   Inspired by Peloton/WHOOP, orange accent, dark-first.
   Replaces Braun neumorphism with modern flat + glow design. */

/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════ */

:root {
  /* Spacing (8pt grid) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s var(--ease-out);
  --transition-base: 0.25s var(--ease-out);
  --transition-slow: 0.4s var(--ease-out);

  /* Fonts */
  --font-display: 'SF Pro Display', -apple-system, 'Helvetica Neue', system-ui, sans-serif;
  --font-body: -apple-system, 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, 'Menlo', monospace;
}

/* ── Dark mode (default) ── */
.braun-theme,
.braun-dark {
  --color-bg: #0d0d0d;
  --color-surface: #1a1a1a;
  --color-surface-hover: #222222;
  --color-elevated: #242424;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.15);

  --color-text: #ffffff;
  --color-text-secondary: #a0a0a0;
  --color-text-muted: #666666;

  --color-accent: #ff6a00;
  --color-accent-hover: #ff8533;
  --color-accent-pressed: #cc5500;
  --color-accent-glow: rgba(255, 106, 0, 0.25);
  --color-accent-subtle: rgba(255, 106, 0, 0.10);
  --color-accent-muted: rgba(255, 106, 0, 0.06);

  --braun-green: #00d26a;
  --braun-red: #ff4444;
  --braun-amber: #ffb400;

  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 4px 16px var(--color-accent-glow);
  --glass-bg: rgba(26, 26, 26, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);

  color-scheme: dark;
}

/* ── Light mode ── */
.braun-light {
  --color-bg: #f2f2f2;
  --color-surface: #ffffff;
  --color-surface-hover: #f7f7f7;
  --color-elevated: #ffffff;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-strong: rgba(0, 0, 0, 0.15);

  --color-text: #111111;
  --color-text-secondary: #555555;
  --color-text-muted: #999999;

  --color-accent: #ff6a00;
  --color-accent-hover: #e55e00;
  --color-accent-pressed: #cc5500;
  --color-accent-glow: rgba(255, 106, 0, 0.20);
  --color-accent-subtle: rgba(255, 106, 0, 0.08);
  --color-accent-muted: rgba(255, 106, 0, 0.04);

  --braun-green: #00b85c;
  --braun-red: #e03838;
  --braun-amber: #e6a200;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 4px 16px rgba(255, 106, 0, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.06);

  color-scheme: light;
}

/* ── Accent override for backwards compat ── */
.braun-accent-orange { --color-accent: #ff6a00; --braun-accent: #ff6a00; }

/* Legacy variable aliases (used by JS-generated inline styles) */
.braun-theme, .braun-dark, .braun-light {
  --braun-seam: var(--color-border);
  --braun-highlight: transparent;
  --braun-shadow: rgba(0,0,0,0.2);
  --braun-shadow-light: transparent;
  --braun-shadow-deep: rgba(0,0,0,0.3);
  --braun-btn-bg: var(--color-surface);
  --braun-btn-shadow: var(--shadow-card);
  --braun-btn-shadow-pressed: inset 0 1px 3px rgba(0,0,0,0.2);
  --braun-btn-text: var(--color-text);
  --braun-black: #333;
}


/* ═══════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  overscroll-behavior: contain;
  overflow-x: hidden;
}

html, body { overflow-x: hidden; max-width: 100vw; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Thin icons globally */
svg { stroke-width: 1.5 !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }
.braun-light ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); }
.braun-light ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }


/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--color-accent-glow); }
  50% { box-shadow: 0 0 20px 4px var(--color-accent-glow); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Legacy animation names */
@keyframes braunFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes braunPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Staggered card entrance */
.card, .streak-strip, .today-dashboard, .section-header {
  opacity: 0;
  animation: fadeSlideUp 400ms var(--ease-out) forwards;
}
.streak-strip { animation-delay: 0ms; }
.today-dashboard { animation-delay: 60ms; }
main .section-header:nth-of-type(1) { animation-delay: 100ms; }
main .card:nth-of-type(1) { animation-delay: 130ms; }
main .section-header:nth-of-type(2) { animation-delay: 180ms; }
main .card:nth-of-type(2) { animation-delay: 210ms; }
main .section-header:nth-of-type(3) { animation-delay: 260ms; }
main .card:nth-of-type(3) { animation-delay: 290ms; }
main .section-header:nth-of-type(4) { animation-delay: 320ms; }
main .card:nth-of-type(4) { animation-delay: 350ms; }

/* Button press micro-interaction */
.btn, .tab-item, .habit-row, .feeling-dot, .date-nav button {
  transition: transform 100ms ease-out;
}
.btn:active, .habit-row:active, .feeling-dot:active, .date-nav button:active {
  transform: scale(0.96);
}


/* ═══════════════════════════════════════════════════════
   NAVIGATION — Top bar (desktop)
   ═══════════════════════════════════════════════════════ */

nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 var(--space-lg);
  height: 56px;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

nav .brand {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-right: var(--space-lg);
  white-space: nowrap;
}
.brand-sep { color: var(--color-accent); font-weight: 400; margin: 0 2px; }

.nav-links {
  display: flex; align-items: center; gap: 4px; flex: 1;
}
.nav-icon { display: none; }

nav a {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
nav a:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}
nav a.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* Mode toggle */
nav .mode-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
nav .mode-toggle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
nav .mode-toggle:active { transform: scale(0.92); }

/* Hamburger button */
.nav-hamburger {
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.nav-hamburger:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.nav-hamburger:active { transform: scale(0.92); }

/* Hamburger dropdown menu */
.hamburger-backdrop {
  position: fixed; inset: 0;
  z-index: 98;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.hamburger-backdrop.open { opacity: 1; pointer-events: auto; }

.hamburger-menu {
  position: fixed;
  top: 56px; right: var(--space-md);
  width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  z-index: 99;
  padding: 6px;
  opacity: 0; pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out);
}
.hamburger-menu.open {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
}

.hamburger-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.hamburger-menu-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}
.hamburger-menu-item.active {
  color: var(--color-accent);
}


/* ═══════════════════════════════════════════════════════
   BOTTOM TAB BAR (mobile)
   ═══════════════════════════════════════════════════════ */

.tab-bar { display: none; }

@media (max-width: 768px) {
  nav { display: none; }
  .hamburger-backdrop, .hamburger-menu { display: none !important; }

  .tab-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    justify-content: space-around;
    align-items: center;
    min-height: 68px;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--glass-bg);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
  }

  .tab-item {
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    font-family: var(--font-body);
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.3px; text-transform: uppercase;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 8px 0;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .tab-item:hover { text-decoration: none; color: var(--color-text-secondary); }
  .tab-item.active { color: var(--color-accent); }
  /* Active dot under tab */
  .tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--color-accent);
    box-shadow: 0 0 6px var(--color-accent-glow);
  }

  /* Legacy .tab-fab removed — workout is now a regular pinnable tab */

  main {
    padding-top: env(safe-area-inset-top) !important;
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
  }
  .workout-fullscreen { padding-top: env(safe-area-inset-top); }
  .workout-topbar { margin-top: env(safe-area-inset-top); }

  /* More button in tab bar */
  #more-btn {
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    font-family: var(--font-body);
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.3px; text-transform: uppercase;
    color: var(--color-text-muted);
    background: none; border: none;
    padding: 8px 0; cursor: pointer;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  #more-btn:hover { color: var(--color-text-secondary); }
  #more-btn.active { color: var(--color-accent); }
  #more-btn.active::after {
    content: '';
    position: absolute;
    bottom: 4px; left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--color-accent);
    box-shadow: 0 0 6px var(--color-accent-glow);
  }
}

/* ═══════════════════════════════════════════════════════
   MORE SHEET (mobile)
   ═══════════════════════════════════════════════════════ */

/* Hidden on desktop (>768px nav is shown, no tab bar) */
@media (min-width: 769px) {
  .more-sheet-backdrop, .more-sheet { display: none !important; }
}

.more-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 101;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.more-sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.more-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-surface);
  border-radius: 16px 16px 0 0;
  z-index: 102;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: none;
}
.more-sheet.open {
  transform: translateY(0);
  pointer-events: auto;
}

.more-sheet-handle {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: var(--color-text-muted);
  opacity: 0.3;
  margin: 10px auto 8px;
}

.more-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 16px 12px;
}

.more-sheet-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: background var(--transition-fast), color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.more-sheet-item:hover {
  background: var(--color-surface-hover);
  text-decoration: none;
  color: var(--color-text);
}
.more-sheet-item.active {
  color: var(--color-accent);
}

.more-sheet-divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 16px 8px;
}

.more-sheet-theme-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
}
.more-sheet-theme-row button {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.more-sheet-theme-row button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}
.more-sheet-theme-row button.active-theme {
  border-color: var(--color-accent);
  color: var(--color-accent);
}


/* ═══════════════════════════════════════════════════════
   PINNED TABS SETTINGS
   ═══════════════════════════════════════════════════════ */

.pinned-tabs-list {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 12px;
}

.pinned-tab-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--color-elevated);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: background var(--transition-fast);
}
.pinned-tab-row:active { cursor: grabbing; }
.pinned-tab-row.dragging { opacity: 0.5; }
.pinned-tab-row.drag-over {
  border-top: 2px solid var(--color-accent);
}

.pinned-tab-row .drag-handle {
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.pinned-tab-row .pinned-tab-icon {
  color: var(--color-accent);
  flex-shrink: 0;
}
.pinned-tab-row .pinned-tab-label {
  flex: 1;
  font-size: 13px; font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.pinned-tab-row .unpin-btn {
  border: none; background: none;
  color: var(--color-text-muted);
  cursor: pointer; padding: 4px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition-fast);
}
.pinned-tab-row .unpin-btn:hover { color: var(--braun-red); }

.pinned-tabs-available {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.pinned-tabs-available .add-tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.pinned-tabs-available .add-tab-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}


/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  animation: fadeSlideUp 300ms var(--ease-out) both;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}

/* Date nav */
.date-nav { display: flex; align-items: center; gap: var(--space-sm); }
.date-nav .date-label {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  min-width: 180px;
  text-align: center;
}
.date-nav button {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.date-nav button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

/* Section header */
.section-header {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin: var(--space-xl) 0 var(--space-sm);
  padding: 0;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.section-edit-btn {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); padding: 2px;
  opacity: 0.5; transition: opacity 150ms;
}
.section-edit-btn:hover { opacity: 1; }

/* Today / Yesterday toggle */
.day-toggle {
  display: flex; gap: 2px; margin-left: auto;
  background: var(--color-bg); border-radius: var(--radius-sm);
  padding: 2px;
}
.day-toggle-btn {
  padding: 4px 10px; border: none; border-radius: calc(var(--radius-sm) - 2px);
  background: transparent; color: var(--color-text-muted);
  font-family: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast);
  text-transform: none; letter-spacing: 0;
}
.day-toggle-btn.active {
  background: var(--color-surface); color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.day-toggle-btn:hover:not(.active) { color: var(--color-text-secondary); }

/* Card */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  position: relative;
  border: 1px solid var(--color-border);
  animation: fadeSlideUp 350ms var(--ease-out) both;
}
.card::before { display: none; }
.card-header {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}


/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */

.btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text);
  background: var(--color-surface);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
}
.btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }

.btn-accent {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}
.btn-accent:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: 0 4px 12px var(--color-accent-glow);
}

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

.btn-danger {
  background: var(--braun-red);
  color: #fff;
  border-color: var(--braun-red);
}
.btn-danger:hover {
  background: #e03030;
  border-color: #e03030;
}

/* Legacy braun button classes */
.braun-btn {
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}
.braun-btn::before { display: none; }
.braun-btn:hover { background: var(--color-surface-hover); border-color: var(--color-border-strong); }
.braun-btn:active { transform: scale(0.97); }
.braun-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.braun-btn-green { background: var(--braun-green); color: #fff; border-color: var(--braun-green); }
.braun-btn-red { background: var(--braun-red); color: #fff; border-color: var(--braun-red); }
.braun-btn-sm { font-size: 11px; padding: 4px 12px; }


/* ═══════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════ */

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
textarea,
select {
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}
input::placeholder, textarea::placeholder { color: var(--color-text-muted); }
textarea { resize: vertical; min-height: 60px; }
input[type="number"] { width: 80px; font-family: var(--font-mono); text-align: right; }


/* ═══════════════════════════════════════════════════════
   TODAY — STREAK STRIP
   ═══════════════════════════════════════════════════════ */

.streak-strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
.streak-count {
  display: flex; flex-direction: column;
}
.streak-num {
  font-family: var(--font-mono);
  font-size: 36px; font-weight: 800; color: var(--color-accent);
  line-height: 1;
}
.streak-label {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--color-text-muted);
  margin-top: 4px;
}
.week-dots { display: flex; gap: 10px; }
.week-dot-col {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.week-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--color-border);
  transition: all 300ms var(--ease-out);
}
.week-dot.filled {
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent-glow);
}
.week-dot.today {
  outline: 2px solid var(--color-text-muted);
  outline-offset: 3px;
}
.week-dot.selected {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}
.week-dot-day {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--color-text-muted); text-transform: uppercase;
}


/* ═══════════════════════════════════════════════════════
   TODAY — DASHBOARD STAT STRIP
   ═══════════════════════════════════════════════════════ */

.today-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-lg);
  border: 1px solid var(--color-border);
}
.dash-card {
  background: var(--color-surface);
  padding: var(--space-md);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dash-card-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--color-text-muted);
}
.dash-card-val {
  font-family: var(--font-mono);
  font-size: 22px; font-weight: 700; color: var(--color-text);
}

/* Habit ring */
.dash-ring {
  width: 52px; height: 52px; border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--color-border) 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.dash-ring::before {
  content: '';
  position: absolute; inset: 5px; border-radius: 50%;
  background: var(--color-surface);
}
.dash-ring::after { display: none; }
.dash-ring-val {
  position: relative; z-index: 1;
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 700; color: var(--color-text);
}
.dash-ring-val small { font-size: 10px; font-weight: 500; color: var(--color-text-muted); }

/* Dashboard progress bars */
.dash-bar-wrap {
  width: 100%; height: 6px; border-radius: var(--radius-full);
  background: var(--color-border); overflow: hidden;
}
.dash-bar {
  height: 100%; border-radius: var(--radius-full);
  transition: width 600ms var(--ease-out);
}
@keyframes barShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Feeling display */
.dash-feeling {
  font-size: 13px; font-weight: 600; color: var(--color-text);
}
.dash-feeling-num {
  font-family: var(--font-mono);
  font-size: 24px; font-weight: 800; color: var(--color-accent);
  display: block;
}


/* ═══════════════════════════════════════════════════════
   HABITS
   ═══════════════════════════════════════════════════════ */

.habit-list {
  display: flex; flex-direction: column; gap: 0;
}
.habit-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px var(--space-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
  border-bottom: 1px solid var(--color-border);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.habit-row:last-child { border-bottom: none; }
.habit-row:hover { background: var(--color-surface-hover); }
.habit-row:active { transform: scale(0.99); }
.habit-row.habit-done .habit-name { color: var(--color-text-muted); text-decoration: line-through; text-decoration-color: var(--color-text-muted); }

.habit-check {
  width: 28px; height: 28px; border-radius: var(--radius-sm); flex-shrink: 0;
  transition: all 200ms var(--ease-out);
  background: transparent;
  border: 2px solid var(--color-border-strong);
  display: flex; align-items: center; justify-content: center;
}
.habit-check svg { display: none; }
.habit-check.on {
  background: var(--braun-green);
  border-color: var(--braun-green);
}
.habit-check.on svg {
  display: block; width: 16px; height: 16px;
  stroke: #fff; stroke-width: 2.5; fill: none;
}
.habit-emoji { font-size: 18px; width: 24px; text-align: center; }
.habit-icon { color: var(--color-text-muted); flex-shrink: 0; }
.habit-name { font-size: 15px; font-weight: 500; flex: 1; color: var(--color-text); }

.habit-progress {
  width: 48px; height: 4px; border-radius: var(--radius-full);
  background: var(--color-border); overflow: hidden; flex-shrink: 0;
}
.habit-progress-bar {
  height: 100%; border-radius: var(--radius-full);
  background: var(--braun-green);
  transition: width 500ms var(--ease-out);
}
.habit-count {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--color-text-muted); min-width: 32px; text-align: right;
}


/* ═══════════════════════════════════════════════════════
   WELLNESS
   ═══════════════════════════════════════════════════════ */

.wellness-gauges { margin-bottom: var(--space-sm); }
.wg-row { display: flex; gap: var(--space-lg); flex-wrap: wrap; align-items: flex-start; }
.wg-field { display: flex; flex-direction: column; gap: 6px; }
.wg-label-row { display: flex; align-items: center; gap: 6px; }
.wg-label-row label {
  font-family: var(--font-body);
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--color-text-muted);
}
.wg-icon { color: var(--color-text-muted); flex-shrink: 0; }
.wg-input-row { display: flex; align-items: center; gap: 6px; }
.wg-unit { font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.wg-field input { width: 72px; }
.wg-mini-bar {
  flex: 1; height: 4px; border-radius: var(--radius-full);
  background: var(--color-border); overflow: hidden;
}
.wg-mini-fill {
  height: 100%; border-radius: var(--radius-full);
  transition: width 500ms var(--ease-out);
}
.wg-mini-fill::after { display: none; }

.wellness-notes-row textarea { width: 100%; min-height: 48px; resize: vertical; }

/* Feeling picker */
.feeling-picker { display: flex; gap: 8px; }
.feeling-dot {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.feeling-dot:hover { color: var(--color-text); background: var(--color-surface-hover); }
.feeling-dot.active {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
}


/* ═══════════════════════════════════════════════════════
   WORKOUT PREVIEW (Today page)
   ═══════════════════════════════════════════════════════ */

.wk-card-title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; color: var(--color-text);
  text-align: left;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.wk-card-subtitle {
  font-size: 13px; color: var(--color-text-muted);
  margin-bottom: var(--space-md); text-align: left;
}
.wk-preview-list { margin-bottom: var(--space-md); }
.wk-preview-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 15px;
  border-bottom: 1px solid var(--color-border);
}
.wk-preview-row:last-child { border-bottom: none; }
.wk-preview-icon { color: var(--color-text-muted); }
.wk-preview-name { font-weight: 500; color: var(--color-text); }
.wk-preview-meta {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--color-text-muted);
  margin-left: auto;
}

.wk-start-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px;
  border-radius: var(--radius-md);
  background: var(--color-accent); color: #fff;
  font-family: var(--font-body);
  font-size: 15px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; text-decoration: none;
  border: none; cursor: pointer;
  box-shadow: 0 4px 16px var(--color-accent-glow);
  transition: all var(--transition-fast);
}
.wk-start-btn:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 6px 20px var(--color-accent-glow);
  text-decoration: none;
}
.wk-start-btn:active { transform: scale(0.98); }

/* Stat pills */
.wk-stat-pills {
  display: flex; gap: var(--space-sm); flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.wk-stat-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-full);
  background: var(--color-accent-subtle); border: 1px solid var(--color-accent-glow);
  font-size: 13px; color: var(--color-text-secondary);
}
.wk-stat-pill strong { color: var(--color-text); font-weight: 700; }

/* Exercise list */
.wk-exercise-list { margin-bottom: var(--space-sm); }
.wk-exercise-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.wk-exercise-row:last-child { border-bottom: none; }
.wk-exercise-name {
  font-size: 14px; font-weight: 600; color: var(--color-text);
  margin-bottom: 4px;
}
.wk-exercise-sets { display: flex; gap: 6px; flex-wrap: wrap; }
.wk-set-chip {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-sm);
  background: var(--color-bg); border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.wk-view-log {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--color-text-muted);
  text-decoration: none; padding-top: 8px;
  transition: color var(--transition-fast);
}
.wk-view-log:hover { color: var(--color-accent); text-decoration: none; }


/* ═══════════════════════════════════════════════════════
   SHEET — Monthly grid
   ═══════════════════════════════════════════════════════ */

.sheet-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
.sheet-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.sheet-table th, .sheet-table td {
  padding: 10px 12px;
  text-align: center;
  min-width: 40px;
  border: none;
  border-bottom: 1px solid var(--color-border);
}
.sheet-table th {
  background: var(--color-surface);
  font-family: var(--font-body);
  font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--color-text-muted);
  position: sticky; top: 0; z-index: 2;
}
.sheet-table td {
  background: var(--color-bg);
  transition: background var(--transition-fast);
}
.sheet-table td.clickable { cursor: pointer; }
.sheet-table td.clickable:hover { background: var(--color-surface-hover); }
.sheet-table .day-col {
  font-weight: 600; font-size: 12px;
  color: var(--color-text-muted); text-align: left;
  position: sticky; left: 0;
  background: var(--color-surface); z-index: 1;
}
.sheet-table .check-on { color: var(--braun-green); }
.sheet-table .check-off { color: var(--color-border-strong); }
.sheet-table .totals-row td {
  background: var(--color-surface); font-weight: 700; font-size: 12px;
}
.sheet-table .totals-row .met { color: var(--braun-green); }
.sheet-table .totals-row .missed { color: var(--braun-red); }
.sheet-table .editable-cell { cursor: text; min-width: 60px; }
.sheet-table .editable-cell:focus {
  outline: none;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 2px var(--color-accent);
}
.sheet-table .notes-col {
  text-align: left; max-width: 250px;
  overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-body); font-size: 12px;
  color: var(--color-text-muted);
}

/* Habit header tooltip */
.sheet-tooltip {
  position: fixed; z-index: 100;
  padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--color-elevated); color: var(--color-text);
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  border: 1px solid var(--color-border-strong);
  pointer-events: none;
  opacity: 0; transform: translateX(-50%) translateY(2px);
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
}
.sheet-tooltip.visible {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* Empty row — missed days */
.sheet-table tr.empty-row td { opacity: 0.45; }
.sheet-table tr.empty-row td.day-col { opacity: 1; }
.sheet-table tr.empty-row:hover td { opacity: 0.7; }

.fill-avg-btn {
  display: none;
  margin-left: 6px; padding: 2px 6px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--color-accent); color: #fff;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  vertical-align: middle;
  transition: background var(--transition-fast);
}
.fill-avg-btn:hover { background: var(--color-accent-hover); }
tr.empty-row:hover .fill-avg-btn { display: inline-block; }


/* ═══════════════════════════════════════════════════════
   PLAN BUILDER
   ═══════════════════════════════════════════════════════ */

.plan-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  position: relative;
  border: 1px solid var(--color-border);
  animation: fadeSlideUp 350ms var(--ease-out) both;
  overflow: hidden;
}
.plan-card::before { display: none; }
.plan-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-sm);
}
.plan-card-title-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.plan-card-header h3 {
  font-size: 16px; font-weight: 600; color: var(--color-text);
  margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plan-card-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.plan-active-label {
  font-size: 11px; color: var(--braun-green);
  font-family: var(--font-mono); letter-spacing: 1px;
  text-transform: uppercase; font-weight: 700;
}

/* Icon-only button (ghost style for delete actions) */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  border: none; background: transparent; cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0; flex-shrink: 0;
}
.btn-icon-muted {
  color: var(--color-text-muted);
}
.btn-icon-muted:hover {
  color: var(--braun-red);
  background: rgba(255, 68, 68, 0.1);
}

/* Plan meta strip (progress + goals) */
.plan-meta-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.plan-card-body { padding: var(--space-md) var(--space-lg); }

.split-section {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}
.split-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.split-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-sm); flex-wrap: wrap; gap: 6px; }
.split-header h4 { font-size: 15px; font-weight: 600; }
.split-header-actions { display: flex; align-items: center; gap: 6px; }
.split-days {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 1px; text-transform: uppercase;
}

.exercise-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; margin-top: var(--space-sm); }
.exercise-table th {
  text-align: left;
  font-family: var(--font-body);
  font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
}
.exercise-table td { padding: 8px; border-bottom: 1px solid var(--color-border); }
.exercise-table tr:last-child td { border-bottom: none; }
.exercise-table input { width: 100%; background: transparent; border: none; color: var(--color-text); font-size: 13px; padding: 2px 4px; outline: none; }
.exercise-table input:focus { background: var(--color-surface-hover); border-radius: 4px; }


/* ═══════════════════════════════════════════════════════
   LOG CARDS
   ═══════════════════════════════════════════════════════ */

.log-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border: 1px solid var(--color-border);
  animation: fadeSlideUp 350ms var(--ease-out) both;
}
.log-card::before { display: none; }
.log-card-date {
  font-size: 11px; font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 1px; text-transform: uppercase;
}
.log-card-split { font-size: 17px; font-weight: 600; margin: 4px 0 var(--space-md); }
.log-exercise { margin-bottom: 12px; text-align: left; }
.log-exercise-name { font-weight: 600; font-size: 14px; margin-bottom: 6px; text-align: left; }
.log-sets { display: flex; gap: 6px; flex-wrap: wrap; }
.log-set-chip {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  color: var(--color-text-secondary);
}
.set-input-row { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: 6px; }
.set-input-row .set-num {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  color: var(--color-text-muted); width: 24px; text-align: center;
}
.set-input-row input { width: 64px; font-family: var(--font-mono); font-size: 14px; text-align: center; }


/* ═══════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════ */

.chart-container {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  height: 320px;
  border: 1px solid var(--color-border);
  animation: fadeSlideUp 350ms var(--ease-out) both;
}
.chart-container::before { display: none; }
.chart-container canvas { width: 100% !important; max-width: 100%; }

.range-toggle { display: flex; gap: 6px; margin-bottom: var(--space-lg); }
.range-toggle button {
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600;
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.range-toggle button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}
.range-toggle button.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}


/* ═══════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: 90%; max-width: 500px;
  max-height: 85vh; overflow-y: auto;
  border: 1px solid var(--color-border);
  animation: fadeSlideUp 200ms var(--ease-out) both;
  box-shadow: var(--shadow-elevated);
}
.modal::before { display: none; }
.modal h2 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
}
.modal .form-group { margin-bottom: var(--space-md); }
.modal .form-group label {
  display: block;
  font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.modal .form-group input,
.modal .form-group textarea,
.modal .form-group select { width: 100%; }
.modal .form-actions { display: flex; gap: var(--space-sm); justify-content: flex-end; margin-top: var(--space-lg); }

/* Habit editor modal */
.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  width: 90%; max-width: 440px; max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-elevated);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md); border-bottom: 1px solid var(--color-border);
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--color-text); margin: 0;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); padding: 4px;
}
.modal-close:hover { color: var(--color-text); }
.modal-body { padding: var(--space-md); overflow-y: auto; flex: 1; }
.modal-footer {
  padding: var(--space-md); border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end;
}

/* Habit editor rows */
.habit-edit-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}
.habit-edit-row:last-child { border-bottom: none; }
.habit-edit-emoji {
  width: 40px; height: 36px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm); text-align: center;
  font-size: 16px; background: var(--color-bg); color: var(--color-text);
}
.habit-edit-name {
  flex: 1; height: 36px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 0 10px;
  font-size: 14px; background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body);
}
.habit-edit-target {
  width: 56px; height: 36px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm); text-align: center;
  font-size: 14px; background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-mono);
}
.habit-edit-del {
  background: none; border: none; cursor: pointer;
  color: var(--braun-red); padding: 4px; opacity: 0.6;
}
.habit-edit-del:hover { opacity: 1; }
.habit-edit-label {
  font-size: 10px; color: var(--color-text-muted);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 2px;
}


/* ═══════════════════════════════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════════════════════════════ */

/* Inline form */
.inline-form { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 100px; }

/* Day chips */
.day-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip {
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600;
  padding: 6px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}
.day-chip:hover { background: var(--color-surface-hover); color: var(--color-text); }
.day-chip.active {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}

/* Empty state */
.empty-state {
  text-align: center; padding: var(--space-2xl) var(--space-lg);
  color: var(--color-text-muted); font-size: 14px; font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: var(--space-lg); left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-full);
  padding: 10px 24px;
  font-size: 13px; font-weight: 600;
  color: var(--color-accent);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s var(--ease-out);
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* LED (standalone, legacy) */
.led {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
  transition: all 300ms var(--ease-out);
  background: var(--color-border);
}
.led.green { background: var(--braun-green); box-shadow: 0 0 6px rgba(0, 210, 106, 0.4); }
.led.red { background: var(--braun-red); box-shadow: 0 0 6px rgba(255, 68, 68, 0.4); }

/* Braun-panel, braun-grid, braun-tile, braun-led — legacy compatibility */
.braun-panel {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-md);
  animation: fadeSlideUp 300ms var(--ease-out) both;
}
.braun-panel::before { display: none; }
.braun-section-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-border);
}
.braun-section-label {
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--color-text-secondary);
}
.braun-grid {
  display: grid; gap: 1px; padding: 0;
  background: var(--color-border);
}
.braun-grid > div { display: flex; }
.braun-grid > div > .braun-tile { flex: 1; }
.braun-tile {
  background: var(--color-surface);
  padding: var(--space-md);
  display: flex; flex-direction: column; gap: 0.5rem;
  transition: background var(--transition-fast);
}
.braun-tile:hover { background: var(--color-surface-hover); }
.braun-tile-name { font-size: 14px; font-weight: 500; color: var(--color-text); }
.braun-tile-desc { font-size: 12px; color: var(--color-text-muted); }
.braun-led {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
  background: var(--color-border);
  transition: all 300ms var(--ease-out);
}
.braun-led-green { background: var(--braun-green); box-shadow: 0 0 8px rgba(0, 210, 106, 0.4); }
.braun-led-red { background: var(--braun-red); }
.braun-led-amber { background: var(--braun-amber); animation: braunPulse 2s ease-in-out infinite; }
.braun-knob-recess { display: none; }

/* Split type badge */
.split-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--color-accent); color: #fff;
}
.split-type-badge.running { background: #3b82f6; }
.split-type-badge.biking { background: #10b981; }
.split-type-badge.swimming { background: #06b6d4; }
.split-type-badge.walking { background: #8b5cf6; }
.split-type-badge.boxing { background: #ef4444; }
.split-type-badge.yoga { background: #ec4899; }
.split-type-badge.stretching { background: #eab308; color: #111; }
.split-type-badge.class { background: #f97316; }
.split-type-badge.strength { background: var(--color-accent); }


/* ═══════════════════════════════════════════════════════
   GUIDED WORKOUT FLOW
   ═══════════════════════════════════════════════════════ */

/* Day strip */
.day-strip {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--color-border);
}
.day-cell {
  background: var(--color-surface);
  padding: 12px 4px; text-align: center;
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}
.day-cell:hover { background: var(--color-surface-hover); }
.day-cell-name {
  font-family: var(--font-body);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--color-text-muted); margin-bottom: 4px;
}
.day-cell-num {
  font-family: var(--font-mono);
  font-size: 18px; font-weight: 700; color: var(--color-text);
}
.day-cell.today { box-shadow: inset 0 -2px 0 var(--color-accent); }
.day-cell .day-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--color-accent); margin: 4px auto 0;
}
.day-cell.future { opacity: 0.4; }

/* Split cards */
.split-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px var(--space-md);
  margin-bottom: 10px;
  cursor: pointer;
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}
.split-card:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}
.split-card.scheduled { border-left: 3px solid var(--color-accent); }
.split-card-name { font-size: 15px; font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.split-card-exercises { font-size: 12px; color: var(--color-text-muted); }
.split-section-label {
  font-family: var(--font-body);
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--color-text-muted); margin: var(--space-md) 0 var(--space-sm);
}

/* Fullscreen workout */
.workout-fullscreen {
  position: fixed; inset: 0; z-index: 150;
  background: var(--color-bg);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.workout-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--space-md);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.wk-topbar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.wk-topbar-btn:hover { background: var(--color-surface-hover); color: var(--color-text); }
.wk-topbar-btn:active { transform: scale(0.90); }
.wk-topbar-btn.danger { border-color: var(--braun-red); color: var(--braun-red); }
.wk-topbar-btn.danger:hover { background: var(--braun-red); color: #fff; }

.wk-timer-group { display: flex; align-items: center; gap: 6px; }
.workout-timer {
  font-family: var(--font-mono);
  font-size: 17px; font-weight: 700;
  color: var(--color-text); letter-spacing: 1px;
}
.workout-timer.paused { color: var(--color-accent); animation: timerBlink 1s ease-in-out infinite; }
@keyframes timerBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Exercise timeline */
.wk-timeline {
  display: flex; gap: 0; flex-shrink: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: none;
}
.wk-timeline::-webkit-scrollbar { display: none; }
.wk-tl-item {
  flex: 1; min-width: 0;
  padding: 10px 4px;
  text-align: center; cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  border-right: 1px solid var(--color-border);
  user-select: none;
}
.wk-tl-item:last-child { border-right: none; }
.wk-tl-item:hover { background: var(--color-surface-hover); }
.wk-tl-item.active {
  background: var(--color-bg);
  box-shadow: inset 0 -2px 0 var(--color-accent);
}
.wk-tl-item.done { opacity: 0.5; }
.wk-tl-item.done::after {
  content: '';
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--braun-green);
}
.wk-tl-item.skipped { opacity: 0.25; }
.wk-tl-name {
  font-family: var(--font-body);
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.3px; text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wk-tl-item.active .wk-tl-name { color: var(--color-text); }
.wk-tl-sets {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600; color: var(--color-text-muted);
  margin-top: 2px;
}
.wk-tl-item.active .wk-tl-sets { color: var(--color-accent); }

/* Main exercise card */
.workout-exercise-card {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--space-lg) var(--space-lg) 0;
  text-align: center; overflow-y: auto;
}
.exercise-name {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700;
  color: var(--color-text); margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.exercise-meta {
  font-size: 14px; color: var(--color-text-muted); margin-bottom: var(--space-md);
  display: flex; align-items: center; gap: 6px; justify-content: center;
}
.exercise-meta-icon { opacity: 0.4; }
.exercise-rec {
  background: var(--color-accent-muted);
  border: 1px solid var(--color-accent-subtle);
  border-radius: var(--radius-md); padding: 12px var(--space-md);
  font-size: 13px; color: var(--color-accent);
  margin-bottom: var(--space-lg); max-width: 340px;
  display: flex; align-items: center; gap: var(--space-sm);
}
.exercise-rec-icon { flex-shrink: 0; opacity: 0.7; }

/* Completed set chips */
.exercise-sets-done {
  display: flex; gap: var(--space-sm); flex-wrap: wrap;
  justify-content: center; margin-bottom: var(--space-lg);
}
.set-done-chip {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  background: var(--color-accent); color: #fff;
  border-radius: var(--radius-full); padding: 6px 16px;
  box-shadow: 0 2px 8px var(--color-accent-glow);
}

/* Set label */
.set-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--color-text-muted); margin-bottom: var(--space-md);
}

/* Weight/reps inputs */
.set-input-field {
  display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-lg);
}
.set-input-group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.set-input-field input {
  width: 96px;
  font-family: var(--font-mono);
  font-size: 32px; font-weight: 700;
  text-align: center; padding: 12px 8px;
  border-radius: var(--radius-md);
}
.set-input-field .input-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--color-text-muted);
}
.set-input-x {
  font-size: 24px; color: var(--color-text-muted); font-weight: 300;
  margin-top: -20px;
}

/* Big action button */
.action-btn-wrap { margin-bottom: var(--space-sm); }
.action-btn {
  width: 120px; height: 120px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--color-accent); color: #fff;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  position: relative;
  box-shadow: 0 4px 24px var(--color-accent-glow);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.action-btn::before {
  content: '';
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 106, 0, 0.15);
  transition: border-color 300ms ease;
}
.action-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 32px rgba(255, 106, 0, 0.4);
}
.action-btn:hover::before { border-color: rgba(255, 106, 0, 0.3); }
.action-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 12px rgba(255, 106, 0, 0.2);
}
.action-btn .action-icon { font-size: 28px; line-height: 1; }
.action-btn-pulse { animation: pulseGlow 2s ease-in-out infinite; }

/* Skip exercise */
.skip-exercise {
  font-size: 12px; color: var(--color-text-muted);
  background: none; border: none; cursor: pointer;
  margin-top: var(--space-sm); padding: 8px var(--space-md);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}
.skip-exercise:hover { background: var(--color-surface-hover); color: var(--color-text); }

/* Bottom progress bar */
.wk-bottom-bar {
  flex-shrink: 0;
  padding: 0 var(--space-md) var(--space-md);
  background: var(--color-bg);
}
.workout-progress-wrap {
  width: 100%; height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full); overflow: hidden;
}
.workout-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), #ff8c42);
  border-radius: var(--radius-full);
  transition: width 400ms var(--ease-out); width: 0;
  box-shadow: 0 0 8px var(--color-accent-glow);
}
.workout-progress-bar::after { display: none; }

/* PR Banner */
.pr-banner {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-20px);
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 14px var(--space-lg); border-radius: var(--radius-md);
  background: linear-gradient(135deg, #FFD700, #FFA000);
  color: #111; font-family: var(--font-body);
  font-size: 14px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(255, 160, 0, 0.4);
  z-index: 200; opacity: 0;
  transition: opacity 300ms, transform 300ms;
}
.pr-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Rest timer overlay */
.workout-rest-overlay {
  align-items: center; justify-content: center;
  text-align: center; gap: var(--space-lg);
}
.rest-timer-label {
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-text-muted);
}
.rest-timer-countdown {
  font-family: var(--font-mono);
  font-size: 80px; font-weight: 200;
  color: var(--color-text); line-height: 1;
  animation: timerPulse 2s ease-in-out infinite;
  transition: color 500ms;
}
.rest-timer-countdown.warning {
  color: var(--color-accent);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
.rest-timer-controls { display: flex; gap: var(--space-md); }
.rest-timer-next { font-size: 13px; color: var(--color-text-muted); }

/* Difficulty rating */
#step-rate {
  align-items: center; justify-content: center;
  text-align: center; gap: var(--space-lg);
}
.rate-exercise-name {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600; color: var(--color-text);
}
.rate-label {
  font-size: 13px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-text-muted);
}
.rate-dots { display: flex; gap: 12px; }
.rate-dot {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.rate-dot:hover { color: var(--color-text); background: var(--color-surface-hover); border-color: var(--color-border-strong); }
.rate-dot.active {
  background: var(--color-accent); color: #fff; border-color: var(--color-accent);
  box-shadow: 0 2px 12px var(--color-accent-glow);
}
.rate-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* Completion summary */
.summary-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--color-border);
  border-radius: var(--radius-md); overflow: hidden; margin-bottom: var(--space-lg);
  border: 1px solid var(--color-border);
}
.summary-stat { background: var(--color-surface); padding: var(--space-lg) var(--space-md); text-align: center; }
.summary-stat-value {
  font-family: var(--font-mono);
  font-size: 32px; font-weight: 800; color: var(--color-text);
}
.summary-stat-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--color-text-muted); margin-top: 4px;
}

/* Workout step visibility */
.workout-step { animation: fadeSlideUp 300ms var(--ease-out) both; }


/* ═══════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════ */

.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: var(--space-lg);
  background: var(--color-bg);
}
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-elevated);
}
.login-brand {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 800; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--color-text);
  text-align: center; margin-bottom: var(--space-xl);
}
.login-field { margin-bottom: var(--space-md); }
.login-field label {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--color-text-muted);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%; padding: 12px 14px;
  background: var(--color-bg); color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
}
.login-field input:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}
.login-btn {
  width: 100%; margin-top: var(--space-sm);
  padding: 14px;
  font-size: 14px; font-weight: 700;
  background: var(--color-accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--color-accent-glow);
  transition: all var(--transition-fast);
}
.login-btn:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 12px var(--color-accent-glow);
}
.login-error {
  color: var(--braun-red); font-size: 13px;
  min-height: 18px; margin-bottom: 4px;
  font-family: var(--font-body);
}


/* ═══════════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════════ */

.settings-hint {
  font-size: 13px; color: var(--color-text-muted);
  margin: 0 0 var(--space-md) 0;
}
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-sm);
}
.category-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--color-bg); border: 1.5px solid var(--color-border);
  color: var(--color-text-secondary); cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  transition: all var(--transition-fast);
}
.category-chip.active {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}
.category-chip.locked { opacity: 0.6; cursor: default; }
.category-chip.locked.active { opacity: 1; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md); padding: var(--space-xs) 0;
}
.settings-label { font-size: 14px; color: var(--color-text); font-weight: 500; }

.unit-toggle { display: flex; gap: 4px; }
.unit-btn {
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--color-bg); border: 1.5px solid var(--color-border);
  color: var(--color-text-muted); cursor: pointer;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  transition: all var(--transition-fast);
}
.unit-btn.active {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
}

.settings-link {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; font-size: 14px; font-weight: 500;
  color: var(--color-text); text-decoration: none;
  border-bottom: 1px solid var(--color-border);
}
.settings-link:last-child { border-bottom: none; }
.settings-link:hover { color: var(--color-accent); text-decoration: none; }

/* Toggle switch */
.toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: var(--radius-full);
  background: var(--color-border-strong); cursor: pointer;
  transition: background var(--transition-fast);
}
.toggle-slider::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform var(--transition-fast);
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Health API key box */
.health-key-box {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-top: 8px;
  background: var(--braun-surface); border-radius: var(--radius-sm);
  border: 1px solid var(--braun-seam);
}
.health-key-box code {
  flex: 1; font-size: 11px; word-break: break-all;
  color: var(--color-accent); font-family: monospace;
}

/* Health data strip on Today page */
.health-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.health-chip {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 8px; border-radius: var(--radius-md);
  background: var(--braun-surface); border: 1px solid var(--braun-seam);
}
.health-chip-val {
  font-size: 22px; font-weight: 700; color: var(--color-text);
  line-height: 1.1;
}
.health-chip-label {
  font-size: 10px; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 4px;
}
.health-chip-icon { color: var(--color-accent); margin-bottom: 4px; }


/* ═══════════════════════════════════════════════════════
   CARDIO TIMER (fullscreen)
   ═══════════════════════════════════════════════════════ */

.cardio-setup {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-xl); padding: var(--space-2xl) var(--space-lg);
  min-height: 60vh;
}
.cardio-setup-icon { color: var(--color-accent); opacity: 0.6; }
.cardio-start-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 44px; border-radius: var(--radius-full);
  background: var(--color-accent); color: #fff;
  border: none; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  box-shadow: 0 4px 24px var(--color-accent-glow);
  transition: transform 100ms ease;
}
.cardio-start-btn:active { transform: scale(0.96); }
.cardio-manual-link {
  font-size: 13px; color: var(--color-text-muted);
  cursor: pointer; text-decoration: underline;
  background: none; border: none; font-family: inherit;
}

.cardio-timer-display {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 70vh; gap: var(--space-lg);
}
.cardio-timer-value {
  font-family: var(--font-mono); font-size: 72px; font-weight: 300;
  letter-spacing: 4px; color: var(--color-text); line-height: 1;
}
.cardio-timer-controls { display: flex; gap: var(--space-md); }
.cardio-timer-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 32px; border-radius: var(--radius-full);
  font-family: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; border: none; transition: transform 100ms ease;
}
.cardio-timer-btn:active { transform: scale(0.96); }
.cardio-timer-btn.finish {
  background: var(--braun-green); color: #fff;
  box-shadow: 0 4px 16px rgba(0, 210, 106, 0.3);
}
.cardio-timer-btn.pause {
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border);
}

/* Cardio log form */
.cardio-log-form, .class-log-form {
  max-width: 400px; margin: 0 auto; padding: var(--space-lg);
}
.cardio-row {
  display: flex; gap: var(--space-md);
}
.cardio-log-form .form-group, .class-log-form .form-group {
  margin-bottom: var(--space-md);
}
.cardio-pace-display {
  font-family: var(--font-mono); font-size: 28px; font-weight: 600;
  color: var(--color-accent); text-align: center;
  padding: var(--space-md) 0; letter-spacing: 2px;
}

/* Class log form */
.intensity-dots { display: flex; gap: 10px; justify-content: center; padding: var(--space-sm) 0; }
.intensity-dot {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 15px; font-weight: 700;
  background: var(--color-bg); border: 1.5px solid var(--color-border);
  color: var(--color-text-muted); cursor: pointer;
  transition: all var(--transition-fast);
}
.intensity-dot.active {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}

/* Log card variants */
.log-card-cardio-stats, .log-card-class-stats {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-sm) 0; flex-wrap: wrap;
}
.log-card-cardio-stats .log-stat, .log-card-class-stats .log-stat {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600;
  color: var(--color-text);
}
.log-stat-muted { color: var(--color-text-muted); font-size: 12px; }
.log-card-type-icon {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--color-text-muted); margin-right: 4px;
}
.log-intensity-dots { display: inline-flex; gap: 3px; }
.log-intensity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-border);
}
.log-intensity-dot.filled { background: var(--color-accent); }
.log-card-duration {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--color-text-muted); margin-top: 2px;
}

/* Plan goals */
.plan-goals { display: flex; flex-wrap: wrap; gap: 4px; }
.plan-goal-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  background: var(--color-accent-subtle); border: 1px solid var(--color-accent-glow);
  color: var(--color-accent);
}
.plan-progress-label {
  font-size: 11px; font-weight: 600;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
.goal-row {
  display: flex; gap: var(--space-sm); align-items: center; margin-bottom: var(--space-sm);
}
.goal-row select, .goal-row input { flex: 1; }
.goal-remove-btn {
  padding: 6px 10px; background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--braun-red); cursor: pointer; font-size: 12px;
}


/* ═══════════════════════════════════════════════════════
   ONBOARD / BUILD YOUR PLAN
   ═══════════════════════════════════════════════════════ */

.onboard-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-lg);
}
.onboard-tab {
  flex: 1; padding: 10px 16px;
  border: none; border-radius: var(--radius-full);
  background: transparent; color: var(--color-text-muted);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast);
  text-align: center;
}
.onboard-tab.active {
  background: var(--color-accent); color: #fff;
  box-shadow: 0 2px 8px var(--color-accent-glow);
}
.onboard-tab:not(.active):hover {
  color: var(--color-text);
}

/* Template filters */
.template-filters {
  display: flex; gap: 6px; margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.filter-chip {
  padding: 8px 16px; border-radius: var(--radius-full);
  background: var(--color-surface); border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast);
}
.filter-chip.active {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}
.filter-chip:not(.active):hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

/* Template grid */
.templates-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}
.template-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-lg);
  transition: all var(--transition-fast);
}
.template-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.template-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-sm); margin-bottom: var(--space-sm);
}
.template-card-header h3 {
  font-size: 16px; font-weight: 700; color: var(--color-text);
  margin: 0; line-height: 1.3;
}
.template-badge {
  flex-shrink: 0; padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  background: var(--color-accent-subtle); color: var(--color-accent);
  border: 1px solid var(--color-accent-glow);
  white-space: nowrap;
}
.template-badge.user {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
}
.template-card { position: relative; }
.template-delete-btn {
  position: absolute; top: 12px; right: 12px;
  opacity: 0.5; z-index: 1;
}
.template-delete-btn:hover { opacity: 1; }
.template-desc {
  font-size: 13px; color: var(--color-text-muted);
  line-height: 1.5; margin: 0 0 var(--space-md) 0;
}
.template-meta {
  display: flex; align-items: center; gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.template-meta-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--color-text-secondary);
}
.template-use-btn {
  width: 100%; justify-content: center;
}

/* Questionnaire */
.q-steps {
  margin-bottom: var(--space-lg);
}
.q-progress {
  height: 4px; background: var(--color-surface);
  border-radius: var(--radius-full); overflow: hidden;
  border: 1px solid var(--color-border);
}
.q-progress-bar {
  height: 100%; background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}
.q-step-label {
  font-size: 12px; font-weight: 600;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.q-step h2 {
  font-size: 22px; font-weight: 700;
  color: var(--color-text); margin: 0 0 var(--space-xs) 0;
}
.q-hint {
  font-size: 14px; color: var(--color-text-muted);
  margin: 0 0 var(--space-lg) 0;
}

/* Goal / Equipment multi-select chips */
.q-options-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-sm);
}
.q-option {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--color-surface); border: 1.5px solid var(--color-border);
  color: var(--color-text-secondary);
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all var(--transition-fast);
}
.q-option:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.q-option.active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

/* Experience single-select cards */
.q-options-list {
  display: flex; flex-direction: column; gap: var(--space-sm);
}
.q-option-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; border-radius: var(--radius-md);
  background: var(--color-surface); border: 1.5px solid var(--color-border);
  cursor: pointer; transition: all var(--transition-fast);
  text-align: left;
  font-family: inherit;
}
.q-option-card strong {
  font-size: 15px; font-weight: 700; color: var(--color-text);
}
.q-option-card span {
  font-size: 13px; color: var(--color-text-muted);
}
.q-option-card:hover {
  border-color: var(--color-border-strong);
}
.q-option-card.active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}
.q-option-card.active strong {
  color: var(--color-accent);
}

/* Days slider */
.q-days-selector {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-md); margin-bottom: var(--space-lg);
}
.q-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  background: var(--color-surface); border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  outline: none;
}
.q-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--color-accent-glow);
  border: 2px solid #fff;
}
.q-slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--color-accent-glow);
  border: 2px solid #fff;
}
.q-days-display {
  font-size: 18px; font-weight: 700;
  color: var(--color-text); font-family: var(--font-mono);
}
.q-days-display span {
  font-size: 32px; color: var(--color-accent);
}

/* Day chips */
.q-day-chips {
  display: flex; gap: 6px; justify-content: center;
  flex-wrap: wrap;
}
.day-chip {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface); border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast);
}
.day-chip.active {
  background: var(--color-accent); color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}
.day-chip:not(.active):hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

/* Mix slider */
.q-mix-slider {
  display: flex; align-items: center; gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.q-mix-slider .q-slider { flex: 1; }
.q-mix-label {
  font-size: 12px; font-weight: 600;
  color: var(--color-text-muted); white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.q-mix-display {
  text-align: center; font-size: 14px; font-weight: 600;
  color: var(--color-accent); font-family: var(--font-mono);
  margin-bottom: var(--space-md);
}

/* Form fields */
.q-form-fields {
  display: flex; flex-direction: column; gap: var(--space-md);
}
.q-field {
  display: flex; flex-direction: column; gap: var(--space-xs);
}
.q-field label {
  font-size: 13px; font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.q-field input,
.q-field textarea {
  padding: 12px 14px;
  background: var(--color-bg); color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px;
  transition: border-color var(--transition-fast);
}
.q-field input:focus,
.q-field textarea:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}
.q-field textarea {
  min-height: 80px; resize: vertical;
}

/* Nav buttons */
.q-nav {
  display: flex; gap: var(--space-sm);
  margin-top: var(--space-xl);
  justify-content: flex-end;
}

/* Result card */
.result-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
}


/* ═══════════════════════════════════════════════════════
   MOBILE OVERRIDES
   ═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  html { font-size: 16px; }
  main { padding: var(--space-md); max-width: 100vw; overflow-x: hidden; }

  .page-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .page-header h1 { font-size: 24px; }
  .date-nav .date-label { font-size: 14px; min-width: 160px; }
  .section-header { font-size: 13px; margin-top: var(--space-lg); }
  .card { padding: var(--space-md); margin-bottom: var(--space-sm); }
  .btn { font-size: 14px; padding: 12px 20px; }
  .btn-sm { font-size: 13px; padding: 8px 16px; }

  /* Streak */
  .streak-num { font-size: 40px; }
  .week-dot { width: 14px; height: 14px; }

  /* Today dashboard — 2x2 grid */
  .today-dashboard { grid-template-columns: repeat(2, 1fr); }
  .dash-card { padding: var(--space-md); }
  .dash-ring { width: 64px; height: 64px; }
  .dash-ring::before { inset: 6px; }
  .dash-ring-val { font-size: 18px; }
  .dash-ring-val small { font-size: 12px; }
  .dash-card-val { font-size: 26px; }
  .dash-card-label { font-size: 11px; }
  .dash-bar-wrap { height: 6px; }
  .dash-feeling-num { font-size: 30px; }

  /* Habits */
  .habit-row { padding: 14px var(--space-md); }
  .habit-name { font-size: 16px; }
  .habit-emoji { font-size: 20px; width: 24px; }
  .habit-led { width: 12px; height: 12px; }
  .habit-progress { width: 48px; height: 5px; }
  .habit-count { font-size: 12px; }

  /* Wellness — sleep + recovery side by side, feeling full width */
  .wg-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }
  .wg-row .wg-field:last-child { grid-column: 1 / -1; } /* feeling spans full width */
  .wg-label-row label { font-size: 12px; }
  .wg-unit { font-size: 13px; }
  .wg-field input { width: 80px; font-size: 16px; padding: 10px; }
  .feeling-dot { width: 48px; height: 48px; font-size: 16px; }
  .wellness-notes-row textarea { font-size: 16px; min-height: 56px; }

  /* Workout on Today */
  .wk-card-title { font-size: 18px; }
  .wk-card-subtitle { font-size: 14px; }
  .wk-preview-row { font-size: 16px; padding: 10px 0; }
  .wk-preview-meta { font-size: 13px; }
  .wk-stat-pill { font-size: 14px; padding: 8px 14px; }
  .wk-exercise-name { font-size: 16px; }
  .wk-set-chip { font-size: 12px; padding: 4px 12px; }
  .wk-start-btn { font-size: 16px; padding: 16px; border-radius: var(--radius-md); }
  .wk-view-log { font-size: 14px; }

  /* Charts */
  .chart-container { height: 280px; padding: var(--space-md); overflow: hidden; }
  .range-toggle button { padding: 10px 18px; font-size: 13px; }

  /* Sheet */
  .sheet-wrapper { -webkit-overflow-scrolling: touch; }
  .sheet-table { font-size: 14px; }
  .sheet-table th, .sheet-table td { padding: 10px; }
  .sheet-table .day-col { min-width: 56px; }

  /* Plans */
  .plan-card-header { padding: var(--space-md); }
  .plan-card-body { padding: var(--space-md); }
  .plan-meta-strip { padding: var(--space-sm) var(--space-md); }
  .split-header { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input { min-width: auto; font-size: 16px; }

  /* Log */
  .log-card-split { font-size: 18px; }

  /* Modal */
  .modal { width: 95%; padding: var(--space-lg); }
  .modal h2 { font-size: 20px; }
  .modal label { font-size: 12px; }
  .modal input { font-size: 16px; }
  .modal-card { width: 95%; }
  .set-input-row input { width: 64px; font-size: 16px; }

  /* Onboard */
  .templates-grid { grid-template-columns: 1fr; }
  .q-options-grid { grid-template-columns: repeat(2, 1fr); }
  .q-step h2 { font-size: 20px; }
  .q-days-display span { font-size: 28px; }
  .day-chip { width: 40px; height: 40px; font-size: 11px; }
  .result-card { padding: var(--space-lg); }
  .q-field input, .q-field textarea { font-size: 16px; }
}

/* Guided workout mobile overrides */
@media (max-width: 768px) {
  .day-cell { padding: 12px 2px; }
  .day-cell-name { font-size: 11px; }
  .day-cell-num { font-size: 18px; }

  .workout-timer { font-size: 18px; }
  .exercise-name { font-size: 26px; }
  .exercise-meta { font-size: 16px; }
  .exercise-rec { font-size: 14px; padding: 14px var(--space-md); }
  .set-done-chip { font-size: 14px; padding: 8px 18px; }
  .set-label { font-size: 13px; }
  .set-input-field input { width: 96px; font-size: 32px; }
  .set-input-field { gap: var(--space-md); }
  .set-input-field .input-label { font-size: 12px; }
  .set-input-x { font-size: 24px; }
  .action-btn { width: 120px; height: 120px; font-size: 14px; }
  .action-btn::before { inset: -6px; }

  .rest-timer-label { font-size: 18px; }
  .rest-timer-countdown { font-size: 72px; }
  .rest-timer-next { font-size: 16px; }
  .rest-timer-controls button { font-size: 14px; padding: 12px 20px; }

  .rate-exercise-name { font-size: 22px; }
  .rate-label { font-size: 16px; }
  .rate-dot { width: 56px; height: 56px; font-size: 18px; }

  .summary-stat-value { font-size: 28px; }
  .summary-stat-label { font-size: 12px; }

  .wk-tl-name { font-size: 9px; }

  /* Cleo mobile */
  .cleo-container { height: calc(100dvh - 56px - 72px); }
  .cleo-msg-bubble { max-width: 90%; }
  .cleo-input-wrap textarea { font-size: 16px; }
}


/* ═══════════════════════════════════════════════════════
   CLEO AI CHAT
   ═══════════════════════════════════════════════════════ */

.cleo-container {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px - 72px);
  max-width: 720px; margin: 0 auto;
}

.cleo-messages {
  flex: 1; overflow-y: auto;
  padding: var(--space-lg) var(--space-md);
  display: flex; flex-direction: column; gap: var(--space-md);
}

.cleo-welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-md);
  flex: 1; min-height: 200px;
  text-align: center;
}
.cleo-welcome-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.cleo-welcome-text {
  font-size: 16px; font-weight: 600; color: var(--color-text);
}
.cleo-welcome-hint {
  font-size: 13px; color: var(--color-text-muted);
  font-weight: 400; margin-top: 4px;
}

/* Messages */
.cleo-msg {
  display: flex; gap: var(--space-sm);
  animation: fadeSlideUp 200ms var(--ease-out) forwards;
}
.cleo-msg-user {
  justify-content: flex-end;
}
.cleo-msg-assistant {
  justify-content: flex-start;
}

.cleo-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  flex-shrink: 0; margin-top: 2px;
  overflow: hidden;
}

/* Cleo headshot avatars */
.cleo-avatar-lg {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover;
}
.cleo-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover;
}

/* Attachment + camera buttons */
.cleo-input-icon-btn {
  background: none; border: none; color: var(--color-text-muted);
  cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}
.cleo-input-icon-btn:hover { color: var(--color-accent); }

/* Image preview strip */
.cleo-img-preview {
  display: flex; gap: 8px; padding: 8px 12px;
  overflow-x: auto;
}
.cleo-img-thumb {
  position: relative; flex-shrink: 0;
}
.cleo-img-thumb img {
  width: 56px; height: 56px; border-radius: var(--radius-sm);
  object-fit: cover; border: 1px solid var(--color-border);
}
.cleo-img-remove {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-accent); color: #fff;
  border: none; font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.cleo-msg-bubble {
  max-width: 80%; padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px; line-height: 1.6;
}
.cleo-msg-user .cleo-msg-bubble {
  background: var(--color-accent);
  color: #fff; border-bottom-right-radius: 4px;
}
.cleo-msg-assistant .cleo-msg-bubble {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}

.cleo-msg-content {
  word-break: break-word;
}
.cleo-msg-content pre {
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: var(--space-sm);
  overflow-x: auto; font-size: 12px; margin: 8px 0;
}
.cleo-msg-content code {
  background: var(--color-bg); border-radius: 3px;
  padding: 1px 4px; font-size: 12px;
  font-family: var(--font-mono);
}
.cleo-msg-content pre code {
  background: none; padding: 0;
}
.cleo-msg-content ul {
  padding-left: 16px; margin: 4px 0;
}
.cleo-msg-content li {
  margin: 2px 0;
}
.cleo-msg-content h2, .cleo-msg-content h3, .cleo-msg-content h4 {
  margin: 8px 0 4px; font-weight: 700;
}
.cleo-msg-content h2 { font-size: 16px; }
.cleo-msg-content h3 { font-size: 15px; }
.cleo-msg-content h4 { font-size: 14px; }

.cleo-error {
  color: var(--braun-red); font-style: italic;
}

.cleo-typing::after {
  content: '...';
  animation: braunPulse 1s infinite;
  color: var(--color-text-muted);
}

/* Input area */
.cleo-input-area {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-top: 1px solid var(--color-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
}

.cleo-input-wrap {
  display: flex; gap: var(--space-sm); align-items: flex-end;
}

.cleo-input-wrap textarea {
  flex: 1; resize: none; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 10px 14px;
  background: var(--color-surface); color: var(--color-text);
  font-family: inherit; font-size: 14px; line-height: 1.5;
  max-height: 120px; min-height: 40px;
  transition: border-color var(--transition-fast);
}
.cleo-input-wrap textarea:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}
.cleo-input-wrap textarea::placeholder {
  color: var(--color-text-muted);
}

.cleo-send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-accent); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}
.cleo-send-btn:hover {
  background: var(--color-accent-hover);
}
.cleo-send-btn:active {
  transform: scale(0.92);
}
.cleo-send-btn.disabled {
  opacity: 0.5; pointer-events: none;
}

.cleo-input-actions {
  display: flex; justify-content: flex-end;
  margin-top: var(--space-xs);
}


/* ═══════════════════════════════════════════════════════
   FOOD TRACKING
   ═══════════════════════════════════════════════════════ */

.food-summary-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm); margin-bottom: var(--space-md);
}
.food-stat {
  text-align: center; padding: var(--space-sm);
  background: var(--color-surface); border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.food-stat-value {
  font-size: 20px; font-weight: 700; font-family: var(--font-mono);
  color: var(--color-text);
}
.food-stat-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--color-text-muted);
}
.food-stat-value.accent { color: var(--color-accent); }

.meal-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-md);
  margin-bottom: var(--space-sm);
}
.meal-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-sm);
}
.meal-card-type {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--color-accent);
}
.meal-card-cals {
  font-size: 14px; font-weight: 700; font-family: var(--font-mono);
  color: var(--color-text);
}
.food-entry-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 13px; color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}
.food-entry-row:last-child { border-bottom: none; }
.food-entry-name { flex: 1; }
.food-entry-macros {
  font-size: 11px; font-family: var(--font-mono);
  color: var(--color-text-muted);
}
.food-entry-cals {
  font-weight: 600; margin-left: var(--space-sm);
  min-width: 50px; text-align: right;
}

.food-add-section {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-md);
  margin-top: var(--space-md);
}
.food-add-section h3 {
  font-size: 14px; font-weight: 700; margin-bottom: var(--space-sm);
}

.food-quick-add {
  display: flex; gap: var(--space-sm); flex-wrap: wrap;
}
.food-quick-chip {
  padding: 8px 14px; border-radius: var(--radius-full);
  background: var(--color-surface); border: 1px solid var(--color-border);
  color: var(--color-text-secondary); font-family: inherit;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition-fast);
}
.food-quick-chip:hover {
  border-color: var(--color-accent); color: var(--color-accent);
}

/* Cleo analyze button */
.cleo-analyze-btn {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 12px 20px; border-radius: var(--radius-md);
  background: var(--color-accent-subtle); border: 1px solid var(--color-accent-glow);
  color: var(--color-accent); font-family: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  justify-content: center;
}
.cleo-analyze-btn:hover {
  background: var(--color-accent); color: #fff;
}

/* Cleo estimate card */
.cleo-estimate-card {
  background: var(--color-surface); border: 1px solid var(--color-accent-glow);
  border-radius: var(--radius-md); padding: var(--space-md);
}
.cleo-estimate-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-sm);
}
.cleo-estimate-total {
  font-weight: 700; font-size: 16px; color: var(--color-accent);
}
.cleo-estimate-macros {
  font-size: 12px; color: var(--color-text-muted);
  margin-top: var(--space-xs); padding-top: var(--space-xs);
  border-top: 1px solid var(--color-border);
}
.cleo-estimate-note {
  font-size: 12px; color: var(--color-text-muted);
  margin-top: var(--space-xs); font-style: italic;
}
.cleo-error { color: #e74c3c; font-size: 13px; }

/* Manual entry rows */
.manual-entry-row {
  display: flex; gap: 6px; margin-bottom: 6px;
}
.manual-entry-row input {
  font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text-primary);
  font-family: inherit;
}

/* ══════════════════════════════════════
   Log History Views
   ══════════════════════════════════════ */

/* View toggle */
.log-view-toggle {
  display: flex; gap: 2px; background: var(--color-bg-inset);
  border-radius: var(--radius-md); padding: 2px;
}
.log-view-btn {
  padding: 6px 16px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-text-muted);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast);
}
.log-view-btn.active {
  background: var(--color-surface); color: var(--color-text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.log-view-btn:hover:not(.active) {
  color: var(--color-text-secondary);
}

/* Summary bar (reuses food-stat) */
.log-summary-bar {
  display: flex; gap: var(--space-md); justify-content: center;
  padding: var(--space-sm) 0;
}

/* Weekly: day groups */
.log-day-group {
  margin-bottom: var(--space-sm);
}
.log-day-group.today { border-left: 3px solid var(--color-accent); padding-left: var(--space-sm); }
.log-day-header {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 6px 0; font-size: 12px; font-weight: 600;
  color: var(--color-text-secondary); border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
}
.log-day-name { font-weight: 700; min-width: 28px; }
.log-day-date { color: var(--color-text-muted); }
.log-day-count { margin-left: auto; color: var(--color-accent); font-weight: 500; }
.log-day-rest { margin-left: auto; color: var(--color-text-muted); font-weight: 400; font-style: italic; }

/* Monthly: calendar grid */
.log-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.log-month-header {
  text-align: center; font-size: 10px; font-weight: 700;
  color: var(--color-text-muted); padding: 4px 0;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.log-month-cell {
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 13px;
  color: var(--color-text-secondary); position: relative;
  transition: all var(--transition-fast);
}
.log-month-cell.empty { visibility: hidden; }
.log-month-cell.today {
  border: 2px solid var(--color-accent);
  font-weight: 700; color: var(--color-accent);
}
.log-month-cell.active {
  background: var(--color-accent-subtle); font-weight: 600;
}
.log-month-cell.active.strength { background: rgba(255, 106, 0, 0.15); }
.log-month-cell.active.cardio   { background: rgba(52, 152, 219, 0.15); }
.log-month-cell.active.other    { background: rgba(155, 89, 182, 0.15); }
.log-month-day { line-height: 1; }
.log-month-count {
  font-size: 8px; font-weight: 700; color: var(--color-accent);
  position: absolute; bottom: 2px;
}

/* No WHOOP toggle */
.nr-row { padding: 0 0 8px 0; }
.nr-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  background: transparent; border: 1.5px solid var(--color-border);
  color: var(--color-text-muted); font-size: 11px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.nr-toggle.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: rgba(255, 106, 0, 0.08);
}

/* Dimmed wellness fields when WHOOP not recorded */
.wg-field.disabled { opacity: 0.35; pointer-events: none; }


/* ═══════════════════════════════════════════════════════
   PROGRESS PHOTOS
   ═══════════════════════════════════════════════════════ */

/* Tab toggle */
.progress-tabs {
  display: flex; gap: 2px; margin-bottom: var(--space-md);
  background: var(--color-bg); border-radius: var(--radius-md);
  padding: 3px;
}
.progress-tab {
  flex: 1; padding: 8px 0; border: none; border-radius: calc(var(--radius-md) - 3px);
  background: transparent; color: var(--color-text-muted);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-fast);
  text-align: center;
}
.progress-tab.active {
  background: var(--color-surface); color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.progress-tab:hover:not(.active) { color: var(--color-text-secondary); }

/* Onboarding / empty state */
.progress-onboard {
  display: flex; flex-direction: column; gap: var(--space-lg);
  padding: var(--space-md) 0;
}
.onboard-hero {
  text-align: center; padding: var(--space-lg) var(--space-md);
}
.onboard-icon-ring {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--color-accent-subtle); color: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-md);
}
.onboard-hero h2 {
  font-family: var(--font-display); font-size: 20px; font-weight: 700;
  margin-bottom: var(--space-sm);
}
.onboard-hero p {
  font-size: 13px; line-height: 1.6; color: var(--color-text-secondary);
  max-width: 400px; margin: 0 auto;
}

.onboard-steps {
  display: flex; flex-direction: column; gap: var(--space-sm);
  background: var(--color-surface); border-radius: var(--radius-md);
  padding: var(--space-md); border: 1px solid var(--color-border);
}
.onboard-step {
  display: flex; gap: var(--space-md); align-items: flex-start;
  padding: var(--space-xs) 0;
}
.onboard-step-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--color-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-top: 2px;
}
.onboard-step strong {
  display: block; font-size: 14px; margin-bottom: 2px;
}
.onboard-step span {
  font-size: 12px; color: var(--color-text-muted); line-height: 1.4;
}

.onboard-tips {
  background: var(--color-surface); border-radius: var(--radius-md);
  padding: var(--space-md); border: 1px solid var(--color-border);
}
.onboard-tips ul {
  list-style: none; padding: 0; margin: 0;
}
.onboard-tips li {
  font-size: 13px; color: var(--color-text-secondary);
  padding: 6px 0; padding-left: 20px; position: relative;
}
.onboard-tips li::before {
  content: ''; position: absolute; left: 0; top: 12px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-accent); opacity: 0.6;
}

/* Stats bar */
.progress-stats {
  display: flex; align-items: center; gap: var(--space-xs);
  font-size: 12px; color: var(--color-text-muted); font-weight: 500;
  padding-bottom: var(--space-sm);
}
.stats-sep { opacity: 0.4; }

/* Gallery grid */
.progress-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}

.progress-thumb {
  position: relative; aspect-ratio: 3/4; overflow: hidden;
  border-radius: var(--radius-sm); cursor: pointer;
  background: var(--color-surface);
  transition: transform var(--transition-fast);
}
.progress-thumb:active { transform: scale(0.96); }
.progress-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.thumb-date {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 2px 6px; font-size: 10px; font-weight: 600;
  color: #fff; background: linear-gradient(transparent, rgba(0,0,0,0.6));
  text-align: center;
}
.thumb-weight {
  position: absolute; top: 4px; right: 4px;
  padding: 1px 5px; border-radius: var(--radius-full);
  font-size: 9px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
}
.thumb-badge {
  position: absolute; top: 4px; left: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.thumb-badge.processing { background: rgba(255, 106, 0, 0.8); }
.thumb-badge.failed { background: rgba(255, 68, 68, 0.8); color: #fff; }

.spinner-sm {
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Upload FAB */
.upload-fab-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-sm); padding: var(--space-md) 0;
}
.upload-fab-label {
  font-size: 12px; font-weight: 600; color: var(--color-text-muted);
}
.upload-fab {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--color-accent); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px var(--color-accent-glow);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.upload-fab:active { transform: scale(0.92); }
.upload-fab:hover { box-shadow: 0 6px 24px var(--color-accent-glow); }

/* Upload preview */
.upload-preview {
  width: 100%; aspect-ratio: 3/4; border-radius: var(--radius-md);
  background: var(--color-bg); border: 2px dashed var(--color-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; margin-bottom: var(--space-md);
}
.upload-preview img {
  width: 100%; height: 100%; object-fit: cover;
}

.upload-fields { display: flex; flex-direction: column; gap: var(--space-sm); }
.upload-field-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--color-text-muted);
}
.upload-input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); font-family: inherit; font-size: 14px;
  transition: border-color var(--transition-fast);
}
.upload-input:focus { outline: none; border-color: var(--color-accent); }
textarea.upload-input { resize: vertical; min-height: 48px; }

/* Accent button */
.btn-accent {
  background: var(--color-accent) !important; color: #fff !important;
  border-color: var(--color-accent) !important;
}
.btn-accent:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* Photo Viewer */
.photo-viewer {
  position: fixed; inset: 0; z-index: 200;
  background: var(--color-bg);
  display: none; flex-direction: column;
}
.photo-viewer.active { display: flex; }

.viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  padding-top: calc(var(--space-sm) + env(safe-area-inset-top, 0px));
}
.viewer-btn {
  background: none; border: none; color: var(--color-text);
  cursor: pointer; padding: 8px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.viewer-btn:hover { background: var(--color-surface-hover); }
.viewer-info { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); }
.viewer-actions { display: flex; gap: 4px; }

.viewer-image-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.viewer-image-wrap img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.viewer-retry {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--space-sm);
  background: rgba(0,0,0,0.5); color: #fff; font-size: 14px;
}

.viewer-meta {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  font-size: 13px;
}
.viewer-weight { font-weight: 700; color: var(--color-accent); }
.viewer-notes { color: var(--color-text-secondary); }
.viewer-status {
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.status-done { background: rgba(0, 210, 106, 0.15); color: var(--braun-green); }
.status-pending, .status-processing { background: var(--color-accent-subtle); color: var(--color-accent); }
.status-failed { background: rgba(255, 68, 68, 0.15); color: var(--braun-red); }

/* Playback Overlay */
.playback-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #000; display: none;
  flex-direction: column;
}
.playback-overlay.active { display: flex; }

.playback-canvas {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.playback-img {
  position: absolute; max-width: 100%; max-height: 100%;
  object-fit: contain; opacity: 0;
  transition: opacity 0.2s ease;
}
.playback-img.active { opacity: 1; }

.playback-date-overlay {
  position: absolute; bottom: 80px; left: 0; right: 0;
  text-align: center; color: #fff;
  font-size: 16px; font-weight: 700; line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  pointer-events: none; z-index: 1;
}

.playback-controls {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-md); padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
}

.playback-speed { display: flex; gap: 4px; }

.speed-chip {
  padding: 6px 14px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6); font-size: 12px; font-weight: 600;
  font-family: var(--font-mono); cursor: pointer;
  transition: all var(--transition-fast);
}
.speed-chip.active {
  background: var(--color-accent); border-color: var(--color-accent);
  color: #fff;
}

.playback-timeline {
  display: flex; gap: 3px; align-items: center;
  max-width: 200px; overflow: hidden;
}
.timeline-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.25);
  transition: all var(--transition-fast);
}
.timeline-dot.active {
  background: var(--color-accent); width: 8px; height: 8px;
}

.playback-exit {
  background: rgba(255,255,255,0.1); border: none;
  color: #fff; padding: 8px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center;
}
.playback-exit:hover { background: rgba(255,255,255,0.2); }
