/*
 * Changuito: la lista de papel de siempre, en pantalla.
 * Hoja cuadriculada, tinta de birome, resaltador amarillo para lo que falta
 * y lapicera roja para lo urgente. De noche, la misma hoja con la luz apagada.
 */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fuentes/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fuentes/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Kalam";
  src: url("../fuentes/kalam-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --papel: #fbfcfd;
  --cuadricula: #e7ecf4;
  --linea: #d3dbe8;
  --superficie: #ffffff;
  --tinta: #1a2440;
  --tinta-suave: #4b5470;
  --birome: #2447b0;
  --birome-fuerte: #1b3586;
  --grafito: #626c86;
  --resaltador: #ffe45c;
  --resaltador-urgente: #ffc4bc;
  --lapicera: #c8241c;
  --sobre-color: #ffffff;
  --pasar-mouse: rgb(36 71 176 / 0.06);
  --destino: rgb(36 71 176 / 0.08);
  --error-fondo: #fdeeec;
  --error-texto: #8a1712;
  --ok-texto: #1d6b3a;
  --sombra: 0 1.25rem 3rem rgb(26 36 64 / 0.22);
  --fondo-dialogo: rgb(26 36 64 / 0.4);

  --texto: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  --mano: "Kalam", "Segoe Print", "Comic Sans MS", cursive;
  --paso: 24px;
  --radio: 6px;
  --ancho-precio: 7.4rem;

  color-scheme: light;
}

/* La hoja de noche: el mismo cuaderno con la luz apagada. */
:root[data-tema="oscuro"] {
  --papel: #121827;
  --cuadricula: #1a2235;
  --linea: #2d3853;
  --superficie: #1a2134;
  --tinta: #e4e8f3;
  --tinta-suave: #c3c9da;
  --birome: #93acff;
  --birome-fuerte: #b7c7ff;
  --grafito: #98a2bc;
  --resaltador: rgb(255 214 10 / 0.34);
  --resaltador-urgente: rgb(255 92 72 / 0.38);
  --lapicera: #ff8577;
  --sobre-color: #10162a;
  --pasar-mouse: rgb(147 172 255 / 0.08);
  --destino: rgb(147 172 255 / 0.12);
  --error-fondo: #3b1b20;
  --error-texto: #ffb8ae;
  --ok-texto: #8fe0aa;
  --sombra: 0 1.25rem 3rem rgb(0 0 0 / 0.5);
  --fondo-dialogo: rgb(4 8 18 / 0.65);

  color-scheme: dark;
}

[data-en-marco] body {
  display: none;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--tinta);
  background-color: var(--papel);
  background-image:
    linear-gradient(var(--cuadricula) 1px, transparent 1px),
    linear-gradient(90deg, var(--cuadricula) 1px, transparent 1px);
  background-size: var(--paso) var(--paso);
  font: 400 1rem/1.5 var(--texto);
}

[hidden] {
  display: none !important;
}

a,
.enlace {
  color: var(--birome);
}

:focus-visible {
  outline: 3px solid var(--birome);
  outline-offset: 2px;
  border-radius: 3px;
}

.oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.saltar {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 40;
  padding: 0.5rem 1rem;
  background: var(--tinta);
  color: var(--papel);
}

.saltar:focus {
  top: 1rem;
}

.icono {
  width: 1em;
  height: 1em;
  flex: none;
}

.sin-js {
  margin: 2rem;
}

/* --- Botones ------------------------------------------------------------------ */

button {
  font: inherit;
}

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--tinta);
  font: 700 1rem/1.25 var(--texto);
  white-space: nowrap;
  cursor: pointer;
}

.boton:hover {
  border-color: var(--grafito);
}

.boton:disabled {
  cursor: progress;
  opacity: 0.75;
}

.boton-principal {
  border-color: var(--birome);
  background: var(--birome);
  color: var(--sobre-color);
}

.boton-principal:hover {
  border-color: var(--birome-fuerte);
  background: var(--birome-fuerte);
}

