/* ==========================================================================
   Fijate Tools - Planificador de cena de Navidad, raciones y cronograma de horno
   Tema oscuro por defecto en :root / [data-theme="dark"] y claro en [data-theme="light"]
   ========================================================================== */

:root,
[data-theme="dark"] {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-page: #090d16;
  --bg-card: #111827;
  --bg-card-subtle: #182235;
  --bg-input: #0f172a;
  --border-color: #273549;
  --border-focus: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-color: #f59e0b;
  --primary-light: rgba(245, 158, 11, 0.14);
  --primary-border: rgba(245, 158, 11, 0.38);
  --primary-ink: #0f172a;

  --accent-emerald: #10b981;
  --accent-emerald-bg: rgba(16, 185, 129, 0.14);
  --accent-emerald-text: #6ee7b7;

  --accent-crimson: #ef4444;
  --accent-crimson-bg: rgba(239, 68, 68, 0.14);
  --accent-crimson-text: #fca5a5;

  --accent-sky: #38bdf8;
  --accent-sky-bg: rgba(56, 189, 248, 0.14);
  --accent-sky-text: #7dd3fc;

  --accent-whatsapp: #25d366;
  --accent-whatsapp-hover: #1fb858;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.38);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-page: #f4f6f9;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #b45309;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary: #b45309;
  --primary-hover: #92400e;
  --primary-color: #b45309;
  --primary-light: #fef3c7;
  --primary-border: #fcd34d;
  --primary-ink: #ffffff;

  --accent-emerald: #059669;
  --accent-emerald-bg: #ecfdf5;
  --accent-emerald-text: #065f46;

  --accent-crimson: #dc2626;
  --accent-crimson-bg: #fef2f2;
  --accent-crimson-text: #991b1b;

  --accent-sky: #0284c7;
  --accent-sky-bg: #e0f2fe;
  --accent-sky-text: #0369a1;

  --accent-whatsapp: #16a34a;
  --accent-whatsapp-hover: #15803d;

  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;

  --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  color-scheme: light;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title {
  font-family: var(--font-heading);
}

.mono,
code {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Layout principal canónico
   ========================================================================== */
.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

/* ==========================================================================
   Hero intro y presets rápidos
   ========================================================================== */
.hero-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.5vw, 1.65rem);
  box-shadow: var(--shadow-card);
}

.hero-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}

.hero-title {
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.hero-desc {
  font-size: 0.94rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  max-width: 860px;
}

.presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.presets-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.btn-preset {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

.btn-preset:hover,
.btn-preset.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* ==========================================================================
   Tarjeta principal de trabajo
   ========================================================================== */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: clamp(1rem, 2.5vw, 1.75rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.section-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.section-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Selector de fecha festiva */
.events-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.event-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
  border-color: var(--primary-border);
}

.event-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.event-card-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.event-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.event-title {
  font-family: var(--font-heading);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
}

.event-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.event-note-banner {
  margin-top: 0.7rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.event-note-banner svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* Parámetros de comensales y servicio */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
}

.label-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.stepper-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
  min-height: 42px;
}

.btn-stepper {
  width: 42px;
  min-width: 42px;
  min-height: 40px;
  border: none;
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-stepper:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.stepper-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  border: none;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 700;
  text-align: center;
  padding: 0.4rem 0.35rem;
  outline: none;
}

.stepper-input:focus {
  background: var(--primary-light);
}

.field-control,
.field-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.field-control:focus,
.field-select:focus {
  border-color: var(--border-focus);
}

.field-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.field-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.time-input {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Ajuste manual del peso del asado */
.main-dish-weight-bar {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1.5fr 1fr auto;
  gap: 0.85rem;
  align-items: center;
}

.dish-meta-info strong {
  display: block;
  font-size: 0.94rem;
  color: var(--text-main);
}

.dish-meta-info span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.weight-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.weight-input-wrap label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.weight-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 72px;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

.btn-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.btn-subtle:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* Selección modular de platos y bodega */
.menu-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.module-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.module-box-title {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.module-box-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.chips-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.16s ease;
}

.check-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.check-chip.checked {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--text-main);
}

.check-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
}

.check-chip.checked .check-chip-dot {
  background: var(--primary);
}

/* ==========================================================================
   KPIs Resumen en vivo
   ========================================================================== */
.kpi-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.kpi-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-card.kpi-highlight {
  border-color: var(--primary-border);
  background: var(--primary-light);
}

.kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-card.kpi-highlight .kpi-value {
  color: var(--primary);
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Pestañas de resultados: Lista de la compra vs Cronograma inverso
   ========================================================================== */
.results-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.results-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Barra de acciones de exportación */
.actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-whatsapp);
  background: var(--accent-whatsapp);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.btn-whatsapp:hover {
  background: var(--accent-whatsapp-hover);
  border-color: var(--accent-whatsapp-hover);
}

