/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* Base */
  --bg:          oklch(8% 0 0);
  --surface:     oklch(12% 0.003 255);
  --surface-2:   oklch(14% 0.003 255);
  --input-bg:    oklch(17% 0.003 255);
  --border:      oklch(100% 0 0 / 0.07);
  --border-md:   oklch(100% 0 0 / 0.12);
  --text:        oklch(95% 0 0);
  --text-dim:    oklch(62% 0 0);
  --text-muted:  oklch(40% 0 0);

  /* Accent palette — numbers & data */
  --c-gold:   oklch(87% 0.065 85);    /* Días, semana, proteína, kcal accent */
  --c-violet: oklch(73% 0.12 280);    /* Peso */
  --c-green:  oklch(71% 0.16 158);    /* Km */
  --c-teal:   oklch(72% 0.14 200);    /* Carbos, horas/min */
  --c-orange: oklch(76% 0.14 50);     /* Grasa */
  --c-blue:   oklch(70% 0.12 220);    /* Sesiones */
  --c-bright: oklch(97% 0 0);         /* Kcal — número más grande */

  /* Gold shortcuts */
  --accent:     var(--c-gold);
  --accent-sub: oklch(87% 0.065 85 / 0.12);
  --accent-bd:  oklch(87% 0.065 85 / 0.4);

  /* Status */
  --success: oklch(72% 0.16 152);
  --error:   oklch(62% 0.2 25);

  /* Easing */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Layout */
  --sidebar-w:   220px;
  --panel-w:     380px;

  /* Radius */
  --r-card: 10px;
  --r-sm:   7px;
  --r-xs:   5px;

  /* Z-index */
  --z-mobile-h: 100;
  --z-panel:    160;
  --z-ai-over:  155;
  --z-overlay:  190;
  --z-sidebar:  200;
  --z-fab:      210;
  --z-toast:    500;

  /* Fonts */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

/* ============================================================
   COLOR UTILITIES
   ============================================================ */
.c-gold   { color: var(--c-gold); }
.c-violet { color: var(--c-violet); }
.c-green  { color: var(--c-green); }
.c-teal   { color: var(--c-teal); }
.c-orange { color: var(--c-orange); }
.c-blue   { color: var(--c-blue); }
.c-bright { color: var(--c-bright); }

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea { font-family: inherit; }
h1, h2, h3 { text-wrap: balance; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: oklch(10% 0.002 255);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
}

.sidebar-brand {
  padding: 26px 20px 22px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  font-family: var(--font-display);
  font-size: 40px;
  letter-spacing: 2px;
  color: var(--c-gold);
  line-height: 1;
}

.brand-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 18px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 400;
  transition: color 0.15s ease, background-color 0.15s ease;
  text-align: left;
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { color: var(--text-dim); background-color: oklch(100% 0 0 / 0.03); }
}

.nav-item.active { color: var(--c-gold); background-color: var(--accent-sub); font-weight: 500; }
.nav-icon { flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.footer-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.footer-race { font-family: var(--font-display); font-size: 22px; color: var(--c-gold); letter-spacing: 1px; line-height: 1; }
.footer-place { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 36px 40px 80px;
  max-width: calc(100% - var(--sidebar-w));
}

/* ============================================================
   MOBILE HEADER
   ============================================================ */
.mobile-header {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: oklch(10% 0.002 255);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-mobile-h);
}

.hamburger { padding: 4px; display: flex; flex-direction: column; gap: 5px; transition: opacity 0.15s ease; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text-dim); border-radius: 2px; }
@media (hover: hover) and (pointer: fine) { .hamburger:hover { opacity: 0.7; } }
.hamburger:active { opacity: 0.5; }

.mobile-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; color: var(--c-gold); }

/* ============================================================
   OVERLAY (sidebar mobile)
   ============================================================ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 0.6);
  z-index: var(--z-overlay);
  backdrop-filter: blur(2px);
}
.overlay.active { display: block; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { display: none; }
.section.active { display: block; animation: sectionIn 0.22s var(--ease-out) both; }

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

@media (prefers-reduced-motion: reduce) {
  .section.active { animation: none; opacity: 1; }
}

.section-header { margin-bottom: 24px; }
.section-title { font-family: var(--font-display); font-size: 42px; letter-spacing: 1px; color: var(--text); line-height: 1; }
.section-sub { font-size: 14px; color: var(--text-muted); margin-top: 5px; }

/* ============================================================
   SHARED CARD
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px; }
.card-title { font-family: var(--font-display); font-size: 19px; letter-spacing: 0.5px; color: var(--text); margin-bottom: 16px; }

/* ============================================================
   COUNTDOWN
   ============================================================ */
.countdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 24px 26px 20px;
  margin-bottom: 16px;
}

/* Top row: race name + date */
.cd-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cd-race-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.01em;
  margin-bottom: 3px;
}

.cd-race-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.cd-race-date {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--c-gold);
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding-top: 1px;
}

/* Main row: big days + h:min */
.cd-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.cd-days-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.cd-num {
  font-family: var(--font-display);
  font-size: clamp(72px, 10vw, 96px);
  line-height: 1;
  color: var(--c-gold);
  letter-spacing: -0.02em;
}

.cd-days-lbl {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1;
  color: oklch(100% 0 0 / 0.22);
  letter-spacing: 0.5px;
}

.cd-hm-block {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding-bottom: 6px;
}

.cd-hm-item {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.cd-hm-num {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 38px);
  line-height: 1;
  letter-spacing: 0.5px;
}

.cd-hm-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-right: 2px;
}

.cd-hm-sep {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--border-md);
  line-height: 1;
  padding-bottom: 3px;
}

/* Progress */
.progress-block { }

.progress-track {
  height: 4px;
  background: oklch(100% 0 0 / 0.06);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--c-gold);
  border-radius: 99px;
  transition: width 0.8s var(--ease-out);
  min-width: 3px;
  box-shadow: 0 0 10px oklch(87% 0.065 85 / 0.35);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.prog-pct { color: var(--c-gold); font-weight: 500; }

/* ============================================================
   STATS STRIP
   ============================================================ */
.stats-strip {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  margin-bottom: 16px;
  overflow: hidden;
}

.stat-item { flex: 1; padding: 18px 20px; border-right: 1px solid var(--border); }
.stat-item:last-child { border-right: none; }

.stat-val { font-family: var(--font-display); font-size: 38px; line-height: 1; }
.stat-lbl { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   DAY CARD + MACROS
   ============================================================ */
.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.day-card-title { font-size: 13px; color: var(--text-dim); font-weight: 500; }

.btn-group { display: flex; gap: 5px; flex-wrap: wrap; }

.tog-btn {
  padding: 6px 14px;
  background: oklch(100% 0 0 / 0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-size: 12.5px;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.12s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .tog-btn:hover:not(.active) { background: oklch(100% 0 0 / 0.07); color: var(--text-dim); }
}

.tog-btn:active { transform: scale(0.97); }
.tog-btn.active { background: var(--accent-sub); border-color: var(--accent-bd); color: var(--c-gold); font-weight: 500; }

.macros-row { display: flex; align-items: center; }
.macro-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0; }
.macro-sep { width: 1px; height: 36px; background: var(--border); flex-shrink: 0; }
.macro-num { font-family: var(--font-display); font-size: 32px; line-height: 1; transition: color 0.18s ease; }
.macro-lbl { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

/* ============================================================
   WEEK VIEW
   ============================================================ */
.week-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px 22px; }
.week-card-label { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px;
  border-radius: var(--r-sm);
  background: oklch(100% 0 0 / 0.02);
  border: 1px solid var(--border);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.day-cell.today { border-color: var(--accent-bd); background: var(--accent-sub); }
.dc-name { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.dc-num { font-family: var(--font-display); font-size: 20px; line-height: 1; color: var(--text-dim); }
.day-cell.today .dc-num { color: var(--c-gold); }
.dc-icon { font-size: 13px; }
.dc-type { font-size: 8.5px; color: var(--text-muted); text-align: center; line-height: 1.2; }

/* ============================================================
   FORMS
   ============================================================ */
.form-card { margin-bottom: 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-col { grid-column: 1 / -1; }
.form-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

.form-input, .form-textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-textarea:focus { border-color: var(--accent-bd); box-shadow: 0 0 0 3px oklch(87% 0.065 85 / 0.08); }
input[type="date"].form-input { color-scheme: dark; }
.form-textarea { resize: vertical; min-height: 80px; }

.form-input-sm { font-size: 13px; padding: 8px 11px; }

.form-range { -webkit-appearance: none; width: 100%; height: 4px; background: oklch(100% 0 0 / 0.1); border-radius: 99px; outline: none; }
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--c-gold);
  border: 2.5px solid var(--bg);
  cursor: pointer;
  transition: transform 0.14s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .form-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
}

.range-ends { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9.5px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  background: var(--c-gold);
  color: oklch(8% 0 0);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: opacity 0.14s ease, transform 0.12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { opacity: 0.87; } }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  background: oklch(100% 0 0 / 0.05);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background-color 0.14s ease, transform 0.12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .btn-secondary:hover { background: oklch(100% 0 0 / 0.09); } }
.btn-secondary:active { transform: scale(0.97); }

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

.btn-delete {
  color: var(--text-muted);
  font-size: 13px;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  margin-left: auto;
  transition: color 0.14s ease, background-color 0.14s ease, transform 0.12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .btn-delete:hover { color: var(--error); background: oklch(62% 0.2 25 / 0.1); }
}
.btn-delete:active { transform: scale(0.95); }

/* ============================================================
   HISTORY
   ============================================================ */
.history-section { margin-top: 4px; }
.history-section .card-title { margin-bottom: 12px; }

.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease;
  animation: cardIn 0.2s var(--ease-out) both;
}

