/* ============================================================
   ADMIN.CSS — Panel de administración
   App Barbería Reto's
   ============================================================
   Depende de: tokens.css + ui-system.css
   Reemplaza: styles.css
   ============================================================
   Modo dark: mismo sistema de tokens que public,
   fondo negro, superficies #111, texto blanco.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* ----------------------------------------------------------
   RESET BASE
---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

button, a, input, select, textarea, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ----------------------------------------------------------
   HTML — iOS PWA safe-area fix
   Mismo fix que home.css: WebKit en standalone desplaza el
   viewport por safe-area-inset-top sin compensar abajo.
---------------------------------------------------------- */
html {
  margin: 0;
  min-height: calc(100% + env(safe-area-inset-top, 0px));
  background: var(--color-dark-bg);
  overflow: hidden;                   /* iOS PWA: bloquear bounce nativo del viewport */
  overscroll-behavior: none;          /* Chrome/Firefox: bloquear overscroll nativo */
}

/* ----------------------------------------------------------
   BODY — AUTH MODE (pantalla de login)
   Fondo negro, formulario centrado, inputs blancos
---------------------------------------------------------- */
body.admin-auth-mode {
  margin: 0;
  font-family: var(--font-family);
  background: var(--color-dark-bg);
  color: var(--color-white);
  min-height: 100dvh;
}

body.admin-auth-mode .shell {
  width: min(430px, 100%);
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 0 28px;
  display: flex;
  flex-direction: column;
}

/* Cabecera del login admin: fondo oscuro (sobreescribe --ui-head-bg del ui-system) */
.admin-auth-header {
  --ui-head-bg: var(--color-dark-bg);   /* ← variable del sistema; propaga fondo oscuro */
  flex-shrink: 0;
  padding: max(calc(env(safe-area-inset-top, 0px) + var(--sheet-safe-extra)), var(--top-anchor))
           var(--app-padding-x)
           9px;
}

.admin-auth-logo {
  width: 56px;
  height: auto;
  display: block;
}

.admin-auth-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}

.admin-auth-close svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: none;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
}

/* Card del formulario de auth */
.admin-auth-card {
  margin-top: 0;
}

body.admin-auth-mode .admin-auth-card {
  margin-top: 32px;   /* igual al gap cabecera→título del user (medido: 32px exactos) */
  max-width: 520px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  border: none;
  background: transparent;
  color: var(--color-white);
  box-shadow: none;
  padding: 0 var(--app-padding-x);
}

/* Centra el formulario exactamente igual que auth-body en user (var(--form-max-width)) */
body.admin-auth-mode .admin-auth-card .ui-form-shell {
  max-width: var(--form-max-width);   /* user usa max-width:var(--form-max-width) + margin:auto → 48px cada lado */
}

/* -- DARK MODE: solo colores. Estructura/tamaños vienen de ui-system.css -- */

body.admin-auth-mode .admin-auth-card h2,
body.admin-auth-mode .admin-auth-card .ui-title {
  color: var(--color-white);
  margin-top: 0;                   /* resetea el margin-top por defecto del h2 (~24px) */
  margin-bottom: var(--space-6);   /* igual que user (24px) */
}

/* Subtítulo dark mode */
body.admin-auth-mode .admin-auth-card p,
body.admin-auth-mode .admin-auth-card .ui-text {
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: var(--space-5);   /* 20px — respira pero no separa demasiado */
}

/* Labels ocultos: los placeholders hacen su función en auth */
body.admin-auth-mode .admin-auth-card label,
body.admin-auth-mode .admin-auth-card .ui-label {
  display: none;
}

/* Inputs dark mode */
body.admin-auth-mode .admin-auth-card .ui-input,
body.admin-auth-mode .admin-auth-card .ui-control {
  border-color: var(--color-dark-border);
  color: var(--color-white);
  background: transparent;
  outline: none;
}

body.admin-auth-mode .admin-auth-card .ui-input::placeholder,
body.admin-auth-mode .admin-auth-card .ui-control::placeholder {
  color: rgba(255, 255, 255, 0.45);
  opacity: 1;
}

body.admin-auth-mode .admin-auth-card .ui-input:focus,
body.admin-auth-mode .admin-auth-card .ui-control:focus {
  border-color: var(--color-white);
}

/* Espaciado entre inputs:
   Se usa ~ (hermano general) porque hay <label display:none> entre inputs
   que rompe el selector + (adyacente inmediato) */
body.admin-auth-mode .admin-auth-card .ui-control ~ .ui-field,
body.admin-auth-mode .admin-auth-card .ui-control ~ .ui-control,
body.admin-auth-mode .admin-auth-card .ui-field   ~ .ui-field {
  margin-top: var(--space-3);   /* 12px — igual que user */
}

/* Espacio antes de los botones — igual que user (space-5 = 20px) */
body.admin-auth-mode .admin-auth-card .ui-field   ~ .ui-actions,
body.admin-auth-mode .admin-auth-card .ui-control ~ .ui-actions {
  margin-top: var(--space-5);   /* 20px — igual que user */
}

/* Password wrapper — layout del botón ojo */
body.admin-auth-mode .admin-auth-card .password-field-wrap {
  position: relative;
}

body.admin-auth-mode .admin-auth-card .password-field-wrap .ui-control {
  padding-right: 56px;
}

body.admin-auth-mode .admin-auth-card .password-eye-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
}

body.admin-auth-mode .admin-auth-card .password-eye-btn[data-eye-state="open"]   .eye-slash  { display: none; }
body.admin-auth-mode .admin-auth-card .password-eye-btn[data-eye-state="open"]   .eye-pupil  { display: block; }
body.admin-auth-mode .admin-auth-card .password-eye-btn[data-eye-state="closed"] .eye-slash  { display: block; }
body.admin-auth-mode .admin-auth-card .password-eye-btn[data-eye-state="closed"] .eye-pupil  { display: none; }

/* Botón link dark mode — igual que auth-link-btn de user: 15px semi-bold, color apagado */
body.admin-auth-mode .admin-auth-link-btn {
  border: none;
  background: none;
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  color: rgba(255, 255, 255, 0.55);   /* equivalente a --color-muted en dark */
}

body.admin-auth-mode .admin-auth-link-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mensajes de error/ok */
body.admin-auth-mode .admin-auth-card .message,
body.admin-auth-mode .admin-auth-card .ui-help {
  color: var(--color-danger);
}

body.admin-auth-mode .admin-auth-card .message.ok { color: var(--color-success); }

/* ----------------------------------------------------------
   BODY — DASHBOARD MODE
   Fondo negro, layout móvil max 430px
---------------------------------------------------------- */
body.admin-dashboard-mode {
  margin: 0;
  font-family: var(--font-family);
  background: var(--color-dark-bg);
  color: var(--color-ink);
  /* Variables de layout que usan los estilos heredados */
  --home-x: var(--app-padding-x);
  --home-bottom: var(--space-5);
  --hero-cta-bottom: clamp(60px, 10vh, 110px);
  --top-anchor-home: var(--top-anchor);
  --top-anchor-drawer: clamp(50px, 7.6dvh, 71px);
  --bottom-anchor-drawer: clamp(42px, 6.8dvh, 58px);
  --top-safe-extra-home: var(--top-safe-extra);
  --top-safe-extra-drawer: var(--sheet-safe-extra);
  --bottom-safe-extra-drawer: 18px;
  --actions-top-offset: clamp(3px, 0.7vh, 7px);
  --menu-control-max-width: var(--form-max-width);
  --menu-control-min-height: var(--control-height);
}

body.admin-dashboard-mode .shell {
  width: min(430px, 100%);
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.admin-mobile-dashboard {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

/* ----------------------------------------------------------
   ADMIN HOME VIEW — Pantalla principal (foto de fondo)
   Idéntica visualmente a la pantalla pública
---------------------------------------------------------- */
.admin-home-view {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding:
    max(calc(env(safe-area-inset-top, 0px) + var(--top-safe-extra-home)), var(--top-anchor-home))
    var(--home-x)
    calc(env(safe-area-inset-bottom, 0px) + var(--home-bottom));
  /* padding-bottom: igual que el user (space-5 = 20px) — el botón "Mis citas" se
     posiciona a la altura del botón "Llamar" del user gracias a --hero-cta-bottom */
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--home-bottom));
  background-image: url("https://elquestudio.es/assets/Home_Barberia_Retos.jpg");
  background-size: cover;
  background-position: center;
  color: var(--color-white);
  overflow: hidden;
  isolation: isolate;
}

