/* ─────────────────────────────────────────
   Kirihat's Eduprint — Admin Panel Styles
   ───────────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --brand:       #0d7a5f;
  --brand-dark:  #095c47;
  --brand-light: #e6f4f0;
  --accent:      #10b981;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --info:        #3b82f6;

  --bg:          #f0f4f3;
  --surface:     #ffffff;
  --surface2:    #f8faf9;
  --border:      #e2e8e6;
  --text:        #111827;
  --muted:       #6b7280;
  --sidebar-w:   240px;
  --radius:      12px;
  --shadow:      0 2px 12px rgba(0,0,0,.07);
}

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

html, body {
  height: 100%;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0b6b52 0%, #083d2f 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 3px 0 16px rgba(0,0,0,.15);
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand h2 {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}
.sidebar-brand span {
  display: block;
  color: rgba(255,255,255,.55);
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-nav li a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.sidebar-nav li a.active {
  background: rgba(255,255,255,.13);
  color: #fff;
  border-left-color: #10b981;
}
.sidebar-nav li a .nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  letter-spacing: .04em;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.13);
  flex-shrink: 0;
}

/* ── Sidebar group label ── */
.sidebar-group-label {
  padding: 14px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.38);
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 6px;
  list-style: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 14, 11, 0.48);
  backdrop-filter: blur(1px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-footer button {
  width: 100%;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 9px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.sidebar-footer button:hover { background: rgba(255,255,255,.2); }

/* ── Main content ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 1px; }

.sidebar-toggle {
  display: none;
  width: 38px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-direction: column;
}
.sidebar-toggle span {
  display: block;
  width: 15px;
  height: 1.8px;
  border-radius: 2px;
  background: #2f3b37;
}

.page-content { padding: 28px; flex: 1; }

.student-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.student-photo-layout {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  align-items: start;
}

.student-id-card-layout {
  grid-template-columns: 220px 1fr;
}

.student-photo-shell {
  width: 130px;
  height: 130px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.student-photo-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.id-card-shell {
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 85.6 / 53.98;
}

.id-card-shell img {
  object-fit: contain;
  background: #fff;
}

.student-photo-placeholder {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }

/* ── Stat tiles ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .stat-icon {
  font-size: 26px;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  margin-bottom: 6px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { color: var(--muted); font-size: 12.5px; }
.stat-card.green { border-left-color: #14b86f; }
.stat-card.blue  { border-left-color: #4f8cf7; }
.stat-card.amber { border-left-color: #f2a81f; }
.stat-card.red   { border-left-color: #ef5858; }
.stat-card.green .stat-icon { background: #d1fae5; }
.stat-card.blue  .stat-icon { background: #dbeafe; }
.stat-card.amber .stat-icon { background: #fef3c7; }
.stat-card.red   .stat-icon { background: #fee2e2; }

/* ── Buttons ── */
button, .btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 8px;
  padding: 9px 16px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, background .15s;
  text-decoration: none;
  white-space: nowrap;
}
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary, button.primary { background: var(--brand); color: #fff; }
.btn-primary:hover, button.primary:hover { background: var(--brand-dark); }

.btn-secondary, button.secondary { background: #374151; color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-outline  { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-outline:hover { background: var(--brand-light); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ── Forms ── */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 9px 12px;
  font-size: 13.5px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13,122,95,.12);
}
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 11px 14px;
  background: var(--surface2); font-size: 11.5px;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s, box-shadow .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f2fbf7; }