.history-card:nth-child(1) { animation-delay: 0ms; }
.history-card:nth-child(2) { animation-delay: 35ms; }
.history-card:nth-child(3) { animation-delay: 70ms; }
.history-card:nth-child(4) { animation-delay: 105ms; }
.history-card:nth-child(5) { animation-delay: 140ms; }
.history-card:nth-child(n+6) { animation-delay: 175ms; }

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

@media (prefers-reduced-motion: reduce) { .history-card { animation: none; } }
@media (hover: hover) and (pointer: fine) { .history-card:hover { border-color: var(--border-md); } }

.history-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.h-week { font-family: var(--font-display); font-size: 19px; color: var(--c-gold); }
.h-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.h-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.hstat { display: flex; flex-direction: column; gap: 1px; }
.hstat-val { font-family: var(--font-mono); font-size: 14px; color: var(--text); font-weight: 500; }
.hstat-lbl { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.h-notes { font-size: 13px; color: var(--text-dim); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); line-height: 1.55; }

.empty-state { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); padding: 30px; text-align: center; border: 1px dashed var(--border); border-radius: var(--r-card); }

/* ============================================================
   NUTRICIÓN
   ============================================================ */
.nutri-toggle { margin-bottom: 20px; }

.macros-big-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); display: flex; margin-bottom: 20px; overflow: hidden; }
.macro-big { flex: 1; padding: 20px 14px; text-align: center; border-right: 1px solid var(--border); }
.macro-big:last-child { border-right: none; }

.mb-num { font-family: var(--font-display); font-size: 46px; line-height: 1; }
.mb-lbl { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 5px; }

/* Macros nutrición — coloridos */
.macro-big:nth-child(1) .mb-num { color: var(--c-bright); }
.macro-big:nth-child(2) .mb-num { color: var(--c-gold); }
.macro-big:nth-child(3) .mb-num { color: var(--c-teal); }
.macro-big:nth-child(4) .mb-num { color: var(--c-orange); }
.macro-big:nth-child(2) { background: var(--accent-sub); border-color: var(--accent-bd); }

.menu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px; margin-bottom: 20px; }
.meals-list { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }

.meal-block { border-radius: var(--r-sm); overflow: hidden; border: 1px solid transparent; transition: border-color 0.15s ease; }
@media (hover: hover) and (pointer: fine) { .meal-block:hover { border-color: var(--border); } }

.meal-header { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: oklch(100% 0 0 / 0.025); }
.meal-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--c-gold); min-width: 46px; }
.meal-name { font-size: 13.5px; font-weight: 500; color: var(--text); flex: 1; }
.meal-total-inline { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); text-align: right; }

