/* ── Botón solicitudes de reserva ──────────────────────────────── */
@keyframes pulse-badge {
  0%, 100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(210, 153, 34, 0.6); }
  50%       { transform: scale(1.15); box-shadow: 0 0 0 5px rgba(210, 153, 34, 0); }
}
@keyframes blink-btn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210, 153, 34, 0); }
  50%       { box-shadow: 0 0 0 3px rgba(210, 153, 34, 0.35); }
}


.cal-requests-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  margin-left: 8px;
}
.cal-requests-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.cal-requests-btn.has-pending {
  border-color: rgba(210, 153, 34, 0.5);
  animation: blink-btn 2s ease-in-out infinite;
}
.cal-requests-btn.has-pending:hover {
  animation: none;
  border-color: var(--yellow);
  background: rgba(210, 153, 34, 0.08);
  color: var(--yellow);
}

/* Badge numérico del botón */
.cal-requests-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--yellow);
  color: #1a1200;
  animation: pulse-badge 2s ease-in-out infinite;
  line-height: 1;
  opacity: 0.8;
  transition: all 0.3s ease;
}
.cal-requests-badge.cal-requests-badge-zero {
  background: rgba(110, 118, 129, 0.3);
  color: var(--text-secondary);
  animation: none;
}

/* ── Panel flotante de solicitudes ─────────────────────────────── */
.requests-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.requests-panel-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.requests-panel-overlay.hidden {
  display: none;
}

.requests-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.55);
  padding: 20px 28px 18px;
  transform: translateY(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 80vh;
  overflow-y: auto;
}
.requests-panel.visible {
  transform: translateY(0);
}
.requests-panel.hidden {
  display: none;
}

.requests-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.requests-panel-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.requests-panel-close:hover {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}
/* Botón mostrar/ocultar fines de semana */
.cal-toggle-weekends-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background var(--transition), color var(--transition);
}
.cal-toggle-weekends-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.cal-toggle-weekends-btn:active {
  background: var(--bg-card);
}
/* =====================================================
   AUTOGEST — Design System
   Fuentes: Sora (headings) + Archivo (body)
   ===================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Backgrounds */
  --bg-app: #0d1117;
  --bg-sidebar: #010409;
  --bg-card: #161b22;
  --bg-card-hover: #1c2128;
  --bg-input: #0d1117;
  --bg-table-alt: #161b22;

  /* Borders */
  --border: #30363d;
  --border-light: #3d444d;

  /* Text */
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  /* Accent colours - modern & serious */
  --green: #3fb950;
  --green-dim: #0d432f;
  --blue: #006aff;
  --blue-dim: #003d99;
  --yellow: #d29922;
  --yellow-dim: #5d3811;
  --red: #f85149;
  --red-dim: #67060c;
  --purple: #bc8ef9;
  --purple-dim: #3d1f59;
  --teal: #39c5cf;
  --orange: #fb8500;
  --warning-bg: rgba(248, 81, 73, 0.16);
  --warning-bg-hover: rgba(248, 81, 73, 0.24);
  --warning-border: rgba(248, 81, 73, 0.65);
  --warning-border-hover: rgba(248, 81, 73, 0.9);
  --warning-text: #ffd7d4;

  /* Sidebar */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.8);

  /* Transition */
  --transition: 0.18s ease;
}

:root[data-theme='light'] {
  /* Backgrounds */
  --bg-app: #f5f7fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fc;
  --bg-input: #ffffff;
  --bg-table-alt: #f6f8fb;

  /* Borders */
  --border: #d0d7de;
  --border-light: #bfc7cf;

  /* Text */
  --text-primary: #1b2d3d;
  --text-secondary: #424f5c;
  --text-muted: #626b77;

  /* Accents */
  --green-dim: #dafbe1;
  --blue-dim: #e6f0ff;
  --yellow-dim: #fff8c5;
  --red-dim: #ffebe6;
  --purple-dim: #f0ebff;
  --warning-bg: #fee2e2;
  --warning-bg-hover: #fecaca;
  --warning-border: #fca5a5;
  --warning-border-hover: #ef4444;
  --warning-text: #9f1239;

  --shadow-card: 0 2px 12px rgba(27, 45, 61, 0.08);
  --shadow-modal: 0 10px 40px rgba(27, 45, 61, 0.15);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Archivo', sans-serif;
  font-size: 0.9rem;
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* ---------- Layout ---------- */
#app {
  display: flex;
  min-height: 100vh;
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition), transform var(--transition);
}

#main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  transition: margin-left var(--transition);
}

#app-content {
  flex: 1;
  padding: 28px 32px;
  width: 100%;
}

#app-content > * {
  margin-left: auto;
  margin-right: auto;
  max-width: 1600px;
}

.mobile-topbar {
  display: none;
}

.sidebar-toggle-btn {
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-width) - 16px);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  z-index: 140;
  transition: left var(--transition), background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar-toggle-btn #sidebar-toggle-icon {
  transition: transform var(--transition), opacity var(--transition);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 1.1rem;
}

