@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Estética tipo Fitia, acento AZUL */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f9;   /* relleno de tarjetas "stat" (gris muy claro) */
  --surface-3: #eaeef3;   /* hover gris */
  --ink: #0f1729;         /* casi negro para titulares */
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e8ecf2;        /* hairlines y pista del donut */

  --brand: #2563eb;       /* AZUL primario */
  --brand-ink: #1d4ed8;   /* azul hover */
  --brand-soft: #e8f0ff;  /* azul claro (activo, día seleccionado) */

  --kcal: #2563eb;        /* calorías = azul (métrica principal) */
  --prot: #ec4899;        /* proteínas = rosa */
  --carb: #f59e0b;        /* carbohidratos = ámbar */
  --fat:  #10b981;        /* grasas = verde */
  --danger: #ef4444;

  --radius: 22px;         /* Fitia usa esquinas muy redondeadas */
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.04), 0 14px 34px rgba(15, 23, 41, 0.07);
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.04), 0 4px 14px rgba(15, 23, 41, 0.04);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: var(--font-body);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; font-size: 0.95rem; color: var(--ink); }
::placeholder { color: var(--faint); }

/* ---------- Layout ---------- */
.container { max-width: 980px; margin: 0 auto; padding: 0 20px; }
main.app { padding: 30px 0 90px; }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topnav-inner { display: flex; align-items: center; gap: 18px; height: 66px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
  letter-spacing: -0.03em; text-decoration: none;
}
.brand-dot {
  width: 20px; height: 20px; border-radius: 7px;
  background: var(--brand);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}
.nav-links { display: flex; gap: 6px; margin: 0 auto; }
.nav-link {
  padding: 9px 16px; border-radius: 999px;
  color: var(--muted); font-size: 0.95rem; font-weight: 600;
  transition: background 0.15s, color 0.15s; text-decoration: none;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { font-size: 0.9rem; color: var(--muted); }
.nav-user strong { color: var(--ink); font-weight: 700; }

/* user menu */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  background: var(--surface-2); transition: background 0.15s;
}
.user-menu-btn:hover { background: var(--surface-3); }
.user-menu-btn .avatar { width: 30px; height: 30px; }
.user-menu-btn .um-name { font-size: 0.92rem; font-weight: 700; color: var(--ink); }
.user-menu-btn .um-caret { color: var(--faint); display: flex; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 220px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow); padding: 8px; z-index: 30;
  animation: pop 0.14s ease;
}
.dropdown-head { display: flex; align-items: center; gap: 11px; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown-head .avatar { width: 42px; height: 42px; }
.dropdown-head .dh-name { font-weight: 700; font-size: 0.95rem; }
.dropdown-head .dh-mail { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.dropdown-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 10px 11px; border-radius: 10px; font-size: 0.92rem;
  font-weight: 500; color: var(--ink); text-align: left; text-decoration: none;
  transition: background 0.12s;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fdecec; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--surface-2); display: block; flex: 0 0 auto; }
.thumb { border-radius: 12px; object-fit: cover; background: var(--surface-2); display: block; flex: 0 0 auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 700; white-space: nowrap;
  transition: transform 0.05s, background 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25); }
