/* ════════════════════════════════════════════════════════════════════════════
   PANEL DE ADMINISTRACIÓN — Sistema de diseño autosuficiente
   Inspirado en Linear / Stripe / Notion. Modo oscuro por defecto,
   modo claro vía [data-theme="light"].

   Esta hoja NO depende de main.css (que es solo para la web pública).
   Todas las reglas que el panel necesita viven aquí, para evitar colisiones
   de clases entre ambos contextos.
   ════════════════════════════════════════════════════════════════════════════ */

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }

/* ─── Tokens de superficie (independientes de los colores de marca) ───────── */
:root {
  --surf-0: #0E0D10;   /* fondo general */
  --surf-1: #161519;   /* sidebar / topbar */
  --surf-2: #1C1B20;   /* cards */
  --surf-3: #242227;   /* hover / inputs */
  --surf-border: #2C2A30;

  --text-1: #F2F0F3;
  --text-2: #B4AFB8;
  --text-3: #7A757E;

  --radius: 10px;
  --radius-lg: 16px;

  --sidebar-width: 248px;
  --topbar-height: 64px;
  /* --radius-sm, --ease y --shadow-* viven en static/css/shared.css (compartidas con la web pública) */
}

[data-theme="light"] {
  --surf-0: #F7F6F8;
  --surf-1: #FFFFFF;
  --surf-2: #FFFFFF;
  --surf-3: #F1EFF2;
  --surf-border: #E7E4E9;
  --text-1: #18161A;
  --text-2: #5C5862;
  --text-3: #948F97;
  --shadow-sm: 0 1px 2px rgba(20,15,25,.06);
  --shadow-md: 0 8px 24px rgba(20,15,25,.08);
  --shadow-lg: 0 16px 48px rgba(20,15,25,.12);
}

/* ════════════════════════════════════════════════════════════════════════════
   LAYOUT RAÍZ — sidebar fijo + contenido con scroll propio
   ════════════════════════════════════════════════════════════════════════════ */

.admin-body {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 100vh;
  overflow: hidden;               /* el scroll vive dentro de .admin-content, no en body */
  background: var(--surf-0);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  transition: background .25s var(--ease), color .25s var(--ease);
}

.admin-body a { color: inherit; text-decoration: none; }

/* ─── Sidebar ──────────────────────────────────────────────────────────────
   Ancho fijo, altura completa, nunca se mueve ni se superpone con el resto.
   ──────────────────────────────────────────────────────────────────────── */
.sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surf-1);
  border-right: 1px solid var(--surf-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-logo {
  flex: 0 0 auto;
  padding: 1.35rem 1.25rem 1.1rem;
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  border-bottom: 1px solid var(--surf-border);
  display: flex;
  align-items: center;
  gap: .6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logo .logo-mark { font-size: 1.25rem; flex-shrink: 0; }

.sidebar-nav {
  flex: 1 1 auto;
  padding: .85rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.sidebar-section-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: 1rem .65rem .35rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .65rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .875rem;
  font-weight: 450;
  transition: color .15s, background .15s;
}
.sidebar-link:hover { color: var(--text-1); background: var(--surf-3); }
.sidebar-link.active {
  color: var(--text-1);
  background: var(--surf-3);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--primary);
}
.sidebar-link .icon { font-size: 1rem; width: 1.1rem; text-align: center; flex-shrink: 0; }
.sidebar-link--danger { color: #E0716B; }
.sidebar-link--danger:hover { color: #F08F8A; background: rgba(224,113,107,.1); }

.sidebar-footer {
  flex: 0 0 auto;
  padding: .85rem .6rem;
  border-top: 1px solid var(--surf-border);
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
  font-size: .8rem;
  border: none;
  background: none;
  width: 100%;
  font-family: var(--font-body);
  transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--surf-3); color: var(--text-1); }

/* ─── Columna principal ─────────────────────────────────────────────────────
   Ocupa todo el espacio restante. Es la ÚNICA zona con scroll vertical.
   ──────────────────────────────────────────────────────────────────────── */
.admin-main {
  flex: 1 1 auto;
  width: 0;                 /* fuerza a flexbox a no medir por contenido, evita overflow horizontal */
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-topbar {
  flex: 0 0 var(--topbar-height);
  height: var(--topbar-height);
  background: var(--surf-1);
  border-bottom: 1px solid var(--surf-border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.admin-page-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.2;
  margin: 0;
}
.admin-topbar-title { min-width: 0; flex-shrink: 1; overflow: hidden; }
.admin-page-title, .admin-page-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-page-subtitle { font-size: .8rem; color: var(--text-3); margin: .1rem 0 0; }
.admin-topbar-actions { display: flex; gap: .6rem; align-items: center; flex-shrink: 0; }

.admin-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.75rem 2rem 3rem;
}

/* Ancho de lectura cómodo en pantallas muy grandes, sin dejar huecos raros */
.admin-content > * { max-width: 1440px; margin-left: auto; margin-right: auto; }

/* ════════════════════════════════════════════════════════════════════════════
   FLASH MESSAGES
   ════════════════════════════════════════════════════════════════════════════ */
.flash {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}
.flash--success { background: var(--success-lt); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.flash--error   { background: var(--danger-lt, #fdecea); color: var(--danger, #c1453f); border-color: color-mix(in srgb, var(--danger, #c1453f) 35%, transparent); }

/* ════════════════════════════════════════════════════════════════════════════
   BOTONES — ver static/css/shared.css (compartido con la web pública)
   ════════════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════════════════════ */
.admin-card {
  background: var(--surf-2);
  border: 1px solid var(--surf-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.admin-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem;
  border-bottom: 1px solid var(--surf-border);
}
.admin-card__header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}

/* ════════════════════════════════════════════════════════════════════════════
   KPI / STAT CARDS
   ════════════════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .9rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surf-2);
  border: 1px solid var(--surf-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s;
  min-width: 0;
}
.stat-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--surf-border)); transform: translateY(-1px); }
.stat-card__label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.15;
  overflow-wrap: break-word;
}
.stat-card__sub {
  font-size: .76rem;
  color: var(--text-3);
  margin-top: .45rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}
.stat-card__trend { font-weight: 600; }
.stat-card__trend--up   { color: var(--success); }
.stat-card__trend--down { color: #E0716B; }

/* ─── Layouts de columnas para el dashboard ──────────────────────────────── */
.admin-two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; align-items: start; }
.admin-three-col { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; align-items: start; }

/* ════════════════════════════════════════════════════════════════════════════
   FILTROS / BÚSQUEDA
   ════════════════════════════════════════════════════════════════════════════ */
.filter-bar { padding: .9rem 1.35rem; }
.filter-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filter-input, .filter-select {
  padding: .5rem .85rem;
  border: 1px solid var(--surf-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .85rem;
  background: var(--surf-3);
  color: var(--text-1);
}
.filter-input { flex: 1 1 200px; min-width: 160px; }
.filter-select { flex: 0 1 170px; min-width: 140px; }
.filter-form input[type="date"].filter-input { flex: 0 1 155px; min-width: 140px; }
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); }

/* Especificidad explícita: los filtros NUNCA deben heredar el width:100%
   de las reglas genéricas de formulario, que se cargan después en este archivo. */
.admin-body .filter-form input.filter-input,
.admin-body .filter-form select.filter-select {
  width: auto;
}

/* ════════════════════════════════════════════════════════════════════════════
   TABLAS
   ════════════════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th, .data-table td {
  padding: .75rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--surf-border);
  white-space: nowrap;
}
.data-table th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  background: var(--surf-1);
  font-weight: 600;
}
.data-table td { color: var(--text-1); }
.data-table tbody tr:hover { background: var(--surf-3); }
.data-table a { color: var(--primary); }
.data-table a:hover { text-decoration: underline; }

.id-cell      { color: var(--text-3); font-size: .78rem; }
.notas-cell   { color: var(--text-3); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions-cell { white-space: nowrap; display: flex; gap: .4rem; }
.row--inactive td { opacity: .5; }

/* ════════════════════════════════════════════════════════════════════════════
   BADGES — ver static/css/shared.css (compartido con la web pública)
   ════════════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════════════
   ESTADOS VACÍOS
   ════════════════════════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-3); }
.empty-state p { margin: 0 0 1.25rem; }
.empty-state .btn { color: #fff; }
.empty-state .btn--ghost, .empty-state .btn--secondary { color: var(--text-1); }
.empty-state-inline { padding: 1.75rem; text-align: center; color: var(--text-3); font-size: .875rem; }

/* ════════════════════════════════════════════════════════════════════════════
   FORMULARIOS
   ════════════════════════════════════════════════════════════════════════════ */
.booking-form {
  background: var(--surf-2);
  border: 1px solid var(--surf-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.form-group { border: none; padding: 0; margin: 0 0 1.75rem; }
.form-group legend {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 1.1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--surf-border);
  width: 100%;
}
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-row .field { margin-bottom: 0; }

.admin-body label { font-size: .82rem; font-weight: 500; color: var(--text-2); }
.required { color: var(--primary); }
.optional { font-weight: 400; color: var(--text-3); font-size: .78rem; }

.admin-body input[type="text"],
.admin-body input[type="tel"],
.admin-body input[type="email"],
.admin-body input[type="date"],
.admin-body input[type="time"],
.admin-body input[type="number"],
.admin-body input[type="password"],
.admin-body select,
.admin-body textarea {
  padding: .6rem .85rem;
  border: 1px solid var(--surf-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--text-1);
  background: var(--surf-3);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.admin-body input:focus,
.admin-body select:focus,
.admin-body textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.admin-body textarea { resize: vertical; }
.admin-body input::placeholder, .admin-body textarea::placeholder { color: var(--text-3); }

.form-footer { margin-top: .5rem; }
.form-note { margin-top: .75rem; font-size: .8rem; color: var(--text-3); text-align: center; }

.info-banner {
  background: color-mix(in srgb, var(--primary) 14%, var(--surf-2));
  border-radius: var(--radius);
  padding: .7rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .85rem;
  color: var(--text-1);
}

/* Selector de color en formularios de servicio/empleado */
.color-swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform .12s, border-color .12s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--text-1); }

/* ════════════════════════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════════════════════════ */
.login-box {
  background: var(--surf-2);
  border: 1px solid var(--surf-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 400; color: var(--text-1); margin: .5rem 0 .25rem; }
.login-logo p { font-size: .85rem; color: var(--text-3); margin: 0; }

/* ════════════════════════════════════════════════════════════════════════════
   PAGINACIÓN
   ════════════════════════════════════════════════════════════════════════════ */
.pagination { display: flex; gap: .4rem; align-items: center; padding: 1.1rem 1.35rem; flex-wrap: wrap; }
.page-btn {
  padding: .35rem .8rem; border: 1px solid var(--surf-border); border-radius: var(--radius-sm);
  font-size: .8rem; color: var(--text-2); cursor: pointer; transition: background .15s;
}
.page-btn:hover { background: var(--surf-3); text-decoration: none; }
.page-btn--active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-ellipsis { padding: .35rem; color: var(--text-3); }
.page-info { margin-left: auto; font-size: .78rem; color: var(--text-3); }

/* ════════════════════════════════════════════════════════════════════════════
   ELEMENTOS VARIOS DEL DASHBOARD
   ════════════════════════════════════════════════════════════════════════════ */
.status-pills { display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.35rem; }
.status-pill  { display: flex; align-items: center; gap: .5rem; }
.status-pill strong { font-size: 1.05rem; color: var(--text-1); }

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1.5rem; padding: 1.1rem 1.35rem; font-size: .875rem; }
.detail-list dt { color: var(--text-3); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; align-self: center; margin: 0; }
.detail-list dd { color: var(--text-1); margin: 0; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 650; color: #fff; flex-shrink: 0;
}

/* Gráficas de barras simples (sin librerías) */
.chart-bars { display: flex; align-items: flex-end; gap: .35rem; height: 110px; padding: 1rem 1.35rem .5rem; overflow-x: auto; }
.chart-empty-note { padding: 0 1.35rem 1rem; font-size: .76rem; color: var(--text-3); }
.chart-bar-col { flex: 1 0 auto; min-width: 18px; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; background: var(--primary);
  transition: height .5s var(--ease), background .2s; position: relative; min-height: 2px;
}
.chart-bar:hover { filter: brightness(1.15); }
.chart-bar-label { font-size: .65rem; color: var(--text-3); white-space: nowrap; }
.chart-tooltip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: .3rem;
  background: var(--surf-1); border: 1px solid var(--surf-border); padding: .25rem .5rem; border-radius: 4px;
  font-size: .7rem; white-space: nowrap; color: var(--text-1); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5;
}
.chart-bar:hover .chart-tooltip { opacity: 1; }

/* ════════════════════════════════════════════════════════════════════════════
   CALENDARIO
   ════════════════════════════════════════════════════════════════════════════ */
.calendar-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem;
}
.calendar-nav { display: flex; align-items: center; gap: .4rem; }
.calendar-nav-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--surf-border); background: var(--surf-2);
  color: var(--text-2); cursor: pointer; font-size: .9rem; transition: background .15s;
}
.calendar-nav-btn:hover { background: var(--surf-3); color: var(--text-1); }
.calendar-label { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; color: var(--text-1); min-width: 180px; text-align: center; }
.calendar-view-switch { display: flex; background: var(--surf-2); border: 1px solid var(--surf-border); border-radius: var(--radius-sm); overflow: hidden; }
.calendar-view-btn { padding: .4rem .9rem; font-size: .8rem; color: var(--text-2); cursor: pointer; background: none; border: none; font-family: var(--font-body); }
.calendar-view-btn.active { background: var(--primary); color: #fff; }
.calendar-filters { display: flex; gap: .5rem; align-items: center; }

.calendar-wrap {
  background: var(--surf-2); border: 1px solid var(--surf-border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); position: relative;
}

.cal-grid { display: grid; position: relative; max-height: 65vh; overflow: auto; }
.cal-header-row { display: grid; position: sticky; top: 0; z-index: 5; background: var(--surf-2); border-bottom: 1px solid var(--surf-border); }
.cal-time-col-spacer { border-right: 1px solid var(--surf-border); }
.cal-day-header { padding: .6rem .4rem; text-align: center; border-right: 1px solid var(--surf-border); }
.cal-day-header .dow { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.cal-day-header .dom { font-family: var(--font-display); font-size: 1.1rem; color: var(--text-1); margin-top: .1rem; }
.cal-day-header.is-today .dom {
  background: var(--primary); color: #fff; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: .85rem;
}

.cal-body-row { display: grid; position: relative; }
.cal-time-col { border-right: 1px solid var(--surf-border); }
.cal-time-slot { height: 48px; font-size: .68rem; color: var(--text-3); text-align: right; padding: 0 .5rem; position: relative; top: -7px; }
.cal-day-col { position: relative; border-right: 1px solid var(--surf-border); }
.cal-hour-line { height: 48px; border-bottom: 1px solid var(--surf-border); cursor: pointer; }
.cal-hour-line:nth-child(odd) { background: color-mix(in srgb, var(--surf-1) 35%, transparent); }
.cal-hour-line:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }

.cal-event {
  position: absolute; left: 3px; right: 3px; border-radius: 6px;
  padding: .3rem .45rem; font-size: .72rem; line-height: 1.3; overflow: hidden;
  cursor: grab; color: #fff; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .1s; z-index: 2;
  border-left: 3px solid rgba(255,255,255,.5);
}
.cal-event:hover { box-shadow: var(--shadow-md); z-index: 10; }
.cal-event.dragging { opacity: .6; cursor: grabbing; }
.cal-event__title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event__sub { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event--cancelled { opacity: .45; text-decoration: line-through; }
.cal-event--completed { opacity: .7; }

.cal-now-line { position: absolute; left: 0; right: 0; height: 2px; background: #E0716B; z-index: 6; pointer-events: none; }
.cal-now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #E0716B; }

.cal-month-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-month-dow { padding: .6rem; text-align: center; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border-bottom: 1px solid var(--surf-border); }
.cal-month-cell { min-height: 100px; border-right: 1px solid var(--surf-border); border-bottom: 1px solid var(--surf-border); padding: .4rem; cursor: pointer; transition: background .15s; }
.cal-month-cell:hover { background: var(--surf-3); }
.cal-month-cell.is-other-month { opacity: .35; }
.cal-month-cell.is-today { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.cal-month-daynum { font-size: .8rem; color: var(--text-2); margin-bottom: .3rem; }
.cal-month-event { font-size: .68rem; padding: .15rem .4rem; border-radius: 4px; color: #fff; margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-month-more { font-size: .68rem; color: var(--text-3); padding-left: .3rem; }

.cal-popover {
  position: fixed; z-index: 200; background: var(--surf-2); border: 1px solid var(--surf-border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1rem; min-width: 240px; max-width: 90vw;
  animation: pop-in .15s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.cal-popover__title { font-weight: 650; font-size: .9rem; color: var(--text-1); margin-bottom: .2rem; }
.cal-popover__sub { font-size: .78rem; color: var(--text-3); margin-bottom: .7rem; }
.cal-popover__row { display: flex; justify-content: space-between; gap: 1rem; font-size: .78rem; padding: .2rem 0; color: var(--text-2); }
.cal-popover__actions { display: flex; gap: .4rem; margin-top: .7rem; flex-wrap: wrap; }
.cal-popover-backdrop { position: fixed; inset: 0; z-index: 199; }

.cal-legend { display: flex; gap: 1rem; flex-wrap: wrap; padding: .75rem 1.35rem; border-top: 1px solid var(--surf-border); }
.cal-legend-item { display: flex; align-items: center; gap: .4rem; font-size: .76rem; color: var(--text-3); }
.cal-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════════════════
   ANIMACIONES DE ENTRADA
   ════════════════════════════════════════════════════════════════════════════ */
.admin-card, .stat-card { animation: rise-in .35s var(--ease) backwards; }
.stats-grid .stat-card:nth-child(1) { animation-delay: .02s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: .05s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: .08s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: .11s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: .14s; }
.stats-grid .stat-card:nth-child(6) { animation-delay: .17s; }
.stats-grid .stat-card:nth-child(7) { animation-delay: .20s; }
.stats-grid .stat-card:nth-child(8) { animation-delay: .23s; }
.stats-grid .stat-card:nth-child(9) { animation-delay: .26s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════════════ */

/* Tablet grande / portátil pequeño */
@media (max-width: 1100px) {
  .admin-three-col { grid-template-columns: 1fr; }
}

/* Tablet */
@media (max-width: 900px) {
  :root { --sidebar-width: 208px; }
  .admin-two-col { grid-template-columns: 1fr; }
  .admin-content { padding: 1.5rem; }
}

/* Móvil — el sidebar deja de ser una columna fija lateral y pasa a barra superior */
@media (max-width: 680px) {
  .admin-body { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }

  .sidebar {
    width: 100%;
    height: auto;
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--surf-border);
  }
  .sidebar-logo { padding: 1rem 1.25rem; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: .5rem; gap: .3rem; }
  .sidebar-section-label { display: none; }
  .sidebar-link { padding: .45rem .7rem; font-size: .8rem; }
  .sidebar-footer { flex-direction: row; flex-wrap: wrap; }

  .admin-main { width: auto; height: auto; overflow-x: hidden; overflow-y: visible; }
  .admin-topbar {
    height: auto; min-height: var(--topbar-height);
    flex-wrap: wrap; padding: 1rem; gap: .75rem;
  }
  .admin-topbar-title { width: 100%; flex-basis: 100%; }
  .admin-page-title, .admin-page-subtitle { white-space: normal; overflow: visible; text-overflow: clip; }
  .admin-topbar-actions { flex-shrink: 1; flex-wrap: wrap; width: 100%; }
  .admin-topbar-actions .btn { flex: 1 1 auto; }
  .admin-content { overflow-x: hidden; overflow-y: visible; padding: 1rem; max-width: 100vw; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat-card { padding: 1rem; }
  .stat-card__value { font-size: 1.5rem; }

  .field-row { grid-template-columns: 1fr; }
  .actions-cell { flex-direction: column; align-items: flex-start; }
  .data-table th, .data-table td { padding: .6rem .75rem; }

  .calendar-toolbar { flex-direction: column; align-items: stretch; }
  .calendar-label { min-width: 0; }
}

/* Móvil pequeño */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-page-title { font-size: 1.2rem; }
}