.sidebar-toggle-btn.is-open #sidebar-toggle-icon {
  transform: rotate(90deg);
}

.sidebar-toggle-btn.is-collapsed #sidebar-toggle-icon {
  transform: translateX(1px);
}

.sidebar-toggle-btn:hover {
  background: var(--bg-card-hover);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.55);
  backdrop-filter: blur(1px);
  z-index: 120;
}

/* Sidebar colapsado en escritorio */
body.sidebar-collapsed #sidebar {
  width: var(--sidebar-collapsed);
}

body.sidebar-collapsed #main-wrapper {
  margin-left: var(--sidebar-collapsed);
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .nav-item-label,
body.sidebar-collapsed .sidebar-user-info {
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 16px;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
}

body.sidebar-collapsed .sidebar-footer {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle-btn {
  left: calc(var(--sidebar-collapsed) - 16px);
}

/* ---------- Sidebar Internals ---------- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--blue), var(--blue));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-family: 'Sora', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-bottom {
  flex: 0;
  padding-top: 0;
  border-top: 1px solid var(--border);
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(88, 166, 255, 0.1);
  color: var(--blue);
  border-top: 3px solid var(--blue);
  padding-left: 7px;
}

.nav-item-icon {
  font-size: 1.2rem;
  font-weight: bold;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  text-align: center;
  font-family: 'Courier New', monospace;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  color: inherit;
}

.nav-item-label { flex: 1; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.15);
  border: 1.5px solid var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---------- Page Header (Banner) ---------- */
.page-header {
  margin-bottom: 24px;
}

.page-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------- KPI Cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(-6px); box-shadow: 0 12px 30px rgba(0,0,0,0.15); border-color: var(--blue);
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-value {
  font-family: 'Sora', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.kpi-card.kpi-green { border-top: 3px solid var(--green); }
.kpi-card.kpi-blue  { border-top: 3px solid var(--blue); }
.kpi-card.kpi-yellow{ border-top: 3px solid var(--yellow); }
.kpi-card.kpi-red   { border-top: 3px solid var(--red); }
.kpi-card.kpi-purple{ border-top: 3px solid var(--purple); }

/* ---------- Quick Access Grid (Inicio) ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  text-decoration: none;
  color: inherit;
}

.quick-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-6px); box-shadow: 0 12px 30px rgba(0,0,0,0.15); border-color: var(--blue);
}

.quick-card:hover .quick-card-icon {
  transform: scale(1.1);
  opacity: 1;
  color: var(--blue);
}

.quick-card-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.quick-card-label {
  font-family: 'Sora', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.quick-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Section Card ---------- */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-card-title {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 600;
}

/* ---------- Filters Bar ---------- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
  max-width: 280px;
  transition: border-color var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--blue); }

.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-select:hover {
  border-color: var(--border-light);
}

.filter-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.filter-select option { background: var(--bg-card); }

/* ---------- Data Table ---------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  background: var(--bg-app);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-table-alt); }

.data-table tbody td {
  padding: 11px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.015);
}

.data-table tbody tr:nth-child(even):hover {
  background: var(--bg-table-alt);
}

/* ---------- Avatar in Table ---------- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-input);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
}

.avatar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-cell-name {
  font-weight: 500;
  color: var(--text-primary);
}

.avatar-cell-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-green  { background: rgba(63, 185, 80, 0.15);  color: var(--green); }
.badge-yellow { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.badge-red    { background: rgba(248, 81, 73, 0.15);    color: var(--red); }
.badge-blue   { background: rgba(88, 166, 255, 0.15);   color: var(--blue); }
.badge-gray   { background: rgba(110, 118, 129, 0.15);  color: var(--text-secondary); }
.badge-purple { background: rgba(188, 142, 249, 0.15); color: var(--purple); }

/* ---------- Progress Bar ---------- */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-track {
  flex: 1;
  min-width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-bar-fill.prog-green  { background: var(--green); }
.progress-bar-fill.prog-yellow { background: var(--yellow); }
.progress-bar-fill.prog-red    { background: var(--red); }

.progress-pct {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 32px;
  text-align: right;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover {
  background: #4184f0;
  border-color: #4184f0;
}

.btn-success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-success:hover {
  background: #2fc455;
  border-color: #2fc455;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover {
  background: #f14949;
  border-color: #f14949;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-outline-blue {
  background: transparent;
  color: var(--blue);
  border-color: var(--blue);
}
.btn-outline-blue:hover { background: var(--blue-dim); }

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-icon {
  padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-card); color: var(--text-primary); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: calc(100% - 40px);
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-box.modal-lg { max-width: 760px; }
.modal-box.modal-sm { max-width: 400px; }

@media (max-width: 640px) {
  .modal-box {
    width: calc(100% - 20px);
    max-width: 100%;
    max-height: 95vh;
  }
  
  .modal-box.modal-lg { max-width: 100%; }
  .modal-box.modal-sm { max-width: 100%; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-app); color: var(--text-primary); }

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-footer.hidden { display: none; }

/* ---------- Form Elements ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.form-select { cursor: pointer; }
.form-select option { background: var(--bg-card); }

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.section-card-inset {
  margin-top: 14px;
  margin-bottom: 0;
  background: var(--bg-app);
  box-shadow: none;
}

.config-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0 16px;
}

.config-toggle-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.config-list-wrap {
  display: grid;
  gap: 10px;
}

.config-list-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.config-check-list {
  display: grid;
  gap: 8px;
}

.config-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.config-check-row input[type='checkbox'] {
  accent-color: var(--blue);
}

.config-actions-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 760px) {
  .config-list-row {
    grid-template-columns: 1fr;
  }
}

/* Premium look for Configuracion */
.config-premium-page .page-title {
  font-size: 1.85rem;
  letter-spacing: -0.02em;
}

.config-premium-page .page-description {
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.config-premium-page .card {
  background:
    radial-gradient(1200px 220px at -10% -25%, rgba(88, 166, 255, 0.08), transparent 46%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.config-premium-page .card-header {
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.config-premium-page .card-title {
  font-size: 1.08rem;
  font-weight: 700;
}

.config-premium-page .card-subtitle {
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.45;
}

.config-premium-page .card-body {
  padding: 1.05rem 1.1rem;
}

.config-premium-page .form-grid {
  gap: 1rem;
}

.config-premium-page .form-group {
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.config-premium-page .form-label {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.config-premium-page .form-input,
.config-premium-page .form-select,
.config-premium-page .form-textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  padding: 0.65rem 0.78rem;
  min-height: 44px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.config-premium-page input[type='file'].form-input {
  padding: 0.3rem 0.4rem;
}

.config-premium-page input[type='file'].form-input::file-selector-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.46rem 0.78rem;
  margin-right: 0.7rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.config-premium-page input[type='file'].form-input::file-selector-button:hover {
  border-color: var(--border-light);
}

.config-premium-page textarea.form-input,
.config-premium-page textarea.form-textarea {
  min-height: 90px;
}

.config-premium-page .form-input:focus,
.config-premium-page .form-select:focus,
.config-premium-page .form-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.18);
}

.config-premium-page .config-check-list {
  gap: 0.55rem;
}

.config-premium-page .config-check-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg-input);
}

.config-premium-page .config-check-row:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.config-premium-page .config-check-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
}

/* Config scope summary */
.config-scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.config-scope-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.config-scope-card.panel-scope {
  border-left: 4px solid var(--purple);
}

.config-scope-card.web-scope {
  border-left: 4px solid var(--green);
}

.scope-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.scope-title {
  margin: 0;
  font-size: 1rem;
}

.scope-desc {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
}

/* Big public web toggle */
.web-status-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.web-status-card.is-on {
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.web-status-card.is-off {
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.web-status-title {
  font-size: 1.04rem;
  font-weight: 700;
}

.web-status-subtitle {
  margin-top: 0.2rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.web-status-switch {
  position: relative;
  width: 72px;
  height: 40px;
  display: inline-block;
}

.web-status-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.web-status-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #d1d5db;
  border-radius: 999px;
  transition: 0.25s;
}

.web-status-slider::before {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: 0.25s;
}

.web-status-switch input:checked + .web-status-slider {
  background: var(--green);
}

.web-status-switch input:checked + .web-status-slider::before {
  transform: translateX(32px);
}

.web-status-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Config tabs */
.config-tabs-nav {
  display: inline-flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  overflow-x: auto;
  max-width: 100%;
}

.config-tabs-nav::-webkit-scrollbar { display: none; }

.config-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.95rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.config-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.config-tab-btn.active {
  color: var(--blue);
  background: rgba(88, 166, 255, 0.12);
  border-color: rgba(88, 166, 255, 0.25);
}

.config-tab-pane { display: none; }
.config-tab-pane.active { display: block; }

/* Service rows */
.service-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.service-row-inputs {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
  flex: 1;
}

/* Permits rows */
.permit-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.permit-row-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.permit-row-body .permit-desc,
.permit-row-body .permit-image {
  grid-column: 1 / -1;
}

/* Methodology cards */
.met-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.met-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: var(--bg-card-hover);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.met-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.05rem;
}

.met-card-body .met-full { grid-column: 1 / -1; }

@media (max-width: 860px) {
  .config-scope-grid {
    grid-template-columns: 1fr;
  }

  .web-status-card {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 600px) {
  .service-row-inputs { grid-template-columns: 1fr; }
  .permit-row-body { grid-template-columns: 1fr; }
  .permit-row-body .permit-desc,
  .permit-row-body .permit-image { grid-column: 1; }
  .met-card-body { grid-template-columns: 1fr; }
  .met-card-body .met-full { grid-column: 1; }
}

/* Color picker combo */
.color-picker-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-picker-input {
  width: 42px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}

.color-preview-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
}

/* Photo upload */
.photo-upload-area {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.photo-upload-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-input);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.photo-upload-preview.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
}

.photo-upload-btn-wrap { display: flex; flex-direction: column; gap: 4px; }
.photo-upload-hint { font-size: 0.72rem; color: var(--text-muted); }

/* ---------- Tabs ---------- */
.tabs-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Disponibilidad alumno ---------- */
.dispo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 110px;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform 0.1s;
  user-select: none;
}
.dispo-btn:hover {
  border-color: var(--blue);
  background: var(--bg-secondary);
  transform: translateY(-6px); box-shadow: 0 12px 30px rgba(0,0,0,0.15); border-color: var(--blue);
}
.dispo-btn.dispo-active {
  border-color: var(--blue);
  background: color-mix(in sRGB, var(--blue) 12%, transparent);
}
.dispo-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 340px;
  box-shadow: var(--shadow-modal);
  pointer-events: auto;
  animation: toastIn 0.25s ease forwards;
  border: 1px solid;
}

.toast.success { background: #052e16; color: var(--green); border-color: var(--green-dim); }
.toast.error   { background: #450a0a; color: var(--red);   border-color: var(--red-dim); }
.toast.warning { background: #431407; color: var(--yellow); border-color: var(--yellow-dim); }
.toast.info    { background: var(--blue-dim); color: var(--blue); border-color: #003d99; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

.toast.removing {
  animation: toastOut 0.25s ease forwards;
}

/* ---------- Detail Profile ---------- */
.profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-light);
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 3px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}
.profile-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.profile-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 10px;
}

.empty-state-icon { font-size: 2.5rem; }
.empty-state-text { font-size: 0.875rem; }

/* ---------- Chip / Tag ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Action Buttons in table row ---------- */
.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---------- Separator / Divider ---------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ---------- Back Button ---------- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
  border: none;
  background: none;
  padding: 0;
  transition: color var(--transition);
}
.back-btn:hover { color: var(--blue); }

/* ---------- Calendar ---------- */
.calendar-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}

.cal-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 20px;
}

.cal-sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cal-student-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: grab;
  background: var(--bg-input);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}