.btn-primary:hover { background: var(--brand-ink); }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: #fdecec; }
.btn-sm { padding: 8px 13px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* ---------- Donuts (tarjetas planas gris claro estilo Fitia) ---------- */
.donuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.donut-card { background: var(--surface-2); border-radius: var(--radius); padding: 22px 16px 18px; text-align: center; }
.donut-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.01em; color: var(--muted); margin-bottom: 12px; }
.donut-wrap { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.donut-wrap svg { transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.donut-unit { font-size: 0.72rem; color: var(--faint); margin-top: 3px; font-weight: 600; }
.donut-goal { margin-top: 12px; font-size: 0.82rem; color: var(--muted); }
.donut-goal b { color: var(--ink); font-weight: 700; }

/* ---------- Week calendar ---------- */
.week { display: flex; align-items: stretch; gap: 10px; margin-bottom: 26px; }
.week-arrow {
  flex: 0 0 auto; width: 44px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.week-arrow:hover { background: var(--surface-3); color: var(--ink); }
.week-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-box {
  background: var(--surface-2); border: 2px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 4px; text-align: center; transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.day-box:hover { background: var(--surface-3); }
.day-box:active { transform: translateY(1px); }
.day-dow { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); font-weight: 600; }
.day-num { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; margin-top: 2px; letter-spacing: -0.02em; }
.day-box.selected { background: var(--brand-soft); border-color: var(--brand); }
.day-box.selected .day-dow { color: var(--brand-ink); }
.day-box.today .day-num { color: var(--brand-ink); }
.day-box.today::after { content: ''; display: block; width: 5px; height: 5px; margin: 4px auto 0; border-radius: 50%; background: var(--brand); }

/* ---------- Meals ---------- */
.day-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.day-heading h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; }
.day-heading .sub { color: var(--muted); font-size: 0.9rem; font-weight: 500; }

.meal { margin-bottom: 14px; overflow: hidden; }
.meal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; cursor: pointer; }
.meal-title { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 1.02rem; }
.meal-kcal { font-family: var(--font-display); font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.meal-kcal b { color: var(--ink); font-weight: 800; }
.meal-body { border-top: 1px solid var(--line); padding: 4px 20px 16px; }
.entry { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: none; }
.entry-thumb { width: 48px; height: 48px; }
.entry-main { flex: 1; min-width: 0; }
.entry-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-marca { font-size: 0.82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-right { text-align: right; flex: 0 0 auto; }
.entry-macros { display: flex; gap: 10px; justify-content: flex-end; font-size: 0.78rem; color: var(--faint); }
.entry-macros span b { color: var(--muted); font-weight: 700; }
.entry-qty { font-size: 0.82rem; color: var(--muted); margin-top: 3px; }
.entry-qty b { font-family: var(--font-display); color: var(--ink); font-weight: 800; }
.entry-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.icon-btn { width: 32px; height: 32px; border-radius: 9px; color: var(--faint); display: inline-flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: #fdecec; color: var(--danger); }

/* Marcador de favorito en filas (Alimentos, Recetas, Diario) */
.fav-toggle { border: 1px solid transparent; }
.fav-toggle svg { width: 17px; height: 17px; }
.fav-toggle.activo { color: var(--brand-ink); border-color: var(--brand); background: var(--brand-soft); }
.fav-toggle.activo:hover { background: var(--brand-soft); color: var(--brand-ink); }
.meal-empty { color: var(--faint); font-size: 0.88rem; padding: 10px 0; }
.meal-add { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; color: var(--brand-ink); font-weight: 700; font-size: 0.9rem; padding: 6px 0; }
.meal-add:hover { text-decoration: underline; }
.meal-add-wrap { margin-top: 10px; }
.meal-add-btn { }

/* Selector Alimento / Receta */
.tipo-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tipo-choice {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 12px; border-radius: var(--radius-md);
  background: var(--surface-2); transition: background 0.15s, transform 0.05s;
}
.tipo-choice:hover { background: var(--brand-soft); }
.tipo-choice:active { transform: translateY(1px); }
.tipo-choice .thumb { width: 64px; height: 64px; }
.tipo-choice .tipo-label { font-weight: 700; font-size: 1rem; }

/* Editor de ingredientes de una receta */
.ing-list { margin-top: 10px; display: flex; flex-direction: column; }
.ing-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ing-row:last-child { border-bottom: none; }
.ing-name { flex: 1 1 auto; min-width: 60px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Especificidad extra: si no, `.field input { width:100% }` machaca el ancho */
.ing-row input.ing-gramos { width: 74px; flex: 0 0 auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; text-align: right; }
.ing-row input.ing-gramos:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ing-g { color: var(--muted); font-size: 0.85rem; }
.ing-kcal { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; color: var(--muted); min-width: 70px; text-align: right; }
.ing-totales { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--muted); }
.ing-totales b { color: var(--ink); font-family: var(--font-display); }

/* Editor de pasos */
.pasos-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.paso-row { display: flex; align-items: center; gap: 10px; }
.paso-num { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.paso-row input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.paso-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* Detalle (solo lectura) de alimento / receta */
.detalle-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.detalle-img { width: 76px; height: 76px; }
.detalle-titulo { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; line-height: 1.15; }
.detalle-sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.detalle-nota { font-size: 0.75rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; margin: 16px 0 8px; }
.detalle-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.detalle-stat { text-align: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: 13px 6px; }
.detalle-stat-v { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.detalle-stat-l { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.detalle-seccion { font-weight: 800; font-size: 0.95rem; margin: 20px 0 8px; }
.detalle-autor { display: flex; align-items: center; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.detalle-autor-img { width: 28px; height: 28px; }
.detalle-autor-txt { font-size: 0.86rem; color: var(--muted); }
.detalle-autor-txt b { color: var(--ink); font-weight: 700; }

/* Botón "Guardar en favoritos" (marcador, estilo guardar de Instagram) */
.btn-fav {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 14px; padding: 11px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-size: 0.92rem; font-weight: 700;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-fav:hover { background: var(--surface-2); }
.btn-fav svg { flex: 0 0 auto; }
.btn-fav.activo { color: var(--brand-ink); border-color: var(--brand); background: var(--brand-soft); }
.btn-fav:disabled { opacity: 0.6; cursor: default; }
.detalle-ings { display: flex; flex-direction: column; }
.detalle-ing { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.detalle-ing:last-child { border-bottom: none; }
.detalle-ing-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detalle-ing-g { color: var(--muted); font-size: 0.85rem; }
.detalle-ing-g b { font-family: var(--font-display); color: var(--ink); }
.detalle-ing-kcal { font-family: var(--font-display); color: var(--muted); font-size: 0.82rem; min-width: 62px; text-align: right; }
.detalle-pasos { display: flex; flex-direction: column; gap: 10px; }
.detalle-paso { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; }
.detalle-paso .paso-num { flex: 0 0 auto; margin-top: 1px; }

.macro-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-kcal { background: var(--kcal); }
.dot-prot { background: var(--prot); }
.dot-carb { background: var(--carb); }
.dot-fat { background: var(--fat); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 41, 0.34); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; animation: fade 0.15s ease; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: 0 24px 70px rgba(15, 23, 41, 0.28); width: 100%; max-width: 470px; max-height: 90vh; overflow: auto; animation: pop 0.16s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px 22px; display: flex; gap: 10px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Forms ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 0.78rem; color: var(--faint); margin-top: 6px; }

.preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; padding: 16px; background: var(--surface-2); border-radius: var(--radius-sm); }
.preview .cell { text-align: center; }
.preview .cell .v { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; }
.preview .cell .l { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; font-weight: 600; }

.search-wrap { position: relative; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 230px; overflow: auto; z-index: 5; }
.search-item { padding: 11px 13px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--surface-2); }
.search-item .n { font-weight: 600; }
.search-item .m { font-size: 0.8rem; color: var(--muted); }

/* image picker */
.img-picker { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.img-picker .preview-img { width: 66px; height: 66px; }
.img-picker.avatar-picker .preview-img { border-radius: 50%; }
.img-picker-actions { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Alimentos page ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search-box { flex: 1; min-width: 180px; }
.toolbar .search-box input { width: 100%; padding: 12px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.toolbar .search-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 0.9rem; color: var(--muted); font-weight: 500; user-select: none; cursor: pointer; }
.checkbox input { accent-color: var(--brand); }

.food-list { display: flex; flex-direction: column; }
.food-row { display: flex; align-items: center; gap: 15px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.food-row:last-child { border-bottom: none; }
.food-thumb { width: 50px; height: 50px; }
.food-info { flex: 1; min-width: 0; }
.food-name { font-weight: 700; }
.food-tags { font-size: 0.82rem; color: var(--muted); }
.food-by { font-size: 0.75rem; color: var(--faint); margin-top: 2px; }
.food-macros { display: flex; gap: 16px; font-size: 0.82rem; color: var(--muted); text-align: right; }
.food-macros .mm { font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.food-actions { display: flex; gap: 2px; }
.clicable { cursor: pointer; }
.food-info.clicable:hover .food-name { color: var(--brand-ink); }
.entry-main.clicable:hover .entry-name { color: var(--brand-ink); }

/* Drag & drop de entradas entre comidas (escritorio) */
.entry[draggable="true"] { cursor: grab; }
.entry.dragging { opacity: 0.45; cursor: grabbing; }
.meal.meal-drop { outline: 2px dashed var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.meal.meal-drop .meal-body { pointer-events: none; }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: none; color: var(--faint); }

/* Distintivos */
.badge-admin, .badge-tu, .badge-usada, .badge-pendiente {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  border-radius: 999px; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase; vertical-align: middle;
}
.badge-admin { background: var(--brand-soft); color: var(--brand-ink); }
.badge-tu { background: var(--surface-3); color: var(--muted); }
.badge-usada { background: #eaf7ef; color: #0f7a3d; }
.badge-pendiente { background: #fff7e6; color: #93600b; }

/* Códigos de invitación */
.codigo-inv {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem; letter-spacing: 0.06em; font-weight: 700;
  background: var(--surface-2); padding: 3px 9px; border-radius: 8px;
}
.codigo-caja {
  margin-top: 16px; padding: 18px; text-align: center;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.codigo-caja-l { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px; }
.codigo-caja-v {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--brand-ink); margin-bottom: 12px;
}

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; color: var(--muted); font-size: 0.9rem; font-weight: 500; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 24px;
  background:
    radial-gradient(1100px 520px at 8% -12%, #e8f0ff 0%, transparent 55%),
    radial-gradient(900px 520px at 112% 112%, #eaf1ff 0%, transparent 55%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 410px; margin: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 34px 30px; }
.auth-brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; letter-spacing: -0.03em; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 0.94rem; margin-bottom: 24px; }
.auth-card-ancha { max-width: 480px; }
.form-seccion {
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--faint); margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.form-seccion:first-of-type { margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--muted); }
.auth-switch a { color: var(--brand-ink); font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ---------- Profile ---------- */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.summary-item { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); }
.summary-item:last-child { border-bottom: none; }
.summary-item .k { color: var(--muted); }
.summary-item .v { font-family: var(--font-display); font-weight: 800; }
.summary-big { text-align: center; padding: 20px 0 12px; }
.summary-big .v { font-family: var(--font-display); font-size: 2.6rem; font-weight: 900; line-height: 1; letter-spacing: -0.03em; color: var(--brand); }
.summary-big .l { color: var(--muted); font-size: 0.9rem; margin-top: 7px; font-weight: 500; }
.card-pad { padding: 22px; }
.card-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; margin-bottom: 18px; }

/* ---------- Misc ---------- */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 15px; }
.alert-error { background: #fdecec; color: #b42318; }
.alert-info { background: var(--brand-soft); color: var(--brand-ink); }
.alert-aviso { background: #fff7e6; color: #93600b; border: 1px solid #fbe3b3; }

/* Zona de acciones destructivas (baja de cuenta) */
.zona-peligro { margin-top: 18px; border-color: #f6cfcf; }
.zona-peligro .card-title { color: var(--danger); }
.zona-peligro-txt { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; }
.btn-peligro { background: var(--danger); color: #fff; box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25); }
.btn-peligro:hover { background: #d93636; }
.lista-baja { margin: 10px 0 16px; padding-left: 20px; color: var(--muted); font-size: 0.92rem; }
.lista-baja li { margin-bottom: 6px; }
.empty-state { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty-state .big { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; color: var(--ink); margin-bottom: 6px; }

.toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 0.88rem; font-weight: 600; box-shadow: 0 10px 28px rgba(15, 23, 41, 0.3); animation: pop 0.16s ease; }
.toast.error { background: var(--danger); }

.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 44px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .donuts { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .day-num { font-size: 1.1rem; }
  .food-macros { display: none; }
  .user-menu-btn .um-name { display: none; }
  .page-head h1 { font-size: 1.6rem; }
}
@media (max-width: 480px) {
  .entry-macros { display: none; }
}

/* ============================================================
   Landing pública (one-page)
   ============================================================ */
.btn-lg { padding: 15px 28px; font-size: 1.02rem; border-radius: 14px; }

.landing { background: var(--bg); color: var(--ink); }
.lp-container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Header */
.lp-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.lp-header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.lp-header .brand { font-size: 1.25rem; text-decoration: none; }

/* Hero */
.lp-hero {
  padding: 88px 0 72px;
  background:
    radial-gradient(1100px 520px at 15% -10%, #e8f0ff 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 0%, #eef4ff 0%, transparent 55%),
    var(--bg);
}
.lp-hero-inner { max-width: 1080px; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: stretch; }
.lp-hero-text { min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.lp-hero-media { display: flex; align-items: center; justify-content: center; min-height: 0; }
.lp-hero-img {
  /* Imagen libre (sin marco): se muestra completa y se ajusta a la altura del texto */
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lp-hero-img-ph { border-radius: 24px; }
.lp-badge {
  display: inline-block; align-self: flex-start; padding: 6px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-ink);
  font-size: 0.82rem; font-weight: 700; margin-bottom: 22px;
}
.lp-title {
  font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; margin-bottom: 20px;
}
.lp-sub { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); line-height: 1.6; max-width: 620px; }
.lp-cta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 34px; }
.lp-cta-note { color: var(--faint); font-size: 0.9rem; }

/* Secciones */
.lp-section { padding: 72px 0; }
.lp-section-alt { background: var(--surface-2); }
.lp-h2 {
  font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800; letter-spacing: -0.02em; text-align: center; margin-bottom: 44px;
}

/* Features */
.lp-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.lp-feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px; box-shadow: var(--shadow-sm);
}
.lp-feature-ic {
  width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-ink); margin-bottom: 16px;
}
.lp-feature-ic svg { width: 24px; height: 24px; }
.lp-feature h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 8px; }
.lp-feature p { color: var(--muted); font-size: 0.92rem; line-height: 1.55; }

/* Pasos */
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.lp-step { display: flex; gap: 16px; align-items: flex-start; }
.lp-step-n {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff; font-family: var(--font-display);
  font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; justify-content: center;
}
.lp-step h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }
.lp-step p { color: var(--muted); font-size: 0.92rem; line-height: 1.55; }

/* Bloque invitación */
.lp-invite {
  display: flex; gap: 18px; align-items: flex-start; margin-top: 48px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm);
}
.lp-invite-ic {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
}
.lp-invite h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }
.lp-invite p { color: var(--muted); font-size: 0.92rem; line-height: 1.6; }

/* Footer */
.lp-footer { border-top: 1px solid var(--line); padding: 32px 0; }
.lp-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lp-footer .brand { text-decoration: none; }
.lp-footer-txt { color: var(--faint); font-size: 0.9rem; }

/* Responsive */
@media (max-width: 900px) {
  .lp-features { grid-template-columns: repeat(2, 1fr); }
  .lp-steps { grid-template-columns: 1fr; }
  .lp-hero-inner { grid-template-columns: 1fr; gap: 32px; text-align: center; align-items: center; }
  .lp-hero-text { justify-content: flex-start; }
  .lp-cta { justify-content: center; }
  .lp-hero-media { order: 1; }
  .lp-hero-img { max-height: 420px; max-width: 340px; }
  .lp-badge { align-self: center; }
}
@media (max-width: 560px) {
  .lp-hero { padding: 56px 0 48px; }
  .lp-section { padding: 52px 0; }
  .lp-features { grid-template-columns: 1fr; }
  .lp-invite { flex-direction: column; }
}

/* Detalle de invitación (modal) */
.inv-det { display: flex; flex-direction: column; gap: 2px; }
.inv-det-fila { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.inv-det-fila:last-child { border-bottom: none; }
.inv-det-fila > span:first-child { color: var(--muted); font-size: 0.9rem; }
.inv-det-pend { color: var(--faint); font-size: 0.9rem; }

/* Crédito del footer de la landing */
.lp-footer-credito { color: var(--faint); font-size: 0.9rem; }
.lp-footer-credito a { color: var(--brand-ink); font-weight: 700; text-decoration: none; }
.lp-footer-credito a:hover { text-decoration: underline; }

/* Sección de contacto de la landing */
.lp-contacto-inner { max-width: 620px; margin: 0 auto; }
.lp-contacto-sub { text-align: center; color: var(--muted); margin: -28px 0 32px; }
.lp-form { display: flex; flex-direction: column; gap: 16px; }
.lp-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lp-form .field label { display: block; margin-bottom: 6px; font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.lp-form input, .lp-form textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.95rem;
}
.lp-form input:focus, .lp-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.lp-form textarea { resize: vertical; min-height: 120px; }
/* Honeypot: invisible para humanos, presente para bots */
.lp-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lp-form-aviso { display: none; padding: 11px 14px; border-radius: 12px; font-size: 0.92rem; }
.lp-form-aviso.ok { display: block; background: #e9f9ef; color: #1b7a43; border: 1px solid #b8e6c8; }
.lp-form-aviso.error { display: block; background: #fdecec; color: var(--danger); border: 1px solid #f6cccc; }

@media (max-width: 560px) {
  .lp-form-row { grid-template-columns: 1fr; }
}