/* Grupos de lista de la compra */
.shopping-groups-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.shopping-group-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.shopping-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.shopping-group-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.shopping-group-subtotal {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.shopping-list-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.shopping-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid transparent;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.shopping-item.is-checked {
  opacity: 0.55;
  text-decoration: line-through;
}

.shopping-item-check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
}

.shopping-item-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.shopping-item-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.shopping-item-detail {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.12rem;
}

.shopping-item-qty {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

.shopping-item-price {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Barra de escote y gama de precios */
.split-bill-bar {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.split-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}

.split-toggle-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* ==========================================================================
   Cronograma inverso de cocina y horno
   ========================================================================== */
.timeline-header-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.timeline-header-meta strong {
  display: block;
  font-size: 0.96rem;
  color: var(--text-main);
}

.timeline-header-meta span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.timeline-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-step {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.timeline-step[data-phase="cold"] {
  border-left-color: var(--accent-sky);
}

.timeline-step[data-phase="oven"] {
  border-left-color: var(--accent-crimson);
}

.timeline-step[data-phase="plating"] {
  border-left-color: var(--primary);
}

.timeline-step[data-phase="table"] {
  border-left-color: var(--accent-emerald);
  background: var(--accent-emerald-bg);
}

.timeline-step.is-done {
  opacity: 0.52;
}

.timeline-time-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.timeline-clock {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
}

.timeline-rel {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.timeline-body {
  min-width: 0;
}

.timeline-phase-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.phase-pill {
  display: inline-block;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
}

.timeline-step[data-phase="cold"] .phase-pill {
  background: var(--accent-sky-bg);
  color: var(--accent-sky-text);
}

.timeline-step[data-phase="oven"] .phase-pill {
  background: var(--accent-crimson-bg);
  color: var(--accent-crimson-text);
}

.timeline-step[data-phase="table"] .phase-pill {
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald-text);
}

.phase-badge-detail {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.timeline-step-title {
  font-family: var(--font-heading);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.timeline-step-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.48;
}

.timeline-check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
}

.timeline-check {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

/* ==========================================================================
   Modales accesibles (sin window.alert) y Toast
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.05rem;
  color: var(--text-main);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  padding: 1.15rem 1.25rem;
  overflow-y: auto;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pre-whatsapp-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-main);
  font-size: 0.86rem;
  line-height: 1.5;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  color: var(--text-main);
  max-height: 48vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

.toast-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(18px);
  z-index: 10000;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-banner.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Responsive móvil y tableta
   ========================================================================== */
@media (max-width: 960px) {
  .events-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-dish-weight-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .controls-grid,
  .menu-modules-grid,
  .shopping-groups-grid {
    grid-template-columns: 1fr;
  }

  .timeline-step {
    grid-template-columns: 74px 1fr;
  }

  .timeline-check-wrap {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .actions-toolbar .btn-primary,
  .actions-toolbar .btn-whatsapp,
  .actions-toolbar .btn-subtle,
  .tab-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .results-tabs {
    width: 100%;
  }

  .btn-preset {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .events-grid {
    grid-template-columns: 1fr;
  }

  .kpi-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Hoja limpia A4 para impresión de cocina y lista de la compra
   ========================================================================== */
.print-only-header {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .tool-breadcrumbs,
  .hero-banner,
  .planner-config-block,
  .results-tabs-bar,
  .actions-toolbar,
  .split-bill-bar,
  .seo-guide-section,
  .amazon-affiliate-showcase,
  .affiliate-showcase-container,
  .related-tools-section,
  .fijate-footer,
  .modal-backdrop,
  .toast-banner {
    display: none !important;
  }

  .tool-layout {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .card-main {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .print-only-header {
    display: block !important;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }

  .print-only-header h2 {
    font-size: 16pt;
    color: #0f172a;
    margin: 0 0 4px 0;
  }

  .print-only-header p {
    font-size: 10pt;
    color: #334155;
    margin: 0;
  }

  .kpi-summary-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px;
  }

  .kpi-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    padding: 8px !important;
  }

  .kpi-value,
  .kpi-label,
  .kpi-sub,
  .timeline-clock,
  .timeline-step-title,
  .timeline-step-desc,
  .shopping-group-title,
  .shopping-item-name {
    color: #0f172a !important;
  }

  body.print-mode-all .tab-panel,
  .tab-panel.active {
    display: block !important;
    margin-bottom: 16px;
  }

  .shopping-groups-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .shopping-group-card,
  .timeline-step,
  .timeline-header-card {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    break-inside: avoid;
  }

  .timeline-step {
    padding: 7px 10px !important;
    gap: 8px !important;
  }
}