.cal-student-item:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.cal-student-item:hover::after {
  content: '↗';
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
  opacity: 0.6;
  flex-shrink: 0;
}
.cal-student-item:active { cursor: grabbing; }
.cal-student-dragging { opacity: 0.4; }


/* Filtros colapsables */
.cal-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.cal-filter-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.cal-instructor-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cal-share-classes-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.cal-share-classes-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal-share-classes-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.cal-share-classes-btn:active {
  transform: translateY(1px);
}

.cal-pending-exams-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.cal-pending-exams-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal-pending-exams-btn:hover {
  background: var(--warning-bg-hover);
  border-color: var(--warning-border-hover);
}

.cal-pending-exams-btn:active {
  transform: translateY(1px);
}

.cal-pending-exams-list {
  display: grid;
  gap: 16px;
}

.cal-share-intro {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.cal-share-toolbar {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 10px;
  align-items: end;
}

.cal-share-toolbar[style*='margin-top:10px'] {
  grid-template-columns: 1.3fr 1fr 1fr auto;
}

.cal-share-summary {
  margin-top: 12px;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.cal-share-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.cal-share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-input);
}

.cal-share-row-main {
  display: grid;
  gap: 4px;
}

.cal-share-row-main strong {
  font-size: 0.84rem;
}

.cal-share-row-main span {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.cal-share-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-share-row-actions .form-select {
  min-width: 150px;
}

.cal-share-preview {
  font-size: 0.8rem;
  line-height: 1.45;
}

.cal-share-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
  background: var(--bg-input);
}

