/* =====================================================================
 * Barbería — hoja de estilos
 * Web pública: barbería clásica (tinta, crema y bronce, títulos serif).
 * Panel: aplicación con menú lateral.
 * Fuentes propias (la CSP no permite cargar nada de afuera):
 * Fraunces e Inter, licencia SIL Open Font License.
 * ===================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f7f4ee;
  --bg-alt: #efe9df;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --text: #1b1915;
  --muted: #6b6358;
  --border: #e5ded2;
  --border-strong: #d4cbbc;
  --accent: #b5832d;
  --accent-strong: #8c6320;
  --accent-soft: #f5ead6;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok-bg: #e6f3e8;
  --ok-text: #1d5a2a;
  --err-bg: #fbeaea;
  --err-text: #8c1d18;
  --warn-bg: #fdf2d8;
  --warn-text: #6b4d0e;
  --ink: #141210;
  --ink-2: #1f1b17;
  --ink-text: #f4eee4;
  --ink-muted: #b4a998;
  --ink-border: rgb(255 255 255 / 0.09);
  --gold: #e3b866;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(30 22 10 / 0.05), 0 8px 24px rgb(30 22 10 / 0.06);
  --shadow-lg: 0 2px 4px rgb(30 22 10 / 0.06), 0 18px 48px rgb(30 22 10 / 0.12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11100e;
    --bg-alt: #171512;
    --surface: #1b1916;
    --surface-2: #211e1a;
    --text: #ede7dd;
    --muted: #a59b8d;
    --border: #2e2a25;
    --border-strong: #3d3832;
    --accent: #d6a44e;
    --accent-strong: #e8bd6c;
    --accent-soft: #2e2516;
    --accent-text: #15120e;
    --danger: #f0857d;
    --ok-bg: #16301e;
    --ok-text: #a6dcb2;
    --err-bg: #3a1a18;
    --err-text: #f5b4ae;
    --warn-bg: #352b13;
    --warn-text: #f0d595;
    --ink: #0b0a09;
    --ink-2: #141210;
    --shadow: none;
    --shadow-lg: 0 18px 48px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
a { color: var(--accent-strong); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-text); }

h1, h2, h3 { line-height: 1.15; margin: 0 0 .6em; letter-spacing: -.01em; }
h1, h2 { font-family: var(--font-display); font-weight: 600; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
h3 { font-size: 1.1rem; font-weight: 650; }
code { font-size: .9em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }

.container { width: min(1140px, 100% - 32px); margin-inline: auto; }
.section { padding-block: clamp(48px, 8vw, 88px); }
.narrow { max-width: 560px; margin-inline: auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; margin: .5em 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; color: var(--accent); margin: 0 0 .7em; font-weight: 700; }
.lead { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--muted); max-width: 46ch; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .95rem;
  line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 6px 18px -8px var(--accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { color: var(--danger); border-color: currentColor; background: transparent; }
.btn-danger:hover { background: var(--err-bg); border-color: var(--danger); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-quiet { background: transparent; border-color: transparent; color: inherit; }
.btn-quiet:hover { background: rgb(255 255 255 / 0.08); border-color: transparent; }
.btn-small { padding: 6px 13px; font-size: .86rem; }
.btn-large { padding: 14px 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-link { border: 0; background: none; padding: 2px 0; text-decoration: underline; color: var(--muted); font-weight: 500; box-shadow: none; }
.btn-link:hover { color: var(--danger); }
.filters .btn[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Tarjetas y grillas ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(18px, 3vw, 24px); box-shadow: var(--shadow); margin-bottom: 20px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card h2 { font-size: 1.25rem; }
.card-off { opacity: .6; }
.card-new { border-style: dashed; }
.grid { display: grid; gap: 20px; }
.grid > .card { margin-bottom: 0; }
.cards-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.cards-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); margin-bottom: 20px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .82rem; font-weight: 600; color: var(--muted); }

/* ---------- Formularios ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: .92rem; margin-bottom: 14px; flex: 1; min-width: 0; }
input, select, textarea {
  font: inherit; font-size: .97rem; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); outline: none; }
input[type="file"] { padding: 8px; background: var(--surface); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
select:disabled { opacity: .65; }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { font-weight: 700; font-size: 1.05rem; margin-bottom: 14px; padding: 0; display: flex; align-items: center; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 8px 24px; }
.span-2 { grid-column: 1 / -1; }
.field-row { display: flex; gap: 0 16px; flex-wrap: wrap; }
.field-row > label { min-width: min(100%, 150px); }
.form-stack { display: flex; flex-direction: column; }
/* En columna las etiquetas no se estiran: si no, quedan huecos cuando la tarjeta es más alta. */
.form-stack > label { flex: 0 0 auto; }
.form-stack > .hint { margin: 0 0 14px; }
.form-stack > .btn, .form-stack > .actions { margin-top: 6px; }
.form-stack > .btn { align-self: flex-start; }
.form-stack > .btn-block { align-self: stretch; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1; min-width: 160px; width: auto; }
.inline-form label { flex-direction: row; align-items: center; flex: 0 0 auto; margin-bottom: 0; gap: 6px; font-weight: 500; }
.inline-form label input, .inline-form input[type="time"] { flex: none; min-width: 0; width: auto; }
.inline-form select { width: auto; }
.pct-field input { width: 4.8em; }
.inline-form .amount-field { flex: none; min-width: 0; width: 8.5em; }
.inline { display: inline; margin: 0; }
.toggle-form { margin-top: 12px; }

