:root {
  /* Remapeados a dark-first para alinear con el bevel theme (--dd-*).
     Las 3 tabs legacy (Analizar/Mounjaro/Perfil) consumen estos tokens;
     las tabs reconstruidas usan dd-* y no se ven afectadas. */
  --bg: #0F1318;
  --surface: #1A2027;
  --text: #EEF1F4;
  --text-2: #C2CAD3;
  --text-3: #8A95A1;
  --text-4: #6C7682;
  --accent: #5DCAA5;
  --accent-2: #FF8A5C;
  --border: rgba(255, 255, 255, 0.08);
  --shadow-soft: 0 1px 2px rgba(44, 42, 38, 0.04), 0 4px 16px rgba(44, 42, 38, 0.04);
  --shadow-lift: 0 1px 2px rgba(44, 42, 38, 0.05), 0 8px 24px rgba(61, 74, 42, 0.08);
}

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

/* Red de seguridad contra desbordes horizontales (Fase 2.5: barra de tabs scrollable).
   Lo ponemos en html Y body: en WKWebView (app nativa) solo-body dejaba que el
   documento "rebotara" horizontal si algún hijo se desbordaba. El carrusel de "Hoy"
   sigue funcionando porque es su propio scroller interno, no el documento. */
html, body {
  overflow-x: hidden;
  /* EL "BAILE" izq-der: es el rebote (rubber-band) horizontal NATIVO del WKWebView,
     que overflow-x:hidden NO frena (el scrollview nativo rebota igual). Faltaba este
     eje — el -y ya estaba abajo, por eso vertical no rebotaba y horizontal sí. Esto
     NO rompe el carrusel de "Hoy": overscroll-behavior solo afecta el rebote del
     propio scroller, no los scrollers anidados. */
  overscroll-behavior-x: none;
  /* v89: WebKit IGNORA overscroll-behavior en el scroller raíz del WKWebView (bug
     conocido), por eso el baile sobrevivió. touch-action sí se respeta: solo permite
     paneo VERTICAL del documento, así el gesto horizontal jamás llega al scrollview
     nativo. Los scrollers internos (carrusel de "Hoy", tabbar) NO se afectan: su gesto
     se resuelve del elemento tocado hacia arriba SOLO hasta el propio scroller, sin
     consultar html/body. */
  touch-action: pan-y pinch-zoom;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none; /* ambos ejes (antes solo -y); el -x mata el baile horizontal */
}

/* iOS WKWebView/Safari: al ENFOCAR un control de formulario con font-size < 16px hace
   ZOOM automático y NO regresa solo (la pantalla queda ampliada). Pasaba al "registrar
   sesión"/agregar un ejercicio a mano (inputs a 14-15px) y en perfil/progreso/bienestar.
   Forzamos 16px en TODOS los controles SOLO en iOS — @supports(-webkit-touch-callout)
   solo matchea iOS, así escritorio/Android quedan igual. !important para ganarle a las
   reglas específicas (.login-field / .profile-field / .progress-field / .chip-input-row). */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px !important; }
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(61,74,42,0.04) 1px, transparent 0);
  background-size: 12px 12px;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

.serif { font-family: 'Instrument Serif', 'Times New Roman', serif; font-weight: 400; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; letter-spacing: 0.12em; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.anim-in { animation: fadeInUp 0.4s ease-out both; }

/* Layout */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

/* Boot screen */
#boot {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg);
  z-index: 9999;
  gap: 14px;
}
#boot .mark {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 56px;
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
  line-height: 1;
}
#boot .lbl {
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Header */
.eyebrow {
  color: var(--text-4);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
}
.h1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 52px;
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 8px 0 10px;
}
.h1 i { font-style: italic; color: var(--accent); }
.lede {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.55;
  max-width: 36ch;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  background: #EDE7DC;
  padding: 4px;
  border-radius: 14px;
  margin: 28px 0 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  flex: 1;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
  letter-spacing: 0.01em;
}
.tab.active {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 1px 2px rgba(44,42,38,0.08);
}
.tab:not(.active):active { transform: scale(0.98); }
@media (max-width:680px) {
  .tabs {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    overflow:visible;
  }
  .tab {
    min-width:0;
    padding:9px 5px;
    font-size:12px;
  }
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px;
  box-shadow: var(--shadow-soft);
}