.admin-home-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(0,0,0,0.70) 0%,
      rgba(0,0,0,0.55) 35%,
      rgba(0,0,0,0.66) 100%),
    radial-gradient(circle at 30% 10%, rgba(0,0,0,0.34), transparent 60%);
  z-index: 0;
}

/* Cabecera: logo + iconos acción */
.admin-home-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

/* .admin-home-logo + estado colapsado → unificados en ui-system.css */

/* .admin-home-actions → unificado en ui-system.css */

.admin-home-icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.admin-home-icon-btn svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* .admin-home-icon-badge → unificado en ui-system.css */

/* Bloque de texto + CTAs (parte inferior) */
.admin-home-main {
  position: relative;
  z-index: 2;
  margin-top: auto;
  width: 100%;
  padding-bottom: var(--hero-cta-bottom);
}

/* .admin-home-brand-line + h1 → unificados en ui-system.css */

.admin-home-ctas {
  margin-top: clamp(28px, 5vh, 48px);
  display: grid;
  gap: var(--space-4);
}

/* .admin-home-cta base → unificado en ui-system.css */
.admin-home-cta {
  width: 100%;
  /* background, color → ui-system.css (regla compartida CTA) */
}

/* Variante secundaria (si se usa) */
.admin-home-cta.secondary {
  background: rgba(0, 0, 0, 0.75);
  color: var(--color-white);
  border-color: var(--color-white);
}

/* ----------------------------------------------------------
   SCRIM DEL DRAWER
---------------------------------------------------------- */
body.admin-drawer-open { overflow: hidden; }

/* ----------------------------------------------------------
   ADMIN SIDE DRAWER — Menú lateral
   Desliza desde la derecha, fondo blanco
---------------------------------------------------------- */
.admin-side-drawer {
  position: absolute;
  inset: 0;
  z-index: var(--z-drawer);
  background: var(--color-white);
  transform: translateX(100%);
  transition: transform var(--motion-slow) var(--ease-out);
  display: flex;
  flex-direction: column;
  padding: 0 0 max(calc(env(safe-area-inset-bottom, 0px) + 100px), 100px);
}

.admin-side-drawer.open { transform: translateX(0); }

/* Cabecera del drawer — mismo padding y margin-bottom que el drawer del user */
.admin-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(calc(env(safe-area-inset-top, 0px) + var(--sheet-safe-extra)), var(--top-anchor))
           var(--app-padding-x) 0;
  flex-shrink: 0;
  margin-bottom: var(--space-8);   /* 32px — igual que .ui-head en home.css */
}

.admin-drawer-logo {
  width: 56px;
  height: auto;
  display: block;
}

.admin-drawer-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-ink);
  cursor: pointer;
  padding: 0;
}

.admin-drawer-close svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: none;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
}

/* Layout de .admin-drawer-menu → ui-system.css (compartido con user) */

/* Estilos de .admin-drawer-item → ui-system.css (compartido con user) */

/* Posición y estilos de .admin-drawer-logout → ui-system.css (compartido con user) */

/* ----------------------------------------------------------
   ADMIN CONTENT SHELL — Panel de contenido (sube desde abajo)
---------------------------------------------------------- */
.admin-content-shell {
  position: absolute;
  inset: 0;
  z-index: var(--z-sheet);
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Non-sheet (Administración, Perfil): slide desde la derecha en todos los tamaños */
.admin-content-shell:not(.is-sheet) {
  transform: translateX(100%);
  transition: transform var(--motion-slow) var(--ease-out);
  pointer-events: none;
}
.admin-content-shell:not(.is-sheet).open {
  transform: translateX(0);
  pointer-events: auto;
}

.admin-content-shell.is-sheet {
  top: max(calc(env(safe-area-inset-top, 0px) + 88px), 128px);
  background: var(--color-bg);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  transform: translateY(100%);
  transition: transform var(--motion-base) var(--ease-out);
  pointer-events: none;
}

.admin-content-shell.is-sheet.open {
  transform: translateY(0);
  pointer-events: auto;
}

/* Cabecera del panel (version no-sheet: estilo pantalla completa) */
.admin-content-head:not(.ui-head) {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-white);
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "logo spacer close"
    "title title title";
  align-items: start;
  row-gap: clamp(82px, 13.5dvh, 120px);
  padding:
    max(calc(env(safe-area-inset-top, 0px) + 12px), 58px)
    var(--home-x)
    18px;
}

.admin-content-logo:not(.ui-head__logo) {
  grid-area: logo;
  width: 56px;
  height: auto;
  object-fit: contain;
}

/* Cabecera del panel (version sheet: compacta) */
.admin-content-shell.is-sheet .admin-content-head:not(.ui-head) {
  z-index: 2;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding:
    max(calc(env(safe-area-inset-top, 0px) + 12px), clamp(24px, 3.6dvh, 30px))
    var(--home-x)
    var(--space-3);
}

.admin-content-shell.is-sheet .admin-content-logo:not(.ui-head__logo) { display: none; }

.admin-content-shell.is-sheet .admin-content-head:not(.ui-head) h2 {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Título en cabecera estándar */
.admin-content-head:not(.ui-head) h2 {
  grid-area: title;
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-semibold);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

/* Botón cerrar del panel */
.admin-content-close:not(.ui-head__close) {
  grid-area: close;
  justify-self: end;
  align-self: start;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-ink);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-content-shell.is-sheet .admin-content-close:not(.ui-head__close) {
  width: 44px;
  height: 44px;
  margin-top: 0;
}

/* ── Sheet title en cabecera (h2 + X) ───────────────── */
/* Oculto por defecto — sólo visible cuando el management shell es sheet */
.admin-content-sheet-title {
  /* Tipografía + color → ui-system.css */
  display: none;
  flex: 1;
}

/* En modo sheet: mostrar h2 en cabecera, ocultar logo + h2 en scroll */
#admin-management-shell.is-sheet .admin-content-sheet-title  { display: block; }
#admin-management-shell.is-sheet .ui-head__logo              { display: none !important; }
#admin-management-shell.is-sheet .admin-management-title     { display: none !important; }
#admin-management-shell.is-sheet #admin-sections-nav         { display: none !important; }

/* Sheet del management: misma altura y fondo que "Reservar cita" */
#admin-management-shell.is-sheet {
  top: max(calc(env(safe-area-inset-top, 0px) + 80px), 112px);
  background: var(--color-surface-dim);
}

/* Cabecera en sheet mode: eliminar fondo blanco y margen del ui-head */
#admin-management-shell.is-sheet > .admin-content-head {
  background: var(--color-surface-dim) !important;
  padding-top: var(--space-6) !important;
  padding-bottom: var(--space-4) !important;
  margin-bottom: 0 !important;
}

/* Scroll: sin gap extra; padding inferior = safe area del home bar */
#admin-management-shell.is-sheet .admin-content-scroll {
  padding-top: 0;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 16px);
  display: flex;
  flex-direction: column;
}

/* El grid wrapper hereda el flex y cancela su margin-top inline */
#admin-management-shell.is-sheet .admin-content-scroll > .grid {
  flex: 1;
  margin-top: 0 !important;
  display: flex;
  flex-direction: column;
}

/* El panel de horario crece para llenar el espacio disponible — solo cuando está activo */
#admin-management-shell.is-sheet [data-admin-panel="schedules"].is-active {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* La vacation-card mantiene su altura natural */
#admin-management-shell.is-sheet .admin-schedule-vacation-card {
  display: flex;
  flex-direction: column;
}

/* El calendario no intercepta gestos de pan/scroll — el JS maneja el drag de selección */
#admin-management-shell.is-sheet .admin-schedule-calendar-grid {
  touch-action: none;
}

/* "Vacaciones": el espacio superior lo da el margin-bottom de la card anterior */
#admin-management-shell.is-sheet .admin-schedule-vacation-title {
  margin-top: 0;
  margin-bottom: var(--space-3);
}

/* Quitar bordes y background de los paneles section en sheet mode */
#admin-management-shell.is-sheet .card.admin-panel {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

/* Panel de servicios en sheet: la lista crece y el footer queda fijo abajo */
#admin-management-shell.is-sheet [data-admin-panel="services"].is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#admin-management-shell.is-sheet .admin-services-list {
  flex: 1;
}

