/* Listita: rojo súper sobre grises neutros (sin tinte cálido: en oscuro quedaba marrón). Mobile first. */
:root {
    --rojo: #E5322D;
    --rojo-osc: #BF1F1A;
    --rojo-suave: #FDECEB;
    --amarillo: #FFC83D;
    --verde-wa: #25D366;
    --fondo: #F4F4F6;
    --papel: #FFFFFF;
    --tinta: #18181B;
    --tinta-2: #6B6B74;
    --linea: #E4E4E8;
    --caja: #C8C8CF;
    --velo: rgba(10, 10, 14, .45);
    --sombra: 0 1px 2px rgba(15, 15, 25, .05), 0 6px 20px rgba(15, 15, 25, .06);
    --radio: 16px;
    --fuente: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --abajo: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
}
/* Modo noche: solo si la persona lo elige con el botón ☀️/🌙 de arriba (se guarda en localStorage "listita.tema").
   Por defecto siempre día, aunque el celu esté en oscuro. */
:root[data-theme="dark"] {
    --rojo: #FF4B44;
    --rojo-osc: #D9302A;
    --rojo-suave: #3A1616;
    --fondo: #0E0E10;
    --papel: #1C1C1F;
    --tinta: #F4F4F5;
    --tinta-2: #A1A1AA;
    --linea: #2E2E33;
    --caja: #55555D;
    --velo: rgba(0, 0, 0, .6);
    --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100dvh; background: var(--fondo); color: var(--tinta);
    font: 16px/1.45 var(--fuente); -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--rojo); }
[hidden] { display: none !important; }
svg { display: block; }

