/* ============================================================
   Gestión Integral EMARTI — Custom Theme
   Navy Blue + Orange/Sienna · Bootstrap 5.3 Variables
   ============================================================ */

:root,
[data-bs-theme="light"] {
  --emarti-navy: #0a1628;
  --emarti-navy-light: #152a4a;
  --emarti-navy-muted: #1e3a6e;
  --emarti-navy-soft: #2d4f8c;
  --emarti-orange: #f97316;
  --emarti-orange-hover: #ea580c;
  --emarti-orange-light: #fb923c;
  --emarti-sienna: #c2410c;
  --emarti-gold: #fbbf24;
  --emarti-amber: #f59e0b;

  --emarti-bg: #f4f6fb;
  --emarti-bg-card: #ffffff;
  --emarti-bg-subtle: #eef2f9;
  --emarti-text: #0f172a;
  --emarti-text-muted: #64748b;
  --emarti-border: #e2e8f0;

  --emarti-present-bg: rgba(34, 197, 94, 0.08);
  --emarti-present-border: rgba(34, 197, 94, 0.35);
  --emarti-present-text: #15803d;
  --emarti-absent-bg: rgba(239, 68, 68, 0.08);
  --emarti-absent-border: rgba(239, 68, 68, 0.35);
  --emarti-absent-text: #b91c1c;

  --emarti-sidebar-width: 260px;
  --emarti-sidebar-collapsed: 72px;
  --emarti-navbar-height: 64px;
  --emarti-radius: 0.75rem;
  --emarti-shadow: 0 1px 3px rgba(13, 27, 62, 0.08), 0 4px 12px rgba(13, 27, 62, 0.06);
  --emarti-shadow-lg: 0 8px 30px rgba(13, 27, 62, 0.12);

  --bs-primary: var(--emarti-navy);
  --bs-primary-rgb: 13, 27, 62;
  --bs-body-bg: var(--emarti-bg);
  --bs-body-color: var(--emarti-text);
  --bs-border-color: var(--emarti-border);
  --bs-border-radius: var(--emarti-radius);
  --bs-border-radius-lg: 1rem;
  --bs-link-color: var(--emarti-navy-muted);
  --bs-link-hover-color: var(--emarti-orange);
}

[data-bs-theme="dark"] {
  --emarti-bg: #0f1419;
  --emarti-bg-card: #1a2332;
  --emarti-bg-subtle: #243044;
  --emarti-text: #f1f5f9;
  --emarti-text-muted: #94a3b8;
  --emarti-border: #334155;
  --emarti-navy-muted: #93c5fd;
  --emarti-present-bg: rgba(34, 197, 94, 0.12);
  --emarti-absent-bg: rgba(239, 68, 68, 0.12);
  --bs-body-bg: var(--emarti-bg);
  --bs-body-color: var(--emarti-text);
  --bs-border-color: var(--emarti-border);
}

/* ── Base ── */
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background-color: var(--emarti-bg);
  color: var(--emarti-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Login Split Screen ── */
.login-split {
  min-height: 100vh;
}

.login-brand-panel {
  background: linear-gradient(135deg, var(--emarti-navy) 0%, var(--emarti-navy-light) 45%, var(--emarti-orange) 100%);
  position: relative;
  overflow: hidden;
}

.login-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(243, 156, 18, 0.25) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
  pointer-events: none;
}

.login-brand-content {
  position: relative;
  z-index: 1;
  padding: 3rem;
}

.login-illustration {
  max-width: 320px;
  opacity: 0.9;
}

.login-form-panel {
  background: var(--emarti-bg-card);
}

.login-card {
  max-width: 420px;
  width: 100%;
}

