/* ==========================================================================
   Mi Súper — sistema visual
   Perfil ui-ux-pro-max "Grocery & Shopping List": plano, bloques de color,
   verde fresco + colores por categoría, sans-serif en negrita, transiciones rápidas.
   Movimiento (motion-design): personalidad "snappy" para la interfaz y un toque
   "playful" solo en el check de producto comprado.
   ========================================================================== */

:root {
  /* Superficies y texto */
  --bg: #ecfdf5;
  --surface: #ffffff;
  --muted: #f0f8f6;
  --line: #e1f2ed;
  --line-strong: #7d958a;      /* bordes de campos: 3:1 sobre blanco */
  --ink: #0f172a;
  --ink-2: #475569;            /* 7:1 sobre el fondo */

  /* Marca (el verde del perfil oscurecido para que el texto blanco pase 4.5:1) */
  --primary: #047857;
  --primary-press: #065f46;
  --on-primary: #ffffff;
  --primary-text: #047857;
  --primary-soft: #d1fae5;

  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;

  --hero-ok: #047857;
  --hero-warn: #b45309;
  --hero-over: #b91c1c;

  /* Colores por categoría: icono (3:1 sobre su fondo suave) + fondo suave + barra */
  --c-produce: #15803d;  --c-produce-soft: #dcfce7;
  --c-meat: #b91c1c;     --c-meat-soft: #fee2e2;
  --c-dairy: #1d4ed8;    --c-dairy-soft: #dbeafe;
  --c-pantry: #b45309;   --c-pantry-soft: #fef3c7;
  --c-drinks: #0e7490;   --c-drinks-soft: #cffafe;
  --c-home: #6d28d9;     --c-home-soft: #ede9fe;
  --c-mine: #be185d;     --c-mine-soft: #fce7f3;
  --c-other: #475569;    --c-other-soft: #e2e8f0;

  /* Forma */
  --r-lg: 22px;
  --r: 16px;
  --r-sm: 12px;

  /* Movimiento: una curva firma, tres duraciones */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-emph: cubic-bezier(0.05, 0.7, 0.1, 1);
  --ease-in: cubic-bezier(0.3, 0, 1, 1);
  --ease-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --t-quick: 120ms;
  --t-std: 200ms;
  --t-slow: 320ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1411;
    --surface: #121e19;
    --muted: #18261f;
    --line: #22342b;
    --line-strong: #5e7a6c;
    --ink: #ecf5f0;
    --ink-2: #a3b3aa;

    --primary: #10b981;
    --primary-press: #34d399;
    --on-primary: #052e1f;
    --primary-text: #34d399;
    --primary-soft: rgba(16, 185, 129, 0.16);

    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.14);

    --hero-ok: #065f46;
    --hero-warn: #92400e;
    --hero-over: #991b1b;

    --c-produce: #4ade80;  --c-produce-soft: rgba(74, 222, 128, 0.14);
    --c-meat: #f87171;     --c-meat-soft: rgba(248, 113, 113, 0.14);
    --c-dairy: #60a5fa;    --c-dairy-soft: rgba(96, 165, 250, 0.14);
    --c-pantry: #fbbf24;   --c-pantry-soft: rgba(251, 191, 36, 0.14);
    --c-drinks: #22d3ee;   --c-drinks-soft: rgba(34, 211, 238, 0.14);
    --c-home: #a78bfa;     --c-home-soft: rgba(167, 139, 250, 0.14);
    --c-mine: #f472b6;     --c-mine-soft: rgba(244, 114, 182, 0.14);
    --c-other: #94a3b8;    --c-other-soft: rgba(148, 163, 184, 0.14);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh;
  padding: env(safe-area-inset-top) 0 calc(104px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { letter-spacing: -0.02em; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }

/* ---------- Encabezado ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px; max-width: 560px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center;
}
.brand-text { min-width: 0; }
.top h1 { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.15; }
.loc {
  display: flex; align-items: center; gap: 4px; min-height: 24px; font-size: 13px; font-weight: 500;
  color: var(--ink-2); text-align: left; max-width: 220px;
}
.loc { position: relative; }
.loc::after { content: ""; position: absolute; inset: -10px -8px; } /* área táctil de 44 px sin cambiar el aspecto */
.loc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc svg { flex: none; color: var(--primary-text); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--ink);
  transition: background-color var(--t-quick) var(--ease), transform var(--t-quick) var(--ease);
}
.icon-btn:active { background: var(--primary-soft); transform: scale(0.94); }

