/* AgendaYa — estilos compartidos (página de reservas, panel y admin) */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500..800&display=swap');

:root {
  --tinta: #19163a;
  --tinta-2: #4a4766;
  --tinta-3: #6f6c88;
  --papel: #ffffff;
  --fondo: #f4f3fa;
  --linea: #e4e2ef;
  --marca: #5b3df5;
  --acento: var(--marca);
  --acento-suave: #ebe8fe;   /* JS los recalcula con el color de cada negocio */
  --acento-fuerte: #4931c4;
  --sobre-acento: #ffffff;
  --ok: #0b7a54;       --ok-fondo: #e1f4ec;
  --espera: #9a4a06;   --espera-fondo: #fdefd9;
  --mal: #b42a26;      --mal-fondo: #fbe6e5;
  --r-s: 10px; --r-m: 16px; --r-l: 26px;
  --sombra: 0 1px 0 rgb(25 22 58 / 4%), 0 10px 28px -14px rgb(25 22 58 / 22%);
  --display: 'Bricolage Grotesque', ui-rounded, system-ui, sans-serif;
  --texto: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 16px/1.5 var(--texto); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 7vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
.tenue { color: var(--tinta-3); }
.peque { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- botones ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: 600 1rem/1 var(--texto);
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--acento); color: var(--sobre-acento); text-decoration: none;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ancho { width: 100%; }
.btn.sec { background: var(--papel); color: var(--tinta); box-shadow: inset 0 0 0 1.5px var(--linea); }
.btn.fant { background: transparent; color: var(--tinta-2); padding: 0 12px; min-height: 40px; }
.btn.peligro { background: var(--mal-fondo); color: var(--mal); }
.btn.wa { background: #1f9d55; color: #fff; }
.btn.chico { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; margin: 0 -2px; scroll-snap-type: x proximity; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  appearance: none; cursor: pointer; border: 0; flex: none; scroll-snap-align: start;
  font: 600 .95rem/1.15 var(--texto); color: var(--tinta);
  background: var(--papel); box-shadow: inset 0 0 0 1.5px var(--linea);
  padding: 10px 16px; border-radius: 999px; min-height: 44px;
}
.chip[aria-pressed="true"] { background: var(--tinta); color: #fff; box-shadow: none; }
.chip.acento[aria-pressed="true"] { background: var(--acento); color: var(--sobre-acento); }

/* ---------- formularios ---------- */
.campo { display: grid; gap: 6px; }
.campo > span { font-weight: 600; font-size: .9rem; color: var(--tinta-2); }
.campo small { color: var(--tinta-3); font-size: .82rem; }
input, select, textarea {
  font: 1rem/1.3 var(--texto); color: var(--tinta); width: 100%;
  background: var(--papel); border: 1.5px solid var(--linea); border-radius: var(--r-s);
  padding: 12px 14px; min-height: 48px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
input[type="color"] { padding: 4px; width: 56px; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--acento); }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-weight: 600; }
.fila { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.fila > *, .campo { min-width: 0; }
input, select { min-width: 0; }
.pila { display: grid; gap: 14px; }

/* ---------- tarjetas y listas ---------- */
.tarjeta { background: var(--papel); border-radius: var(--r-m); box-shadow: var(--sombra); padding: 18px; }
.lista { list-style: none; margin: 0; padding: 0; background: var(--papel); border-radius: var(--r-m); box-shadow: var(--sombra); overflow: hidden; }
.lista > li + li { border-top: 1px solid var(--linea); }
.lista-btn {
  appearance: none; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; color: inherit;
  font: inherit; display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 60px;
}
.lista-btn:active { background: var(--fondo); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.confirmada { background: var(--acento-suave); color: var(--acento-fuerte); }
.pill.pendiente  { background: var(--espera-fondo); color: var(--espera); }
.pill.completada { background: var(--ok-fondo); color: var(--ok); }
.pill.cancelada, .pill.no_asistio { background: #eeedf3; color: var(--tinta-3); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font: 700 1rem/1 var(--display); background: var(--acento-suave); color: var(--acento-fuerte);
  object-fit: cover;
}

/* ---------- hoja inferior (dialog) ---------- */
dialog.hoja {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92vh;
  border-radius: var(--r-l) var(--r-l) 0 0; background: var(--papel); color: var(--tinta);
  box-shadow: 0 -20px 60px -20px rgb(25 22 58 / 40%);
  overflow: auto; overscroll-behavior: contain; scroll-padding-top: 84px;
}
dialog.hoja[open] { animation: subir .22s cubic-bezier(.2,.8,.2,1); }
dialog.hoja::backdrop { background: rgb(25 22 58 / 45%); }
@keyframes subir { from { transform: translateY(40px); opacity: .4; } }
.hoja-cab { position: sticky; top: 0; background: var(--papel); z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--linea); }
.hoja-cuerpo { padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.cerrar { appearance: none; border: 0; background: var(--fondo); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.3rem; line-height: 1; color: var(--tinta-2); }
@media (min-width: 700px) { dialog.hoja { margin: auto; border-radius: var(--r-l); } }

/* ---------- avisos ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--tinta); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 100;
  max-width: calc(100% - 32px); box-shadow: 0 12px 30px -10px rgb(0 0 0 / 40%); animation: subir .2s ease;
}
.toast.error { background: var(--mal); }
.aviso { border-radius: var(--r-m); padding: 14px 16px; background: var(--espera-fondo); color: var(--espera); font-weight: 600; font-size: .95rem; }
.aviso.mal { background: var(--mal-fondo); color: var(--mal); }
.aviso a { font-weight: 700; }
.vacio { text-align: center; padding: 36px 20px; color: var(--tinta-3); display: grid; gap: 12px; justify-items: center; }
.cargando { display: grid; place-items: center; padding: 48px; color: var(--tinta-3); }
.cargando::before { content: ''; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--linea); border-top-color: var(--acento); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- el ticket de turno ---------- */
.ticket {
  --muesca: 14px;
  position: relative; background: var(--papel); border-radius: 20px; box-shadow: var(--sombra);
  -webkit-mask: radial-gradient(circle var(--muesca) at 0 var(--corte), #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--muesca) at 100% var(--corte), #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--muesca) at 0 var(--corte), #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--muesca) at 100% var(--corte), #0000 98%, #000) right / 51% 100% no-repeat;
  --corte: 128px;
}
.ticket-arriba { padding: 22px 24px 20px; height: var(--corte); display: grid; align-content: end; gap: 2px;
  background: var(--acento); color: var(--sobre-acento); border-radius: 20px 20px 0 0; }
.ticket-hora { font: 800 3.2rem/0.95 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.ticket-abajo { padding: 22px 24px 24px; border-top: 2px dashed var(--linea); display: grid; gap: 14px; }
.ticket-dato { display: grid; grid-template-columns: 96px 1fr; gap: 10px; font-size: .95rem; margin: 0; }
.ticket-abajo .pill { justify-self: start; }
.ticket-dato dt { color: var(--tinta-3); }
.ticket-dato dd { margin: 0; font-weight: 600; }

/* tarjeta de fidelidad */
.sellos { display: flex; flex-wrap: wrap; gap: 6px; }
.sello { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--linea); }
.sello.lleno { background: var(--acento); box-shadow: inset 0 0 0 3px var(--acento), inset 0 0 0 6px #fff; }

/* calendario del mes */
.cal { display: grid; gap: 10px; }
.cal-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-cab b { font: 800 1.25rem/1.1 var(--display); letter-spacing: -0.02em; }
.cal-cab .flecha { appearance: none; border: 0; cursor: pointer; width: 44px; height: 44px; border-radius: 50%; background: var(--papel); box-shadow: inset 0 0 0 1.5px var(--linea); font-size: 1.4rem; color: var(--tinta-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-sem span { text-align: center; font-size: .78rem; font-weight: 700; color: var(--tinta-3); }
.cal-dia {
  appearance: none; border: 0; cursor: pointer; border-radius: 12px; min-height: 50px; padding: 5px 0;
  display: grid; justify-items: center; align-content: center; gap: 3px;
  background: var(--papel); color: var(--tinta); box-shadow: inset 0 0 0 1.5px var(--linea);
  font: 700 1rem/1 var(--texto); font-variant-numeric: tabular-nums;
}
.cal-dia small { font-size: .68rem; font-weight: 800; line-height: 1; min-width: 18px; padding: 2px 5px; border-radius: 999px; background: var(--acento-suave); color: var(--acento-fuerte); }
.cal-dia small.vacio-dia { visibility: hidden; }
.cal-dia.hoy { box-shadow: inset 0 0 0 2.5px var(--acento); }
.cal-dia.pasado { color: var(--tinta-3); background: transparent; box-shadow: none; }
.cal-dia.cerrado { color: var(--tinta-3); background: repeating-linear-gradient(135deg, var(--papel) 0 6px, #ecebf3 6px 9px); }
.cal-dia[aria-pressed="true"] { background: var(--acento); color: var(--sobre-acento); box-shadow: none; }
.cal-dia[aria-pressed="true"] small { background: rgb(255 255 255 / 25%); color: inherit; }
.cal-leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--tinta-3); }
.cal-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.cal-leyenda small { font-size: .68rem; font-weight: 800; padding: 2px 6px; border-radius: 999px; background: var(--acento-suave); color: var(--acento-fuerte); }
.cal-raya { width: 16px; height: 16px; border-radius: 5px; background: repeating-linear-gradient(135deg, var(--papel) 0 3px, #d9d7e5 3px 5px); box-shadow: inset 0 0 0 1px var(--linea); }