/* El footer gestiona el safe-area propio → el scroll container no lo necesita aquí */
#admin-management-shell.is-sheet .admin-content-scroll:has([data-admin-panel="services"].is-active) {
  padding-bottom: 0;
}

#admin-management-shell.is-sheet .admin-services-footer {
  position: sticky;
  bottom: 0;
  /* Breakout: escapa del padding horizontal del scroll container */
  margin-left: calc(-1 * var(--home-x));
  margin-right: calc(-1 * var(--home-x));
  padding-left: var(--home-x);
  padding-right: var(--home-x);
  padding-top: var(--space-3);
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 46px);
  background: var(--color-surface-dim);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: 0 -12px 20px 4px rgba(0, 0, 0, 0.12);
}

/* En sheet mode los controles no necesitan margin propio (el footer gestiona el gap) */
#admin-management-shell.is-sheet .admin-services-controls,
#admin-management-shell.is-sheet .admin-services-order-actions {
  margin-bottom: 0;
}

.admin-content-close:not(.ui-head__close) svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
}

/* Contenido scrollable del panel */
.admin-content-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;        /* iOS: no delegar overscroll al viewport */
  -webkit-overflow-scrolling: touch;
  padding:
    0
    var(--home-x)
    max(calc(env(safe-area-inset-bottom, 0px) + 28px), 28px);
}

/* ----------------------------------------------------------
   ADMIN CARDS (panels de contenido)
---------------------------------------------------------- */
body.admin-dashboard-mode .card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  box-shadow: none;
  border-radius: var(--radius-card);
}

body.admin-dashboard-mode .card h2 {
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

body.admin-dashboard-mode .admin-profiles-panel {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

/* ----------------------------------------------------------
   ADMIN MANAGEMENT — Menú de secciones
---------------------------------------------------------- */
.admin-management-menu-screen {
  display: none;
  min-height: 100%;
  background: var(--color-white);
  color: var(--color-ink);
  /* padding-top eliminado — lo gestiona el .ui-head interno (mismo patrón que .sheet) */
  padding-left: var(--home-x);
  padding-right: var(--home-x);
  padding-bottom: max(calc(env(safe-area-inset-bottom, 0px) + var(--bottom-safe-extra-drawer)), var(--bottom-anchor-drawer));
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#admin-management-shell.menu-mode .admin-management-menu-screen { display: flex; }

#admin-management-shell.menu-mode .admin-content-head,
#admin-management-shell.menu-mode .admin-content-scroll { display: none; }

.admin-management-menu-body {
  /* margin-top eliminado — el header ya aporta var(--space-8) = 32px de separación */
  /* padding-left eliminado — indentación de ítems gestionada por .ui-menu-item--indent */
  padding-bottom: clamp(16px, 3vh, 30px);
}

.admin-management-menu-title {
  /* font-size, font-weight, margin → heredados de .ui-title en ui-system.css */
  color: var(--color-black);
  font-family: var(--font-family);
  text-align: left;
}

/* Título de sección del panel de contenido (fuera del header, en el scroll) */
.admin-management-title {
  color: var(--color-black);
  font-family: var(--font-family);
  text-align: left;
  margin-bottom: var(--space-5); /* 20px — separación antes del contenido del panel */
}

/* Excepción: sección Usuarios no necesita padding-top en el h2 */
.admin-content-scroll:has([data-admin-panel="users"].is-active) > .admin-management-title {
  padding-top: 0;
}

/* ----------------------------------------------------------
   SECTION CHIPS — Pestañas de navegación dentro del panel
   Usan ui-btn pero necesitan forma de píldora
---------------------------------------------------------- */
.section-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: var(--space-4) 0 var(--space-2);
}

.section-chip {
  border-radius: var(--radius-pill) !important;
  padding: 7px 16px;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  min-height: auto;
  height: auto;
  line-height: 1.3;
  box-shadow: none !important;
  transform: none !important;
}

/* Chip inactivo: borde oscuro, fondo blanco */
.section-chip.ui-btn--ghost {
  border: 2px solid var(--color-ink);
  background: var(--color-white);
  color: var(--color-ink);
}

/* Chip activo: negro sólido */
.section-chip.ui-btn--primary,
.section-chip.is-active {
  background: var(--color-ink-deep);
  border-color: var(--color-ink-deep);
  color: var(--color-white);
}

/* ----------------------------------------------------------
   PANEL VISIBILITY — Controlada por JS via .is-active
   Todos los paneles ocultos por defecto; solo el activo visible
---------------------------------------------------------- */
[data-admin-panel] { display: none; }
[data-admin-panel].is-active { display: block; }

/* Grid wrapper: se oculta cuando ningún panel hijo está activo */
.grid:has([data-admin-panel]):not(:has([data-admin-panel].is-active)) {
  display: none;
}

/* Standalone mode: vista individual desde el menú Administración
   → ocultar chips de navegación, mostrar solo el panel activo */
.admin-content-shell.standalone-mode #admin-sections-nav {
  display: none;
}

/* ----------------------------------------------------------
   ADMIN POPUPS
   Se muestran sobre el panel de contenido
---------------------------------------------------------- */
/* Overlay → ui-system.css (.ui-popup-overlay)
   Aquí solo: padding específico y estilos de contenido. */
/* Overlay padding ahora lo hereda de .ui-popup-overlay en ui-system.css */

.admin-confirm-card {
  padding: clamp(26px, 4.8dvh, 38px) var(--home-x) clamp(22px, 4dvh, 34px);
}

.admin-confirm-title {
  margin: 0;
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: clamp(24px, 7.2vw, 31px);
  font-weight: var(--font-weight-bold);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.admin-confirm-save-btn,
.admin-confirm-delete-btn,
.admin-confirm-cancel-btn {
  width: 100%;
  max-width: var(--menu-control-max-width);
  margin-left: auto;
  margin-right: auto;
  height: var(--control-height);
  border-radius: var(--radius-pill);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-confirm-save-btn {
  margin-top: var(--popup-detail-gap);
  border: none;
  background: var(--color-ink-deep);
  color: var(--color-white);
}

.admin-confirm-delete-btn {
  margin-top: var(--popup-detail-gap);
  border: none;
  background: var(--color-danger);
  color: var(--color-white);
}

.admin-confirm-cancel-btn {
  margin-top: var(--space-3);
  border: 2px solid var(--color-ink-deep);
  background: var(--color-white);
  color: var(--color-ink-deep);
}

/* Popup vacaciones */
/* Card base (border-radius, bg, shadow, animation) → ui-system.css (.ui-popup-card) */
.admin-vacation-popup-card {
  padding: clamp(24px, 4.4dvh, 34px) var(--home-x) clamp(22px, 4.4dvh, 30px);
  text-align: left;
}

.admin-vacation-popup-title {
  margin: 0;
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: clamp(29px, 7.2vw, 35px);
  font-weight: var(--font-weight-semibold);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.admin-vacation-popup-date {
  margin: clamp(20px, 3.4dvh, 26px) 0 0;
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: clamp(21px, 5.2vw, 28px);
  font-weight: var(--font-weight-semibold);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-align: center;
}

.admin-vacation-popup-row {
  margin-top: clamp(16px, 2.8dvh, 20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.admin-vacation-popup-row span {
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: clamp(17px, 4.8vw, 24px);
  font-weight: var(--font-weight-semibold);
  line-height: 1.1;
}

/* Toggle switch vacaciones */
.admin-vacation-switch {
  width: clamp(78px, 20vw, 90px);
  min-width: clamp(78px, 20vw, 90px);
  height: clamp(42px, 10vw, 48px);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  padding: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  transition: background var(--motion-base) var(--ease-out);
}

.admin-vacation-switch-thumb {
  width: clamp(36px, 8.6vw, 42px);
  height: clamp(36px, 8.6vw, 42px);
  border-radius: 50%;
  background: var(--color-white);
  box-shadow: var(--shadow-control);
  transition: transform var(--motion-base) var(--ease-out);
}

.admin-vacation-switch.is-on {
  background: var(--color-success);
}

.admin-vacation-switch.is-on .admin-vacation-switch-thumb {
  transform: translateX(clamp(36px, 9vw, 42px));
}

/* Botón "Validar" (amarillo) */
.admin-vacation-popup-validate {
  width: 100%;
  max-width: var(--menu-control-max-width);
  height: var(--control-height);
  margin: clamp(26px, 4.8dvh, 38px) auto 0;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-vacation);
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-vacation-popup-msg {
  margin: var(--space-2) auto 0;
  max-width: var(--menu-control-max-width);
  color: var(--color-danger);
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-align: center;
  line-height: 1.25;
}

/* Popup de éxito — estructura en ui-system.css */

/* ----------------------------------------------------------
   ADMIN APPOINTMENTS — Panel de citas
---------------------------------------------------------- */

/* Píldora de fecha — selector principal */
.admin-appt-date-pill {
  width: 100%;
  margin-bottom: var(--space-4);
}

/* Card del calendario (expandible) */
.admin-appt-calendar-card {
  background: var(--color-white);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  padding: 18px var(--space-4);
  margin-bottom: var(--space-4);
}

/* Botones prev/next del mes — igual que schedule */
.admin-appt-calendar-nav {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.admin-appt-calendar-nav svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon-lg);
  stroke-linecap: round;
}

/* Título del mes */
.admin-appt-calendar-title {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  color: var(--color-ink);
  text-align: center;
}

/* Fila de nombres de día (Lun Mar Mié…) */
.admin-appt-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  margin: 6px 0 10px;
}

.admin-appt-calendar-weekdays span {
  text-align: center;
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  color: var(--color-muted);
  line-height: 1;
  padding: var(--space-1) 0;
}

/* Grid de celdas del mes */
.admin-appt-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

/* Celda de día */
.admin-appt-calendar-day {
  aspect-ratio: 1;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-regular);
  color: var(--color-ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 2px;
  transition: background var(--motion-fast) var(--ease-out);
}

/* Días de otro mes → invisibles */
.admin-appt-calendar-day.is-outside {
  opacity: 0;
  pointer-events: none;
}

/* Días pasados → muy tenues */
.admin-appt-calendar-day.is-blocked {
  color: var(--color-muted);
  opacity: 0.35;
  cursor: default;
}

/* Días sin horario → gris tenue */
.admin-appt-calendar-day.is-closed {
  color: var(--color-muted);
  opacity: 0.5;
}

/* Días con huecos libres → fondo verde */
.admin-appt-calendar-day.is-available {
  background: var(--color-success);
  color: var(--color-black);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-sm);
}

/* Días completos → fondo rojo */
.admin-appt-calendar-day.is-full {
  background: var(--color-danger);
  color: var(--color-white);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-sm);
}

/* Día seleccionado → fondo blanco + borde del color del estado */
.admin-appt-calendar-day.is-selected {
  background: var(--color-white);
  color: var(--color-black);
  box-shadow: inset 0 0 0 2px var(--color-ink);
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-sm);
  opacity: 1;
}
.admin-appt-calendar-day.is-selected.is-available {
  box-shadow: inset 0 0 0 2px var(--color-success);
}
.admin-appt-calendar-day.is-selected.is-full {
  box-shadow: inset 0 0 0 2px var(--color-danger);
}

/* ------ Mensaje y estados vacíos ------ */
.admin-appt-msg { margin-bottom: var(--space-3); }

.admin-appt-empty {
  text-align: center;
  color: var(--color-muted);
  margin: var(--space-6) 0 var(--space-3);
  font-family: var(--font-family);
  font-size: var(--font-size-stat);
  font-weight: var(--font-weight-bold);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* ------ Lista de citas ------ */
.admin-appt-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-3);
}