.meal-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; background: oklch(100% 0 0 / 0.01); }
.meal-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.mr-food { flex: 1; color: var(--text-dim); }
.mr-amount { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); min-width: 80px; text-align: right; }
.mr-macros { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); min-width: 130px; text-align: right; opacity: 0.7; }
.meal-footer { padding: 7px 14px 10px; font-family: var(--font-mono); font-size: 11px; color: oklch(87% 0.065 85 / 0.6); background: oklch(100% 0 0 / 0.015); border-top: 1px solid var(--border); }

.tips-card { margin-top: 20px; }
.tips-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tip { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px; }
.tip-icon { font-size: 18px; margin-bottom: 7px; }
.tip-head { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; text-wrap: balance; }
.tip-body { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }

/* ============================================================
   PROGRESO — CHARTS
   ============================================================ */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px; margin-bottom: 14px; }
.chart-title { font-family: var(--font-display); font-size: 17px; letter-spacing: 0.4px; color: var(--text-dim); margin-bottom: 14px; }
.chart-canvas-wrap { position: relative; height: 210px; }
#charts-wrapper { margin-top: 14px; }

/* ============================================================
   FAB — TXITXA
   ============================================================ */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--z-fab);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--c-gold);
  color: oklch(8% 0 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 4px 18px oklch(87% 0.065 85 / 0.35);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease, background-color 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
  .fab:hover { transform: scale(1.07); box-shadow: 0 6px 24px oklch(87% 0.065 85 / 0.5); }
}

.fab:active { transform: scale(0.94); }

.fab-default, .fab-open { display: flex; align-items: center; justify-content: center; }
.fab-open { display: none; }

.fab.open .fab-default { display: none; }
.fab.open .fab-open    { display: flex; }
.fab.open { background: var(--surface-2); color: var(--text-dim); box-shadow: 0 4px 12px oklch(0% 0 0 / 0.4); }
@media (hover: hover) and (pointer: fine) { .fab.open:hover { box-shadow: 0 6px 16px oklch(0% 0 0 / 0.5); } }

.fab-label {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
}

.fab.open .fab-label { display: none; }

/* ============================================================
   AI PANEL
   ============================================================ */
.ai-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0% 0 0 / 0.5);
  z-index: var(--z-ai-over);
  backdrop-filter: blur(2px);
}
.ai-overlay.active { display: block; }

.ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--panel-w);
  z-index: var(--z-panel);
  background: oklch(10% 0.003 255);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s var(--ease-out);
  will-change: transform;
}

.ai-panel.open { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  .ai-panel { transition: none; }
}

/* Panel header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-brand { display: flex; align-items: center; gap: 11px; }

.panel-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-sub);
  border: 1px solid var(--accent-bd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--c-gold);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.panel-name { font-size: 14px; font-weight: 600; color: var(--text); }
.panel-role { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-muted); margin-top: 1px; }
.panel-header-actions { display: flex; gap: 4px; }

.panel-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: var(--text-dim);
  transition: color 0.14s ease, background-color 0.14s ease, transform 0.12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .panel-btn:hover { color: var(--text); background: oklch(100% 0 0 / 0.08); } }
.panel-btn:active { transform: scale(0.9); }

/* Settings accordion */
.panel-settings {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out);
  flex-shrink: 0;
}

.panel-settings.open { max-height: 380px; }

