:root {
  --bg-primary:#0f1117;
  --bg-secondary:#161822;
  --bg-card:#1c1f2e;
  --bg-card-hover:#232738;
  --border-color:#2a2d3e;
  --border-focus:#4f8cff;
  --text-primary:#e8eaf0;
  --text-secondary:#8b8fa3;
  --text-muted:#5c6078;
  --accent:#4f8cff;
  --accent-hover:#3a7af0;
  --accent-light:rgba(79,140,255,0.1);
  --success:#34d399;
  --success-bg:rgba(52,211,153,0.1);
  --warning:#fbbf24;
  --danger:#f87171;
  --danger-bg:rgba(248,113,113,0.1);
  --purple:#a78bfa;
  --sidebar-width:260px;
  --sidebar-width-collapsed:75px;
  --topbar-height:64px;
  --radius:10px;
  --radius-sm:6px;
  --shadow:0 4px 24px rgba(0,0,0,0.3);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family:'Inter',-apple-system,sans-serif;
  background:var(--bg-primary);
  color:var(--text-primary);
  line-height:1.6;
}

::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:var(--bg-primary); }
::-webkit-scrollbar-thumb { background:var(--border-color); border-radius:3px; }

/* ============================================
 LOGIN
 ============================================ */
.login-screen {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  background:var(--bg-primary);
}

.login-card {
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius);
  padding:48px 40px;
  width:100%;
  max-width:420px;
  box-shadow:var(--shadow);
}

.login-logo { text-align:center; margin-bottom:32px; }
.login-logo .logo-icon { font-size:48px; margin-bottom:12px; }
.login-logo h1 { font-size:24px; font-weight:700; }
.login-logo p { color:var(--text-secondary); font-size:14px; }

.form-group { margin-bottom:20px; }
.form-group label {
  display:block;
  font-size:13px;
  font-weight:500;
  color:var(--text-secondary);
  margin-bottom:6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width:100%;
  padding:10px 14px;
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius-sm);
  color:var(--text-primary);
  font-size:14px;
  outline:none;
  transition:0.2s;
}

.form-group input:focus {
  border-color:var(--border-focus);
  box-shadow:0 0 0 3px var(--accent-light);
}

.error-msg {
  background:var(--danger-bg);
  color:var(--danger);
  padding:10px;
  border-radius:var(--radius-sm);
  font-size:13px;
  margin-bottom:16px;
}

.login-hint {
  margin-top:24px;
  padding:16px;
  background:var(--bg-secondary);
  border-radius:var(--radius-sm);
  text-align:center;
}
.login-hint p { font-size:12px; color:var(--text-muted); }
.login-hint strong { color:var(--text-secondary); }

/* ============================================
 BOTONES
 ============================================ */
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 20px;
  border:none;
  border-radius:var(--radius-sm);
  font-size:14px;
  font-weight:500;
  cursor:pointer;
  transition:0.2s;
}

.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent-hover); }

.btn-ghost {
  background:transparent;
  color:var(--text-secondary);
  border:1px solid var(--border-color);
}
.btn-ghost:hover { background:var(--bg-card-hover); color:var(--text-primary); }

