/* ═══════════════════════════════════════════
   CASA CRM — Estilos mobile-first (375px)
═══════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-light: #ffedd5;
  --primary-tint: #fff7ed;
  --secondary: #0f172a;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #edeef1;
  --text: #0f172a;
  --text-muted: #7b8494;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 10px rgba(16,24,40,.05);
  --shadow-md: 0 6px 20px rgba(16,24,40,.08);
  --shadow-lg: 0 14px 40px rgba(16,24,40,.14);
  --tab-h: 64px;
  --header-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }
a { color: inherit; }

/* ── Utilities ── */
.hidden { display: none !important; }

/* Iconos SVG inline (editar, borrar, carrito…) */
.ic { width: 1.15em; height: 1.15em; vertical-align: -.16em; flex-shrink: 0; }
button .ic { pointer-events: none; }
.btn-mini { display: inline-flex; align-items: center; justify-content: center; }
.btn-mini .ic { width: 1.05rem; height: 1.05rem; }

/* Selector de idioma */
.btn-lang {
  width: auto; padding: 0 .55rem; border-radius: 100px;
  font-size: .72rem; font-weight: 800; letter-spacing: .03em;
  color: var(--primary-dark); background: var(--primary-tint);
  border: 1px solid var(--primary-light);
}
.lang-switch { display: flex; gap: .4rem; justify-content: center; margin: .2rem 0 1.1rem; }
.lang-switch button {
  padding: .32rem .8rem; border-radius: 100px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); font-weight: 700; font-size: .75rem;
  -webkit-tap-highlight-color: transparent;
}
.lang-switch button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ══════════════════════════════════════
   PANTALLA DE LOGIN
══════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #fff7ed 0%, #fed7aa 50%, #fff7ed 100%);
  z-index: 100;
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 2rem 1.5rem 1.5rem;
  width: 100%; max-width: 340px;
  box-shadow: 0 8px 32px rgba(249,115,22,.15);
  text-align: center;
}

.login-logo {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: .5rem;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .25rem;
}

.login-sub {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

/* PIN dots */
.pin-display {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: .5rem;
}

.pin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: transparent;
  transition: background .15s;
}

.pin-dot.filled {
  background: var(--primary);
}

.pin-error {
  min-height: 1.4rem;
  color: var(--danger);
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .75rem;
}

/* Teclado numérico */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  max-width: 280px;
  margin: 0 auto;
}

.pin-btn {
  height: 64px;
  border-radius: var(--radius);
  font-size: 1.5rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  transition: background .12s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}

.pin-btn:active {
  background: var(--primary-light);
  transform: scale(.95);
}

.pin-btn--del {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1.3rem;
}

.pin-btn--ghost {
  background: transparent;
  pointer-events: none;
}

/* ══════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════ */
.app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* ── Cabecera (blanca, título grande estilo iOS) ── */
.app-header {
  height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) 1.1rem 0;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

.header-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.025em;
  color: var(--text);
}

.header-right {
  display: flex; align-items: center; gap: .5rem;
}

.user-badge {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border: 1px solid var(--primary-light);
  border-radius: 100px;
  padding: .28rem .7rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: capitalize;
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  color: var(--text-muted);
  background: var(--surface-2);
  transition: background .12s;
}
.btn-icon:hover { background: var(--border); }

/* ── Contenido principal ── */
.app-main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.section {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1rem calc(var(--tab-h) + var(--safe-b) + 1rem);
  display: none;
}
.section.active { display: block; }

/* Mensajes: necesita layout flex column */
.mensajes-section {
  display: none;
  flex-direction: column;
  padding: 0;
}
.mensajes-section.active { display: flex; }

/* ── Barra de pestañas ── */
.tab-bar {
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  z-index: 20;
}

.tab-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  padding: .3rem 0;
}

.tab-item.active {
  color: var(--primary);
}

.tab-icon {
  font-size: 1.2rem;
  line-height: 1;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 30px;
  border-radius: 100px;
  transition: background .18s, transform .12s;
}
.tab-icon svg { width: 23px; height: 23px; display: block; }
.tab-item.active .tab-icon {
  background: var(--primary-tint);
  transform: translateY(-1px);
}

.tab-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .01em;
}

/* Badge de mensajes no leídos */
.badge {
  position: absolute;
  top: -4px; right: -8px;
  background: var(--danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 100px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--surface);
}