/* ---------- Alertas ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; background: var(--warn-bg); color: var(--warn-text); border: 1px solid transparent; }
.alert ul { margin: 0; padding-left: 18px; }
.alert a { color: inherit; font-weight: 600; }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); }
.alert-error { background: var(--err-bg); color: var(--err-text); }

/* ---------- Estados ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .8rem; font-weight: 650; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.badge-confirmado { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-cancelado { background: var(--err-bg); color: var(--err-text); border-color: transparent; }
.badge-pendiente { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge-completado { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.status-confirmado { border-color: var(--ok-text); color: var(--ok-text); }
.status-cancelado { border-color: var(--danger); color: var(--danger); }
.status-pendiente { border-color: var(--accent); }
.status-completado { border-color: var(--accent-strong); color: var(--accent-strong); }

/* ---------- Detalles (dl) ---------- */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0 0 24px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
details summary { cursor: pointer; font-weight: 600; }
.reschedule-form { margin-top: 16px; }

/* =====================================================================
 * Web pública
 * ===================================================================== */
.site .topbar {
  background: rgb(20 18 16 / 0.92); color: var(--ink-text);
  border-bottom: 1px solid var(--ink-border);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; flex-wrap: wrap; padding-block: 8px; }
.brand { font-family: var(--font-display); font-weight: 600; text-decoration: none; color: inherit; display: inline-flex; align-items: center; gap: 10px; font-size: 1.2rem; letter-spacing: -.01em; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--gold); color: var(--gold); font-size: 1rem; font-family: var(--font);
}
.topnav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.topnav a:not(.btn) { color: var(--ink-muted); text-decoration: none; font-weight: 500; font-size: .95rem; transition: color .15s; }
.topnav a:not(.btn):hover { color: var(--ink-text); }

/* Hero */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: radial-gradient(1200px 500px at 85% -10%, rgb(214 164 78 / 0.18), transparent 60%), var(--ink);
  color: var(--ink-text); padding-block: clamp(64px, 11vw, 128px);
}
/* Rayas de poste de barbería, muy sutiles */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background: repeating-linear-gradient(135deg, transparent 0 46px, rgb(227 184 102 / 0.05) 46px 50px);
  mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
}
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); letter-spacing: -.025em; line-height: 1.02; margin-bottom: .35em; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero .eyebrow { color: var(--gold); }
.hero .lead { color: var(--ink-muted); margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary { background: var(--gold); border-color: var(--gold); color: var(--ink); box-shadow: 0 10px 30px -10px rgb(227 184 102 / 0.6); }
.hero .btn-primary:hover { background: #f0c97c; border-color: #f0c97c; }
.hero .btn-ghost { color: var(--ink-text); border-color: rgb(255 255 255 / 0.25); }
.hero-card {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.06), rgb(255 255 255 / 0.02));
  border: 1px solid var(--ink-border); border-radius: 20px; padding: 28px;
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.6);
}
.hero-card-label { margin: 0; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; color: var(--ink-muted); font-weight: 700; }
.hero-card-hours { font-family: var(--font-display); font-size: 2rem; margin: 4px 0 18px; color: var(--ink-text); }
.checks { list-style: none; margin: 0; padding: 18px 0 0; border-top: 1px solid var(--ink-border); display: grid; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: baseline; color: var(--ink-text); font-size: .95rem; }
.checks li::before { content: "✓"; color: var(--gold); font-weight: 700; }

