/* ===================================================================
   SírveME · tokens y componentes compartidos (sitio del cliente y panel)
   Estilo «Aguayo»: franjas andinas, ángulos rectos, bordes de 2 px,
   Unbounded para títulos y Manrope para el texto.
   En el sitio del cliente, --marca y --acento son los colores del
   negocio (los pone SM.aplicarMarca); en el panel, los de SírveME.
   =================================================================== */
:root {
  --papel: #F6F5F2;
  --superficie: #FFFFFF;
  --superficie-2: #F3F3F1;
  --hundido: #E8E7E3;
  --tinta: #1A1A1A;
  --tinta-2: #4D4D4D;
  --tinta-3: #767676;
  --linea: #1A1A1A;
  --linea-suave: #DAD8D2;
  --marca: #2F5D50;
  --marca-tinta: #FFFFFF;
  --marca-texto: #2F5D50;
  --marca-suave: #E3ECE9;
  --acento: #E9A23B;
  --acento-tinta: #1A1A1A;
  --ok: #1D6B4A;
  --ok-suave: #DDEFE6;
  --aviso: #8A5A00;
  --aviso-suave: #FFF1CF;
  --mal: #A3123F;
  --mal-suave: #FBE3EA;
  --velo: rgba(20, 20, 20, .5);
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --fuente: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papel: #121212; --superficie: #1C1C1C; --superficie-2: #232323; --hundido: #2C2C2C;
    --tinta: #F1F0EC; --tinta-2: #C4C2BC; --tinta-3: #9A9893; --linea: #F1F0EC; --linea-suave: #3A3A38;
    --marca-suave: #22302C; --ok: #6CCB9C; --ok-suave: #173326; --aviso: #F2C14E; --aviso-suave: #3A2F12;
    --mal: #F08AA8; --mal-suave: #3A1A24; --velo: rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papel: #121212; --superficie: #1C1C1C; --superficie-2: #232323; --hundido: #2C2C2C;
  --tinta: #F1F0EC; --tinta-2: #C4C2BC; --tinta-3: #9A9893; --linea: #F1F0EC; --linea-suave: #3A3A38;
  --marca-suave: #22302C; --ok: #6CCB9C; --ok-suave: #173326; --aviso: #F2C14E; --aviso-suave: #3A2F12;
  --mal: #F08AA8; --mal-suave: #3A1A24; --velo: rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papel); color: var(--tinta);
  font: 400 15.5px/1.55 var(--fuente); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--marca-texto); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-family: var(--display); font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
[hidden] { display: none !important; }
.tenue { color: var(--tinta-3); }
.medio { color: var(--tinta-2); }
.peque { font-size: 13.5px; }
.rotulo { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tinta-2); }
.cifra { font-family: var(--display); font-weight: 900; letter-spacing: -.03em; line-height: 1; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- La franja de aguayo ---------- */
.aguayo {
  height: 14px; flex: none;
  background: repeating-linear-gradient(90deg, var(--marca) 0 40px, var(--acento) 40px 60px, var(--tinta) 60px 100px,
              var(--acento) 100px 108px);
}
.aguayo.g { height: 22px; }
.aguayo.s { height: 6px; }

/* ---------- Iconos ---------- */
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: square; stroke-linejoin: miter; vertical-align: -3px; }
.ico.g { width: 22px; height: 22px; }
.ico.s { width: 15px; height: 15px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 2px solid var(--linea); background: var(--superficie); color: var(--tinta); border-radius: 0;
  font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, color .12s, transform .06s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--marca); border-color: var(--marca); color: var(--marca-tinta); }
.btn-primario:hover:not(:disabled) { filter: brightness(.92); }
.btn-acento { background: var(--acento); border-color: var(--acento); color: var(--acento-tinta); }
.btn-borde:hover:not(:disabled) { background: var(--superficie-2); }
.btn-texto { border-color: transparent; background: transparent; color: var(--marca-texto); padding: 0 6px; min-height: 34px; text-decoration: underline; }
.btn-peligro { background: var(--mal); border-color: var(--mal); color: #fff; }
.btn-peligro-borde { border-color: var(--mal); color: var(--mal); background: transparent; }
.btn-g { min-height: 54px; font-size: 16px; padding: 0 24px; }
.btn-p { min-height: 34px; font-size: 13.5px; padding: 0 12px; border-width: 2px; }
.btn-bloque { width: 100%; }
.btn-icono { width: 40px; min-height: 40px; padding: 0; border-color: transparent; background: transparent; }
.btn-icono:hover { background: var(--hundido); }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > span, .etiqueta { font-size: 14px; font-weight: 700; color: var(--tinta); }
.campo small { font-size: 13px; color: var(--tinta-3); }
.entrada, .campo input:not([type=checkbox]):not([type=radio]), .campo select, .campo textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--linea); border-radius: 0;
  background: var(--superficie); color: var(--tinta); font-size: 16px;
}
.campo textarea { min-height: 92px; resize: vertical; }
.entrada:focus, .campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--acento); }
.campo.error input, .campo.error select { border-color: var(--mal); }
.fila-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--marca); flex: none; }
.telefono { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }

/* Fichas elegibles (alergias, días, opciones) */
.fichas { display: flex; flex-wrap: wrap; gap: 8px; }
.ficha { position: relative; }
.ficha input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.ficha span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 2px solid var(--linea);
  background: var(--superficie); font-weight: 600; font-size: 14.5px; cursor: pointer; user-select: none;
}
.ficha input:checked + span { background: var(--tinta); color: var(--papel); }
.ficha input:focus-visible + span { box-shadow: 0 0 0 3px var(--acento); }
.ficha input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Opciones grandes (radio con texto) */
.opciones { display: grid; gap: 10px; }
.opcion { position: relative; display: block; }
.opcion input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opcion > div { border: 2px solid var(--linea-suave); background: var(--superficie); padding: 14px 16px; cursor: pointer; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.opcion input:checked + div { border-color: var(--linea); box-shadow: inset 6px 0 0 var(--marca); }
.opcion input:focus-visible + div { box-shadow: 0 0 0 3px var(--acento); }

/* Interruptor */
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; cursor: pointer; }
.interruptor input { appearance: none; width: 46px; height: 26px; border: 2px solid var(--linea); background: var(--superficie); position: relative; flex: none; cursor: pointer; margin: 0; }
.interruptor input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: var(--tinta); transition: transform .12s; }
.interruptor input:checked { background: var(--marca); border-color: var(--marca); }
.interruptor input:checked::after { transform: translateX(20px); background: var(--marca-tinta); }

/* Segmentado */
.segmento { display: inline-flex; border: 2px solid var(--linea); align-self: flex-start; max-width: 100%; }
.segmento button { border: 0; background: transparent; padding: 8px 14px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--tinta); }
.segmento button + button { border-left: 2px solid var(--linea); }
.segmento button[aria-pressed="true"] { background: var(--tinta); color: var(--papel); }

/* ---------- Estados ---------- */
.pastilla { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--hundido); color: var(--tinta); }
.pastilla.ok { background: var(--ok-suave); color: var(--ok); }
.pastilla.aviso { background: var(--aviso-suave); color: var(--aviso); }
.pastilla.mal { background: var(--mal-suave); color: var(--mal); }
.pastilla.marca { background: var(--marca); color: var(--marca-tinta); }
.pastilla.acento { background: var(--acento); color: var(--acento-tinta); }

.nota { padding: 12px 14px; font-size: 14.5px; line-height: 1.5; background: var(--aviso-suave); color: var(--tinta); border-left: 6px solid var(--aviso); }
.nota.ok { background: var(--ok-suave); border-left-color: var(--ok); }
.nota.mal { background: var(--mal-suave); border-left-color: var(--mal); }
.nota.neutra { background: var(--superficie-2); border-left-color: var(--tinta-3); }

/* ---------- Tarjeta, modal ---------- */
.tarjeta { background: var(--superficie); border: 2px solid var(--linea); }
.velo { position: fixed; inset: 0; z-index: 60; background: var(--velo); display: flex; align-items: center; justify-content: center; padding: 16px; animation: aparecer .12s ease-out; }
.velo.hoja { align-items: flex-end; padding: 0; }
.modal { background: var(--superficie); border: 2px solid var(--linea); width: min(540px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.velo.hoja .modal { width: min(600px, 100%); max-height: 92vh; border-bottom: 0; animation: subir .18s ease-out; }
.modal::before { content: ""; display: block; height: 8px; flex: none;
  background: repeating-linear-gradient(90deg, var(--marca) 0 40px, var(--acento) 40px 60px, var(--tinta) 60px 100px, var(--acento) 100px 108px); }
.modal-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 8px; }
.modal-cab h3 { font-size: 19px; }
.modal-cuerpo { padding: 8px 20px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-pie { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 2px solid var(--linea-suave); flex-wrap: wrap; }
.modal-pie .btn { flex: 1 1 auto; }
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(30px); opacity: .4; } }

/* Avisos breves */
.avisos { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.aviso-breve { background: var(--tinta); color: var(--papel); padding: 12px 16px; font-weight: 600; font-size: 14.5px; border-left: 6px solid var(--acento); animation: subir .18s ease-out; }
.aviso-breve.mal { border-left-color: var(--mal); }
.aviso-breve.ok { border-left-color: var(--ok); }

/* Esqueleto de carga */
.esqueleto { background: linear-gradient(90deg, var(--hundido), var(--superficie-2), var(--hundido)); background-size: 200% 100%; animation: brillo 1.2s infinite linear; }
@keyframes brillo { to { background-position: -200% 0; } }

/* Vacío */
.vacio { text-align: center; padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vacio h3 { font-size: 18px; }

/* Tabla simple */
.tabla { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tabla th { text-align: left; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--tinta-2); padding: 8px 10px; border-bottom: 2px solid var(--linea); }
.tabla td { padding: 10px; border-bottom: 1px solid var(--linea-suave); vertical-align: top; }
.tabla .num { text-align: right; white-space: nowrap; }

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