.panel-settings-inner {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-block {}
.settings-block-title { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 9px; }

.apikey-row { display: flex; gap: 8px; }
.apikey-row .form-input { flex: 1; }
.apikey-status { font-family: var(--font-mono); font-size: 11px; margin-top: 8px; min-height: 14px; transition: color 0.2s ease; }

/* Chips in panel */
.panel-chips {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.suggestions-row { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  padding: 5px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-dim);
  font-size: 11.5px;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .chip:hover { background: var(--accent-sub); border-color: var(--accent-bd); color: var(--c-gold); }
}
.chip:active { transform: scale(0.97); }

/* Chat messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: oklch(100% 0 0 / 0.08) transparent;
}

.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: oklch(100% 0 0 / 0.08); border-radius: 2px; }

.chat-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px 10px; text-align: center; }
.welcome-icon { font-size: 28px; }
.welcome-text { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.chat-msg { max-width: 88%; display: flex; flex-direction: column; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.assistant { align-self: flex-start; }

.msg-bubble {
  padding: 9px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.6;
  animation: msgIn 0.18s var(--ease-out) both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .msg-bubble { animation: none; } }

.chat-msg.user .msg-bubble { background: var(--accent-sub); border: 1px solid var(--accent-bd); color: var(--text); border-bottom-right-radius: 3px; }
.chat-msg.assistant .msg-bubble { background: oklch(100% 0 0 / 0.04); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 3px; }

.typing-dots { display: flex; gap: 5px; align-items: center; padding: 3px 0; }
.typing-dots span { width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%; animation: dotBounce 1.1s var(--ease-in-out) infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .typing-dots span { animation: none; opacity: 0.5; } }

/* Chat input */
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-textarea {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  resize: none;
  overflow-y: auto;
  max-height: 100px;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-textarea::placeholder { color: var(--text-muted); }
.chat-textarea:focus { border-color: var(--accent-bd); box-shadow: 0 0 0 3px oklch(87% 0.065 85 / 0.08); }

.btn-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--c-gold);
  color: oklch(8% 0 0);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.14s ease, transform 0.12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .btn-send:hover:not(:disabled) { opacity: 0.85; } }
.btn-send:active:not(:disabled) { transform: scale(0.94); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================================
   TABS (Nutrición)
   ============================================================ */
.tabs-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 5px;
}

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  transition: background-color 0.14s ease, color 0.14s ease, transform 0.12s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) { .tab-btn:hover:not(.active) { color: var(--text-dim); background: oklch(100% 0 0 / 0.04); } }
.tab-btn:active { transform: scale(0.97); }
.tab-btn.active { background: var(--surface-2); color: var(--text); font-weight: 500; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: sectionIn 0.18s var(--ease-out) both; }

/* ============================================================
   SESIONES
   ============================================================ */
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title-row .card-title { margin-bottom: 0; }

.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-size: 16px;
  transition: color 0.14s ease, background-color 0.14s ease;
}
@media (hover: hover) and (pointer: fine) { .btn-icon:hover { color: var(--text-dim); background: oklch(100% 0 0 / 0.06); } }
.btn-icon:active { transform: scale(0.9); }

.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

.file-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background: var(--input-bg);
  border: 1px dashed var(--border-md);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease;
}
@media (hover: hover) and (pointer: fine) { .file-label:hover { border-color: var(--accent-bd); color: var(--text-dim); } }
.file-input { display: none; }

/* Acciones del formulario de sesión */
.session-form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Modo edición */
.form-card.edit-mode {
  border-color: var(--accent-bd);
  background: oklch(87% 0.065 85 / 0.04);
}

/* Botones de la tarjeta de sesión */
.session-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-edit-session {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  transition: color 0.14s ease, background-color 0.14s ease, transform 0.12s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn-edit-session:hover { color: var(--c-gold); background: var(--accent-sub); }
}

.btn-edit-session:active { transform: scale(0.9); }

/* Confirmación de borrado inline */
.delete-confirm {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.dc-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.dc-cancel, .dc-ok {
  padding: 4px 10px;
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.14s ease, transform 0.12s var(--ease-out);
}

.dc-cancel:active, .dc-ok:active { transform: scale(0.95); }

.dc-cancel {
  background: oklch(100% 0 0 / 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

@media (hover: hover) and (pointer: fine) {
  .dc-cancel:hover { background: oklch(100% 0 0 / 0.09); }
}

.dc-ok {
  background: oklch(62% 0.2 25 / 0.15);
  border: 1px solid oklch(62% 0.2 25 / 0.4);
  color: var(--error);
}

@media (hover: hover) and (pointer: fine) {
  .dc-ok:hover { background: oklch(62% 0.2 25 / 0.25); }
}

.gpx-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  min-height: 16px;
  transition: color 0.2s ease;
}
.gpx-info.loading { color: var(--text-dim); }
.gpx-info.success { color: var(--c-green); }

/* Session feed */
.sessions-feed { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  animation: cardIn 0.2s var(--ease-out) both;
  transition: border-color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .session-card:hover { border-color: var(--border-md); } }

.session-card:nth-child(1) { animation-delay: 0ms; }
.session-card:nth-child(2) { animation-delay: 35ms; }
.session-card:nth-child(3) { animation-delay: 70ms; }
.session-card:nth-child(n+4) { animation-delay: 100ms; }

.session-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.session-body { padding: 16px 18px; }

.session-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.session-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--accent-sub);
  border: 1px solid var(--accent-bd);
  color: var(--c-gold);
  margin-bottom: 4px;
}