main { padding: 0 16px; max-width: 560px; margin: 0 auto; }

/* ---------- Tarjeta principal (bloque de color según el presupuesto) ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--r-lg); padding: 20px; margin-top: 4px;
  background: var(--hero-ok); color: #fff;
  transition: background-color var(--t-slow) var(--ease);
}
.hero.warn { background: var(--hero-warn); }
.hero.over { background: var(--hero-over); }
/* capa ambiental: círculos suaves fijos que dan profundidad sin sombras */
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; background: rgba(255, 255, 255, 0.07);
}
.hero::before { width: 220px; height: 220px; right: -70px; top: -90px; }
.hero::after { width: 120px; height: 120px; right: 60px; top: 40px; background: rgba(255, 255, 255, 0.05); }
.hero .label { font-size: 14px; font-weight: 600; }
.hero .big {
  font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 4px 0 16px;
  font-variant-numeric: tabular-nums;
}
.hero .bar { background: rgba(255, 255, 255, 0.28); }
.hero .bar > i { background: #fff; }
.hero .stats { display: flex; gap: 10px; margin-top: 16px; }
.hero .stat {
  flex: 1; text-align: left; padding: 10px 12px; min-height: 56px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.16); color: #fff;
}
.hero .stat .label { font-size: 12px; font-weight: 600; }
.hero .stat .v { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.hero .stat.tap { transition: background-color var(--t-quick) var(--ease), transform var(--t-quick) var(--ease); }
.hero .stat.tap:active { background: rgba(0, 0, 0, 0.26); transform: scale(0.98); }
.hero .stat.tap .label::after { content: " ›"; }

.hero.setup { background: var(--surface); color: var(--ink); border: 1px solid var(--line); text-align: center; padding: 28px 20px; }
.hero.setup::before { background: var(--primary-soft); opacity: 0.6; }
.hero.setup::after { display: none; }
.hero.setup .big { font-size: 26px; margin: 0; }
.hero.setup p { color: var(--ink-2); margin: 6px auto 18px; max-width: 280px; }

/* ---------- Barras de progreso (se animan con transform, no con width) ---------- */
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 100%; border-radius: 99px; background: var(--primary);
  transform-origin: left center; transform: scaleX(0);
  transition: transform 520ms var(--ease);
}
.bar.thin { height: 8px; }

/* ---------- Lista agrupada por categoría ---------- */
.list { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 4px; }
.group-head .gname { flex: 1; font-size: 14px; font-weight: 700; }
.group-head .gsum { font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.item {
  display: flex; align-items: center; gap: 4px; padding: 6px 10px 6px 4px; min-height: 64px;
  transition: background-color var(--t-std) var(--ease);
}
.item + .item { border-top: 1px solid var(--line); }
.check {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 50%;
}
.check .ring {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: grid; place-items: center; color: transparent;
  transition: background-color var(--t-std) var(--ease), border-color var(--t-std) var(--ease), transform var(--t-quick) var(--ease);
}
.check:active .ring { transform: scale(0.88); }
.check path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.item.done .check .ring { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.item.done .check path { stroke-dashoffset: 0; }
.check.pop .ring { animation: pop 340ms var(--ease-back); }
.check.pop path { animation: draw 260ms var(--ease) 70ms both; }

.item .info { flex: 1; min-width: 0; text-align: left; padding: 6px 4px; min-height: 48px; border-radius: 10px; }
.item .name {
  font-weight: 600; line-height: 1.25; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.item .sub { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.item.done { background: var(--muted); }
.item.done .name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-2); }
.item .total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 64px; text-align: right; }
.item.done .total { color: var(--ink-2); }

.stepper { display: flex; align-items: center; flex: none; }
.stepper button {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--primary-text);
  transition: background-color var(--t-quick) var(--ease), transform var(--t-quick) var(--ease);
}
.stepper button .knob {
  width: 30px; height: 30px; border-radius: 10px; background: var(--primary-soft); display: grid; place-items: center;
  transition: background-color var(--t-quick) var(--ease);
}
.stepper button:active { transform: scale(0.9); }
.stepper > span { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper > span.bump { animation: bump 220ms var(--ease-back); }

.item.enter { animation: item-in 280ms var(--ease-emph) backwards; }

.empty { text-align: center; color: var(--ink-2); padding: 40px 24px; }
.empty-art {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text);
}

