/* ============================================================
   RMS DESIGN SYSTEM — Professional School Management Platform
   ============================================================ */

/* Poppins is loaded globally via <link> in index.html. */

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

:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a5f;

  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;

  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --sidebar-w: 260px;
  --header-h: 64px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.06);
  --transition: 150ms cubic-bezier(.4,0,.2,1);
  --font-sans: 'Poppins', sans-serif;
}

html {
  font-family: var(--font-sans);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

body {
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

#app,
#app-layout,
.app-layout,
.main-wrapper,
.main-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  flex-direction: column;
}

#app-layout {
  flex-direction: row;
}

.main-wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.no-scroll {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.no-scroll .main-content {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font-family: var(--font-sans);
  max-width: 100%;
}

img,
svg,
video,
canvas,
object,
iframe {
  display: block;
  max-width: 100%;
  height: auto;
}

a,
button,
input,
select,
textarea,
label,
span,
p,
li,
td,
th {
  min-width: 0;
}

img,
svg, 
canvas,
video,
object,
iframe {
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ============================================================
   LOADING
   ============================================================ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
  background: var(--gray-50);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  position: relative;
  background:
    linear-gradient(160deg, rgba(5, 10, 24, 0.78) 0%, rgba(10, 26, 60, 0.72) 50%, rgba(13, 47, 107, 0.75) 100%),
    url('../public/school1.jpeg') center/cover no-repeat;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: rgba(255,255,255,.03);
}
.login-page::after {
  content: '';
  position: absolute;
  bottom: -35%;
  left: -12%;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: rgba(255,255,255,.02);
}
.login-shell {
  position: relative;
  z-index: 1;
  margin: auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  max-width: 1000px;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 48px 44px;
  color: #fff;
  background: linear-gradient(200deg, rgba(5,10,24,.35) 0%, rgba(10,26,60,.15) 100%);
}
.login-brand-top { text-align: center; }
.login-brand-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d4af37;
  background: linear-gradient(135deg, rgba(212,175,55,.18), rgba(212,175,55,.05));
  border: 1px solid rgba(212,175,55,.35);
  overflow: hidden;
  box-shadow: 0 14px 34px -12px rgba(212,175,55,.35);
}
.login-brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.login-brand-logo i { font-size: 32px; }
.login-brand-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255,255,255,.55);
}
.login-brand-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.login-brand-subtitle {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #d4af37;
}
.login-brand-tagline {
  margin-top: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,.72);
  max-width: 420px;
}
.login-brand-motto {
  margin-top: 14px;
  font-style: italic;
  font-weight: 600;
  font-size: 15px;
  color: #d4af37;
}
.login-features {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255,255,255,.85);
}
.login-feature i {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d4af37;
  background: rgba(212,175,55,.14);
  border: 1px solid rgba(212,175,55,.28);
}
.login-contact { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.login-contact p { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.7); }
.login-contact p i { width: 16px; flex-shrink: 0; color: rgba(212,175,55,.85); }
.login-school-info {
  margin-top: 20px;
  background: linear-gradient(135deg, var(--blue-50) 0%, #fff 70%);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 24px -12px rgba(13,47,107,.18);
}
.login-school-info h4 {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--blue-800);
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-school-info h4::after { content: ""; flex: 1; height: 1px; background: var(--gray-200); }
.login-school-info h4 svg { width: 15px; height: 15px; color: #b8912a; }
.login-school-info .lsi-row {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}
.login-school-info .lsi-ic {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-700);
  background: #fff;
  border: 1px solid var(--gray-200);
  box-shadow: 0 2px 8px -3px rgba(13,47,107,.18);
}
.login-school-info .lsi-ic svg { width: 16px; height: 16px; }

.login-auth {
  background: #fff;
  padding: 44px 44px 28px;
  display: flex;
  flex-direction: column;
}
.login-card {
  background: transparent;
  box-shadow: none;
  padding: 0;
  flex: 1;
}
.login-card-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #0d2f6b);
  box-shadow: 0 12px 26px -10px rgba(29,78,216,.55);
}
.login-card-icon i { font-size: 24px; }
.login-card-title {
  font-size: 22px;
  font-weight: 700;
  color: #0a1a3c;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.login-card-sub {
  margin-top: 6px;
  margin-bottom: 26px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--gray-500);
}
.login-options {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 4px;
}
.forgot-link {
  border: none;
  background: transparent;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-600);
  cursor: pointer;
  transition: color var(--transition);
}
.forgot-link:hover { color: var(--blue-800); text-decoration: underline; }
.forgot-link:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; border-radius: 4px; }
.input-wrap { position: relative; }
.input-wrap .input-field { padding-right: 46px; }
.login-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.login-eye:hover { color: var(--blue-600); }
.login-eye:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }
.login-eye i { width: 18px; height: 18px; }
.login-submit {
  padding: 13px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px;
  margin-top: 10px;
}
.login-portal-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0;
  padding: 14px;
  border: 1px solid var(--blue-100);
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fbff, #eff6ff);
  color: var(--blue-800);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.login-portal-toggle:hover { border-color: var(--blue-300); box-shadow: 0 8px 20px rgba(29,78,216,.1); transform: translateY(-1px); }