.btn-emarti-primary {
  background: linear-gradient(135deg, var(--emarti-orange) 0%, var(--emarti-orange-hover) 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--emarti-radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-emarti-primary:hover,
.btn-emarti-primary:focus {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(230, 126, 34, 0.45);
  filter: brightness(1.05);
}

.input-group-emarti .input-group-text {
  background: var(--emarti-bg);
  border-color: var(--emarti-border);
  color: var(--emarti-navy-muted);
}

.input-group-emarti .form-control {
  border-color: var(--emarti-border);
  padding: 0.65rem 1rem;
}

.input-group-emarti .form-control:focus {
  border-color: var(--emarti-orange);
  box-shadow: 0 0 0 0.2rem rgba(230, 126, 34, 0.15);
}

/* ── App Layout ── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar (tono azul claro institucional) ── */
.sidebar {
  width: var(--emarti-sidebar-width);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 45%, #f1f5f9 100%);
  color: #0f172a;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, transform 0.3s ease;
  overflow: hidden;
  border-right: 1px solid var(--emarti-border);
  box-shadow: 2px 0 16px rgba(10, 22, 40, 0.06);
}

.sidebar.collapsed {
  width: var(--emarti-sidebar-collapsed);
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--emarti-border);
  background: linear-gradient(135deg, #1e3a6e 0%, #2d5282 100%);
  white-space: nowrap;
}

.sidebar-brand {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand i {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--emarti-orange) 0%, var(--emarti-gold) 100%);
  border-radius: 0.6rem;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}

.sidebar-brand-text {
  transition: opacity 0.2s ease;
  line-height: 1.25;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-footer {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.65rem;
  overflow-y: auto;
  background: transparent;
}

.sidebar-section-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #475569;
  padding: 0.5rem 0.85rem;
  margin-top: 0.25rem;
  font-weight: 700;
  transition: opacity 0.2s ease;
}

.sidebar .nav-link {
  color: #1e293b;
  padding: 0.7rem 0.9rem;
  border-radius: 0.65rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.22s ease;
  border-left: 3px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

.sidebar .nav-link i {
  width: 1.35rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  color: #334155;
}

.sidebar .nav-link:hover {
  color: var(--emarti-navy);
  background: rgba(30, 58, 110, 0.08);
  transform: translateX(2px);
}

.sidebar .nav-link.active {
  color: var(--emarti-navy);
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.04) 100%);
  border-left-color: var(--emarti-orange);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(249, 115, 22, 0.1);
}

.sidebar .nav-link.active i {
  color: var(--emarti-orange);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--emarti-border);
  font-size: 0.7rem;
  color: #475569;
  text-align: center;
  background: #f8fafc;
  transition: opacity 0.2s ease;
}

/* Sidebar y navbar en modo oscuro */
[data-bs-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f1f5f9;
  border-right-color: #334155;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] .sidebar-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

[data-bs-theme="dark"] .sidebar-section-label {
  color: #94a3b8;
}

[data-bs-theme="dark"] .sidebar .nav-link {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .sidebar .nav-link i {
  color: #94a3b8;
}

[data-bs-theme="dark"] .sidebar .nav-link:hover {
  color: #fff;
  background: rgba(249, 115, 22, 0.12);
}

[data-bs-theme="dark"] .sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.22) 0%, rgba(249, 115, 22, 0.06) 100%);
}

[data-bs-theme="dark"] .sidebar .nav-link.active i {
  color: var(--emarti-orange-light);
}

[data-bs-theme="dark"] .sidebar-footer {
  background: #0f172a;
  color: #94a3b8;
}

[data-bs-theme="dark"] .top-navbar {
  background: rgba(15, 23, 42, 0.96);
  border-bottom-color: #334155;
}

[data-bs-theme="dark"] .page-title {
  color: #f1f5f9;
}

[data-bs-theme="dark"] #sidebarToggle {
  background: #1e293b;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .table-emarti tbody td {
  color: var(--emarti-text);
  border-color: var(--emarti-border);
}

[data-bs-theme="dark"] .table-emarti tbody tr:hover {
  background: rgba(249, 115, 22, 0.08);
}

[data-bs-theme="dark"] .kpi-card {
  background: var(--emarti-bg-card);
  border-color: var(--emarti-border);
}

[data-bs-theme="dark"] .filter-bar {
  background: var(--emarti-bg-card);
  border-color: var(--emarti-border);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1035;
}

/* ── Layout Docente (sin sidebar, móvil) ── */
.layout-docente .main-content {
  margin-left: 0 !important;
}

.docente-header {
  background: linear-gradient(135deg, #1e3a6e 0%, #2d5282 70%, #c2410c 100%);
  color: #fff;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 4px 16px rgba(30, 58, 110, 0.2);
}

.docente-header-logo {
  width: 42px;
  height: 42px;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--emarti-gold);
}

.docente-header-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}

.docente-header-sub {
  font-size: 0.72rem;
  opacity: 0.8;
}

.layout-docente .page-content {
  padding: 1rem;
  padding-bottom: 6rem;
}

.layout-docente .attendance-fab {
  bottom: 1rem;
  max-width: calc(100% - 1.5rem);
}

.layout-docente .attendance-fab .btn {
  width: 100%;
  font-size: 0.95rem;
  padding: 0.9rem 1.25rem;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--emarti-sidebar-width);
  transition: margin-left 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed ~ .main-content,
