body { background: #f6f7fb; color: #1f2937; --sidebar-bg: radial-gradient(circle at 12% 8%, rgba(34,211,238,.34) 0 18%, transparent 34%), linear-gradient(165deg, #0f172a 0%, #1d4ed8 46%, #0e7490 100%); }
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar { width: 270px; min-height: 100vh; position: sticky; top: 0; flex-direction: column; background: var(--sidebar-bg) !important; border-right: 0; box-shadow: 14px 0 34px rgba(15,23,42,.22); }
.sidebar-brand { min-height: 68px; display: flex; align-items: center; gap: 10px; padding: 0 20px; color: #ffffff; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.16); text-shadow: 0 1px 10px rgba(15,23,42,.24); }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.96); color: #1d4ed8; box-shadow: 0 10px 24px rgba(15,23,42,.24); }
.brand-mark img { width: 28px; height: 28px; object-fit: contain; }
.sidebar-nav { padding: 14px 12px; overflow-y: auto; }
.app-sidebar .sidebar-nav { max-height: calc(100vh - 68px); }
.sidebar-nav.mobile { padding-top: 0; }
.sidebar-link { min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin-bottom: 4px; border-radius: 8px; color: rgba(255,255,255,.88); text-decoration: none; font-size: .94rem; transition: background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease; }
.sidebar-link i { width: 20px; text-align: center; font-size: 1rem; color: rgba(255,255,255,.96); }
.sidebar-link:hover { background: rgba(255,255,255,.15); color: #ffffff; transform: translateX(2px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.sidebar-link.active { background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 100%); color: #0f3b74; font-weight: 700; box-shadow: 0 12px 26px rgba(8,47,73,.28); }
.sidebar-link.active i { color: #0ea5e9; }
.sidebar-toggle { width: 100%; border: 0; background: transparent; }
.sidebar-toggle.active { background: rgba(255,255,255,.16); color: #ffffff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.sidebar-toggle.active i { color: #ffffff; }
.sidebar-sublink { position: relative; margin-left: 12px; min-height: 38px; font-size: .9rem; background: rgba(255,255,255,.075); border-left: 3px solid rgba(255,255,255,.18); padding-left: 14px; }
.sidebar-sublink:hover { background: rgba(255,255,255,.18); border-left-color: rgba(255,255,255,.55); }
.sidebar-sublink.active { background: linear-gradient(135deg, rgba(255,255,255,.96) 0%, rgba(204,251,241,.96) 100%); color: #0f766e; font-weight: 800; border-left-color: #5eead4; box-shadow: 0 8px 20px rgba(15,23,42,.18); }
.sidebar-sublink.active i { color: #0f766e; }
.app-sidebar .border-top { border-color: rgba(255,255,255,.18) !important; }
.app-sidebar .text-danger { color: #fee2e2 !important; }
.offcanvas-start { background: var(--sidebar-bg) !important; color: #fff; }
.offcanvas-start .offcanvas-header { border-bottom: 1px solid rgba(255,255,255,.18); }
.offcanvas-start .sidebar-brand { border-bottom: 0; padding: 0; color: #fff; }
.offcanvas-start .border-top { border-color: rgba(255,255,255,.18) !important; }
.offcanvas-start .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .9; }
.app-main { flex: 1; min-width: 0; }
.app-topbar { min-height: 68px; position: sticky; top: 0; z-index: 1010; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid #e5e7eb; backdrop-filter: blur(8px); }
.app-content { padding: 24px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(to bottom, #0d6efd 0 42%, #ffffff 42% 100%); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 28px; box-shadow: 0 18px 45px rgba(15,23,42,.08); }
.auth-card .text-center { text-align: center; }
.auth-card .text-muted { color: #6b7280; }
.auth-card .mb-1 { margin-bottom: .25rem; }
.auth-card .mb-2 { margin-bottom: .5rem; }
.auth-card .mb-3 { margin-bottom: 1rem; }
.auth-card .mb-4 { margin-bottom: 1.5rem; }
.auth-card .mt-2 { margin-top: .5rem; }
.auth-card .mt-3 { margin-top: 1rem; }
.auth-card .h4 { font-size: 1.5rem; line-height: 1.2; }
.auth-card .form-label { display: inline-block; margin-bottom: .5rem; font-weight: 500; }
.auth-card .form-control,
.auth-card .form-select { display: block; width: 100%; min-height: 40px; padding: .45rem .75rem; border: 1px solid #ced4da; border-radius: 6px; background-color: #fff; color: #212529; font: inherit; }
.auth-card .form-control:focus,
.auth-card .form-select:focus { border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 .2rem rgba(13,110,253,.18); }
.auth-card .input-group { display: flex; align-items: stretch; width: 100%; }
.auth-card .input-group > .form-control { width: 1%; }
.auth-card .input-group .form-control { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.auth-card .input-group .btn { flex: 0 0 46px; width: 46px; border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.auth-card .form-check { display: flex; align-items: center; gap: .5rem; min-height: 24px; }
.auth-card .form-check-input { width: 1rem; height: 1rem; margin: 0; }
.auth-card .form-check-label { cursor: pointer; }
.auth-card .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .45rem .75rem; border: 1px solid transparent; border-radius: 6px; text-decoration: none; cursor: pointer; font: inherit; }
.auth-card .btn-primary { background: #0d6efd; border-color: #0d6efd; color: #fff; }
.auth-card .btn-outline-secondary { background: #fff; border-color: #6c757d; color: #6c757d; }
.auth-card .w-100 { width: 100%; }
.page-title { display:flex; justify-content:space-between; gap:16px; align-items:center; margin-bottom:18px; }
.table-wrap { background:#fff; border:1px solid #e5e7eb; border-radius:8px; overflow:auto; }
.table thead th { background:#f1f3f5; color:#374151; border-bottom-color:#d8dee6; }
.stat-card { position: relative; overflow: hidden; background:#fff; border:0; border-radius:8px; padding:18px; height:100%; box-shadow: 0 12px 28px rgba(15,23,42,.08); }
.stat-card:after { content:""; position:absolute; right:-28px; top:-28px; width:92px; height:92px; border-radius:50%; background:rgba(255,255,255,.22); }
.stat-card .text-muted { color: #64748b !important; font-weight: 600; }
.stat-card .h4 { position: relative; color:#0f172a; font-weight: 800; letter-spacing: 0; }
.stat-card i { color: #2563eb; }
.stat-card-1 { background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%); }
.stat-card-2 { background: linear-gradient(135deg, #16a34a 0%, #14b8a6 100%); }
.stat-card-3 { background: linear-gradient(135deg, #f97316 0%, #e11d48 100%); }
.stat-card-4 { background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%); }
.stat-card-1 .text-muted,
.stat-card-2 .text-muted,
.stat-card-3 .text-muted,
.stat-card-4 .text-muted { color: rgba(255,255,255,.84) !important; }
.stat-card-1 .h4,
.stat-card-2 .h4,
.stat-card-3 .h4,
.stat-card-4 .h4 { color:#fff; }
.stat-card-1 i,
.stat-card-2 i,
.stat-card-3 i,
.stat-card-4 i { color: rgba(255,255,255,.94); }
.form-section { background:#fff; border:1px solid #e5e7eb; border-radius:8px; padding:20px; }
.required:after { content:" *"; color:#dc3545; }
.badge-soft { background:#eef2ff; color:#3730a3; }
.app-footer { margin-top: 28px; padding: 16px 0 4px; color:#6b7280; font-size:.88rem; text-align:center; }
.chart-box { position: relative; min-height: 280px; }
.dashboard-page { display: block !important; visibility: visible !important; opacity: 1 !important; min-height: 300px; }
.dashboard-chart-fallback { display: block; }
.chart-box canvas[data-chart-ready="1"] + .dashboard-chart-fallback { display: none; }
@media (max-width: 991px) {
  .app-shell { display: block; }
  body { background: #eef4ff; }
  .app-topbar { min-height: 62px; padding: 0 14px; background: linear-gradient(135deg, #0f4cfd 0%, #0ea5e9 56%, #14b8a6 100%); color: #fff; border-bottom: 0; box-shadow: 0 10px 24px rgba(15,23,42,.18); }
  .app-topbar .text-muted { color: rgba(255,255,255,.78) !important; }
  .app-topbar .dropdown-toggle { width: 40px; height: 40px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.22); font-size: 0; }
  .app-topbar .dropdown-toggle i { font-size: 1.18rem; }
  .app-topbar .dropdown-toggle:after { display: none; }
  .mobile-sidebar-button { display: none !important; }
  .mobile-top-brand { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.95); box-shadow: 0 8px 18px rgba(15,23,42,.18); }
  .mobile-top-brand img { width: 29px; height: 29px; object-fit: contain; }
  .topbar-title { min-width: 0; }
  .topbar-title .fw-semibold { max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-content { padding: 16px 14px 92px; }
  .page-title { align-items: flex-start; flex-direction: column; }
  .table { min-width: 760px; }
  .btn-group { display: inline-flex; flex-wrap: nowrap; }
  .modal-dialog { margin: 8px; }
  .auth-card { padding: 22px; }
  .stat-card .h4 { font-size: 1.1rem; }
  .dashboard-page .row.g-3.mb-4,
  .dashboard-page > .row.g-3.mb-4 { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; margin-left: 0 !important; margin-right: 0 !important; }
  .dashboard-page .row.g-3.mb-4 > [class*="col-"],
  .dashboard-page > .row.g-3.mb-4 > [class*="col-"] { width: auto !important; max-width: none !important; flex: none !important; padding: 0 !important; }
  .dashboard-page .stat-card { min-height: 108px; padding: 13px; border-radius: 18px; box-shadow: 0 10px 24px rgba(15,23,42,.10); }
  .dashboard-page .stat-card:after { right: -36px; top: -36px; width: 88px; height: 88px; }
  .dashboard-page .stat-card .text-muted { display: flex; align-items: center; gap: 6px; min-height: 34px; font-size: .74rem; line-height: 1.15; }
  .dashboard-page .stat-card .text-muted i { flex: 0 0 auto; font-size: .95rem; }
  .dashboard-page .stat-card .h4 { margin-top: 8px !important; font-size: 1rem; line-height: 1.18; word-break: break-word; }
  .dashboard-page .chart-box { min-height: 220px; }
  .dashboard-chart-fallback .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px !important; }
  .dashboard-chart-fallback .row > [class*="col-"] { width: auto; max-width: none; padding: 0; }
  .app-footer { padding-bottom: 18px; }
  .mobile-bottom-nav { position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 1040; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; min-height: 64px; padding: 8px; border-radius: 22px; background: rgba(255,255,255,.94); border: 1px solid rgba(148,163,184,.28); box-shadow: 0 18px 38px rgba(15,23,42,.22); backdrop-filter: blur(14px); }
  .mobile-bottom-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; border-radius: 16px; color: #64748b; text-decoration: none; font-size: .68rem; font-weight: 700; line-height: 1.05; }
  .mobile-bottom-nav a i { font-size: 1.25rem; line-height: 1; }
  .mobile-bottom-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bottom-nav a.active { color: #fff; background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%); box-shadow: 0 10px 22px rgba(37,99,235,.28); }
  .mobile-bottom-nav .mobile-menu-badge { position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; font-size: .65rem; border: 2px solid #fff; }
  .mobile-menu-page { display: grid; gap: 16px; }
  .mobile-menu-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 14px; box-shadow: 0 10px 24px rgba(15,23,42,.06); }
  .mobile-menu-section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: #0f172a; font-weight: 800; }
  .mobile-menu-section-title i { color: #2563eb; }
  .mobile-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .mobile-menu-card { position: relative; min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; border: 1px solid #e5e7eb; border-radius: 18px; background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%); color: #334155; text-align: center; text-decoration: none; font-weight: 700; font-size: .78rem; line-height: 1.15; }
  .mobile-menu-card:active { transform: scale(.98); }
  .mobile-menu-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(135deg, #dbeafe 0%, #cffafe 100%); color: #2563eb; font-size: 1.25rem; }
  .mobile-menu-icon.danger { background: #fee2e2; color: #dc2626; }
  .mobile-menu-card .mobile-menu-badge { position: absolute; top: 8px; right: 8px; }
  a[href*="/students/import"],
  a[href*="/teachers/import"],
  a[href*="/templates/"],
  a[href$="/backup"],
  a[href*="/backup/"],
  a[href$="/migrations"],
  [data-bulk-delete] { display: none !important; }
}
@media (max-width: 380px) {
  .dashboard-page .row.g-3.mb-4,
  .dashboard-page > .row.g-3.mb-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .dashboard-page .stat-card { min-height: 100px; padding: 11px; border-radius: 16px; }
  .dashboard-page .stat-card .text-muted { font-size: .68rem; }
  .dashboard-page .stat-card .h4 { font-size: .9rem; }
}
