/* MAINEVOLVE · estructura y componentes de la app. El aspecto (colores, letra, tarjetas, botones, navegación)
   lo pone el diseño Z en css/z.css, que se carga el último. Tema claro/oscuro con [data-theme] (js/theme). */

/* ═════════ TOKENS · OSCURO ═════════ */
:root {
  /* Cristal: tinte oscuro casi transparente (no blanquea) + desenfoque */
  --glass-bg: rgba(16, 16, 20, 0.22);
  --glass-bg-strong: rgba(16, 16, 20, 0.46);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.16);
  --glass-sheen: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --glass-blur: 22px;
  --glass-saturate: 160%;
  --glass-solid: rgba(20, 17, 19, 0.96);          /* cabeceras fijas y fallback sin blur */
  --fill: rgba(255, 255, 255, 0.05);              /* inputs, botones, chips (sin blur) */
  --fill-hover: rgba(255, 255, 255, 0.1);
  --fill-inset: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --hairline: rgba(255, 255, 255, 0.06);
  --modal-tint: rgba(12, 10, 12, 0.55);
  --live-bg: rgba(38, 18, 12, 0.95);
  --scrim: rgba(0, 0, 0, 0.55);
  --option-bg: #1a1618;
  --radius-card: 24px;
  --radius-pill: 999px;
  --radius-field: 14px;

  /* Texto (AA sobre el cristal en las zonas más brillantes del fondo) */
  --text: #ffffff;
  --muted: #c4c4c4;
  --faint: #8f8f8f;
  --accent-text: #ff7a2e;
  --up: #3ddc84;
  --down: #ff6b77;

  /* Marca */
  --red: #eb3141;
  --orange: #ed5c23;
  --yellow: #fbbb0b;
  --fire: #ff5a1f;
  --grad: linear-gradient(90deg, var(--fire), var(--red));
  --grad-text: linear-gradient(90deg, #ff7a2e, #ff4655);
  --grad-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%);

  /* Fondo vivo para que el cristal tenga qué refractar */
  --bg: #07070a;
  --bg-art:
    radial-gradient(48vw 48vw at 92% 4%, rgba(255, 90, 31, 0.55), transparent 62%),
    radial-gradient(42vw 42vw at 4% 96%, rgba(235, 49, 65, 0.5), transparent 62%),
    radial-gradient(30vw 30vw at 18% 22%, rgba(251, 187, 11, 0.16), transparent 65%),
    radial-gradient(40vw 30vw at 60% 60%, rgba(122, 15, 31, 0.45), transparent 70%);

  /* Gráficas */
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-tick: #8f8f8f;
  --chart-point: #000;

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --display: 'Bebas Neue', 'Oswald', Impact, sans-serif;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