/* Day card */
.day-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.day-card.is-today {
  border: 1.5px solid var(--accent);
  box-shadow: var(--shadow-lift);
}
.day-head {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px;
  text-align: left;
  transition: background 0.2s ease;
}
.day-head:active { background: rgba(61, 74, 42, 0.03); }
.day-name {
  font-family: 'Instrument Serif', serif;
  font-size: 24px;
  line-height: 1.1;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pill-today {
  display: inline-block;
  background: rgba(61, 74, 42, 0.1);
  color: var(--accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  vertical-align: middle;
}
.day-foco {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.45;
}
.toggle-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(61, 74, 42, 0.06);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s;
  margin-top: 2px;
}
.toggle-btn.open { transform: rotate(45deg); background: rgba(61, 74, 42, 0.12); }

.day-body {
  padding: 0 18px 18px;
  animation: fadeInUp 0.3s ease-out both;
}
.day-divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 14px;
}
.meal-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.meal-row:last-child { border-bottom: none; }
.meal-time {
  width: 92px;            /* antes 52px: las etiquetas descriptivas ("Post entrenamiento",
                            "SUPLEMENTO", "Media mañana") de los planes HYROX/IA desbordaban
                            y se encimaban sobre el texto de la derecha. */
  flex-shrink: 0;
  overflow-wrap: break-word; /* parte palabras largas (p.ej. "entrenamiento") en vez de salirse */
  word-break: break-word;
}
.meal-time .hora {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.meal-time .tipo {
  display: block;
  color: var(--text-4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}
.meal-body { flex: 1; min-width: 0; }
.meal-titulo {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 4px;
}
.meal-detalle {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

/* Recordatorios */
.reminders {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  padding: 18px 20px;
  margin-top: 18px;
}
.reminders .label {
  color: var(--text-4);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 10px;
}
.reminders ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.reminders li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 8px 0;
}
.reminders li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 9px;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

/* Analyze tab */
.upload-card {
  background: var(--surface);
  border: 1.5px dashed rgba(61, 74, 42, 0.22);
  border-radius: 18px;
  padding: 48px 24px;
  text-align: center;
}
.upload-emoji {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(61, 74, 42, 0.07);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.upload-title {
  font-family: 'Instrument Serif', serif;
  font-size: 28px;
  line-height: 1.18;
  color: var(--text);
  margin-bottom: 10px;
}
.upload-sub {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
  max-width: 30ch;
  margin: 0 auto 24px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--bg);
  padding: 13px 26px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, background 0.2s ease;
  box-shadow: 0 1px 2px rgba(44,42,38,0.08);
}
.btn-primary:active { transform: scale(0.98); }
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.15s ease;
}
.btn-outline:hover { background: rgba(61,74,42,0.05); }
.btn-outline:active { transform: scale(0.98); }

.upload-hint {
  font-size: 12px;
  color: var(--text-4);
  margin-top: 14px;
}

.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.preview-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 320px;
  overflow: hidden;
  background: var(--dd-surface-2);
}
.preview-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.loader {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}
.loader-text {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--text-2);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Result cards */
.result-stack { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }

.verdict {
  border-radius: 16px;
  padding: 22px 22px;
  border: 1px solid var(--border);
}
.verdict.verde { background: var(--dd-good-bg); color: var(--dd-teal); }
.verdict.amarillo { background: var(--dd-warn-bg); color: var(--dd-amber); }
.verdict.rojo { background: #2A1717; color: var(--dd-danger); }
.verdict .label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  opacity: 0.75;
  margin-bottom: 8px;
}
.verdict .titulo {
  font-family: 'Instrument Serif', serif;
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 8px;
}
.verdict .coment {
  font-size: 14px;
  line-height: 1.55;
  opacity: 0.92;
}

.calorias-num {
  font-family: 'Instrument Serif', serif;
  font-size: 56px;
  line-height: 1;
  text-align: center;
  color: var(--text);
  margin-bottom: 4px;
}
.calorias-sub {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin-bottom: 22px;
}
.macros { display: flex; flex-direction: column; gap: 14px; }
.macro-row { }
.macro-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.macro-name {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.macro-val {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.bar-track {
  height: 6px;
  width: 100%;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.extras {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.extra-item .lbl {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: 4px;
}
.extra-item .val {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  color: var(--text);
}
.extra-item .unit {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--text-3);
  margin-left: 4px;
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-4);
  font-weight: 500;
  margin-bottom: 14px;
}
.food-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.food-row:last-child { border-bottom: none; }
.food-name {
  font-size: 14px;
  color: var(--text);
  flex: 1;
}
.food-portion {
  font-size: 13px;
  color: var(--text-3);
  flex-shrink: 0;
  text-align: right;
}

.clinical {
  display: flex;
  flex-direction: column;
}
.clinical-block { padding: 14px 0; }
.clinical-block + .clinical-block { border-top: 1px solid var(--border); }
.clinical-lbl {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-4);
  font-weight: 500;
  margin-bottom: 6px;
}
.clinical-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}

.error-card {
  background: #2A1717;
  color: var(--dd-danger);
  border-radius: 14px;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid rgba(226,75,74,0.25);
}

.actions { display: flex; justify-content: center; margin-top: 18px; }

.footer {
  text-align: center;
  color: var(--text-4);
  font-size: 11px;
  letter-spacing: 0.06em;
  margin-top: 36px;
  padding: 0 8px;
}

@media (max-width: 380px) {
  .h1 { font-size: 44px; }
  .calorias-num { font-size: 48px; }
  .day-name { font-size: 22px; }
}

/* ==================== Login screen ==================== */

.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--dd-text-sub);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--dd-bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--dd-surface);
  border: 1px solid var(--dd-line);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--dd-text-sub);
  margin-bottom: 12px;
}

