/* ── Fonts ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Cairo:wght@600;700;800;900&display=swap');

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

:root {
  --primary:    #0b4a8a;
  --primary-dk: #073669;
  --primary-lt: #2774c4;
  --accent:     #14b8a6;
  --accent-2:   #0891b2;
  --gold:       #d97706;
  --success:    #059669;
  --danger:     #dc2626;
  --warn:       #d97706;
  --bg:         #f6f8fc;
  --bg-tint:    #eef3fa;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --border-strong:#cbd5e1;
  --text:       #0f172a;
  --muted:      #64748b;
  --radius-sm:  10px;
  --radius:     16px;
  --radius-lg:  22px;
  --shadow-sm:  0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow:     0 8px 24px -8px rgba(11,74,138,.18), 0 2px 6px rgba(15,23,42,.04);
  --shadow-lg:  0 24px 60px -20px rgba(11,74,138,.28);
  --grad-hero:  linear-gradient(135deg,#062b54 0%,#0b4a8a 45%,#0e7490 100%);
  --grad-soft:  linear-gradient(135deg,#eef3fa 0%,#e0f2fe 100%);
}

html, body {
  height: 100%;
  font-family: 'Tajawal','Cairo','Segoe UI',Tahoma,Arial,sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  font-feature-settings: "kern","liga","calt";
  letter-spacing: 0;
}

h1,h2,h3,h4 { font-family:'Cairo','Tajawal',sans-serif; letter-spacing:-0.01em; }

/* ── Screen System ────────────────────────────────────── */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ── Shared Page Wrapper ─────────────────────────────── */
.page-wrap {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* ── Top Nav Bar ─────────────────────────────────────── */
.topbar {
  background: linear-gradient(180deg,var(--primary) 0%,var(--primary-dk) 100%);
  color: #fff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 6px 24px -10px rgba(7,54,105,.55);
}
.topbar-back {
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  border-radius: 8px;
  width: 36px; height: 36px;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.topbar-back:hover { background: rgba(255,255,255,.3); }
.topbar-title { font-size: 17px; font-weight: 700; flex: 1; }
.topbar-sub { font-size: 12px; opacity: .8; }

/* ── Identity Screen ─────────────────────────────────── */
#screen-identity {
  background: linear-gradient(145deg, #0f3d6e 0%, #1a5fa8 50%, #0ea5e9 100%);
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}
.identity-hero { margin-bottom: 48px; }
.identity-icon { font-size: 72px; margin-bottom: 16px; }
.identity-hero h1 {
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}
.identity-hero p { color: rgba(255,255,255,.8); font-size: 15px; }
.identity-school { color: rgba(255,255,255,.7); font-size: 13px; margin-top: 6px; }

.identity-cards {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.identity-card {
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: 22px;
  padding: 34px 28px;
  width: 210px;
  color: #fff;
  cursor: pointer;
  transition: transform .25s ease, background .25s ease, border-color .25s ease, box-shadow .25s ease;
  text-align: center;
  font-family: inherit;
}
.identity-card:hover {
  background: rgba(255,255,255,.18);
  transform: translateY(-6px);
  border-color: rgba(255,255,255,.55);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.45);
}
.identity-card .card-icon { font-size: 44px; margin-bottom: 14px; }
.identity-card .card-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.identity-card .card-desc { font-size: 13px; opacity: .8; line-height: 1.5; }

/* ── Cards / Panels ──────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.card-title-sm {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* ── Form Elements ───────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.form-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s, background .2s;
  direction: rtl;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-lt);
  box-shadow: 0 0 0 4px rgba(39,116,196,.15);
  background: #fbfdff;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  border: none; border-radius: 12px; padding: 14px 28px;
  font-size: 15px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
  text-decoration: none; letter-spacing: 0;
}
.btn-primary {
  background: linear-gradient(135deg,var(--primary-lt),var(--primary));
  color: #fff; width: 100%;
  box-shadow: 0 10px 24px -10px rgba(11,74,138,.55);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -12px rgba(11,74,138,.6); }
.btn-primary:active { transform: translateY(0); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 10px 24px -10px rgba(5,150,105,.5); }
.btn-success:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-outline {
  background: transparent; border: 1.5px solid var(--border-strong);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background:#f1f6fc; }
.btn-sm { padding: 9px 18px; font-size: 13px; border-radius: 10px; }
.btn-full { width: 100%; }

/* ── Page Titles ─────────────────────────────────────── */
.page-title {
  font-size: 22px; font-weight: 800; color: var(--primary);
  margin-bottom: 6px;
}
.page-sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }

/* ── Service Cards (Home) ────────────────────────────── */
.service-section-title {
  font-size: 15px; font-weight: 800; margin-bottom: 16px; color: var(--text);
  text-transform: none; letter-spacing: 0; position: relative; padding-right: 14px;
}
.service-section-title::before {
  content:""; position:absolute; right:0; top:50%; transform:translateY(-50%);
  width:4px; height:18px; border-radius:4px; background:linear-gradient(180deg,var(--primary-lt),var(--accent));
}
.service-cards { display: flex; flex-direction: column; gap: 14px; }
.service-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  text-align: right;
  position: relative;
}
.service-card.active { border-color: #bcd6ee; }
.service-card.active::after{
  content:""; position:absolute; right:0; top:14px; bottom:14px; width:3px;
  border-radius:3px; background:linear-gradient(180deg,var(--primary-lt),var(--accent));
}
.service-card.active:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color:var(--primary-lt); }
.service-card.disabled { opacity: .55; cursor: not-allowed; }
.service-card-icon {
  width: 58px; height: 58px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.service-card.active .service-card-icon { background: linear-gradient(135deg,#e0f2fe,#dbeafe); }
.service-card.disabled .service-card-icon { background: #f1f5f9; }
.service-card-info { flex: 1; }
.service-card-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.service-card-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }
.service-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; white-space: nowrap;
}
.badge-active { background: #d1fae5; color: #065f46; }
.badge-soon   { background: #f1f5f9; color: #64748b; }

/* ── Self-Diagnostic Table ───────────────────────────── */
.diag-section-head {
  font-size: 14px; font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px 8px 0 0;
  margin-top: 20px;
}
.diag-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.diag-table th {
  background: #e0eaf8; font-size: 12px; font-weight: 700;
  padding: 10px 12px; color: var(--primary-dk);
}
.diag-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.diag-table tr:last-child td { border-bottom: none; }
.diag-table tr:hover td { background: #f8fbff; }
.diag-options { display: flex; gap: 10px; }
.diag-option { cursor: pointer; }
.diag-option input { display: none; }
.diag-option label {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  border: 2px solid var(--border);
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .2s;
  color: var(--muted);
}
.diag-option input:checked + label {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.diag-option.opt-mastered input:checked + label { background: var(--success); border-color: var(--success); }
.diag-option.opt-partial  input:checked + label { background: var(--warn);    border-color: var(--warn); color: #fff; }
.diag-option.opt-need     input:checked + label { background: var(--danger);  border-color: var(--danger); }

/* ── Pre-Test ────────────────────────────────────────── */
.test-progress-bar-wrap {
  background: #dbeafe; border-radius: 99px; height: 8px; margin-bottom: 6px;
}
.test-progress-bar {
  background: var(--primary); height: 8px; border-radius: 99px;
  transition: width .3s;
}
.test-progress-label { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.test-section-badge {
  display: inline-block; padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 700; margin-bottom: 16px;
}
.badge-verbal { background: #dbeafe; color: #1e40af; }
.badge-quant  { background: #dcfce7; color: #166534; }

.q-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.q-num { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.q-text { font-size: 16px; font-weight: 600; line-height: 1.7; margin-bottom: 22px; }
.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 10px;
  border: 1.5px solid var(--border);
  cursor: pointer; transition: all .2s; font-size: 15px;
}
.q-opt:hover { border-color: var(--primary-lt); background: #f1f7fd; }
.q-opt.selected { border-color: var(--primary); background: #e0edfa; font-weight: 700; box-shadow: inset 0 0 0 1px var(--primary); }
.q-opt.dont-know { border-color: #94a3b8; background: #f8fafc; color: var(--muted); font-style: italic; }
.q-opt.dont-know.selected { border-color: #64748b; background: #f1f5f9; color: var(--text); }
.opt-circle {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; transition: all .2s;
}
.q-opt.selected .opt-circle { background: var(--primary); border-color: var(--primary); }

.test-nav { display: flex; gap: 12px; margin-top: 8px; }
.test-nav .btn { flex: 1; }

/* ── Result / Plan ───────────────────────────────────── */
.status-banner {
  border-radius: var(--radius); padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px;
}
.status-banner.pending { background: #fef9c3; border: 1.5px solid #fde68a; }
.status-banner.active  { background: #dcfce7; border: 1.5px solid #86efac; }
.status-icon { font-size: 36px; }
.status-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.status-desc  { font-size: 13px; color: var(--muted); line-height: 1.5; }

.gap-list { display: flex; flex-direction: column; gap: 12px; }
.gap-item {
  background: var(--surface); border-radius: 10px;
  padding: 14px 16px; border: 1.5px solid var(--border);
}
.gap-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.gap-skill { font-size: 14px; font-weight: 700; flex: 1; }
.gap-score {
  font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 99px; white-space: nowrap;
}
.score-low  { background: #fee2e2; color: #991b1b; }
.score-mid  { background: #fef9c3; color: #854d0e; }
.score-high { background: #dcfce7; color: #166534; }
.gap-rec  { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── Admin Dashboard ─────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

.student-list { display: flex; flex-direction: column; gap: 10px; }
.student-row {
  background: var(--surface); border-radius: 10px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.student-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.student-info { flex: 1; }
.student-name { font-size: 15px; font-weight: 700; }
.student-code { font-size: 12px; color: var(--muted); }
.student-badge { font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 20px; }
.sbadge-pending { background: #fef9c3; color: #854d0e; }
.sbadge-active  { background: #dcfce7; color: #166534; }
.sbadge-new     { background: #f1f5f9; color: #64748b; }

/* ── Plan Approve Modal ──────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 200;
  justify-content: center; align-items: flex-start;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 18px;
  padding: 28px; width: 100%; max-width: 600px;
  box-shadow: 0 16px 64px rgba(0,0,0,.2);
  margin: auto;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* ── Tabs ────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: #e0eaf8; border-radius: 10px; padding: 4px; }
.tab-btn {
  flex: 1; padding: 10px; border: none; background: transparent;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; font-family: inherit; transition: all .2s;
}
.tab-btn.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 6px rgba(0,0,0,.1); }

/* ── Intro Screen ────────────────────────────────────── */
.intro-box {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border-radius: var(--radius); padding: 28px;
  border: 1.5px solid #bfdbfe; margin-bottom: 20px;
}
.intro-box p { font-size: 15px; line-height: 2; color: var(--text); }
.intro-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.intro-step {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border-radius: 12px; padding: 16px;
  border: 1px solid var(--border);
}
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
}
.step-text { font-size: 14px; line-height: 1.7; color: var(--text); }

/* ── Processing / Loading ────────────────────────────── */
.processing-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh;
  background: var(--bg); text-align: center; padding: 40px;
}
.processing-icon { font-size: 72px; margin-bottom: 24px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }
.processing-title { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 12px; }
.processing-sub { font-size: 15px; color: var(--muted); line-height: 1.7; }
.processing-bar {
  width: 200px; height: 6px; background: #dbeafe;
  border-radius: 99px; margin: 24px auto;
  overflow: hidden;
}
.processing-bar-fill {
  height: 100%; width: 0%;
  background: var(--primary); border-radius: 99px;
  animation: loading 2.5s ease forwards;
}
@keyframes loading { to { width: 100%; } }

/* ── Alert / Toast ───────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  margin-bottom: 16px; display: none;
}
.alert.show { display: block; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info  { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Admin Note Textarea ─────────────────────────────── */
.admin-note {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px; font-size: 14px; font-family: inherit;
  direction: rtl; resize: vertical; min-height: 80px;
  margin-top: 10px;
}
.admin-note:focus { outline: none; border-color: var(--accent); }

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; }
.empty-state p { font-size: 15px; }

/* ── Responsive ──────────────────────────────────────── */
/* Make wide self-diagnostic table horizontally scrollable on small screens */
#selfdiag-content { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─ Tablet & up (≥ 768px) ─ */
@media (min-width: 768px) {
  .page-wrap { padding: 32px 28px 56px; max-width: 820px; }
  .topbar { padding: 18px 32px; }
  .topbar-title { font-size: 19px; }
  .card { padding: 32px; }
  .welcome-banner { padding: 32px 36px; }
  .welcome-banner h2 { font-size: 24px; }
  .welcome-banner p  { font-size: 15px; }
}

/* ─ Desktop (≥ 1024px) ─ */
@media (min-width: 1024px) {
  .page-wrap { max-width: 1040px; padding: 40px 40px 64px; }
  .service-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .service-card { padding: 22px 24px; }
  .identity-card { width: 240px; padding: 40px 32px; }
  .identity-card .card-icon { font-size: 52px; }
  .identity-card .card-title { font-size: 22px; }
  .stat-num { font-size: 32px; }
  .stat-lbl { font-size: 13px; }
  .page-title { font-size: 26px; }
  .q-card { padding: 32px 36px; }
  .q-text { font-size: 17px; }
}

/* ─ Large desktop (≥ 1280px) ─ */
@media (min-width: 1280px) {
  .page-wrap { max-width: 1160px; }
}

/* ─ Small phones (≤ 640px) ─ */
@media (max-width: 640px) {
  .page-wrap { padding: 18px 14px 32px; }
  .topbar { padding: 14px 16px; gap: 10px; }
  .topbar-title { font-size: 15px; }
  .topbar-sub   { font-size: 11px; }
  .topbar-back  { width: 34px; height: 34px; font-size: 16px; }
  .card { padding: 20px 18px; border-radius: 14px; }
  .welcome-banner { padding: 20px 18px; border-radius: 16px; }
  .welcome-banner h2 { font-size: 17px; }
  .welcome-banner p  { font-size: 13px; }
  .page-title { font-size: 19px; }
  .page-sub   { font-size: 13px; }
  .btn { padding: 13px 20px; font-size: 14.5px; }
  /* service cards: tighter */
  .service-card { padding: 16px 16px; gap: 12px; border-radius: 14px; }
  .service-card-icon { width: 50px; height: 50px; font-size: 24px; border-radius: 14px; }
  .service-card-name { font-size: 15px; }
  .service-card-desc { font-size: 12.5px; }
  /* diag table: shrink dots & padding so it fits without scroll on most phones */
  .diag-table th { font-size: 11px; padding: 8px 6px; }
  .diag-table td { padding: 9px 6px; font-size: 13px; }
  .diag-table th:nth-child(n+2),
  .diag-table td:nth-child(n+2) { width: 56px; }
  .diag-dot { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
  .diag-section-head { font-size: 13px; padding: 9px 12px; }
  /* questions */
  .q-card { padding: 18px 16px; border-radius: 14px; }
  .q-text { font-size: 15px; line-height: 1.65; margin-bottom: 16px; }
  .q-opt  { padding: 11px 13px; font-size: 14px; }
  .test-nav { flex-direction: row; gap: 10px; }
  /* identity */
  .identity-cards { flex-direction: column; align-items: stretch; width: 100%; max-width: 360px; }
  .identity-card  { width: 100%; padding: 26px 22px; }
  .identity-card .card-icon  { font-size: 40px; }
  .identity-card .card-title { font-size: 18px; }
  /* admin */
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-box { padding: 12px 8px; }
  .stat-num { font-size: 20px; }
  .stat-lbl { font-size: 11px; line-height: 1.3; }
  .student-row { padding: 12px; gap: 10px; flex-wrap: wrap; }
  .student-avatar { width: 38px; height: 38px; font-size: 15px; }
  .student-name { font-size: 14px; }
  .student-code { font-size: 11px; }
  .student-row .btn-sm { flex: 1; }
  .tabs { gap: 2px; padding: 3px; }
  .tab-btn { padding: 9px 4px; font-size: 12px; }
  /* modal */
  .modal-overlay { padding: 12px; }
  .modal-box { padding: 20px; border-radius: 14px; }
  .modal-actions { flex-direction: column; gap: 10px; }
  /* intro */
  .intro-box { padding: 18px; }
  .intro-box p { font-size: 14px; line-height: 1.8; }
  .intro-step { padding: 13px; gap: 12px; }
  .step-text  { font-size: 13.5px; }
}

/* Very small phones (≤ 360px) — keep diag table from clipping */
@media (max-width: 360px) {
  .diag-table th, .diag-table td { padding: 7px 4px; }
  .diag-dot { width: 28px; height: 28px; font-size: 11px; }
}