.cal-pending-exam-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg-input);
}

.cal-pending-exam-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.cal-pending-exam-head strong {
  font-size: 0.9rem;
}

.cal-pending-exam-head span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.cal-main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.cal-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
}
.cal-nav-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.cal-period-label {
  font-family: 'Sora', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  flex: 0 1 auto;
  min-width: 0;
  text-align: center;
}

.cal-view-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cal-view-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.cal-view-btn.active { background: var(--blue); color: #fff; }

/* Week grid */
.cal-week-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
}

.cal-week-header {
  display: contents;
}

.cal-week-header-corner {
  background: var(--bg-app);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cal-week-day-label {
  text-align: center;
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg-app);
}

.cal-week-day-label.today { color: var(--blue); }

.cal-time-col {
  grid-column: 1;
}

.cal-time-row-label {
  height: 36px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 3px 6px 0 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cal-slot {
  height: 36px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background var(--transition);
}

.cal-slot:hover { background: rgba(59,130,246,0.06); }
.cal-slot.unavailable {
  background: rgba(248, 81, 73, 0.12);
}
.cal-slot.unavailable:hover {
  background: rgba(248, 81, 73, 0.18);
}
.cal-slot.drag-over {
  background: rgba(59,130,246,0.14);
  border-color: var(--blue);
  z-index: 12;
}
.cal-slot.drop-half-top::before,
.cal-slot.drop-half-bottom::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
  z-index: 70;
}
.cal-slot.drop-half-top::before { top: 0; }
.cal-slot.drop-half-bottom::before { top: 50%; }
.cal-slot.drag-over::after {
  content: attr(data-drop-time);
  position: absolute;
  top: -9px;
  right: 4px;
  background: var(--blue);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 999px;
  z-index: 30;
  pointer-events: none;
}