/* Secciones */
.section-head { margin-bottom: 28px; max-width: 640px; }
.section-head h2 { margin-bottom: .3em; }
.section-head .muted { margin: 0; }
.section-alt { background: var(--bg-alt); }

/* Servicios */
.service-card { display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s, border-color .2s; }
.service-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.service-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; margin-bottom: .4em; }
.service-card p { flex: 1; margin-top: 0; }
.service-meta { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.service-meta strong { font-family: var(--font-display); font-size: 1.5rem; color: var(--accent-strong); }
.service-link { margin-top: 14px; font-weight: 600; font-size: .92rem; text-decoration: none; }
.service-link:hover { text-decoration: underline; }

/* Equipo */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.team-member {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 28px 16px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s, border-color .2s;
}
.team-member:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.avatar {
  display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg, var(--ink-2), #3a3127); color: var(--gold);
  font-family: var(--font-display); font-size: 1.6rem; border: 2px solid var(--gold); margin-bottom: 8px;
}
.avatar-small { width: 34px; height: 34px; font-size: .95rem; margin: 0; border-width: 1px; }
.team-name { font-family: var(--font-display); font-size: 1.2rem; }
.team-cta { font-size: .85rem; color: var(--accent-strong); font-weight: 600; }

/* Reserva */
.booking { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: clamp(24px, 5vw, 56px); align-items: start; }
.booking-intro { position: sticky; top: 96px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: center; font-weight: 550; }
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: .9rem;
}
#booking-form { padding: clamp(20px, 4vw, 32px); }
#booking-form fieldset { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
#booking-form fieldset:last-of-type { border-bottom: 0; margin-bottom: 4px; padding-bottom: 0; }
.step-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-size: .85rem; font-weight: 700;
}
#booking-form .btn-primary { padding: 14px 20px; font-size: 1rem; }
.waitlist { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border-strong); }
.waitlist .btn { margin-top: 8px; }

/* Horarios */
.hours-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.hours-list { list-style: none; padding: 6px 24px; margin: 0; }
.hours-list li { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.hours-list li:last-child { border-bottom: 0; }
.hours-list li.is-closed { color: var(--muted); }
.hours-list li.is-today { font-weight: 700; color: var(--accent-strong); }
.hours-list small { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; background: var(--accent-soft); color: var(--accent-strong); padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }

/* Pie */
.footer { background: var(--ink); color: var(--ink-text); padding: 48px 0 24px; font-size: .92rem; }
.footer .muted { color: var(--ink-muted); max-width: 40ch; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-nav { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.footer-nav a { color: var(--ink-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--gold); }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--ink-border); font-size: .84rem; }

/* Página del turno, reseña y errores */
.site .narrow > .card, .site .narrow > article.card { padding: clamp(22px, 4vw, 34px); box-shadow: var(--shadow-lg); }
.site .narrow h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); }

/* Estrellas de la reseña */
.stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: 6px; border: 0; padding: 0; margin: 8px 0 16px; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 2.6rem; line-height: 1; cursor: pointer; color: var(--border-strong); margin: 0; flex: none; transition: color .1s, transform .1s; }
.stars label:hover { transform: scale(1.1); }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #e8b04a; }
.stars input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.rating { color: #e0a93e; letter-spacing: 1px; white-space: nowrap; }

/* =====================================================================
 * Panel
 * ===================================================================== */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--ink); color: var(--ink-text); border-right: 1px solid var(--ink-border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 20px; }