.login-portal-toggle:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.login-portal-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: #dbeafe;
  color: var(--blue-700);
}
.login-portal-icon svg { width: 21px; height: 21px; }
.login-portal-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.login-portal-copy strong { font-size: 13px; font-weight: 700; }
.login-portal-copy small { color: var(--gray-500); font-size: 11px; font-weight: 400; line-height: 1.4; }
.login-portal-arrow { width: 17px; height: 17px; color: var(--blue-500); }
html.parent-marks-document {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
body[data-page="parent-marks"] {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}
.parent-marks-page { min-height: 100vh; padding: clamp(20px, 4vw, 48px) 20px; background: #f1f5f9; }
.parent-marks-page-header { display: flex; max-width: 1200px; align-items: center; gap: 12px; margin: 0 auto 24px; color: #0a1a3c; }
.parent-marks-page-header img { width: 42px; height: 42px; object-fit: contain; }
.parent-marks-page-header div { display: flex; flex-direction: column; gap: 2px; }
.parent-marks-page-header strong { font-size: 15px; }
.parent-marks-page-header span { color: var(--gray-500); font-size: 11px; }
.parent-marks-view { width: 100%; max-width: 1200px; margin: 0 auto; color: var(--gray-800); }
.pmp-heading { position: relative; margin: 0 auto 22px; text-align: center; }
.pmp-back-link { position: absolute; top: 0; left: 0; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: 0; background: transparent; color: var(--blue-600); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.pmp-back-link svg { width: 16px; height: 16px; }
.pmp-brand-mark { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; margin: 10px 0 8px; border-radius: 15px; background: #eff6ff; color: var(--blue-700); }
.pmp-brand-mark svg { width: 25px; height: 25px; }
.pmp-heading h2 { margin: 0; color: #0a1a3c; font-size: 23px; font-weight: 700; }
.pmp-heading p { max-width: 480px; margin: 7px auto 0; color: var(--gray-500); font-size: 13px; line-height: 1.55; }
.pmp-search-card { max-width: 700px; margin: 0 auto; padding: 22px; border: 1px solid var(--gray-200); border-radius: 14px; background: #fff; box-shadow: 0 8px 30px rgba(15,23,42,.06); }
.pmp-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.pmp-search-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; margin-top: 12px; }
.pmp-search-button svg { width: 18px; height: 18px; }
.pmp-privacy-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 16px 0 0; color: var(--gray-500); font-size: 11px; }
.pmp-privacy-note svg { width: 15px; height: 15px; color: var(--green-600); }
.pmp-inline-error { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--red-100); border-radius: 8px; background: var(--red-50); color: var(--red-600); font-size: 12px; line-height: 1.5; }
.pmp-message { display: flex; max-width: 600px; align-items: center; gap: 11px; margin: 24px auto; padding: 14px 16px; border: 1px solid var(--blue-100); border-radius: 10px; background: var(--blue-50); color: var(--blue-800); font-size: 13px; line-height: 1.5; }
.pmp-message > svg { width: 18px; height: 18px; flex: 0 0 18px; }
.pmp-message.is-error { border-color: var(--red-100); background: var(--red-50); color: var(--red-600); }
.pmp-message .spinner { width: 18px; height: 18px; flex: 0 0 18px; border-width: 2px; }
.pmp-retry { display: block; margin: 0 auto; }
.pmp-results-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 17px; }
.pmp-eyebrow { margin: 0 0 3px; color: var(--blue-700); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.pmp-results-head h2 { margin: 0; color: #0a1a3c; font-size: 23px; font-weight: 700; }
.pmp-period { margin: 4px 0 0; color: var(--gray-500); font-size: 12px; }
.pmp-another { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.pmp-another svg { width: 17px; height: 17px; }
.pmp-student-card { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--blue-100); border-radius: 14px; background: linear-gradient(120deg, #f8fbff, #eff6ff); }
.pmp-student-icon { display: flex; width: 48px; height: 48px; flex: 0 0 48px; align-items: center; justify-content: center; border-radius: 50%; background: #dbeafe; color: var(--blue-700); }
.pmp-student-icon svg { width: 24px; height: 24px; }
.pmp-student-details { min-width: 0; flex: 1; }
.pmp-student-details h3 { margin: 0; color: #0a1a3c; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.pmp-student-details p { margin: 4px 0 0; color: var(--gray-500); font-size: 12px; }
.pmp-position { display: flex; flex-direction: column; gap: 3px; padding-left: 16px; border-left: 1px solid var(--blue-100); text-align: right; }
.pmp-position span { color: var(--gray-500); font-size: 11px; }
.pmp-position strong { color: var(--blue-800); font-size: 18px; }
.pmp-tabs { display: flex; gap: 5px; margin: 17px 0; padding: 5px; overflow-x: auto; border: 1px solid var(--gray-200); border-radius: 11px; background: #fff; }
.pmp-tab { display: inline-flex; min-height: 40px; flex: 1 0 auto; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--gray-500); font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.pmp-tab svg { width: 16px; height: 16px; }
.pmp-tab.is-active { background: var(--blue-50); color: var(--blue-700); }
.pmp-tab-content { min-width: 0; }
.pmp-stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.pmp-stat { display: grid; min-height: 104px; grid-template-columns: 34px 1fr; grid-template-rows: auto 1fr; align-items: center; gap: 5px 9px; padding: 13px; border: 1px solid var(--gray-200); border-radius: 11px; background: #fff; }
.pmp-stat-icon { display: flex; width: 34px; height: 34px; grid-row: 1 / span 2; align-items: center; justify-content: center; border-radius: 9px; background: var(--blue-50); color: var(--blue-700); }
.pmp-stat-icon svg { width: 17px; height: 17px; }
.pmp-stat-label { color: var(--gray-500); font-size: 10px; }
.pmp-stat strong { align-self: start; color: #0a1a3c; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.pmp-section { margin: 0 0 18px; padding: 18px; border: 1px solid var(--gray-200); border-radius: 12px; background: #fff; }
.pmp-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.pmp-section-heading h3 { margin: 0; color: #0a1a3c; font-size: 15px; font-weight: 700; }
.pmp-section-heading p { margin: 4px 0 0; color: var(--gray-500); font-size: 11px; line-height: 1.45; }
.pmp-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--gray-200); border-radius: 8px; }
.pmp-table { width: 100%; border-collapse: collapse; font-size: 11px; text-align: left; }
.pmp-table th { padding: 10px 9px; background: #f8fafc; color: var(--gray-600); font-size: 10px; font-weight: 700; white-space: nowrap; }
.pmp-table td { padding: 9px; border-top: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.pmp-table tbody tr:hover { background: #f8fbff; }
.pmp-status { display: inline-block; padding: 3px 7px; border-radius: 999px; background: var(--gray-100); color: var(--gray-600); font-size: 9px; font-weight: 700; white-space: nowrap; }
.pmp-status.pass { background: var(--green-50); color: var(--green-700); }
.pmp-status.fail { background: var(--red-50); color: var(--red-600); }
.pmp-status.missing, .pmp-status.incomplete { background: var(--amber-50); color: var(--amber-600); }
.pmp-empty { display: flex; min-height: 100px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 20px; color: var(--gray-500); text-align: center; }
.pmp-empty svg { width: 23px; height: 23px; opacity: .6; }
.pmp-empty p { margin: 0; font-size: 12px; }
.pmp-filters { display: flex; flex-wrap: wrap; gap: 9px; margin: 0 0 12px; }
.pmp-filters label { display: flex; align-items: center; gap: 6px; color: var(--gray-600); font-size: 11px; font-weight: 600; }
.pmp-filters select { max-width: 180px; min-height: 34px; padding: 5px 26px 5px 8px; border: 1px solid var(--gray-200); border-radius: 7px; background: #fff; color: var(--gray-700); font: inherit; font-size: 11px; }
.pmp-subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.pmp-subject-card { align-self: start; overflow: hidden; border: 1px solid var(--gray-200); border-radius: 10px; background: #fff; }
.pmp-subject-card summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; list-style: none; cursor: pointer; }
.pmp-subject-card summary::-webkit-details-marker { display: none; }
.pmp-subject-card summary > span:first-child { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.pmp-subject-card summary strong { color: #0a1a3c; font-size: 13px; }
.pmp-subject-card summary small { color: var(--gray-500); font-size: 10px; }
.pmp-subject-score { color: var(--blue-700); font-size: 17px; font-weight: 700; text-align: right; }
.pmp-subject-score small { display: block; color: var(--gray-500); font-size: 10px; }
.pmp-subject-body { padding: 0 13px 13px; }
.pmp-subject-body > p { margin: 0 0 10px; color: var(--gray-600); font-size: 11px; }
.pmp-remark { margin-top: 10px !important; color: var(--gray-500) !important; }
.pmp-mobile-assessments { display: none; }
.pmp-report-actions { display: flex; gap: 8px; }
.pmp-report-actions button { display: inline-flex; align-items: center; gap: 6px; }
.pmp-report-actions svg { width: 16px; height: 16px; }
.pmp-report-preview { width: 100%; min-width: 0; max-height: none; overflow-x: auto; overflow-y: visible; padding: 8px; background: #f8fafc; -webkit-overflow-scrolling: touch; }
.pmp-report-preview .rms-a4-container { width: 210mm !important; max-width: 210mm !important; min-height: 297mm !important; margin: 0 auto; padding: 12mm !important; overflow: visible !important; }

@media (max-width: 760px) {
  .parent-marks-view { max-width: 100%; }
  .pmp-results-head { align-items: flex-start; flex-direction: column; }
  .pmp-another { align-self: stretch; justify-content: center; }
  .pmp-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pmp-stat:last-child { grid-column: 1 / -1; }
  .pmp-subject-grid { grid-template-columns: 1fr; }
  .pmp-assessment-table { min-width: 760px; }
  .pmp-assessment-table-wrap { display: none; }
  .pmp-mobile-assessments { display: grid; gap: 9px; }
  .pmp-assessment-table + .pmp-mobile-assessments { margin-top: 10px; }
  .pmp-mobile-assessments .pmp-assessment-card { padding: 12px; border: 1px solid var(--gray-200); border-radius: 9px; background: #fff; }
  .pmp-assessment-card h4 { margin: 0; color: #0a1a3c; font-size: 12px; }
  .pmp-assessment-card p { margin: 4px 0 8px; color: var(--gray-500); font-size: 10px; }
  .pmp-assessment-card div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--gray-100); font-size: 10px; }
  .pmp-assessment-card div span { color: var(--gray-500); }
  .pmp-assessment-card div b { color: var(--gray-700); text-align: right; }
  .pmp-report-actions { width: 100%; }
  .pmp-report-actions button { flex: 1; justify-content: center; }
  .pmp-report-section, .pmp-report-preview, .pmp-report-preview .rms-a4-container { min-width: 0; }
}

@media (max-width: 480px) {
  .parent-marks-page { padding-right: 10px; padding-left: 10px; }
  .pmp-heading { padding-top: 28px; }
  .pmp-heading h2 { font-size: 20px; }
  .pmp-search-card, .pmp-section { padding: 14px; }
  .pmp-form-grid { grid-template-columns: 1fr; }
  .pmp-student-card { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .pmp-student-details { width: calc(100% - 64px); flex: initial; }
  .pmp-position { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 0 0; border-top: 1px solid var(--blue-100); border-left: 0; text-align: left; }
  .pmp-position strong { font-size: 15px; }
  .pmp-tabs { margin-top: 12px; }
  .pmp-tab { min-height: 38px; padding: 7px 9px; font-size: 11px; }
  .pmp-tab svg { width: 14px; height: 14px; }
  .pmp-stat { min-height: 90px; padding: 10px; }
  .pmp-stat strong { font-size: 14px; }
  .pmp-section-heading { align-items: flex-start; flex-direction: column; }
  .pmp-report-actions button { padding: 8px; font-size: 11px; }
}
.login-secure {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-400);
}
.login-secure i { width: 14px; height: 14px; color: var(--green-600); }
.login-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--red-50);
  border: 1px solid var(--red-100);
  color: var(--red-500);
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.login-error i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.reset-back {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.reset-back i { width: 15px; height: 15px; }
.login-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
}
.login-footer p { line-height: 1.6; }
.login-footer-sub { font-size: 11px; }

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; max-width: 460px; }
  .login-brand { padding: 34px 32px 28px; gap: 20px; }
  .login-brand-mid { text-align: center; }
  .login-brand-tagline { margin-left: auto; margin-right: auto; }
  .login-features { align-items: center; }
  .login-brand-bottom { display: flex; flex-direction: column; align-items: center; }
  .login-contact { display: none; }
  .login-auth { padding: 36px 32px 26px; }
}
@media (max-width: 480px) {
  .login-page {
    position: fixed;
    inset: 0;
    z-index: 1000;
    height: 100dvh;
    min-height: 100dvh;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    align-items: flex-start;
    padding: 20px 14px;
  }
  .login-shell { flex: 0 0 auto; margin: 0 auto; }
  .login-card { padding: 0; }
  .login-brand { padding: 28px 22px 24px; }
  .login-auth { padding: 28px 22px 22px; }
  .login-brand-title { font-size: 24px; }
  .login-card-title { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-page, .login-shell, .login-brand, .login-card, .login-card-icon, .login-brand-logo {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 240ms ease;
  overflow: hidden;
}
.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--blue-600);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand h3 {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.sidebar-brand p {
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--gray-400);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  margin-left: auto;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-toggle:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }
.sidebar-toggle i { font-size: 20px; }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }
.sidebar-section { margin-bottom: 4px; }
.sidebar-section-title {
  padding: 12px 12px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-link i { font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.nav-link.active {
  background: var(--blue-600);
  color: #fff;
  font-weight: 600;
}
.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-parent .nav-chevron {
  margin-left: auto;
  font-size: 14px;
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}
.nav-parent .nav-chevron.rotated { transform: rotate(180deg); }
.nav-sub {
  display: none;
  margin: 2px 0 4px 10px;
  padding-left: 10px;
  border-left: 2px solid rgba(255,255,255,.08);
}
.nav-sub.open { display: block; }
.nav-sub-link { padding: 8px 12px; font-size: 12.5px; }
.nav-sub-link i { font-size: 16px; width: 18px; }
.sidebar-user {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--blue-600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.user-info { flex: 1; min-width: 0; }
.user-info .name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .role {
  font-size: 11px;
  color: var(--gray-400);
  text-transform: capitalize;
}
.user-info .role-sub {
  font-size: 10px;
  color: var(--primary-300, #93c5fd);
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-logout {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: color var(--transition);
  display: flex;
  align-items: center;
}
.btn-logout:hover { color: var(--red-500); }
.btn-logout i { font-size: 18px; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left 240ms ease;
}
.app-header {
   height: var(--header-h);
   padding: 0 32px;
   background: #fff;
   border-bottom: 1px solid var(--gray-200);
   position: fixed;
   top: 0;
   left: var(--sidebar-w);
   right: 0;
   z-index: 30;
   display: flex;
   align-items: center;
   flex-wrap: wrap;
   row-gap: 0;
 }
.app-header .header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}
.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.3px;
  overflow-wrap: anywhere;
}
.app-header p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 1px;
  overflow-wrap: anywhere;
}
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--gray-600);
  border-radius: var(--radius);
}
.mobile-toggle:hover { background: var(--gray-100); }
.mobile-toggle i { font-size: 20px; }
.main-content {
   padding: 32px;
   padding-top: calc(var(--header-h) + 32px);
   flex: 1;
   min-width: 0;
 }

/* ============================================================
   SIDEBAR CONTROL
   ============================================================ */
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--gray-600);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.sidebar-toggle-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.sidebar-toggle-btn:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.sidebar-toggle-btn i { width: 20px; height: 20px; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.app-layout.sb-mobile-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 769px) {
  .app-layout.sidebar-hidden .sidebar {
    transform: translateX(-102%);
  }
  .app-layout.sidebar-hidden .main-wrapper {
    margin-left: 0;
  }
  .app-layout.sidebar-hidden .app-header {
    left: 0;
  }
 }

/* ============================================================
   CARD DESIGN SYSTEM
   ============================================================ */
.card,
.stat-card,
.action-card {
  background: #ffffff;
  border: 1px solid #e7eaf0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  transition: box-shadow 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.card:hover,
.stat-card:hover,
.action-card:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
  border-color: #dfe4ee;
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.card-subtitle {
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--gray-500);
  line-height: 1.5;
}
.card-body { margin-top: 16px; }
.card-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-500);
}
.card-header .card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.05), transparent 70%);
  pointer-events: none;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.stat-card .stat-icon i { font-size: 20px; }
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
  font-weight: 500;
}
.stat-card .stat-desc {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.5;
}
.stat-card .stat-desc i { width: 13px; height: 13px; }
.stat-card .stat-trend {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

/* Compact professional stat strip (Convert Marks summary) — scoped, does not
   affect the global .stat-card look used elsewhere. */
.bulk-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.bulk-stats .stat-card {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.bulk-stats .stat-card::after { display: none; }
.bulk-stats .stat-card:hover { transform: none; }
.bulk-stats .stat-card .stat-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 9px;
  margin-bottom: 0;
}
.bulk-stats .stat-card .stat-icon i { font-size: 15px; }
.bulk-stats .stat-card .stat-text { min-width: 0; flex: 1; }
.bulk-stats .stat-card .stat-value {
  font-size: 15px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bulk-stats .stat-card .stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   CONVERT MARKS — RESPONSIVE (mobile-first refinements)
   Scoped to the bulk conversion page; leaves the rest of the
   app untouched.
   ============================================================ */
.bulk-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.bulk-steps-spacer { flex: 1; }
.bulk-step-count { margin-left: 2px; }
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.bulk-toolbar .bulk-tabs { margin-bottom: 0; }
.bulk-toolbar.bulk-review-toolbar { align-items: center; }
.bulk-spacer { flex: 1; }
.bulk-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.bulk-tabs .tab-btn { white-space: nowrap; flex: 0 0 auto; }
.bulk-target-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.bulk-assessment-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 10px;
  color: var(--gray-600);
  font-size: 12px;
}
.bulk-assessment-summary strong { color: var(--gray-900); }
.bulk-tab-count {
  display: inline-block;
  min-width: 1.5em;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}
.tab-btn.active .bulk-tab-count {
  background: rgba(255,255,255,.22);
  color: inherit;
}
.bulk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bulk-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.bulk-preview-wrap {
  overflow: auto;
  max-height: 860px;
  -webkit-overflow-scrolling: touch;
}
.bulk-swipe-hint { display: none; }

@media (max-width: 768px) {
  .bulk-steps {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 2px;
  }
  .bulk-steps > .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  .bulk-steps-spacer { display: none; }
  .bulk-swipe-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 11.5px;
    color: var(--gray-500);
  }
  .bulk-swipe-hint i { width: 14px; height: 14px; flex: 0 0 auto; }
  .bulk-toolbar { align-items: flex-end; }
}

@media (max-width: 560px) {
  .bulk-toolbar { align-items: stretch; }
  .bulk-search { max-width: 100% !important; }
  .bulk-toolbar .bulk-tabs { width: 100%; }
  .bulk-assessment-summary { gap: 5px 10px; font-size: 11px; }
  .bulk-toolbar.bulk-review-toolbar { align-items: center; }
  .bulk-toolbar.bulk-review-toolbar .bulk-tabs { width: auto; }
  .bulk-sel { margin-left: 0; }
  .bulk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bulk-stats .stat-card { padding: 9px; gap: 7px; }
  .bulk-stats .stat-card .stat-icon { width: 28px; height: 28px; min-width: 28px; }
  .bulk-stats .stat-card .stat-label { font-size: 9px; }
  .bulk-preview-wrap { max-height: 65vh; }
  .bulk-export-actions .btn { min-height: 38px; }
}

@media (max-width: 480px) {
  .bulk-target-row { gap: 8px; }
  .bulk-target-row #bulk-target { width: 100%; max-width: 100% !important; }
  .bulk-chips .btn { flex: 1 1 auto; }
  .bulk-export-actions .btn { flex: 1 1 auto; justify-content: center; }
  .bulk-steps { margin-right: -4px; }
  .bulk-steps > .btn { min-height: 38px; }
}

/* ============================================================
   QUICK ACTION CARDS
   ============================================================ */
.action-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}
.action-card:hover { transform: translateY(-2px); border-color: #c9d6f4; }
.action-card:focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 2px;
}
.action-card .ac-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.action-card .ac-icon i { font-size: 20px; }
.action-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
}
.action-card p {
  font-size: 12.5px;
  color: var(--gray-500);
  line-height: 1.55;
}
.action-card .ac-open {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue-600);
}
.action-card .ac-open i { width: 14px; height: 14px; }

/* ============================================================
   ERROR CARD
   ============================================================ */
.error-card {
  background: #fff;
  border: 1px solid var(--red-100);
  border-radius: 16px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}
.error-card .error-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--red-50);
  color: var(--red-500);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.error-card .error-icon i { font-size: 24px; }
.error-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.error-card p {
  font-size: 13px;
  color: var(--gray-500);
  max-width: 420px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

.card-in { animation: cardIn 280ms ease both; }
.card-in-stagger > * { animation: cardIn 280ms ease both; }
.card-in-stagger > *:nth-child(2) { animation-delay: 40ms; }
.card-in-stagger > *:nth-child(3) { animation-delay: 80ms; }
.card-in-stagger > *:nth-child(4) { animation-delay: 120ms; }
.card-in-stagger > *:nth-child(5) { animation-delay: 160ms; }
.card-in-stagger > *:nth-child(6) { animation-delay: 200ms; }
.card-in-stagger > *:nth-child(7) { animation-delay: 240ms; }
.card-in-stagger > *:nth-child(8) { animation-delay: 280ms; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn i { font-size: 16px; }
.btn-primary {
  background: var(--blue-600);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-700); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); }
.btn-success {
  background: var(--green-600);
  color: #fff;
}
.btn-success:hover { background: var(--green-700); }
.btn-danger {
  background: var(--red-500);
  color: #fff;
}
.btn-danger:hover { background: var(--red-600); }
.btn-warning {
  background: var(--amber-500);
  color: #fff;
}
.btn-warning:hover { background: var(--amber-600); }
.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-sm i { font-size: 14px; }
.btn-full { width: 100%; }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-group label .required {
  color: var(--red-500);
  margin-left: 2px;
}
.input-field,
.select-field,
.textarea-field {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
  background: #fff;
  color: var(--gray-800);
}
.input-field::placeholder { color: var(--gray-400); }
.input-field:focus,
.select-field:focus,
.textarea-field:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.input-field:disabled,
.select-field:disabled {
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: not-allowed;
}
.select-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.textarea-field {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}
.form-error {
  font-size: 12px;
  color: var(--red-500);
  margin-top: 4px;
}
.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue-600);
}
.page-title {
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.4;
}
.badge i { font-size: 12px; }
.badge-success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.badge-danger { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-100); }
.badge-warning { background: var(--amber-50); color: var(--amber-600); border: 1px solid var(--amber-100); }
.badge-info { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.badge-male { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }
.badge-female { background: #fdf2f8; color: #be185d; border: 1px solid #fce7f3; }

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
  overflow-x: auto;
  margin: -4px;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-container::-webkit-scrollbar { height: 6px; }
.table-container::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.table-container .data-table { min-width: max-content; }
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table tbody td { overflow-wrap: anywhere; }
.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tbody tr {
  transition: background var(--transition);
}
.data-table tbody tr:hover {
  background: var(--gray-50);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table .col-name { font-weight: 600; color: var(--gray-900); }
.data-table .col-code { font-weight: 500; font-size: 12px; letter-spacing: 0.15px; color: var(--gray-600); }
.data-table .col-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}

/* ---------- Assignment teacher cards ---------- */
.assign-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.assign-card {
  min-width: 0;
}
@media (max-width: 900px) {
  .assign-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .assign-grid { grid-template-columns: 1fr; }
}
.assign-card {
  background: var(--white, #fff);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.assign-card:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}
.assign-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--gray-100);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(255, 255, 255, 0));
}
.assign-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue-600, #2563eb), var(--blue-400, #60a5fa));
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.assign-card-meta {
  min-width: 0;
}
.assign-card-meta h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assign-code {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--gray-500);
  margin-top: 1px;
}
.assign-status {
  margin-top: 3px;
}
.assign-card-body {
  padding: 8px 12px;
  flex: 1;
}
.assign-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.assign-summary i {
  width: 8px;
  height: 8px;
  color: var(--gray-300);
}
.assign-year {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue-700, #1d4ed8);
  margin: 5px 0 1px;
}
.assign-year:first-child {
  margin-top: 0;
}
.assign-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 1px 0;
}
.assign-class {
  flex-shrink: 0;
  min-width: 52px;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--gray-900);
}
.assign-subjects {
  color: var(--gray-600);
  font-size: 11px;
  word-wrap: break-word;
}
.assign-card-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50, #f8fafc);
}
.assign-card-actions .btn {
  padding: 3px 10px;
  font-size: 11.5px;
}
.assign-card-empty .assign-card-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
}
.assign-card-empty .assign-card-actions {
  justify-content: center;
}
.table-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-500);
}
.table-highlight { background: #fffbeb !important; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  width: 100%;
  background: var(--gray-100);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width .4s ease;
  background: var(--blue-500);
}
.progress-bar-fill.green { background: var(--green-500); }
.progress-bar-fill.amber { background: var(--amber-500); }
.progress-bar-fill.red { background: var(--red-500); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
}
.alert i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-error { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-100); }
.alert-success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.alert-warning { background: var(--amber-50); color: var(--amber-600); border: 1px solid var(--amber-100); }
.alert-info { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp .2s ease;
}
.modal.modal-wide { max-width: 900px; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 24px 24px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}
.modal-body {
  padding: 20px 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .3s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast i { font-size: 16px; }
.toast-success { background: var(--green-600); }
.toast-error { background: var(--red-500); }
.toast-info { background: var(--blue-600); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   TABS
   ============================================================ */
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
  margin-bottom: 24px;
}
.tab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
  color: var(--gray-500);
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active {
  background: #fff;
  color: var(--blue-600);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
}
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--red-50, #fef2f2);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
}
.bulk-bar i { vertical-align: middle; width: 14px; height: 14px; margin-right: 6px; }
.filter-bar .form-group { margin-bottom: 0; min-width: 180px; }
.filter-bar .input-field,
.filter-bar .select-field {
  padding: 9px 14px;
}
.search-input-wrapper {
  position: relative;
}
.search-input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 16px;
  pointer-events: none;
}
.search-input-wrapper .input-field {
  padding-left: 38px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}
