/* App Dorotea & Teodoro · inicio, entrada y ajustes. Sistema visual de DESIGN.md (tokens del inventario). */
:root {
  --fondo: #f5f2ef;
  --carta: #ffffff;
  --tinta: #161311;
  --tinta-2: #5a524b;
  --linea: #e3ddd7;
  --linea-2: #cfc7bf;
  --naranja: #b94f0f;
  --naranja-texto: #a9470c;
  --naranja-suave: #fbeee5;
  --almacen: #36587a;
  --falta: #a8231b;
  --falta-suave: #fbe7e5;
  --ok: #3f6a2c;
  --banda: #161311;
  --sobre-banda: #ffffff;
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --texto: "Open Sans", "Segoe UI", system-ui, sans-serif;
  --radio: 14px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --sombra: 0 1px 2px rgba(22,19,17,.06), 0 6px 18px -8px rgba(22,19,17,.18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #131110; --carta: #1d1a18; --tinta: #f4efea; --tinta-2: #b9b0a8; --linea: #34302c; --linea-2: #4a443f;
    --naranja-texto: #f08a4b; --naranja-suave: #3a2416; --falta: #f08378; --falta-suave: #3b1b18; --ok: #9cc47f; --banda: #0b0a09;
    --sombra: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px -8px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fondo: #131110; --carta: #1d1a18; --tinta: #f4efea; --tinta-2: #b9b0a8; --linea: #34302c; --linea-2: #4a443f;
  --naranja-texto: #f08a4b; --naranja-suave: #3a2416; --falta: #f08378; --falta-suave: #3b1b18; --ok: #9cc47f; --banda: #0b0a09;
  --sombra: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px -8px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--fondo); color: var(--tinta); font: 400 16px/1.45 var(--texto); min-height: 100dvh; }
::selection { background: var(--naranja); color: #fff; }
:focus-visible { outline: 3px solid var(--naranja); outline-offset: 2px; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; font-variation-settings: "opsz" 10; letter-spacing: .01em; line-height: 1.15; }
p { margin: 0; }
.ico { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
main:focus { outline: none; }
.cargando { padding: 40vh 16px 0; text-align: center; color: var(--tinta-2); }

/* ---------- Sello del escudo ---------- */
.sello { position: relative; width: 44px; height: 44px; flex: none; }
.sello svg { width: 100%; height: 100%; display: block; }
.sello-forma { fill: var(--naranja); }
.sello-filete { fill: none; stroke: #fff; stroke-width: 2.4; }
.sello b { position: absolute; inset: 0; display: grid; place-items: center; font: 600 13px/1 var(--display); font-variation-settings: "opsz" 10; color: #fff; }
.sello.grande { width: 96px; height: 96px; }
.sello.grande b { font-size: 27px; }

/* ---------- Banda superior ---------- */
.banda { position: sticky; top: 0; z-index: 10; background: var(--banda); color: var(--sobre-banda); padding-top: env(safe-area-inset-top, 0px); }
.banda-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.marca-txt { display: grid; min-width: 0; }
.marca-txt b { font: 600 1.15rem/1.15 var(--display); font-variation-settings: "opsz" 10; }
.marca-txt span { font-size: .8rem; color: rgba(255,255,255,.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banda .relleno { flex: 1; }
.redondo { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid rgba(255,255,255,.3); background: transparent; color: inherit; transition: transform 160ms var(--ease-out), background-color 160ms ease; text-decoration: none; }
.redondo .ico { width: 20px; height: 20px; }
.redondo:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .redondo:hover { background: rgba(255,255,255,.12); } }

/* ---------- Contenido ---------- */
.contenido { max-width: 1040px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.saludo { margin-bottom: 18px; }
.saludo h1 { font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.2rem); }
.saludo p { color: var(--tinta-2); margin-top: 4px; }

/* Tarjetas de módulo: grandes, una por herramienta (RF-9) */
.modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.modulo {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; row-gap: 2px; align-items: center;
  padding: 20px; min-height: 112px; border-radius: var(--radio); background: var(--carta); border: 1.5px solid var(--linea);
  box-shadow: var(--sombra); color: inherit; text-decoration: none; transition: transform 160ms var(--ease-out), border-color 160ms ease;
}
.modulo:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { a.modulo:hover { border-color: var(--linea-2); } }
.modulo .disco { grid-row: 1 / span 2; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--tinta); color: var(--carta); }
.modulo .disco .ico { width: 28px; height: 28px; }
.modulo[data-modulo="sumiller"] .disco { background: var(--naranja); color: #fff; }
.modulo[data-modulo="inventario"] .disco { background: var(--almacen); color: #fff; }
.modulo b { font: 600 1.35rem/1.15 var(--display); font-variation-settings: "opsz" 10; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modulo span.desc { color: var(--tinta-2); font-size: .92rem; line-height: 1.35; }
.modulo.apagado { opacity: .55; box-shadow: none; cursor: default; }
.etiqueta { font: 700 .68rem/1 var(--texto); letter-spacing: .05em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: var(--naranja-suave); color: var(--naranja-texto); }
.etiqueta.gris { background: var(--linea); color: var(--tinta-2); }
.vacio { padding: 28px 20px; text-align: center; color: var(--tinta-2); border: 1.5px dashed var(--linea-2); border-radius: var(--radio); }

/* ---------- Formularios ---------- */
.campo { display: grid; gap: 6px; margin-bottom: 14px; }
.campo label, .campo .rotulo { font-weight: 600; font-size: .92rem; }
.campo input, .campo select { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--linea-2); background: var(--carta); }
.campo input:focus { border-color: var(--naranja); outline: none; box-shadow: 0 0 0 3px var(--naranja-suave); }
.ayuda { font-size: .82rem; color: var(--tinta-2); }
.error { color: var(--falta); background: var(--falta-suave); border-radius: 10px; padding: 10px 12px; font-size: .92rem; margin-bottom: 14px; }
.exito { color: var(--ok); font-weight: 600; font-size: .92rem; margin-bottom: 14px; }
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid var(--tinta); background: var(--tinta); color: var(--carta); font-weight: 700;
  transition: transform 160ms var(--ease-out), opacity 160ms ease; text-decoration: none;
}
.boton:active { transform: scale(.97); }
.boton[disabled] { opacity: .55; cursor: progress; }
.boton.claro { background: transparent; color: var(--tinta); border-color: var(--linea-2); }
.boton.peligro { background: transparent; color: var(--falta); border-color: currentColor; }
.boton.ancho { width: 100%; }
.boton.pequeno { min-height: 38px; padding: 0 14px; font-size: .88rem; }
.boton .ico { width: 18px; height: 18px; }
.enlace { background: none; border: 0; padding: 8px 0; color: var(--naranja-texto); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 6px; }
.casillas { display: grid; gap: 8px; }
.casilla { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--linea-2); background: var(--carta); }
.casilla input { width: 20px; height: 20px; accent-color: var(--naranja); }

/* ---------- Entrada ---------- */
.entrada { min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px)); }
.entrada-caja { width: min(100%, 400px); }
.entrada-cab { display: grid; justify-items: center; gap: 12px; text-align: center; margin-bottom: 26px; }
.entrada-cab h1 { font-size: 2rem; }
.entrada-cab p { color: var(--tinta-2); }
.tarjeta { background: var(--carta); border: 1.5px solid var(--linea); border-radius: 18px; padding: 22px; box-shadow: var(--sombra); }
.publico { margin-top: 18px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radio); border: 1.5px solid var(--linea); background: var(--carta); color: inherit; text-decoration: none; }
.publico .disco { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--naranja); color: #fff; flex: none; }
.publico .disco .ico { width: 22px; height: 22px; }
.publico b { display: block; }
.publico span { font-size: .86rem; color: var(--tinta-2); }
.ios { margin-top: 14px; display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--tinta-2); }
.ios .ico { width: 18px; height: 18px; margin-top: 2px; color: var(--naranja-texto); }