.btn-success { background:var(--success); color:#0f1117; }
.btn-success:hover { filter:brightness(0.95); }

.btn-sm { padding:6px 12px; font-size:12px; }
.btn-full { width:100%; }
.btn-icon {
  background:none;
  border:none;
  color:var(--text-muted);
  cursor:pointer;
  padding:4px;
  border-radius:4px;
}
.btn-icon:hover { color:var(--danger); background:var(--danger-bg); }

/* ============================================
 SIDEBAR
 ============================================ */
.sidebar {
  position:fixed;
  top:0;
  left:0;
  width:var(--sidebar-width);
  height:100vh;
  background:var(--bg-secondary);
  border-right:1px solid var(--border-color);
  display:flex;
  flex-direction:column;
  z-index:100;
  transition:width 0.3s ease, transform 0.3s ease;
  overflow:hidden;
}

/* Botón Toggle Sidebar */
.sidebar-header {
  position: relative;
  padding: 12px 20px !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  background: transparent !important;
}

.sidebar-toggle {
  position: absolute !important;
  top: 8px !important;
  right: 0px !important;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  border-radius: 4px !important;
  background: var(--accent) !important;
  color: white !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 101 !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  font-size: 0 !important;
  box-shadow: none !important;
}

.sidebar-toggle svg {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  stroke: white !important;
  stroke-width: 2.5 !important;
  fill: none !important;
}

.sidebar-toggle:hover {
  background: var(--accent-hover) !important;
}

.sidebar-header .logo-icon.small { font-size:28px; }

.sidebar-nav {
  flex:1;
  padding:16px 12px;
  overflow-y:auto;
}

.nav-item {
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
  color:var(--text-secondary);
  text-decoration:none;
  border-radius:var(--radius-sm);
  font-size:14px;
  font-weight:500;
  transition:0.2s;
  white-space:nowrap;
}

.nav-item:hover { background:var(--bg-card); color:var(--text-primary); }
.nav-item.active { background:var(--accent-light); color:var(--accent); }
.nav-item svg { width:20px; height:20px; flex-shrink:0; }

.sidebar-footer {
  padding:16px 20px;
  border-top:1px solid var(--border-color);
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-shrink:0;
}

.user-info {
  display:flex;
  align-items:center;
  gap:10px;
  overflow:hidden;
}

.user-avatar {
  width:36px;
  height:36px;
  background:var(--accent);
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  font-weight:600;
  color:#fff;
  flex-shrink:0;
}

.user-name { font-size:13px; font-weight:600; }
.user-role { font-size:11px; color:var(--text-muted); }

.btn-logout {
  background:none;
  border:none;
  color:var(--text-muted);
  cursor:pointer;
  padding:8px;
  border-radius:var(--radius-sm);
  flex-shrink:0;
}

.btn-logout:hover { color:var(--danger); background:var(--danger-bg); }
.btn-logout svg { width:18px; height:18px; }

/* ============================================
 SIDEBAR COLAPSADO
 ============================================ */
.sidebar.collapsed {
  width:var(--sidebar-width-collapsed);
}

.sidebar.collapsed .sidebar-toggle {
  right:-8px;
}

.sidebar.collapsed .sidebar-toggle svg {
  transform:rotate(180deg);
}

.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .user-details {
  display:none !important;
  opacity:0;
  visibility:hidden;
}

.sidebar.collapsed .sidebar-header {
  justify-content:center;
  padding:15px 0;
}

.sidebar.collapsed .sidebar-header .logo-icon { margin:0; }

.sidebar.collapsed .nav-item {
  justify-content:center;
  padding:14px 0;
  gap:0;
}

.sidebar.collapsed .nav-item svg { margin:0; }

.sidebar.collapsed .sidebar-footer {
  padding:15px 10px;
  justify-content:center;
}

.sidebar.collapsed .user-info { justify-content:center; gap:0; }
.sidebar.collapsed .user-avatar { margin:0; }

/* ============================================
 MAIN CONTENT
 ============================================ */
.main-content {
  margin-left:var(--sidebar-width);
  min-height:100vh;
  transition:margin-left 0.3s ease;
  position:relative;
  z-index:1;
  display: flex !important;
  flex-direction: column !important;
}

.sidebar.collapsed ~ .main-content {
  margin-left:var(--sidebar-width-collapsed);
}

.topbar {
  height:var(--topbar-height);
  padding:0 32px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border-color);
  background:var(--bg-secondary);
  position:sticky;
  top:0;
  z-index:50;
}

.topbar h2 { font-size:20px; font-weight:600; }
.topbar-actions { display:flex; gap:12px; }

.content-area { padding:32px; flex: 1; }

.section { display:none; }
.section.active { display:block; }

/* ============================================
 DASHBOARD & STATS
 ============================================ */
.stats-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:20px;
  margin-bottom:32px;
}

.stat-card {
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius);
  padding:24px;
  display:flex;
  align-items:center;
  gap:16px;
}

.stat-icon {
  width:52px;
  height:52px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
}

.stat-icon.blue { background:var(--accent-light); }
.stat-icon.green { background:var(--success-bg); }
.stat-icon.purple { background:var(--purple); color:#fff; }
.stat-icon.orange { background:var(--warning); color:#000; }

.stat-info { display:flex; flex-direction:column; }
.stat-number { font-size:28px; font-weight:700; }
.stat-label { font-size:13px; color:var(--text-secondary); }

.small-stats .stat-card { padding:16px; }
.small-stats .stat-number { font-size:22px; }

.dashboard-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
}

.card {
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius);
  padding:24px;
}

