:root {
  --bg: #fdf6f8;
  --surface: #ffffff;
  --surface-2: #fbeef2;
  --text: #2b1d24;
  --muted: #7a6670;
  --border: #f0dbe3;
  --primary: #c2255c;
  --primary-ink: #ffffff;
  --primary-soft: #fde4ec;
  --ok: #2b8a3e;
  --ok-soft: #e6f6ea;
  --warn: #b35c00;
  --warn-soft: #fff3e0;
  --info: #1864ab;
  --info-soft: #e7f1fb;
  --danger: #c92a2a;
  --danger-soft: #fdecec;
  --gray-soft: #f1eef0;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(160, 40, 90, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1216;
    --surface: #241a1f;
    --surface-2: #2e2128;
    --text: #f6e9ef;
    --muted: #b49ca8;
    --border: #3d2b34;
    --primary: #f06595;
    --primary-ink: #1a1216;
    --primary-soft: #3d1f2c;
    --ok: #69db7c;
    --ok-soft: #1f3324;
    --warn: #ffb35c;
    --warn-soft: #3a2a17;
    --info: #74c0fc;
    --info-soft: #172a3a;
    --danger: #ff8787;
    --danger-soft: #3b1d1d;
    --gray-soft: #2f2a2d;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: .55rem 1.1rem; cursor: pointer; text-decoration: none;
  font-weight: 600; font-size: .95rem; transition: transform .05s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.small { padding: .3rem .75rem; font-size: .85rem; }
.btn.whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.btn.block { width: 100%; }

label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
input, select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type="checkbox"] { width: auto; }
input[type="color"] { padding: .15rem; height: 2.4rem; }
.field { margin-bottom: .9rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 140px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem;
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); background: var(--danger-soft); padding: .6rem .8rem; border-radius: 10px; }
.notice { background: var(--info-soft); color: var(--info); padding: .6rem .8rem; border-radius: 10px; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.st-pendiente { background: var(--warn-soft); color: var(--warn); }
.st-confirmada { background: var(--info-soft); color: var(--info); }
.st-completada { background: var(--ok-soft); color: var(--ok); }
.st-cancelada { background: var(--gray-soft); color: var(--muted); }
.st-no_asistio { background: var(--danger-soft); color: var(--danger); }

/* ---------- página pública de reservas ---------- */
.hero {
  text-align: center; padding: 2.2rem 16px 1.5rem;
  background: linear-gradient(160deg, var(--primary-soft), var(--bg));
}
.hero .logo { font-size: 2.6rem; }
img.logo { display: block; width: 84px; height: 84px; margin: 0 auto .4rem; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 6px 22px rgba(0, 0, 0, .25); }
.hero h1 { font-size: 1.7rem; }
.hero p { margin: .2rem 0; color: var(--muted); }

.booking { max-width: 720px; margin: 0 auto; padding: 0 16px 4rem; }
.stepper { display: flex; gap: .35rem; margin: 1rem 0 1.25rem; }
.stepper span { flex: 1; height: 5px; border-radius: 99px; background: var(--border); }
.stepper span.on { background: var(--primary); }

.step-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.step-head h2 { margin: 0; font-size: 1.25rem; flex: 1; }

.choices { display: grid; gap: .7rem; }
.choice {
  display: flex; gap: .8rem; align-items: center; width: 100%; text-align: left;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem; cursor: pointer; transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--primary); }
.choice.selected { border-color: var(--primary); background: var(--primary-soft); }
.choice .grow { flex: 1; min-width: 0; }
.choice .title { font-weight: 700; }
.choice .desc { font-size: .85rem; color: var(--muted); }
.choice .price { font-weight: 700; white-space: nowrap; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; flex: none;
}