/* ═════════ TOKENS · CLARO ═════════ */
:root[data-theme='light'] {
  --glass-bg: rgba(255, 255, 255, 0.3);
  --glass-bg-strong: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-highlight: rgba(255, 255, 255, 0.9);
  --glass-sheen: rgba(255, 255, 255, 0.35);
  --glass-shadow: 0 10px 36px rgba(110, 35, 10, 0.12);
  --glass-solid: rgba(251, 248, 246, 0.97);
  --fill: rgba(255, 255, 255, 0.5);
  --fill-hover: rgba(255, 255, 255, 0.75);
  --fill-inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --hairline: rgba(20, 10, 5, 0.07);
  --modal-tint: rgba(255, 252, 250, 0.55);
  --live-bg: rgba(255, 240, 232, 0.97);
  --scrim: rgba(40, 20, 10, 0.28);
  --option-bg: #ffffff;

  --text: #16120f;
  --muted: #4d4640;
  --faint: #857b74;
  --accent-text: #c2410c;
  --up: #157a43;
  --down: #c41d2e;
  --grad-text: linear-gradient(90deg, #e2470f, #c81e2e);

  --bg: #f5efea;
  --bg-art:
    radial-gradient(48vw 48vw at 92% 4%, rgba(255, 90, 31, 0.38), transparent 62%),
    radial-gradient(42vw 42vw at 4% 96%, rgba(235, 49, 65, 0.3), transparent 62%),
    radial-gradient(30vw 30vw at 18% 22%, rgba(251, 187, 11, 0.32), transparent 65%),
    radial-gradient(40vw 30vw at 60% 60%, rgba(255, 150, 120, 0.25), transparent 70%);

  --chart-grid: rgba(0, 0, 0, 0.07);
  --chart-tick: #6b625b;
  --chart-point: #fff;
  color-scheme: light;
}
:root[data-theme='light'] .glass-border-strong { border-color: rgba(20, 10, 5, 0.12); }

/* Logo según tema */
.logo-on-light { display: none !important; }
:root[data-theme='light'] .logo-on-dark { display: none !important; }
:root[data-theme='light'] .logo-on-light { display: block !important; }

/* ═════════ BASE ═════════ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button, a, .btn, [role='button'] { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }

a { color: var(--accent-text); text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; line-height: 0.95; text-transform: none; }
h1 { font-size: 52px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hidden { display: none !important; }

/* ═════════ CRISTAL ═════════ */
/* Clases reutilizables; los componentes existentes las heredan por selector, sin tocar el HTML. */
.glass, .glass-strong, .glass-nav,
.card, .kpi, .login-card, .modal, .sheet, .toast, .sidebar, .mobile-header, .bottom-nav {
  position: relative;
  isolation: isolate;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  border-radius: var(--radius-card);
}
.glass-strong, .login-card, .toast, .glass-nav, .sidebar, .mobile-header, .bottom-nav { background: var(--glass-bg-strong); }


/* Píldora translúcida: sin blur propio (vive dentro de contenedores que ya desenfocan) */
.glass-pill { background: var(--fill); border: 1px solid var(--glass-border); border-radius: var(--radius-pill); box-shadow: var(--fill-inset); }

.eyebrow {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  font: 700 12px var(--font); letter-spacing: 0.32em; text-transform: uppercase; color: var(--accent-text);
}
.eyebrow::before { content: ''; width: 36px; height: 1px; background: currentColor; flex-shrink: 0; }
.label-caps { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

/* ═════════ COMPONENTES BASE ═════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--fill); color: var(--text); border: 1px solid var(--glass-border); border-radius: var(--radius-pill);
  box-shadow: var(--fill-inset), 0 4px 14px rgba(0, 0, 0, 0.1);
  font: 600 19px/1 var(--display); letter-spacing: -0.01em; text-transform: none;
  padding: 13px 24px; cursor: pointer; white-space: nowrap;
  transition: transform 180ms var(--spring), background 180ms var(--ease), filter 180ms var(--ease), box-shadow 180ms var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; }
.btn.primary {
  background: var(--grad-sheen), var(--grad); border-color: rgba(255, 255, 255, 0.35); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 10px 30px rgba(235, 49, 65, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.btn.sm { padding: 8px 14px; font-size: 16px; }
.btn.icon { padding: 9px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

label.field { display: flex; flex-direction: column; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
input, select, textarea {
  width: 100%; color: var(--text); background: var(--fill); border: 1px solid var(--glass-border); border-radius: var(--radius-field);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
  padding: 11px 14px; font: 500 16px var(--font); letter-spacing: normal; text-transform: none; outline: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}
:root[data-theme='light'] input, :root[data-theme='light'] select, :root[data-theme='light'] textarea { border-color: rgba(20, 10, 5, 0.14); }
select option { background: var(--option-bg); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  background: var(--fill-hover); border-color: rgba(255, 120, 60, 0.75);
  box-shadow: 0 0 0 4px rgba(255, 90, 31, 0.2), 0 0 22px rgba(255, 90, 31, 0.22), inset 0 1px 2px rgba(0, 0, 0, 0.12);
}
:focus-visible { outline: 2px solid rgba(255, 120, 60, 0.9); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
textarea { min-height: 90px; resize: vertical; }
input[type='number'] { font-variant-numeric: tabular-nums; }
input[type='checkbox'] { accent-color: var(--fire); width: 18px; height: 18px; }
.input-suffix { position: relative; display: block; min-width: 0; }
.input-suffix > input { width: 100%; }
.input-suffix.has-suffix > input { padding-right: 46px; }
.input-suffix .sfx { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font: 500 14px var(--font); letter-spacing: normal; text-transform: none; pointer-events: none; }
.input-suffix > input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
.input-suffix > input[type='number']::-webkit-inner-spin-button, .input-suffix > input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--glass-border); border-radius: 20px; padding: 20px; margin: 0 0 18px; background: var(--hairline); }
legend { padding: 0 10px; font: 600 16px var(--display); letter-spacing: -0.01em; text-transform: none; }

.search { position: relative; }
.search input { padding-left: 42px; border-radius: var(--radius-pill); }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill); background: var(--fill); border: 1px solid var(--glass-border); color: var(--muted);
}
.badge.activo { border-color: color-mix(in srgb, var(--up) 45%, transparent); color: var(--up); background: color-mix(in srgb, var(--up) 10%, transparent); }
.badge.pausa { border-color: rgba(251, 187, 11, 0.5); color: #b07d00; background: rgba(251, 187, 11, 0.12); }
:root:not([data-theme='light']) .badge.pausa { color: var(--yellow); }
.badge.baja { border-color: color-mix(in srgb, var(--down) 50%, transparent); color: var(--down); background: color-mix(in srgb, var(--down) 10%, transparent); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--grad-sheen), var(--grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 18px rgba(235, 49, 65, 0.25);
  font: 600 16px/1 var(--display); letter-spacing: -0.01em; color: #fff;
}
.avatar.lg { width: 78px; height: 78px; font-size: 36px; }

/* Pestañas como control segmentado de cristal */
.tabs {
  display: flex; gap: 4px; padding: 5px; margin-bottom: 26px; width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
  background: var(--fill); border: 1px solid var(--glass-border); border-radius: var(--radius-pill); box-shadow: var(--fill-inset);
}
.tabs a {
  padding: 9px 18px; border-radius: var(--radius-pill); color: var(--muted); white-space: nowrap;
  font: 600 19px/1 var(--display); letter-spacing: -0.01em;
  transition: background 200ms var(--ease), color 200ms var(--ease);
}
.tabs a.active { color: #fff; background: var(--grad-sheen), var(--grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 14px rgba(235, 49, 65, 0.25); }

/* Tablas y listas: filas sobre cristal ligero, sin blur por fila */
.table-wrap { overflow: auto; max-height: 70dvh; border-radius: 16px; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  position: sticky; top: 0; z-index: 1; text-align: left; white-space: nowrap;
  font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; padding: 12px;
  background: var(--glass-solid); border-bottom: 1px solid var(--glass-border);
}
.table td { white-space: nowrap; padding: 14px 12px; border-bottom: 1px solid var(--hairline); font-variant-numeric: tabular-nums; transition: background 150ms var(--ease); }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }

.list-row { color: var(--text); display: flex; align-items: center; gap: 14px; padding: 12px; margin: 0 -12px; border-radius: 16px; cursor: pointer; transition: background 150ms var(--ease); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row > svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--muted); }
.list-row .title { font-weight: 600; }
.list-row b { font: 600 19px var(--display); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--accent-text); margin-bottom: 12px; }
.empty h2 { margin-bottom: 8px; color: var(--text); }
.card > .empty.small, .empty.small { padding: 22px 16px; }

.result-box {
  border-radius: 20px; padding: 18px;
  background: linear-gradient(135deg, rgba(255, 90, 31, 0.14), rgba(235, 49, 65, 0.07));
  border: 1px solid rgba(255, 120, 60, 0.38); box-shadow: var(--fill-inset);
}
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.result-grid .r .k { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.result-grid .r .v { font: 600 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }

.chart-box { position: relative; height: 280px; }
.chart-box:has(> .chart-empty) { height: auto; }

/* Fotos de progreso */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.photo-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; }
.photo { margin: 0; }
.photo img, .photo-missing { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 18px; border: 1px solid var(--glass-border); background: var(--fill); display: grid; place-items: center; }
.photo figcaption { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); min-height: 32px; }