.cal-event {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 2px;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  color: #fff;
  border-left: 3px solid rgba(255,255,255,0.4);
}
.cal-event[draggable="true"] { cursor: grab; }
.cal-event[draggable="true"]:active { cursor: grabbing; }
.cal-event-dragging { opacity: 0.45; }

.cal-event.is-exam {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.22);
  border-left-color: rgba(255,255,255,0.95);
}

.cal-event.is-exam.exam-approved {
  border-left-color: #22c55e;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.55), 0 0 0 1px rgba(34, 197, 94, 0.5);
}

.cal-event.is-exam.exam-failed {
  border-left-color: #ef4444;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.58), 0 0 0 1px rgba(239, 68, 68, 0.5);
}

.cal-exam-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.28);
  color: #fff;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.cal-class-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  width: 24px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255,255,255,0.92);
  color: #111;
  border: 1px solid rgba(0,0,0,0.38);
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.cal-class-status-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  stroke: #111;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal-class-status-icon.is-pending {
  background: rgba(255,255,255,0.92);
}

.cal-class-status-icon.is-warned {
  background: rgba(255,255,255,0.92);
}

.cal-class-status-icon.is-confirmed {
  background: rgba(255,255,255,0.92);
}

.cal-class-status-icon.is-free {
  background: rgba(255,255,255,0.92);
}

.cal-class-status-icon.is-cancelled {
  background: rgba(255,255,255,0.92);
}

.cal-class-status-icon.is-exam-marker {
  background: rgba(255,255,255,0.92);
}

/* Month grid */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-month-header {
  text-align: center;
  padding: 8px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg-app);
}
.cal-month-header:last-child { border-right: none; }

.cal-month-cell {
  min-height: 90px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
  transition: background var(--transition);
}

.cal-month-cell:last-child { border-right: none; }
.cal-month-cell:hover { background: rgba(59,130,246,0.05); }
.cal-month-cell.drag-over { background: rgba(59,130,246,0.12); }
.cal-month-cell.other-month .cal-month-day-num { color: var(--text-muted); opacity: 0.4; }
.cal-month-cell.today .cal-month-day-num {
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-month-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.cal-month-event {
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.cal-month-event.is-exam {
  border-left: 3px solid rgba(255,255,255,0.95);
  font-weight: 700;
}

.cal-month-event.is-exam.exam-approved {
  border-left-color: #22c55e;
}

.cal-month-event.is-exam.exam-failed {
  border-left-color: #ef4444;
}

/* ── Calendar context menu ──────────────────────────────────────── */
.cal-ctx-menu {
  position: fixed;
  z-index: 9100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
  padding: 4px;
  min-width: 204px;
  user-select: none;
  font-size: 0.83rem;
  animation: _ctxIn 0.1s ease;
  outline: none;
}

@keyframes _ctxIn {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.cal-ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.1s;
  position: relative;
  white-space: nowrap;
}

.cal-ctx-item:hover {
  background: rgba(0,0,0,0.055);
}

[data-theme="dark"] .cal-ctx-item:hover {
  background: rgba(255,255,255,0.07);
}

.cal-ctx-item.danger {
  color: #dc2626;
}

.cal-ctx-item.danger:hover {
  background: rgba(220,38,38,0.08);
}

.cal-ctx-item > svg,
.cal-ctx-item > .ctx-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.cal-ctx-item .ctx-label {
  flex: 1;
}

.cal-ctx-item .ctx-arrow {
  margin-left: auto;
  opacity: 0.4;
  stroke-width: 2;
}

.cal-ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 3px 8px;
}

/* Sub-menu */
.cal-ctx-submenu {
  position: absolute;
  top: -4px;
  left: calc(100% + 2px);
  right: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.07);
  padding: 4px;
  min-width: 184px;
  display: none;
  z-index: 9101;
  animation: _ctxIn 0.1s ease;
}

.cal-ctx-item:hover > .cal-ctx-submenu {
  display: block;
}

.cal-ctx-sub-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.1s;
  white-space: nowrap;
}

.cal-ctx-sub-item:hover {
  background: rgba(0,0,0,0.055);
}

[data-theme="dark"] .cal-ctx-sub-item:hover {
  background: rgba(255,255,255,0.07);
}

.cal-ctx-sub-item.current {
  font-weight: 600;
}

.cal-ctx-sub-item > svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* Calendar legend */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Schedule / Availability Rows ---------- */
.schedule-grid {
  display: grid;
  grid-template-columns: 100px repeat(7, 1fr);
  gap: 0;
  font-size: 0.8rem;
}

.schedule-grid-header {
  background: var(--bg-app);
  padding: 8px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-left: none;
}

.schedule-grid-header:first-child { border-left: 1px solid var(--border); }