.boton-peligro {
  border-color: var(--lapicera);
  background: var(--lapicera);
  color: var(--sobre-color);
}

.boton-peligro:hover {
  border-color: var(--lapicera);
  filter: brightness(0.92);
}

.boton-ancho {
  width: 100%;
}

.boton-icono {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--grafito);
  cursor: pointer;
}

.boton-icono:hover {
  background: var(--pasar-mouse);
  color: var(--tinta);
}

.boton-icono .icono {
  width: 1.25rem;
  height: 1.25rem;
}

.enlace {
  padding: 0.25rem 0;
  border: 0;
  background: none;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.enlace-peligro {
  color: var(--lapicera);
}

/* Luna en el modo claro, sol en el oscuro. */
.icono-sol,
[data-tema="oscuro"] .icono-luna {
  display: none;
}

[data-tema="oscuro"] .icono-sol {
  display: block;
}

/* --- Pantallas sueltas (entrar y configurar) ------------------------------------- */

.pantalla-suelta {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 3rem 1rem;
}

.pantalla-suelta > .cambiar-tema {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.panel {
  width: 100%;
  max-width: 25rem;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: var(--superficie);
  box-shadow: var(--sombra);
}

.panel-ancho {
  max-width: 46rem;
}

.panel > p {
  margin: 0 0 1.25rem;
}

.panel-acceso {
  display: grid;
  gap: 1.1rem;
}

.titulo-marca {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  color: var(--birome);
  font: 700 2.1rem/1.15 var(--mano);
}

.panel-acceso .titulo-marca {
  justify-content: center;
  margin-bottom: 0.5rem;
  font-size: 2.8rem;
}

.titulo-marca .icono {
  width: 1.1em;
  height: 1.1em;
}

/* El nombre "pasado con resaltador", como el título de una hoja. */
.trazo {
  padding: 0 0.15em;
  background: linear-gradient(100deg, transparent 0.08em, var(--resaltador) 0.22em,
    var(--resaltador) calc(100% - 0.18em), transparent calc(100% - 0.04em))
    0 78% / 100% 46% no-repeat;
}

.grupo {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 1.25rem 0 0;
  border: 0;
  border-top: 1px solid var(--linea);
}

.grupo > legend {
  padding: 0 0.5rem 0 0;
  color: var(--birome);
  font: 700 1.35rem/1.2 var(--mano);
}

.grupo > .ayuda {
  margin-top: -0.25rem;
}

.mas-opciones > summary {
  width: fit-content;
  color: var(--grafito);
  font-weight: 700;
  cursor: pointer;
}

.mas-opciones .fila-campos {
  margin-top: 0.75rem;
}

.progreso {
  margin: 0;
  color: var(--grafito);
  font-weight: 700;
}

/* --- Encabezado -------------------------------------------------------------------- */

.encabezado {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--papel);
  border-bottom: 1px solid var(--linea);
}

.encabezado-fila,
.barra-lista {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  max-width: 100rem;
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 3vw, 2.5rem);
}

.barra-lista {
  padding-top: 0;
}

.marca {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--birome);
  font: 700 1.9rem/1 var(--mano);
  letter-spacing: -0.01em;
}

.marca .icono {
  width: 1.9rem;
  height: 1.9rem;
}

.herramientas {
  display: flex;
  align-items: center;
  gap: 0.35rem 1rem;
  margin-left: auto;
}

.herramientas .enlace {
  color: var(--grafito);
  text-decoration: none;
}

.herramientas .enlace:hover {
  color: var(--tinta);
}

.icono-actualizar {
  width: 1.15rem;
  height: 1.15rem;
}

.actualizando .icono-actualizar {
  animation: girar 1.1s linear infinite;
}

@keyframes girar {
  to {
    rotate: 360deg;
  }
}

.estado-precios {
  margin: 0 0 0 auto;
  color: var(--grafito);
  font-size: 0.92rem;
  text-align: right;
}