/* ═════════ DIETAS ═════════ */
/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.editor-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.editor-main > .card + .card { margin-top: 0; }
.editor-aside { position: sticky; top: 16px; display: grid; gap: 16px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--fill); border: 1px solid var(--glass-border); border-radius: var(--radius-pill); flex-wrap: wrap; max-width: 100%; }
.seg button { padding: 8px 16px; border: 0; border-radius: var(--radius-pill); background: none; color: var(--muted); cursor: pointer; font: 600 17px/1 var(--display); letter-spacing: -0.01em; transition: background 180ms var(--ease), color 180ms var(--ease); }
.seg button[aria-pressed='true'] { color: #fff; background: var(--grad-sheen), var(--grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--glass-border); border-radius: var(--radius-pill); padding: 2px; background: var(--fill); }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; color: var(--text); cursor: pointer; font: 600 18px/1 var(--font); transition: background 150ms var(--ease); }
.stepper button:active { background: var(--fill-hover); }
.stepper output { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.rac-table td, .rac-table th { padding: 8px 6px; vertical-align: middle; }
.rac-table input { padding: 8px 10px; border-radius: 10px; font-size: 15px; }
.rac-table .tot td { font-weight: 700; background: var(--fill); }
.bar { height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; border: 1px solid var(--hairline); margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: inherit; transition: width 250ms var(--ease); }
.bar.over > i { background: var(--down); }
.metric-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.metric-row b { font: 600 19px var(--display); font-variant-numeric: tabular-nums; }
.metric + .metric { margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius-pill); background: var(--fill); border: 1px solid var(--glass-border); font-size: 13px; }
.chip b { font-variant-numeric: tabular-nums; }
.chip.warn { border-color: color-mix(in srgb, var(--down) 50%, transparent); }
button.chip { cursor: pointer; font: inherit; font-size: 13px; color: var(--text); transition: background 180ms var(--ease), color 180ms var(--ease); }
.chip.is-on { color: #fff; background: var(--grad-sheen), var(--grad); border-color: transparent; }

/* Generador de entrenos */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); gap: 16px; align-items: start; }
.gen-form, .gen-previa { display: grid; gap: 16px; min-width: 0; }
.gen-form > .card + .card, .gen-previa > .card + .card { margin-top: 0; }
.gen-form > .card, .gen-previa > .card { min-width: 0; }
.gen-previa { position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; border-radius: var(--radius-card); }
.gen-fila { margin-top: 14px; }
.gen-vol td, .gen-res td, .gen-res th, .gen-vol th { padding: 8px 10px; }
.gen-vol input, .gen-vol select { padding: 7px 10px; font-size: 14px; }
.gen-vol input { width: 84px; }
.gen-matriz th input { width: 110px; padding: 6px 8px; font-size: 13px; }
.gen-matriz td { text-align: center; padding: 8px 10px; }
.gen-matriz td:first-child { text-align: left; }
.gen-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.gen-dot.ok { background: var(--up); }
.gen-dot.mal { background: var(--yellow); }
.gen-avisos { margin-top: 12px; display: grid; gap: 8px; }
.gen-avisos p { display: flex; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.gen-avisos svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent-text); margin-top: 1px; }
.gen-ej { padding: 8px 12px; gap: 12px; }
.gen-ej-img { border: 0; background: none; padding: 0; cursor: pointer; flex-shrink: 0; }
.grp-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 9px; border-radius: var(--radius-pill); color: #fff; }
.grp-proteina { background: #e2470f; }
.grp-hc { background: #a87400; }
.grp-grasa { background: #c81e2e; }
.grp-libre { background: #4d7c5a; }
.meal-block { border: 1px solid var(--glass-border); border-radius: 18px; padding: 16px; background: var(--hairline); }
.meal-block + .meal-block { margin-top: 12px; }
.meal-block h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meal-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px dashed var(--hairline); }
.save-state { font-size: 12px; color: var(--muted); }
.picker-list { max-height: 52dvh; overflow: auto; display: grid; gap: 2px; margin-top: 12px; }
.picker-list label { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 500; }
.picker-list label .grow { flex: 1; min-width: 0; }
.picker-list label small { color: var(--muted); font-size: 12px; }
.food-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.food-card { cursor: pointer; }
.star { background: none; border: 0; cursor: pointer; color: var(--faint); font-size: 18px; line-height: 1; padding: 4px; }
.star[aria-pressed='true'] { color: var(--yellow); }

/* Documento de dieta (app del cliente y PDF) */
.dieta-doc { display: grid; gap: 26px; }
.dd-title { font-size: 44px; margin: 2px 0 6px; }
.dd-sub { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-text); font-weight: 700; margin-bottom: 6px; }
.dd-muted { color: var(--muted); font-size: 14px; }
.dd-h { font-size: 30px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dd-h small { font: 500 13px var(--font); color: var(--muted); text-transform: none; letter-spacing: 0; }
.dd-macros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.dd-macros span { padding: 6px 12px; border-radius: var(--radius-pill); background: var(--fill); border: 1px solid var(--glass-border); font-size: 13px; }
.dd-comidas { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.dd-comida { border: 1px solid var(--glass-border); border-radius: 18px; padding: 16px 18px; background: var(--fill); break-inside: avoid; }
.dd-comida header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.dd-comida h4 { font: 600 21px/1 var(--display); margin: 0; text-transform: none; }
.dd-hora { font-size: 13px; color: var(--muted); }
.dd-grupo + .dd-grupo { margin-top: 12px; }
.dd-grupo-head, .dd-eq-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dd-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 9px; border-radius: var(--radius-pill); color: #fff; }
.dd-proteina { background: #e2470f; }
.dd-hc { background: #a87400; }
.dd-grasa { background: #c81e2e; }
.dd-menu { background: #3b3330; }
.dd-hint { font-size: 12px; color: var(--muted); }
.dd-opciones { list-style: none; margin: 0; padding: 0; }
.dd-opciones li, .dd-compra li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--hairline); font-size: 14px; }
.dd-opciones li b, .dd-compra li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dd-libre { margin-top: 10px; font-size: 13px; color: var(--up); font-weight: 600; }
.dd-nota { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.dd-ejemplos { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hairline); font-size: 13px; line-height: 1.5; }
.dd-ejemplo + .dd-ejemplo { margin-top: 6px; }
.dd-eqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.dd-compra { columns: 3 230px; column-gap: 28px; }
.dd-compra > div { break-inside: avoid; margin-bottom: 16px; }
.dd-compra ul { list-style: none; padding: 0; margin: 0; }
.dd-notas p { margin: 0; line-height: 1.6; }
.dd-foot { font-size: 11px; color: var(--faint); text-align: center; padding-top: 14px; border-top: 1px solid var(--hairline); }

/* Hoja imprimible (siempre clara, como papel) */
.print-page { min-height: 100dvh; padding: 24px 16px 60px; }
.print-toolbar { max-width: 920px; margin: 0 auto 16px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.print-sheet {
  --text: #16120f; --muted: #5a524c; --faint: #8a817a; --accent-text: #c2410c; --fill: #faf7f5;
  --glass-border: #e6dfd9; --hairline: #ece6e1; --up: #157a43;
  color: var(--text); background: #fff; max-width: 920px; margin: 0 auto; border-radius: 10px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.25); overflow: hidden;
}
.print-band { background: #0b0b0d; padding: 20px 32px; display: flex; justify-content: space-between; align-items: center; }
.print-band img { height: 30px; display: block; }
.print-band span { color: #fff; font: 600 16px var(--display); letter-spacing: -0.01em; }
.print-sheet .dieta-doc { padding: 28px 32px 22px; }
@media print {
  @page { size: A4; margin: 10mm; }
  body::before, .print-toolbar, .toasts { display: none !important; }
  html, body { background: #fff !important; }
  .print-page { padding: 0; }
  .print-sheet { box-shadow: none; max-width: none; border-radius: 0; }
  .print-band, .dd-tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .dd-comidas { grid-template-columns: 1fr 1fr; }
  .dd-dia { break-before: auto; }
}

/* ═════════ ENTRENOS ═════════ */
.ej-thumb { display: block; flex-shrink: 0; object-fit: cover; border-radius: 10px; background: #fff; border: 1px solid var(--glass-border); }
.ej-thumb-empty { display: grid; place-items: center; background: var(--fill); color: var(--muted); }
.ej-thumb-empty svg { width: 40%; height: 40%; }
.ej-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.ej-gallery img { width: 100%; border-radius: 14px; background: #fff; border: 1px solid var(--glass-border); }
.ej-video { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; }
.ej-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ej-card { border: 1px solid var(--glass-border); border-radius: 18px; padding: 14px 16px; background: var(--hairline); }
.ej-card + .ej-card { margin-top: 10px; }
.ej-card > header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ej-tag { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 10px; font: 600 18px/1 var(--display); color: #fff; background: var(--grad-sheen), var(--grad); flex-shrink: 0; }
.ej-name { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; background: none; border: 0; padding: 0; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.ej-name span { display: flex; flex-direction: column; min-width: 0; }
.ej-name b { font-weight: 700; }
.ej-name small { color: var(--muted); font-size: 13px; }
.ej-actions { display: flex; gap: 2px; }
.ej-actions .btn.icon { padding: 7px 9px; font-size: 15px; }
.btn.is-on { color: var(--accent-text); border-color: rgba(255, 120, 60, 0.6); background: rgba(255, 90, 31, 0.12); }
.ej-bloque { margin-bottom: 12px; }
.ej-bloque.is-ss { border-left: 3px solid var(--fire); padding-left: 12px; border-radius: 4px; }
.ss-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 8px; }
.ss-link { font-size: 12px; color: var(--accent-text); margin-top: 8px; }
.sem-table { font-size: 14px; }
.sem-table th, .sem-table td { padding: 6px 5px; text-align: center; }
.sem-table td:first-child { text-align: left; white-space: nowrap; }
.sem-table input { padding: 7px 6px; text-align: center; min-width: 58px; border-radius: 10px; font-size: 15px; }
.ej-params { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; align-items: flex-end; }
.ej-params .field { min-width: 110px; }
.ej-params input { padding: 8px 10px; }
.ej-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.ej-tile { padding: 0; overflow: hidden; text-align: left; cursor: pointer; color: var(--text); font: inherit; display: flex; flex-direction: column; }
.ej-tile .ej-thumb { width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: 0; border: 0; }
.ej-tile-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.ej-tile-body small { color: var(--muted); font-size: 12px; }
.ej-tile-body .badge { align-self: flex-start; margin-top: 4px; }

/* Registro en el gimnasio */
.lg-card { padding: 16px; }
.lg-head { margin-bottom: 8px; }
.lg-sets { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.lg-sets th { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; padding: 0 4px; }
.lg-sets td { padding: 0 3px; text-align: center; }
.lg-sets td:first-child { width: 28px; font-weight: 700; }
.lg-sets input { text-align: center; padding: 12px 4px; font-size: 18px; font-weight: 600; border-radius: 12px; }
.lg-sets tr.is-done input { border-color: color-mix(in srgb, var(--up) 55%, transparent); background: color-mix(in srgb, var(--up) 10%, transparent); }
.lg-check { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--glass-border); background: var(--fill); color: var(--muted); font-size: 22px; font-weight: 700; cursor: pointer; transition: transform 160ms var(--spring), background 160ms var(--ease); }
.lg-check:active { transform: scale(0.92); }
.lg-check.on { background: var(--up); border-color: var(--up); color: #fff; }
.lg-cardio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 8px; align-items: end; }
.lg-cardio input { font-size: 18px; text-align: center; }
.lg-nota { margin-top: 10px; padding: 9px 12px; font-size: 14px; }
.lg-card.is-done { border-color: color-mix(in srgb, var(--up) 45%, transparent); }
.rest-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 20px; border-radius: var(--radius-pill); background: var(--glass-solid); border: 1px solid rgba(255, 120, 60, 0.5);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.rest-bar b { font: 600 27px/1 var(--display); min-width: 74px; text-align: center; font-variant-numeric: tabular-nums; }

/* ═════════ SEGUIMIENTO ═════════ */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--red); color: #fff; font: 700 11px/20px var(--font); text-align: center; letter-spacing: 0; }
.nav-badge[hidden] { display: none; }
.bottom-nav a, .bottom-nav button { position: relative; }
.nav-dot { position: absolute; top: 6px; left: calc(50% + 7px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--glass-solid); }
.nav-dot[hidden] { display: none; }

/* Panel «Más» (móvil) */
.sheet-bg { position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: flex; align-items: flex-end; animation: fade 200ms var(--ease); }
.sheet-bg[hidden] { display: none; }
@media (min-width: 761px) { .sheet-bg { display: none !important; } } /* el panel «Más» es solo del móvil */
.sheet {
  width: 100%; max-height: 86dvh; overflow: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; border-bottom: 0;
  background: linear-gradient(var(--modal-tint), var(--modal-tint)), var(--glass-bg-strong); animation: rise 260ms var(--spring);
}
.sheet-bg.sin-anim, .sheet-bg.sin-anim .sheet { animation: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--muted); opacity: 0.4; margin: 4px auto 12px; }
.sheet-nav { display: grid; gap: 2px; }
.sheet-nav a { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-radius: 16px; color: var(--text); font: 600 16px var(--font); }
.sheet-nav a svg { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.sheet-nav a.active { color: #fff; background: var(--grad-sheen), var(--grad); }
.sheet-nav a.active svg { color: #fff; }
.sheet-nav a:active { background: var(--fill-hover); }
.sheet-nav .nav-badge { margin-left: auto; }
.sheet-sec { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.sheet .theme-switch { margin: 8px 0 0; }
.sheet .theme-switch button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 0; font: 600 14px var(--font); }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-foot .btn svg { width: 16px; height: 16px; }
.bottom-nav .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; line-height: 18px; font-size: 10px; }
.nav a.active .nav-badge { background: #fff; color: var(--red); }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 120px); max-width: 860px; }
.chat-lista { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.burbuja { max-width: 78%; align-self: flex-start; padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--fill-hover); border: 1px solid var(--glass-border); }
.burbuja.mia { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: linear-gradient(135deg, rgba(255, 90, 31, 0.9), rgba(235, 49, 65, 0.9)); color: #fff; border-color: transparent; }
.burbuja.mia a { color: #fff; text-decoration: underline; }
.burbuja p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.burbuja small { display: block; margin-top: 4px; font-size: 11px; opacity: 0.7; }
.burbuja-foto { display: block; max-width: 100%; max-height: 320px; border-radius: 12px; margin-bottom: 6px; background: var(--fill); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.chat-form textarea { min-height: 46px; max-height: 160px; resize: none; border-radius: 22px; padding: 12px 16px; }
.chat-form .btn.icon { width: 46px; height: 46px; flex-shrink: 0; }

/* Check-in */
.ci-fotos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ci-foto { cursor: pointer; }
.ci-foto-prev { display: grid; place-items: center; gap: 4px; aspect-ratio: 3 / 4; border-radius: 16px; border: 1px dashed var(--glass-border); background: var(--fill); color: var(--muted); overflow: hidden; position: relative; }
.ci-foto-prev svg { width: 28px; height: 28px; }
.ci-foto-prev img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ci-foto-prev small { position: relative; z-index: 1; background: var(--glass-solid); padding: 2px 8px; border-radius: 99px; align-self: end; margin-bottom: 8px; }
.ci-rango { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 1.2fr) 32px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--hairline); font-weight: 600; }
.ci-rango input[type='range'] { padding: 0; accent-color: var(--fire); background: none; border: 0; box-shadow: none; }
.ci-rango output { font: 600 19px var(--display); text-align: right; }

/* Agenda */
.agenda-semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.agenda-dia { min-height: 180px; padding: 10px; border-radius: 18px; border: 1px solid var(--glass-border); background: var(--glass-bg); display: flex; flex-direction: column; gap: 6px; }
.agenda-dia.is-hoy { border-color: rgba(255, 120, 60, 0.7); box-shadow: inset 0 0 0 1px rgba(255, 120, 60, 0.4); }
.agenda-dia-head { display: flex; align-items: center; gap: 6px; text-transform: uppercase; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); }
.agenda-dia-head b { font: 600 18px var(--display); color: var(--text); }
.agenda-dia-head .btn { margin-left: auto; padding: 4px; }
.cita { display: flex; flex-direction: column; text-align: left; padding: 8px 10px; border-radius: 12px; border: 0; cursor: pointer; font: inherit; font-size: 13px; color: #fff; background: var(--grad-sheen), var(--grad); }
.cita small { opacity: 0.85; font-size: 11px; }
.cita.is-past { opacity: 0.55; }

/* ═════════ ESTRUCTURA Y PANTALLAS ═════════ */
.shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: 236px; flex-shrink: 0; position: sticky; top: 16px; height: calc(100dvh - 32px); margin: 16px 0 16px 16px;
  display: flex; flex-direction: column; padding: 26px 14px;
}
.sidebar .logo { width: 150px; margin: 0 10px 38px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a, .nav button.nav-btn {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-pill); width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  color: var(--muted); font: 600 13px var(--font); letter-spacing: 0.1em; text-transform: uppercase;
  transition: color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--spring);
}
.nav a:active, .nav button.nav-btn:active { transform: scale(0.97); }
.nav a svg, .nav button.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav a.active { color: #fff; background: var(--grad-sheen), var(--grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 18px rgba(235, 49, 65, 0.25); }
.nav a .soon { margin-left: auto; font-size: 10px; letter-spacing: 0.08em; padding: 2px 7px; border-radius: var(--radius-pill); border: 1px solid var(--glass-border); color: var(--muted); }
.sidebar .bottom { margin-top: auto; }

.main { flex: 1; min-width: 0; padding: 40px 40px 64px; max-width: 1320px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mobile-header { display: none; }
.bottom-nav { display: none; }

.card { padding: 24px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi { padding: 20px 22px; }
.kpi .value { font-family: var(--display); font-weight: 600; font-size: 43px; line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi .value small { font-family: var(--font); font-size: 15px; font-weight: 600; margin-left: 4px; color: var(--muted); -webkit-text-fill-color: var(--muted); }
.kpi .label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.kpi .delta { font-size: 13px; font-weight: 600; margin-top: 6px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade 200ms var(--ease); }
.modal { background: linear-gradient(var(--modal-tint), var(--modal-tint)), var(--glass-bg-strong); width: 100%; max-width: 640px; max-height: 90dvh; overflow: auto; border-radius: 28px; animation: rise 260ms var(--spring); }
.modal.wide { max-width: 980px; }
.modal-head, .modal-foot { position: sticky; z-index: 2; background: var(--glass-solid); }
.modal-head { top: 0; display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--glass-border); }
.modal-head h2 { font-size: 30px; }
.modal-body { padding: 24px; }
.modal-foot { bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--glass-border); }
.modal .result-box.live { position: sticky; top: 76px; z-index: 1; background: var(--live-bg); margin-bottom: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } }

.toasts { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 13px 20px; border-radius: var(--radius-pill); font-weight: 500; animation: rise 240ms var(--spring); }
.toast.error { border-color: color-mix(in srgb, var(--down) 60%, transparent); }
.toast.ok { border-color: color-mix(in srgb, var(--up) 55%, transparent); }

.demo-banner { border: 1px solid rgba(251, 187, 11, 0.45); color: #8a6200; font-size: 13px; padding: 9px 16px; border-radius: var(--radius-pill); margin-bottom: 28px; background: rgba(251, 187, 11, 0.1); }
:root:not([data-theme='light']) .demo-banner { color: var(--yellow); }

/* Selector de tema */
.theme-switch { display: flex; gap: 2px; padding: 3px; margin: 6px 0 10px; background: var(--fill); border: 1px solid var(--glass-border); border-radius: var(--radius-pill); }
.theme-switch button { flex: 1; display: grid; place-items: center; padding: 7px 0; border: 0; border-radius: var(--radius-pill); background: none; color: var(--muted); cursor: pointer; transition: background 180ms var(--ease), color 180ms var(--ease); }
.theme-switch button svg { width: 16px; height: 16px; }
.theme-switch button[aria-pressed='true'] { background: var(--grad-sheen), var(--grad); color: #fff; }

/* Acceso */
.login-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 40px; padding: 40px 6vw; }
.login-hero .logo { width: 170px; margin-bottom: 70px; }
.login-hero h1 { font-size: clamp(56px, 8vw, 120px); line-height: 0.9; }
.login-hero p { color: var(--muted); font-size: 18px; max-width: 460px; margin: 28px 0 0; }
.login-card { width: 100%; max-width: 420px; justify-self: center; padding: 32px; border-radius: 28px; }
.login-card h2 { font-size: 34px; margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .btn.primary { margin-top: 6px; }

/* Hover solo con ratón (en táctil se queda pegado) */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--fill-hover); filter: brightness(1.05); }
  .btn.primary:hover { background: var(--grad-sheen), var(--grad); filter: brightness(1.1); }
  .btn.ghost:hover { color: var(--text); background: var(--fill); }
  .nav a:not(.active):hover, .nav button.nav-btn:hover { color: var(--text); background: var(--fill-hover); }
  .tabs a:not(.active):hover { color: var(--text); background: var(--fill); }
  .table tr.clickable:hover td { background: var(--fill); }
  .list-row:hover { background: var(--fill); }
  .theme-switch button[aria-pressed='false']:hover { color: var(--text); }
}
.list-row:active, .bottom-nav a:active, .bottom-nav button:active { background: var(--fill-hover); }

/* ═════════ ACCESIBILIDAD Y FALLBACKS ═════════ */
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-strong, .glass-nav, .card, .kpi, .login-card, .modal, .sheet, .toast, .sidebar, .mobile-header, .bottom-nav {
    background: var(--glass-solid); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .modal-head, .modal-foot, .table th, .modal .result-box.live { background: var(--glass-solid); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:active, .nav a:active { transform: none; }
  .btn:hover, .chip:hover, .tipo-card:hover, a.card:hover, .card.list-row:hover, .lg-check:hover, .tipo-card:active, .chip:active { transform: none !important; }
}

/* ═════════ MÓVIL ═════════ */
@media (max-width: 1100px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor-aside { position: static; order: -1; }
  .gen { grid-template-columns: minmax(0, 1fr); }
  .gen-previa { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; gap: 28px; padding: 28px 20px; }
  .login-hero .logo { margin-bottom: 36px; }
  .login-hero p { display: none; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 18px 16px 120px; }
  h1 { font-size: 40px; }
  .eyebrow { letter-spacing: 0.24em; font-size: 11px; }
  .shell { flex-direction: column; }
  .mobile-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; z-index: 50;
    top: max(10px, env(safe-area-inset-top)); margin: max(10px, env(safe-area-inset-top)) 12px 0;
    padding: 6px 6px 6px 18px; border-radius: var(--radius-pill);
  }
  .mobile-header img { height: 24px; }
  .mobile-header .actions { display: flex; gap: 2px; }
  .bottom-nav {
    display: flex; position: fixed; z-index: 50; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
    padding: 6px; border-radius: 28px;
  }
  .bottom-nav a, .bottom-nav button {
    border: 0; background: none; cursor: pointer; font-family: var(--font);
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-radius: 22px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
    transition: background 180ms var(--ease), color 180ms var(--ease);
  }
  .bottom-nav a svg, .bottom-nav button svg { width: 22px; height: 22px; }
  .bottom-nav a.active, .bottom-nav button.active { color: #fff; background: var(--grad-sheen), var(--grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4); }
  .toasts { left: 16px; right: 16px; bottom: 104px; }
  .toast { border-radius: 20px; }
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal { max-height: 94dvh; border-radius: 28px 28px 0 0; }
  .hide-mobile { display: none; }
  .kpi { padding: 16px; border-radius: 20px; }
  .kpi .value { font-size: 42px; }
  .avatar.lg { width: 58px; height: 58px; font-size: 28px; }
  .card { padding: 18px; border-radius: 22px; }
  .tabs a { padding: 8px 14px; font-size: 17px; }
  .meal-row { grid-template-columns: 1fr; }
  .agenda-semana { grid-template-columns: 1fr; }
  .agenda-dia { min-height: 0; }
  .chat { height: calc(100dvh - 190px); }
  .burbuja { max-width: 88%; }
  .gen-res th, .gen-res td { padding: 8px 6px; font-size: 13px; }
  .rest-bar { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 84px); width: calc(100% - 24px); justify-content: center; }
  .lg-cardio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ej-actions .btn.icon { padding: 6px 7px; }
  .ej-card > header { flex-wrap: wrap; }
  .print-sheet .dieta-doc { padding: 20px 16px; }
  .print-band { padding: 16px; }
  .dd-title { font-size: 34px; }
}

/* Captación (coach) */
.cap-url { display: inline-block; max-width: 100%; padding: 8px 12px; border-radius: 12px; background: var(--fill); border: 1px solid var(--glass-border); font: 500 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); }
.cap-enlaces { display: grid; gap: 8px; }
.cap-enlace { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.cap-pasos { margin: 0; padding-left: 22px; display: grid; gap: 14px; font-size: 15px; line-height: 1.5; }
.cap-pasos a { color: var(--accent-text); }
.cap-codigo { margin: 8px 0; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; min-height: 160px; }
.cap-previa { width: 100%; height: min(70vh, 760px); border: 1px solid var(--glass-border); border-radius: 16px; background: #f4efeb; }
.cap-fila { width: calc(100% + 24px); border: 0; background: none; text-align: left; font: inherit; }
@media (max-width: 760px) { .cap-enlace { grid-template-columns: minmax(0, 1fr) auto; } .cap-enlace > span { grid-column: 1 / -1; } }

/* ═════════ PÁGINAS PÚBLICAS (/info, /reserva, /baja, /privacidad) ═════════ */
.pub { min-height: 100dvh; }
.pub [hidden] { display: none !important; }
.pub-wrap { max-width: 560px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 48px; display: grid; gap: 18px; }
.pub-hero { padding: 8px 4px 4px; }
.pub-logo { height: 30px; width: auto; margin-bottom: 34px; }
.pub-hero h1 { font-size: clamp(48px, 13vw, 76px); line-height: 0.92; }
.pub-lead { color: var(--muted); font-size: 17px; line-height: 1.55; margin: 16px 0 0; }
.pub-card { display: grid; gap: 16px; padding: 26px; }
.pub-card > * { margin: 0; }
.pub-btn { width: 100%; justify-content: center; padding: 15px 22px; font-size: 20px; }
.pub-check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--text); cursor: pointer; }
.pub-check input { margin-top: 1px; flex-shrink: 0; }
.pub-legal { font-size: 12px; line-height: 1.55; color: var(--muted); }
.pub-legal a, .pub-texto a { color: var(--accent-text); }
.pub-msg { padding: 10px 14px; border-radius: 14px; font-size: 14px; color: var(--down); background: color-mix(in srgb, var(--down) 10%, transparent); border: 1px solid color-mix(in srgb, var(--down) 35%, transparent); }
.pub-trampa { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.pub-ok { text-align: center; justify-items: center; }
.pub-ok h2 { font-size: 40px; }
.pub-ok p { color: var(--muted); line-height: 1.55; }
.pub-ok:focus { outline: none; }
.pub-ok-icono { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font: 700 30px/1 var(--font); color: #fff; background: var(--grad-sheen), var(--grad); box-shadow: 0 10px 30px rgba(235, 49, 65, 0.3); }
.pub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.pub-email { font-size: 15px; color: var(--muted); }
.pub-planes { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; background: none; }
.pub-planes legend { padding: 0; margin-bottom: 8px; font: 600 11px var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.pub-plan { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--glass-border); background: var(--fill); cursor: pointer; transition: border-color 180ms var(--ease), background 180ms var(--ease); }
.pub-plan:has(input:checked) { border-color: rgba(255, 120, 60, 0.75); background: color-mix(in srgb, var(--fire) 10%, var(--fill)); }
.pub-plan input { flex-shrink: 0; accent-color: var(--fire); width: 18px; height: 18px; }
.pub-plan .grow { display: grid; gap: 3px; min-width: 0; }
.pub-plan small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.pub-precio { font: 600 21px/1 var(--display); text-align: right; white-space: nowrap; }
.pub-precio small { display: block; font: 500 12px var(--font); margin-top: 3px; }
.pub-sep { border: 0; border-top: 1px solid var(--hairline); width: 100%; }
.pub-texto h2 { font-size: 26px; margin-top: 8px; }
.pub-texto p, .pub-texto li { line-height: 1.6; color: var(--text); }
.pub-texto ul, .pub-texto ol { padding-left: 20px; display: grid; gap: 8px; }

/* ───────── Tipos de dieta (asistente de creación) ───────── */
.tipo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tipo-card { position: relative; display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; background: var(--fill); border: 1px solid var(--glass-border); cursor: pointer; transition: border-color 160ms var(--ease), background 160ms var(--ease); }
.tipo-card:hover { background: var(--fill-hover); }
.tipo-card input { position: absolute; opacity: 0; pointer-events: none; }
.tipo-card b { font: 600 16px/1.05 var(--display); letter-spacing: -0.01em; text-transform: none; }
.tipo-card span { font-size: 13px; line-height: 1.4; color: var(--muted); }
.tipo-card:has(input:checked) { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; background: var(--fill-hover); }
.tipo-card:has(input:focus-visible) { outline: 2px solid var(--orange); outline-offset: 2px; }
.rac-tamanos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.rac-tamanos input { width: 64px; padding: 6px 8px; }

/* Documento de la dieta: recetas */
.dd-receta { font-weight: 600; font-size: 14px; margin: 6px 0 4px; }
.dd-pasos { margin-top: 6px; font-size: 13px; }
.dd-pasos summary { cursor: pointer; color: var(--accent-text); font-weight: 600; }
.dd-pasos p { margin: 6px 0 0; line-height: 1.55; color: var(--muted); }
@media print { .dd-pasos:not([open]) p { display: block; } }

/* ───────── Diario flexible (tipo MyFitnessPal) ───────── */
.dia-punto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dia-resumen { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 18px 28px; align-items: center; }
.dia-anillo { width: 170px; height: 170px; }
.dia-anillo .pista { fill: none; stroke: var(--fill-hover); stroke-width: 11; }
.dia-anillo .valor { fill: none; stroke: var(--orange); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 400ms var(--ease); }
.dia-anillo .valor.pasado { stroke: var(--down); }
.dia-anillo .num { font: 600 24px var(--display); fill: var(--text); }
.dia-anillo .lbl { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; fill: var(--muted); }
.dia-barras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dia-barras .metric + .metric { margin-top: 0; }
.dia-extra { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; padding-top: 14px; border-top: 1px solid var(--hairline); }
.dia-nota { font: 600 32px/1 var(--display); margin-top: 4px; }
.dia-nota small { font: 500 14px var(--font); color: var(--muted); margin-left: 2px; }
.dia-consejos { margin-top: 16px; display: grid; gap: 8px; }
.dia-consejos p { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 14px; line-height: 1.45; }
.dia-consejos p > i { flex-shrink: 0; width: 18px; font-style: normal; text-align: center; line-height: 1.3; }
.dia-consejos p > i svg { width: 17px; height: 17px; }
.dia-consejos p > span { min-width: 0; }
.dia-consejos .tono-aviso { color: var(--down); }
.dia-consejos .tono-aviso span { color: var(--text); }
.dia-consejos .tono-ok { color: var(--up); font-weight: 600; }
.dia-comida { margin-top: 16px; }
.dia-entrada { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; color: inherit; font: inherit; align-items: center; gap: 10px; padding: 10px 2px; cursor: pointer; }
.dia-entrada:hover { background: var(--fill); }
.dia-lista { display: grid; gap: 2px; max-height: 46vh; overflow: auto; margin-top: 10px; }
.dia-lista .list-row { margin: 0; width: 100%; text-align: left; background: none; border: 1px solid transparent; font: inherit; }
.dia-lista .list-row.is-sel { background: var(--fill-hover); border-color: var(--orange); }
.dia-sel { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: var(--fill); border: 1px solid var(--glass-border); }
.dia-video { width: 100%; max-height: 260px; border-radius: 14px; background: #000; object-fit: cover; margin-top: 10px; }
@media (max-width: 760px) {
  .dia-resumen { grid-template-columns: 1fr; justify-items: center; gap: 14px; }
  .dia-anillo { width: 136px; height: 136px; }
  .dia-barras { width: 100%; gap: 12px; }
  .dia-barras .metric-row { flex-direction: column; align-items: flex-start; gap: 0; font-size: 12px; }
  .dia-barras .metric-row b { font-size: 21px; }
  .dia-barras .small { font-size: 11px; }
  .dia-extra { gap: 12px 20px; }
  .tipo-grid { grid-template-columns: 1fr; }
}
.rac-g { display: block; font-size: 11px; margin-top: 3px; padding-left: 4px; }

/* Aviso de «sin conexión» (app.js) */
.offline-pill { position: fixed; z-index: 120; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); padding: 9px 16px; border-radius: var(--radius-pill);
  background: var(--glass-solid); color: var(--text); border: 1px solid color-mix(in srgb, var(--yellow) 55%, transparent); box-shadow: var(--glass-shadow);
  font-size: 13px; font-weight: 600; white-space: nowrap; animation: fade 300ms var(--ease); }
.offline-pill::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); margin-right: 8px; vertical-align: 1px; }
@media (max-width: 760px) { .offline-pill { bottom: calc(96px + env(safe-area-inset-bottom)); font-size: 12px; } }

/* Zonas táctiles de al menos 40 px en pantallas táctiles (recomendación de Apple/Google: 44 px) */
@media (pointer: coarse) {
  .tabs a, .seg button, .theme-switch button { min-height: 40px; }
  .tabs a { display: inline-flex; align-items: center; }
  .btn.icon, .btn.sm.icon, button.star { min-width: 40px; min-height: 40px; }
  .btn.sm { min-height: 40px; }
  .card-head a.small, .card-head > a { padding: 10px 6px; margin: -10px -6px; }
  .gen-ej-img { min-height: 40px; }
}

/* Esqueleto mientras carga una pantalla (aparece solo si tarda más de 0,3 s) */
.cargando { display: grid; gap: 16px; animation: fade 200ms var(--ease) 300ms both; }
.cargando i { display: block; position: relative; overflow: hidden; border-radius: var(--radius-card); background: var(--fill); border: 1px solid var(--hairline); }
/* El brillo se mueve con transform (lo hace la tarjeta gráfica sin repintar: fluido aunque la pantalla esté cargando) */
.cargando i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, var(--fill-hover) 50%, transparent 70%); transform: translateX(-100%); animation: brillo 1.4s linear infinite; }
.cargando .c-tit { height: 54px; width: min(420px, 70%); border-radius: 14px; }
.cargando .c-fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.cargando .c-kpi { height: 120px; }
.cargando .c-card { height: 220px; }
@keyframes brillo { to { transform: translateX(100%); } }

/* Nombre del cliente: en el móvil pasa a dos líneas en vez de cortarse */
@media (max-width: 760px) {
  h1.titulo-cliente { white-space: normal; overflow: visible; line-height: 0.95; overflow-wrap: anywhere; }
}
/* Deslizadores del check-in: más fáciles de mover con el dedo */
@media (pointer: coarse) { .ci-rango input[type='range'] { height: 36px; } }

/* Pantalla de arranque (está en el HTML: se ve aunque el JavaScript tarde) */
.arranque { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 22px; }
.arranque img { width: 190px; height: auto; }
.arranque i { position: relative; overflow: hidden; width: 120px; height: 3px; border-radius: 3px; }
.arranque i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--orange), transparent); transform: translateX(-100%); animation: brillo 1.1s linear infinite; }

/* Productos de supermercado: cadena y Nutri-Score */
.super-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.super-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: var(--radius-pill); border: 1px solid var(--glass-border); color: var(--muted); background: var(--fill); }
.super-carrefour { color: #2f6fd6; border-color: color-mix(in srgb, #2f6fd6 40%, transparent); }
.super-mercadona { color: #1f9d55; border-color: color-mix(in srgb, #1f9d55 40%, transparent); }
.super-lidl { color: #d9a400; border-color: color-mix(in srgb, #d9a400 45%, transparent); }
.super-aldi { color: #4f7fd9; border-color: color-mix(in srgb, #4f7fd9 40%, transparent); }
:root:not([data-theme='light']) .super-carrefour { color: #7fb0ff; }
:root:not([data-theme='light']) .super-mercadona { color: #5fd895; }
:root:not([data-theme='light']) .super-lidl { color: #ffd34d; }
:root:not([data-theme='light']) .super-aldi { color: #9dbbff; }
.nutri { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; font: 800 11px/1 var(--font); color: #fff; }
.nutri-a { background: #038141; } .nutri-b { background: #85bb2f; } .nutri-c { background: #e5a800; } .nutri-d { background: #ee8100; } .nutri-e { background: #e63e11; }
.pub-aviso { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, #e0a100 14%, transparent); border: 1px solid color-mix(in srgb, #e0a100 40%, transparent); font-size: 15px; line-height: 1.45; }
/* Turnstile (antibots): solo ocupa sitio si está activado */
.ts-caja { margin: 4px 0 8px; }
.ts-caja:empty { display: none; }
/* Preguntas frecuentes (app y página /ayuda) */
.ay-preg { border-bottom: 1px solid var(--hairline); }
.ay-preg:last-child { border-bottom: 0; }
.ay-preg summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 2px; font-weight: 600; font-size: 15.5px; }
.ay-preg summary::-webkit-details-marker { display: none; }
.ay-preg summary::after { content: '+'; flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--fill); color: var(--accent-text); font-weight: 700; transition: transform 150ms var(--ease); }
.ay-preg[open] summary::after { transform: rotate(45deg); }
.ay-preg summary:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 8px; }
.ay-preg p { margin: 0 0 14px; color: var(--muted); line-height: 1.55; font-size: 15px; }
.ay-grupo + .ay-grupo { margin-top: 0; }
.pub-texto .legal-indice, .legal-indice { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.legal-indice a { display: inline-block; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--fill); border: 1px solid var(--glass-border); font-size: 13px; color: var(--text); }
.pub-pie { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin: 22px 0 8px; font-size: 13px; }
.pub-pie a { color: var(--muted); }
.pub-wrap--ancho { max-width: 780px; }
.pub-texto h3 { font: 600 16px var(--font); margin: 18px 0 6px; text-transform: none; letter-spacing: 0; }
.pub-texto table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0 12px; }
.pub-texto th, .pub-texto td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--hairline); line-height: 1.45; }
.pub-texto th { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pub-aviso-salud { padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--orange) 10%, transparent); border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent); line-height: 1.55; }
@media (max-width: 560px) { .pub-texto table { display: block; overflow-x: auto; } }
