/* Costito · el recetario de la cocina: fichas de receta con su renglón rojo, tinta de birome azul,
   el margen rojo del cuaderno y la regla de la balanza. En la cuenta, los renglones llevan puntitos
   hasta el número, como en los recetarios impresos; los totales van con doble subrayado, como en las cuentas a mano.
   Letras (OFL, en esta carpeta): Young Serif para títulos, Figtree para leer y para la plata.
   Esquinas: 10 px en todo; los atajos de ganancia son redondos. */
@font-face { font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("cos-young-serif-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("cos-figtree-400-800.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --papel: #E8EBE7;
  --hoja: #FAFAF7;
  --tinta: #1B2233;
  --tinta2: #535C6D;
  --linea: #CFD4D1;
  --borde-campo: #868D8A;
  --renglon: #D6DCEF;
  --puntos: #AEB5C4;
  --azul: #2743C4;
  --azul-tinta: #FFFFFF;
  --azul-hondo: #1A2E8C;
  --azul-suave: #E3E8FB;
  --margen: #D8434F;
  --rojo: #B3303B;
  --verde: #0C7350;
  --cinta: rgba(236, 222, 160, .8);
  --sombra: 0 1px 2px rgba(27, 34, 51, .07), 0 6px 16px rgba(27, 34, 51, .05);
  --sombra-hoja: 0 -10px 30px rgba(10, 12, 20, .18);
  --fuente: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --radio: 10px;
  --suave: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papel: #0F1219;
    --hoja: #191D28;
    --tinta: #EEF0F5;
    --tinta2: #A3ABBC;
    --linea: #2C3242;
    --borde-campo: #6B7490;
    --renglon: #293152;
    --puntos: #4C5570;
    --azul: #9DB0FF;
    --azul-tinta: #0B1130;
    --azul-hondo: #6F86E8;
    --azul-suave: #222B50;
    --margen: #E5727B;
    --rojo: #FF8C92;
    --verde: #5AD3A6;
    --cinta: rgba(214, 200, 140, .3);
    --sombra: 0 1px 2px rgba(0, 0, 0, .4);
    --sombra-hoja: 0 -10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 16px/1.42 var(--fuente);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-weight: 400; }

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(170px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
}

/* ---------- Encabezado ---------- */
.tope { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 36px; }
.tope h1 { font: 400 28px/1.15 var(--serif); letter-spacing: -.01em; }
.marca { color: var(--azul); border-bottom: 4px double var(--azul); padding-bottom: 2px; }
.cuenta-de { color: var(--tinta2); font-size: 14px; font-weight: 600; white-space: nowrap; }
/* la regla de la balanza: una rayita cada 8 px y una más larga cada 40 */
.regla {
  height: 10px;
  margin-top: -6px;
  opacity: .55;
  background:
    repeating-linear-gradient(90deg, var(--tinta2) 0 1.5px, transparent 1.5px 40px) 0 0 / 100% 10px no-repeat,
    repeating-linear-gradient(90deg, var(--tinta2) 0 1px, transparent 1px 8px) 0 0 / 100% 5px no-repeat;
}
.bajada { color: var(--tinta2); font-size: 15px; }
.subtitulo { font: 400 19px/1.2 var(--serif); margin-top: 6px; }
.volver { background: none; border: 0; padding: 8px 10px 8px 0; min-height: 44px; font-weight: 700; color: var(--azul); font-size: 16px; }

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > span { font-size: 14px; font-weight: 650; }
.campo small { color: var(--tinta2); font-size: 13px; }
input[type="text"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--borde-campo);
  border-radius: var(--radio);
  background: var(--hoja);
  color: var(--tinta);
  transition: border-color .15s, box-shadow .15s;
}
textarea { line-height: 1.5; resize: vertical; min-height: 170px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
input[aria-invalid="true"] { border-color: var(--rojo); }
.con-signo { position: relative; display: block; }
.con-signo input { padding-left: 30px; font-variant-numeric: tabular-nums; }
.con-signo.atras input { padding-left: 12px; padding-right: 34px; }
.con-signo i { position: absolute; top: 50%; transform: translateY(-50%); left: 12px; font-style: normal; font-weight: 600; color: var(--tinta2); pointer-events: none; }
.con-signo.atras i { left: auto; right: 12px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.dos-tres { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; }

/* ---------- Botones ---------- */
.btn {
  min-height: 50px;
  padding: 12px 18px;
  border-radius: var(--radio);
  border: 1.5px solid var(--tinta);
  background: var(--hoja);
  font-weight: 750;
  text-align: center;
  transition: transform .12s var(--suave), box-shadow .12s var(--suave), background-color .15s;
}
.btn:active { transform: translateY(2px); }
.btn.fuerte { background: var(--azul); color: var(--azul-tinta); border-color: var(--azul); box-shadow: 0 3px 0 var(--azul-hondo); }
.btn.fuerte:active { box-shadow: 0 1px 0 var(--azul-hondo); }
.btn.suave { border-color: var(--borde-campo); font-weight: 650; }
.btn.peligro { border-color: var(--rojo); color: var(--rojo); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.ancho { width: 100%; }
.link { background: none; border: 0; padding: 10px 0; min-height: 44px; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; font-weight: 700; color: var(--azul); text-align: left; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--borde-campo);
  background: var(--hoja);
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: transform .12s var(--suave), background-color .15s;
}
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--azul); color: var(--azul-tinta); border-color: var(--azul); }