.schedule-label {
  padding: 10px 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-top: none;
  display: flex;
  align-items: center;
}

.schedule-cell {
  padding: 8px;
  border: 1px solid var(--border);
  border-top: none;
  border-left: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

/* ---------- ITV Alert Rows ---------- */
.itv-alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.itv-alert-row.urgent   { border-top: 3px solid var(--red);    background: rgba(239,68,68,0.05); }
.itv-alert-row.upcoming { border-top: 3px solid var(--yellow);  background: rgba(245,158,11,0.05); }
.itv-alert-row.ok       { border-top: 3px solid var(--green);   background: rgba(34,197,94,0.05); }

/* ---------- Color Swatch ---------- */
.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 5px;
  border: 1px solid rgba(255,255,255,0.1);
}

/* ---------- Permit Code Badge ---------- */
.permit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

/* ==================== ESTADÍSTICAS DE CLASES PAGADAS ==================== */

.paid-classes-stat-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition);
}

.paid-classes-stat-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.danger-light {
  background: rgba(248, 81, 73, 0.08);
  border-left: 4px solid var(--red);
}

/* ==================== ESTADÍSTICAS / STATISTICS DASHBOARD ==================== */
.stats-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

.stats-filters-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.filters-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.filter-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.filter-stat {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
}