.nav-toggle-btn { display: none; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-muted); text-decoration: none; font-weight: 550; font-size: .94rem; transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: rgb(255 255 255 / 0.05); color: var(--ink-text); }
.sidebar-nav a[aria-current="page"] { background: rgb(227 184 102 / 0.13); color: var(--gold); }
.icon { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 14px 8px 4px; border-top: 1px solid var(--ink-border); margin-top: 12px; }
.sidebar-user { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-user strong { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: var(--ink-muted); font-size: .78rem; }
.sidebar .btn-quiet { color: var(--ink-muted); }
.sidebar .btn-quiet:hover { color: var(--ink-text); }

.app-main { padding: clamp(20px, 4vw, 40px); width: 100%; max-width: 1280px; }

/* Login */
.auth {
  display: grid; place-items: center; align-content: center; gap: 24px; min-height: 100vh; padding: 24px 16px;
  background: radial-gradient(900px 400px at 50% -10%, rgb(214 164 78 / 0.16), transparent 60%), var(--ink);
}
.auth-brand { color: var(--ink-text); font-size: 1.4rem; }
.auth-box { width: min(440px, 100%); }
.auth-box .card { box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.7); padding: 30px; }
.auth-box h1 { font-size: 1.6rem; margin-bottom: .3em; }

/* Encabezados de página */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 1.9rem); }
.app-main > h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin-bottom: 22px; }
.app-main > h2 { margin-top: 32px; font-size: 1.25rem; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; padding: 7px 10px; font-size: .9rem; }

/* Pestañas de Administración */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin: -6px 0 26px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: .93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tabs a:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; font-size: .88rem; }
.chip { padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 550; transition: border-color .15s; }
.chip:hover { border-color: var(--accent); }