.session-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.session-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.session-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 10px 0;
}

.sstat { display: flex; flex-direction: column; gap: 1px; }
.sstat-val { font-family: var(--font-mono); font-size: 16px; font-weight: 500; }
.sstat-lbl { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.session-notes { font-size: 13px; color: var(--text-dim); line-height: 1.55; margin-top: 8px; }

.session-map {
  height: 220px;
  border-top: 1px solid var(--border);
}

.session-elevation {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.elevation-title {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.elevation-canvas-wrap { height: 80px; }

/* ============================================================
   NUTRICIÓN — MENÚS SEMANALES
   ============================================================ */
.weekly-plan { display: flex; flex-direction: column; gap: 12px; }

.day-plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.day-plan-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
@media (hover: hover) and (pointer: fine) { .day-plan-header:hover { background: oklch(100% 0 0 / 0.02); } }

.day-plan-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--text);
  min-width: 130px;
}

.day-plan-type {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid;
}

.day-plan-type.training { color: var(--c-green); border-color: oklch(71% 0.16 158 / 0.4); background: oklch(71% 0.16 158 / 0.1); }
.day-plan-type.rest     { color: var(--c-violet); border-color: oklch(73% 0.12 280 / 0.4); background: oklch(73% 0.12 280 / 0.1); }
.day-plan-type.cardio   { color: var(--c-teal); border-color: oklch(72% 0.14 200 / 0.4); background: oklch(72% 0.14 200 / 0.1); }

.day-plan-kcal { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: auto; }

.day-plan-chevron {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.2s var(--ease-out);
}

.day-plan-card.open .day-plan-chevron { transform: rotate(180deg); }

.day-plan-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out);
}

.day-plan-card.open .day-plan-body { max-height: 1200px; }

.day-plan-meals { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 1px; }

/* ============================================================
   DIARIO
   ============================================================ */
.diary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.diary-date-nav { display: flex; align-items: center; gap: 8px; }

.diary-date-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  color-scheme: dark;
  transition: border-color 0.15s ease;
}
.diary-date-input:focus { border-color: var(--accent-bd); }

.btn-icon-sm {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: 14px;
  transition: background-color 0.14s ease, transform 0.12s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .btn-icon-sm:hover { background: var(--surface-2); } }
.btn-icon-sm:active { transform: scale(0.92); }

.diary-totals {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.dt-item { display: flex; flex-direction: column; align-items: center; }
.dt-val { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.dt-lbl { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); margin-top: 2px; }

.diary-entries { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.diary-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 14px 16px;
  animation: cardIn 0.18s var(--ease-out) both;
  transition: border-color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .diary-entry:hover { border-color: var(--border-md); } }

.diary-entry-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

.de-meal-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-sub);
  border: 1px solid var(--accent-bd);
  color: var(--c-gold);
  text-transform: capitalize;
}

.de-macros { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: auto; }
.de-foods { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ============================================================
   CALENDARIO
   ============================================================ */
.calendar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px 18px 16px;
  margin-top: 16px;
}

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

.calendar-month-label {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--text);
}

.cal-week-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}

.cal-week-headers div {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  cursor: default;
  padding: 2px;
}

.cal-day.empty { visibility: hidden; }

.cal-day.has-session {
  background: oklch(100% 0 0 / 0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.14s ease, transform 0.12s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cal-day.has-session:hover { background: oklch(100% 0 0 / 0.07); }
}

.cal-day.has-session:active { transform: scale(0.94); }

.cal-day.today .cal-num { color: var(--c-gold); font-weight: 600; }

.cal-num { font-size: 12px; line-height: 1; color: var(--text-dim); }
.cal-day.today .cal-num { color: var(--c-gold); }

.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }

.cal-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.cal-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.leg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   MODAL SESIÓN
   ============================================================ */