.stats-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-card-full {
  grid-column: 1 / -1;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-card-body {
  flex: 1;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-full .stat-card-body {
  min-height: 320px;
}

.chart-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.chart-container-horizontal {
  position: relative;
}

/* Scrollbar para el panel de filtros */
.stats-filters-panel::-webkit-scrollbar {
  width: 4px;
}

.stats-filters-panel::-webkit-scrollbar-track {
  background: transparent;
}

.stats-filters-panel::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

.stats-filters-panel::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* ---------- Horario checkbox rows ---------- */
.schedule-day-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.schedule-day-row:last-child { border-bottom: none; }
.schedule-day-label {
  min-width: 80px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-weight: 500;
}
.schedule-day-times { display: flex; align-items: center; gap: 8px; }
.schedule-day-times input[type="time"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* ---------- Scrollbar (Webkit) ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue { color: var(--blue); }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  #sidebar {
    width: min(290px, 86vw);
    transform: translateX(-105%);
    box-shadow: none;
    z-index: 150;
  }

  #main-wrapper {
    margin-left: 0;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }

  .sidebar-toggle-btn {
    left: 10px;
    top: 8px;
    width: 34px;
    height: 34px;
    font-size: 1.05rem;
    z-index: 161;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 160;
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 8px 14px 8px 52px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-sidebar) 88%, transparent);
    backdrop-filter: blur(10px);
  }

  .mobile-topbar-title {
    font-family: 'Sora', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
  }

  #app-content {
    padding: 16px;
  }

  #app-content > * {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-wrapper {
    overflow-x: auto;
  }

  .cal-main {
    overflow: auto;
  }

  .cal-week-grid,
  .cal-month-grid,
  .schedule-grid {
    min-width: 720px;
  }

  .form-row {
    gap: 10px;
  }

  /* Responsive Stats */
  .stats-container {
    grid-template-columns: 1fr;
  }

  .stats-filters-panel {
    position: relative;
    top: auto;
    max-height: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card-full {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  #app-content {
    padding: 14px 16px;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }

  #app-content > * {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .form-row { 
    grid-template-columns: 1fr; 
  }
  
  .kpi-grid { 
    grid-template-columns: 1fr; 
    gap: 10px;
  }
  
  .quick-grid {
    grid-template-columns: 1fr;
  }
  
  .calendar-layout { 
    grid-template-columns: 1fr; 
  }

  .section-card {
    padding: 14px;
    margin-bottom: 14px;
    margin-left: 0;
    margin-right: 0;
  }

  .quick-grid,
  .kpi-grid,
  .data-table,
  .table-wrapper,
  .calendar-layout,
  .cal-sidebar,
  .cal-main,
  ul, ol, li {
    margin-left: 0;
    margin-right: 0;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .page-subtitle {
    font-size: 0.8rem;
  }

  .page-header {
    margin-bottom: 16px;
  }

  /* Asegurar que formularios no se corten */
  .form-input,
  .form-select,
  .form-textarea {
    width: 100% !important;
    min-width: auto !important;
  }

  /* Override de inline styles */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input[type="color"],
  select,
  textarea {
    width: 100% !important;
    min-width: auto !important;
    max-width: 100% !important;
  }

  .search-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .filters-bar {
    flex-direction: column;
    gap: 16px;
    margin-bottom: 14px;
  }

  .filter-select {
    width: 100%;
    padding: 9px 12px;
  }

  .search-input {
    padding: 9px 12px;
  }

  .modal-header {
    padding: 16px 16px 12px !important;
  }

  .modal-body {
    padding: 16px !important;
  }

  .modal-footer {
    padding: 12px 16px 16px !important;
  }

  .modal-title {
    font-size: 0.95rem;
  }

  /* Calendario responsive extra */
  .cal-sidebar {
    position: static;
    margin-bottom: 16px;
    padding: 12px;
    margin-left: 0;
    margin-right: 0;
  }

  .cal-main {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-left: 0;
    margin-right: 0;
  }

  .cal-toolbar {
    flex-direction: column;
    gap: 16px;
    padding: 12px;
  }

  .cal-instructor-select-wrap {
    width: 100%;
    flex-wrap: wrap;
  }

  .cal-instructor-select-wrap .filter-select {
    flex: 1;
    min-width: 0;
  }

  .cal-share-classes-btn,
  .cal-pending-exams-btn {
    width: 100%;
    justify-content: center;
  }

  .cal-nav-group {
    width: 100%;
    justify-content: space-between;
  }

  .cal-period-label {
    font-size: 0.85rem;
  }

  .cal-view-toggle {
    flex: 1;
  }

  #btn-new-event {
    width: 100%;
  }

  /* Listas y elementos dinámicos */
  ul, ol, li {
    margin-left: 0;
    margin-right: 0;
  }

  .cal-student-item {
    margin-left: 0;
    margin-right: 0;
  }

  /* Flexbox override */
  .d-flex.flex-wrap {
    flex-direction: column;
  }

  /* Selects y inputs en flex */
  .d-flex select,
  .d-flex input {
    width: 100%;
    min-width: 0;
  }

  .cal-share-toolbar {
    grid-template-columns: 1fr;
  }

  .cal-share-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cal-share-row-actions {
    flex-wrap: wrap;
  }

  .cal-share-row-actions .form-select,
  .cal-share-row-actions .btn {
    width: 100%;
  }

  /* Tablas en móvil */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    margin-left: 0;
    margin-right: 0;
  }

  .data-table thead th {
    font-size: 0.65rem;
    padding: 8px;
  }

  .data-table tbody td {
    padding: 8px;
    font-size: 0.8rem;
  }

  /* Schedule */
  .schedule-grid {
    min-width: auto !important;
    grid-template-columns: auto minmax(60px, 1fr);
    gap: 0;
  }

  .schedule-grid-header {
    font-size: 0.65rem;
    padding: 6px;
  }

  .schedule-day-label {
    width: auto;
    min-width: 0;
    font-size: 0.75rem;
    padding: 8px 4px;
  }

  .schedule-day-times {
    flex-direction: column;
    gap: 4px;
  }

  .schedule-day-times input[type="time"] {
    width: 100%;
    padding: 4px 6px;
    font-size: 0.75rem;
  }

  /* Profile en móvil */
  .profile-header {
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

  .profile-info {
    width: 100%;
  }

  /* Tabs override */
  .tabs-bar {
    gap: 2px;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

/* =====================================================
   INCIDENCIAS
   ===================================================== */

/* Layout de dos columnas */
.inc-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: flex-start;
}

.inc-list-panel {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.inc-detail-panel {
  min-height: 400px;
}

/* Tarjeta de incidencia en el listado */
.inc-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.inc-card:hover { background: var(--bg-card-hover); }

.inc-card-active {
  border-color: var(--blue);
  background: var(--blue-dim);
}

.inc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.inc-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inc-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.inc-card-date {
  font-size: 0.75rem;
}

/* Placeholder vacío en el panel de detalle */
.inc-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

/* Cabecera del detalle */
.inc-detail-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.inc-detail-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Secciones del detalle */
.inc-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.inc-section:last-child { border-bottom: none; }

.inc-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.inc-description {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Grid de adjuntos */
.inc-attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.inc-attachment-item {
  position: relative;
  width: 90px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary, var(--bg-card));
  transition: border-color var(--transition);
}

.inc-attachment-item:hover { border-color: var(--blue); }

.inc-att-preview {
  width: 100%;
  height: 70px;
  object-fit: cover;
  display: block;
}

.inc-att-icon {
  width: 100%;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.inc-att-name {
  font-size: 0.68rem;
  color: var(--text-secondary);
  padding: 4px 6px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inc-att-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.inc-attachment-item:hover .inc-att-remove { opacity: 1; }

/* Formulario de comentario */
.inc-comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

/* Comentarios en la línea de tiempo */
.inc-comment {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.inc-comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-dim);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.inc-comment-body {
  flex: 1;
  background: var(--bg-card-hover, var(--bg-secondary));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.inc-comment-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.inc-comment-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Link azul */
.link-blue {
  color: var(--blue);
  text-decoration: none;
}
.link-blue:hover { text-decoration: underline; }

/* Lightbox */
.inc-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inc-lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.inc-lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.9);
}

.inc-lightbox-name {
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
}

.inc-lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* Responsive: stack en móvil */
@media (max-width: 900px) {
  .inc-layout {
    grid-template-columns: 1fr;
  }

  .inc-list-panel {
    max-height: 340px;
  }
}


/* -- Student Quick Popup (SQP) ----------------------------------- */
.sqp-popup {
  position: fixed;
  z-index: 9999;
  width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  font-size: 0.82rem;
  color: var(--text-primary);
  overflow: hidden;
  animation: sqp-fadein 0.12s ease;
}
@keyframes sqp-fadein {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.sqp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 8px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}
.sqp-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue, #006aff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sqp-header-info {
  flex: 1;
  min-width: 0;
}
.sqp-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sqp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}
.sqp-ficha-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue, #006aff);
  text-decoration: none;
  padding: 3px 7px;
  border: 1px solid var(--blue, #006aff);
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.sqp-ficha-btn:hover {
  background: var(--blue-dim, #e6f0ff);
}
.sqp-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.sqp-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sqp-section {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.sqp-section:last-child {
  border-bottom: none;
}
.sqp-section-title {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sqp-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  gap: 6px;
}
.sqp-stat-label {
  color: var(--text-secondary);
}
.sqp-stat-value {
  font-weight: 500;
}
.sqp-exam-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding: 2px 0;
  gap: 6px;
}
.sqp-exam-row span:first-child {
  color: var(--text-secondary);
}
.sqp-incident-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 2px 0;
  font-size: 0.8rem;
}
.sqp-priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.sqp-note-text {
  font-style: italic;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
  font-size: 0.78rem;
}
.sqp-empty {
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}
.sqp-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.5;
}
.sqp-badge-green  { background: #d1fae5; color: #065f46; }
.sqp-badge-red    { background: #fee2e2; color: #991b1b; }
.sqp-badge-grey   { background: var(--bg-hover); color: var(--text-secondary); }
.sqp-badge-blue   { background: #dbeafe; color: #1e40af; }
@media (prefers-color-scheme: dark) {
  .sqp-badge-green { background: #065f46; color: #d1fae5; }
  .sqp-badge-red   { background: #7f1d1d; color: #fee2e2; }
  .sqp-badge-blue  { background: #1e3a8a; color: #bfdbfe; }
}
.cal-event-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  cursor: ns-resize;
  z-index: 10;
}
.cal-event-resize-handle:hover {
  background: rgba(255, 255, 255, 0.4);
}
.slot-selecting {
  background: rgba(88, 166, 255, 0.15) !important;
}

/* Efecto Post-it para bloques especiales */
.cal-event.is-block {
  box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3) !important;
  border-radius: 2px 2px 14px 2px !important;
  border: none !important;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.06) 100%) !important;
  position: relative;
  overflow: visible !important;
  transform: rotate(-0.5deg);
  transition: transform 0.2s, box-shadow 0.2s;
  color: #111 !important;
}
.cal-event.is-block:hover {
  transform: rotate(0deg) scale(1.02);
  box-shadow: 4px 8px 12px rgba(0, 0, 0, 0.35) !important;
  z-index: 20;
}
.cal-event.is-block::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  border-width: 14px 14px 0 0;
  border-style: solid;
  border-color: rgba(0,0,0,0.12) transparent transparent rgba(0,0,0,0.12);
  border-radius: 0 0 14px 0;
}
.cal-month-event.is-block {
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2) !important;
  border-radius: 1px 1px 8px 1px !important;
  border: none !important;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.06) 100%) !important;
  position: relative;
  overflow: visible !important;
  transform: rotate(-0.5deg);
  color: #111 !important;
}
.cal-month-event.is-block::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  border-width: 8px 8px 0 0;
  border-style: solid;
  border-color: rgba(0,0,0,0.12) transparent transparent rgba(0,0,0,0.12);
  border-radius: 0 0 8px 0;
}