/* ---------- Iconos de categoría ---------- */
.cat-tile {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--tile-soft); color: var(--tile);
}
.cat-tile.sm { width: 26px; height: 26px; border-radius: 8px; }
.c-produce { --tile: var(--c-produce); --tile-soft: var(--c-produce-soft); }
.c-meat    { --tile: var(--c-meat);    --tile-soft: var(--c-meat-soft); }
.c-dairy   { --tile: var(--c-dairy);   --tile-soft: var(--c-dairy-soft); }
.c-pantry  { --tile: var(--c-pantry);  --tile-soft: var(--c-pantry-soft); }
.c-drinks  { --tile: var(--c-drinks);  --tile-soft: var(--c-drinks-soft); }
.c-home    { --tile: var(--c-home);    --tile-soft: var(--c-home-soft); }
.c-mine    { --tile: var(--c-mine);    --tile-soft: var(--c-mine-soft); }
.c-other   { --tile: var(--c-other);   --tile-soft: var(--c-other-soft); }
.tile-brand { --tile: var(--primary-text); --tile-soft: var(--primary-soft); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px; border-radius: 14px;
  background: var(--primary); color: var(--on-primary); font-weight: 700;
  transition: background-color var(--t-quick) var(--ease), transform var(--t-quick) var(--ease);
}
.btn:active { background: var(--primary-press); transform: scale(0.97); }
.btn.ghost { background: var(--muted); color: var(--ink); }
.btn.ghost:active { background: var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
@media (hover: hover) {
  .btn:hover { background: var(--primary-press); }
  .btn.ghost:hover { background: var(--line); }
  .btn.danger:hover { filter: brightness(0.97); }
  .row:hover, .menu-item:hover { background: var(--muted); }
}

.fab {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 5;
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  min-height: 56px; padding: 0 26px; border-radius: 99px;
  background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 16px;
  box-shadow: 0 0 0 5px var(--bg), 0 10px 24px rgba(4, 120, 87, 0.28);
  transform: translateX(-50%);
  transition: background-color var(--t-quick) var(--ease), transform var(--t-quick) var(--ease);
  animation: fab-in 420ms var(--ease-emph) 120ms backwards;
}
.fab:active { transform: translateX(-50%) scale(0.95); background: var(--primary-press); }

.list-actions { display: flex; gap: 10px; margin-top: 14px; }
.list-actions .btn { flex: 1; background: var(--surface); border: 1px solid var(--line); color: var(--primary-text); }
.list-actions .btn:active { background: var(--primary-soft); }

/* ---------- Hoja inferior, menú lateral y fondo oscurecido ---------- */
.scrim { position: fixed; inset: 0; background: rgba(6, 20, 14, 0.5); z-index: 10; animation: fade-in var(--t-std) var(--ease) both; }
.scrim.out { animation: fade-out 180ms var(--ease-in) both; pointer-events: none; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 560px; margin: 0 auto;
  background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 90vh; display: flex; flex-direction: column;
  animation: sheet-in var(--t-slow) var(--ease-emph) backwards;
}
.sheet::before {
  content: ""; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line);
  margin: 0 auto 14px; flex: none;
}
.sheet.out { animation: sheet-out 200ms var(--ease-in) both; pointer-events: none; }
.sheet > div > * { animation: rise 260ms var(--ease-emph) backwards; }
.sheet > div > *:nth-child(2) { animation-delay: 30ms; }
.sheet > div > *:nth-child(3) { animation-delay: 60ms; }
.sheet > div > *:nth-child(4) { animation-delay: 90ms; }
.sheet > div > *:nth-child(n+5) { animation-delay: 120ms; }
.sheet h2 { margin: 0 0 4px; font-size: 21px; font-weight: 800; }
.sheet .hint { margin-bottom: 14px; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 12; width: min(84vw, 320px);
  background: var(--surface); border-radius: 26px 0 0 26px;
  padding: calc(18px + env(safe-area-inset-top)) 12px 18px;
  animation: drawer-in 300ms var(--ease-emph) backwards;
}
.drawer.out { animation: drawer-out 200ms var(--ease-in) both; pointer-events: none; }
.drawer-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--ink-2); padding: 8px 14px 12px; }
.menu-item {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px;
  text-align: left; font-weight: 600; color: var(--ink);
  transition: background-color var(--t-quick) var(--ease);
  animation: slide-in 260ms var(--ease-emph) backwards;
}
.menu-item:nth-child(2) { animation-delay: 30ms; }
.menu-item:nth-child(3) { animation-delay: 60ms; }
.menu-item:nth-child(4) { animation-delay: 90ms; }
.menu-item:nth-child(5) { animation-delay: 120ms; }
.menu-item svg { color: var(--ink-2); flex: none; }
.menu-item:active { background: var(--muted); }
.menu-item.active { background: var(--primary-soft); color: var(--primary-text); }
.menu-item.active svg { color: var(--primary-text); }