.card h3 { font-size:16px; font-weight:600; margin-bottom:16px; }

.activity-list { display:flex; flex-direction:column; gap:12px; }

.activity-item {
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 0;
  border-bottom:1px solid var(--border-color);
  font-size:13px;
}

.activity-dot {
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--accent);
  flex-shrink:0;
}

.activity-time { margin-left:auto; color:var(--text-muted); font-size:11px; }

.schools-dash-list { display:flex; flex-direction:column; gap:8px; }

.school-dash-item {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 14px;
  background:var(--bg-secondary);
  border-radius:var(--radius-sm);
  font-size:13px;
}

.school-dash-item .school-name { font-weight:500; }
.school-dash-item .school-count { color:var(--text-muted); font-size:12px; }

/* ============================================
 CARDS & GRIDS
 ============================================ */
.cards-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(300px,1fr));
  gap:20px;
}

.item-card {
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius);
  padding:24px;
  transition:0.2s;
  cursor:pointer;
  position:relative;
}

.item-card:hover {
  border-color:var(--accent);
  transform:translateY(-2px);
}

.item-card .card-actions {
  position:absolute;
  top:12px;
  right:12px;
  display:flex;
  gap:4px;
  opacity:0;
  transition:0.2s;
}

.item-card:hover .card-actions { opacity:1; }

.item-card h3 { font-size:16px; font-weight:600; margin-bottom:4px; }
.item-card .card-subtitle { font-size:13px; color:var(--text-secondary); }

.item-card .card-meta {
  display:flex;
  gap:16px;
  margin-top:16px;
  padding-top:16px;
  border-top:1px solid var(--border-color);
  font-size:12px;
  color:var(--text-muted);
}

.add-card {
  border:2px dashed var(--border-color);
  background:transparent;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  min-height:180px;
  color:var(--text-muted);
  gap:8px;
}

.add-card:hover {
  border-color:var(--accent);
  color:var(--accent);
  background:var(--accent-light);
}

.add-card .plus { font-size:36px; }

.breadcrumb {
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:24px;
  font-size:13px;
  color:var(--text-secondary);
  flex-wrap: wrap;
}

.breadcrumb a { color:var(--accent); cursor:pointer; }
.breadcrumb .separator { color:var(--text-muted); }

/* ============================================
 TABLAS
 ============================================ */
.table-container {
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius);
  overflow:hidden;
  margin-top:20px;
  overflow-x: auto;
}

.data-table { width:100%; border-collapse:collapse; min-width: 600px; }

.data-table th {
  padding:14px 20px;
  text-align:left;
  font-size:12px;
  font-weight:600;
  color:var(--text-muted);
  text-transform:uppercase;
  background:var(--bg-secondary);
  border-bottom:1px solid var(--border-color);
}

.data-table td {
  padding:14px 20px;
  font-size:14px;
  border-bottom:1px solid var(--border-color);
}

.data-table tbody tr:hover { background:var(--bg-card-hover); }

/* ============================================
 MODALES
 ============================================ */
.modal-backdrop {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.7);
  backdrop-filter:blur(4px);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:1000;
  padding:20px;
}

.modal-backdrop.active { display:flex; }

.modal {
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius);
  width:100%;
  max-width:640px;
  max-height:90vh;
  display:flex;
  flex-direction:column;
  box-shadow:0 24px 48px rgba(0,0,0,0.4);
  animation:modalIn 0.2s ease;
}

@keyframes modalIn {
  from{opacity:0;transform:scale(0.95)}
  to{opacity:1;transform:scale(1)}
}