/* Card de cita — grid: info a la izq, botones a la dcha */
.admin-appt-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name    actions"
    "service actions"
    "time    actions";
  align-items: center;
  column-gap: var(--space-3);
  row-gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-white);
  border-radius: var(--radius-card);
}

.admin-appt-item-name {
  grid-area: name;
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-item);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge amarillo para el nombre del servicio */
.admin-appt-item-service {
  grid-area: service;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  margin: 0;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-vacation);
  color: var(--color-black);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-regular);
  line-height: 1.4;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* La fecha no se muestra en la vista de día — ocultar */
.admin-appt-item-date { display: none; }

.admin-appt-item-time {
  grid-area: time;
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-regular);
  line-height: 1.2;
}

.admin-appt-item-actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

/* Botones de acción: llamar + anular */
.admin-appt-item-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-ink);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.admin-appt-item-btn img {
  width: 26px;
  height: 26px;
}

.admin-appt-item-btn.delete { color: var(--color-danger); }
.admin-appt-item-btn:disabled { opacity: 0.4; cursor: default; }

/* ------ Footer sticky — "+ Nueva cita" ------ */
.admin-appt-footer {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-5);
}

/* ------ Sheet mode — Mis citas ------ */
#admin-management-shell.is-sheet [data-admin-panel="appointments"].is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#admin-management-shell.is-sheet .admin-appt-list {
  flex: 1;
}

/* Estado vacío: centrar verticalmente entre el date pill y el footer.
   Cuando .admin-appt-empty está visible (sin .hidden), la lista vacía
   colapsa a 0 y el párrafo ocupa todo el espacio libre. */
#admin-management-shell.is-sheet
  [data-admin-panel="appointments"].is-active:has(.admin-appt-empty:not(.hidden))
  .admin-appt-list {
  flex: 0;
  padding: 0;
}

#admin-management-shell.is-sheet
  [data-admin-panel="appointments"].is-active:has(.admin-appt-empty:not(.hidden))
  .admin-appt-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

/* El footer gestiona el safe-area → el scroll container no lo necesita aquí */
#admin-management-shell.is-sheet .admin-content-scroll:has([data-admin-panel="appointments"].is-active) {
  padding-bottom: 0;
}

#admin-management-shell.is-sheet .admin-appt-footer {
  position: sticky;
  bottom: 0;
  margin-left: calc(-1 * var(--home-x));
  margin-right: calc(-1 * var(--home-x));
  padding-left: var(--home-x);
  padding-right: var(--home-x);
  padding-top: var(--space-3);
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 46px);
  background: var(--color-surface-dim);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -12px 20px 4px rgba(0, 0, 0, 0.12);
}

/* ----------------------------------------------------------
   ADMIN SERVICES — Panel de servicios
---------------------------------------------------------- */

/* Footer de servicios: wrapper para controles + guardar orden */
.admin-services-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* Botón "Nuevo servicio" */
.admin-services-controls {
  display: flex;
  flex-direction: column;
}

/* Botones CTA amarillos: píldora ancho completo */
#btn-service-open-create,
#btn-admin-appt-open-create {
  width: 100%;
  height: var(--control-height);
  border-radius: var(--radius-pill);
  background: var(--color-vacation);
  color: var(--color-black);
  border: none;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Texto de ayuda en modo reordenar */
.admin-services-order-hint {
  margin: 0 0 var(--space-3);
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-regular);
  line-height: 1.4;
}

/* Fila "Guardar orden" + "Cancelar" en modo reordenar */
.admin-services-order-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Estado vacío */
.admin-services-empty {
  margin: var(--space-6) 0;
  text-align: center;
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
}

/* ------ Popup editor (crear / editar servicio) ------ */
/* Overlay → ui-system.css (.ui-popup-overlay) */
.admin-service-editor-popup {
  padding: clamp(22px, 4.8dvh, 42px) var(--home-x)
           max(calc(env(safe-area-inset-bottom, 0px) + 18px), 26px);
}

.admin-service-editor-card {
  padding: clamp(26px, 4.8dvh, 38px) var(--home-x) clamp(22px, 4dvh, 34px);
  text-align: left;
}

.admin-service-editor-title {
  margin: 0 0 var(--space-5);
}

.admin-service-editor-label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
}

/* Input nombre — ancho completo */
.admin-service-editor-name {
  width: 100%;
  margin-bottom: var(--space-4);
}

/* Fila dos columnas: duración + precio */
.admin-service-editor-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.admin-service-editor-col {
  display: flex;
  flex-direction: column;
}

.admin-service-editor-small {
  width: 100%;
}

/* Botones del editor */
.admin-service-editor-save,
.admin-service-editor-cancel {
  width: 100%;
}

.admin-service-editor-save {
  margin-bottom: var(--space-3);
}

.admin-appt-form-delete-btn {
  margin-top: var(--space-2);
  width: 100%;
}

.admin-service-editor-msg {
  margin-top: var(--space-3);
  text-align: center;
}

/* ------ Formulario "Nueva cita" ------ */

/* El card de cita tiene más campos que el de servicio → proteger overflow */
.admin-appt-editor-card {
  max-height: calc(
    100dvh
    - max(env(safe-area-inset-top, 0px), 22px)
    - max(env(safe-area-inset-bottom, 0px), 22px)
    - 44px
  );
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* El padding superior lo asume el header sticky */
  padding-top: 0;
}

