:root {
  --fondo: #f6f3ee;
  --superficie: #fff;
  --superficie-2: #f1ede6;
  --borde: #e2dcd2;
  --texto: #1f1b17;
  --texto-suave: #6b635a;
  --acento: #b71c1c;
  --acento-texto: #fff;
  --acento-suave: #fbe9e7;
  --verde: #2e7d32;
  --amarillo: #b26a00;
  --papel: #fffdf8;
  --sombra: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .05);
  --radio: 12px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-tema="oscuro"] {
  --fondo: #151311;
  --superficie: #201d1a;
  --superficie-2: #2a2622;
  --borde: #3a352f;
  --texto: #f2ede6;
  --texto-suave: #a79e93;
  --acento: #ff6b6b;
  --acento-texto: #1f1b17;  /* texto oscuro sobre el rojo claro: 6.2:1 */
  --acento-suave: #3a1d1b;
  --verde: #6cc070;
  --amarillo: #e3a43b;
  --papel: #f4efe4;
  --sombra: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
[hidden] { display: none !important; }

.con-fondo {
  background:
    var(--logo) no-repeat right -40px bottom -40px / 380px,
    var(--fondo);
  background-attachment: fixed;
}
.con-fondo::before {
  content: "";
  position: fixed; inset: 0;
  background: var(--fondo);
  opacity: .9;
  pointer-events: none;
  z-index: -1;
}

/* Botones */
.boton-primario, .boton-secundario {
  min-height: 44px; border-radius: 10px; padding: 10px 18px; font-weight: 600;
  border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.boton-primario { background: var(--acento); color: var(--acento-texto); }
.boton-secundario { background: var(--superficie); border-color: var(--borde); color: var(--texto); }
.boton-tema {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--borde); background: var(--superficie);
  display: inline-grid; place-items: center;
}
.boton-tema svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icono-sol { display: none; }
[data-tema="oscuro"] .icono-sol { display: block; }
[data-tema="oscuro"] .icono-luna { display: none; }

/* Barra */
.barra {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; min-height: 58px;
  background: var(--superficie); border-bottom: 1px solid var(--borde);
}
.barra-logo img { width: 40px; height: 40px; display: block; }
.barra-titulo { margin: 0; font-size: 20px; }
.barra-menu { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.barra-menu a {
  padding: 8px 10px; border-radius: 8px; color: var(--texto); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.barra-menu a:hover, .barra-menu a[aria-current] { background: var(--superficie-2); }
.barra-usuario { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.barra-usuario form { margin: 0; }
.barra-nombre { font-weight: 600; color: var(--texto-suave); white-space: nowrap; }
.boton-salir {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--borde); background: var(--superficie);
  text-decoration: none; color: var(--texto); font-weight: 600;
}
.boton-salir:hover { border-color: var(--acento); color: var(--acento); }

/* Modal */
.modal { border: 0; padding: 0; border-radius: 16px; background: var(--superficie); color: var(--texto); box-shadow: 0 20px 60px rgb(0 0 0 / .3); width: min(440px, calc(100% - 32px)); }
.modal::backdrop { background: rgb(0 0 0 / .45); }
.modal-caja { margin: 0; padding: 20px; display: grid; gap: 14px; }
.modal-caja h2 { margin: 0; font-size: 18px; }
.modal-caja p { margin: 0; color: var(--texto-suave); }
.modal-opciones { display: grid; gap: 8px; }
.modal-opcion {
  display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; text-align: left;
  border: 1px solid var(--borde); border-radius: 10px; background: var(--fondo); font-weight: 600;
}
.modal-opcion:hover { border-color: var(--acento); }
.modal-opcion .precio { color: var(--texto-suave); font-weight: 500; }
.modal-botones { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-botones > :first-child { margin-right: auto; }
.modal-botones button { min-height: 44px; padding: 9px 16px; }
.modal-botones-chicos { display: flex; }
.modal-botones-chicos .boton-secundario { padding: 6px 12px; font-size: 13px; }
.modal-caja input, .modal-caja textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--fondo);
}
.modal-caja textarea { min-height: 100px; resize: vertical; }
.paso { display: flex; align-items: center; justify-content: center; gap: 16px; }
.paso button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--borde); background: var(--fondo); font-size: 22px; font-weight: 700; }
.paso output { font-size: 28px; font-weight: 800; min-width: 40px; text-align: center; }
.alternar { display: inline-flex; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; justify-self: start; }
.alternar button { border: 0; padding: 8px 18px; background: var(--fondo); font-weight: 700; }
.alternar button[aria-pressed="true"] { background: var(--acento); color: var(--acento-texto); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--texto); color: var(--fondo); padding: 10px 18px; border-radius: 10px; font-weight: 600; box-shadow: var(--sombra);
}



/* Avisos y páginas simples */
.aviso-info { background: var(--superficie-2); color: var(--texto); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.aviso-error { background: var(--acento-suave); color: var(--acento); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.panel-cuenta {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 16px; display: grid; gap: 14px;
}
.seccion-vacia { text-align: center; padding: 80px 16px; }
.seccion-vacia p { color: var(--texto-suave); }

@media (max-width: 1360px) {
  .barra { flex-wrap: wrap; }
  .barra-menu { order: 3; flex-basis: 100%; }
}

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