.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--gray-400);
}
.empty-state .empty-icon i { font-size: 26px; }
.empty-state h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.6;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}
.page-header p {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 2px;
}
.page-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--gray-500); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }
.relative { position: relative; }
/* .no-print helper if needed */

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .grid-4, .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
   .grid-3 { grid-template-columns: repeat(2, 1fr); }
   .form-row-3 { grid-template-columns: 1fr 1fr; }
   .main-content { padding: 20px; padding-top: calc(var(--header-h) + 20px); }
   .stat-card .stat-value { font-size: 24px; }
 }
@media (max-width: 768px) {
  .app-layout {
    position: relative;
  }
  .sidebar {
    width: min(82vw, 320px);
    transform: translateX(-102%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .sidebar-toggle { display: flex; }
  .mobile-toggle { display: flex; }
  .main-wrapper { margin-left: 0; }
  .main-content { padding: 16px; padding-top: calc(var(--header-h) + 16px); }
  .app-header { padding: 0 16px; left: 0; }
  .grid-4, .grid-3, .grid-2, .card-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { min-width: 100%; }
  .modal { margin: 16px; max-height: 95vh; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; }
  .table-actions { flex-wrap: wrap; }
  .page-header h2 { font-size: 20px; }
  .app-header h1 { font-size: 16px; }
  .stat-card .stat-value { font-size: 24px; }
  .card, .stat-card, .action-card, .panel, .section-card {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
}
@media (max-width: 480px) {
  .stat-card .stat-value { font-size: 24px; }
  .page-header h2 { font-size: 19px; }
  .card, .stat-card, .action-card { padding: 20px; }
  .app-header { padding: 0 12px; }
  .main-content { padding: 12px; padding-top: calc(var(--header-h) + 12px); }
  .header-right { gap: 8px; }
  .acad-year-selector { max-width: 100%; }
}
@media (max-width: 360px) {
  .sidebar { width: min(88vw, 290px); }
  .card, .stat-card, .action-card { padding: 16px; }
  .login-brand, .login-auth {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .stat-card,
  .action-card,
  .report-cb-item {
    animation: none !important;
    transition: none !important;
  }
}

.card-in,
.card-in-stagger > * {
  animation: cardIn 280ms ease both;
}
@media (prefers-reduced-motion: reduce) {
  .card-in,
  .card-in-stagger > * {
    animation: none !important;
  }
}

@media print {
  .card, .stat-card, .action-card, .report-cb-item, .report-paper-container {
    box-shadow: none !important;
    border-color: #d1d5db !important;
  }
  .card:hover, .stat-card:hover, .action-card:hover {
    transform: none !important;
    box-shadow: none !important;
  }
}

/* ============================================================
   LEARNER IMPORT
   ============================================================ */
.import-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.import-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.import-step .step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.import-step.active { color: var(--blue-700); }
.import-step.active .step-num { background: var(--blue-600); color: #fff; }
.import-step.done { color: var(--green-700); }
.import-step.done .step-num { background: var(--green-600); color: #fff; }
.import-step-sep { width: 18px; height: 1px; background: var(--gray-300); }

.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--gray-25);
  margin-bottom: 16px;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.dropzone .dz-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropzone .dz-icon i { font-size: 26px; }
.dropzone h4 { font-size: 15px; font-weight: 700; color: var(--gray-800); }
.dropzone p { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.dropzone .dz-formats { margin-top: 12px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.dropzone .dz-formats span {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.dropzone.dz-disabled { pointer-events: none; opacity: .5; }

.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--gray-25);
  margin-bottom: 16px;
}
.file-card .file-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--green-50);
  color: var(--green-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-card .file-icon i { font-size: 20px; }
.file-card .file-meta { flex: 1; min-width: 0; }
.file-card .file-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-card .file-detail { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.file-card .btn-remove {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-500);
  border-radius: var(--radius);
  font-family: inherit;
  cursor: pointer;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}
.file-card .btn-remove:hover { color: var(--red-500); border-color: var(--red-100); background: var(--red-50); }

.import-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.import-stat {
  flex: 1;
  min-width: 130px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: #fff;
}
.import-stat .is-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.1;
}
.import-stat .is-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  font-weight: 500;
}
.import-stat.is-green { border-color: var(--green-100); background: var(--green-50); }
.import-stat.is-green .is-value { color: var(--green-700); }
.import-stat.is-amber { border-color: var(--amber-100); background: var(--amber-50); }
.import-stat.is-amber .is-value { color: var(--amber-600); }
.import-stat.is-red { border-color: var(--red-100); background: var(--red-50); }
.import-stat.is-red .is-value { color: var(--red-600); }
.import-stat.is-blue { border-color: var(--blue-100); background: var(--blue-50); }
.import-stat.is-blue .is-value { color: var(--blue-700); }

.import-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.import-badge i { font-size: 12px; }
.import-badge-ready { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.import-badge-dup { background: var(--amber-50); color: var(--amber-600); border: 1px solid var(--amber-100); }
.import-badge-exists { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }
.import-badge-error { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-100); }

.import-errors-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.import-error-item {
  border: 1px solid var(--red-100);
  background: var(--red-50);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.import-error-item .ie-row { font-size: 11px; font-weight: 700; color: var(--red-500); text-transform: uppercase; letter-spacing: .3px; }
.import-error-item .ie-code { font-size: 13px; font-weight: 700; color: var(--gray-900); letter-spacing: 0.15px; margin-top: 2px; }
.import-error-item .ie-problem { font-size: 13px; color: var(--gray-700); margin-top: 4px; }
.import-error-item .ie-fix { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.import-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.import-progress .ip-text { font-size: 13px; font-weight: 600; color: var(--gray-700); }

.import-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.import-filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid var(--gray-200);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
}
.import-filter-tab:hover { border-color: var(--gray-300); color: var(--gray-800); }
.import-filter-tab.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.imp-filter-count {
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 9999px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
}
.import-filter-tab.active .imp-filter-count { background: rgba(255,255,255,.25); color: #fff; }
.imp-filter-count.green { background: var(--green-50); color: var(--green-700); }
.imp-filter-count.amber { background: var(--amber-50); color: var(--amber-600); }
.imp-filter-count.red { background: var(--red-50); color: var(--red-600); }
.imp-filter-count.blue { background: var(--blue-50); color: var(--blue-700); }

/* ============================================================
   OFFICIAL SCHOOL REPORT DESIGN SYSTEM
   ============================================================ */

.report-paper-container {
  background: #ffffff;
  max-width: 1050px;
  margin: 0 auto;
  padding: 36px 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  color: var(--gray-900);
  font-family: 'Poppins', sans-serif;
}

.school-report-header {
  text-align: center;
  border-bottom: 3px double var(--gray-800);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.school-logo-img {
  max-height: 80px;
  width: auto;
  margin: 0 auto 12px;
  display: block;
  object-fit: contain;
}
.school-report-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.5px;
  text-transform: uppercase;
  margin: 0;
}
.school-report-header .motto {
  font-style: italic;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 13px;
  margin-top: 4px;
}
.school-report-header .contact-line {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 6px;
  font-weight: 500;
}

.report-title-section {
  text-align: center;
  margin-bottom: 20px;
}
.report-main-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--blue-900);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.report-sub-title {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 600;
  margin-top: 2px;
}

.report-info-panel {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 24px;
  font-size: 13px;
}
.report-info-item span.label {
  color: var(--gray-500);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 2px;
}
.report-info-item div.value {
  font-weight: 700;
  color: var(--gray-800);
}

.report-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.report-status-approved { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.report-status-draft { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

.report-marks-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 12px;
}
.report-marks-table th {
  background: var(--gray-900);
  color: #ffffff;
  font-weight: 700;
  padding: 10px 12px;
  border: 1px solid var(--gray-700);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-align: center;
}
.report-marks-table td {
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  color: var(--gray-800);
}
.report-marks-table tbody tr:nth-child(even) {
  background: var(--gray-50);
}
.report-marks-table td.col-learner-name {
  font-weight: 600;
  color: var(--gray-900);
  text-align: left;
}
.report-marks-table td.col-code {
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.15px;
  color: var(--gray-600);
  text-align: center;
}

.badge-result-pass {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.badge-result-fail {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.text-nr {
  color: var(--gray-400);
  font-style: italic;
  font-weight: 500;
}

.report-summary-section {
  margin-top: 24px;
  margin-bottom: 24px;
  page-break-inside: avoid;
  break-inside: avoid;
}
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.report-stat-card {
  background: var(--gray-25);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.report-stat-card .val {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.2;
}
.report-stat-card .lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  margin-top: 4px;
}

.report-signatures {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-300);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  page-break-inside: avoid;
  break-inside: avoid;
}
.sig-box .sig-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 28px;
}
.sig-box .sig-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  border-top: 1px solid var(--gray-400);
  padding-top: 6px;
}
.sig-box .sig-sub {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

.report-doc-footer {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px dashed var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--gray-500);
  page-break-inside: avoid;
  break-inside: avoid;
}

/* ============================================================
   PRINT SPECIFIC STYLES
   ============================================================ */
@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .sidebar,
  .sidebar-backdrop,
  .app-header,
  .no-print,
  .mobile-toggle,
  .sidebar-toggle-btn,
  .modal-footer,
  .tab-bar,
  .btn,
  .modal-header button,
  #toast-container {
    display: none !important;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .modal-overlay {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    backdrop-filter: none !important;
  }

  .modal,
  .modal-wide {
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .modal-body {
    padding: 0 !important;
  }

  .report-paper-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .report-marks-table th {
    background: #111827 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .report-marks-table td,
  .report-marks-table th {
    border: 1px solid #6b7280 !important;
  }

  .report-signatures,
  .report-summary-section,
  .report-unit-section,
  .report-grade-section,
  .report-info-panel,
  .report-assess-included,
  .school-report-header {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

/* Official print footer with page numbering */
.print-page-footer { display: none; }
.print-page-footer {
  display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 4px 10mm;
    font-size: 9px;
    color: #374151;
    border-top: 1px dashed #9ca3af;
    font-family: 'Poppins', sans-serif;
  }
  .print-page-footer .pf-right.pg::after {
    content: "Page " counter(page) " of " counter(pages);
  }
}

/* ============================================================
   REPORT SELECTION & PREVIEW (SCREEN ONLY)
   ============================================================ */

.report-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 12px;
}
.report-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.report-tab:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}
.report-tab.active {
  background: var(--blue-600);
  color: #ffffff;
}

.report-cb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
}
.report-cb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid #e7eaf0;
  border-radius: 14px;
  background: var(--gray-25);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.report-cb-item:hover {
  border-color: var(--blue-400);
  background: #f0f6ff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}
.report-cb-item:has(input:checked) {
  border-color: var(--blue-500);
  background: #eef4ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.report-cb-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.report-cb-title {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--gray-800);
}
.report-cb-meta {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.report-preview-toolbar-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.report-preview-toolbar-flex .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.report-paper-container.report-orientation-landscape {
  max-width: 1180px;
}

.report-table-scroll {
  overflow-x: auto;
  margin-bottom: 8px;
}

.report-marks-table th.th-left {
  text-align: left;
}
.report-marks-table th.th-unit {
  padding: 4px 6px;
  min-width: 56px;
}
.report-marks-table th.th-unit .unit-th-name {
  font-size: 10.5px;
  line-height: 1.2;
}
.report-marks-table th.th-unit .unit-th-max {
  font-size: 9px;
  font-weight: 500;
  opacity: 0.85;
}
.report-marks-table.compact {
  font-size: 11px;
}
.report-marks-table.compact td {
  padding: 5px 6px;
}
.report-marks-table.compact td.col-learner-name {
  font-size: 11px;
}

.report-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-700);
  margin-bottom: 12px;
}
.report-summary-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

/* DOS report orientation + print page sizing */
body.report-orientation-portrait .report-paper-container {
  max-width: 860px;
}
.report-orientation-portrait { page: rms-portrait; }
.report-orientation-landscape { page: rms-landscape; }
@page rms-portrait { size: A4 portrait; margin: 10mm; }
@page rms-landscape { size: A4 landscape; margin: 10mm; }

/* Report tab overflow helper for many tabs */
.report-tabs { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; }
.report-tab { flex: 0 0 auto; }
@media (max-width: 768px) {
  .report-tabs { flex-wrap: wrap; }
  .report-tab { flex: 1 1 auto; }
}

@media print {
  .report-table-scroll { overflow: visible !important; }
  .report-orientation-portrait .report-paper-container { max-width: 100% !important; }
}

/* Unit performance bars */
.report-unit-section {
  margin: 24px 0;
  page-break-inside: avoid;
  break-inside: avoid;
}
.unit-perf-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.unit-perf-name {
  width: 210px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-800);
}
.unit-perf-track {
  flex: 1;
  height: 12px;
  background: var(--gray-100);
  border-radius: 9999px;
  overflow: hidden;
}
.unit-perf-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}
.unit-perf-fill.green { background: #22c55e; }
.unit-perf-fill.amber { background: #f59e0b; }
.unit-perf-fill.red { background: #ef4444; }
.unit-perf-val {
  width: 64px;
  flex-shrink: 0;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-800);
}

/* Grade distribution chart */
.report-grade-section {
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--gray-25);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  page-break-inside: avoid;
  break-inside: avoid;
}
.grade-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.grade-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.grade-bar-label {
  width: 74px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-700);
}
.grade-bar-track {
  flex: 1;
  height: 18px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}
.grade-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-600), var(--blue-400));
  border-radius: 4px;
  transition: width 0.4s ease;
}
.grade-bar-count {
  width: 110px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--gray-500);
  text-align: right;
}