/* Margen inferior en todos los inputs / selects del formulario */
.admin-appt-editor-card .admin-service-editor-input {
  display: block;
  width: 100%;
  margin-bottom: var(--space-4);
}

/* Los triggers custom son flex (texto + icono) — override del display:block anterior */
.admin-appt-editor-card .admin-appt-custom-select-trigger {
  display: flex;
  margin-bottom: 0; /* el margen lo gestiona el wrapper (.admin-appt-editor-input-mb) */
}

/* Dentro del grid fecha/hora el margen lo pone el two-cols wrapper */
.admin-appt-editor-two-cols .admin-service-editor-input {
  margin-bottom: 0;
  /* Quitar iconos y flechas nativos de iOS para date/time */
  -webkit-appearance: none;
  appearance: none;
}

/* Margen superior para labels que no son el primero del grupo */
.admin-appt-editor-card .admin-service-editor-label {
  margin-top: var(--space-1);
}

/* Separador entre "qué/cuándo" y "datos del cliente" */
.admin-appt-form-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-4) 0;
}

/* Texto "(opcional)" dentro de la label — peso visual reducido */
.admin-appt-form-optional {
  font-weight: var(--font-weight-regular);
  color: var(--color-muted);
}

/* Cabecera "Nueva cita" + botón X — fija al hacer scroll del formulario */
.admin-appt-form-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-white);
  /* Recupera el padding superior del card + espacio inferior hacia el primer campo */
  padding-top: clamp(26px, 4.8dvh, 38px);
  padding-bottom: var(--space-4);
  /* Extiende el fondo hasta los bordes laterales del card para tapar el scroll */
  margin-left: calc(-1 * var(--home-x));
  margin-right: calc(-1 * var(--home-x));
  padding-left: var(--home-x);
  padding-right: var(--home-x);
}

.admin-appt-form-header .admin-service-editor-title {
  margin: 0;
}

.admin-appt-form-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  border-radius: 50%;
  margin-right: calc(-1 * var(--space-2));
}

/* position:fixed ahora viene de .ui-popup-overlay (ui-system.css) */

/* El card sí permite scroll vertical propio */
.admin-appt-editor-card {
  touch-action: pan-y;
}

/* Custom triggers de Nueva cita — el SVG chevron va inline en el HTML,
   aquí solo aplicamos borde fuerte y cursor. */
.admin-appt-editor-select {
  border: 2px solid var(--color-ink-deep);
  cursor: pointer;
}

/* Wrapper del campo Fecha: el input nativo flota encima invisible para abrir el picker */
.admin-appt-date-wrap {
  position: relative;
}

.admin-appt-date-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

/* Grid fecha / hora — minmax(0,…) fuerza al grid a respetar el ancho de columna
   aunque el input nativo de iOS tenga un mínimo intrínseco mayor */
.admin-appt-editor-two-cols {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-2);
}

/* Los inputs dentro del grid se ajustan al 100 % de su columna */
.admin-appt-editor-two-cols .admin-service-editor-col {
  min-width: 0;
}

/* Ambos campos son ahora type="text" readonly → centrado nativo del browser */
.admin-appt-editor-two-cols .admin-service-editor-col .admin-service-editor-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  height: 41px;
  min-height: 41px;
  padding-top: 0;
  padding-bottom: 0;
  text-align: center;
}

/* Subtítulo/nombre en popups de confirmación */
.admin-service-delete-name,
.admin-appt-cancel-service {
  margin: var(--popup-detail-gap) 0 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-item);
  font-weight: var(--font-weight-semibold);
}

.admin-appt-cancel-meta {
  margin: 7px 0 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
}

/* ------ Items de la lista ------ */
.admin-service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-white);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-3);
  /* Impedir selección de texto en toda la card */
  -webkit-user-select: none;
  user-select: none;
}

.admin-service-item.is-dragging {
  opacity: 0.5;
  box-shadow: var(--shadow-popup);
}

/* Feedback visual mientras se mantiene pulsado el handle */
.admin-service-drag-handle.is-long-press-pending {
  color: var(--color-success);
  transform: scale(1.2);
  transition: transform 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.admin-service-item-info { flex: 1; min-width: 0; }

.admin-service-item-name {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-item);
  font-weight: var(--font-weight-semibold);
  line-height: 1.1;
}

.admin-service-item-meta {
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.admin-service-item-price,
.admin-service-item-duration {
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-regular);
}

.admin-service-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.admin-service-item-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--color-ink);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.admin-service-item-btn.delete { color: var(--color-danger); }
.admin-service-item-btn:disabled { opacity: 0.35; }

.admin-service-item-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
}

.admin-service-drag-handle {
  width: 36px;
  height: 36px;
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 3px;
  align-content: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  color: var(--color-muted);
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
  /* Impedir globo de selección iOS en pulsación larga */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.admin-service-drag-handle span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  display: block;
}

.admin-service-drag-handle:active,
.admin-service-item.is-dragging .admin-service-drag-handle {
  cursor: grabbing;
}

/* ----------------------------------------------------------
   ADMIN SCHEDULE — Calendario de horarios
---------------------------------------------------------- */
.admin-schedule-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  margin: 6px 0 10px;
}

.admin-schedule-calendar-weekdays span {
  text-align: center;
  color: var(--color-black);
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  line-height: 1;
}

.admin-schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: 4px;
  row-gap: 4px;
}

.admin-schedule-calendar-day {
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 5px;
  border: none;
  background: var(--color-white);
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background var(--motion-fast) var(--ease-out);
}

.admin-schedule-calendar-day.is-outside  { background: var(--color-white); color: var(--color-surface-dim); cursor: default; }
.admin-schedule-calendar-day.is-past     { background: var(--color-surface-dim); color: var(--color-muted); cursor: default; }
.admin-schedule-calendar-day.is-closed   { background: var(--color-surface-dim); color: var(--color-muted); }

.admin-schedule-calendar-day.is-vacation,
.admin-schedule-calendar-day.is-vacation-full {
  background: var(--color-vacation);
  color: var(--color-black);
}

/* Mitad superior amarilla (mañana) — gradient como fondo, número siempre visible */
.admin-schedule-calendar-day.is-vacation-morning {
  background: linear-gradient(to bottom, var(--color-vacation) 50%, var(--color-white) 50%);
  color: var(--color-ink);
  border: calc(var(--stroke-icon) * 1px) solid var(--color-vacation);
}

/* Mitad inferior amarilla (tarde) */
.admin-schedule-calendar-day.is-vacation-afternoon {
  background: linear-gradient(to top, var(--color-vacation) 50%, var(--color-white) 50%);
  color: var(--color-ink);
  border: calc(var(--stroke-icon) * 1px) solid var(--color-vacation);
}

.admin-schedule-calendar-day.is-selected-range { background: rgba(255, 228, 53, 0.4);  color: var(--color-ink); }
.admin-schedule-calendar-day.is-selected       { background: var(--color-vacation);    color: var(--color-black); }
.admin-schedule-calendar-day.is-range-preview  { background: rgba(255, 228, 53, 0.2);  color: var(--color-ink); }

.admin-schedule-calendar-day.is-past:hover,
.admin-schedule-calendar-day.is-past:focus-visible,
.admin-schedule-calendar-day.is-past:active { background: var(--color-surface-dim); }

/* ----------------------------------------------------------
   ADMIN PROFILES / USUARIOS
---------------------------------------------------------- */
.admin-profiles-rows {
  display: flex;
  flex-direction: column;
}

.admin-profiles-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-4) 0;
  border-bottom: 1px solid #B7B7B7;
}

.admin-profiles-row-name {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-item);
  font-weight: var(--font-weight-semibold);
  text-align: left;
  justify-content: flex-start;
  cursor: pointer;
  padding: 0;
}

.admin-profiles-row-name:disabled { color: var(--color-muted); cursor: default; }

.admin-profiles-row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.admin-profiles-status-pill {
  height: 36px;
  border-radius: var(--radius-pill);
  padding: 0 var(--space-3);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
}

.admin-profiles-status-pill:disabled { opacity: 0.45; cursor: default; }
.admin-profiles-status-pill.active   { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.admin-profiles-status-pill.inactive { background: #E5E5E5; color: var(--color-ink-deep); border-color: transparent; }

.admin-profiles-trash-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.admin-profiles-trash-btn:disabled { opacity: 0.35; }

.admin-profiles-empty {
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  text-align: center;
  padding: var(--space-8) 0;
}

/* Botón "Crear nuevo barbero" */
.admin-profiles-create-btn {
  width: 100%;
  height: var(--control-height);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-ink-deep);
  background: transparent;
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  margin-top: var(--space-5);
}

.admin-profiles-create-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
}