/* Teclado del PIN del mostrador */
.pin-puntos { display: flex; justify-content: center; gap: 14px; margin: 6px 0 18px; }
.pin-puntos i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--tinta-2); transition: background-color 120ms ease, transform 160ms var(--ease-out); }
.pin-puntos i.lleno { background: var(--tinta); border-color: var(--tinta); transform: scale(1.1); }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.teclado button { min-height: 64px; border-radius: 14px; border: 1.5px solid var(--linea); background: var(--fondo); font: 600 1.5rem/1 var(--texto); font-variant-numeric: tabular-nums; transition: transform 120ms var(--ease-out); display: grid; place-items: center; }
.teclado button:active { transform: scale(.95); }
.teclado button .ico { width: 24px; height: 24px; }

/* ---------- Ajustes y listas ---------- */
.cabecera { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; column-gap: 14px; margin-bottom: 18px; }
.volver { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--linea-2); background: var(--carta); color: var(--tinta); display: grid; place-items: center; text-decoration: none; transition: transform 160ms var(--ease-out); }
.volver:active { transform: scale(.97); }
.volver .ico { width: 20px; height: 20px; }
.cabecera h1 { font-size: clamp(1.5rem, 1rem + 1.6vw, 2.1rem); padding-top: calc((44px - 1.15em) / 2); }
.cabecera h1 small { display: block; font: 400 .9rem/1.3 var(--texto); color: var(--tinta-2); margin-top: 4px; }
.seccion { margin-bottom: 22px; }
.seccion > h2 { font-size: 1.25rem; margin-bottom: 10px; }
.lista { list-style: none; margin: 0; padding: 0; background: var(--carta); border: 1.5px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
.lista > li + li { border-top: 1.5px solid var(--linea); }
.fila { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 16px; background: none; border: 0; text-align: left; color: inherit; text-decoration: none; }
.fila > .ico { width: 22px; height: 22px; color: var(--tinta-2); }
.fila .txt { flex: 1; min-width: 0; display: grid; }
.fila .txt b { font-weight: 600; }
.fila .txt span { font-size: .86rem; color: var(--tinta-2); overflow-wrap: anywhere; }
.fila .acciones { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fila.retirada { opacity: .6; }
.dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) {
  .dos { grid-template-columns: minmax(0, 1fr); }
  .fila { flex-wrap: wrap; }
  .fila .acciones { width: 100%; justify-content: flex-start; padding-left: 36px; }
}
dl.datos { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: .92rem; }
dl.datos dt { color: var(--tinta-2); }
dl.datos dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Avisos ---------- */
.aviso-red { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--tinta); color: var(--carta); font-size: .82rem; font-weight: 600; box-shadow: var(--sombra); }
.aviso-red .ico { width: 16px; height: 16px; }
.aviso-version { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 999px; background: var(--tinta); color: var(--carta); box-shadow: var(--sombra); font-weight: 600; font-size: .92rem; white-space: nowrap; animation: subir 240ms var(--ease-out); }
.aviso-version .boton.claro { color: var(--carta); border-color: rgba(255,255,255,.4); }
.avisos-dev { margin-top: 18px; }
@keyframes subir { from { opacity: 0; transform: translate(-50%, 12px); } }
@media (prefers-reduced-motion: reduce) { .aviso-version { animation: none; } .modulo, .boton, .redondo, .volver, .teclado button { transition: none; } }