.acciones-lista {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- Buscador ---------------------------------------------------------------------- */

.buscador {
  position: relative;
  flex: 1 1 16rem;
  max-width: 30rem;
}

.buscador input {
  width: 100%;
  padding: 0.55rem 2.5rem 0.55rem 2.4rem;
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--tinta);
  font: inherit;
}

.buscador input:focus {
  border-color: var(--birome);
  outline: none;
}

.buscador input::placeholder {
  color: var(--grafito);
}

.icono-lupa {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  translate: 0 -50%;
  color: var(--grafito);
  pointer-events: none;
}

.atajo {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  translate: 0 -50%;
  min-width: 1.5rem;
  padding: 0 0.35rem;
  border: 1px solid var(--linea);
  border-radius: 4px;
  color: var(--grafito);
  font: 700 0.8rem/1.4 var(--texto);
  text-align: center;
}

.buscador input:focus ~ .atajo,
.buscador input:not(:placeholder-shown) ~ .atajo {
  display: none;
}

/* --- Filtros e interruptor ----------------------------------------------------------- */

.filtros {
  display: flex;
  gap: 0.25rem;
}

.filtro {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: var(--radio);
  background: none;
  color: var(--grafito);
  font: 700 1rem/1.3 var(--texto);
  cursor: pointer;
}

.filtro:hover,
.filtro[aria-pressed="true"] {
  color: var(--tinta);
}

/* El filtro elegido queda "pasado con resaltador". */
.filtro[aria-pressed="true"] .filtro-texto {
  background: linear-gradient(100deg, transparent 0.1em, var(--resaltador) 0.25em,
    var(--resaltador) calc(100% - 0.2em), transparent calc(100% - 0.05em))
    0 70% / 100% 70% no-repeat;
}

.cuenta {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.interruptor {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0;
  border: 0;
  background: none;
  color: var(--tinta);
  font-weight: 700;
  cursor: pointer;
}

.interruptor-pista {
  position: relative;
  width: 2.3rem;
  height: 1.3rem;
  border: 2px solid var(--grafito);
  border-radius: 1rem;
  transition: background-color 0.15s, border-color 0.15s;
}

.interruptor-pista::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--grafito);
  transition: translate 0.15s ease-out, background-color 0.15s;
}

.interruptor[aria-pressed="true"] .interruptor-pista {
  border-color: var(--birome);
  background: var(--birome);
}

.interruptor[aria-pressed="true"] .interruptor-pista::after {
  translate: 1rem 0;
  background: var(--sobre-color);
}

/* --- Bandas, avisos y vacíos ----------------------------------------------------------- */

.banda {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  max-width: 100rem;
  margin: 1rem auto 0;
  padding: 0.75rem clamp(1rem, 3vw, 2.5rem);
  border-left: 4px solid var(--lapicera);
  background: var(--error-fondo);
  color: var(--error-texto);
  font-weight: 700;
}

.banda p {
  margin: 0;
}

.sin-resultados,
.vacio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.sin-resultados p,
.vacio p {
  margin: 0;
}

.error {
  margin: 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--lapicera);
  background: var(--error-fondo);
  color: var(--error-texto);
  font-weight: 700;
}

.aviso-ok {
  margin: 0;
  color: var(--ok-texto);
  font-weight: 700;
}

.notificacion {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  translate: -50% 0;
  max-width: min(38rem, calc(100% - 2rem));
  padding: 0.75rem 1.25rem;
  border-radius: var(--radio);
  background: var(--tinta);
  color: var(--papel);
  font-weight: 700;
  box-shadow: var(--sombra);
}

.notificacion .enlace {
  color: inherit;
  white-space: nowrap;
}

/* --- Hoja con las categorías ------------------------------------------------------------ */

main#contenido {
  width: 100%;
  max-width: 100rem;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 4rem;
}

main#contenido:focus {
  outline: none;
}

/* Las categorías fluyen en columnas, como en el Excel. */
.hoja {
  columns: 3 23rem;
  column-gap: 3rem;
}

.hoja[data-comparar] {
  columns: 2 30rem;
}