/* Signature lines */
.sig-box .sig-line {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* Assessments-included table */
.report-assess-included {
  margin-bottom: 24px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.report-assess-tbl-title {
  background: var(--gray-100);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  padding: 8px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.report-assess-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.report-assess-tbl th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.4px;
  text-align: left;
  padding: 6px 12px;
  border-bottom: 1px solid var(--gray-200);
}
.report-assess-tbl td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
}
.report-assess-tbl tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================================
   Realtime sync — sidebar notification badge
   ============================================================ */
.nav-badge {
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--red-500);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.school-logo-img {
  max-height: 68px;
  max-width: 180px;
  object-fit: contain;
  margin: 0 auto 10px auto;
  display: block;
}

/* ============================================================
   PERFORMANCE & ANALYTICS
   ============================================================ */
.analytics-page { max-width: 1400px; width: 100%; margin: 0 auto; overflow-x: hidden; }
.analytics-page .card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.analytics-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px;
}
.af-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.af-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.af-field select { width: 100%; min-width: 0; }
@media (max-width: 1100px) { .filters-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .filters-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .filters-grid { grid-template-columns: 1fr; } }

.analytics-scope {
  padding: 10px 20px 16px;
  font-size: 13px;
  color: var(--gray-600);
  border-top: 1px solid var(--gray-100);
}

.analysis-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}
.analysis-tools { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.analysis-tool { display: flex; flex-direction: column; gap: 4px; }
.analysis-tool > label { font-size: 11px; font-weight: 600; color: var(--gray-500); }

.chart-box { padding: 16px 20px; min-height: 120px; max-width: 100%; }
.table-box { padding: 8px 0; min-height: 60px; max-width: 100%; }
.insights-box { padding: 16px 20px; }

/* --- Analytics page fit-screen + responsive --- */
.analytics-page .card { max-width: 100%; overflow: hidden; }
.analytics-page .filters-grid { padding: 12px 16px; gap: 10px; }

/* --- Chart module --- */
.rms-chart { font-family: inherit; }
.rms-chart svg { display: block; }
.rms-chart .rms-bar { cursor: pointer; transition: opacity .12s ease; }
.rms-chart .rms-bar:hover { opacity: .8; }
.rms-chart .rms-donut-seg { cursor: default; }
.rms-chart-tip {
  position: fixed;
  display: none;
  z-index: 9999;
  background: #111827;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 11px;
  border-radius: 8px;
  pointer-events: none;
  max-width: 260px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.rms-chart-tip strong { color: #fff; }
.rms-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  padding: 24px;
  color: var(--gray-400);
  text-align: center;
  font-size: 13px;
}
.rms-empty svg { width: 32px; height: 32px; }
.rms-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--gray-600); }
.rms-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.rms-legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.rms-donut-flex { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; }
.rms-donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.rms-donut-legend-item { display: flex; align-items: center; gap: 8px; }
.rms-donut-legend-label { min-width: 120px; color: var(--gray-600); }
.rms-radar-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rms-radar-wrap .rms-legend { justify-content: center; }