.modal-header {
  padding:20px 24px;
  border-bottom:1px solid var(--border-color);
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.modal-header h3 { font-size:18px; }

.modal-close {
  background:none;
  border:none;
  color:var(--text-muted);
  font-size:24px;
  cursor:pointer;
}

.modal-close:hover { color:var(--danger); background:var(--danger-bg); }

.modal-body { padding:24px; overflow-y:auto; flex:1; }

.modal-footer {
  padding:16px 24px;
  border-top:1px solid var(--border-color);
  display:flex;
  justify-content:flex-end;
  gap:12px;
}

.modal-large { max-width:800px; }

/* ============================================
 COMPONENTES
 ============================================ */
.badge {
  display:inline-block;
  padding:3px 10px;
  border-radius:12px;
  font-size:11px;
  font-weight:600;
}

.badge-success { background:var(--success-bg); color:var(--success); }
.badge-info { background:var(--accent-light); color:var(--accent); }
.badge-warning { background:var(--warning); color:#000; }

.empty-state { text-align:center; padding:48px; color:var(--text-muted); }

.toast-container {
  position:fixed;
  top:20px;
  right:20px;
  z-index:2000;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.toast {
  padding:14px 20px;
  border-radius:var(--radius-sm);
  font-size:13px;
  font-weight:500;
  box-shadow:var(--shadow);
  animation:toastIn 0.3s, toastOut 0.3s 2.7s forwards;
}

.toast-success { background:var(--success); color:#0f1117; }
.toast-error { background:var(--danger); color:#fff; }
.toast-info { background:var(--accent); color:#fff; }

@keyframes toastIn {
  from{opacity:0;transform:translateX(40px)}
  to{opacity:1;transform:translateX(0)}
}

@keyframes toastOut { to{opacity:0} }

.search-input {
  padding:10px 16px;
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius-sm);
  color:var(--text-primary);
  font-size:14px;
  outline:none;
  width:300px;
}

.students-toolbar {
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:16px;
  flex-wrap: wrap;
}

.file-upload-area {
  border:2px dashed var(--border-color);
  border-radius:var(--radius);
  padding:32px;
  text-align:center;
  cursor:pointer;
}

.file-upload-area:hover {
  border-color:var(--accent);
  background:var(--accent-light);
}

.upload-icon { font-size:36px; margin-bottom:8px; }

.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }

/* ============================================
 PAGOS & DETALLES
 ============================================ */
.payment-concepts { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }

.payment-concept-btn {
  padding:6px 14px;
  border:1px solid var(--border-color);
  border-radius:20px;
  background:transparent;
  color:var(--text-secondary);
  font-size:12px;
  cursor:pointer;
}

.payment-concept-btn:hover,
.payment-concept-btn.active {
  border-color:var(--accent);
  background:var(--accent-light);
  color:var(--accent);
}

.payments-list { max-height:250px; overflow-y:auto; }

.payment-item {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px;
  border:1px solid var(--border-color);
  border-radius:var(--radius-sm);
  margin-bottom:8px;
  background:var(--bg-secondary);
}

.payment-item .payment-concept { font-size:13px; font-weight:500; }
.payment-item .payment-date { font-size:11px; color:var(--text-muted); }
.payment-item .payment-amount { font-size:16px; font-weight:700; color:var(--success); }

.payment-delete {
  background:none;
  border:none;
  color:var(--text-muted);
  cursor:pointer;
  padding:4px;
  margin-left:8px;
}

.payment-delete:hover { color:var(--danger); }

.payment-summary {
  display:flex;
  justify-content:space-between;
  padding:12px 0;
  border-top:1px solid var(--border-color);
  margin-top:8px;
  font-size:14px;
}

.payment-summary .total-amount {
  font-weight:700;
  color:var(--success);
  font-size:18px;
}

.tabs {
  display:flex;
  border-bottom:1px solid var(--border-color);
  margin-bottom:20px;
}

.tab-btn {
  padding:10px 20px;
  background:none;
  border:none;
  color:var(--text-secondary);
  font-size:13px;
  cursor:pointer;
  border-bottom:2px solid transparent;
}

.tab-btn:hover { color:var(--text-primary); }
.tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); }
.tab-content { display:none; }
.tab-content.active { display:block; }

.detail-section { margin-bottom:24px; }
.detail-section h4 { font-size:14px; font-weight:600; color:var(--accent); margin-bottom:12px; }
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.detail-item .label { font-size:11px; color:var(--text-muted); text-transform:uppercase; }
.detail-item .value { font-size:14px; }

.student-detail-header {
  display:flex;
  align-items:center;
  gap:20px;
  margin-bottom:24px;
  padding-bottom:20px;
  border-bottom:1px solid var(--border-color);
}

.student-avatar {
  width:64px;
  height:64px;
  background:var(--accent);
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  font-weight:700;
  color:#fff;
}

/* ============================================
 REPORTES
 ============================================ */
.report-toolbar {
  display:flex;
  gap:10px;
  align-items:center;
  margin-bottom:20px;
  flex-wrap:wrap;
}

.report-summary {
  background:rgba(46,204,113,0.1);
  border-radius:8px;
  padding:15px;
  margin-top:20px;
}

.report-table { width:100%; }

/* ============================================
 UTILIDADES
 ============================================ */
.text-center { text-align:center; }
.text-success { color:var(--success); }
.text-muted { color:var(--text-muted); }
.flex { display:flex; }
.gap-1 { gap:8px; }
.mt-2 { margin-top:16px; }

/* ============================================
 AGENDA & CALENDAR
 ============================================ */
.agenda-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.weekday {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 0;
  font-weight: 600;
}

.calendar-day {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  min-height: 80px;
  padding: 8px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-day:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.calendar-day.empty { background: transparent; border: none; cursor: default; }
.calendar-day.today { border-color: var(--accent); background: var(--accent-light); }
.calendar-day.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.day-number { font-weight: 600; font-size: 14px; }

.event-dots { display: flex; gap: 2px; }
.event-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.event-preview { width: 100%; height: 4px; background: var(--accent); border-radius: 2px; margin-top: 2px; }

.agenda-events-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

.agenda-event-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  transition: transform 0.2s;
}
.agenda-event-item:last-child { border-bottom: none; }
.agenda-event-item:hover { transform: translateX(4px); }

.event-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 50px;
}

.event-info { flex: 1; }
.event-title { font-weight: 600; font-size: 14px; }
.event-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.event-actions { display: flex; gap: 4px; }

.event-preview { transition: opacity 0.2s; }
.event-preview:hover { opacity: 1 !important; }

/* ============================================
 FOOTER
 ============================================ */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 12px 24px;
  width: 100%;
  margin-top: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.footer-logo { font-size: 16px; }
.footer-app-name { color: var(--text-primary); font-weight: 600; }

.footer-version {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.footer-copyright { color: var(--text-muted); }

.footer-developer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ============================================
 TOGGLE SWITCH - PAGOS DE PRUEBAS
 ============================================ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 1px var(--success);
}

/* ============================================
 BOTÓN HAMBURGUESA (MÓVIL)
 ============================================ */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  margin-right: 12px;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

/* Overlay para sidebar móvil */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

/* ============================================
 RESPONSIVE - TABLET (max-width: 1024px)
 ============================================ */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ============================================
 RESPONSIVE - MÓVIL (max-width: 768px)
 ============================================ */
@media (max-width: 768px) {
  /* Mostrar botón hamburguesa */
  .mobile-menu-btn { display: block; }
  
  /* Sidebar como drawer */
  .sidebar {
      transform: translateX(-100%);
      width: var(--sidebar-width);
      box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  
  .sidebar.mobile-open {
      transform: translateX(0);
  }
  
  /* Ocultar toggle de escritorio */
  .sidebar-toggle { display: none !important; }
  
  /* El sidebar colapsado en móvil no aplica */
  .sidebar.collapsed {
      width: var(--sidebar-width);
  }
  
  /* Main content sin margen */
  .main-content {
      margin-left: 0 !important;
  }
  
  .sidebar.collapsed ~ .main-content {
      margin-left: 0 !important;
  }
  
  /* Topbar compacta */
  .topbar {
      padding: 0 16px;
  }
  
  .topbar h2 { font-size: 16px; }
  
  .topbar-actions { gap: 8px; }
  .topbar-actions .btn { padding: 8px 12px; font-size: 13px; }
  
  /* Contenido */
  .content-area { padding: 16px; }
  
  /* Stats en 1 columna */
  .stats-grid {
      grid-template-columns: 1fr;
      gap: 12px;
      margin-bottom: 20px;
  }
  
  .stat-card { padding: 16px; }
  .stat-icon { width: 44px; height: 44px; font-size: 20px; }
  .stat-number { font-size: 22px; }
  
  /* Cards en 1 columna */
  .cards-grid {
      grid-template-columns: 1fr;
      gap: 12px;
  }
  
  .item-card { padding: 16px; }
  .item-card .card-actions { opacity: 1; } /* Siempre visibles en móvil */
  
  /* Formularios en 1 columna */
  .form-row { grid-template-columns: 1fr; }
  
  /* Search input full width */
  .search-input { width: 100%; }
  
  /* Students toolbar apilado */
  .students-toolbar {
      flex-direction: column;
      align-items: stretch;
  }
  
  /* Modales pantalla completa */
  .modal-backdrop { padding: 0; }
  .modal {
      max-width: 100%;
      max-height: 100vh;
      border-radius: 0;
      height: 100vh;
  }
  .modal-large { max-width: 100%; }
  .modal-header, .modal-body, .modal-footer { padding: 16px; }
  
  /* Toast abajo en móvil */
  .toast-container {
      top: auto;
      bottom: 20px;
      right: 16px;
      left: 16px;
  }
  .toast { max-width: 100%; }
  
  /* Calendario compacto */
  .calendar-grid { gap: 4px; }
  .calendar-day { min-height: 60px; padding: 4px; }
  .day-number { font-size: 12px; }
  .event-preview { height: 3px; }
  .weekday { font-size: 10px; padding: 6px 0; }
  .event-dots { display: none; } /* Ocultar dots en móvil */
  
  /* Agenda events */
  .agenda-event-item {
      flex-wrap: wrap;
  }
  .event-time {
      min-width: auto;
      width: 100%;
      margin-bottom: 4px;
  }
  
  /* Login compacto */
  .login-card { padding: 24px; }
  .login-logo .logo-icon { font-size: 36px; }
  .login-logo h1 { font-size: 20px; }
  
  /* Footer apilado */
  .footer-content {
      flex-direction: column;
      text-align: center;
      gap: 8px;
      font-size: 11px;
  }
  .footer-brand, .footer-developer {
      justify-content: center;
      flex-wrap: wrap;
  }
  
  /* Reportes toolbar apilado */
  .report-toolbar {
      flex-direction: column;
      align-items: stretch;
  }
  .report-toolbar .btn,
  .report-toolbar select,
  .report-toolbar input {
      width: 100%;
  }
  
  /* Student detail */
  .student-detail-header {
      flex-direction: column;
      text-align: center;
  }
  
  /* Payment concepts */
  .payment-concepts { flex-direction: column; }
  .payment-concept-btn { width: 100%; text-align: center; }
  
  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; }
  
  /* Breadcrumb */
  .breadcrumb { font-size: 12px; }
  
  /* Tablas */
  .data-table th, .data-table td {
      padding: 10px 12px;
      font-size: 13px;
  }
}

/* ============================================
 RESPONSIVE - MÓVIL PEQUEÑO (max-width: 480px)
 ============================================ */
@media (max-width: 480px) {
  .btn { padding: 10px 14px; font-size: 13px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }
  
  .stat-card {
      flex-direction: column;
      text-align: center;
  }
  
  .calendar-day { min-height: 50px; }
  .event-preview { height: 2px; }
  
  .login-card { padding: 20px; }
  
  .app-footer { padding: 10px 16px; }
}

/* ============================================
 PRINT
 ============================================ */
@media print {
  .sidebar,
  .topbar-actions,
  .report-toolbar,
  .modal-backdrop,
  .btn,
  .mobile-menu-btn,
  .sidebar-overlay {
      display:none !important;
  }
  
  .main-content {
      margin-left:0 !important;
  }
  
  body {
      background:#fff;
      color:#000;
  }
  
  .data-table {
      font-size:10px;
  }
  
  .data-table th,
  .data-table td {
      padding:6px 10px;
  }
}
/* ============================================
   MEJORAS DASHBOARD - RESPONSIVE Y LAYOUT
   ============================================ */

/* Ajustar tamaño de iconos en stat-card */
.stat-icon {
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Prevenir overflow en stat-number */
.stat-number {
  font-size: 28px;
  font-weight: 700;
  word-break: break-word;
  max-width: 100%;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Ajustar label para que no sea tan largo */
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Mejorar el contenedor de stat-info */
.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0; /* Permite que flex-item se encoja */
  overflow: hidden;
}

/* Stats grid responsive */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

/* Responsive para tablets */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stat-number {
    font-size: 24px;
  }
}

/* Responsive para móviles */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-number {
    font-size: 22px;
  }
  
  .stat-label {
    font-size: 12px;
  }
  
  .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
}

