:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #f2f2ee;
  --ink: #151515;
  --ink-2: #3a3a37;
  --muted: #64645f;
  --line: #e2e2dc;
  --line-strong: #cfcfc8;
  --chip: #ececE6;
  --brand: #c8372d;
  --info: #2554c7;
  --info-soft: #e8eefb;
  --ok: #1b7a44;
  --ok-soft: #e4f3e9;
  --danger: #b42318;
  --danger-soft: #fcebe9;
  --wa: #0f7a3d;
  --wa-soft: #e3f5ea;
  --focus: rgba(37, 84, 199, .25);
  --radius: 16px;
  --font: 'Geist', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

/* Modo oscuro: es el de por defecto (lo pone index.html); el botón del sol/luna lo cambia. */
:root[data-theme="dark"] {
    --bg: #0e0e0e;
    --surface: #171717;
    --surface-2: #1e1e1e;
    --ink: #f3f3f0;
    --ink-2: #d4d4cf;
    --muted: #a2a29c;
    --line: #2a2a28;
    --line-strong: #3a3a37;
    --chip: #242422;
    --brand: #ec5b4f;
    --info: #7ea2ff;
    --info-soft: #1a2440;
    --ok: #5fcb8c;
    --ok-soft: #15301f;
    --danger: #f27b70;
    --danger-soft: #3a1c19;
    --wa: #4cd185;
    --wa-soft: #133222;
    --focus: rgba(126, 162, 255, .3);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
h1, h2, h3 { font-weight: 650; letter-spacing: -.02em; margin: 0; line-height: 1.2; }
h1 { font-size: 30px; letter-spacing: -.03em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-size: .9em; background: var(--chip); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 17px; margin-top: 8px; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ── Marca ───────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.logo-mark { width: 32px; height: 32px; flex: none; display: block; }
.wordmark { font-size: 16px; letter-spacing: .14em; text-transform: uppercase; font-weight: 400; white-space: nowrap; }
.wordmark b { font-weight: 700; }
.wordmark.plain { letter-spacing: -.01em; text-transform: none; font-weight: 650; }
.brand.lg { gap: 14px; margin-bottom: 36px; }
.brand.lg .logo-mark { width: 52px; height: 52px; }
.brand.lg .wordmark { font-size: 22px; }
.corner { position: fixed; top: 12px; right: 12px; z-index: 5; }
.theme-btn { width: 38px; padding: 0; }
.theme-btn .ico { width: 18px; height: 18px; }

/* ── Botones ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary, .btn.accent { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover, .btn.accent:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.danger { color: var(--danger); border-color: var(--line); }
.btn.danger:hover { border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.wa { background: var(--wa-soft); color: var(--wa); border-color: transparent; }
.btn.wa:hover { border-color: var(--wa); }
.btn.wa.icon-only { width: 36px; padding: 0; }
.ico { width: 17px; height: 17px; flex: none; }
.link { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }

/* ── Formularios ─────────────────────────── */
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: var(--muted); }
.input:focus { border-color: var(--info); box-shadow: 0 0 0 3px var(--focus); }
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error { color: var(--danger); font-size: 14px; font-weight: 500; }
.error:empty { display: none; }

/* ── Pantalla de acceso ──────────────────── */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-top: 28px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.tabs button { border: 0; background: transparent; min-height: 38px; border-radius: 7px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }
.notice { margin: -6px 0 18px; padding: 12px 14px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-size: 14px; font-weight: 500; }
.notice.neutral { background: var(--surface-2); color: var(--muted); }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
.demo-box { margin-top: 16px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.demo-box .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── Estructura ──────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1000px; margin: 0 auto; padding: 12px 16px 0; display: flex; align-items: center; gap: 14px; }
.topbar .name { display: flex; align-items: center; text-decoration: none; min-width: 0; }
.topbar-inner { gap: 8px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 14px; color: var(--muted); white-space: nowrap; }
.nav { max-width: 1000px; margin: 0 auto; padding: 6px 16px 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 10px 12px 12px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--ink); }
.demo-banner { background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center; padding: 7px 16px; border-bottom: 1px solid var(--line); }
main { max-width: 1000px; margin: 0 auto; padding: 32px 16px 128px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card + .card, form > .card + .card { margin-top: 14px; }
.card.contact { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card.contact p { margin-top: 4px; }
.step-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.step-num {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); flex: none;
}

/* ── Reserva ─────────────────────────────── */
.auth-title { font-size: 34px; }
.eyebrow { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.service-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.service-hero h2 { font-size: 21px; }
.service-hero .muted { margin-top: 2px; }
.service-hero .price { font-size: 34px; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.service {
  text-align: left; padding: 16px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; display: grid; gap: 2px; transition: border-color .15s, background .15s;
}
.service:hover { border-color: var(--ink); }
.service[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--surface-2); }
.service .s-name { font-weight: 600; line-height: 1.3; }
.service .s-meta { font-size: 14px; color: var(--muted); }
.service .s-price { font-size: 20px; font-weight: 650; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }

.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.day {
  flex: none; width: 62px; padding: 10px 0; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); cursor: pointer; text-align: center; scroll-snap-align: start; line-height: 1.25;
}
.day:hover { border-color: var(--ink); }
.day .d-wd { font-size: 12px; text-transform: capitalize; color: var(--muted); font-weight: 500; }
.day .d-num { font-size: 21px; font-weight: 650; letter-spacing: -.02em; margin: 2px 0; }
.day .d-mo { font-size: 12px; color: var(--muted); }
.day[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.day[aria-pressed="true"] .d-wd, .day[aria-pressed="true"] .d-mo { color: var(--bg); opacity: .7; }
.day:disabled { opacity: .35; cursor: not-allowed; background: transparent; border-style: dashed; }

.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.time {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.time:hover { border-color: var(--ink); }
.time[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.empty { padding: 20px; text-align: center; color: var(--muted); background: var(--surface-2); border-radius: 12px; }

.summary-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.summary-inner { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.summary-inner .txt { flex: 1; min-width: 0; line-height: 1.35; }
.summary-inner .txt strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Listas de citas ─────────────────────── */
.appt-list { display: grid; gap: 10px; }
.appt {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
}
.appt .when { text-align: center; min-width: 52px; padding-right: 16px; border-right: 1px solid var(--line); line-height: 1.15; }
.appt .when .w-num { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.appt .when .w-mo { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.appt .info strong { display: block; }
.appt .info .muted { display: block; }
.appt .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px;
  background: var(--chip); color: var(--muted); vertical-align: middle; letter-spacing: 0;
}
.badge.accent { background: var(--info-soft); color: var(--info); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.section-label { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin: 28px 0 12px; }

/* ── Agenda (peluquero) ──────────────────── */
.agenda-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-head .date-title { flex: 1; min-width: 200px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 20px 0 16px; }
.week button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 0 6px;
  cursor: pointer; text-align: center; display: grid; line-height: 1.3; position: relative;
}
.week button:hover { border-color: var(--ink); }
.week button .wd { font-size: 12px; text-transform: capitalize; color: var(--muted); }
.week button .dn { font-weight: 650; font-size: 17px; }
.week button .ct { font-size: 11px; color: var(--muted); font-weight: 600; min-height: 15px; }
.week button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.week button[aria-pressed="true"] .wd, .week button[aria-pressed="true"] .ct { color: var(--bg); opacity: .75; }
.week button.today::after { content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); }
.timeline { display: grid; gap: 6px; }
.slot {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
.slot .t { font-weight: 650; font-variant-numeric: tabular-nums; }
.slot .what { min-width: 0; }
.slot .what strong { display: block; line-height: 1.35; }
.slot .sub { display: block; font-size: 14px; color: var(--muted); }
.slot .sub a { color: var(--muted); }
.slot.free { background: transparent; border-style: dashed; padding-top: 8px; padding-bottom: 8px; }
.slot.free .what { color: var(--muted); font-size: 15px; }
.slot.free .acts .btn { opacity: .85; }
.slot.past { opacity: .45; }
.slot.block { background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 7px, transparent 7px, transparent 14px); }
.slot.appt { box-shadow: inset 3px 0 0 var(--info); }
.slot.appt.done { box-shadow: inset 3px 0 0 var(--ok); }
.slot.appt.noshow { box-shadow: inset 3px 0 0 var(--danger); }
.slot .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.gap-label { font-size: 13px; color: var(--muted); padding: 6px 2px; text-align: center; }

/* ── Tablas ──────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.phone-cell { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* ── Invitaciones ────────────────────────── */
.invite-list { display: grid; gap: 10px; }
.invite-row {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
}
.invite-row.fresh { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.invite-row.past { opacity: .6; }
.invite-row .info { min-width: 0; }
.invite-row .info strong { display: block; }
.invite-row .sub { display: block; font-size: 14px; color: var(--muted); }
.invite-link { display: block; margin-top: 8px; padding: 6px 10px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Ajustes ─────────────────────────────── */
.hours-grid { display: grid; gap: 10px; }
.hours-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.svc-row { display: grid; grid-template-columns: 1fr 96px 96px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
#hols { display: grid; gap: 8px; }
.hol-row { display: grid; grid-template-columns: 170px 1fr auto; gap: 8px; align-items: center; }
.day.holiday .d-mo { color: var(--brand); font-weight: 600; }
.day.holiday[aria-pressed="true"] .d-mo { color: var(--bg); }

/* ── Diálogo y avisos ────────────────────── */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(460px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(10, 10, 10, .45); backdrop-filter: blur(2px); }
.dlg { padding: 24px; display: grid; gap: 14px; }
.dlg .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 500; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); color: #fff; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 48px; }

@media (max-width: 640px) {
  h1 { font-size: 25px; }
  main { padding-top: 24px; }
  .card { padding: 18px; }
  .topbar .who { display: none; }
  .appt { grid-template-columns: auto 1fr; gap: 14px; }
  .appt .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .slot { grid-template-columns: 48px 1fr; gap: 10px; }
  .slot .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .stat { padding: 12px; }
  .stat .v { font-size: 21px; }
  .form-row { grid-template-columns: 1fr; }
  .hours-row { grid-template-columns: 1fr; gap: 4px; }
  .svc-row { grid-template-columns: 1fr 64px 64px auto; }
  .hol-row { grid-template-columns: 1fr auto; }
  .invite-row { grid-template-columns: 1fr; }
  .invite-row .acts { justify-content: flex-start; }
  .hol-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .hol-row [data-k="name"] { grid-column: 1 / -1; }
  .hol-row [data-hdel] { grid-column: 2; grid-row: 1; }
  .week { gap: 4px; }
  .week button .dn { font-size: 15px; }
  .week button .ct { font-size: 10px; }
}