/* ---------- Dashboard Layout ---------- */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Notepad ---------- */
.notepad-card {
  height: 600px;
  display: flex;
  flex-direction: column;
}

.notepad-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.notepad-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Estilo Scrollbar para Notepad */
.notepad-list::-webkit-scrollbar { width: 5px; }
.notepad-list::-webkit-scrollbar-track { background: transparent; }
.notepad-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.note-item {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
  transition: border-color var(--transition);
}

.note-item:hover {
  border-color: var(--border-light);
}

.note-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
}

.note-author {
  font-weight: 700;
  color: var(--text-primary);
}

.note-date {
  color: var(--text-muted);
}

.note-delete {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}

.note-item:hover .note-delete {
  opacity: 1;
}

.note-delete:hover {
  color: var(--red);
}

.note-body {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.notepad-input-wrapper {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state-sm {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.875rem;
}

/* ---------- Notepad Enhancements ---------- */
.notepad-filters {
  display: flex;
  gap: 8px;
}

.note-recipient-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--blue-dim);
  color: var(--blue);
}

.note-recipient-badge.general {
  background: rgba(110, 118, 129, 0.15);
  color: var(--text-secondary);
}

.note-item.is-private {
  border-left: 3px solid var(--blue);
  background: rgba(88, 166, 255, 0.03);
}

.notepad-date-filter {
  padding: 0 24px 12px;
  animation: fadeIn var(--transition);
}

.d-none { display: none !important; }
.d-flex.gap-8 { display: flex; gap: 8px; }
.mb-8 { margin-bottom: 8px; }
.btn-block { width: 100%; }