.app-wrapper.sidebar-collapsed .main-content {
  margin-left: var(--emarti-sidebar-collapsed);
}

.top-navbar {
  height: var(--emarti-navbar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--emarti-border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 1px 3px rgba(10, 22, 40, 0.06);
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--emarti-text);
  margin: 0;
  letter-spacing: -0.01em;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emarti-navy-muted) 0%, var(--emarti-orange) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
  border: 2px solid #fff;
}

.page-content {
  flex: 1;
  padding: 1.5rem;
  background: var(--emarti-bg);
}

/* ── Dashboard ── */
.dashboard-welcome {
  background: linear-gradient(135deg, var(--emarti-navy) 0%, var(--emarti-navy-muted) 60%, #7c2d12 100%);
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  color: #fff;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(10, 22, 40, 0.18);
}

.dashboard-welcome::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -5%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.15);
  pointer-events: none;
}

.dashboard-welcome::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: 30%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.08);
  pointer-events: none;
}

.dashboard-welcome-content {
  position: relative;
  z-index: 1;
}

.dashboard-welcome h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dashboard-welcome p {
  opacity: 0.8;
  margin: 0;
  font-size: 0.9rem;
}

.dashboard-welcome-stat {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  padding: 0.65rem 1rem;
  text-align: center;
  backdrop-filter: blur(4px);
}

.dashboard-welcome-stat strong {
  display: block;
  font-size: 1.25rem;
  color: var(--emarti-gold);
}

.dashboard-welcome-stat span {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}

/* ── KPI Cards ── */
.kpi-card {
  background: var(--emarti-bg-card);
  border-radius: 1rem;
  border: 1px solid var(--emarti-border);
  box-shadow: 0 1px 3px rgba(10, 22, 40, 0.05), 0 4px 16px rgba(10, 22, 40, 0.04);
  padding: 1.35rem;
  height: 100%;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  border-radius: 1rem 1rem 0 0;
}

.kpi-card.kpi-navy::before { background: linear-gradient(90deg, var(--emarti-navy), var(--emarti-navy-soft)); }
.kpi-card.kpi-orange::before { background: linear-gradient(90deg, var(--emarti-orange), var(--emarti-gold)); }
.kpi-card.kpi-green::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
.kpi-card.kpi-blue::before { background: linear-gradient(90deg, #2563eb, #60a5fa); }

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(10, 22, 40, 0.1);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.kpi-icon.navy { background: linear-gradient(135deg, rgba(10, 22, 40, 0.08), rgba(30, 58, 110, 0.12)); color: var(--emarti-navy); }
.kpi-icon.orange { background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(251, 191, 36, 0.15)); color: var(--emarti-orange); }
.kpi-icon.green { background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(74, 222, 128, 0.15)); color: #16a34a; }
.kpi-icon.blue { background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(96, 165, 250, 0.15)); color: #2563eb; }

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--emarti-text);
  letter-spacing: -0.02em;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--emarti-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-progress {
  height: 7px;
  border-radius: 4px;
  background: var(--emarti-bg-subtle);
  margin-top: 0.85rem;
  overflow: hidden;
}

.kpi-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--emarti-navy-muted), var(--emarti-orange), var(--emarti-gold));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Chart Cards ── */
.chart-card {
  background: var(--emarti-bg-card);
  border-radius: 1rem;
  border: 1px solid var(--emarti-border);
  box-shadow: 0 1px 3px rgba(10, 22, 40, 0.05), 0 4px 16px rgba(10, 22, 40, 0.04);
  padding: 1.35rem;
  height: 100%;
  transition: box-shadow 0.25s ease;
}

.chart-card:hover {
  box-shadow: 0 8px 28px rgba(10, 22, 40, 0.08);
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--emarti-border);
}

.chart-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
  color: var(--emarti-text);
}

.chart-container {
  position: relative;
  height: 280px;
}