/* Ajustes específicos para montos grandes */
.stat-number[data-currency] {
  font-size: 24px;
  letter-spacing: -0.5px;
}

@media (max-width: 768px) {
  .stat-number[data-currency] {
    font-size: 20px;
  }
}

/* Prevenir que el contenido se salga de las cards */
.card {
  overflow: hidden;
  word-wrap: break-word;
}

.card h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ============================================
   MEJORAS DASHBOARD - FORMATO COMPACTO
   ============================================ */

/* Prevenir que los números se partan en dos líneas */
.stat-number {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

/* Ajustar el layout de stat-card para mejor alineación */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 100px;
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive para pantallas pequeñas */
@media (max-width: 768px) {
  .stat-number {
    font-size: 22px;
  }
  
  .stat-card {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stat-number {
    font-size: 20px;
  }
}

/* ============================================
   TOOLTIP PARA DASHBOARD - VALOR EXACTO
   ============================================ */

/* Contenedor del tooltip */
.stat-card[data-exact-value] {
  position: relative;
}

/* Tooltip */
.stat-card[data-exact-value]::after {
  content: attr(data-exact-value);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 17, 23, 0.95);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  z-index: 1000;
}

/* Flecha del tooltip */
.stat-card[data-exact-value]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-color);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-bottom: -2px;
  z-index: 1000;
}