.days { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem .1rem .7rem; scroll-snap-type: x mandatory; }
.day {
  flex: none; width: 64px; padding: .5rem 0; text-align: center; scroll-snap-align: start;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer;
}
.day .dow { font-size: .75rem; color: var(--muted); text-transform: capitalize; }
.day .num { font-size: 1.25rem; font-weight: 700; }
.day .mon { font-size: .7rem; color: var(--muted); text-transform: capitalize; }
.day:disabled { opacity: .35; cursor: not-allowed; }
.day.selected { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.day.selected .dow, .day.selected .mon { color: inherit; }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; margin-top: .5rem; }
.slot {
  padding: .55rem 0; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: pointer; font-weight: 600;
}
.slot:hover { border-color: var(--primary); }
.slot.selected { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.summary { display: grid; gap: .3rem; margin-bottom: 1rem; }
.summary div { display: flex; justify-content: space-between; gap: 1rem; }
.summary dt { color: var(--muted); }
.summary dd { text-align: right; }

.done { text-align: center; }
.done .big { font-size: 3rem; }
.done .actions { display: grid; gap: .6rem; margin-top: 1rem; }

footer.site { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 16px; }

/* ---------- panel de administración ---------- */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { font-weight: 800; font-size: 1.1rem; padding: .25rem .5rem 1rem; }
.nav { display: grid; gap: .2rem; }
.nav button {
  display: flex; justify-content: space-between; align-items: center; text-align: left;
  border: 0; background: none; padding: .6rem .75rem; border-radius: 10px; cursor: pointer; font-weight: 600;
}
.nav button:hover { background: var(--surface-2); }
.nav button.active { background: var(--primary-soft); color: var(--primary); }
.nav .count { background: var(--primary); color: var(--primary-ink); border-radius: 99px; font-size: .7rem; padding: 0 .45rem; }
.content { padding: 1.25rem; min-width: 0; }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar h1 { font-size: 1.4rem; margin: 0 auto 0 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi .value { font-size: 1.35rem; font-weight: 800; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; white-space: nowrap; }

/* agenda diaria */
.agenda { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.agenda-grid { display: grid; min-width: 100%; }
.agenda-head { position: sticky; top: 0; z-index: 2; background: var(--surface-2); border-bottom: 1px solid var(--border);
  padding: .5rem; font-weight: 700; text-align: center; border-left: 1px solid var(--border); }
.agenda-head .dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; }
.agenda-times { position: relative; }
.agenda-times span { position: absolute; right: .4rem; font-size: .72rem; color: var(--muted); transform: translateY(-50%); }
.agenda-col { position: relative; border-left: 1px solid var(--border);
  background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px var(--hour-px)); }
.appt {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: .25rem .45rem; overflow: hidden;
  font-size: .78rem; line-height: 1.25; cursor: pointer; border-left: 4px solid; background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.appt:hover { z-index: 1; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.appt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.cancelada { opacity: .45; text-decoration: line-through; }
.block-band {
  position: absolute; left: 0; right: 0; font-size: .72rem; color: var(--muted); padding: .2rem .4rem;
  background: repeating-linear-gradient(45deg, var(--gray-soft) 0 6px, transparent 6px 12px);
}
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 1; }

.list-cards { display: grid; gap: .6rem; }
.appt-card { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.appt-card .when { min-width: 92px; font-weight: 700; }
.appt-card .grow { flex: 1; min-width: 180px; }

/* modal */
dialog {
  border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(30, 10, 20, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem .5rem; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: .5rem 1.1rem 1.1rem; max-height: 75vh; overflow-y: auto; }
.status-buttons { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.status-buttons .btn.current { outline: 2px solid var(--primary); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-wrap .card { width: min(380px, 100%); }

.toast {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; font-weight: 600;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

.qr-box { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.section { margin-bottom: 1.5rem; }
.section h2 { font-size: 1.1rem; }

.menu-toggle { display: none; }

@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: .6rem 16px; }
  .sidebar .brand { display: flex; justify-content: space-between; align-items: center; padding: .25rem 0; }
  .menu-toggle { display: inline-flex; }
  .nav { display: none; padding-top: .5rem; }
  .sidebar.open .nav { display: grid; }
  .content { padding: 1rem 16px; }
}