.session-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.session-modal.open { pointer-events: auto; opacity: 1; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: oklch(0% 0 0 / 0.72);
  backdrop-filter: blur(3px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-card);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  animation: modalIn 0.22s var(--ease-out) both;
  scrollbar-width: thin;
  scrollbar-color: oklch(100% 0 0 / 0.08) transparent;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) { .modal-content { animation: none; } }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.14s ease, background-color 0.14s ease;
}
@media (hover: hover) and (pointer: fine) { .modal-close:hover { color: var(--text); background: oklch(100% 0 0 / 0.06); } }
.modal-close:active { transform: scale(0.9); }

.modal-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.modal-session {
  padding: 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  margin-bottom: 10px;
  padding-left: 16px;
}

.modal-session-head { margin-bottom: 10px; }
.modal-session-type { font-family: var(--font-mono); font-size: 11px; display: block; margin-bottom: 2px; }
.modal-session-title { font-size: 15px; font-weight: 600; color: var(--text); }

.modal-stats { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 8px 0; }

.mstat { display: flex; flex-direction: column; gap: 1px; }
.mstat-val { font-family: var(--font-mono); font-size: 15px; color: var(--text); font-weight: 500; }
.mstat-lbl { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.modal-notes { font-size: 13px; color: var(--text-dim); margin-top: 8px; line-height: 1.55; }
.modal-photo { width: 100%; border-radius: var(--r-sm); margin-top: 10px; object-fit: cover; max-height: 200px; }

/* ============================================================
   FILTROS PROGRESO
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 5px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 7px 14px;
  background: oklch(100% 0 0 / 0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  color: var(--text-muted);
  font-size: 12.5px;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.12s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .filter-btn:hover:not(.active) { background: oklch(100% 0 0 / 0.07); color: var(--text-dim); }
}

.filter-btn:active { transform: scale(0.97); }
.filter-btn.active { background: var(--accent-sub); border-color: var(--accent-bd); color: var(--c-gold); font-weight: 500; }

/* Breakdown por tipo */
.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.breakdown-row:last-child { border-bottom: none; }

.breakdown-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-dim);
  min-width: 110px;
}

.breakdown-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.breakdown-bar-wrap { flex: 1; height: 24px; background: oklch(100% 0 0 / 0.03); border-radius: var(--r-xs); overflow: hidden; min-width: 60px; }
.breakdown-bar { height: 100%; border-radius: var(--r-xs); transition: width 0.4s var(--ease-out); }
.breakdown-nums { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ============================================================
   TOASTS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  pointer-events: auto;
  max-width: 300px;
}

.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.success { background: var(--success); color: oklch(8% 0 0); }
.toast.error   { background: var(--error);   color: #fff; }
.toast.info    { background: var(--c-gold);  color: oklch(8% 0 0); }

@media (prefers-reduced-motion: reduce) { .toast { transition: opacity 0.15s ease; transform: none; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.24s var(--ease-out); }
  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; max-width: 100%; padding: 0 0 100px; }
  .mobile-header { display: flex; }
  .section { padding: 22px 20px 0; }

  .cd-num { font-size: 52px; }
  .cd-num-sm { font-size: 26px; }

  .week-days { grid-template-columns: repeat(4, 1fr); }
  .tips-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .form-group.full-col { grid-column: 1; }

  .macros-big-row { flex-wrap: wrap; }
  .macro-big { min-width: calc(50% - 1px); }
  .macro-big:nth-child(2) { border-right: none; }
  .macro-big:nth-child(3) { border-top: 1px solid var(--border); }
  .macro-big:nth-child(4) { border-top: 1px solid var(--border); border-right: none; }

  .ai-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
  .fab { bottom: 20px; right: 20px; }
  #toast-container { bottom: 88px; right: 16px; }
}

@media (max-width: 560px) {
  .stats-strip { flex-direction: column; }
  .stat-item { border-right: none; border-bottom: 1px solid var(--border); }
  .stat-item:last-child { border-bottom: none; }
  .macros-row { flex-wrap: wrap; }
  .macro-sep:nth-child(4), .macro-sep:nth-child(6) { display: none; }
  .macro-item { min-width: calc(50% - 8px); }
  .meal-row { flex-wrap: wrap; }
  .mr-macros { display: none; }
  .suggestions-row { gap: 5px; }
}