/* ── Attendance View ── */
.attendance-header {
  background: linear-gradient(135deg, #1e3a6e 0%, #2d5282 60%, #ea580c 100%);
  color: #fff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(30, 58, 110, 0.15);
}

.attendance-summary {
  background: var(--emarti-bg-card);
  border-radius: var(--emarti-radius);
  border: 1px solid var(--emarti-border);
  box-shadow: var(--emarti-shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.summary-badge.present {
  background: var(--emarti-present-bg);
  color: var(--emarti-present-text);
  border: 1px solid var(--emarti-present-border);
}

.summary-badge.absent {
  background: var(--emarti-absent-bg);
  color: var(--emarti-absent-text);
  border: 1px solid var(--emarti-absent-border);
}

.student-row {
  background: var(--emarti-bg-card);
  border: 1px solid var(--emarti-present-border);
  background-color: var(--emarti-present-bg);
  border-radius: var(--emarti-radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.25s ease;
}

.student-row.absent {
  background-color: var(--emarti-absent-bg);
  border-color: var(--emarti-absent-border);
}

.student-info {
  flex: 1;
  min-width: 0;
}

.student-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-carnet {
  font-size: 0.78rem;
  color: var(--emarti-text-muted);
}

/* iOS-style Switch */
.emarti-switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}

.emarti-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.emarti-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ef4444;
  border-radius: 30px;
  transition: background 0.25s ease;
}

.emarti-switch-slider::before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.emarti-switch input:checked + .emarti-switch-slider {
  background: #22c55e;
}

.emarti-switch input:checked + .emarti-switch-slider::before {
  transform: translateX(22px);
}

.attendance-fab {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1010;
  max-width: calc(100% - 2rem);
}

.attendance-fab .btn {
  box-shadow: 0 6px 24px rgba(230, 126, 34, 0.4);
  padding: 0.85rem 2rem;
  font-weight: 600;
  border-radius: 2rem;
}

/* ── Reports ── */
.filter-bar {
  background: var(--emarti-bg-card);
  border-radius: var(--emarti-radius);
  border: 1px solid var(--emarti-border);
  box-shadow: var(--emarti-shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.btn-export-excel {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

.btn-export-excel:hover {
  background: #047857;
  border-color: #047857;
  color: #fff;
}

.btn-export-pdf {
  background: var(--emarti-navy);
  border-color: var(--emarti-navy);
  color: #fff;
}

.btn-export-pdf:hover {
  background: var(--emarti-navy-light);
  border-color: var(--emarti-navy-light);
  color: #fff;
}

.table-emarti {
  background: var(--emarti-bg-card);
  border-radius: var(--emarti-radius);
  overflow: hidden;
  box-shadow: var(--emarti-shadow);
}

.table-emarti thead {
  background: var(--emarti-navy);
  color: #fff;
}

.table-emarti thead th {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.85rem 1rem;
  border: none;
}

.table-emarti tbody td {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  vertical-align: middle;
  color: var(--emarti-text);
}

.table-emarti tbody td code {
  color: #0f172a;
  background: #f1f5f9;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  font-size: 0.85rem;
}

[data-bs-theme="dark"] .table-emarti tbody td code {
  color: #fbbf24;
  background: #1e293b;
}

.table-emarti tbody tr:hover {
  background: rgba(230, 126, 34, 0.04);
}

.table-emarti .btn + .btn {
  margin-left: 0.25rem;
}

/* ── Modals ── */
.modal-emarti .modal-header {
  background: linear-gradient(135deg, var(--emarti-navy) 0%, var(--emarti-navy-light) 100%);
  color: #fff;
  border-bottom: none;
  border-radius: var(--emarti-radius) var(--emarti-radius) 0 0;
}

.modal-emarti .modal-content {
  border: none;
  border-radius: var(--emarti-radius);
  overflow: hidden;
  box-shadow: var(--emarti-shadow-lg);
}

.modal-emarti .btn-close {
  filter: invert(1);
}

.modal-confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(230, 126, 34, 0.12);
  color: var(--emarti-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
}

/* ── Utilities ── */
.text-emarti-orange { color: var(--emarti-orange) !important; }
.text-emarti-navy { color: var(--emarti-navy) !important; }
.bg-emarti-card { background: var(--emarti-bg-card); }

.date-badge {
  background: var(--emarti-bg);
  border: 1px solid var(--emarti-border);
  border-radius: 2rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  color: var(--emarti-text-muted);
}

.date-badge i {
  color: var(--emarti-orange);
}

/* ── Responsive ── */
.table-responsive {
  -webkit-overflow-scrolling: touch;
}

#sidebarToggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--emarti-bg-subtle);
  color: var(--emarti-navy) !important;
  text-decoration: none !important;
}

#sidebarToggle:hover {
  background: rgba(249, 115, 22, 0.12);
  color: var(--emarti-orange) !important;
}

.student-row .emarti-switch {
  min-height: auto;
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .page-content { padding: 1.25rem; }
  .kpi-value { font-size: 1.6rem; }
  .chart-container { height: 260px; }
  .dashboard-welcome h2 { font-size: 1.2rem; }
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--emarti-sidebar-width) !important;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .page-content {
    padding: 1rem;
  }

  .chart-container {
    height: 240px;
  }

  .attendance-fab {
    bottom: 1rem;
  }
}

@media (max-width: 575.98px) {
  .kpi-value {
    font-size: 1.35rem;
  }

  .top-navbar {
    padding: 0 0.75rem;
  }

  .page-title {
    font-size: 1rem;
    max-width: 55vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .filter-bar .row > [class*="col"] {
    margin-bottom: 0.5rem;
  }

  .filter-bar {
    padding: 0.85rem;
  }

  .attendance-summary {
    flex-direction: column;
    align-items: stretch !important;
  }

  .attendance-summary .summary-badge {
    justify-content: center;
    width: 100%;
  }

  .student-row {
    padding: 1rem;
  }

  .student-name {
    font-size: 0.9rem;
    white-space: normal;
  }

  .emarti-switch {
    width: 56px;
    height: 34px;
  }

  .emarti-switch-slider::before {
    height: 28px;
    width: 28px;
  }

  .emarti-switch input:checked + .emarti-switch-slider::before {
    transform: translateX(22px);
  }

  .dashboard-welcome {
    padding: 1.15rem;
  }

  .dashboard-welcome-stat strong {
    font-size: 1.1rem;
  }

  .login-card {
    padding: 1.75rem 1.25rem;
    border-radius: 1rem;
  }

  .table-emarti thead th,
  .table-emarti tbody td {
    font-size: 0.8rem;
    padding: 0.6rem 0.5rem;
  }

  .date-badge {
    display: none !important;
  }

  .attendance-header {
    padding: 1rem;
  }

  .attendance-header .h5 {
    font-size: 1rem;
  }
}

/* Safe area (notch phones) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .attendance-fab {
    bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  .layout-docente .page-content {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }
}

/* ── Login aesthetic overrides ── */
.login-split { background: var(--emarti-bg); }

.login-brand-panel {
  background: linear-gradient(145deg, #06101f 0%, var(--emarti-navy) 35%, #1a3260 65%, #9a3412 100%) !important;
}

.login-brand-panel::before {
  background:
    radial-gradient(ellipse 80% 60% at 10% 90%, rgba(249, 115, 22, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(251, 191, 36, 0.15) 0%, transparent 50%) !important;
}

.login-form-panel {
  background: linear-gradient(180deg, #f8fafc 0%, var(--emarti-bg) 100%) !important;
  position: relative;
}

.login-form-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--emarti-orange), var(--emarti-gold));
}

.login-card {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2.25rem 2rem;
  box-shadow: 0 4px 6px rgba(10, 22, 40, 0.04), 0 20px 50px rgba(10, 22, 40, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-card-icon {
  width: 56px; height: 56px;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--emarti-navy), var(--emarti-navy-muted));
  display: flex; align-items: center; justify-content: center;
  color: var(--emarti-orange-light);
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(10, 22, 40, 0.2);
}

.login-brand-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(255,255,255,0.1); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 2rem;
  padding: 0.4rem 1rem; font-size: 0.8rem; color: rgba(255,255,255,0.9);
  margin-bottom: 1.5rem;
}

.login-brand-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.15;
}

.login-brand-subtitle { font-size: 1.05rem; color: rgba(255,255,255,0.75); max-width: 380px; margin: 0 auto; }

.login-brand-features { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-top: 2rem; }

.login-feature-pill {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.5rem; padding: 0.5rem 0.85rem; font-size: 0.78rem; color: rgba(255,255,255,0.85);
}

.login-feature-pill i { color: var(--emarti-gold); margin-right: 0.35rem; }

.btn-emarti-primary {
  background: linear-gradient(135deg, var(--emarti-orange), var(--emarti-sienna)) !important;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35) !important;
  border-radius: 0.75rem !important;
  padding: 0.8rem 1.5rem !important;
}

.btn-emarti-primary:hover {
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.45) !important;
}

.input-group-emarti .input-group-text { background: var(--emarti-bg-subtle); border-right: none; }
.input-group-emarti:focus-within .input-group-text { border-color: var(--emarti-orange); color: var(--emarti-orange); }
.input-group-emarti .form-control:focus { box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12) !important; }

.date-badge {
  background: var(--emarti-bg-subtle);
  border: 1px solid var(--emarti-border);
  border-radius: 2rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  color: var(--emarti-text-muted);
}

.date-badge i { color: var(--emarti-orange); }