/* --- Insights --- */
.insights-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.insights-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  font-size: 13px;
  line-height: 1.45;
}
.insights-list li svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.insight-good { background: var(--green-50); color: var(--green-800, #1a7f37); border-color: var(--green-200, #bbf7d0) !important; }
.insight-warn { background: var(--red-50); color: var(--red-800, #b91c1c); border-color: var(--red-200, #fecaca) !important; }
.insight-info { background: var(--blue-50); color: var(--blue-800, #1e40af); border-color: var(--blue-200, #bfdbfe) !important; }

/* --- Matrix chips --- */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  min-width: 46px;
  text-align: center;
}
.chip.bg-green { background: #dcfce7; color: #166534; }
.chip.bg-amber { background: #fef3c7; color: #92400e; }
.chip.bg-red { background: #fecaca; color: #991b1b; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .data-table { min-width: max-content; }

/* --- Badge variants used by analytics --- */
.badge-green { background: var(--green-50); color: var(--green-600); border: 1px solid var(--green-200, #bbf7d0); }
.badge-red { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-200, #fecaca); }
.badge-amber { background: var(--amber-50); color: var(--amber-700, #b45309); border: 1px solid var(--amber-200, #fde68a); }
.badge-purple { background: #f5f3ff; color: var(--purple-600, #7c3aed); border: 1px solid #e9d5ff; }

.stat-sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

.mt-6 { margin-top: 16px; }
.analytics-hint { margin: -6px 0 14px; }
.analytics-hint p { margin: 0; }

/* --- Print / PDF --- */
@media print {
  #sidebar, .sidebar-toggle-btn, .app-header, .analysis-bar, .analytics-page > .card, #rms-chart-tip { display: none !important; }
  .main-content { padding: 0; width: 100%; }
  .analytics-page { max-width: 100%; }
  .grid-2, .grid-4 { grid-template-columns: 1fr 1fr !important; }
  .card { break-inside: avoid; box-shadow: none; border-color: #ddd; }
  .chart-box svg { width: 100% !important; }
  .table-scroll { overflow: visible; }
  .table-scroll .data-table { min-width: 0; }
}

/* ============================================================
   POST-ASSESSMENT REPORTS (psr)
   ============================================================ */

.psr-page { max-width: 1400px; width: 100%; margin: 0 auto; }
.psr-page .card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.psr-tabs { margin-top: 6px; }

.cmp-chips { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 2px 8px; }
.cmp-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.cmp-chip input { display: none; }
.cmp-chip .text-muted { font-weight: 500; }
.cmp-chip:hover { border-color: var(--blue-300); background: var(--blue-50); }
.cmp-chip.on { border-color: var(--blue-600); background: var(--blue-600); color: #fff; }
.cmp-chip.on .text-muted { color: #dbeafe; }

.psr-student-chips { min-width: 220px; }
.psr-chip-row { display: flex; flex-wrap: wrap; gap: 6px; max-height: 140px; overflow-y: auto; padding: 2px; }

.psr-scope-switch { display: inline-flex; background: var(--gray-100); border-radius: 999px; padding: 4px; gap: 4px; }
.psr-scope-btn { border: none; background: transparent; color: var(--gray-600); font-size: 12px; font-weight: 600; padding: 7px 16px; border-radius: 999px; cursor: pointer; transition: all 0.15s ease; }
.psr-scope-btn:hover { color: var(--blue-700); }
.psr-scope-btn.active { background: var(--blue-600); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25); }

.psr-toggle-group { display: inline-flex; background: var(--gray-100); border-radius: 8px; padding: 3px; gap: 2px; }
.psr-toggle-btn { border: none; background: transparent; color: var(--gray-600); padding: 6px 14px; font-size: 12px; font-weight: 600; border-radius: 6px; cursor: pointer; }
.psr-toggle-btn.active { background: #fff; color: var(--blue-700); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }

.psr-include-block { border: 1px solid var(--gray-200); border-radius: 10px; overflow: hidden; margin-top: 10px; }
.psr-include-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); font-size: 12px; font-weight: 600; color: var(--gray-600); }
.psr-include-body { padding: 10px 14px; }

.psr-table-pager { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 12px; color: var(--gray-500); }
.psr-pager-btns { display: flex; gap: 6px; margin-left: auto; }
.psr-table-pager button { border: 1px solid var(--gray-200); background: #fff; color: var(--gray-700); border-radius: 6px; cursor: pointer; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.psr-table-pager button:hover { background: var(--blue-50); color: var(--blue-700); }

.badge-neutral { background: var(--gray-100); color: var(--gray-600); }

.psr-table-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 0; }
.psr-table-tools .input-field { max-width: 320px; }
.psr-count { white-space: nowrap; }
.psr-comment-input { width: 200px; padding: 5px 8px; font-size: 12px; }
.psr-sortable { cursor: pointer; user-select: none; }
.psr-sortable:hover { background: var(--blue-50); }
.psr-sort-active { background: var(--blue-50) !important; color: var(--blue-700) !important; }

.psr-print-header, .psr-print-subtitle, .psr-print-signature { display: none; }
.psr-print-subtitle { font-size: 12px; }
.psr-print-signature { margin-top: 24px; }

@media print {
  body.psr-printing .psr-filters-card,
  body.psr-printing .psr-export-bar { display: none !important; }
  body.psr-printing .psr-print-header,
  body.psr-printing .psr-print-subtitle,
  body.psr-printing .psr-print-signature { display: block !important; }
  body.psr-printing .cmp-chips { display: none !important; }
  body.psr-printing .psr-tabs { display: none !important; }
  body.psr-printing .psr-table-tools { display: none !important; }
  body.psr-printing .psr-comment-input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-size: 12px !important;
    width: auto !important;
    color: #000 !important;
  }
  body.psr-printing .psr-chip-row { display: none !important; }
}


/* ---------- Report Center Styles ---------- */

.report-center-container { max-width: 960px; margin: 0 auto; }

.rms-report-header { display: flex; align-items: stretch; padding: 16px 20px; border: 2px solid #1e3a5f; border-radius: 8px; margin-bottom: 16px; gap: 16px; }
.rms-header-left { display: flex; align-items: center; gap: 14px; flex: 1; }
.rms-header-center { flex: 1; text-align: center; }
.rms-header-right { display: flex; align-items: center; }
.rms-header-logo { height: 60px; width: auto; object-fit: contain; }
.rms-header-text { display: flex; flex-direction: column; gap: 1px; }
.rms-header-country { font-weight: 800; font-size: 13px; color: #1e3a5f; }
.rms-header-ministry { font-weight: 600; font-size: 11px; color: #555; }
.rms-header-province, .rms-header-district, .rms-header-sector { font-size: 10px; color: #666; }
.rms-header-school { font-weight: 800; font-size: 14px; color: #1e3a5f; }
.rms-header-code { font-size: 10px; color: #888; }
.rms-header-email, .rms-header-phone { font-size: 10px; color: #666; }
.rms-header-title { font-weight: 800; font-size: 16px; color: #1e3a5f; text-transform: uppercase; }
.rms-header-subtitle { font-size: 12px; color: #555; margin-top: 2px; }
.rms-header-level { font-size: 11px; color: #888; margin-top: 2px; }
.rms-header-divider { height: 3px; background: #1e3a5f; margin-bottom: 16px; }
.rms-report-title { font-weight: 800; font-size: 15px; color: #1e3a5f; text-transform: uppercase; margin-bottom: 12px; border-bottom: 2px solid #2563eb; padding-bottom: 6px; }
.rms-meta { font-size: 12px; color: #555; margin-bottom: 12px; }
.rms-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; margin-bottom: 16px; }
.rms-meta-lbl { font-weight: 600; color: #333; }
.rms-summary { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.rms-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rms-stat { background: var(--blue-50); border-radius: 8px; padding: 12px; text-align: center; }
.rms-stat-val { display: block; font-size: 22px; font-weight: 800; color: #1e3a5f; }
.rms-stat-lbl { display: block; font-size: 10px; color: #666; margin-top: 2px; }
.rms-grade-dist { margin-bottom: 12px; padding: 8px; background: var(--blue-50); border-radius: 6px; font-size: 12px; }
.rms-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 16px; }
.rms-table th { background: #1e3a5f; color: #fff; padding: 8px 6px; text-align: center; font-weight: 600; }
.rms-table td { padding: 6px; border-bottom: 1px solid #e5e7eb; text-align: center; }
.rms-table tr:nth-child(even) { background: #f9fafb; }
.rms-table tbody tr:hover { background: #eff6ff; }
.rms-report-footer { display: flex; justify-content: space-between; padding: 12px 20px; border-top: 2px solid #1e3a5f; font-size: 10px; color: #666; margin-top: 24px; }
.rms-page-break { page-break-after: always; }

/* ========== REPORT CHART / EMPTY / BANNER STYLES ========== */

.rms-chart-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; margin-bottom: 10px; }
.rms-chart-card { flex: 1 1 210px; min-width: 190px; border: 1px solid var(--gray-200, #e5e7eb); border-radius: 10px; padding: 7px 9px; background: #fff; page-break-inside: avoid; break-inside: avoid; }
.rms-chart { width: 100%; height: auto; max-height: 132px; }
.rms-chart-legend { display: flex; flex-direction: column; gap: 6px; justify-content: center; font-size: 12px; min-width: 170px; padding: 6px 2px; }
.rms-chart-legend-item { display: flex; align-items: center; gap: 8px; }
.rms-chart-legend-item i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.rms-chart-legend-item b { color: #1e3a5f; }
.rms-empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 14px; margin-bottom: 14px; border: 1px dashed #cbd5e1; border-radius: 10px; background: #f8fafc; color: #475569; font-size: 13px; font-weight: 600; text-align: center; }
.rms-warn-banner { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; margin-bottom: 12px; background: #fef3c7; border: 1px solid #f59e0b; border-left: 4px solid #f59e0b; color: #92400e; border-radius: 8px; font-size: 12px; }
.rms-info-banner { padding: 9px 12px; margin-bottom: 12px; background: #eff6ff; border: 1px solid #bfdbfe; border-left: 4px solid #2563eb; color: #1e40af; border-radius: 8px; font-size: 12px; }
.rms-comment-block { margin-top: 8px; margin-bottom: 6px; padding: 8px 10px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 11.5px; color: #334155; }
.rms-cell-pct { font-size: 9px; color: #6b7280; }
.rms-th-sub { font-size: 8.5px; font-weight: 500; color: #e2e8f0; }
.rms-summary-row td { background: #eef2f7 !important; font-size: 10px !important; border-top: 2px solid #1e3a5f; }
.rms-table .rms-summary-row + tr { border-top: 2px solid #1e3a5f; }
.rms-signature-row { display: flex; justify-content: space-between; gap: 20px; margin-top: 42px; font-size: 11.5px; }
.rms-signature-box { min-width: 160px; }

@media print {
  .rms-chart-row { page-break-inside: avoid; break-inside: avoid; }
  .rms-chart-card { page-break-inside: avoid; break-inside: avoid; }
  .rms-empty-state, .rms-warn-banner, .rms-info-banner, .rms-comment-block { page-break-inside: avoid; break-inside: avoid; }
  .rms-signature-row { page-break-inside: avoid; break-inside: avoid; }

  /* Keep every report part on a single page */
  .rms-a4-container .rms-report-title,
  .rms-a4-container .rms-meta,
  .rms-a4-container .rms-meta-grid,
  .rms-a4-container .rms-summary,
  .rms-a4-container .rms-summary-grid,
  .rms-a4-container .card,
  .rms-a4-container .rms-chart-row,
  .rms-a4-container .rms-table thead,
  .rms-a4-container .rms-report-footer {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .rms-a4-container .rms-report-footer { page-break-before: avoid; }
  .rms-table { font-size: 9.5px !important; }
  .rms-table th, .rms-table td { padding: 3px 4px !important; }
  .rms-cell-pct, .rms-th-sub { font-size: 7.5px !important; }
  .rms-chart { max-height: 104px !important; }
  .rms-chart-card { padding: 5px 7px !important; }
}

/* ========== REPORT CENTER HUB ========== */

.rms-hub-head {
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  align-items: flex-start;
  background: linear-gradient(135deg, #16324d 0%, #1e3a8a 55%, #2563eb 100%);
  box-shadow: 0 8px 24px rgba(30, 58, 138, 0.35);
}
.rms-hub-head::before {
  content: "";
  position: absolute;
  right: -50px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.rms-hub-head::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, #60a5fa, #22d3ee);
}
.rms-hub-head .rw-head-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 4px 12px rgba(0, 0, 0, 0.18);
}
.rms-hub-head-main {
  min-width: 0;
  flex: 1;
}
.rms-hub-head .rw-head-title {
  font-size: 20px;
  letter-spacing: 0.01em;
}
.rms-hub-head .rw-head-sub {
  font-size: 12.5px;
  opacity: 0.9;
}
.rms-hub-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.rms-hub-stat {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.rms-hub-stat b {
  font-weight: 800;
}
.rms-hub-head .rw-scope-badge {
  align-self: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
@media (max-width: 760px) {
  .rms-hub-head { flex-wrap: wrap; }
  .rms-hub-head .rw-scope-badge { margin-left: 0; align-self: flex-start; }
}
.rms-hub-section { margin-bottom: 24px; }
.rms-hub-cat { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: var(--gray-800, #1f2937); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .4px; }
.rms-hub-cat span:last-child { margin-left: auto; }
.rms-hub-count { background: #e2e8f0; color: #334155; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.rms-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.rms-hub-card { padding: 15px; display: flex; flex-direction: column; gap: 9px; }
.rms-hub-card-top { display: flex; align-items: center; gap: 10px; }
.rms-hub-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }
.rms-hub-title { font-weight: 800; color: var(--gray-800, #1f2937); font-size: 14px; }
.rms-hub-desc { font-size: 12px; color: var(--gray-500, #6b7280); min-height: 32px; line-height: 1.45; }
.rms-hub-filters { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #64748b; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 999px; padding: 4px 10px; align-self: flex-start; }
.rms-hub-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

/* ========== A4 REPORT STYLES ========== */

.rms-a4-container {
  width: 210mm;
  min-height: 297mm;
  max-width: 210mm;
  margin: 0 auto;
  padding: 12mm;
  box-sizing: border-box;
  background: #fff;
  position: relative;
  border: 1px solid var(--gray-200, #e5e7eb);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

/* Make A4 preview scale on small screens rather than overflow */
@media (max-width: 980px) {
  .rms-a4-container, .rms-a4-page {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 12px !important;
    box-shadow: none !important;
    border: none !important;
  }
  .rms-a4-container { overflow-x: auto; }
}

/* Multi-subject list touch-friendly */
.ms-list .report-cb-item { padding: 6px 4px; font-size: 14px; }
.ms-actions .btn { padding: 6px 8px; font-size: 13px; }

.rms-a4-container.rms-a4-landscape {
  width: 297mm;
  min-height: 210mm;
  max-width: 297mm;
}

.rms-a4-page {
  width: 210mm;
  min-height: 297mm;
  max-width: 210mm;
  margin: 0 auto;
  padding: 12mm;
  box-sizing: border-box;
  background: #fff;
  position: relative;
  page-break-after: always;
}

.rms-a4-page.rms-a4-landscape {
  width: 297mm;
  min-height: 210mm;
  max-width: 297mm;
}

/* A4 print @page rules (orientation is overridden per-report in the print window) */
@page {
  size: A4 portrait;
  margin: 12mm;
}

@media print {
  body { background: #fff !important; }
  
  .rms-a4-container,
  .rms-a4-page {
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 297mm !important;
    padding: 12mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    page-break-after: always;
  }

  .rms-a4-container {
    height: auto !important;
    overflow: visible !important;
    page-break-after: auto !important;
  }
  
  .rms-a4-container.rms-a4-landscape,
  .rms-a4-page.rms-a4-landscape {
    width: 297mm !important;
    max-width: 297mm !important;
    min-height: 210mm !important;
  }
  
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  .rms-report-header,
  .rms-header-left,
  .rms-header-center,
  .rms-header-right {
    display: flex !important;
  }
  
  .rms-header-logo {
    height: 20mm !important;
    max-width: 35mm !important;
    object-fit: contain !important;
  }

  .rms-table {
    font-size: 10px !important;
    page-break-inside: auto;
  }

  .rms-table thead {
    display: table-header-group;
  }

  .rms-table tfoot {
    display: table-footer-group;
  }

  .rms-table tbody tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .rms-report-title,
  .rms-meta {
    page-break-after: avoid;
    break-after: avoid;
  }

  .rms-summary,
  .rms-summary-grid {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .rms-table th {
    background: #1e3a5f !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  .rms-summary-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  
  .rms-stat-val { font-size: 18px !important; }
  
  .rms-report-footer {
    border-top: 2px solid #1e3a5f !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .rms-page-break {
    page-break-after: always;
    height: 0;
    margin: 0;
    padding: 0;
  }
  
  .no-print { display: none !important; }
  
  .rms-a4-container * {
    overflow: visible !important;
    text-overflow: clip !important;
  }
}

/* A4 print container wrapper */
.rms-a4-print-wrapper {
  width: 210mm;
  margin: 0 auto;
  padding: 12mm;
  box-sizing: border-box;
}

.rms-a4-print-wrapper.rms-a4-landscape {
  width: 297mm;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Student report-card safeguards (A4 portrait) ---------- */
.rms-table td, .rms-table th { word-wrap: break-word; overflow-wrap: break-word; }
.rms-abbr { display: inline-block; margin: 2px 8px 2px 0; font-size: 11px; white-space: normal; }
@media print {
  .rms-table td, .rms-table th { word-wrap: break-word; overflow-wrap: break-word; }
  .rms-abbr { font-size: 9px; }
}

/* ============================================================
   RESPONSIVE ENHANCEMENTS (mobile-first hardening)
   ============================================================ */

#app, .app-layout { max-width: 100%; }

/* Long, unbroken content wraps instead of overflowing the viewport */
.app-header h1, .app-header p,
.badge, .alert, .report-cb-body,
.import-error-item, .import-badge,
.sidebar-brand h3, .sidebar-brand p,
.toast, .modal,
.stat-card .stat-label, .card-subtitle { overflow-wrap: anywhere; }

/* Wide data tables scroll inside their container (never the page) */
.report-table-scroll, .table-scroll, .report-cb-grid {
  -webkit-overflow-scrolling: touch;
}
.table-scroll .data-table { min-width: max-content; }

/* Header implements a wrapping row so its controls never overflow.
   On desktop (>=769px) it remains a fixed, single-line bar. */
@media (max-width: 768px) {
  .app-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: var(--header-h);
    padding: 8px 16px;
    flex-wrap: wrap;
    row-gap: 6px;
    align-items: center;
    box-shadow: 0 1px 0 var(--gray-200);
  }
  .main-content { padding-top: 16px; }

  .header-left { flex: 1 1 auto; min-width: 0; }
  .header-left p { display: none; }
  .app-header h1 { font-size: 15px; }

  /* Year selector lives on its own full-width row on phones */
  .header-year-wrap {
    flex: 1 1 100% !important;
    margin-left: 0 !important;
    padding-right: 0 !important;
    gap: 8px;
  }
  .header-year-wrap > span { display: none; }
  .header-year-wrap .select-field {
    flex: 1 1 auto;
    min-width: 0 !important;
    padding: 8px 34px 8px 12px;
  }
}

@media (max-width: 767px) {
  .grid-4, .grid-3, .card-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }

  .filter-bar .form-group { min-width: 100%; width: 100%; }
  .search-input-wrapper {
    width: 100% !important;
    min-width: 100% !important;
    flex: 1 1 100% !important;
    max-width: none !important;
  }

  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1 1 auto; min-width: 0; white-space: normal; }

  /* Modals fit the viewport height for comfortable scrolling */
  .modal-overlay { padding: 16px; }
  .modal { margin: 0; max-height: 94dvh; }
  .modal-header { padding: 20px 20px 0; }
  .modal-body { padding: 16px 20px; }
  .modal-footer { padding: 14px 20px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1 1 auto; min-width: 0; }

  /* Toasts fill the width below the header */
  .toast-container { top: 12px; left: 12px; right: 12px; align-items: stretch; }
  .toast { width: 100%; max-width: 100%; padding: 12px 14px; }

  /* Report center */
  .report-cb-grid { grid-template-columns: 1fr; max-height: 300px; }
  .report-paper-container { padding: 22px 16px; }
  .report-signatures { grid-template-columns: 1fr 1fr; }
  .report-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .report-preview-toolbar-flex { flex-direction: column; align-items: stretch; }
  .report-preview-toolbar-flex > * { width: 100%; }
  .unit-perf-row { flex-wrap: wrap; }
  .unit-perf-name { width: auto; flex: 1 1 100%; }
  .unit-perf-val { width: 56px; }

  /* Report + two-col meta grids */
  .rms-meta-grid { grid-template-columns: 1fr; }

  /* Import */
  .import-stat { min-width: 100%; }
  .file-card { flex-wrap: wrap; }
  .file-card .btn-remove { width: 100%; justify-content: center; }

  /* Marks / PSR toolbars */
  .psr-table-tools { flex-wrap: wrap; }
  .psr-table-tools .input-field { max-width: 100%; width: 100%; }
  .psr-comment-input { width: 100%; max-width: 100%; }
  .psr-table-pager { flex-wrap: wrap; gap: 6px; }
  .psr-table-pager .psr-pager-btns { margin-left: 0; flex-wrap: wrap; }
  .psr-count { white-space: normal; }
}

@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
  .unit-perf-name { flex: 1 1 auto; width: auto; }
  .unit-perf-val { width: 48px; }

  /* Inline flex rows inside cards wrap instead of overflowing */
  .card > div[style*="display:flex"],
  .card-header > div[style*="display:flex"] { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .app-header { padding: 8px 12px; }
  .main-content { padding: 12px; padding-top: 14px; }
  .card, .stat-card, .action-card { padding: 18px; }

  .modal-overlay { padding: 10px; align-items: stretch; }
  .modal { max-height: 92dvh; }
  .modal-header { padding: 18px 18px 0; font-size: 16px; }
  .modal-body { padding: 14px 18px; }
  .modal-footer { padding: 12px 18px; }

  .report-signatures { grid-template-columns: 1fr; }
  .report-summary-grid { grid-template-columns: 1fr; }
  .grade-bar-label { width: 58px; }
  .grade-bar-count { width: 72px; font-size: 10px; }
  .rms-report-header { flex-direction: column; align-items: center; text-align: center; gap: 10px; }
  .rms-summary { flex-direction: column; }
  .rms-a4-page, .rms-a4-container { padding: 10px !important; }

  .page-header h2 { font-size: 18px; }
  .stat-card .stat-value { font-size: 22px; }
  .col-actions { flex-wrap: wrap; }
}

/* Drawer open => lock background scrolling behind the sheet */
.app-layout.sb-mobile-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .sidebar, .main-wrapper, .app-header, .sidebar-backdrop { transition: none !important; }
}

/* ============================================================
   NOTIFICATION CENTER
   ============================================================ */
.notify-dropdown {
  min-width: 280px;
  max-width: 320px;
  font-size: 13px;
}
.notify-dropdown h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
}
.notify-dropdown .btn {
  margin-top: 8px;
  width: 100%;
}
.notify-badge {
  background: var(--red-600);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  position: absolute;
  top: 4px;
  right: 4px;
  border-radius: 9999px;
  padding: 0 4px;
}
.notify-bell {
  position: relative;
  padding: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--gray-600);
}
.notify-bell:hover { color: var(--gray-800); }
.notify-bell:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.notify-dropdown::-webkit-scrollbar { width: 4px; }
.notify-dropdown::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

/* Notification cards */
.notify-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  max-width: 1120px;
  min-height: 0;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
  border-left: 3px solid var(--gray-300);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.notify-card:hover { background: var(--gray-50); border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.notify-card:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.notify-card.unread { border-left-color: var(--blue-600); background: #fff; }
.notify-card.unread:hover { background: var(--blue-50); }
.notify-card.read { color: var(--gray-700); }
.notify-card.priority-urgent { border-left-color: var(--red-600); }
.notify-card.priority-important { border-left-color: var(--amber-600); }
.notify-card.priority-normal { border-left-color: var(--gray-300); }
.notify-card > div { min-width: 0; }
.notify-card .notify-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  color: var(--gray-800);
  overflow-wrap: anywhere;
}
.notify-card .notify-message {
  margin-top: 4px;
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.45;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.notify-card .notify-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  font-size: 11px;
  color: var(--gray-500);
}
.notify-card .notify-meta .notify-sender {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notify-card .notify-meta .notify-time {
  flex: 0 0 auto;
  color: var(--gray-500);
}
.notify-card .notify-action {
  align-self: center;
  margin: 0;
}
.notify-card .notify-action:hover { color: var(--blue-700); }
.notify-actions { display: flex; align-items: center; gap: 6px; }
.notify-card .notify-delete {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--gray-200);
  color: var(--red-600);
  background: #fff;
}
.notify-card .notify-delete:hover { border-color: var(--red-600); background: var(--red-50); }

/* Category icons */
.notify-card .notify-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin: 0;
  border-radius: 6px;
  background: var(--gray-100);
  font-size: 16px;
}
.notify-card.priority-urgent .notify-icon { color: var(--red-600); }
.notify-card.priority-important .notify-icon { color: var(--amber-600); }
.notify-card.priority-normal .notify-icon { color: var(--gray-500); }

/* Notification center page */
.notify-center-page { padding: 20px; }
.notify-center-page .tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--gray-100);
  padding: 6px 12px;
  border-radius: var(--radius);
}
.notify-center-page .tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--gray-500);
}
.notify-center-page .tab-btn.active {
  background: var(--blue-600);
  color: white;
}
.notify-center-page .tab-btn:not(.active):hover {
  color: var(--gray-700);
}
.notify-center-page #notify-cards-container {
  display: grid;
  gap: 12px;
}
.notify-card-empty {
  padding: 40px;
  text-align: center;
  color: var(--gray-400);
  font-size: 13px;
}

/* Announcement acknowledgment */
.announcement-ack {
  background: var(--gray-100);
  padding: 12px;
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: 13px;
}
.announcement-ack p { margin: 4px 0; }
.announcement-ack .ack-progress {
  width: 100%;
  height: 4px;
  background: var(--gray-300);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}
.announcement-ack .ack-progress-filled {
  height: 100%;
  background: var(--blue-600);
  width: 0%;
  transition: width .3s ease;
}

/* Dashboard announcement banner */
.dashboard-announcement {
  background: var(--blue-600);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDown .4s ease;
}
.dashboard-announcement.urgent {
  background: var(--red-600);
  box-shadow: 0 2px 8px rgba(239,68,68,.15);
}
.dashboard-announcement .announce-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.dashboard-announcement .announce-close {
  margin-left: auto;
  opacity: 0.7;
  cursor: pointer;
  font-size: 18px;
}
.dashboard-announcement .announce-close:hover { opacity: 1; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   RMS-MIS PWA RESPONSIVE DESIGN
   ============================================================ */

/* ---------- Mobile Drawer ---------- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  opacity: 0;
  transition: opacity .3s ease;
}
.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
  }
  .sidebar-backdrop.visible {
    display: block;
    z-index: 999;
  }
  #app-layout {
    margin-left: 0 !important;
  }
  #app-layout.sb-mobile-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  .sidebar-toggle-btn {
    display: flex !important;
  }
  .main-wrapper {
    width: 100%;
  }
}

/* ---------- Mobile Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---------- Mobile Touch Targets ---------- */
@media (max-width: 768px) {
  .btn {
    min-height: 44px;
    font-size: 14px;
    padding: 10px 16px;
  }
  .nav-link {
    min-height: 44px;
    padding: 10px 16px;
  }
  .input-field {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom */
  }
  select.select-field {
    min-height: 44px;
    font-size: 16px;
  }
}

/* ---------- Mobile Cards ---------- */
@media (max-width: 640px) {
  .teacher-card-grid {
    grid-template-columns: 1fr !important;
  }
  .grid-4 {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .card {
    padding: 12px !important;
    margin: 8px !important;
  }
  .form-group {
    margin-bottom: 12px;
  }
}

/* ---------- Mobile Tables ---------- */
@media (max-width: 768px) {
  table {
    font-size: 13px;
  }
  th, td {
    padding: 6px 8px;
  }
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- Mobile Marks Entry ---------- */
@media (max-width: 640px) {
  .marks-grid {
    grid-template-columns: 1fr !important;
  }
  .mark-cell {
    min-height: 48px;
    font-size: 16px; /* Prevents iOS zoom */
  }
}

/* ---------- Mobile Reports ---------- */
@media (max-width: 768px) {
  .report-toolbar {
    flex-direction: column;
    gap: 8px;
  }
  .report-preview {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- Mobile Install Banner ---------- */
#pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #0d2f6b, #2563eb);
    color: #fff;
    padding: 14px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,.2);
    font-family: 'Poppins', sans-serif;
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.4,0,.2,1), opacity .4s ease;
  }
  #pwa-install-banner.at-banner-visible {
    transform: translateY(0);
    opacity: 1;
  }
  #pwa-install-banner .install-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  #pwa-install-banner .install-left {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  #pwa-install-banner .install-left img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }
  #pwa-install-banner .install-left div {
    display: flex;
    flex-direction: column;
  }
  #pwa-install-banner .install-title {
    font-weight: 700;
    font-size: 14px;
  }
  #pwa-install-banner .install-sub {
    font-size: 11px;
    opacity: .8;
  }
  #pwa-install-banner .install-actions {
    display: flex;
    gap: 8px;
  }
  #pwa-install-banner .install-btn {
    background: #fff;
    color: #0d2f6b;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: transform .15s;
  }
  #pwa-install-banner .install-btn:active {
    transform: scale(.95);
  }
  #pwa-install-banner .dismiss-btn {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
  }

/* ---------- Mobile FAB ---------- */
#pwa-fab {
    display: none !important;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d2f6b, #2563eb);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
    font-size: 24px;
  }
  #pwa-fab:active {
    transform: scale(.9);
  }
  #pwa-fab:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.4);
  }

/* ---------- Mobile Snackbar ---------- */
#pwa-snackbar {
    display: none !important;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    max-width: 90vw;
    text-align: center;
    display: none;
  }
  #pwa-snackbar .snackbar-text {
    flex: 1;
  }
  #pwa-snackbar .snackbar-btn {
    background: #fff;
    color: #333;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
  }
  #pwa-snackbar .snackbar-dismiss {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    margin-left: 4px;
  }

/* ---------- Safe Area Notches ---------- */
@supports (padding: max(0px)) {
  .app-header {
    padding-top: max(8px, env(safe-area-inset-top));
  }
  #pwa-install-banner {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* ---------- Responsive Login ---------- */
@media (max-width: 640px) {
  .login-shell {
    width: 95vw;
    margin: auto;
  }
  .login-brand-title {
    font-size: 24px !important;
  }
  .login-features {
    flex-direction: column;
    gap: 8px;
  }
}

/* ---------- Responsive Admin Dashboard ---------- */
@media (max-width: 768px) {
  .admin-stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .admin-content {
    padding: 12px !important;
  }
}

/* ---------- Scroll to top on mobile ---------- */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
  }
}

/* ---------- Prevent horizontal scroll ---------- */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ---------- Print improvements ---------- */
@media print {
  .sidebar,
  #pwa-install-banner,
  #pwa-fab,
  #pwa-snackbar,
  #notify-dropdown,
  .sidebar-toggle-btn {
    display: none !important;
  }
  #app-layout {
    margin-left: 0 !important;
  }
}

/* ---------- sb-mobile-open ---------- */
.app-layout.sb-mobile-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ---------- Safe Area ---------- */
@supports (padding: max(0px)) {
  .app-header {
    padding-top: max(8px, env(safe-area-inset-top));
  }
  #pwa-install-banner {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* ---------- High contrast mode ---------- */
@media (prefers-contrast: high) {
  :root {
    --gray-800: #000;
    --gray-600: #333;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   GLOBAL RESPONSIVE FIXES — All Pages
   ============================================================ */

/* Prevent horizontal scroll */
html {
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  overflow-x: hidden;
  max-width: 100vw;
  margin: 0;
  padding: 0;
}

/* ---------- Base Mobile Fixes ---------- */
@media (max-width: 768px) {
  /* Ensure all text is readable */
  html { font-size: 14px; }

  /* Prevent zoom on input focus (iOS) */
  input, select, textarea, button {
    font-size: 16px !important;
  }

  /* Full-width layout */
  #app-layout {
    flex-direction: column !important;
    width: 100vw !important;
    margin-left: 0 !important;
    overflow-x: hidden !important;
  }

  .main-wrapper {
    width: 100vw;
    max-width: 100vw;
    padding: 12px !important;
  }

  #main-content {
    padding: 12px !important;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Header */
  .app-header {
    padding: 8px 12px !important;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* Main content area */
  .main-wrapper {
    padding: 12px !important;
    margin-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Cards */
  .card {
    padding: 14px !important;
    margin-bottom: 12px !important;
    max-width: 100% !important;
  }

  /* Tables */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    max-width: 100vw;
  }
  table {
    font-size: 13px;
    min-width: 600px;
  }
  th, td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  /* Forms */
  .form-group {
    margin-bottom: 14px;
  }
  .form-group label {
    font-size: 14px;
    margin-bottom: 4px;
  }
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 44px;
    font-size: 16px;
    padding: 10px 12px;
  }

  /* Buttons */
  .btn {
    min-height: 44px;
    font-size: 14px;
    padding: 10px 16px;
    white-space: nowrap;
  }
  .btn-sm {
    min-height: 36px;
    font-size: 12px;
    padding: 6px 10px;
  }

  /* Modals */
  .modal-overlay {
    padding: 8px !important;
  }
  .modal {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: 8px auto !important;
  }
  .modal-header {
    padding: 16px !important;
    font-size: 16px !important;
  }
  .modal-body {
    padding: 16px !important;
  }
  .modal-footer {
    padding: 12px 16px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer .btn {
    flex: 1 1 45%;
    min-width: 0;
  }

  /* Sidebar stays mounted so the fixed mobile drawer can open. */
  .sidebar-toggle-btn {
    display: flex !important;
  }
}

/* ---------- Tablet (769px - 1024px) ---------- */
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .card {
    padding: 18px !important;
  }
  #sidebar {
    width: 220px !important;
  }
  #sidebar .sidebar-nav {
    font-size: 14px;
  }
}

/* ---------- Laptop (1025px+) ---------- */
@media (min-width: 1025px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .grid-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #sidebar {
    width: 260px !important;
  }
}

/* ---------- Large Desktop (1440px+) ---------- */
@media (min-width: 1440px) {
  #app-layout {
    max-width: 1400px;
    margin: 0 auto !important;
  }
  .main-wrapper {
    max-width: 1400px !important;
  }
}

/* ---------- Specific Page Fixes ---------- */

/* Login Page */
@media (max-width: 480px) {
  .login-page {
    padding: 16px !important;
  }
  .login-shell {
    width: 95vw !important;
    padding: 20px !important;
  }
  .login-brand-title {
    font-size: 22px !important;
  }
  .login-brand-subtitle {
    font-size: 14px !important;
  }
  .login-features {
    flex-direction: column;
    gap: 8px;
  }
  .login-feature {
    font-size: 13px;
  }
}

/* Dashboard */
@media (max-width: 768px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .dashboard-card {
    padding: 14px !important;
  }
  .dashboard-card-value {
    font-size: 24px !important;
  }
  .dashboard-card-label {
    font-size: 12px !important;
  }
}

/* Marks Entry */
@media (max-width: 768px) {
  .marks-entry-grid {
    grid-template-columns: 1fr !important;
  }
  .marks-header {
    flex-direction: column;
    gap: 8px;
  }
  .marks-form {
    padding: 12px !important;
  }
}

/* Reports */
@media (max-width: 768px) {
  .report-toolbar {
    flex-direction: column;
    gap: 8px;
  }
  .report-toolbar .btn {
    width: 100%;
    justify-content: center;
  }
  .report-preview {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .report-settings {
    flex-direction: column;
  }
}

/* Notification Center */
#notify-center-page {
  position: fixed;
  inset: 0;
  z-index: 150;
  overflow-y: auto;
  background: var(--gray-50);
}
.notify-center-header,
.notify-center-filters,
#notify-cards-container,
#no-notifications {
  width: min(100%, 1120px);
  margin-right: auto;
  margin-left: auto;
}
.notify-center-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gray-200);
}
.notify-center-filters .btn { margin-left: auto; }
#notify-cards-container { display: grid; gap: 8px; }
.notify-center-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}
.notify-center-header h2 { margin: 0; font-size: 20px; }
@media (max-width: 768px) {
  #notify-center-page { padding: 14px !important; }
  .notify-center-filters { gap: 6px; }
  .notify-center-filters .btn { margin-left: 0; }
  .notify-card { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .notify-card .notify-icon { width: 28px; height: 28px; }
  .notify-card .notify-action { grid-column: 2; justify-self: start; }
  #notify-dropdown {
    position: fixed;
    right: 8px;
    left: 8px;
    top: 56px;
    min-width: auto;
    width: auto;
    max-width: calc(100vw - 16px);
  }
  #notify-center-page {
    padding: 12px !important;
  }
}

/* ---------- Touch-friendly scrolling ---------- */
@media (hover: none) and (pointer: coarse) {
  .nav-link, .btn, .card, .form-group input, select, textarea {
    min-height: 44px;
  }
  .scroll-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
}

/* ---------- Print ---------- */
@media print {
  .sidebar,
  #pwa-install-banner,
  #pwa-fab,
  #pwa-snackbar,
  #notify-dropdown,
  .sidebar-toggle-btn,
  .app-header {
    display: none !important;
  }
  #app-layout {
    margin-left: 0 !important;
    width: 100% !important;
  }
  #main-content {
    padding: 0 !important;
    max-width: 100% !important;
  }
  body {
    overflow-x: visible !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---------- Safe Area Support ---------- */
@supports (padding: max(0px)) {
  .app-header {
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .main-wrapper {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  #pwa-install-banner {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* ---------- Orientation Support ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .app-header {
    padding: 4px 12px !important;
  }
  #main-content {
    padding: 8px !important;
  }
  .card {
    padding: 10px !important;
    margin-bottom: 8px !important;
  }
}

/* ---------- Dark mode support (future) ---------- */
@media (prefers-color-scheme: dark) {
  /* Placeholder for future dark mode */
}

/* ---------- High DPI displays ---------- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .card, .btn, .nav-link, .form-group input, select, textarea {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ---------- Scrollbar styling ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--gray-100);
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ---------- Selection ---------- */
::selection {
  background: var(--blue-200);
  color: var(--blue-900);
}

/* ---------- Focus visible ---------- */
*:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* ---------- Transitions ---------- */
@media (prefers-reduced-motion: no-preference) {
  * {
    scroll-behavior: smooth;
  }
}
/* Examination Centre */
.ec-page{max-width:1440px;margin:0 auto;padding:4px 0 28px}
.ec-page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin:4px 0 20px}
.ec-page-head h2{margin:0 0 6px;font-size:24px;color:var(--gray-900)}
.ec-page-head p{margin:0;color:var(--gray-500)}
.ec-head-actions,.ec-actions,.ec-exam-actions,.ec-question-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.ec-state-legend{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.ec-state-legend span{font-size:11px;color:var(--gray-600);background:var(--gray-50);padding:6px 9px;border-radius:999px}
.ec-exam-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.ec-exam-card{min-width:0;padding:18px;background:#fff;border:1px solid var(--gray-200);border-radius:14px;box-shadow:var(--shadow-sm)}
.ec-exam-card h3{margin:12px 0 7px;font-size:17px;color:var(--gray-900);overflow-wrap:anywhere}
.ec-exam-card p{margin:5px 0;color:var(--gray-600);overflow-wrap:anywhere}
.ec-exam-top{display:flex;justify-content:space-between;align-items:center;gap:8px}
.ec-exam-actions{margin-top:14px}
.ec-exam-card-manage{position:relative;display:flex;min-height:250px;flex-direction:column;overflow:hidden;padding:20px;background:linear-gradient(145deg,#fff 0%,#fbfdff 100%);border-color:#dfe6ef;border-radius:17px;box-shadow:0 2px 7px rgb(15 35 60 / 5%),0 12px 28px rgb(15 35 60 / 4%);transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease}
.ec-exam-card-manage::before{position:absolute;inset:0 0 auto;height:4px;background:linear-gradient(90deg,var(--blue-700),#4d9be0);content:""}
.ec-exam-card-manage:hover{transform:translateY(-3px);border-color:#c5d6e9;box-shadow:0 8px 18px rgb(15 35 60 / 8%),0 20px 42px rgb(15 35 60 / 6%)}
.ec-exam-card-manage .ec-exam-top{min-height:30px}
.ec-exam-card-manage .ec-exam-top .badge{display:inline-flex;align-items:center;gap:7px;padding:6px 10px;border-radius:999px;font-size:11px;font-weight:750;letter-spacing:.035em;text-transform:capitalize}
.ec-exam-status-dot{width:7px;height:7px;border-radius:50%;background:currentColor;box-shadow:0 0 0 3px rgb(255 255 255 / 70%)}
.ec-exam-status-open{color:#087443;background:#eaf8f0;border:1px solid #c8ecd7}
.ec-exam-status-draft{color:#965c08;background:#fff6e5;border:1px solid #f5dfb3}
.ec-exam-status-published{color:#205e9d;background:#eef6ff;border:1px solid #d2e5fa}
.ec-exam-status-closed,.ec-exam-status-archived{color:#5c6573;background:#f1f3f6;border:1px solid #e0e4e9}
.ec-exam-count{display:inline-flex;align-items:center;gap:6px;color:var(--gray-500);font-size:11px;font-weight:600;text-align:right}
.ec-exam-count svg{width:14px;height:14px;color:var(--blue-700)}
.ec-exam-card-manage h3{display:-webkit-box;margin:16px 0 8px;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-size:16px;line-height:1.5;letter-spacing:-.01em}
.ec-exam-card-manage .ec-exam-subject{margin:0;color:var(--gray-700);font-size:13px;font-weight:650}
.ec-exam-details{display:grid;gap:7px;margin-top:10px}
.ec-exam-details span{display:flex;align-items:flex-start;gap:7px;color:var(--gray-500);font-size:12px;line-height:1.45;overflow-wrap:anywhere}
.ec-exam-details svg{width:15px;height:15px;flex:0 0 15px;margin-top:1px;color:#718096}
.ec-exam-card-manage .ec-exam-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:auto;padding-top:18px}
.ec-exam-card-manage .ec-exam-actions .btn{display:inline-flex;min-width:0;min-height:36px;align-items:center;justify-content:center;gap:6px;padding:7px 9px;border-radius:9px;font-size:11px;font-weight:650;line-height:1.2;text-align:center;white-space:normal}
.ec-exam-card-manage .ec-exam-actions .btn svg{width:15px;height:15px;flex:0 0 15px}
.ec-exam-card-manage .ec-exam-actions .badge{display:flex;align-items:center;justify-content:center;min-height:38px}
.ec-exam-card-manage .ec-exam-actions .btn-danger{background:#df3f49;border-color:#df3f49}
.ec-exam-card-manage .ec-exam-actions .btn-warning{background:#ee9800;border-color:#ee9800;color:#fff}
.ec-exam-card-manage .ec-exam-actions .btn-danger:hover{background:#c92f3a;border-color:#c92f3a}
.ec-exam-card-manage .ec-exam-actions .btn-warning:hover{background:#d58400;border-color:#d58400}
@media(prefers-reduced-motion:reduce){.ec-exam-card-manage{transition:none}.ec-exam-card-manage:hover{transform:none}}
.ec-empty{min-height:180px;padding:32px 16px;border:1px dashed var(--gray-300);border-radius:14px;text-align:center;color:var(--gray-500)}
.ec-empty>i{width:34px;height:34px;margin:0 auto 8px}
.ec-empty h3{margin:5px 0;color:var(--gray-800)}
.ec-form{display:grid;gap:9px}
.ec-form .form-label{display:block;margin:4px 0 0;font-size:13px;font-weight:600;color:var(--gray-700)}
.ec-form .grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.ec-class-picker{min-width:0}
.ec-class-picker>p{margin:4px 0 8px}
#ec-class-list{max-height:190px;overflow:auto;padding:8px 10px;border:1px solid var(--gray-300);border-radius:8px;background:var(--white,#fff)}
#ec-class-list .ec-check{margin:7px 0}
.ec-question-editor{display:grid;gap:14px}
.ec-question-mode{display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:5px;background:var(--gray-100);border-radius:10px}
.ec-question-mode button{display:flex;align-items:center;justify-content:center;gap:8px;min-height:42px;padding:8px 12px;border:0;border-radius:7px;background:transparent;color:var(--gray-600);font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.ec-question-mode button.active{background:#fff;color:var(--blue-700);box-shadow:var(--shadow-sm)}
.ec-question-mode button i{width:17px;height:17px}
.ec-question-mode button:focus-visible,.ec-bulk-format summary:focus-visible{outline:2px solid var(--blue-500);outline-offset:2px}
.ec-question-editor [hidden]{display:none!important}
.ec-bulk-import{min-width:0;padding:18px;border:1px solid var(--gray-200);border-radius:12px;background:linear-gradient(150deg,#f8fbff,#fff 65%)}
.ec-bulk-heading{display:flex;align-items:center;gap:12px}
.ec-bulk-icon{display:grid;place-items:center;width:42px;height:42px;flex:none;border-radius:11px;background:var(--blue-50);color:var(--blue-700)}
.ec-bulk-icon i{width:21px;height:21px}
.ec-bulk-heading h3{margin:0;color:var(--gray-900);font-size:16px}
.ec-bulk-heading p{margin:4px 0 0;color:var(--gray-500);font-size:12px}
.ec-bulk-steps{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0;padding:0;list-style:none}
.ec-bulk-steps li{display:flex;align-items:center;gap:6px;color:var(--gray-600);font-size:11px}
.ec-bulk-steps b{display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--blue-100);color:var(--blue-700);font-size:11px}
.ec-bulk-format{margin-bottom:12px}
.ec-bulk-format summary{color:var(--blue-700);font-size:12px;font-weight:600;cursor:pointer}
.ec-bulk-format pre{max-height:190px;margin:8px 0 0;padding:12px;overflow:auto;white-space:pre-wrap;background:#fff;border:1px solid var(--gray-200);border-radius:8px;font-size:11px;line-height:1.5}
.ec-bulk-import>.form-label{display:block;margin:0 0 6px;font-size:13px;font-weight:600;color:var(--gray-700)}
.ec-bulk-import .ec-bulk-textarea{display:block;width:100%;min-height:260px;resize:vertical;box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:1.55;tab-size:2}
.ec-bulk-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px}
.ec-bulk-actions>span{color:var(--gray-500);font-size:11px}
.ec-bulk-actions .btn{flex:none}
#ec-bulk-preview{margin-top:14px}
#ec-bulk-preview:empty{display:none}
#ec-bulk-preview>p{margin:0 0 8px;color:var(--gray-700);font-size:13px}
#ec-bulk-preview .alert{margin:8px 0}
#ec-bulk-preview .alert ul{margin:6px 0 0;padding-left:20px}
.ec-bulk-review-list{display:grid;gap:10px;max-height:430px;overflow:auto;margin:10px 0}
.ec-bulk-review-card{display:grid;gap:6px;padding:12px;background:#fff;border:1px solid var(--gray-200);border-radius:9px}
.ec-bulk-review-question strong{color:var(--blue-700);font-size:12px}
.ec-bulk-review-question p{margin:4px 0 6px;color:var(--gray-800);font-size:13px;line-height:1.5}
.ec-bulk-review-card .form-label{margin:3px 0 0;font-size:12px;font-weight:600;color:var(--gray-700)}
.ec-bulk-review-card .input-field{width:100%;min-height:40px;box-sizing:border-box}
.ec-bulk-explanation{display:block;margin-top:3px;color:var(--gray-600)}
#ec-bulk-preview>.btn{width:100%;justify-content:center;margin-top:8px}
.ec-check{display:flex;align-items:flex-start;gap:9px;font-size:13px;color:var(--gray-700);margin:4px 0}
.ec-check input{margin-top:3px}
.ec-summary-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:18px 0 24px}
.ec-summary-grid>div{display:flex;flex-direction:column;gap:4px;padding:14px;background:#fff;border:1px solid var(--gray-200);border-radius:12px}
.ec-summary-grid b{font-size:22px;color:var(--blue-700)}
.ec-summary-grid span{font-size:12px;color:var(--gray-500)}
.ec-section-title{display:flex;align-items:center;gap:10px;margin:24px 0 12px;color:var(--gray-900)}
.ec-section-title small{font-size:12px;font-weight:400;color:var(--gray-500)}
.ec-question-list{display:grid;gap:10px}
.ec-question-card{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:15px;background:white;border:1px solid var(--gray-200);border-radius:12px}
.ec-question-card p{margin:9px 0;color:var(--gray-800);white-space:pre-wrap}
.ec-question-card small{color:var(--gray-500)}
.ec-q-number{display:inline-flex;margin-right:8px;font-weight:700;color:var(--blue-700)}
.ec-question-actions{justify-content:flex-end;flex-shrink:0}
.ec-analysis{display:grid;gap:9px;padding:16px;background:white;border:1px solid var(--gray-200);border-radius:12px}
.ec-analysis-row{display:grid;grid-template-columns:36px 1fr auto;align-items:center;gap:12px;font-size:13px}
.ec-analysis-bar{height:9px;background:var(--gray-100);border-radius:20px;overflow:hidden}
.ec-analysis-bar i{display:block;height:100%;background:var(--blue-600);border-radius:inherit}
.ec-options{display:grid;gap:8px;margin:6px 0}
.ec-option-input{display:grid;grid-template-columns:22px 28px 1fr;align-items:center;gap:8px}
.ec-option-input span{font-weight:700;color:var(--gray-700)}
.ec-bank-list{display:grid;gap:8px;max-height:55vh;overflow:auto}
.ec-bank-item{display:flex;align-items:flex-start;gap:10px;padding:10px;border:1px solid var(--gray-200);border-radius:8px}
.ec-bank-item span{font-size:13px}
.ec-preview{max-height:65vh;overflow:auto}
.ec-preview article{padding:14px 0;border-bottom:1px solid var(--gray-200)}
.ec-preview article label{display:block;margin:10px 0}
.ec-taking{max-width:850px;margin:18px auto;padding:clamp(16px,4vw,32px);background:white;border:1px solid var(--gray-200);border-radius:18px;box-shadow:var(--shadow-md)}
.ec-taking-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.ec-timer-label{display:block;font-size:10px;font-weight:700;letter-spacing:.1em;color:var(--gray-500)}
.ec-taking-head strong{display:block;margin-top:3px;font-size:22px;font-variant-numeric:tabular-nums;color:var(--gray-900)}
.ec-taking-head strong.expired{color:var(--red-600)}
.ec-progress{height:7px;margin-top:18px;background:var(--gray-100);border-radius:20px;overflow:hidden}
.ec-progress span{display:block;height:100%;background:var(--blue-600);transition:width .2s ease}
.ec-progress-label{margin:8px 0 20px;font-size:12px;color:var(--gray-500)}
.ec-question-live h1{margin:0 0 20px;font-size:clamp(20px,3vw,27px);line-height:1.4;color:var(--gray-900);white-space:pre-wrap}
.ec-question-image{display:block;max-width:100%;max-height:360px;object-fit:contain;margin:0 auto 18px}
.ec-question-video{display:block;width:min(100%,720px);max-height:420px;margin:0 auto 18px;background:#111;border-radius:10px}
.ec-question-media-preview{display:grid;gap:8px;margin:12px 0}
.ec-question-media{display:grid;gap:7px;min-width:0;margin:6px 0;padding:14px;border:1px solid var(--gray-200);border-radius:10px}
.ec-question-media legend{padding:0 5px;font-size:13px;font-weight:600;color:var(--gray-700)}
.ec-question-media .form-label,.ec-bulk-media .form-label{margin:3px 0 0;font-size:12px;font-weight:600;color:var(--gray-700)}
.ec-question-media .input-field,.ec-bulk-media .input-field{width:100%;min-height:40px;box-sizing:border-box}
.ec-bulk-media{display:grid;gap:7px;margin-top:8px;padding:10px;border:1px solid var(--gray-200);border-radius:8px}
.ec-bulk-media summary{color:var(--blue-700);font-size:12px;font-weight:600;cursor:pointer}
.ec-question-live fieldset{border:0;padding:0;margin:0}
.ec-question-live legend{margin-bottom:10px;font-size:13px;color:var(--gray-500)}
.ec-written-answer{width:100%;min-height:180px;box-sizing:border-box;line-height:1.6}
.ec-marking-list{display:grid;gap:12px;max-height:65vh;overflow:auto}
.ec-marking-item{padding:14px;background:#fff;border:1px solid var(--gray-200);border-radius:10px}
.ec-marking-item h4{margin:0 0 8px;color:var(--blue-700)}
.ec-marking-item p{white-space:pre-wrap;color:var(--gray-800)}
.ec-marking-item .form-label{display:block;margin:10px 0 5px;font-size:12px;font-weight:600;color:var(--gray-700)}
.ec-marking-item .input-field,.ec-marking-item .textarea-field{width:100%;box-sizing:border-box}
.ec-marking-response{padding:12px;background:var(--gray-50);border-radius:8px;white-space:pre-wrap;overflow-wrap:anywhere}
.ec-answer{display:flex;align-items:center;gap:12px;padding:15px;margin:9px 0;border:1.5px solid var(--gray-200);border-radius:12px;cursor:pointer;transition:border-color .15s,background .15s}
.ec-answer:hover,.ec-answer.selected{border-color:var(--blue-500);background:var(--blue-50)}
.ec-answer input{position:absolute;opacity:0;pointer-events:none}
.ec-radio-mark{width:19px;height:19px;flex:0 0 19px;border:2px solid var(--gray-400);border-radius:50%}
.ec-answer.selected .ec-radio-mark{border:6px solid var(--blue-600)}
.ec-answer>span:last-child{line-height:1.45;color:var(--gray-800)}
#ec-save-state{min-height:20px;margin:12px 0 0;font-size:12px;color:var(--gray-500)}
.ec-question-nav{display:flex;justify-content:space-between;gap:12px;margin-top:18px}
.ec-touch{min-height:46px}
.ec-warning{margin:20px 0 0;text-align:center;font-size:12px;color:var(--gray-500)}
.ec-result{max-width:560px;margin:40px auto;padding:30px 22px;text-align:center;background:white;border:1px solid var(--gray-200);border-radius:18px;box-shadow:var(--shadow-sm)}
.ec-result.ec-result-with-review{max-width:960px}
.ec-result-with-review .ec-answer-review{text-align:left}
.ec-result-icon{display:grid;place-items:center;width:56px;height:56px;margin:0 auto 12px;color:var(--green-600);background:var(--green-50);border-radius:50%}
.ec-result-icon svg{width:30px;height:30px}
.ec-result h1{font-size:23px;color:var(--gray-900)}
.ec-result>p{color:var(--gray-600)}
.ec-result-score{display:flex;justify-content:center;align-items:baseline;gap:14px;margin:20px 0}
.ec-result-score strong{font-size:32px;color:var(--blue-700)}
.ec-result-score span{font-size:22px;font-weight:700}
.ec-result-detail{display:grid;grid-template-columns:1fr auto;gap:8px 20px;max-width:300px;margin:0 auto 22px;text-align:left}
.ec-result-detail span{color:var(--gray-600)}
.ec-result-detail b{color:var(--gray-900)}
.ec-answer-review{max-width:900px;margin:0 auto 36px}
.ec-answer-review>.btn{margin-top:20px}
.ec-review-question{margin:14px 0;padding:18px;background:#fff;border:1px solid var(--gray-200);border-radius:12px}
.ec-review-heading{display:flex;justify-content:space-between;gap:12px;color:var(--gray-700)}
.ec-review-prompt{margin:12px 0;font-weight:600;white-space:pre-wrap}
.ec-review-options{display:grid;gap:8px;padding:0;list-style:none}
.ec-review-option{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px;border:1px solid var(--gray-200);border-radius:8px}
.ec-review-option.is-selected{border-color:var(--blue-500);background:var(--blue-50)}
.ec-review-option.is-correct{border-color:var(--green-600);background:var(--green-50)}
.ec-review-option span{margin-left:auto;color:var(--gray-700);font-size:12px;font-weight:600}
.ec-review-outcome,.ec-review-response,.ec-review-feedback{white-space:pre-wrap;color:var(--gray-700)}
.ec-math-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0 0 8px}
.ec-math-tools>span{font-size:12px;font-weight:600;color:var(--gray-700)}
.ec-math-tools .btn{min-width:36px;padding:5px 8px}
.ec-math-tools small{flex-basis:100%;color:var(--gray-500);font-size:11px}
.ec-math-preview-label{margin:8px 0 4px;color:var(--gray-600);font-size:11px;font-weight:600}
.ec-math-preview{min-height:38px;margin-bottom:12px;padding:9px 11px;border:1px solid var(--gray-200);border-radius:8px;background:var(--gray-50);color:var(--gray-700);white-space:pre-wrap;overflow-wrap:anywhere}
.ec-math-preview:empty{display:none}
.ec-question-live mjx-container[display="true"],.ec-review-question mjx-container[display="true"]{overflow-x:auto;overflow-y:hidden;max-width:100%}
.ec-guest-page{max-width:900px;margin:0 auto}
.ec-guest-form{display:grid;gap:9px;max-width:520px;margin:18px 0;padding:20px;background:#fff;border:1px solid var(--gray-200);border-radius:14px;box-shadow:var(--shadow-sm)}
.ec-guest-form .form-label{margin:4px 0 0;font-size:13px;font-weight:600;color:var(--gray-700)}
.ec-guest-form .input-field{width:100%;min-height:44px;box-sizing:border-box}
.ec-guest-form .btn{margin-top:6px}
@media(max-width:1000px){.ec-exam-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.ec-page-head{flex-direction:column}.ec-head-actions{width:100%}.ec-exam-grid{grid-template-columns:1fr}.ec-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ec-form .grid-2{grid-template-columns:1fr}.ec-question-card{flex-direction:column}.ec-question-actions{justify-content:flex-start}.ec-taking{margin:8px auto;padding:16px;border-radius:12px}.ec-answer{padding:13px 11px}.ec-question-nav .btn{padding:10px 12px;font-size:13px}.ec-bulk-import{padding:14px}.ec-bulk-import .ec-bulk-textarea{min-height:210px}.ec-bulk-actions{align-items:stretch;flex-direction:column}.ec-bulk-actions .btn{width:100%;justify-content:center}.ec-question-mode button{padding:8px 6px;font-size:12px}.ec-bulk-steps{gap:6px}.ec-bulk-steps li{font-size:10px}}