/* ----------------------------------------------------------
   ADMIN CREATE SCREEN — Crear nuevo administrador
---------------------------------------------------------- */
.admin-create-screen {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-sheet) + 5);
  background: var(--color-dark-bg);
  transform: translateX(100%);
  transition: transform var(--motion-slow) var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-create-screen.open { transform: translateX(0); }

.admin-create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(calc(env(safe-area-inset-top, 0px) + var(--sheet-safe-extra)), var(--top-anchor))
           var(--app-padding-x) 0;
  flex-shrink: 0;
}

.admin-create-logo {
  width: 56px;
  height: auto;
}

.admin-create-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  padding: 0;
}

.admin-create-close svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: none;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
}

.admin-create-body {
  padding: clamp(28px, 5dvh, 48px) var(--app-padding-x)
           max(calc(env(safe-area-inset-bottom, 0px) + 28px), 28px);
  /* Replica el patrón auth-body: contenido centrado a var(--form-max-width) → ~49px desde el borde */
  width: 100%;
  max-width: calc(var(--form-max-width) + 2 * var(--app-padding-x));  /* 398px */
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.admin-create-body h2 {
  padding-top: 56px;
  margin: 0 0 var(--space-6);
  color: var(--color-white);
  font-family: var(--font-family);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

.admin-create-input {
  display: block;
  width: 100%;
  height: var(--input-height);
  margin-top: var(--space-3);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-dark-border);
  padding: 0 var(--space-6);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  color: var(--color-white);
  background: transparent;
  outline: none;
}

.admin-create-input::placeholder { color: rgba(255,255,255,0.4); opacity: 1; }
.admin-create-input:first-of-type { margin-top: 0; }

/* Selector de rol */
.admin-create-role-wrap {
  position: relative;
  margin-top: var(--space-3);
}

.admin-create-role-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: var(--input-height);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-dark-border);
  padding: 0 var(--space-5);
  background: transparent;
  color: var(--color-white);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  cursor: pointer;
}

.admin-create-role-trigger.open .admin-profile-editor-select-icon { transform: rotate(180deg); }

/* Separador entre opciones de rol (crear barbero) */
.admin-create-role-option + .admin-create-role-option { border-top: 1px solid var(--color-border); }

/* ============================================================
   GESTIONAR USUARIOS
   ============================================================ */

/* Vistas lista ↔ perfil */
.admin-users-view {
  width: 100%;
}

/* Pull-to-refresh: estilos base en ui-system.css (.ui-pull-indicator) */

/* Buscador */
.admin-users-search-wrap {
  position: relative;
  max-width: var(--ui-form-max-width);
  margin: 0 auto var(--space-5);
}
.admin-users-search {
  padding-right: var(--space-10);  /* espacio para el icono */
  width: 100%;
}
.admin-users-search-icon {
  position: absolute;
  right: var(--space-5);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Filas de usuario */
.admin-users-rows {
  max-width: var(--ui-form-max-width);
  margin: 0 auto;
}
.admin-users-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
}
.admin-users-row-name {
  flex: 1;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-bold);
  color: var(--color-ink);
}
.admin-users-row-profile {
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-regular);
  color: var(--color-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.admin-users-row-delete {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--color-danger);
}
.admin-users-row-delete img {
  width: 22px;
  height: 22px;
  display: block;
}

/* Estado vacío */
.admin-users-empty {
  text-align: center;
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  margin-top: var(--space-8);
}

/* Fila de teléfono + acciones directas */
.admin-users-phone-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--ui-form-max-width);
  margin-left: auto;
  margin-right: auto;
}
.admin-users-phone-input {
  flex: 1;
  min-width: 0;
  max-width: none;  /* anula el max-width de .ui-control para que ceda al flex */
  margin: 0;
}
.admin-users-phone-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}
.admin-users-phone-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  text-decoration: none;
  flex-shrink: 0;
}
.admin-users-phone-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Botón nueva cita — amarillo (acción user-facing) */
.admin-users-new-appt-btn {
  width: 100%;
  max-width: var(--ui-form-max-width);
  margin: var(--space-6) auto 0;
  display: block;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--color-vacation);
  color: var(--color-black);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
}

/* Botón eliminar usuario — texto rojo */
.admin-users-delete-btn {
  display: block;
  width: 100%;
  max-width: var(--ui-form-max-width);
  margin: var(--space-6) auto 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  color: var(--color-danger);
  text-align: center;
}

/* ── Citas pendientes en perfil de usuario ───────────────── */

.admin-user-appts-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--ui-form-max-width);
  margin: var(--space-5) auto 0;
  padding: var(--space-3) 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  text-align: left;
}

.admin-user-appts-arrow {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: transform 0.2s ease;
}
.admin-user-appts-arrow.rotated {
  transform: rotate(180deg);
}

.admin-user-appts-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: var(--ui-form-max-width);
  margin: var(--space-3) auto 0;
}

.admin-user-appts-empty {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-3) 0;
}

/* Reutiliza .admin-appt-item — solo cambia fondo y muestra la fecha */
.admin-user-appt-card {
  background: #F5F5F5;
}
.admin-user-appt-card .admin-appt-item-date {
  display: block;
  margin-top: 0;
  margin-bottom: 0;
}

/* Botón submit de crear admin */
.admin-create-submit-btn {
  width: 100%;
  height: var(--control-height);
  margin-top: var(--space-8);
  border-radius: var(--radius-pill);
  border: none;
  background: var(--color-white);
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-create-submit-btn:disabled {
  background: var(--color-dark-border);
  color: rgba(255,255,255,0.4);
}

.admin-create-msg {
  margin-top: var(--space-3);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  text-align: center;
  color: var(--color-danger);
}

.admin-create-msg.ok { color: var(--color-success); }

/* Pantalla de contraseña temporal generada */
.admin-created-temp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 5dvh, 48px) var(--app-padding-x)
           max(calc(env(safe-area-inset-bottom, 0px) + 28px), 28px);
}

.admin-created-temp-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-created-temp-value {
  font-family: var(--font-family);
  font-size: var(--font-size-price);
  font-weight: var(--font-weight-semibold);
  color: var(--color-white);
  letter-spacing: 0.04em;
  text-align: center;
  margin: var(--space-6) 0;
  word-break: break-all;
}

.admin-created-temp-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.admin-created-temp-exit-btn {
  width: 100%;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  text-align: center;
  cursor: pointer;
  padding: var(--space-3) 0;
}

.admin-created-temp-copy-btn.is-copied { opacity: 0.7; }

/* ----------------------------------------------------------
   ADMIN PROFILE — Perfil del administrador
---------------------------------------------------------- */
.admin-profile-shell .admin-content-scroll {
  padding:
    0
    var(--home-x)
    max(calc(env(safe-area-inset-bottom, 0px) + 28px), 28px);
}

.admin-profile-form {
  margin-top: var(--space-3);
  padding-bottom: clamp(16px, 3vh, 30px);
}

.admin-profile-form-input::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

.admin-profile-form-input[readonly] { color: var(--color-ink-deep); }

/* .admin-profile-save-btn:disabled → unificado en ui-system.css (junto con .auth-primary-btn:disabled) */

.admin-profile-feedback {
  margin-top: var(--space-3);
  max-width: var(--form-max-width);
  margin-left: auto;
  margin-right: auto;
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  line-height: 1.35;
  font-weight: var(--font-weight-medium);
}

.admin-profile-feedback.ok  { color: var(--color-success); }
.admin-profile-feedback.err { color: var(--color-danger); }

.admin-profile-help {
  margin: 14px auto 0;
  max-width: var(--form-max-width);
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  line-height: 1.35;
}

/* Profile flow (scoped to profile shell) */
#admin-profile-shell .admin-profile-form { margin-top: 0; }

/* display:block por defecto (igual que user) — espaciado por márgenes, no por gap */

/* margin-top de .ui-actions ahora en ui-system.css con .ui-input + .ui-actions */