/* ══════════════════════════════════════
   COMPONENTES COMUNES
══════════════════════════════════════ */

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem;
  height: 44px;
  padding: 0 1.1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  transition: opacity .12s, transform .08s, background .12s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { opacity: .8; transform: scale(.97); }

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(249,115,22,.28);
}
.btn--primary:hover { background: var(--primary-dark); }

.btn--secondary {
  background: var(--secondary);
  color: #fff;
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--success {
  background: var(--success);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn--outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn--sm {
  height: 34px;
  padding: 0 .7rem;
  font-size: .8rem;
}

/* Section header */
.section-header {
  display: flex; align-items: center;
  justify-content: flex-end;
  margin-bottom: .85rem;
  gap: .5rem;
  min-height: 30px;
}

/* El título grande vive en la cabecera; ocultamos el duplicado de la sección */
.section-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text-muted);
  display: none;
}

.section-actions {
  display: flex; gap: .5rem;
}

/* Cards */
.card-list {
  display: flex; flex-direction: column;
  gap: .6rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(16,24,40,.03);
}
.card-list { gap: .7rem; }

/* ─── Módulo Menú semanal ─── */
.menu-notas { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.menu-nota {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.menu-nota--warn { border-color: var(--danger); background: #fff8f8; }
.menu-nota > summary {
  list-style: none;
  cursor: pointer;
  padding: .8rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  font-weight: 600; font-size: .92rem;
}
.menu-nota > summary::-webkit-details-marker { display: none; }
.menu-nota > summary::before { content: '▸'; color: var(--text-muted); margin-right: .1rem; transition: transform .15s; }
.menu-nota[open] > summary::before { transform: rotate(90deg); }
.menu-nota-titulo { flex: 1; }
.menu-nota-body {
  padding: 0 1rem .9rem 1.9rem;
  font-size: .86rem; line-height: 1.5; color: var(--text);
}
.menu-nota--warn .menu-nota-titulo { color: #b91c1c; }

.menu-dia { display: flex; flex-direction: column; gap: .4rem; }
.menu-dia--hoy { border: 2px solid var(--primary); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }
.menu-dia-head { display: flex; align-items: center; justify-content: space-between; }
.menu-dia-nombre { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .4rem; }
.chip-hoy {
  background: var(--primary); color: #fff;
  font-size: .6rem; font-weight: 700; letter-spacing: .04em;
  padding: .1rem .4rem; border-radius: 999px;
}
.menu-meal { margin-top: .6rem; }
.menu-label {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--primary);
}
.menu-label .ic { width: .9rem; height: .9rem; }
.menu-label--cena { color: #6366f1; }
.menu-dish {
  display: block; margin-top: 2px;
  font-size: .95rem; line-height: 1.35; color: var(--text);
}
.menu-nota-dia {
  display: flex; align-items: flex-start; gap: .35rem;
  margin-top: .7rem; padding-top: .6rem;
  border-top: 1px dashed var(--border);
  font-size: .82rem; color: var(--text-muted);
}
.menu-nota-dia .ic { width: .9rem; height: .9rem; flex-shrink: 0; margin-top: .1rem; }
.btn-mini {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: .25rem .5rem; font-size: .85rem;
  cursor: pointer; flex-shrink: 0;
}
.btn-mini:active { background: var(--border); }

.card--danger {
  border-left: 4px solid var(--danger);
  background: #fff8f8;
}

.card--warning {
  border-left: 4px solid var(--warning);
  background: #fffdf0;
}

.card--success {
  border-left: 4px solid var(--success);
  background: #f0fdf4;
}

.card--muted {
  opacity: .55;
}

/* Estado badges */
.estado-badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.estado-pendiente  { background: var(--warning-light); color: #92400e; }
.estado-aprobado   { background: #dbeafe; color: #1e40af; }
.estado-comprado   { background: var(--success-light); color: #15803d; }
.estado-rechazado  { background: var(--danger-light); color: #b91c1c; }

/* Loading / empty */
.loading, .empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}

.loading::before {
  content: '⏳ ';
}

/* Formularios */
.form-group {
  margin-bottom: .85rem;
}

.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .3rem;
}

.form-control {
  width: 100%;
  height: 44px;
  padding: 0 .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: border-color .15s;
}
.form-control:focus {
  border-color: var(--primary);
  background: #fff;
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: .6rem .85rem;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='m7 10 5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
}

/* ══════════════════════════════════════
   RECETAS
══════════════════════════════════════ */
.receta-card {
  display: flex; align-items: center;
  gap: .85rem;
  cursor: pointer;
  transition: box-shadow .12s;
}
.receta-card:active { box-shadow: 0 0 0 2px var(--primary); }

.receta-emoji {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}
.receta-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.receta-info { flex: 1; min-width: 0; }
.receta-nombre {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.receta-meta {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Detalle receta */
.detalle-content { padding-bottom: 1rem; }

.detalle-header {
  text-align: center;
  padding: 1rem 0;
}

.detalle-emoji { font-size: 4rem; }
.detalle-foto {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}

/* Editor de foto en el formulario */
.foto-editor { display: flex; flex-direction: column; gap: .6rem; }
.foto-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: var(--bg);
  border: 2px dashed var(--border, #ddd);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.foto-preview img { width: 100%; height: 100%; object-fit: cover; }
.foto-placeholder { color: var(--text-muted); font-size: .9rem; }
.foto-editor-btns { display: flex; gap: .5rem; }

/* Hero del detalle (foto grande o emoji) */
.receta-hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.receta-hero-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.receta-hero-emoji { font-size: 5.5rem; line-height: 1; }

.detalle-nombre {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.025em;
  margin: 0 0 .7rem;
}

.detalle-chips {
  display: flex; gap: .5rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .32rem .7rem;
  border-radius: 100px;
  font-size: .8rem; font-weight: 600;
}
.chip .ic { width: .95rem; height: .95rem; }
.chip--cat { background: var(--primary-tint); color: var(--primary-dark); border-color: var(--primary-light); text-transform: capitalize; }
.muted-p { font-size: .9rem; color: var(--text-muted); }

.detalle-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-top: .75rem;
  border: 1px solid var(--border);
}

.detalle-section h3 {
  display: flex; align-items: center; gap: .45rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text);
  margin-bottom: .8rem;
}
.detalle-section h3 .ic { width: 1.15rem; height: 1.15rem; color: var(--primary); }
.detalle-notas { font-size: .9rem; line-height: 1.5; color: var(--text); }

.ingrediente-row {
  display: flex; justify-content: space-between;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  gap: .5rem;
}
.ingrediente-row:last-child { border-bottom: none; }
.ing-name { color: var(--text); }
.ing-qty {
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-weight: 700;
  white-space: nowrap;
  padding: .15rem .55rem;
  border-radius: 100px;
  font-size: .8rem;
}

/* Chevron en tarjetas de lista */
.chevron { width: 20px; height: 20px; color: var(--text-muted); flex-shrink: 0; }
.receta-meta .ic { width: .95rem; height: .95rem; vertical-align: -.15em; }

.paso-row {
  display: flex; gap: .75rem;
  padding: .4rem 0;
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
}
.paso-row:last-child { border-bottom: none; }
.paso-num {
  width: 24px; height: 24px; flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}

/* ══════════════════════════════════════
   LISTA DE COMPRA
══════════════════════════════════════ */
.compra-card {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

.compra-check {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  margin-top: 2px;
}
.compra-check.comprado {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.compra-info { flex: 1; min-width: 0; }
.compra-producto {
  font-size: .95rem;
  font-weight: 600;
}
.compra-producto.tachado { text-decoration: line-through; color: var(--text-muted); }
.compra-detalle {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.compra-actions {
  display: flex; align-items: center; gap: .4rem;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   DESPENSA
══════════════════════════════════════ */
.despensa-card {
  display: flex; align-items: center;
  gap: .75rem;
}

.despensa-info { flex: 1; min-width: 0; }
.despensa-nombre { font-size: .95rem; font-weight: 600; }
.despensa-qty {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex; align-items: center; gap: .4rem;
}

.low-stock-badge {
  font-size: .7rem;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
  padding: .1rem .5rem;
  border-radius: 100px;
}

.qty-controls {
  display: flex; align-items: center; gap: .5rem;
  flex-shrink: 0;
}

.qty-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.qty-btn:active { background: var(--primary-light); }

.qty-val {
  font-size: 1rem;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.despensa-actions { display: flex; gap: .4rem; }

/* ══════════════════════════════════════
   TAREAS
══════════════════════════════════════ */
.dia-tabs {
  display: flex; gap: .4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .5rem;
  margin-bottom: .75rem;
  scrollbar-width: none;
}
.dia-tabs::-webkit-scrollbar { display: none; }

.dia-tab {
  flex-shrink: 0;
  height: 36px;
  padding: 0 .85rem;
  border-radius: 100px;
  font-size: .85rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background .12s, color .12s, border-color .12s;
}
.dia-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tarea-card {
  display: flex; align-items: flex-start; gap: .85rem;
}

.tarea-check {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 8px;
  border: 2.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.tarea-check.hecha {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.tarea-info { flex: 1; }
.tarea-titulo {
  font-size: .95rem;
  font-weight: 600;
}
.tarea-titulo.hecha { text-decoration: line-through; color: var(--text-muted); }
.tarea-meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex; gap: .5rem;
}

.tarea-tipo-badge {
  padding: .1rem .5rem;
  border-radius: 100px;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
}
.tipo-cocina    { background: #fce7f3; color: #9d174d; }
.tipo-limpieza  { background: #dbeafe; color: #1e40af; }
.tipo-otro      { background: #f1f5f9; color: #475569; }

.tarea-actions { display: flex; gap: .4rem; }

/* ══════════════════════════════════════
   MENSAJES
══════════════════════════════════════ */
.mensajes-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.msg-bubble {
  max-width: 80%;
  padding: .6rem .85rem;
  border-radius: 16px;
  font-size: .9rem;
  line-height: 1.4;
  word-break: break-word;
}

.msg-bubble.yo {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg-bubble.otro {
  background: var(--surface);
  color: var(--text);
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-meta {
  font-size: .68rem;
  margin-top: .25rem;
  opacity: .7;
}

.mensajes-input-bar {
  display: flex; gap: .5rem;
  padding: .6rem .75rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  align-items: center;
}

.msg-input {
  flex: 1;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 0 1rem;
  font-size: .9rem;
  outline: none;
  background: var(--bg);
}
.msg-input:focus { border-color: var(--primary); }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%; max-width: 480px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: slideUp .2s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem .5rem;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-body {
  overflow-y: auto;
  padding: .75rem 1.25rem;
  flex: 1;
}

.modal-footer {
  padding: .75rem 1.25rem;
  display: flex; gap: .6rem;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

.modal-footer .btn { flex: 1; height: 48px; font-size: 1rem; }

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 16px);
  left: 50%; transform: translateX(-50%);
  background: var(--secondary);
  color: #fff;
  padding: .65rem 1.2rem;
  border-radius: 100px;
  font-size: .85rem;
  font-weight: 500;
  z-index: 200;
  white-space: nowrap;
  max-width: 90%;
  text-align: center;
  animation: slideUp .2s ease;
  box-shadow: var(--shadow-md);
}
.toast.toast--success { background: var(--success); }
.toast.toast--error   { background: var(--danger); }

/* ══════════════════════════════════════
   INGREDIENTES EDITOR (en modal)
══════════════════════════════════════ */
.ing-editor, .pasos-editor {
  display: flex; flex-direction: column; gap: .5rem;
}

.ing-row-editor {
  display: grid;
  grid-template-columns: 1fr 70px 60px 36px;
  gap: .4rem;
  align-items: center;
}

.paso-row-editor {
  display: flex; gap: .4rem; align-items: flex-start;
}

.paso-row-editor textarea {
  flex: 1;
}

.btn-add-row {
  width: 100%; height: 38px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
  background: var(--bg);
  transition: border-color .12s, color .12s;
}
.btn-add-row:hover { border-color: var(--primary); color: var(--primary); }

.btn-remove-row {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  margin-top: 6px;
}

/* ══════════════════════════════════════
   RESPONSIVE ≥ 480px
══════════════════════════════════════ */
@media (min-width: 480px) {
  .modal-overlay {
    align-items: center;
  }
  .modal {
    border-radius: 24px;
    max-height: 80vh;
  }
  .pin-pad { max-width: 300px; }
  .pin-btn { height: 70px; }
}

/* Logo del login (icono de la app) */
.login-logo-img {
  width: 76px; height: 76px;
  border-radius: 20px;
  display: block; margin: 0 auto .6rem;
  box-shadow: 0 6px 18px rgba(249,115,22,.22);
}