.categoria {
  margin-bottom: 2rem;
  padding: 0 0.25rem;
  border-radius: var(--radio);
  /* Cada categoría queda entera en una columna, con su título arriba. */
  break-inside: avoid;
  transition: background-color 0.12s;
}

/* Mientras se arrastra un producto, la categoría de destino se marca. */
.categoria.destino {
  background: var(--destino);
  outline: 2px dashed var(--birome);
  outline-offset: 2px;
}

.titulo-categoria {
  display: grid;
  grid-template-columns: 1rem 1fr;
  align-items: center;
  column-gap: 0.4rem;
  padding: 0.25rem 0 0.35rem;
  list-style: none;
  cursor: pointer;
}

.titulo-categoria::-webkit-details-marker {
  display: none;
}

.titulo-categoria h2 {
  grid-column: 2;
  margin: 0;
  color: var(--birome);
  font: 700 1.6rem/1.15 var(--mano);
}

.icono-flecha {
  grid-row: 1;
  color: var(--grafito);
  transition: rotate 0.15s ease-out;
}

details:not([open]) .icono-flecha {
  rotate: -90deg;
}

.resumen {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--grafito);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.resumen-faltan {
  padding: 0 0.3rem;
  border-radius: 3px;
  background: var(--resaltador);
  color: var(--tinta);
  font-weight: 700;
}

.resumen-faltan:empty {
  display: none;
}

/* Títulos de las columnas de precios (solo al comparar con Día). */
.columnas {
  display: none;
  justify-content: flex-end;
  gap: 0.25rem;
  padding-right: 3.85rem;
  color: var(--grafito);
  font-size: 0.8rem;
  font-weight: 700;
}

.columnas span {
  width: var(--ancho-precio);
  text-align: right;
}

.hoja[data-comparar] .con-precios .columnas {
  display: flex;
}

