:root {
  --fondo: #f3f6f9; --tarjeta: #ffffff; --texto: #14212b; --suave: #5b6b78; --borde: #dbe3ea;
  --marca: #0b5d8c; --marca-texto: #ffffff; --peligro: #b3261e; --hoy: #f2a33a; --sel: #0b5d8c;
  --c0: #2f7fbf; --c1: #d0632c; --c2: #2e9b6b; --c3: #8a5cc2; --c4: #c2477e; --c5: #9a7b1c; --c6: #2a9aa6; --c7: #5c6f87;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #0e161d; --tarjeta: #16212b; --texto: #e6edf3; --suave: #9aabb8; --borde: #2a3946;
    --marca: #3a9ad6; --marca-texto: #06131c; --peligro: #ff8a80; --sel: #3a9ad6;
    --c0: #5aa6e0; --c1: #f08a55; --c2: #4fc28f; --c3: #a985e0; --c4: #e46fa3; --c5: #cfae45; --c6: #4cc1cc; --c7: #8ea2bb;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fondo: #0e161d; --tarjeta: #16212b; --texto: #e6edf3; --suave: #9aabb8; --borde: #2a3946;
  --marca: #3a9ad6; --marca-texto: #06131c; --peligro: #ff8a80; --sel: #3a9ad6;
  --c0: #5aa6e0; --c1: #f08a55; --c2: #4fc28f; --c3: #a985e0; --c4: #e46fa3; --c5: #cfae45; --c6: #4cc1cc; --c7: #8ea2bb;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .6rem; }
.tarjeta h2:first-child { margin-top: 0; }

.barra { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 16px .6rem; background: var(--marca); color: var(--marca-texto); flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
nav { display: flex; gap: .25rem; }
.enlace { background: transparent; color: inherit; border: 0; padding: .4rem .6rem; border-radius: 8px; font: inherit; font-size: .95rem; opacity: .85; cursor: pointer; }
.enlace.activo { background: rgba(255, 255, 255, .18); opacity: 1; }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.estrecha { max-width: 420px; margin: 24px auto; }
label { display: block; margin-bottom: .8rem; font-size: .92rem; color: var(--suave); }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--texto); }
input:not([type=checkbox]) { display: block; width: 100%; margin-top: .3rem; padding: .7rem .75rem; font: inherit; color: var(--texto);
  background: var(--fondo); border: 1px solid var(--borde); border-radius: 10px; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }
button { font: inherit; padding: .65rem 1rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
.primario { background: var(--marca); color: var(--marca-texto); border-color: var(--marca); font-weight: 600; }
.peligro { color: var(--peligro); border-color: var(--peligro); background: transparent; }
form .primario { width: 100%; }
.fila { display: flex; gap: .5rem; }
.fila button { flex: 1; }
.error { color: var(--peligro); min-height: 1.2em; margin: .5rem 0 0; font-size: .92rem; }
.pista { color: var(--suave); font-size: .88rem; }
.nota { color: var(--suave); font-style: italic; }

.cabecera-mes { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cabecera-mes h1 { margin: 0; }
.icono { width: 44px; height: 44px; padding: 0; font-size: 1.5rem; line-height: 1; }
.semana, .rejilla { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.semana span { text-align: center; font-size: .8rem; color: var(--suave); padding: .25rem 0; }
.dia { position: relative; aspect-ratio: 1 / 1.05; min-height: 44px; padding: 4px; border-radius: 10px; border: 1px solid var(--borde);
  background: var(--tarjeta); display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; overflow: hidden; text-align: left; }
.dia.vacio { border: 0; background: transparent; }
.dia .num { font-size: .9rem; font-weight: 600; }
.dia .quien { font-size: .68rem; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.dia.pasado { opacity: .45; }
.dia.hoy { box-shadow: inset 0 0 0 2px var(--hoy); }
.dia.ocupado { color: #fff; border-color: transparent; }
.dia.mia::after { content: "★"; position: absolute; top: 3px; right: 5px; font-size: .7rem; }
.dia.sel { background: color-mix(in srgb, var(--sel) 22%, var(--tarjeta)); border-color: var(--sel); }
.c0 { background: var(--c0); } .c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); }
.c4 { background: var(--c4); } .c5 { background: var(--c5); } .c6 { background: var(--c6); } .c7 { background: var(--c7); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dia.ocupado { color: #0b1218; } }
:root[data-theme="dark"] .dia.ocupado { color: #0b1218; }
@media (min-width: 560px) { .dia .quien { font-size: .78rem; } .dia { aspect-ratio: 1 / .8; } }

#panelReserva, #detalleDia { margin-top: 12px; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; gap: .75rem; padding: .7rem .25rem; border-bottom: 1px solid var(--borde); cursor: pointer; flex-wrap: wrap; }
.lista li:last-child { border-bottom: 0; }
.lista li.vacia { color: var(--suave); cursor: default; }
.lista.pequena li { font-size: .85rem; padding: .45rem .25rem; cursor: default; }
.punto { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.texto { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.texto span { color: var(--suave); font-size: .9rem; }
.acciones { display: flex; gap: .4rem; flex-wrap: wrap; width: 100%; padding-left: calc(12px + .75rem); }
.acciones button { padding: .4rem .7rem; font-size: .85rem; }
.enlace-generado { margin-top: 1rem; }
.enlace-generado input { margin-bottom: .5rem; font-size: .85rem; }

.aviso { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--texto); color: var(--fondo);
  padding: .7rem 1.1rem; border-radius: 999px; font-size: .95rem; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); z-index: 10; }