tbody tr:focus-within {
  background: #f2fbf7;
  box-shadow: inset 0 0 0 1.5px rgba(13,122,95,.24);
}
tbody td { padding: 11px 14px; vertical-align: middle; }
tbody td a { color: var(--brand); font-weight: 600; text-decoration: none; }
tbody td a:hover { text-decoration: underline; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 3px 9px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
  border: 1px solid transparent;
}
.badge-green  { background: #d1fae5; color: #065f46; border-color: #9ee4bf; }
.badge-red    { background: #fee2e2; color: #991b1b; border-color: #f9b6b6; }
.badge-amber  { background: #fef3c7; color: #92400e; border-color: #f7d88d; }
.badge-blue   { background: #dbeafe; color: #1e40af; border-color: #aacdff; }
.badge-gray   { background: #f3f4f6; color: #374151; border-color: #d7dce4; }

/* ── Search & filter bar ── */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: flex-end; margin-bottom: 16px;
}
.filter-bar input, .filter-bar select {
  width: auto; min-width: 160px;
}

/* ── Modal ── */
.school-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.school-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.school-card-skeleton {
  pointer-events: none;
}

.school-card-main {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(160deg, #ffffff 0%, #f8fcfa 100%);
}

.school-card-main:hover {
  background: linear-gradient(160deg, #f7fcfa 0%, #ecf7f2 100%);
}

.school-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.school-card-title-row h4 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.school-code-pill {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid #cce5db;
  background: #eef8f4;
  color: #0f5e49;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  line-height: 1.2;
}

.school-card-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.school-card-badges,
.school-card-classes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.school-card-actions {
  padding: 10px 14px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.school-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.school-mini-card {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.school-mini-card:hover {
  border-color: #b6ddd0;
  background: #f6fcf9;
}

.school-mini-card.active {
  border-color: #1a9f78;
  box-shadow: 0 0 0 2px rgba(26,159,120,.15);
  background: #ecf9f4;
}

.school-mini-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f3d31;
}

.school-mini-sub {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.school-mini-card-skeleton {
  pointer-events: none;
}

.class-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.class-chip-option {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.class-chip-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.class-chip-option span,
.class-chip-btn {
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.class-chip-option:hover span,
.class-chip-btn:hover {
  border-color: #cbd5e1;
  color: var(--text, #1e293b);
  background: var(--surface-2, #f8fafc);
}

.class-chip-option input:checked + span,
.class-chip-btn.active {
  border-color: #1A237E;
  background: #EEF0FB;
  color: #1A237E;
}

.class-chip-btn {
  cursor: pointer;
}

.detail-tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.detail-tab-btn {
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  color: var(--text-muted, #64748b);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.detail-tab-btn:hover {
  border-color: #cbd5e1;
  color: var(--text, #1e293b);
  background: var(--surface-2, #f8fafc);
}

.detail-tab-btn.active {
  border-color: #1A237E;
  background: #EEF0FB;
  color: #1A237E;
  font-weight: 600;
}

.detail-tab-panel {
  display: none;
}

.detail-tab-panel.active {
  display: block;
  animation: tabFadeIn 0.25s ease-out;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.school-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.student-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-mini-avatar-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid #cfe0d9;
  background: #f1f8f5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.student-mini-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f1f8f5;
  z-index: 1;
}

.student-mini-avatar-fallback {
  position: relative;
  color: #145e49;
  font-size: 12px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-backdrop.open,
.modal-backdrop:not([hidden]) { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  transform: translateY(20px);
  transition: transform .2s;
}
.modal-backdrop.open .modal,
.modal-backdrop:not([hidden]) .modal { transform: translateY(0); }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Activity feed ── */
.activity-list { list-style: none; }
.activity-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: none; }
.activity-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.activity-dot.entry { background: #d1fae5; }
.activity-dot.exit  { background: #fef3c7; }
.activity-info { flex: 1; }
.activity-name { font-weight: 600; font-size: 13.5px; }
.activity-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.activity-time { color: var(--muted); font-size: 12px; }

.activity-skeleton-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-skeleton-item:last-child { border-bottom: none; }

.skeleton {
  position: relative;
  overflow: hidden;
  background: #e5ece9;
  border-radius: 8px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.72) 45%, transparent 100%);
  animation: skeleton-shimmer 1.1s ease-in-out infinite;
}
.skeleton-text {
  display: block;
  width: 100%;
  height: 12px;
}
.skeleton-row td {
  padding-top: 12px;
  padding-bottom: 12px;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }

/* ── Empty state ── */
.empty-state {
  padding: 42px 28px;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 42px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
.empty-illustration {
  width: 74px;
  height: 54px;
  border-radius: 14px;
  margin: 0 auto 12px;
  position: relative;
  background:
    radial-gradient(circle at 22% 30%, #d7ebe3 4px, transparent 5px),
    radial-gradient(circle at 74% 66%, #d7ebe3 4px, transparent 5px),
    linear-gradient(135deg, #e7f2ee, #d6e8e2);
  border: 1px solid #cce1d9;
}
.empty-illustration::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #99b8ad;
  transform: translate(-50%, -50%);
}

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px;
}
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-info    { background: #dbeafe; color: #1e40af; }
.alert[hidden] { display: none; }

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #23332d;
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
  font-size: 13px;
  line-height: 1.35;
  animation: toast-in .24s ease forwards;
}
.toast-success { background: #065f46; }
.toast-error { background: #991b1b; }
.toast-info { background: #1e40af; }
.toast-hide { animation: toast-out .22s ease forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0b6b52 0%, #083d2f 60%, #042b20 100%);
}
.login-box {
  background: #fff; border-radius: 18px;
  padding: 38px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
}
.login-box .brand { text-align: center; margin-bottom: 28px; }
.login-box .brand h1 { color: var(--brand); font-size: 22px; font-weight: 800; }
.login-box .brand p { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ── Spinner ── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc helpers ── */
.row    { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.mt-2   { margin-top: 8px; }
.mt-4   { margin-top: 16px; }
.mb-4   { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.fw-600     { font-weight: 600; }
.w-full     { width: 100%; }
.gap-2      { gap: 8px; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ── Session Cards ── */
.session-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.session-card {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px 18px 14px;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background .18s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  width: 100%;
}

.session-card:hover {
  border-color: #a8d9c6;
  background: #f6fcf9;
  box-shadow: 0 4px 20px rgba(13,122,95,.12);
}

.session-card.active {
  border-color: var(--brand);
  background: #eaf7f2;
  box-shadow: 0 0 0 3px rgba(13,122,95,.14);
}

.session-card-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f3d31;
  letter-spacing: -.01em;
}

.session-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.session-card-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.session-card-count {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
}

.session-card-count-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Class breakdown panel (inside session) ── */
.session-class-panel {
  border: 1.5px solid #cce8dc;
  border-radius: 14px;
  background: #f5fcf9;
  padding: 18px 20px;
  margin-top: 16px;
  animation: panel-in .18s ease;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.session-class-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: #0d5940;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Promotion Class Map Builder ── */
.class-map-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.class-map-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.class-map-arrow {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  user-select: none;
}
.class-map-label {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}
.class-map-select {
  width: 100%;
}

/* ── Promotion Preview Table ── */
.promotion-preview-wrap {
  border: 1.5px solid #cce8dc;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 0;
}
.promotion-preview-wrap table thead th {
  background: #e8f7f1;
}
.promotion-preview-row-move td { background: #f0faf5; }
.promotion-preview-row-same td { background: #fafafa; color: var(--muted); }
.promotion-class-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.promotion-class-from { color: #374151; }
.promotion-class-to   { color: var(--brand); }

/* ── Step indicator (School → Session → Class) ── */
.drill-down-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.drill-down-step .step-active {
  font-weight: 700;
  color: var(--brand);
}
.drill-down-step .step-sep {
  color: #d1d5db;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }

  .main { margin-left: 0; }
  .topbar {
    padding: 12px 14px;
    gap: 10px;
  }
  .topbar > :first-child {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .topbar > :first-child > div {
    min-width: 0;
  }
  .page-content { padding: 16px; }
  .sidebar-toggle { display: inline-flex; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
  }
  .filter-bar input, .filter-bar select { width: 100%; min-width: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .student-detail-grid { grid-template-columns: 1fr; }
  .student-photo-layout { grid-template-columns: 1fr; }
  .student-photo-shell { width: 120px; height: 120px; }
  .student-id-card-layout { grid-template-columns: 1fr; }
  .id-card-shell {
    width: 100%;
    max-width: 240px;
    height: auto;
    aspect-ratio: 85.6 / 53.98;
  }
  .school-grid, .school-mini-grid { grid-template-columns: 1fr; }
  .school-overview-grid { grid-template-columns: 1fr; }
  .detail-tab-nav { gap: 6px; }
  .detail-tab-btn { flex: 1; justify-content: center; }
}

/* ── Page enter animation ─────────────────────────────── */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-content {
  animation: pageEnter 180ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ── Skeleton cell size helpers ───────────────────────── */
.skeleton-cell {
  display: inline-block;
  height: 13px;
  border-radius: 4px;
}
.skeleton-cell.sm   { width: 48px;  }
.skeleton-cell.md   { width: 120px; }
.skeleton-cell.lg   { width: 180px; }
.skeleton-cell.xl   { width: 240px; }
.skeleton-cell.full { width: 90%;   }

/* ── Topbar skeleton ──────────────────────────────────── */
.topbar-skeleton h1 {
  display: inline-block;
  width: 200px;
  height: 24px;
  border-radius: 6px;
}
.topbar-skeleton .sub {
  display: inline-block;
  width: 140px;
  height: 14px;
  border-radius: 4px;
  margin-top: 4px;
}

/* ── Card appear animation ────────────────────────────── */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  animation: cardEnter 200ms ease both;
}

.card:nth-child(1) { animation-delay: 0ms;   }
.card:nth-child(2) { animation-delay: 40ms;  }
.card:nth-child(3) { animation-delay: 80ms;  }
.card:nth-child(4) { animation-delay: 120ms; }

/* ── Table row hover ──────────────────────────────────── */
table tbody tr {
  transition: background 120ms ease;
}

/* ── Button active micro-interaction ─────────────────── */
a.btn:active, a.btn-ghost:active, a.btn-primary:active {
  opacity: 0.85;
  transform: scale(0.98);
}

/* Students premium workspace */
.students-page-content { padding-bottom: 28px; }
.students-topbar { gap: 16px; }
.students-topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.students-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(520px, 1fr) minmax(340px, 420px);
  gap: 14px;
  align-items: start;
}
.students-context-panel {
  grid-column: 1;
}
.students-list-panel {
  grid-column: 2;
}
.student-detail-panel {
  grid-column: 3;
}
.students-context-panel,
.students-list-panel,
.student-detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  min-width: 0;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.students-context-panel:hover,
.students-list-panel:hover,
.student-detail-panel:hover {
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 16px -6px rgba(15, 23, 42, 0.04);
  border-color: #cbd5e1;
}
.students-context-panel,
.student-detail-panel {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow-x: hidden;
  overflow-y: auto;
}
.students-panel-head,
.students-list-toolbar,
.detail-panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.students-panel-head h3,
.students-list-toolbar h3 { font-size: 15px; line-height: 1.25; }
.students-panel-head p,
.students-context-bar {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.filter-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.filter-block:last-child { border-bottom: 0; }
.filter-block label,
.filter-label-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
.filter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.school-picker-list {
  margin-top: 8px;
  display: grid;
  gap: 6px;
  max-height: 330px;
  overflow-x: hidden;
  overflow-y: auto;
}
.school-picker-item {
  width: 100%;
  min-height: 52px;
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text);
  box-sizing: border-box;
  transition: all 0.2s ease;
}
.school-picker-item:hover {
  border-color: #cbd5e1;
  background: var(--surface-2, #f8fafc);
}
.school-picker-item.active {
  border-color: #1A237E;
  background: #EEF0FB;
  box-shadow: 0 0 0 2px rgba(26, 35, 126, 0.12);
}
.school-picker-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
}
.school-picker-sub {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}
.session-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.session-mini {
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
}
.session-mini.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}
.class-chip-grid.compact {
  grid-template-columns: 1fr;
  gap: 6px;
}
.students-list-toolbar { flex-wrap: wrap; }
.students-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.students-toolbar-actions input { min-width: 190px; }
.ready-pill {
  background: #ecfdf5;
  color: #047857;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
}
.bulk-action-bar {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.bulk-action-bar[hidden] { display: none; }
.students-table-wrap {
  max-height: calc(100vh - 235px);
  overflow: auto;
}
.students-table-wrap tbody tr { cursor: pointer; }
.students-table-wrap tbody tr.selected { background: #eef6ff; }
.load-more-wrap {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.load-more-wrap[hidden] { display: none; }
.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }
.student-detail-panel { min-height: 420px; }
.student-detail-empty {
  padding: 34px 22px;
  color: var(--muted);
}
.student-detail-empty h3 {
  color: var(--text);
  margin-bottom: 4px;
}
.student-detail-content { min-width: 0; }
.student-detail-content[hidden] { display: none; }
.student-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.student-identity h2 {
  font-size: 17px;
  line-height: 1.25;
  word-break: break-word;
}
.student-identity p {
  color: var(--muted);
  font-size: 12px;
}
.student-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: #e0f2fe;
  color: #0369a1;
  background-size: cover;
  background-position: center;
  font-weight: 800;
}
.student-avatar-lg.has-image { color: transparent; }
.detail-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.detail-nav-actions {
  display: flex;
  gap: 6px;
}
.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
}
.icon-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.detail-tab-nav.compact {
  padding: 8px 10px 0;
  overflow-x: auto;
}
.detail-tab-nav.compact .detail-tab-btn {
  padding: 8px 10px;
  font-size: 12px;
}
.student-detail-panel .detail-tab-panel {
  padding: 14px 16px 18px;
}
.detail-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.detail-kv {
  border: 1px solid var(--border);
  background: var(--surface-2, #f8fafc);
  border-radius: 8px;
  padding: 8px 9px;
  min-width: 0;
  transition: all 0.2s ease;
}
.detail-kv:hover {
  border-color: #1A237E;
  background: #EEF0FB;
}
.detail-kv span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}
.detail-kv strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}
.detail-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.detail-edit-form .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-edit-form .form-row .form-group:only-child { grid-column: span 2; }
.locked-school-note {
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  margin-bottom: 12px;
}
.media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.media-preview-box {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.media-preview-box .student-photo-shell {
  width: 120px;
  height: 120px;
}
.media-preview-box .id-card-shell {
  width: 120px;
  height: 80px;
}
.media-upload-control {
  display: grid;
  gap: 7px;
}
.media-upload-control label {
  font-size: 12px;
  font-weight: 700;
}
.mini-table-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  margin-bottom: 12px;
}
.mini-table-title {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}
.mini-table-block table td {
  font-size: 12px;
  padding: 7px 9px;
}
.fw-600 { font-weight: 600; }

@media (max-width: 1320px) {
  .students-workspace {
    grid-template-columns: minmax(230px, 280px) minmax(480px, 1fr);
  }
  .students-context-panel {
    grid-column: 1;
    grid-row: 1;
  }
  .student-detail-panel {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 78px;
    max-height: calc(100vh - 96px);
    overflow: auto;
  }
  .students-list-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 900px) {
  .students-workspace { grid-template-columns: 1fr; }
  .students-context-panel,
  .student-detail-panel,
  .students-list-panel {
    grid-column: auto;
    grid-row: auto;
    position: static;
    max-height: none;
  }
  .students-table-wrap { max-height: none; }
  .students-list-toolbar,
  .students-toolbar-actions {
    align-items: stretch;
    justify-content: flex-start;
  }
  .students-toolbar-actions input { width: 100%; }
  .detail-kv-grid,
  .detail-edit-form .form-row,
  .media-preview-box { grid-template-columns: 1fr; }
}

/* Minimal premium scrollbars for the student workspace panels */
.students-workspace ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.students-workspace ::-webkit-scrollbar-track {
  background: transparent;
}
.students-workspace ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
.students-workspace ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