/* ---------- barra ---------- */
.top {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; background: var(--rojo); color: #fff;
}
.marca { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.marca-logo { width: 32px; height: 32px; color: #fff; --logo-trazo: var(--rojo); }
.top-acciones { display: flex; align-items: center; gap: 8px; }
.ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: #fff; }
.ico svg { width: 22px; height: 22px; }
.ico:active { background: rgba(255, 255, 255, .18); }
.ico-oscuro { color: var(--tinta-2); }
.ico-oscuro:active { background: var(--linea); }
.avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #fff; color: var(--rojo); font-weight: 800; display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, .7); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.red-aviso { position: sticky; top: 60px; z-index: 19; background: var(--amarillo); color: #3a2a00; font-size: 13px; font-weight: 600; text-align: center; padding: 6px 16px; }

/* ---------- botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
    border-radius: 999px; background: var(--rojo); color: #fff; font-weight: 700; text-decoration: none; transition: transform .1s;
}
.btn:active { transform: scale(.97); background: var(--rojo-osc); }
.btn svg { width: 22px; height: 22px; }
.btn-grande { min-height: 56px; font-size: 18px; padding: 0 26px; }
.btn-chico { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-blanco { background: #fff; color: var(--tinta); box-shadow: var(--sombra); }
.btn-blanco:active { background: #f4f4f4; }
.btn-suave { background: var(--rojo-suave); color: var(--rojo); }
.btn-suave:active { background: var(--linea); }
.btn-ancho { width: 100%; margin-top: 10px; }
.btn-peligro { background: transparent; color: var(--rojo); border: 2px solid var(--rojo-suave); }
.btn-wa { background: var(--verde-wa); color: #fff; }
.btn-wa:active { background: #1fb556; }
.btn .g { width: 22px; height: 22px; }
.btn:disabled { opacity: .6; }

/* ---------- landing ---------- */
.landing { max-width: 520px; margin: 0 auto; padding: 32px 16px calc(40px + var(--abajo)); }
.land-titulo { font-size: clamp(34px, 9vw, 46px); line-height: 1.05; letter-spacing: -1px; margin: 0 0 8px; font-weight: 900; text-align: center; }
.land-titulo em { font-style: normal; color: var(--rojo); }
.land-bajada { text-align: center; color: var(--tinta-2); font-size: 17px; margin: 0 0 24px; }
.pasos-home { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: paso; }
.pasos-home li {
    counter-increment: paso; position: relative; display: flex; gap: 14px; align-items: flex-start;
    background: var(--papel); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); min-width: 0;
}
.pasos-home li::before {
    content: counter(paso); position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--rojo); color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; z-index: 1;
}
.paso-ico {
    width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--rojo-suave); display: grid; place-items: center;
    font-size: 30px; margin: 6px 0 0 6px;
}
.paso-ico svg { width: 30px; height: 30px; }
.paso-ico-blanco { background: #fff; border: 1px solid var(--linea); }
.paso-ico-wa { background: var(--verde-wa); color: #fff; }
.paso-txt { min-width: 0; flex: 1; }
.paso-txt h2 { margin: 2px 0 2px; font-size: 18px; }
.paso-txt p { margin: 0 0 10px; color: var(--tinta-2); font-size: 15px; }
.paso-txt p:last-child { margin-bottom: 0; }
.land-nota { text-align: center; color: var(--tinta-2); font-size: 14px; margin: 22px 0 0; }

/* ---------- vista general ---------- */
.vista { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(120px + var(--abajo)); }
.inicio .saludo { font-size: 26px; margin: 6px 0 16px; letter-spacing: -.5px; }
.tarjetas { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.tarjeta {
    display: block; background: var(--papel); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra);
    color: inherit; text-decoration: none; text-align: left; min-width: 0;
}
.tarjeta:active { transform: scale(.99); }
.tarjeta-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 18px; }
.tarjeta-cab b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tarjeta-info { color: var(--tinta-2); font-size: 14px; margin: 2px 0 10px; }
.nueva { background: var(--amarillo); color: #3a2a00; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; flex: none; }
.barrita { height: 6px; border-radius: 3px; background: var(--linea); overflow: hidden; }
.barrita i { display: block; height: 100%; background: var(--rojo); border-radius: 3px; }
.tarjeta-nueva { border: 2px dashed var(--linea); box-shadow: none; background: transparent; color: var(--rojo); font-weight: 800; font-size: 17px; text-align: center; padding: 18px; }
.aviso-login { display: flex; gap: 10px; margin-top: 18px; padding: 14px; border-radius: var(--radio); background: var(--rojo-suave); font-size: 15px; }
.instalar {
    display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 18px; padding: 14px; border-radius: var(--radio);
    background: var(--papel); box-shadow: var(--sombra); text-align: left;
}
.instalar > svg { width: 44px; height: 44px; color: var(--rojo); flex: none; }
.instalar > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.instalar small { color: var(--tinta-2); }

/* ---------- lista ---------- */
.lista-cab { display: flex; align-items: center; gap: 4px; margin: -4px -8px 0; }
.volver { width: 40px; height: 40px; display: grid; place-items: center; color: var(--tinta); flex: none; }
.volver svg { width: 24px; height: 24px; }
.lista-titulo { flex: 1; min-width: 0; text-align: left; font-size: 24px; font-weight: 900; letter-spacing: -.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progreso-txt { font-size: 14px; color: var(--tinta-2); margin: 2px 0 6px; }
.progreso { height: 8px; border-radius: 4px; background: var(--linea); overflow: hidden; margin-bottom: 8px; }
.progreso i { display: block; height: 100%; width: 0; background: var(--rojo); border-radius: 4px; transition: width .4s ease; }
.seccion { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--tinta-2); margin: 20px 4px 6px; font-weight: 800; }
.items { list-style: none; margin: 0; padding: 0; background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.item { display: flex; align-items: stretch; border-bottom: 1px solid var(--linea); }
.item:last-child { border-bottom: 0; }
.item-tilde { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 14px 4px 14px 16px; text-align: left; min-height: 56px; }
.item-tilde:active { background: var(--rojo-suave); }
.caja { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2.5px solid var(--caja); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.item-txt { min-width: 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.cant { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--rojo-suave); color: var(--rojo); font-size: 13px; font-weight: 800; vertical-align: 1px; }
.item-editar { width: 48px; flex: none; display: grid; place-items: center; color: var(--tinta-2); }
.item-editar svg { width: 18px; height: 18px; }
.item.hecho .caja { background: var(--rojo); border-color: var(--rojo); }
.item.hecho .caja::after { content: ""; width: 7px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-1px) rotate(45deg); }
.item.hecho .item-txt { color: var(--tinta-2); text-decoration: line-through; font-weight: 500; }
.item.hecho .cant { background: var(--linea); color: var(--tinta-2); }
.item.pop .caja { animation: pop .3s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }
.carrito { margin-top: 24px; }
.carrito-cab { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 8px 4px; font-weight: 800; color: var(--tinta-2); font-size: 15px; }
.carrito .flecha { transition: transform .2s; }
.carrito:not(.abierto) .items, .carrito:not(.abierto) .carrito-acc { display: none; }
.carrito:not(.abierto) .flecha { transform: rotate(-90deg); }
.carrito .items { opacity: .85; }
.carrito-acc { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.vacio { text-align: center; padding: 40px 16px; color: var(--tinta-2); }
.vacio-emoji { font-size: 56px; }
.vacio h1 { color: var(--tinta); }
.vacio-lista { padding-top: 56px; }
.pensando { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 14px 0; padding: 12px; border-radius: var(--radio); background: var(--rojo-suave); color: var(--rojo); font-weight: 700; }
.chispa { display: inline-block; animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.cargando { display: flex; justify-content: center; gap: 8px; padding: 60px 0; }
.cargando i { width: 10px; height: 10px; border-radius: 50%; background: var(--rojo); animation: salto 1s infinite; }
.cargando i:nth-child(2) { animation-delay: .15s; }
.cargando i:nth-child(3) { animation-delay: .3s; }
@keyframes salto { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- compositor (abajo, fijo) ---------- */
.compositor {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 8px 12px calc(10px + var(--abajo));
    background: color-mix(in srgb, var(--fondo) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--linea);
}
.compositor-fila { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; align-items: center; }
.compositor input {
    flex: 1; min-width: 0; height: 50px; border-radius: 999px; border: 2px solid var(--linea); background: var(--papel);
    padding: 0 18px; font-size: 17px; outline: none;
}
.compositor input:focus { border-color: var(--rojo); }
.ico-redondo { width: 50px; height: 50px; flex: none; color: var(--tinta-2); background: var(--papel); border: 2px solid var(--linea); }
.ico-lleno { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.ico-lleno:active { background: var(--rojo-osc); }
.grabando { background: var(--rojo); border-color: var(--rojo); color: #fff; animation: latido 1s infinite; }
@keyframes latido { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--rojo) 25%, transparent); } }
.sugerencias { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.sugerencias:not(:empty) { padding-bottom: 8px; }
.sugerencias::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--papel); border: 1.5px solid var(--linea); font-weight: 600; font-size: 15px; white-space: nowrap; max-width: 75vw; overflow: hidden; text-overflow: ellipsis; }
.chip:active { background: var(--rojo-suave); }
.chip-prod { border-style: dashed; }

/* ---------- hoja (bottom sheet) ---------- */
.hoja {
    width: 100%; max-width: 560px; max-height: 88dvh; margin: auto auto 0; padding: 8px 20px calc(24px + var(--abajo));
    border: 0; border-radius: 24px 24px 0 0; background: var(--papel); color: var(--tinta); overflow-y: auto;
}
.hoja[open] { animation: subir .22s ease-out; }
.hoja::backdrop { background: var(--velo); }
@keyframes subir { from { transform: translateY(40px); opacity: .5; } }
.hoja:focus { outline: none; }
.hoja-asa { width: 44px; height: 5px; border-radius: 3px; background: var(--linea); margin: 0 auto 10px; }
.hoja h2 { margin: 6px 0 10px; font-size: 21px; overflow-wrap: anywhere; }
.hoja h3 { margin: 22px 0 8px; font-size: 16px; }
.hoja label { display: block; font-weight: 700; font-size: 14px; color: var(--tinta-2); margin-top: 10px; }
.hoja input:not([type=radio]), .hoja textarea {
    display: block; width: 100%; margin-top: 6px; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--linea);
    background: var(--fondo); font-size: 17px; outline: none; color: var(--tinta);
}
.hoja input:focus, .hoja textarea:focus { border-color: var(--rojo); }
.nota { color: var(--tinta-2); font-size: 15px; margin: 0 0 8px; }
.fila-btn { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hoja .cat { margin: 0; }
.cat input { position: absolute; opacity: 0; pointer-events: none; }
.cat span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--linea); font-size: 14px; color: var(--tinta); font-weight: 600; }
.cat input:checked + span { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.menu { display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 12px; padding: 15px 4px; border-bottom: 1px solid var(--linea); text-align: left; font-size: 17px; font-weight: 600; }
.menu button:last-child { border-bottom: 0; }
.menu button svg { width: 20px; height: 20px; }
.menu .peligro { color: var(--rojo); }
.invitar { display: flex; gap: 8px; }
.invitar input { margin-top: 0 !important; flex: 1; min-width: 0; }
.miembros { list-style: none; padding: 0; margin: 12px 0 0; }
.miembros li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.mini-av { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--rojo-suave); color: var(--rojo); font-weight: 800; flex: none; }
.mini-av img { width: 100%; height: 100%; object-fit: cover; }
.m-nombre { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; overflow-wrap: anywhere; }
.m-nombre small { color: var(--tinta-2); font-weight: 500; }
.link-chico { display: block; margin: 18px auto 0; color: var(--tinta-2); text-decoration: underline; font-size: 14px; }
.cuenta { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.cuenta img { width: 48px; height: 48px; border-radius: 50%; }
.cuenta div { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.cuenta small { color: var(--tinta-2); }
.pasos { padding-left: 22px; font-size: 17px; }
.pasos li { margin: 8px 0; }
.ico-txt { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: #0a84ff; }

/* ---------- toast ---------- */
.toast {
    position: fixed; left: 16px; right: 16px; bottom: calc(86px + var(--abajo)); z-index: 30; max-width: 520px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 14px;
    background: var(--tinta); color: var(--fondo); font-weight: 600; box-shadow: var(--sombra); animation: subir .2s ease-out;
}
.toast button { color: var(--amarillo); font-weight: 800; flex: none; }
body:not(.en-lista) .toast { bottom: calc(20px + var(--abajo)); }