/* Tablas */
.table-wrap { overflow-x: auto; padding: 0; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; background: var(--surface-2); white-space: nowrap; }
thead th:first-child { border-top-left-radius: var(--radius); }
thead th:last-child { border-top-right-radius: var(--radius); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td .actions, td.actions { gap: 6px; }
.row-muted { opacity: .55; }
.row-warn td { background: var(--warn-bg); }
.notes { max-width: 260px; font-size: .88rem; color: var(--muted); }
.num { text-align: right; }
.status-form select { width: auto; min-width: 136px; padding: 6px 10px; font-size: .88rem; font-weight: 600; border-width: 1.5px; }
.hours-table { margin-bottom: 16px; }
.hours-table input[type="time"] { width: auto; }

/* Listas */
.list { list-style: none; margin: 0 0 4px; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.list li:first-child { padding-top: 0; }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list .inline-form { flex: 1; }

/* Indicadores */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-row .card { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--accent); opacity: .8; }
.stat > .muted { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.stat strong { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1.1; }
.amount-out { color: var(--danger); }

/* Cobros */
.pay-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pay-form input { width: 100px; padding: 6px 8px; font-size: .88rem; }
.pay-form select { width: auto; padding: 6px 8px; font-size: .88rem; }

/* Código QR del 2FA */
.qr-box { display: flex; justify-content: center; margin: 18px 0; }
.qr-box .qr { max-width: 100%; height: auto; border-radius: 10px; background: #fff; padding: 10px; border: 1px solid var(--border); }
.qr-key { font-size: 1.15rem; letter-spacing: .05em; text-align: center; word-break: break-word; }

/* Comprobantes */
.invoice-rows th, .invoice-rows td { padding: 4px 6px 4px 0; border: 0; background: none; }
.invoice-rows tbody tr:hover { background: none; }
.invoice-rows td:first-child { width: 60%; }
.invoice-rows input { padding: 8px; }
.invoice { max-width: 780px; }
.invoice-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.invoice-biz { font-family: var(--font-display); font-size: 1.35rem; }
.invoice-meta { text-align: right; }
.invoice-customer { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; }
.invoice-total { font-size: 1.2rem; font-weight: 700; }
.invoice-legend { font-size: .85rem; margin-top: 20px; }

/* =====================================================================
 * Pantallas chicas
 * ===================================================================== */
@media (max-width: 900px) {
  .hero-inner, .booking, .hours-wrap { grid-template-columns: 1fr; }
  .booking-intro { position: static; }
  .hero-card { max-width: 460px; }

  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; padding: 10px 14px; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-head { padding: 0; flex: 1; }
  .nav-toggle-btn {
    display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; flex: none; cursor: pointer;
    padding: 7px 14px; border: 1px solid var(--ink-border); border-radius: 999px; font-size: .88rem; color: var(--ink-text);
  }
  .nav-toggle-btn::before { content: "☰"; }
  .nav-toggle:focus-visible ~ .sidebar-head .nav-toggle-btn { outline: 2px solid var(--gold); outline-offset: 2px; }
  .sidebar-nav, .sidebar-foot { display: none; width: 100%; }
  .nav-toggle:checked ~ .sidebar-nav { display: flex; padding-top: 12px; }
  .nav-toggle:checked ~ .sidebar-foot { display: flex; }
}

@media (max-width: 600px) {
  .topnav { gap: 14px; }
  .topnav a:not(.btn) { display: none; }
  .card { padding: 16px; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 10px; }
  .hero-actions .btn { flex: 1; }
  th, td { padding: 11px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* =====================================================================
 * Impresión (cierre de caja, comprobantes, ganancias)
 * ===================================================================== */
@media print {
  .topbar, .sidebar, .tabs, .footer, .no-print, .alert, .filters { display: none !important; }
  .app { display: block; }
  .app-main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .section { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
  .invoice { border: 0; max-width: none; }
  .stat::before { display: none; }
}

/* Títulos que siguen a otro contenido dentro de una tarjeta */
.card > h2:not(:first-child), .card > h3:not(:first-child) { margin-top: 28px; }

/* =====================================================================
 * Apartado Administración
 * ===================================================================== */
.admin-eyebrow { margin-bottom: 6px; }
.page-sub { margin: 6px 0 0; font-size: .93rem; max-width: 70ch; }
.page-note { margin: -8px 0 20px; }
.app-main > .hint { margin: -6px 0 22px; }
.app-main > .card + .hint, .app-main > .table-wrap + .hint { margin-top: -8px; }
.nowrap { white-space: nowrap; }

/* Avatar + nombre en una celda */
.user-cell { display: flex; align-items: center; gap: 12px; }
.user-cell input { min-width: 180px; }
.user-head .avatar { width: 56px; height: 56px; font-size: 1.4rem; margin: 0; }
.user-head h1 { margin: 0; }

/* Roles */
.role { display: inline-block; font-size: .76rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; letter-spacing: .01em; }
.role-admin { background: var(--accent-soft); color: var(--accent-strong); }
.role-encargado { background: #e7eefb; color: #24467f; }
.role-barbero { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
@media (prefers-color-scheme: dark) { .role-encargado { background: #1b2740; color: #a9c3f0; } }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; margin: 0 0 28px; }
.role-card { padding: 14px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.role-card p { margin: 8px 0 0; font-size: .88rem; color: var(--muted); }

/* Formularios de alta: más angostos, no de lado a lado */
.form-narrow { max-width: 720px; }
.label-small { flex: 0 0 140px !important; min-width: 0 !important; }

/* Confirmación con contraseña y 2FA */
.confirm-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px 2px; margin: 4px 0 14px; }
.confirm-title { margin: 0 0 10px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.confirm-box input { background: var(--surface); }

/* Comisión con su % pegado */
.pct-input { display: inline-flex; align-items: center; gap: 6px; }
.pct-input input { width: 5em; }
.row-actions { justify-content: flex-end; flex-wrap: nowrap; }
td .row-actions { white-space: nowrap; }

/* Selector Todo / Solo alertas */
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .88rem; }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.row-alert td { background: var(--err-bg); }
.row-alert:hover td { background: var(--err-bg); }
.app-main td { vertical-align: middle; }
.cards-2 { align-items: start; }
.card-badge { margin-bottom: 14px; }
.card-off { opacity: 1; background: var(--surface-2); }
.card-off input, .card-off textarea { opacity: .75; }