/* Mostrar tooltip en hover */
.stat-card[data-exact-value]:hover::after,
.stat-card[data-exact-value]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Tooltip para móviles (siempre visible en touch) */
@media (hover: none) {
  .stat-card[data-exact-value]::after,
  .stat-card[data-exact-value]::before {
    display: none;
  }
}

/* ============================================
   TOOLTIP PARA DASHBOARD - VALOR EXACTO
   ============================================ */

.stat-card {
  position: relative;
}

.stat-card[data-exact-value]::after {
  content: attr(data-exact-value);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 17, 23, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.stat-card[data-exact-value]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* TOOLTIP DASHBOARD */
.stat-card {
  position: relative;
}

.stat-card[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.stat-card[data-tooltip]:hover::before {
  opacity: 1;
}

/* ============================================
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 768px) {
  .stat-card-flip-front,
  
}

  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* FLIP CARD - ALTURA IGUAL A LAS DEMÁS */
.stat-card-flip {
  perspective: 1000px;
}

.stat-card-flip-inner {
  position: relative;
  width: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.stat-card-flip:hover .stat-card-flip-inner {
  transform: rotateY(180deg);
}

.stat-card-flip-front {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 100px;
}

.stat-card-flip-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 100px;
}

.stat-card-flip-back .exact-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.stat-card-flip-back .exact-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================
  
  .modal-header, 
  .modal-footer {
    flex-shrink: 0;
    min-height: auto;
  }
  
  .modal-body {
    max-height: 60vh;
    overflow-y: auto;
  }
  
  /* Ajustar padding para mejor visualización */
  .modal-header,
  .modal-footer {
    padding: 16px !important;
  }
  
  /* Asegurar que el título sea visible */
  .modal-header h3 {
    font-size: 16px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Para pantallas aún más pequeñas */
@media (max-width: 480px) {
  .modal {
    width: 95% !important;
    margin: 10px !important;
  }
  
  .modal-body {
    padding: 12px !important;
  }
  
  .modal-footer {
    flex-direction: column !important;
    gap: 8px !important;
  }
  
  .btn {
    width: 100% !important;
  }
}

/* ============================================
  
  .modal-body {
    flex: 0 0 auto !important;
    max-height: none !important;
    overflow-y: visible !important;
  }
  
  .modal-footer {
    margin-top: auto;
  }
}


/* MODAL MÓVIL - REGLA DEFINITIVA */
@media (max-width: 768px) {
  .modal {
    max-height: 100vh !important;
    height: auto !important;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    flex: 0 0 auto !important;
  }
  
  .modal-body {
    overflow-y: auto !important;
  }
}

/* MODAL MÓVIL - FORZAR COMPORTAMIENTO */
@media screen and (max-width: 768px) {
  .modal {
    max-height: none !important;
    height: auto !important;
    min-height: auto !important;
  }
  
  .modal-header {
    flex: 0 0 auto !important;
    -webkit-box-flex: 0 !important;
    -ms-flex: 0 0 auto !important;
  }
  
  .modal-body {
    flex: 0 0 auto !important;
    -webkit-box-flex: 0 !important;
    -ms-flex: 0 0 auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  .modal-footer {
    flex: 0 0 auto !important;
    -webkit-box-flex: 0 !important;
    -ms-flex: 0 0 auto !important;
  }
}

/* Forzar ancho completo en tabla de usuarios */
#section-admins #adminsGrid {
  width: 100% !important;
  display: block !important;
}

#section-admins #adminsGrid > * {
  width: 100% !important;
}

#section-admins .data-table {
  width: 100% !important;
  min-width: 100% !important;
}