/* ---------- Listas: la ficha del recetario, con su renglón rojo arriba ---------- */
.lista { list-style: none; margin: 0; padding: 0; background: var(--hoja); border-radius: var(--radio); border-top: 4px solid var(--margen); box-shadow: var(--sombra); overflow: hidden; }
.lista li + li { border-top: 1.5px solid var(--renglon); }
.fila {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: none;
  border: 0;
  text-align: left;
  min-height: 66px;
  transition: background-color .15s;
}
button.fila:active { background: var(--azul-suave); }
label.fila { cursor: pointer; }
.fila.suelta { padding: 4px 0; min-height: 44px; }
.fila .que { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fila .nombre { font-weight: 700; font-size: 16.5px; overflow-wrap: anywhere; }
.fila .datos { color: var(--tinta2); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.fila input[type="checkbox"] { width: 24px; height: 24px; flex: none; accent-color: var(--azul); }
.precio-col { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.precio-col small { color: var(--tinta2); font-size: 12px; }
.precio {
  font-weight: 800;
  font-size: 19px;
  line-height: 1.15;
  color: var(--azul);
  border-bottom: 3px double var(--azul);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chico { font-weight: 750; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dif { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--tinta2); font-variant-numeric: tabular-nums; }
.dif.sube { color: var(--rojo); }
.dif.baja { color: var(--verde); }

.aviso { background: var(--hoja); border: 1.5px dashed var(--tinta2); border-radius: var(--radio); padding: 12px 14px 8px; font-size: 14.5px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }

.vacio { text-align: center; padding: 30px 8px 8px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.vacio.corto { padding-top: 18px; }
.vacio h2 { font: 400 23px/1.2 var(--serif); text-wrap: balance; }
.vacio p { color: var(--tinta2); max-width: 36ch; }
.vacio .btn { width: 100%; max-width: 340px; }
/* el plato de la balanza, con sus rayitas */
.pesa {
  width: 104px; height: 104px; border-radius: 50%;
  background: repeating-conic-gradient(var(--tinta2) 0 1.2deg, transparent 1.2deg 12deg);
  display: grid; place-items: center;
}
.pesa span {
  width: 84px; height: 84px; border-radius: 50%; background: var(--hoja);
  display: grid; place-items: center;
  font: 400 44px/1 var(--serif); color: var(--azul);
}

.fab {
  position: fixed;
  right: max(16px, calc(50vw - 344px));
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
}

/* ---------- Tarjetas ---------- */
.tarjeta { background: var(--hoja); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.tarjeta h2 { font: 400 19px/1.2 var(--serif); padding-bottom: 9px; border-bottom: 1.5px solid var(--renglon); }
.tarjeta p { color: var(--tinta2); font-size: 14.5px; }
.nota { color: var(--tinta2); font-size: 13.5px; }
.previa { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.previa td { padding: 8px 0; border-top: 1.5px solid var(--renglon); vertical-align: top; }
.previa td:first-child { overflow-wrap: anywhere; padding-right: 8px; font-weight: 650; }
.previa td:first-child .nota { font-weight: 400; }
.previa td.n { text-align: right; white-space: nowrap; }
.previa .antes { color: var(--tinta2); text-decoration: line-through; padding-right: 8px; }
.previa .ahora { font-weight: 800; font-size: 16px; }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; }
.acciones .btn { flex: 1 1 150px; }
.gana { color: var(--verde); font-weight: 700; font-size: 15px; }
.gana:empty { display: none; }
.gana.pierde { color: var(--rojo); }

/* ---------- Lo que cambió: la nota pegada con cinta, es lo primero que tiene que verse ---------- */
.novedad { position: relative; margin-top: 6px; background: var(--azul-suave); border: 2px solid var(--azul); border-radius: var(--radio); padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.novedad::before { content: ""; position: absolute; top: -12px; left: 50%; width: 88px; height: 22px; margin-left: -44px; background: var(--cinta); transform: rotate(-3deg); pointer-events: none; }
.novedad .sello { font-size: 13.5px; font-weight: 750; color: var(--azul); }
.novedad h2 { font: 400 21px/1.2 var(--serif); text-wrap: balance; }
.novedad p { font-size: 14.5px; }
.novedad .previa td { border-top-color: var(--azul); }
.efecto { background: var(--azul-suave); border-radius: var(--radio); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
#i-efecto:empty { display: none; }
#i-efecto { display: flex; flex-direction: column; gap: 6px; }
#i-efecto h3, .efecto h3 { font-size: 15px; margin: 0; }

/* ---------- Los ingredientes de una receta ---------- */
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.items:empty { display: none; }
.items li { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 10px 0; border-top: 1.5px solid var(--renglon); }
.items li:first-child { border-top: 0; padding-top: 0; }
.i-nombre { font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.i-costo { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.i-cant { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 92px 48px; gap: 8px; }
.i-cant input { font-variant-numeric: tabular-nums; }
.quitar { background: none; border: 1.5px solid var(--borde-campo); border-radius: var(--radio); min-height: 48px; min-width: 44px; font-size: 22px; line-height: 1; color: var(--tinta2); }

/* ---------- La cuenta: una hoja de libreta, con puntitos hasta cada número ---------- */
.cuenta {
  background:
    linear-gradient(90deg, transparent 15px, var(--margen) 15px, var(--margen) 16.5px, transparent 16.5px),
    var(--hoja);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 16px 16px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.cuenta h2 { font: 400 20px/1.2 var(--serif); margin-bottom: 2px; }
.renglon { display: flex; gap: 6px; align-items: baseline; font-size: 15px; }
.renglon > span { min-width: 0; }
.renglon::after { content: ""; order: 1; flex: 1 1 12px; min-width: 12px; border-bottom: 2px dotted var(--puntos); transform: translateY(-4px); }
.renglon b { order: 2; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 650; }
.renglon.suma { font-weight: 750; padding-top: 9px; border-top: 1.5px solid var(--tinta); }
.renglon.suma::after { border-bottom-color: var(--tinta2); }
.renglon.suma b { font-weight: 800; }
.venta { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 10px; }
.venta span { font: 400 17px/1.2 var(--serif); max-width: 16ch; }
.total { font-size: 38px; line-height: 1.1; font-weight: 800; color: var(--azul); border-bottom: 5px double var(--azul); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.02em; }

.marco { background: var(--hoja); border-radius: var(--radio); box-shadow: var(--sombra); padding: 10px; display: flex; justify-content: center; }
.marco canvas { width: 100%; max-width: 380px; height: auto; display: block; border: 1px solid var(--linea); }

.hoja h3 { margin: 6px 0 0; font-size: 16px; }
.hoja .lista { box-shadow: none; border: 1.5px solid var(--linea); border-top: 4px solid var(--margen); }

/* ---------- Pestañas ---------- */
.pestanas {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  background: var(--hoja);
  border-top: 1.5px solid var(--linea);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.pestanas div { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pestanas button {
  position: relative;
  background: none;
  border: 0;
  min-height: 54px;
  border-radius: var(--radio);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.15;
  color: var(--tinta2);
  transition: color .15s;
}
.pestanas button:active svg { transform: scale(.9); }
.pestanas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s var(--suave); }
/* la pestaña abierta: tinta azul y la rayita roja del margen arriba */
.pestanas button[aria-current="page"] { color: var(--azul); font-weight: 750; }
.pestanas button[aria-current="page"]::before { content: ""; position: absolute; top: -7px; left: 50%; width: 34px; height: 3px; margin-left: -17px; border-radius: 0 0 3px 3px; background: var(--margen); }
.pestanas .globo { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rojo); color: #fff; font-size: 11px; line-height: 18px; font-weight: 750; }

/* ---------- Ventanas: la ficha sube desde abajo ---------- */
dialog {
  border: 0;
  padding: 0;
  background: var(--hoja);
  color: var(--tinta);
  width: min(560px, 100%);
  max-width: 100%;
  max-height: 92vh;
  border-radius: 16px 16px 0 0;
  margin: auto auto 0;
  overflow: auto;
  box-shadow: var(--sombra-hoja);
}
dialog::before { content: ""; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--linea); }
dialog::backdrop { background: rgba(10, 12, 20, .55); }
@media (min-width: 620px) { dialog { border-radius: 16px; margin: auto; } dialog::before { display: none; } }
.hoja { padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.hoja h2 { font: 400 22px/1.2 var(--serif); }
.hoja .cabeza { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cerrar { background: none; border: 0; width: 44px; height: 44px; font-size: 26px; line-height: 1; border-radius: 50%; color: var(--tinta2); flex: none; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  background: var(--tinta);
  color: var(--papel);
  padding: 12px 16px;
  border-radius: var(--radio);
  font-size: 15px;
  font-weight: 650;
  width: max-content;
  max-width: calc(100vw - 32px);
  box-shadow: var(--sombra);
}

@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: sube .28s var(--suave); }
  dialog[open]::backdrop { animation: aparece .2s ease-out; }
  .toast:not([hidden]) { animation: cartel .26s var(--suave); }
  .novedad { animation: aparece .35s ease-out; }
  @media (min-width: 620px) { dialog[open] { animation: aparece .2s ease-out; } }
  @keyframes sube { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
  @keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
  @keyframes cartel { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