/* ----------------------------------------------------------
   ADMIN PROFILE EDITOR — Editor de perfiles de barbero
---------------------------------------------------------- */
.admin-profile-editor-back {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: none;
  background: transparent;
  color: var(--color-black);
  font-family: var(--font-family);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.03em;
  line-height: 1.05;
  cursor: pointer;
  /* Compensa el espacio del h2 oculto — debe coincidir con .ui-screen-body padding-top */
  padding-top: 36px;
}

.admin-profile-editor-back svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon);
  stroke-linecap: round;
}

.admin-profile-editor-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.admin-profile-editor-input {
  display: block;
  width: 100%;
  height: var(--input-height);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-border);
  padding: 0 var(--space-5);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  color: var(--color-ink);
  background: transparent;
  outline: none;
}

.admin-profile-editor-input::placeholder { color: var(--color-muted); opacity: 1; }

/* Campos de solo lectura (superadmin viendo perfil ajeno) */
.admin-profile-editor-input[readonly] {
  border-color: var(--color-border);
  color: var(--color-muted);
  cursor: default;
  pointer-events: none;
}

/* El selector de rol mantiene fondo blanco */
.admin-profile-editor-select-wrap {
  position: relative;
}

/* Layout y tipografía propios del trigger de rol (background/color/border → ui-system.css) */
.admin-profile-editor-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: var(--input-height);
  border-radius: var(--radius-pill);
  border-width: 2px;
  border-style: solid;
  border-color: var(--color-ink);
  padding: 0 var(--space-5);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
}

.admin-profile-editor-select:disabled { opacity: 0.5; cursor: default; }

.admin-profile-editor-select-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: currentColor;
  transition: transform var(--motion-fast) var(--ease-out);
}

.admin-profile-editor-select.open .admin-profile-editor-select-icon { transform: rotate(180deg); }

/* Separador entre opciones del menú de rol */
.admin-profile-editor-role-option + .admin-profile-editor-role-option,
.admin-appt-custom-select-option  + .admin-appt-custom-select-option,
.admin-appt-name-suggest-option   + .admin-appt-name-suggest-option   { border-top: 1px solid var(--color-border); }
/* Opción deshabilitada */
.admin-profile-editor-role-option:disabled,
.admin-appt-custom-select-option:disabled,
.admin-appt-name-suggest-option:disabled   { opacity: 0.4; cursor: default; }

/* ── Custom select — Nueva cita ── */
/* Wrapper: ancla posición del menú flotante y aplica separación inferior */
.admin-appt-custom-select-wrap,
.admin-appt-name-suggest-wrap {
  position: relative;
}
.admin-appt-editor-input-mb {
  margin-bottom: var(--space-4);
}
/* Trigger: misma pill que el selector de "Rol" pero en flex para alinear texto + icono */
.admin-appt-custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
/* Rotar chevron al abrir */
.admin-appt-custom-select-trigger.open .admin-profile-editor-select-icon { transform: rotate(180deg); }
/* Texto del trigger: truncar si es largo */
.admin-appt-custom-select-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Trigger deshabilitado (barbero no puede cambiar el admin asignado) */
.admin-appt-custom-select-trigger:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.admin-profile-editor-save-btn {
  width: 100%;
  height: var(--control-height);
  margin-top: var(--space-6);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-ink-deep);
  background: var(--color-ink-deep);
  color: var(--color-white);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-profile-editor-save-btn:disabled {
  background: var(--color-muted);
  border-color: var(--color-muted);
}

/* ----------------------------------------------------------
   ADMIN CONFIRM DELETE (profiles)
---------------------------------------------------------- */
.admin-profiles-confirm-card {
  background: var(--color-white);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  box-shadow: var(--shadow-popup);
}

.admin-profiles-confirm-name {
  margin: var(--popup-detail-gap) 0 0;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-item);
  font-weight: var(--font-weight-semibold);
}

.admin-profiles-delete-password-input {
  display: block;
  width: 100%;
  height: var(--input-height);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-ink-deep);
  padding: 0 var(--space-5);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--color-ink);
  background: var(--color-white);
  outline: none;
  margin-top: var(--space-3);
}

.admin-profiles-delete-password-input::placeholder { color: var(--color-muted); opacity: 1; }

.admin-profiles-delete-password-msg {
  margin-top: var(--space-2);
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  color: var(--color-danger);
}

/* ----------------------------------------------------------
   GESTIONAR HORARIO — días, detalle y calendario
---------------------------------------------------------- */

/* Card principal de días */
.admin-schedule-days-card {
  background: var(--color-white);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}

/* Cabeceras de sección — regla compartida (un solo punto de control) */
.admin-schedule-card-head,
.admin-schedule-calendar-head,
.admin-appt-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
/* Solo "Días" / "Guardar cambios": altura mínima de 44px */
.admin-schedule-card-head {
  min-height: 44px;
}

/* ID (1,1,1) gana sobre body.admin-dashboard-mode .card h2 (0,2,2) */
#admin-management-shell .admin-schedule-card-head h2 {
  margin: 0;
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: clamp(20px, 5.2vw, 26px);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Botón "Guardar cambios" — texto, sin CTA */
.admin-schedule-save-btn {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: clamp(14px, 3.6vw, 16px);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  cursor: default;
  transition: color var(--motion-fast) var(--ease-out);
}
.admin-schedule-save-btn:not(:disabled) {
  color: var(--color-ink-deep);
  cursor: pointer;
}
/* ID override: neutraliza ui-btn--primary (min-height:64px) y ui-btn--pill
   inyectados por shared/dom.js en tiempo de ejecución */
#btn-schedule-days-save {
  min-height: unset;
  height: auto;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--color-muted);
  font-family: var(--font-family);
  font-size: clamp(14px, 3.6vw, 16px);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  cursor: default;
  transition: color var(--motion-fast) var(--ease-out);
}
#btn-schedule-days-save:not(:disabled) {
  color: var(--color-ink-deep);
  cursor: pointer;
}

/* Grid de 7 días */
.admin-schedule-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-2);
}

/* Celda: label + tile + punto indicador */
.admin-schedule-day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.admin-schedule-day-label {
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-ink);
  text-align: center;
}

/* Punto rojo debajo del tile seleccionado */
.admin-schedule-day-cell::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: background var(--motion-fast) var(--ease-out);
}
.admin-schedule-day-cell:has(.is-selected)::after {
  background: var(--color-danger);
}

/* Tile de día — celda plana con gradiente, mismo sistema que el calendario de vacaciones */
.admin-schedule-day-tile {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0;
  background: var(--color-border);
  cursor: pointer;
  transition: box-shadow var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              opacity var(--motion-fast) var(--ease-out);
}
.admin-schedule-day-tile:disabled { cursor: default; opacity: 0.6; }

/* Las pills internas ya no se necesitan */
.admin-schedule-day-tile .part { display: none; }

/* Modos — mismo patrón que is-vacation-* en el calendario */
.admin-schedule-day-tile.mode-full {
  background: var(--color-success);
}
.admin-schedule-day-tile.mode-morning {
  background: linear-gradient(to bottom, var(--color-success) 50%, var(--color-border) 50%);
}
.admin-schedule-day-tile.mode-evening {
  background: linear-gradient(to top, var(--color-success) 50%, var(--color-border) 50%);
}
.admin-schedule-day-tile.mode-closed {
  background: var(--color-border);
}

/* Tile seleccionado: blanco + trazo verde interior (no afecta al layout ni al gradiente) */
.admin-schedule-day-tile.is-selected {
  background: var(--color-white);
  box-shadow: inset 0 0 0 calc(var(--stroke-icon) * 1px) var(--color-success);
}