/* ---------- Campos ---------- */
.hint { color: var(--ink-2); font-size: 14px; }
.hint.warn { color: var(--warn); font-weight: 600; }
.hint.over { color: var(--danger); font-weight: 600; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line-strong); background: var(--muted); outline: none;
  transition: border-color var(--t-quick) var(--ease), background-color var(--t-quick) var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary-text); background: var(--surface); }
.field textarea { resize: none; font: 13px/1.4 ui-monospace, Consolas, monospace; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.shake { animation: shake 360ms ease-in-out; }
.two { display: flex; gap: 10px; }
.two .field { flex: 1; min-width: 0; }
.actions { display: flex; gap: 10px; margin-top: 6px; }
.actions .btn { flex: 1; }

/* ---------- Resultados y filas ---------- */
.search { margin-bottom: 8px; }
.results { overflow-y: auto; margin: 0 -8px; padding: 0 8px 6px; flex: 1; overscroll-behavior: contain; }
.cat {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--ink-2);
  margin: 16px 2px 4px;
}
.row {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 14px; text-align: left;
  transition: background-color var(--t-quick) var(--ease);
}
.row > .grow { flex: 1; min-width: 0; }
.row:active { background: var(--primary-soft); }
.row .n { font-weight: 600; }
.row .u { font-size: 13px; color: var(--ink-2); }
.row .p { font-variant-numeric: tabular-nums; color: var(--primary-text); font-weight: 700; white-space: nowrap; }
.row .p.none {
  color: var(--warn); font-weight: 600; font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--warn-soft);
}
.row .p.dark { color: var(--ink); }
.row .added {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary-text);
}
.row .right { text-align: right; }
.diff { font-size: 12px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.diff.up { color: var(--danger); }
.diff.down { color: var(--primary-text); }

/* ---------- Vistas ---------- */
.view-title { margin: 10px 2px 12px; font-size: 28px; font-weight: 800; line-height: 1.15; }
main > .hint { margin: -4px 2px 10px; }
.section-title { margin: 24px 4px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--ink-2); }
.note { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card .field:last-child { margin-bottom: 0; }
.card .hint { margin: -6px 0 14px; }
.card-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; }
.card-list .row + .row { box-shadow: 0 -1px 0 var(--line); }
.card-list .empty { padding: 24px 12px; }