.productos {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

/* --- Producto -------------------------------------------------------------------------- */

.producto {
  --color-resaltador: var(--resaltador);

  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  border-radius: var(--radio);
  break-inside: avoid;
}

.producto[data-estado="urgente"] {
  --color-resaltador: var(--resaltador-urgente);
}

.producto:hover {
  background: var(--pasar-mouse);
}

.producto.arrastrando {
  opacity: 0.45;
}

.producto.recien-movido {
  animation: senalar 2.2s ease-out;
}

@keyframes senalar {
  from {
    background: var(--destino);
    box-shadow: inset 3px 0 0 var(--birome);
  }
}

/* Agarradera para arrastrar: aparece al pasar el mouse, en el margen. */
.agarre {
  position: absolute;
  left: -1.05rem;
  top: 0.55rem;
  display: grid;
  place-items: center;
  width: 0.9rem;
  height: 1.2rem;
  color: var(--grafito);
  opacity: 0;
  cursor: grab;
}

.agarre .icono {
  width: 0.6rem;
  height: 1rem;
}

.producto:hover .agarre {
  opacity: 1;
}

.tilde {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.38rem 0.4rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.casilla {
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.17rem;
  flex: none;
  border: 2px solid var(--grafito);
  border-radius: 3px;
  background: var(--superficie);
  color: var(--sobre-color);
}

.casilla .icono {
  width: 0.85rem;
  height: 0.85rem;
  opacity: 0;
}

.tilde[aria-pressed="true"] .casilla {
  border-color: var(--birome);
  background: var(--birome);
}

.tilde[aria-pressed="true"] .casilla .icono {
  opacity: 1;
}

.nombre {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* El resaltador: un trazo que se "pasa" de izquierda a derecha al marcar. */
.resaltado {
  margin: 0 -0.2em;
  padding: 0 0.2em;
  background-image: linear-gradient(100deg, transparent 0.08em,
    var(--color-resaltador) 0.2em, var(--color-resaltador) calc(100% - 0.15em),
    transparent calc(100% - 0.02em));
  background-repeat: no-repeat;
  background-position: 0 65%;
  background-size: 0% 78%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 0.3s ease-out;
}

.producto:not([data-estado="no_falta"]) .resaltado {
  background-size: 100% 78%;
}

.detalle {
  color: var(--grafito);
}

.producto:not([data-estado="no_falta"]) .detalle {
  color: var(--tinta-suave);
}

/* En "Faltan" o "Urgentes", lo que se desmarca queda tachado, como en papel,
   hasta cambiar de filtro: así se ve lo que ya se compró. */
.hoja:not([data-filtro="todo"]) .producto[data-estado="no_falta"] .nombre {
  color: var(--grafito);
  text-decoration: line-through 2px var(--birome);
}

.urgente,
.editar {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  margin-top: 0.12rem;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--grafito);
  cursor: pointer;
}

.urgente {
  font: 700 1.05rem/1 var(--texto);
  opacity: 0.35;
}

.urgente:hover,
.urgente:focus-visible,
.producto:hover .urgente {
  opacity: 1;
}

.urgente:hover {
  color: var(--lapicera);
}

.urgente[aria-pressed="true"] {
  opacity: 1;
  background: var(--lapicera);
  color: var(--sobre-color);
}

.editar {
  opacity: 0;
}

.producto:hover .editar,
.editar:focus-visible {
  opacity: 1;
}

.editar:hover {
  color: var(--birome);
}

.hoja.filtrando .agregar-aca {
  display: none;
}

.agregar-aca {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--grafito);
  font-size: 0.92rem;
  cursor: pointer;
}

.agregar-aca:hover {
  color: var(--birome);
  text-decoration: underline;
}

/* --- Precio ---------------------------------------------------------------------------- */

.precio {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: var(--ancho-precio);
  flex: none;
  padding: 0.38rem 0.15rem 0.3rem 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: right;
}

.hoja:not([data-comparar]) .precio[data-tienda="dia"],
.producto:not(.con-precio) .precio {
  display: none;
}

.monto {
  color: var(--tinta);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

a.monto:hover {
  color: var(--birome);
  text-decoration: underline;
}

.antes {
  color: var(--grafito);
  font-size: 0.78rem;
  white-space: nowrap;
}

.antes s {
  text-decoration-thickness: 1px;
}

.promo {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.1rem 0.3rem;
  margin-top: 0.2rem;
  color: var(--birome);
  font-size: 0.78rem;
  font-weight: 700;
}

.promo > span {
  white-space: nowrap;
}

/* La promoción, como un sello de birome. */
.promo-etiqueta {
  padding: 0 0.25rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  line-height: 1.3;
}

.promo-tarjeta {
  color: var(--grafito);
  font-weight: 400;
  white-space: nowrap;
}

.sin-precio {
  padding-top: 0.08rem;
  color: var(--grafito);
  font-size: 0.85rem;
}

.precio-viejo .monto {
  color: var(--grafito);
  font-weight: 400;
}

.precio-viejo .monto::after {
  content: " ?";
  color: var(--lapicera);
  font-weight: 700;
}

/* Al comparar, el más barato queda "encerrado con birome". */
.mas-barato .monto {
  margin: -0.1rem -0.35rem;
  padding: 0.05rem 0.35rem;
  border: 2px solid var(--birome);
  border-radius: 50% 46% 52% 44% / 55% 50% 48% 52%;
  rotate: -2deg;
}

/* --- Diálogos -------------------------------------------------------------------------- */

.dialogo {
  width: min(38rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--tinta);
  box-shadow: var(--sombra);
}

.dialogo-chico {
  width: min(26rem, calc(100% - 2rem));
}

.dialogo::backdrop {
  background: var(--fondo-dialogo);
}

.dialogo[open] {
  animation: aparecer 0.14s ease-out;
}

@keyframes aparecer {
  from {
    opacity: 0;
    translate: 0 0.5rem;
  }
}

.dialogo > .formulario {
  padding: 1.25rem clamp(1.25rem, 4vw, 1.75rem) 1.5rem;
}

.dialogo-encabezado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: -0.25rem;
}

.dialogo-encabezado h2 {
  margin: 0;
  color: var(--birome);
  font: 700 1.8rem/1.2 var(--mano);
}

.fila-separada {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.fila-separada p {
  margin: 0;
}

/* --- Formularios ----------------------------------------------------------------------- */

.formulario {
  display: grid;
  gap: 1.1rem;
}

.campo {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.campo > label,
.campo > legend {
  padding: 0;
  font-weight: 700;
}

.opcional {
  color: var(--grafito);
  font-weight: 400;
}

input:not([type="radio"], [type="search"]),
select {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--tinta);
  font: inherit;
}

input:not([type="radio"], [type="search"]):focus,
select:focus {
  border-color: var(--birome);
  outline: none;
}

input[aria-invalid="true"] {
  border-color: var(--lapicera);
}

.ayuda,
.cantidad {
  margin: 0;
  color: var(--grafito);
  font-size: 0.92rem;
}

.fila-campos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem;
}

.fila-boton {
  display: flex;
  gap: 0.5rem;
}

.fila-boton input {
  flex: 1;
}

.tamanio {
  display: grid;
  grid-template-columns: 1fr 5rem;
  gap: 0.5rem;
}

.tiendas {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 2px dashed var(--linea);
  border-radius: var(--radio);
}

.tiendas .ayuda.listo {
  color: var(--ok-texto);
  font-weight: 700;
}

.opciones-estado {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.opcion-estado {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  cursor: pointer;
}

.opcion-estado input {
  margin: 0;
  accent-color: var(--birome);
}

.opcion-estado:has(input:checked) {
  border-color: var(--tinta);
  font-weight: 700;
}

.opcion-estado[data-estado="falta"]:has(input:checked) {
  background: var(--resaltador);
}

.opcion-estado[data-estado="urgente"]:has(input:checked) {
  border-color: var(--lapicera);
  background: var(--resaltador-urgente);
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.acciones .enlace-peligro {
  margin-left: auto;
}

.lista-categorias,
.lista-personas {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lista-categorias li,
.lista-personas li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--linea);
}

.lista-categorias .fila-boton {
  flex: 1 1 16rem;
}

.lista-categorias .cantidad {
  min-width: 6.5rem;
}

.lista-personas li > span {
  flex: 1;
}

.seccion-cuenta {
  padding-top: 0.75rem;
  border-top: 1px solid var(--linea);
}

.seccion-cuenta > summary {
  font-weight: 700;
  cursor: pointer;
}

.seccion-cuenta[open] > summary {
  margin-bottom: 0.9rem;
}

.seccion-cuenta .lista-personas {
  margin-bottom: 1rem;
}

/* --- Pantallas chicas y dispositivos táctiles --------------------------------------------- */

@media (hover: none) {
  .editar,
  .urgente {
    opacity: 0.6;
  }

  .agarre {
    display: none;
  }
}

@media (max-width: 52rem) {
  .estado-precios {
    order: 5;
    flex-basis: 100%;
    margin: 0;
    text-align: left;
  }
}

@media (max-width: 40rem) {
  .marca {
    font-size: 1.6rem;
  }

  .buscador {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .atajo {
    display: none;
  }

  .herramientas {
    flex-wrap: wrap;
  }

  .acciones-lista {
    flex-wrap: wrap;
    width: 100%;
  }

  .acciones-lista .boton-principal {
    flex: 1;
  }

  .tilde {
    padding-block: 0.55rem;
  }

  .fila-boton {
    flex-wrap: wrap;
  }

  /* El nombre ocupa toda la fila; los precios van abajo, a la derecha. */
  .producto {
    flex-wrap: wrap;
  }

  .tilde {
    flex-basis: calc(100% - 4.25rem);
  }

  .precio {
    order: 4;
    width: auto;
    min-width: 5.5rem;
    padding-top: 0;
  }

  .precio[data-tienda="carrefour"] {
    margin-left: auto;
  }

  .urgente,
  .editar {
    order: 2;
  }

  .hoja[data-comparar] .con-precios .columnas {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