/* Panel de detalle del día seleccionado */
.admin-schedule-day-detail {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Título del día ("Sábado") */
.admin-schedule-selected-day-title {
  margin: 0 0 var(--space-1);
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: clamp(20px, 5.2vw, 26px);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Bloque de periodo (Mañana / Tarde) */
.admin-schedule-period-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.admin-schedule-period-title {
  margin: 0;
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
}

/* Fila: inputs + toggle */
.admin-schedule-period-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.admin-schedule-period-row input[type="time"] {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  text-align: center;
  padding: 0 var(--space-1);
  transition: opacity var(--motion-fast) var(--ease-out);
}

/* Toggle "Cerrado" — estado ABIERTO: outline rojo */
.admin-schedule-period-toggle {
  height: 44px;
  padding: 0 var(--space-3);
  border: 1.5px solid var(--color-danger);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-danger);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
}

/* Toggle "Cerrado" — estado CERRADO: relleno rojo */
.admin-schedule-period-toggle.is-active {
  background: var(--color-danger);
  color: var(--color-white);
}

/* Inputs deshabilitados cuando periodo cerrado */
.admin-schedule-period-block.is-closed .admin-schedule-period-row input {
  opacity: 0.35;
}

/* ── VACACIONES ──────────────────────────────────── */

.admin-schedule-vacation-title {
  margin: var(--space-5) 0 var(--space-4);
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: clamp(20px, 5.2vw, 26px);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Card del calendario — igual que booking-calendar-card */
.admin-schedule-vacation-card {
  background: var(--color-white);
  border-radius: var(--radius-card);
  padding: 18px var(--space-4);
}

/* Cabecera del mes — solo lo exclusivo (el resto lo hereda del selector agrupado) */
.admin-schedule-calendar-head {
  gap: var(--space-3);
}

/* Botones prev/next — igual que booking-calendar-nav */
.admin-schedule-calendar-nav {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.admin-schedule-calendar-nav svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--stroke-icon-lg);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Etiqueta del mes — igual que booking-month-label */
.admin-schedule-calendar-title {
  margin: 0;
  flex: 1;
  text-align: center;
  color: var(--color-ink-deep);
  font-family: var(--font-family);
  font-size: var(--font-size-price);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ----------------------------------------------------------
   SCHEDULE ADVANCED (details / colapsable)
---------------------------------------------------------- */
.admin-schedule-advanced {
  margin-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-5);
}

.admin-schedule-advanced summary {
  cursor: pointer;
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  list-style: none;
}

/* ----------------------------------------------------------
   TOPBAR (barra de navegación admin — solo desktop)
---------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--app-padding-x);
  background: var(--color-dark-surface);
  color: var(--color-white);
  font-family: var(--font-family);
}

.topbar .brand {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
}

.topbar a {
  color: var(--color-muted);
  font-size: var(--font-size-small);
  text-decoration: none;
}

/* ----------------------------------------------------------
   UTILIDADES COMPARTIDAS
---------------------------------------------------------- */
.hidden { display: none !important; }

.ui-help {
  font-family: var(--font-family);
  font-size: var(--font-size-small);
  line-height: 1.35;
}

/* ----------------------------------------------------------
   MOTION REDUCIDO
---------------------------------------------------------- */
/* ----------------------------------------------------------
   RESPONSIVE — Pantallas más anchas que la app (> 430px)
---------------------------------------------------------- */
@media (min-width: 431px) {
  body.admin-dashboard-mode .shell {
    box-shadow:
      1px 0 0 0 rgba(255, 255, 255, 0.06),
      -1px 0 0 0 rgba(255, 255, 255, 0.06);
  }
}

/* ----------------------------------------------------------
   RESPONSIVE — iPad / Desktop (≥ 768px)
   Contenedor a pantalla completa; drawer y content-shells
   como paneles parciales anclados a la derecha.
---------------------------------------------------------- */
@media (min-width: 768px) {

  /* ---- AUTH MODE: pantalla completa igual que admin-create-screen ---- */
  body.admin-auth-mode .shell {
    max-width: none;
    width: 100%;
    min-height: 100dvh;
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  body.admin-auth-mode .admin-auth-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding-left: var(--app-padding-x);
    padding-right: var(--app-padding-x);
  }

  body.admin-auth-mode .admin-auth-card {
    margin-top: 0;
    padding: clamp(28px, 5dvh, 48px) var(--app-padding-x);
  }

  body.admin-auth-mode .admin-auth-card .ui-form-shell {
    max-width: var(--form-max-width);
  }

  /* ---- Contenedor: sin max-width, fondo completo ---- */
  body.admin-dashboard-mode .shell {
    max-width: none;
    width: 100%;
    box-shadow: none;
  }

  /* ---- Admin Home: padding lateral tablet (60px) ---- */
  .admin-home-view {
    padding-left: 60px;
    padding-right: 60px;
    transition: padding-right var(--motion-slow) var(--ease-out);
  }

  /* Header admin: absolute para que padding-right de admin-home-view no le afecte */
  .admin-home-header {
    position: absolute;
    top: max(calc(env(safe-area-inset-top, 0px) + var(--top-safe-extra-home)), var(--top-anchor-home));
    left: 60px;
    right: 60px;
    transition: right var(--motion-slow) var(--ease-out);
  }

  /* Hero admin: centrado por defecto */
  .admin-home-main {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  /* ---- Auto-adjust: contenido se adapta al espacio visible ---- */
  /* Drawer lateral (full height) → ajusta admin-home-view (hero) Y cabecera */
  body.admin-drawer-open .admin-home-view {
    padding-right: calc(var(--tablet-drawer-width) + var(--app-padding-x));
  }
  body.admin-drawer-open .admin-home-header {
    right: calc(var(--tablet-drawer-width) + var(--app-padding-x));
  }
  /* Sheet → ajusta admin-home-view (hero) */
  body.admin-sheet-open .admin-home-view {
    padding-right: calc(var(--tablet-sheet-width) + var(--app-padding-x));
  }
  /* Paneles laterales (sin is-sheet) → desplazan también el header */
  body:has(.admin-content-shell.open:not(.is-sheet)) .admin-home-header {
    right: calc(var(--tablet-sheet-width) + var(--app-padding-x));
  }

  /* ---- Admin Drawer: panel lateral derecho ---- */
  .admin-side-drawer {
    position: fixed;
    inset: auto;              /* resetear inset:0 del base */
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--tablet-drawer-width);
    z-index: var(--z-drawer);
    overflow: hidden;         /* clip hijos al border-radius */
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: transform var(--motion-slow) var(--ease-out),
                opacity var(--motion-slow) var(--ease-out);
  }
  .admin-side-drawer.open { opacity: 1; }

  /* ---- Admin Content Shells: panel derecho ---- */
  /* Shared: todos los shells se posicionan a la derecha */
  .admin-content-shell {
    left: auto;
    right: 0;
    width: var(--tablet-sheet-width);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  }

  /* Non-sheet (Administración, Perfil): slide-in lateral con scale igual que .sheet.slide-in */
  .admin-content-shell:not(.is-sheet) {
    position: fixed;
    inset: auto;
    top: 0;
    right: 0;
    bottom: 0;
    transform: translateX(100%) scale(0.985);
    transition: transform var(--motion-slow) var(--ease-out);
    overflow: hidden;
  }
  .admin-content-shell:not(.is-sheet).open {
    transform: translateX(0) scale(1);
  }

  /* is-sheet (Mis citas): border-radius → ui-system.css (regla compartida bottom sheets) */

  /* ---- Scrim: fondo oscuro cuando drawer o sheet están abiertos ---- */
  body.admin-drawer-open::before,
  body.admin-sheet-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 19;   /* justo debajo del drawer (z-index: 20) */
    pointer-events: auto;
  }
  body.admin-sheet-open::before {
    z-index: 29;   /* justo debajo del sheet (z-index: 30) */
  }
}

/* ----------------------------------------------------------
   RESPONSIVE — Desktop (≥ 1280px)
   Padding lateral amplio para pantallas grandes.
---------------------------------------------------------- */
@media (min-width: 1280px) {
  .admin-home-view {
    padding-left: 150px;
    padding-right: 150px;
  }

  /* Header admin: actualizar posición para padding desktop */
  .admin-home-header {
    left: 150px;
    right: 150px;
  }

  /* Auto-adjust desktop: padding mayor → las fórmulas necesitan override */
  body.admin-drawer-open .admin-home-view {
    padding-right: calc(var(--tablet-drawer-width) + 150px);
  }
  body.admin-drawer-open .admin-home-header {
    right: calc(var(--tablet-drawer-width) + 150px);
  }
  body.admin-sheet-open .admin-home-view {
    padding-right: calc(var(--tablet-sheet-width) + 150px);
  }
  body:has(.admin-content-shell.open:not(.is-sheet)) .admin-home-header {
    right: calc(var(--tablet-sheet-width) + 150px);
  }
}

/* ----------------------------------------------------------
   RESPONSIVE — Padding inferior según orientación (≥ 768px)
---------------------------------------------------------- */
@media (min-width: 768px) and (orientation: portrait) {
  .admin-home-main { padding-bottom: 240px; }
}
@media (min-width: 768px) and (orientation: landscape) {
  .admin-home-main { padding-bottom: 170px; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-create-screen,
  .admin-side-drawer,
  .admin-content-shell,
  .admin-vacation-switch-thumb {
    transition: none !important;
  }
}