.period {
  display: block; width: 100%; text-align: left; margin-bottom: 12px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: transform var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease);
}
.period:active { transform: scale(0.985); border-color: var(--primary-text); }
.period .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.period .big { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 12px; font-variant-numeric: tabular-nums; color: var(--ink); }
.period.ok .big { color: var(--primary-text); }
.period.warn .big { color: var(--warn); }
.period.over .big { color: var(--danger); }
.period.warn .bar > i { background: var(--warn); }
.period.over .bar > i { background: var(--danger); }
.period.nobudget .big { color: var(--ink); margin-bottom: 4px; }
.period-note { margin-top: 10px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.period.nobudget .period-note { margin-top: 0; color: var(--primary-text); font-weight: 600; }

.cats { margin-bottom: 12px; }
.cats-title { font-weight: 800; font-size: 17px; margin-bottom: 14px; }
.cat-row { display: flex; gap: 12px; align-items: center; }
.cat-row + .cat-row { margin-top: 14px; }
.cat-row .grow { flex: 1; min-width: 0; }
.cat-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.cat-line span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.cat-row .bar > i { background: var(--tile); }

.add-more { margin: 18px 0 8px; text-align: center; }
.add-more p { color: var(--ink-2); font-size: 14px; margin: 0 0 12px; }

.lines { overflow-y: auto; margin-bottom: 14px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.line span:last-child { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.again { margin-bottom: 10px; }

.intro { color: var(--ink-2); margin: -6px 2px 16px; }
.tip {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 10px;
}
.tip-n {
  flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--primary); color: var(--on-primary);
  font-weight: 800; display: grid; place-items: center; font-size: 15px;
}
.tip h3 { margin: 4px 0 4px; font-size: 16px; font-weight: 700; }
.tip p { margin: 0; color: var(--ink-2); font-size: 15px; }

.backup, .danger-zone { display: flex; flex-direction: column; gap: 10px; }
.backup .hint { margin: 0 0 4px; }
.tall { display: flex; flex-direction: column; min-height: 0; height: 80vh; }

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: calc(100vw - 32px); width: max-content;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  transform: translateX(-50%);
}
.toast.show { animation: toast-in 260ms var(--ease-back) both; }

/* ---------- Bienvenida ---------- */
.intro-screen {
  position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}
.intro-top { display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.langs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 4px; }
.langs button { min-width: 48px; min-height: 40px; padding: 0 12px; border-radius: 99px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.langs button.on { background: var(--primary); color: var(--on-primary); }
.skip { color: var(--ink-2); font-weight: 700; min-height: 48px; padding: 0 8px; }
.intro-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.intro-body > * { animation: rise 420ms var(--ease-emph) backwards; }
.intro-body > :nth-child(2) { animation-delay: 70ms; }
.intro-body > :nth-child(3) { animation-delay: 130ms; }
.intro-icon {
  width: 112px; height: 112px; border-radius: 32px; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; margin-bottom: 28px; position: relative;
}
.intro-icon::after {
  content: ""; position: absolute; inset: -10px; border-radius: 40px; border: 2px solid var(--primary-soft);
  animation: breathe 2.8s ease-in-out infinite;
}
.intro-body > .intro-icon { animation: pop-in 480ms var(--ease-back) backwards; }
.intro-body h2 { margin: 0; font-size: 28px; font-weight: 800; }
.intro-body p { margin: 10px 0 0; color: var(--ink-2); font-size: 17px; max-width: 320px; }
.intro-foot { display: flex; flex-direction: column; gap: 22px; align-items: center; }
.dots { display: flex; gap: 8px; }
.dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--line-strong); opacity: 0.4; transition: width var(--t-std) var(--ease); }
.dots i.on { width: 26px; background: var(--primary); opacity: 1; }

/* ---------- Entrada de pantallas (escalonado < 200 ms) ---------- */
main.view-enter > * { animation: rise 280ms var(--ease-emph) backwards; }
main.view-enter > :nth-child(2) { animation-delay: 35ms; }
main.view-enter > :nth-child(3) { animation-delay: 70ms; }
main.view-enter > :nth-child(4) { animation-delay: 105ms; }
main.view-enter > :nth-child(5) { animation-delay: 140ms; }
main.view-enter > :nth-child(n+6) { animation-delay: 175ms; }

/* ---------- Animaciones ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { from { transform: none; } to { transform: translateY(100%); } }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-out { from { transform: none; } to { transform: translateX(100%); } }
@keyframes item-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
@keyframes bump { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); } 40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(4px); }
}
@keyframes fab-in { from { opacity: 0; transform: translateX(-50%) translateY(24px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.96); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.06); opacity: 0.4; } }

/* Quien pide menos movimiento en el sistema no ve animaciones */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0ms !important; transition-duration: 0.01ms !important;
  }
}