.login-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 36px;
  font-weight: 400;
  color: var(--dd-text);
  margin: 0 0 8px;
  line-height: 1.1;
}

.login-title em {
  font-style: italic;
  color: var(--dd-teal);
}

.login-subtitle {
  color: var(--dd-text-sub);
  margin: 0;
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field span {
  font-size: 13px;
  color: var(--dd-text-sub);
  font-weight: 500;
}

.login-field input {
  padding: 12px 14px;
  border: 1px solid var(--dd-line);
  border-radius: 8px;
  font-size: 15px;
  background: var(--dd-surface-2);
  color: var(--dd-text);
  font-family: inherit;
}

.login-field input:focus {
  outline: none;
  border-color: var(--dd-teal);
  box-shadow: 0 0 0 3px rgba(93, 202, 165, 0.18);
}

.login-error {
  background: rgba(226, 75, 74, 0.12);
  color: var(--dd-danger);
  border: 1px solid rgba(226, 75, 74, 0.3);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.login-success {
  background: var(--dd-good-bg);
  color: var(--dd-teal);
  border: 1px solid rgba(93, 202, 165, 0.3);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.login-link {
  color: var(--dd-teal);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-link:hover {
  color: var(--dd-text);
}

.login-secondary {
  padding: 12px 14px;
  background: var(--dd-surface-2);
  color: var(--dd-text);
  border: 1px solid var(--dd-line);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.login-secondary:hover {
  border-color: var(--dd-teal);
  background: var(--dd-surface);
}

.login-submit {
  margin-top: 8px;
  padding: 14px;
  background: var(--dd-teal);
  color: var(--dd-bg);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.login-submit:hover:not(:disabled) {
  background: #4ab394;
}

.login-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--dd-text-sub);
  font-size: 13px;
  line-height: 1.42;
}

.login-check input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.login-check a {
  color: var(--dd-teal);
  text-underline-offset: 3px;
}

.login-note {
  margin: -2px 0 0;
  color: var(--dd-text-sub);
  font-size: 12px;
  line-height: 1.45;
}

.legal-page {
  min-height: 100vh;
  background: var(--dd-bg);
  color: var(--dd-text);
  padding: 24px;
}

.legal-doc {
  width: min(760px, 100%);
  margin: 0 auto;
  background: var(--dd-surface);
  border: 1px solid var(--dd-line);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.legal-doc h1,
.legal-doc h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
}

.legal-doc h1 {
  margin: 0 0 16px;
  font-size: 30px;
}

.legal-doc h2 {
  margin: 24px 0 8px;
  font-size: 20px;
  color: var(--dd-text);
}

.legal-doc p {
  margin: 8px 0;
  color: var(--dd-text-sub);
  line-height: 1.55;
}

.legal-doc h3 {
  margin: 16px 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--dd-text);
}

.legal-doc ul,
.legal-doc ol {
  margin: 8px 0;
  padding-left: 22px;
  color: var(--dd-text-sub);
  line-height: 1.55;
}

.legal-doc li {
  margin: 4px 0;
}

.legal-doc a {
  color: var(--dd-accent, #4f8cff);
  text-decoration: underline;
}

.legal-doc strong {
  color: var(--dd-text);
}

.legal-meta {
  font-size: 13px;
  color: var(--dd-text-sub);
  border-bottom: 1px solid var(--dd-line);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.legal-back {
  display: inline-block;
  margin-top: 24px;
  font-size: 14px;
}

.legal-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 14px;
}

.legal-doc th,
.legal-doc td {
  border: 1px solid var(--dd-line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  color: var(--dd-text-sub);
}

.legal-doc th {
  color: var(--dd-text);
  font-weight: 600;
  background: var(--dd-bg);
}

/* ==================== Topbar (después de login) ==================== */

.app-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--dd-surface);
  border-bottom: 1px solid var(--dd-line);
}

.app-user {
  font-size: 14px;
  color: var(--dd-text-sub);
}

.app-logout {
  background: transparent;
  border: 1px solid var(--dd-line);
  color: var(--dd-text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.app-logout:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ==================== Topbar avanzado ==================== */
.app-topbar { display:flex; justify-content:space-between; align-items:center; padding:12px 24px; background:var(--dd-surface); border-bottom:1px solid var(--dd-line); gap:12px; }
.topbar-left { display:flex; align-items:center; gap:16px; }
.topbar-greeting { font-size:14px; color:var(--dd-text-sub); }

.context-switcher { position:relative; }
.context-btn { background:transparent; border:1px solid var(--dd-line); color:var(--dd-text); padding:6px 12px; border-radius:6px; font-size:13px; cursor:pointer; font-family:inherit; }
.context-btn.active { background:rgba(255,255,255,0.06); }
.context-dropdown { position:absolute; top:calc(100% + 4px); left:0; background:var(--dd-surface); border:1px solid var(--dd-line); border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,0.4); min-width:180px; z-index:10; overflow:hidden; }
.context-dropdown button { display:block; width:100%; text-align:left; padding:10px 14px; background:transparent; border:none; cursor:pointer; font-family:inherit; font-size:14px; color:var(--dd-text); }
.context-dropdown button:hover { background:rgba(255,255,255,0.06); }
.context-dropdown button.selected { background:var(--dd-teal); color:var(--dd-bg); }

/* ==================== Modal (force password change) ==================== */
.modal-overlay { position:fixed; inset:0; background:rgba(42,44,32,0.6); display:flex; align-items:center; justify-content:center; padding:24px; z-index:100; }
.modal-card { background:var(--dd-surface); border-radius:16px; padding:32px; max-width:420px; width:100%; box-shadow:0 16px 48px rgba(0,0,0,0.5); }
.modal-card h2 { font-family:Georgia,'Times New Roman',serif; font-size:24px; margin:0 0 8px; color:var(--dd-text); }
.modal-sub { color:var(--dd-text-sub); margin:0 0 24px; font-size:14px; }

/* ==================== Tabs nav ==================== */
.tabs-nav { display:flex; gap:8px; margin:24px 0; background:var(--dd-surface-2); border-radius:10px; padding:4px; }
.tabs-nav button { flex:1; padding:12px; border:none; background:transparent; cursor:pointer; font-family:inherit; font-size:14px; color:var(--dd-text-sub); border-radius:8px; }
.tabs-nav button.active { background:var(--dd-teal); color:var(--dd-bg); }

/* ==================== Profile tab ==================== */
.profile-tab { display:flex; flex-direction:column; gap:24px; padding:8px 0 40px; }
.profile-loading { padding:40px; text-align:center; color:var(--text-3); }
.viewing-banner { background:var(--dd-warn-bg); border:1px solid rgba(239,159,39,0.3); padding:12px 16px; border-radius:8px; color:var(--dd-amber); font-size:14px; }

.profile-section { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:20px; }
.profile-section h3 { font-family:Georgia,serif; font-size:18px; color:var(--text); margin:0 0 16px; font-weight:400; }

.profile-photo-row { display:flex; align-items:center; gap:16px; }
.profile-photo { width:80px; height:80px; border-radius:50%; overflow:hidden; background:var(--dd-surface-2); display:flex; align-items:center; justify-content:center; }
.profile-photo img { width:100%; height:100%; object-fit:cover; }
.profile-photo-placeholder { font-size:32px; color:var(--accent); font-family:Georgia,serif; }
.profile-photo-upload { padding:8px 14px; background:transparent; border:1px solid var(--border); color:var(--text); border-radius:6px; font-size:13px; cursor:pointer; }

.profile-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:16px; }
.profile-field { display:flex; flex-direction:column; gap:6px; }
.profile-field span { font-size:13px; color:var(--text-2); font-weight:500; }
.profile-field input, .profile-field select { padding:10px 12px; border:1px solid var(--border); border-radius:6px; font-size:14px; background:var(--dd-surface-2); color:var(--text); font-family:inherit; }
.profile-field input:focus, .profile-field select:focus { outline:none; border-color:var(--accent); }

/* Estatura imperial: dos inputs ft / in en una fila */
.hf-ftin { display:flex; align-items:center; gap:6px; }
.hf-ftin input { width:100%; min-width:0; }
.hf-unit { font-size:13px; color:var(--text-3); font-weight:500; }

/* Toggle de unidades (Métrico / Imperial) */
.units-toggle { display:flex; gap:8px; }
.units-opt { flex:1; padding:10px 12px; border:1px solid var(--border); border-radius:8px; background:var(--dd-surface-2); color:var(--text-2); font-size:13px; font-weight:600; font-family:inherit; cursor:pointer; }
.units-opt.is-active { border-color:var(--accent); background:color-mix(in srgb, var(--accent) 14%, transparent); color:var(--text); }

.profile-textarea { width:100%; padding:12px; border:1px solid var(--border); border-radius:8px; font-family:inherit; font-size:14px; background:var(--dd-surface-2); color:var(--text); resize:vertical; }

.profile-help { font-size:13px; color:var(--text-3); margin:0 0 12px; }
.profile-share { display:flex; align-items:center; gap:10px; padding:8px 0; }

.chip-list { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.chip { background:var(--dd-surface-2); color:var(--text); padding:4px 10px; border-radius:16px; font-size:13px; display:inline-flex; align-items:center; gap:6px; }
.chip button { background:transparent; border:none; color:var(--text-3); cursor:pointer; font-size:16px; line-height:1; padding:0; }
.chip-input-row input { width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:6px; font-family:inherit; font-size:14px; background:var(--dd-surface-2); color:var(--text); }
.chip-suggestions { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.chip-suggest { background:transparent; border:1px dashed var(--border); color:var(--text-3); padding:3px 10px; border-radius:14px; font-size:12px; cursor:pointer; }
.chip-suggest:hover { background:var(--dd-surface-2); color:var(--text); border-style:solid; }

.profile-save-row { display:flex; align-items:center; gap:16px; padding-top:8px; }
.profile-saved { color:var(--accent); font-size:13px; }

/* ==================== Fase 2: Today tab ==================== */
/* today-tab/today-empty/today-header/today-ring/calorie-ring/today-numbers/today-macros legacy eliminados — código muerto. */
.macro-row { display:flex; flex-direction:column; gap:4px; }
/* macro-label/macro-bar/macro-hint legacy eliminados — código muerto (analyzer usa macro-head/macro-name/dd-bar). */

/* today-meals/meal-block/meal-item/meal-desc/meal-meta legacy eliminados — código muerto. */
.meal-empty { color:var(--dd-text-sub); font-size:13px; font-style:italic; margin:0; }
.meal-del { background:transparent; border:none; cursor:pointer; font-size:16px; padding:4px 8px; flex-shrink:0; }
.meal-del:hover { background:rgba(255,255,255,0.06); border-radius:6px; }

/* Modal compartido — variantes */
.btn-cancel { padding:14px; background:transparent; color:var(--dd-text); border:1px solid var(--dd-line); border-radius:8px; font-size:15px; font-weight:500; cursor:pointer; font-family:inherit; }
.btn-cancel:hover:not(:disabled) { background:rgba(255,255,255,0.06); }
.btn-cancel:disabled { opacity:0.5; cursor:not-allowed; }
.modal-actions { display:flex; gap:10px; margin-top:8px; }
.modal-actions > button { flex:1; }
.macro-grid { display:grid; grid-template-columns:repeat(2, 1fr); gap:10px; padding:8px; background:var(--dd-surface-2); border-radius:8px; }
.macro-grid .login-field { margin-bottom:0; }
.macro-grid .login-field span { font-size:12px; }
.link-btn { background:none; border:none; color:var(--accent); font-size:13px; text-decoration:underline; text-underline-offset:3px; padding:6px 0; cursor:pointer; font-family:inherit; text-align:left; }

/* Plan semanal — badge "evitar" */
.meal-row.has-warn .meal-titulo { color:var(--dd-amber); }
.meal-warn { display:inline-block; margin-left:8px; padding:2px 8px; background:var(--dd-warn-bg); color:var(--dd-amber); border:1px solid rgba(239,159,39,0.3); border-radius:10px; font-size:10px; font-weight:600; letter-spacing:0.06em; text-transform:uppercase; vertical-align:middle; }
.meal-warn-hint { margin-top:6px; padding:8px 10px; background:var(--dd-warn-bg); border:1px solid rgba(239,159,39,0.3); border-radius:6px; color:var(--dd-amber); font-size:12px; line-height:1.4; }

/* Photo analyzer — Agregar a hoy */
.add-to-today { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px; margin-top:14px; }
.add-to-today-row { display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; }
.add-to-today-row > .login-field { flex:1; min-width:160px; }
.add-to-today-row > .btn-primary { flex-shrink:0; padding:12px 20px; }
.add-to-today-success { color:var(--accent); font-size:14px; text-align:center; padding:12px; font-weight:500; }

/* Bloque Ejercicio legacy (today-exercise/exercise-*) eliminado — código muerto, ya no se renderiza. */

/* ==================== Fase 3: Progreso ==================== */
.progress-tab { display:flex; flex-direction:column; gap:18px; padding:8px 0 40px; position:relative; }
.progress-section { background:#fcfaf4; border:1px solid #e6e0cf; border-radius:12px; padding:18px; }
.progress-section h3 { margin:0 0 12px; font-family:Georgia,serif; font-size:18px; color:#2a2c20; font-weight:400; }

.progress-form { display:flex; flex-direction:column; gap:12px; }
.progress-field { display:flex; flex-direction:column; gap:6px; }
.progress-field span { font-size:13px; color:var(--dd-text-sub); font-weight:500; }
.progress-field input, .progress-field textarea { padding:10px 12px; border:1px solid var(--dd-line); border-radius:6px; font-size:14px; background:var(--dd-surface-2); color:var(--dd-text); font-family:inherit; resize:vertical; }
.progress-field input:focus, .progress-field textarea:focus { outline:none; border-color:var(--dd-teal); }
.plan-recalc-card p { margin:0 0 12px; color:var(--dd-text-sub); font-size:14px; line-height:1.5; }
.plan-recalc-card .login-submit { margin-top:0; width:100%; }
.plan-recalc-modal { max-width:620px; max-height:90vh; overflow-y:auto; }
.plan-recalc-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
@media (max-width:520px) { .plan-recalc-grid { grid-template-columns:1fr; } }
.personal-plan-banner { margin:0 0 14px; padding:10px 14px; background:var(--dd-good-bg); border:1px solid rgba(93,202,165,0.3); border-radius:10px; color:var(--dd-teal); font-size:13px; font-weight:500; }

.progress-cards { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; }
@media (min-width: 720px) { .progress-cards { grid-template-columns:repeat(4, minmax(0, 1fr)); } }
/* progress-card / weight-chart (SVG) / chart-empty / badge-profile legacy eliminados — código muerto. */

/* Lista de últimos pesajes */
.progress-list { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; }
.progress-list-item { display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--dd-line); flex-wrap:wrap; }
.progress-list-item:first-child { border-top:none; }
.progress-list-main { flex:1; display:flex; align-items:baseline; gap:10px; min-width:0; }
.progress-list-weight { font-family:Georgia,serif; font-size:18px; color:var(--dd-text); }
.progress-list-date { font-size:12px; color:var(--dd-text-sub); }
.progress-list-notes { width:100%; font-size:12px; color:var(--dd-text-sub); font-style:italic; padding-left:0; }

/* ==================== Food estimate: ManualMealModal + analyzer edición ==================== */

/* Botón "Estimar con IA" (modal manual). Variante visual del primary usando --accent-2. */
.btn-estimate {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: var(--accent-2);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin: 4px 0 2px;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.btn-estimate:hover:not(:disabled) { background: #b25826; }
.btn-estimate:disabled { opacity: 0.55; cursor: not-allowed; }

/* Warning amarillo (baja confianza) reutilizado por modal y analyzer */
.warning-low-confidence,
.confidence-warning {
  background: var(--dd-warn-bg);
  color: var(--dd-amber);
  border: 1px solid rgba(239,159,39,0.3);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 8px;
}

/* Hint informativo (ⓘ) — gris discreto */
.form-hint-info {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.45;
  margin-top: 8px;
}

/* Inputs en estado "estimado" — borde gris suave para indicar valor sugerido editable */
.input-estimated {
  border-color: rgba(239,159,39,0.5) !important;
  background: var(--dd-surface-2);
  color: var(--text);
}
.input-estimated:focus { border-color: var(--accent) !important; background: var(--surface); }

/* Lista editable de ingredientes en el analyzer */
.editable-foods .editable-food-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.editable-food-row input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--dd-surface-2);
  color: var(--text);
  min-width: 0;
}
.editable-food-row input[type="text"]:focus { outline: none; border-color: var(--accent); }
.editable-food-row input[type="text"]:first-of-type { flex: 2; }
.editable-food-row input[type="text"]:nth-of-type(2) { flex: 1; }

.btn-icon-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--dd-danger);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-icon-remove:hover { background: rgba(226,75,74,0.15); border-color: var(--dd-danger); }

.btn-add-food {
  width: 100%;
  margin-top: 6px;
}

.plato-name-card { padding: 16px 18px; }

/* Banner de recálculo */
.recompute-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--dd-warn-bg);
  border: 1px solid rgba(239,159,39,0.3);
  border-radius: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.recompute-msg {
  font-size: 13px;
  color: var(--dd-amber);
  flex: 1 1 200px;
  line-height: 1.4;
}

/* ==================== User events: Perfil + Banner del Plan ==================== */

/* Sección "Eventos especiales" en Perfil */
.events-section { margin-top: 4px; }
.events-subsection { margin-top: 10px; }
.events-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.event-card {
  background: var(--dd-surface);
  border: 1px solid var(--border, #e6e0cf);
  border-radius: 10px;
  padding: 12px 14px;
}
.event-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.event-icon { font-size: 18px; line-height: 1; }
.event-name {
  font-weight: 600;
  color: var(--text, #2a2c20);
  font-size: 14px;
}
.event-date {
  font-size: 12px;
  color: var(--text-3, #7a7468);
  margin-left: auto;
}
.event-meta {
  font-size: 12px;
  color: var(--text-2, #5a554c);
  line-height: 1.45;
}
.event-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Banner en Plan Semanal */
.events-banner {
  background: var(--dd-warn-bg);
  border: 1px solid rgba(239, 159, 39, 0.3);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.events-banner-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--dd-amber);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.events-banner-card {
  background: var(--dd-surface-2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(239, 159, 39, 0.3);
}
.events-banner-card:last-child { margin-bottom: 0; }

/* Sugerencias renderizadas (markdown) */
.suggestions-markdown {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--dd-surface-2);
  border: 1px solid var(--dd-line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text, #2a2c20);
}
.suggestions-markdown h3 {
  font-family: Georgia, serif;
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--text, #2a2c20);
  font-weight: 400;
}
.suggestions-markdown h4 {
  font-size: 13px;
  margin: 12px 0 4px;
  color: var(--dd-teal);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.suggestions-markdown p { margin: 4px 0; }
.suggestions-markdown ul { margin: 4px 0 8px 18px; padding: 0; }
.suggestions-markdown li { margin: 3px 0; }
.suggestions-markdown strong { color: var(--text, #2a2c20); }

/* ===== Fase 2.5 · Mounjaro tracker ===== */
.mounjaro-tab { display: flex; flex-direction: column; gap: 14px; padding: 0 4px; }

/* Selector de medicamento GLP-1 */
.mj-med-select {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mj-med-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
}
.mj-med-dropdown {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font-size: 15px;
  min-width: 190px;
}
.mj-med-meta { font-size: 13px; color: var(--text-3); }

.mj-phase-card {
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  text-align: center;
}
.mj-phase-label {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  letter-spacing: 0.005em;
  margin-bottom: 4px;
}
.mj-day-meta { color: var(--text-3); font-size: 13px; margin-bottom: 8px; }
.mj-current-dose { font-size: 15px; margin: 6px 0; }
.mj-advice { font-style: italic; color: var(--text-2); margin: 8px 0; font-size: 14px; }
.mj-cal-mod {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
}
/* Bordes por fase del ciclo */
.mj-phase-onset   { border-color: var(--dd-amber); }    /* ámbar — niveles subiendo */
.mj-phase-peak    { border-color: var(--dd-danger); }   /* rojo — pico Cmax */
.mj-phase-plateau { border-color: var(--accent); }      /* verde — meseta */
.mj-phase-trough  { border-color: var(--dd-violet-2); } /* azul — víspera */

.mj-interactions-banner {
  background: var(--dd-warn-bg);
  border-left: 4px solid var(--dd-amber);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.mj-banner-title { font-weight: 600; margin-bottom: 6px; }
.mj-interactions-banner ul { margin: 0; padding-left: 18px; }
.mj-interactions-banner li { margin: 2px 0; }

.mj-medical-disclaimer {
  background: var(--dd-warn-bg);
  border-left: 4px solid var(--dd-danger);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.mj-medical-disclaimer .mj-banner-title { color: var(--dd-danger); }

.mj-next-dose {
  background: var(--dd-good-bg);
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mj-doctor-alert {
  background: rgba(255,138,92,0.12);
  border-left: 4px solid var(--accent-2);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.mj-actions-row { display: flex; justify-content: center; margin: 4px 0; }

.mj-btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--bg);
  padding: 12px 22px; border-radius: 10px;
  font-size: 15px; font-weight: 500;
  transition: transform 0.15s ease, background 0.2s ease;
  box-shadow: 0 1px 2px rgba(44,42,38,0.08);
}
.mj-btn-primary:active { transform: scale(0.98); }
.mj-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.mj-btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
  padding: 11px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
}
.mj-btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.mj-meal-suggester {
  margin-top: 4px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}
.mj-meal-suggester h3 {
  margin: 0 0 10px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
}
.mj-meal-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.mj-meal-buttons button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
.mj-meal-buttons button:disabled { opacity: 0.5; cursor: not-allowed; }
.mj-meal-card {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.mj-meal-card h4 { margin: 0 0 6px; font-size: 15px; color: var(--accent); }
.mj-meal-card p { margin: 0 0 8px; font-size: 14px; color: var(--text-2); }
.mj-meal-card details summary {
  cursor: pointer; font-size: 13px; color: var(--text-3);
  padding: 4px 0;
}
.mj-ingredients { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.mj-portions { margin: 8px 0; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.mj-macros { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.mj-meal-notes {
  margin-top: 8px; padding: 6px 10px;
  background: rgba(196,98,45,0.08);
  border-radius: 6px; font-size: 12px; color: var(--text-2);
}
.mj-loading { font-size: 13px; color: var(--text-3); margin-top: 10px; }

.mj-history {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}
.mj-history h3 {
  margin: 0 0 8px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
}
.mj-history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mj-history-table th, .mj-history-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.mj-history-table th {
  font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px;
}

.mj-empty {
  padding: 32px 16px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}
.mj-empty p { margin: 6px 0; color: var(--text-2); }
.mj-empty-hint { color: var(--text-4); font-size: 13px; }

.mj-error {
  background: rgba(226,75,74,0.12);
  border-left: 3px solid var(--accent-2);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}

/* Modal de registrar inyección */
.mj-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
}
.mj-modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 22px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}
.mj-modal h3 {
  margin: 0 0 16px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
}
.mj-modal label {
  display: flex; flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-2);
}
.mj-modal label input,
.mj-modal label select,
.mj-modal label textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.mj-modal label textarea { resize: vertical; min-height: 44px; }
.mj-modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 8px;
}
.mj-modal-actions > button { flex: 1; }

/* Banner recordatorio viernes víspera (fallback in-app) */
.mj-reminder-banner {
  background: var(--dd-good-bg);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 12px;
  text-align: center;
}

/* ==================== Fase 3.5: Garmin ==================== */
/* Badges en el header de "Ejercicio de hoy" */
.garmin-badge { display:inline-block; margin-left:8px; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:500; letter-spacing:0.02em; text-transform:none; vertical-align:middle; }
.garmin-badge-on { background:var(--dd-good-bg); color:var(--dd-teal); }
.garmin-badge-stale { background:var(--dd-surface-2); color:var(--dd-text-sub); }

/* Ejercicio manual ignorado cuando Garmin manda */
.exercise-garmin-ignored { margin:10px 0 0; font-size:12px; color:#a86f1c; line-height:1.4; }
.exercise-list-ignored { opacity:0.45; }
.exercise-total-src { color:#3a5d2a; font-weight:500; }

/* Tarjeta de peso Garmin en Progreso */
.garmin-weight-card { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; background:var(--dd-good-bg); border:1px solid rgba(93,202,165,0.3); border-radius:12px; padding:14px 16px; margin-bottom:14px; }
.garmin-weight-info { display:flex; flex-direction:column; gap:2px; min-width:0; }
.garmin-weight-label { font-size:12px; color:var(--dd-teal); text-transform:uppercase; letter-spacing:0.05em; }
.garmin-weight-value { font-family:Georgia,serif; font-size:22px; color:var(--dd-text); line-height:1.1; }
.garmin-weight-card .login-submit { flex:0 0 auto; width:auto; padding:10px 16px; }

/* ==================== Fase 3.6-A: Composición corporal (bc-) ==================== */
.bc-section { }
.bc-compare { display:flex; flex-direction:column; gap:0; }
.bc-row { display:grid; grid-template-columns:1.3fr 1fr 1fr 0.9fr; align-items:center; gap:8px; padding:9px 0; border-top:1px solid var(--dd-line); }
.bc-row:first-child { border-top:none; }
.bc-row-head { border-top:none; padding-bottom:4px; }
.bc-row-head .bc-val, .bc-row-head .bc-delta-col { font-size:11px; color:var(--dd-text-sub); text-transform:uppercase; letter-spacing:0.03em; }
.bc-metric { font-size:14px; color:var(--dd-text); }
.bc-val { font-size:14px; color:var(--dd-text); text-align:right; font-variant-numeric:tabular-nums; }
.bc-delta-col { text-align:right; }
.bc-delta { font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }
.bc-good { color:var(--dd-teal); }
.bc-warn { color:var(--dd-danger); }
.bc-caution { color:var(--dd-amber); }
.bc-delta-none, .bc-delta-flat { color:var(--dd-text-dim); font-weight:400; }
.bc-caveat { margin:10px 0 0; font-size:11px; color:var(--dd-text-sub); line-height:1.45; }

/* ==================== Fase 3.7: Bienestar Garmin ==================== */
:root { --wellness-good:#2e7d32; --wellness-warn:#f9a825; --wellness-bad:#c62828; }
.wellness-tab { display:flex; flex-direction:column; gap:14px; }
.wellness-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.wellness-head h2 { margin:3px 0 0; font-size:32px; font-weight:800; color:var(--dd-text); letter-spacing:0; }
.wellness-head .garmin-badge { margin:4px 0 0; white-space:nowrap; }
.wellness-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.wellness-card { background:var(--dd-surface); border:1px solid var(--dd-line); border-radius:24px; box-shadow:none; padding:20px; }
.wellness-card-wide { grid-column:1 / -1; }
.wellness-card h3 { margin:0 0 16px; color:var(--dd-text-sub); font-size:12px; font-weight:700; letter-spacing:0.1em; text-transform:uppercase; }
.wellness-card p { margin:7px 0 0; color:var(--dd-text-sub); font-size:12px; line-height:1.4; }
.wellness-rings { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px 8px; }
.wellness-ring-metric { display:flex; flex-direction:column; align-items:center; text-align:center; min-width:0; }
.wellness-ring-wrap { position:relative; width:120px; height:120px; }
.wellness-ring-center { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
.wellness-ring-num { font-size:1.9rem; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; }
.wellness-ring-pct { font-size:.85rem; font-weight:700; margin-left:1px; }
.wellness-ring-label { color:var(--dd-text); font-size:.95rem; font-weight:600; margin-top:10px; }
.wellness-ring-band { font-size:.84rem; font-weight:700; margin-top:2px; }
.wellness-ring-ten { color:var(--dd-text-dim); font-size:.72rem; margin-top:1px; }
.wellness-ring-progress { transition:stroke-dashoffset 1.1s cubic-bezier(.22,1,.36,1); }
.wellness-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
/* wellness-detail-metric / wellness-metric / wm-* legacy eliminados — código muerto. */
.wellness-info-section { padding:0; background:transparent; box-shadow:none; }
.info-tiles-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
/* info-tile / it-* legacy eliminados — código muerto (InfoTile usa dd-card/dd-stat). */
.wellness-alerts { padding:12px 14px; background:var(--dd-warn-bg); border:1px solid rgba(239,159,39,0.3); border-radius:10px; }
.wellness-alerts h3 { margin:0 0 5px; color:var(--dd-amber); font-size:14px; }
.wellness-alerts p { margin:3px 0; color:var(--dd-text); font-size:13px; }
.wellness-alerts small { display:block; margin-top:7px; color:var(--dd-text-dim); font-size:11px; line-height:1.4; }
.wellness-empty { padding:28px 18px; text-align:center; background:var(--dd-surface); border:1px solid var(--dd-line); border-radius:12px; }
.wellness-empty h3 { margin:0 0 6px; color:var(--dd-text); }
.wellness-empty p, .wellness-foot { margin:0; color:var(--dd-text-sub); font-size:12px; line-height:1.5; }
@media (max-width:520px) {
  .wellness-grid { grid-template-columns:1fr; }
  .wellness-card-wide { grid-column:auto; }
  .wellness-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .wellness-ring-progress { transition:none; }
}
