/* ==========================================================================
   سامانه ارزیابی روان‌شناختی — Design System
   Persian / RTL, mobile-first, zero JavaScript, no external assets.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces */
  --bg: #f2f5fa;
  --bg-deep: #0b1730;
  --panel: #ffffff;
  --panel-soft: #f7f9fd;
  --panel-alt: #eef3fb;

  /* Text */
  --text: #101a2e;
  --text-2: #35435c;
  --muted: #667690;
  --on-dark: #f4f8ff;
  --on-dark-muted: #a9bcdc;

  /* Lines */
  --border: #e0e7f2;
  --border-strong: #c9d5e8;

  /* Brand */
  --primary: #2455c9;
  --primary-dark: #1a3f9d;
  --primary-soft: #eaf0ff;
  --primary-ring: rgba(36, 85, 201, .28);
  --accent: #0f9d8f;
  --accent-soft: #e6f7f4;

  /* Status */
  --success: #0f7a56;
  --success-soft: #e6f8f1;
  --warning: #96620a;
  --warning-soft: #fff4de;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --violet: #6d3fa0;
  --violet-soft: #f4eefb;

  /* Radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Elevation */
  --sh-1: 0 1px 2px rgba(16, 26, 46, .05), 0 1px 3px rgba(16, 26, 46, .04);
  --sh-2: 0 4px 12px rgba(16, 26, 46, .06), 0 2px 4px rgba(16, 26, 46, .04);
  --sh-3: 0 14px 34px rgba(16, 26, 46, .09), 0 4px 10px rgba(16, 26, 46, .04);
  --sh-4: 0 28px 60px rgba(11, 23, 48, .16);

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;

  /* Motion */
  --ease: cubic-bezier(.4, .14, .3, 1);
  --fast: .16s;
  --base: .24s;

  --font: "Vazirmatn", "Vazir", "IRANSansX", "IRANSans", "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
  --shell-w: min(1240px, 100% - 2 * var(--gutter));
  --gutter: 16px;
}

@media (min-width: 768px) { :root { --gutter: 28px; } }
@media (min-width: 1280px) { :root { --gutter: 40px; } }

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }

body {
  overflow-x: clip;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 520px at 100% -10%, #e6edff 0%, rgba(230, 237, 255, 0) 60%),
    radial-gradient(900px 460px at 0% 0%, #e7f7f5 0%, rgba(231, 247, 245, 0) 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: anywhere;
  word-break: normal;
}

img, svg, video { max-width: 100%; height: auto; }

a { color: var(--primary); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 var(--s-2); letter-spacing: -.2px; font-weight: 800; }
h1 { font-size: clamp(22px, 5vw, 32px); }
h2 { font-size: clamp(17px, 3vw, 20px); }
h3 { font-size: 16px; }
p { margin: 0 0 var(--s-3); color: var(--text-2); }
p:last-child { margin-bottom: 0; }
ul { padding-inline-start: 1.2em; margin: 0 0 var(--s-3); }

.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 13px; line-height: 1.7; }
.eyebrow {
  display: inline-block; color: var(--primary); font-weight: 700;
  font-size: 12px; letter-spacing: .3px; margin-bottom: var(--s-1);
}

code {
  direction: ltr; display: inline-block; font-family: "SFMono-Regular", Consolas, monospace;
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 1px 7px; font-size: 13px; user-select: all;
}

:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; border-radius: 6px; }

::selection { background: var(--primary-soft); }

/* --------------------------------------------------------------------------
   3. App shell
   -------------------------------------------------------------------------- */
.container {
  width: var(--shell-w);
  margin: var(--s-6) auto var(--s-9);
  flex: 1;
}
@media (min-width: 768px) { .container { margin-block: var(--s-7) var(--s-9); } }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 62px;
  padding-inline: max(var(--gutter), env(safe-area-inset-right)) max(var(--gutter), env(safe-area-inset-left));
  background: linear-gradient(180deg, #0e2246 0%, #0b1c3b 100%);
  color: var(--on-dark);
  box-shadow: 0 6px 24px rgba(8, 18, 40, .22);
}
@media (min-width: 900px) { .topbar { min-height: 70px; gap: var(--s-6); } }

.brand {
  display: flex; align-items: center; gap: var(--s-2);
  color: #fff; font-weight: 800; font-size: 15px; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand:hover { color: #fff; }
.brand-logo {
  /* Responsive, aspect-ratio preserving logo that never grows the header. */
  flex: none; display: block;
  height: clamp(22px, 4.6vw, 30px);
  width: auto; max-width: min(96px, 26vw);
  object-fit: contain; object-position: center;
  background: #fff; border-radius: 8px;
  padding: 2px 5px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18) inset, 0 6px 14px rgba(8, 18, 40, .35);
}
@media (min-width: 600px) { .brand-logo { height: 30px; max-width: 120px; padding: 3px 6px; } }
@media (min-width: 900px) { .brand { font-size: 17px; } .brand-logo { height: 36px; max-width: 140px; padding: 3px 7px; } }

.topbar nav { display: flex; align-items: center; gap: var(--s-1); flex: 1; min-width: 0; }
.topbar nav a {
  color: #cfdcf6; font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: var(--r-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.topbar nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topbar nav a.is-active { background: rgba(90, 137, 255, .22); color: #fff; box-shadow: inset 0 0 0 1px rgba(140, 175, 255, .35); }

.userbox { display: flex; align-items: center; gap: var(--s-2); margin-inline-start: auto; }
.userbox .who { display: none; font-size: 13px; font-weight: 700; color: #fff; }
@media (min-width: 900px) { .userbox .who { display: inline; } }
.role {
  font-size: 11px; font-weight: 700; color: #b9cdf5;
  border: 1px solid rgba(150, 180, 240, .45); border-radius: var(--r-pill); padding: 2px 10px;
}
.link-button {
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--r-sm); padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; min-height: 38px; transition: background var(--fast) var(--ease);
}
.link-button:hover { background: rgba(255, 255, 255, .18); }

/* Drawer (checkbox pattern, no JS) */
.nav-toggle-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.nav-toggle-btn { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 899px) {
  .nav-toggle-btn {
    order: -1; display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex: none; cursor: pointer;
    border-radius: var(--r-sm); border: 1px solid rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .08);
  }
  .nav-toggle-btn span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; position: relative; }
  .nav-toggle-btn span::before,
  .nav-toggle-btn span::after {
    content: ""; position: absolute; inset-inline: 0; height: 2px; background: #fff; border-radius: 2px;
    transition: transform var(--base) var(--ease);
  }
  .nav-toggle-btn span::before { top: -6px; }
  .nav-toggle-btn span::after { top: 6px; }

  .topbar nav {
    position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 60;
    width: min(84vw, 320px);
    flex-direction: column; align-items: stretch; gap: 2px; flex: none;
    padding: 78px var(--s-4) calc(var(--s-6) + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #0d2044, #091830);
    box-shadow: -20px 0 50px rgba(4, 10, 24, .45);
    transform: translateX(-105%);
    transition: transform var(--base) var(--ease);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .topbar nav::before {
    content: "منوی سامانه";
    color: var(--on-dark-muted); font-size: 12px; font-weight: 700;
    padding: 0 12px var(--s-2);
  }
  .topbar nav a { min-height: 46px; display: flex; align-items: center; font-size: 15px; }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(7, 14, 30, .55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity var(--base) var(--ease);
  }
  .nav-toggle-input:checked ~ nav { transform: translateX(0); }
  .nav-toggle-input:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }
  .nav-toggle-input:checked ~ .nav-toggle-btn span { background: transparent; }
  .nav-toggle-input:checked ~ .nav-toggle-btn span::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle-input:checked ~ .nav-toggle-btn span::after { transform: translateY(-6px) rotate(-45deg); }
}

footer {
  text-align: center; padding: var(--s-5) var(--gutter);
  padding-bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  color: var(--muted); font-size: 13px;
  border-top: 1px solid var(--border); background: rgba(255, 255, 255, .8);
}

/* --------------------------------------------------------------------------
   4. Page header
   -------------------------------------------------------------------------- */
.page-head {
  display: grid; gap: var(--s-4); margin-bottom: var(--s-6);
}
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }
@media (min-width: 900px) {
  .page-head { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
}

/* --------------------------------------------------------------------------
   5. Surfaces
   -------------------------------------------------------------------------- */
.panel, .card, .auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}
.panel { padding: var(--s-5); margin-bottom: var(--s-5); }
@media (min-width: 768px) { .panel { padding: var(--s-6); } }
.panel > h2 { display: flex; align-items: center; gap: var(--s-2); }
.panel > h2::before {
  content: ""; width: 4px; height: 18px; border-radius: 3px;
  background: linear-gradient(180deg, var(--primary), var(--accent)); flex: none;
}
.panel-head, .row-between {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: var(--s-3);
}
.panel-head { margin-bottom: var(--s-4); }
.panel-head p { margin: 0; font-size: 13px; }

.grid { display: grid; gap: var(--s-4); }
.cards-3 { grid-template-columns: 1fr; }
@media (min-width: 620px) { .cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.two-col { display: grid; gap: var(--s-5); align-items: start; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); } }
.supervisor-layout { grid-template-columns: 1fr; }
@media (min-width: 1000px) { .supervisor-layout { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); } }

.report-grid { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 1000px) { .report-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } }

/* --------------------------------------------------------------------------
   6. Stats
   -------------------------------------------------------------------------- */
.stats {
  display: grid; gap: var(--s-3); margin-bottom: var(--s-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); } }
.stat {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--s-4) var(--s-4) var(--s-3);
  box-shadow: var(--sh-1);
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease);
}
.stat::after {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 0;
  height: 3px; background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: .85;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.stat strong {
  display: block; font-size: clamp(24px, 6vw, 30px); line-height: 1.3;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.stat span { color: var(--muted); font-size: 13px; }

/* --------------------------------------------------------------------------
   7. Buttons & action hierarchy
   -------------------------------------------------------------------------- */
input, select, textarea, button { font: inherit; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 42px; padding: 9px 16px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: #fff; color: var(--text-2); font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: center;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), color var(--fast) var(--ease);
}
button:hover, .button:hover { background: var(--panel-soft); border-color: var(--primary); color: var(--primary-dark); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

button.primary, .primary.button {
  background: linear-gradient(180deg, #2b62db, var(--primary));
  border-color: var(--primary-dark); color: #fff;
  box-shadow: 0 6px 16px rgba(36, 85, 201, .28);
}
button.primary:hover, .primary.button:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: #fff; border-color: var(--primary-dark);
  box-shadow: 0 8px 22px rgba(36, 85, 201, .34);
}
.button.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.button.ghost:hover { background: var(--primary-soft); }
.button.block, button.block { width: 100%; }
.button.sm, button.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.button.danger, button.danger { color: var(--danger); border-color: #f0c4bf; background: var(--danger-soft); }

.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.actions--end { justify-content: flex-start; }
@media (min-width: 900px) { .actions--end { justify-content: flex-end; } }
.status-stack { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
@media (min-width: 900px) { .status-stack { justify-content: flex-end; } }

/* Overflow (⋮) menu — CSS only, keyboard accessible via <details> */
.more { position: relative; }
.more > summary {
  list-style: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: #fff; cursor: pointer;
  font-weight: 800; color: var(--muted); transition: background var(--fast) var(--ease);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary:hover { background: var(--panel-soft); color: var(--primary); }
.more[open] > summary { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.more-panel {
  position: absolute; inset-inline-start: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 210px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-3);
  animation: pop var(--base) var(--ease);
}
.more-panel a, .more-panel button {
  display: flex; width: 100%; justify-content: flex-start; text-align: start;
  border: 0; background: transparent; border-radius: var(--r-xs);
  padding: 9px 10px; font-size: 14px; color: var(--text-2); box-shadow: none;
}
.more-panel a:hover, .more-panel button:hover { background: var(--panel-alt); color: var(--primary-dark); }
.more-panel .meta { padding: 4px 10px; }

/* Text-labeled variant of the overflow toggle (e.g. "ویرایش نمره") — the
   base .more > summary rule above is sized for a single ⋮ icon glyph and
   squashes real label text into a 40x40 box, so this modifier switches it
   back to a normal auto-width pill button. */
.more.more--label > summary {
  width: auto; height: auto; min-height: 36px;
  padding: 6px 14px; white-space: nowrap;
  font-weight: 600; font-size: 13px;
}

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

/* --------------------------------------------------------------------------
   8. Forms
   -------------------------------------------------------------------------- */
label { display: grid; gap: 6px; font-weight: 700; font-size: 13.5px; color: var(--text-2); }
.stack { display: grid; gap: var(--s-4); }
.field-row { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 700px) { .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

input, select, textarea {
  width: 100%; min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: #fff; color: var(--text); font-weight: 500;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: #9aa8bf; }
input:hover, select:hover, textarea:hover { border-color: #adbcd4; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring);
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--primary); }
textarea { resize: vertical; min-height: 120px; line-height: 1.9; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(var(--s-4) - 2px) calc(50% + 1px), calc(var(--s-4) + 3px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-inline-start: var(--s-7);
}
label.inline, .checkbox-row {
  display: flex; align-items: center; gap: var(--s-2); font-weight: 600;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--panel-soft); cursor: pointer; min-height: 44px;
}
label.inline:hover { border-color: var(--primary); }
.form-section { border: 0; margin: 0 0 var(--s-5); padding: 0; }
.form-section > legend {
  padding: 0; margin-bottom: var(--s-3); font-size: 13px; font-weight: 800;
  color: var(--primary-dark); text-transform: none;
}
.helper { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.required { color: var(--danger); font-weight: 800; }
.errorlist, ul.errorlist {
  list-style: none; margin: 4px 0 0; padding: 0;
  color: var(--danger); font-size: 12.5px; font-weight: 600;
}
.inline-form { display: grid; gap: var(--s-2); grid-template-columns: 1fr; width: 100%; }
@media (min-width: 620px) { .inline-form { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }
@media (min-width: 900px) { .inline-form { min-width: 420px; } }

/* --------------------------------------------------------------------------
   9. Feedback: notice / flash / states
   -------------------------------------------------------------------------- */
.notice, .demo-box {
  border-radius: var(--r-md); padding: var(--s-3) var(--s-4);
  background: var(--primary-soft); border: 1px solid #cddcff;
  color: #22407c; font-size: 13.5px;
}
.notice { display: flex; gap: var(--s-2); margin-bottom: var(--s-5); }
.notice.important { background: var(--warning-soft); border-color: #f2d79c; color: #6f4a05; }
.notice.important::before { content: "!"; flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 4px; border-radius: 50%; background: #f2c25e; color: #4b3100; font-weight: 800; font-size: 12px; }

.flash {
  display: flex; gap: var(--s-2); align-items: flex-start;
  border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3);
  border: 1px solid; font-size: 14px; font-weight: 600;
  animation: slide-in var(--base) var(--ease);
}
.flash.error { color: var(--danger); background: var(--danger-soft); border-color: #f3c8c3; }
.flash.success { color: var(--success); background: var(--success-soft); border-color: #a8e5cb; }
.flash.info, .flash.debug { color: #22407c; background: var(--primary-soft); border-color: #cddcff; }
.flash.warning { color: var(--warning); background: var(--warning-soft); border-color: #f2d79c; }
/* Space-between layout used by the "viewing another user's panel" banners. */
.flash--split { justify-content: space-between; align-items: center; }

@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Page-specific layout rules that used to live in inline <style> blocks
   or inline style="" attributes inside individual templates. The site's
   Content-Security-Policy is style-src 'self', which silently blocks any
   inline styling — moved here so they actually apply.
   -------------------------------------------------------------------------- */

/* Impersonation banner in the top bar (distinct from the in-page .flash.info
   banner other panels show for the same state). */
.impersonation-bar { background: #7c3aed; color: #fff; padding: .5rem 1rem; display: flex; justify-content: space-between; align-items: center; font-size: 13px; gap: 1rem; }
.impersonation-bar a { color: #fff; font-weight: 700; border: 1px solid rgba(255, 255, 255, .5); border-radius: 4px; padding: .2rem .7rem; text-decoration: none; }

/* Supervisor-manager hierarchy row (counselor/student tree). */
.hier-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Small top margin used after short explanatory notes. */
.mt-sm { margin-top: .6rem; }
/* Small bottom margin used above the user-search box. */
.mb-sm { margin-bottom: .75rem; }
/* Vertical action stack (used in user-account rows: login-as + delete). */
.action-col { display: flex; flex-direction: column; gap: .4rem; }

/* Exam-results page: parameter picker and score sort links. */
.param-bar { display: flex; flex-wrap: wrap; gap: .5rem; }
.param-btn { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-pill); padding: .35rem .9rem; font-size: .85rem; font-weight: 600; color: var(--text); background: var(--panel); text-decoration: none; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.param-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.param-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sort-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sort-link { font-size: .85rem; font-weight: 600; color: var(--text-2); text-decoration: none; border: 1px solid var(--border); border-radius: var(--r-sm); padding: .3rem .7rem; }
.sort-link.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.edit-score-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }
.edit-score-form input[type=number] { width: 6rem; font-size: .85rem; padding: .2rem .4rem; }

.empty-state, .success-panel {
  text-align: center; background: var(--panel); border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg); padding: var(--s-8) var(--s-5); box-shadow: var(--sh-1);
  grid-column: 1 / -1;
}
.empty-state h1, .empty-state h2 { font-size: 18px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 14px; }
.empty-icon, .success-icon {
  width: 60px; height: 60px; margin: 0 auto var(--s-3);
  display: grid; place-items: center; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-size: 26px; font-weight: 800;
}
.success-icon { background: var(--success-soft); color: var(--success); }
.success-panel { border-style: solid; }
.error-code { font-size: clamp(56px, 20vw, 96px); font-weight: 900; color: #cbd6e8; line-height: 1.1; }

/* --------------------------------------------------------------------------
   10. Badges & indicators
   -------------------------------------------------------------------------- */
.badge, .tag, .source-chip, .watcher {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-pill); padding: 4px 11px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--panel-alt); color: var(--text-2);
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75;
}
.badge.assigned { background: var(--warning-soft); color: #8a5a06; }
.badge.completed, .badge.ready { background: var(--success-soft); color: var(--success); }
.badge.draft { background: var(--violet-soft); color: var(--violet); }
.tag, .source-chip { background: var(--primary-soft); color: #2a4f9e; }
.watcher { background: var(--warning-soft); color: var(--warning); }
.watcher.pass { background: var(--success-soft); color: var(--success); }
.watcher.review { background: var(--warning-soft); color: var(--warning); }
.watcher.block { background: var(--danger-soft); color: var(--danger); }

/* --------------------------------------------------------------------------
   11. Tables → responsive cards on mobile
   -------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
@media (min-width: 768px) { .table-wrap table { min-width: max-content; } }

/* Tables with many columns and long labels (e.g. the Supervisor Manager
   results table) opt into ".scroll-only": the container itself scrolls
   horizontally with mouse/trackpad/touch and a draggable scrollbar, at
   every viewport size, while the real table/columns are preserved as-is
   (no collapsing into stacked cards on mobile, unlike the default
   ".table-wrap" behavior below). The page itself never scrolls
   horizontally -- only this container does. */
.table-wrap.scroll-only {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}
.table-wrap.scroll-only table { min-width: max-content; }
thead th {
  padding: 10px 12px; text-align: start; font-size: 12px; font-weight: 700;
  color: var(--muted); background: var(--panel-soft);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
thead th:first-child { border-start-start-radius: var(--r-sm); }
thead th:last-child { border-start-end-radius: var(--r-sm); }
tbody td { padding: 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
tbody tr { transition: background var(--fast) var(--ease); }
tbody tr:hover { background: var(--panel-soft); }
tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 767px) {
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap th, .table-wrap td { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-wrap tbody tr {
    border: 1px solid var(--border); border-radius: var(--r-md);
    padding: var(--s-2) var(--s-3); margin-bottom: var(--s-3); background: #fff; box-shadow: var(--sh-1);
  }
  .table-wrap tbody td {
    display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
    gap: var(--s-3); align-items: center;
    padding: 8px 0; border-bottom: 1px dashed var(--border);
  }
  .table-wrap tbody td:last-child { border-bottom: 0; }
  .table-wrap tbody td::before {
    content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700;
  }
  .table-wrap tbody td:not([data-label]) { grid-template-columns: 1fr; }

  /* ".scroll-only" tables opt out of the stacked-card collapse above: keep
     them as real, horizontally-scrollable tables even on narrow/touch
     viewports (see the ".table-wrap.scroll-only" rule near the top of this
     section for the container-level scrolling itself). */
  .table-wrap.scroll-only table,
  .table-wrap.scroll-only thead,
  .table-wrap.scroll-only tbody,
  .table-wrap.scroll-only tr,
  .table-wrap.scroll-only th,
  .table-wrap.scroll-only td { display: revert; }
  .table-wrap.scroll-only thead {
    position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: nowrap;
  }
  .table-wrap.scroll-only tbody tr {
    border: 0; border-radius: 0; padding: 0; margin-bottom: 0; background: transparent; box-shadow: none;
  }
  .table-wrap.scroll-only tbody td {
    display: table-cell; grid-template-columns: none; gap: 0;
    padding: 12px; border-bottom: 1px solid var(--border);
  }
  .table-wrap.scroll-only tbody td::before { content: none; }
}

/* --------------------------------------------------------------------------
   12. Timeline
   -------------------------------------------------------------------------- */
.timeline { position: relative; display: grid; gap: var(--s-4); }
.timeline::before {
  content: ""; position: absolute; inset-inline-start: 6px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(180deg, var(--primary-soft), var(--border));
}
.timeline-item { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: var(--s-3); position: relative; }
.timeline-dot {
  width: 14px; height: 14px; margin-top: 14px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); z-index: 1;
}
.timeline-content {
  min-width: 0; border: 1px solid var(--border); border-radius: var(--r-md);
  background: #fff; padding: var(--s-4); box-shadow: var(--sh-1);
  transition: box-shadow var(--base) var(--ease), border-color var(--base) var(--ease);
}
.timeline-content:hover { box-shadow: var(--sh-2); border-color: var(--border-strong); }
.timeline-content h3 { margin-bottom: 2px; font-size: 15px; }
.result-strip {
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); align-items: center;
  margin-top: var(--s-3); padding-top: var(--s-3);
  border-top: 1px dashed var(--border); font-size: 13px; color: var(--text-2);
}
.result-strip a { font-weight: 700; }

/* --------------------------------------------------------------------------
   13. Tilt cards (question bank)
   -------------------------------------------------------------------------- */
.card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2);
  padding: var(--s-5); overflow: hidden; isolation: isolate;
}
.card p { color: var(--muted); font-size: 14px; }
.card h2 { font-size: 17px; margin: 2px 0 0; }
.card .meta { margin-top: auto; }
.card .actions { width: 100%; margin-top: var(--s-3); }

.tilt {
  perspective: 900px;
  perspective-origin: 50% 50%;
}
.tilt > .card {
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease), border-color var(--base) var(--ease);
  will-change: transform;
}
.tilt > .card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: radial-gradient(420px 220px at 80% 0%, rgba(76, 125, 255, .16), transparent 65%),
              radial-gradient(360px 200px at 10% 100%, rgba(23, 193, 169, .14), transparent 60%);
  transition: opacity var(--base) var(--ease);
}
.tilt > .card > * { transform: translateZ(0.01px); }
.tilt > .card .card-title-row { transform: translateZ(24px); }
.tilt > .card .actions { transform: translateZ(18px); }

@media (hover: hover) and (pointer: fine) {
  .tilt:hover > .card {
    transform: rotateX(3.2deg) rotateY(-3.6deg) translateY(-4px) scale(1.012);
    box-shadow: var(--sh-3); border-color: #c6d6f5;
  }
  .tilt:hover > .card::before { opacity: 1; }
  .tilt > .card:focus-within { transform: translateY(-3px); box-shadow: var(--sh-3); }
}
@media (hover: none) {
  .tilt > .card:active { transform: scale(.995); }
}

.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); width: 100%; }
.card-title-row h2 { min-width: 0; }
.card-meta-list { display: grid; gap: 6px; width: 100%; margin-top: var(--s-2); }
.card-meta-list div { display: flex; justify-content: space-between; gap: var(--s-3); font-size: 13px; color: var(--muted); }
.card-meta-list b { color: var(--text-2); font-weight: 700; text-align: end; }

/* --------------------------------------------------------------------------
   14. Assessment: circular carousel
   -------------------------------------------------------------------------- */
.assessment-form { display: grid; gap: var(--s-5); padding-bottom: 96px; min-width: 0; }
.assessment-form > * { min-width: 0; max-width: 100%; }

.assess-progress {
  position: sticky; top: 62px; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-1);
  font-size: 13px; color: var(--text-2);
}
@media (min-width: 900px) { .assess-progress { top: 70px; } }
.assess-progress b { color: var(--primary-dark); }

.carousel {
  position: relative; min-width: 0; max-width: 100vw;
  margin-inline: 0;
  padding-block: var(--s-5);
  perspective: 1400px;
}
.carousel-track {
  display: flex; gap: var(--s-4);
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-padding-inline: var(--s-2);
  padding-inline: var(--s-2);
  padding-block: var(--s-2) var(--s-4);
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.carousel-track::-webkit-scrollbar { height: 8px; }
.carousel-track::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-pill); }

/* --- the question card: everything about a question lives inside it --- */
.question-card {
  position: relative;
  flex: 0 0 min(100%, 640px);
  max-width: min(100%, 640px);
  min-inline-size: 0; min-width: 0;
  scroll-snap-align: center;
  display: flex; flex-direction: column; gap: var(--s-4);
  border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--panel);
  box-shadow: var(--sh-2);
  padding: var(--s-5) var(--s-4); margin: 0;
  overflow: hidden;
  transition: flex-basis .38s var(--ease), padding .38s var(--ease), gap .38s var(--ease),
              box-shadow var(--base) var(--ease), border-color var(--base) var(--ease), transform var(--base) var(--ease);
}
@media (min-width: 480px) { .question-card { padding: var(--s-5); } }
@media (min-width: 900px) {
  .carousel-track { gap: var(--s-6); }
  .question-card { flex-basis: min(78%, 700px); max-width: min(78%, 700px); padding: var(--s-6); }
}
.question-card:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring), var(--sh-3); }
.question-card:has(.q-opt:checked) { border-color: #a9d8c4; }

.q-head { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.q-index {
  flex: none; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 13px;
  background: linear-gradient(140deg, var(--primary-soft), var(--accent-soft));
  color: var(--primary-dark); font-size: 14px; font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(36, 85, 201, .12);
  font-variant-numeric: tabular-nums;
}
.question-card:has(.q-opt:checked) .q-index {
  background: linear-gradient(140deg, var(--success-soft), var(--accent-soft)); color: var(--success);
}
.q-step { font-size: 12.5px; font-weight: 700; color: var(--muted); min-width: 0; }
.q-fold {
  display: none; margin-inline-start: auto; flex: none; cursor: pointer;
  font-size: 12px; font-weight: 700; color: var(--primary);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 5px 11px; min-height: 32px; align-items: center;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.q-fold:hover { background: var(--primary-soft); border-color: var(--primary); }
.question-card:has(.q-opt:checked) .q-fold { display: inline-flex; }

.q-text {
  margin: 0; color: var(--text);
  font-size: clamp(15px, 4.1vw, 18px); font-weight: 700; line-height: 1.95;
  text-align: start; max-width: 62ch;
  overflow-wrap: break-word; word-break: normal; hyphens: auto;
}

.options { display: grid; gap: var(--s-2); margin: 0; min-width: 0; }
@media (min-width: 620px) { .options { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.option {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: 48px; padding: 10px 13px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--panel-soft); font-weight: 600; font-size: 14px; color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.option:hover { border-color: var(--primary); background: var(--panel); }
.option:active { transform: scale(.99); }
.option input { flex: none; width: 18px; height: 18px; }
.option span { min-width: 0; overflow-wrap: break-word; }
.option:has(input:focus-visible) { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.option:has(input:checked) {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.q-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding-top: var(--s-3); border-top: 1px dashed var(--border);
  font-size: 12.5px;
}
.q-move {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 10px;
  border-radius: var(--r-pill); font-weight: 700; color: var(--text-2);
  border: 1px solid var(--border); background: var(--panel-soft); white-space: nowrap;
}
.q-move:hover { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-soft); }
.q-state { color: var(--success); font-weight: 700; opacity: 0; transition: opacity var(--fast) var(--ease); }
.question-card:has(.q-opt:checked) .q-state { opacity: 1; }
.question-card:has(.q-opt:checked) .q-move--next {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark);
}

/* Collapsed (answered) card → moves to the end of the rail as a small chip,
   so the next question slides into the snapped position automatically. */
.q-collapsed { display: none; }
.question-card:has(.q-opt:checked):not(:target):not(:has(:focus-visible)) {
  flex-basis: 58px; max-width: 58px; padding: var(--s-4) 6px; gap: 0;
}
.question-card:has(.q-opt:checked):not(:target):not(:has(:focus-visible)) > :is(.q-head, .q-text, .options, .q-foot) {
  opacity: 0; visibility: hidden; height: 0; min-height: 0; padding-block: 0; margin: 0; border: 0; overflow: hidden;
}
.question-card:has(.q-opt:checked):not(:target):not(:has(:focus-visible)) > .q-collapsed {
  display: flex; position: absolute; inset: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; animation: q-chip .3s var(--ease) both;
}
.question-card:target { scroll-margin-inline: var(--s-2); box-shadow: 0 0 0 3px var(--primary-ring), var(--sh-3); }
.q-collapsed-num {
  font-size: 15px; font-weight: 800; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.q-collapsed-tick {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 900;
}
.q-collapsed:hover .q-collapsed-num { color: var(--primary-dark); }

@keyframes q-chip { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }


.q-nav {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  padding: 0 var(--gutter);
}
.q-nav a {
  display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: #fff; color: var(--text-2); font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: all var(--fast) var(--ease);
}
.q-nav a:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }

.sticky-actions {
  position: sticky; z-index: 25;
  bottom: max(var(--s-3), env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--sh-3);
}
.sticky-actions .muted { font-size: 13px; }
.sticky-actions button { flex: 1 1 200px; }
@media (min-width: 620px) { .sticky-actions button { flex: 0 0 auto; min-width: 220px; } }

/* --------------------------------------------------------------------------
   15. Auth — animated sign-in
   -------------------------------------------------------------------------- */
.auth-page {
  flex: 1; display: grid; align-items: center; gap: var(--s-7);
  width: var(--shell-w); margin: var(--s-6) auto var(--s-8);
  grid-template-columns: 1fr;
}
@media (min-width: 1000px) {
  .auth-page { grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: var(--s-9); margin-block: var(--s-8); }
}

.auth-hero { position: relative; display: none; }
@media (min-width: 1000px) { .auth-hero { display: block; } }
.auth-hero h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.5; }
.auth-hero p { font-size: 15px; max-width: 46ch; }
.auth-hero ul { list-style: none; padding: 0; margin-top: var(--s-5); display: grid; gap: var(--s-3); }
.auth-hero li {
  display: flex; align-items: flex-start; gap: var(--s-3);
  font-size: 14px; color: var(--text-2); font-weight: 600;
}
.auth-hero li::before {
  content: "✓"; flex: none; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px;
}

.auth-aurora {
  position: absolute; inset: -18% -10% auto -10%; height: 380px; z-index: -1;
  filter: blur(60px); opacity: .55; pointer-events: none;
  background:
    radial-gradient(280px 200px at 20% 40%, #7aa5ff, transparent 70%),
    radial-gradient(300px 220px at 70% 30%, #62e0cd, transparent 70%),
    radial-gradient(260px 200px at 50% 80%, #a79bff, transparent 70%);
  animation: aurora 14s var(--ease) infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-3%, 2%, 0) scale(1.06); }
  100% { transform: translate3d(3%, -2%, 0) scale(1.02); }
}

.auth-card {
  width: 100%; padding: var(--s-6) var(--s-5);
  border-radius: var(--r-xl); box-shadow: var(--sh-4);
  animation: auth-in .5s var(--ease) both;
}
@media (min-width: 620px) { .auth-card { padding: var(--s-7); } }
.auth-card h1 { font-size: clamp(22px, 5vw, 28px); }
.auth-card > .stack { margin-top: var(--s-5); }
.auth-card .stack > * { animation: auth-in .5s var(--ease) both; }
.auth-card .stack > *:nth-child(2) { animation-delay: .05s; }
.auth-card .stack > *:nth-child(3) { animation-delay: .1s; }
.auth-card .stack > *:nth-child(4) { animation-delay: .15s; }
.auth-card button.primary { min-height: 48px; font-size: 15px; }

@keyframes auth-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.auth-mark {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); border-radius: var(--r-pill); padding: 4px 12px; margin-bottom: var(--s-3);
}

.auth-logo { display: block; height: 64px; width: auto; max-width: 100%; object-fit: contain; margin-bottom: var(--s-4); }

/* --------------------------------------------------------------------------
   16. Report / analysis
   -------------------------------------------------------------------------- */
.score-total {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: var(--s-4) var(--s-5); margin: var(--s-4) 0;
  border-radius: var(--r-md); color: #fff;
  background: linear-gradient(135deg, #12305f, #0b1c3b);
  box-shadow: var(--sh-2);
}
.score-total span { color: #b9cdf5; font-size: 13px; font-weight: 600; }
.score-total strong { font-size: clamp(26px, 6vw, 34px); font-variant-numeric: tabular-nums; }
.dimension-grid { display: grid; gap: var(--s-2); grid-template-columns: 1fr; }
@media (min-width: 560px) { .dimension-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dimension {
  display: flex; justify-content: space-between; gap: var(--s-3); align-items: center;
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 13px;
  background: var(--panel-soft); font-size: 13.5px;
}
.dimension strong { color: var(--primary-dark); font-variant-numeric: tabular-nums; }

.check-list { list-style: none; padding: 0; display: grid; gap: var(--s-2); }
.check-list li { display: flex; gap: var(--s-2); font-size: 13.5px; color: var(--text-2); }
.check-list li::before { content: "•"; color: var(--primary); font-weight: 900; }

.counselor-block {
  border: 1px solid var(--border); border-radius: var(--r-md);
  margin-bottom: var(--s-3); overflow: hidden; background: #fff;
}
.counselor-block summary {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2);
  padding: var(--s-3) var(--s-4); cursor: pointer; background: var(--panel-soft);
  font-weight: 700; font-size: 14px;
}
.counselor-block summary span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.counselor-block[open] summary { border-bottom: 1px solid var(--border); }
.student-links { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-3) var(--s-4); }
.student-links a {
  border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 6px 13px; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: all var(--fast) var(--ease);
}
.student-links a:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
details > summary { cursor: pointer; }

/* --------------------------------------------------------------------------
   17. Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .tilt:hover > .card { transform: none; }
}

/* --------------------------------------------------------------------------
   18. Header action group — never wraps (نقش + خروج side by side)
   -------------------------------------------------------------------------- */
.topbar { flex-wrap: nowrap; }
.brand { flex: 0 1 auto; }
@media (max-width: 599px) { .brand { max-width: 42vw; } }
.userbox { flex-wrap: nowrap; flex: none; gap: 6px; min-width: 0; }
.userbox > form { flex: none; margin: 0; }
.role, .link-button { white-space: nowrap; flex: none; }
@media (max-width: 419px) {
  .topbar { gap: var(--s-2); }
  .role { padding: 2px 7px; font-size: 10.5px; }
  .link-button { padding: 6px 9px; font-size: 12.5px; }
}

/* --------------------------------------------------------------------------
   19. Theme toggle (☀ / ☾) — CSS only
   -------------------------------------------------------------------------- */
.theme-toggle-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; cursor: pointer; border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, .24); background: rgba(255, 255, 255, .08);
  color: #ffd88a; font-size: 16px; line-height: 1;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.theme-toggle-btn:hover { background: rgba(255, 255, 255, .2); transform: rotate(-12deg); }
.theme-toggle-input:focus-visible + .theme-toggle-btn,
.theme-toggle-btn:focus-visible { outline: 3px solid rgba(160, 195, 255, .7); outline-offset: 2px; }
.theme-icon { display: none; }
.theme-icon--moon { display: inline; }
body:has(.theme-toggle-input:checked) .theme-icon--moon { display: none; }
body:has(.theme-toggle-input:checked) .theme-icon--sun { display: inline; }
.theme-toggle-floating {
  position: fixed; z-index: 45;
  top: max(12px, env(safe-area-inset-top)); inset-inline-end: 14px;
  background: rgba(12, 28, 60, .75); backdrop-filter: blur(6px);
}

/* --------------------------------------------------------------------------
   20. Dark mode
   -------------------------------------------------------------------------- */
body { transition: background-color var(--base) var(--ease), color var(--base) var(--ease); }

body:has(.theme-toggle-input:checked) {
  --bg: #0a1020;
  --panel: #121a2c;
  --panel-soft: #172136;
  --panel-alt: #1c2740;
  --text: #eaf1ff;
  --text-2: #c3d0e6;
  --muted: #93a4c0;
  --border: #24304a;
  --border-strong: #33415f;
  --primary: #6d9bff;
  --primary-dark: #a9c4ff;
  --primary-soft: #1b2c51;
  --primary-ring: rgba(109, 155, 255, .34);
  --accent: #45d6c1;
  --accent-soft: #10322f;
  --success: #59d3a2;
  --success-soft: #102f26;
  --warning: #e7b45c;
  --warning-soft: #33270f;
  --danger: #ff8b7e;
  --danger-soft: #3a1a17;
  --violet: #b79bff;
  --violet-soft: #241c3d;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
  --sh-2: 0 6px 18px rgba(0, 0, 0, .45);
  --sh-3: 0 16px 38px rgba(0, 0, 0, .55);
  --sh-4: 0 28px 60px rgba(0, 0, 0, .65);
  background:
    radial-gradient(1100px 520px at 100% -10%, #14213f 0%, rgba(20, 33, 63, 0) 60%),
    radial-gradient(900px 460px at 0% 0%, #0e2a2c 0%, rgba(14, 42, 44, 0) 55%),
    var(--bg);
  color: var(--text);
}
body:has(.theme-toggle-input:checked) :is(
  button, .button, input, select, textarea,
  .more-panel, .q-nav a, .timeline-content, .counselor-block,
  .table-wrap tbody tr, .empty-state, .success-panel, .panel, .card, .auth-card, .stat
) { background-color: var(--panel); color: var(--text-2); border-color: var(--border); }
body:has(.theme-toggle-input:checked) :is(input, select, textarea) { color: var(--text); }
body:has(.theme-toggle-input:checked) :is(h1, h2, h3, h4, b, strong) { color: var(--text); }
body:has(.theme-toggle-input:checked) button.primary,
body:has(.theme-toggle-input:checked) .primary.button {
  background: linear-gradient(180deg, #3f74e8, #2b56c4); color: #fff; border-color: #2b56c4;
}
body:has(.theme-toggle-input:checked) .option { background-color: var(--panel-soft); }
body:has(.theme-toggle-input:checked) .option:has(input:checked) { background-color: var(--primary-soft); color: var(--primary-dark); }
body:has(.theme-toggle-input:checked) :is(.assess-progress, .sticky-actions) { background: rgba(18, 26, 44, .94); }
body:has(.theme-toggle-input:checked) footer { background: rgba(10, 16, 32, .85); }
body:has(.theme-toggle-input:checked) thead th { background: var(--panel-alt); color: var(--muted); }
body:has(.theme-toggle-input:checked) tbody tr:hover { background: var(--panel-alt); }
body:has(.theme-toggle-input:checked) .notice,
body:has(.theme-toggle-input:checked) .demo-box { background: var(--primary-soft); border-color: var(--border-strong); color: var(--text-2); }
body:has(.theme-toggle-input:checked) :is(.badge, .tag, .source-chip, .watcher) { background-color: var(--panel-alt); }
body:has(.theme-toggle-input:checked) code { background: var(--panel-alt); color: var(--text-2); }
body:has(.theme-toggle-input:checked) .error-code { color: #2c3a58; }
body:has(.theme-toggle-input:checked) .auth-aurora { opacity: .35; }
body:has(.theme-toggle-input:checked) .theme-toggle-btn { color: #ffd88a; }


/* --------------------------------------------------------------------------
   20. Destructive confirmation dialog (CSS-only, admin user management)
   -------------------------------------------------------------------------- */
.confirm-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.confirm-open { cursor: pointer; }
.confirm-modal {
  display: none; position: fixed; inset: 0; z-index: 90;
  align-items: center; justify-content: center; padding: var(--s-4);
}
.confirm-input:checked ~ .confirm-modal { display: flex; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(8, 18, 40, .55); cursor: pointer; }
.confirm-card {
  position: relative; width: min(420px, 100%);
  background: var(--panel); color: var(--text, inherit); border: 1px solid var(--border);
  border-radius: var(--r-lg, 14px); padding: var(--s-5);
  box-shadow: 0 24px 60px rgba(8, 18, 40, .35);
  max-height: 90vh; overflow: auto;
}
.confirm-card h2 { margin: 0 0 var(--s-2); font-size: 17px; }
.confirm-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--s-3); margin: var(--s-4) 0; font-size: 14px; }
.confirm-details dt { font-weight: 700; }
.confirm-details dd { margin: 0; overflow-wrap: anywhere; }
.confirm-card .actions { gap: var(--s-2); flex-wrap: wrap; }
.confirm-card form { margin: 0; }
.confirm-cancel { cursor: pointer; }
@media (max-width: 520px) { .confirm-card .actions { justify-content: stretch; } .confirm-card .actions > * { flex: 1 1 auto; text-align: center; } }

/* --------------------------------------------------------------------------
   21. Mobile Header fix — brand stays visible, theme controls move left (RTL: start)
   -------------------------------------------------------------------------- */
@media (max-width: 599px) {
  /* Ensure brand never shrinks to nothing */
  .brand { flex: 1 1 0; min-width: 0; font-size: 13px; }
  /* Keep userbox compact and push it to logical start (left in RTL) */
  .userbox { order: -2; margin-inline-start: 0; gap: 4px; }
  /* Nav hamburger keeps its order */
  .nav-toggle-btn { order: -1; }
  .who { display: none !important; }
  .role { display: none; }
  .link-button { padding: 5px 8px; font-size: 12px; }
}
@media (max-width: 374px) {
  .brand { font-size: 11.5px; }
  .theme-toggle-btn { width: 32px; height: 32px; font-size: 14px; }
  .nav-toggle-btn { width: 36px; height: 36px; }
}

/* --------------------------------------------------------------------------
   22. Mobile Hamburger fix — always accessible while scrolled
   -------------------------------------------------------------------------- */
@media (max-width: 899px) {
  /* Topbar is already sticky; ensure z-index is above page content */
  .topbar { z-index: 50; }
  /* Nav panel and backdrop already fixed; bump z-index above sticky topbar */
  .topbar nav { z-index: 70; }
  .nav-backdrop { z-index: 60; }
  /* Ensure the hamburger button itself never gets clipped */
  .nav-toggle-btn { position: relative; z-index: 51; flex: none; }
}

/* --------------------------------------------------------------------------
   23. Password manage cell (admin user list) — CSS-only show/hide, no JS
   -------------------------------------------------------------------------- */
.pw-show-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pw-manage { display: flex; flex-direction: column; gap: .5rem; min-width: 12rem; }
.pw-value-row { display: flex; align-items: center; }
.pw-value { font-family: monospace; font-size: .85rem; letter-spacing: .05em; min-width: 5rem; }
.pw-plain { display: none; }
.pw-show-input:checked ~ .pw-value-row .pw-dots { display: none; }
.pw-show-input:checked ~ .pw-value-row .pw-plain { display: inline; }
.pw-edit-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.pw-btn-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.pw-eye-label { width: 36px; height: 36px; padding: 0; }
.pw-eye-label svg { display: block; }
.pw-show-input:checked ~ .pw-btn-row .pw-eye-label { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

/* --------------------------------------------------------------------------
   24. Page transition overlay — shown briefly while navigating to the next
   page (any link/button that leaves this page). Toggled by
   static/js/page_transition.js via the .is-visible class only; no inline
   styles are used anywhere (CSP: style-src 'self').
   -------------------------------------------------------------------------- */
.page-transition-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9, 17, 36, .38); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--base) var(--ease), visibility 0s linear var(--base);
}
.page-transition-overlay.is-visible {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity var(--fast) var(--ease), visibility 0s;
}
.page-transition-box {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-4);
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s-6) var(--s-8); box-shadow: var(--sh-4);
  transform: translateY(10px) scale(.9); opacity: 0;
  transition: transform var(--base) cubic-bezier(.34, 1.56, .64, 1), opacity var(--base) var(--ease);
}
.page-transition-overlay.is-visible .page-transition-box {
  transform: none; opacity: 1;
}
/* Bouncing-dots "typing indicator" style loader (in the spirit of the
   Uiverse.io minimal dot loader) instead of a plain spinner ring. */
.page-transition-dots {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 20px;
}
.page-transition-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary);
  animation: page-transition-bounce 1s var(--ease) infinite;
}
.page-transition-dots span:nth-child(2) { background: var(--accent); animation-delay: .15s; }
.page-transition-dots span:nth-child(3) { background: var(--violet); animation-delay: .3s; }
@keyframes page-transition-bounce {
  0%, 80%, 100% { transform: scale(.55) translateY(0); opacity: .55; }
  40% { transform: scale(1) translateY(-9px); opacity: 1; }
}
.page-transition-text { font-size: 14px; font-weight: 600; color: var(--text-2); }
body:has(.theme-toggle-input:checked) .page-transition-overlay { background: rgba(4, 8, 18, .6); }
body:has(.theme-toggle-input:checked) .page-transition-box {
  background: #101b34; border-color: rgba(255, 255, 255, .1); color: var(--on-dark);
}
body:has(.theme-toggle-input:checked) .page-transition-text { color: var(--on-dark-muted); }
body:has(.theme-toggle-input:checked) .page-transition-dots span { background: #6ea3ff; }
body:has(.theme-toggle-input:checked) .page-transition-dots span:nth-child(2) { background: #35d6c1; }
body:has(.theme-toggle-input:checked) .page-transition-dots span:nth-child(3) { background: #b48be0; }
@media (prefers-reduced-motion: reduce) {
  .page-transition-dots span { animation-duration: 1.8s; }
}

/* --------------------------------------------------------------------------
   25. 404 page — full-screen dark takeover, independent of the rest of the
   site's light/blue theme and of the user's light/dark toggle (this page
   always renders dark, on purpose). Big bold glitching digits that shy away
   from the cursor ("magnetic" repel, set inline by error_404.js), a
   mouse-tracked spotlight that sweeps a dot-grid out of the dark, and an
   ambient radar + drifting stars for depth. Entirely scoped under
   body.err404-body so nothing else on the site is touched.
   -------------------------------------------------------------------------- */
body.err404-body {
  min-height: 100vh; margin: 0; overflow-x: hidden;
  background: radial-gradient(120% 100% at 50% -10%, #16213f 0%, #070b16 55%, #04060c 100%);
  color: #eef2ff; font-family: inherit;
}
body.err404-body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .22) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(circle 240px at var(--err404-mx, 50%) var(--err404-my, 30%), #000 0%, transparent 72%);
          mask-image: radial-gradient(circle 240px at var(--err404-mx, 50%) var(--err404-my, 30%), #000 0%, transparent 72%);
  transition: -webkit-mask-position .05s linear;
}
.err404-nav {
  position: relative; z-index: 2; display: flex; align-items: center;
  padding: var(--s-5) var(--s-6);
}
.err404-brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: #cfd9ff; text-decoration: none; font-weight: 700; font-size: 14px;
  opacity: .8; transition: opacity var(--fast) var(--ease);
}
.err404-brand:hover { opacity: 1; }
.err404-brand-logo { width: 26px; height: 26px; border-radius: 8px; }
.err404-stage {
  position: relative; z-index: 1; min-height: calc(100vh - 70px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--s-6) var(--s-5) var(--s-9); gap: var(--s-2);
}
.err404-radar { position: absolute; top: 8%; inset-inline-end: 8%; width: 150px; height: 150px; opacity: .5; pointer-events: none; }
.err404-radar-ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid #6ea3ff; opacity: 0; animation: err404-ping 2.8s ease-out infinite; }
.err404-radar-ring:nth-child(2) { animation-delay: .9s; }
.err404-radar-ring:nth-child(3) { animation-delay: 1.8s; }
.err404-radar-dot { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #6ea3ff; box-shadow: 0 0 0 6px rgba(110, 163, 255, .18); }
@keyframes err404-ping { 0% { transform: scale(.25); opacity: .8; } 100% { transform: scale(1); opacity: 0; } }
.err404-stars { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.err404-stars span { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #35d6c1; opacity: .5; animation: err404-drift 4.5s ease-in-out infinite; }
.err404-stars span:nth-child(1) { top: 14%; left: 10%; animation-delay: 0s; }
.err404-stars span:nth-child(2) { top: 22%; left: 82%; animation-delay: .5s; background: #b48be0; }
.err404-stars span:nth-child(3) { top: 74%; left: 7%; animation-delay: 1s; background: #6ea3ff; }
.err404-stars span:nth-child(4) { top: 80%; left: 88%; animation-delay: 1.5s; }
.err404-stars span:nth-child(5) { top: 48%; left: 4%; animation-delay: 2s; background: #b48be0; }
.err404-stars span:nth-child(6) { top: 42%; left: 93%; animation-delay: 2.5s; background: #6ea3ff; }
@keyframes err404-drift { 0%, 100% { transform: translateY(0) scale(1); opacity: .3; } 50% { transform: translateY(-16px) scale(1.5); opacity: .9; } }
.err404-digits {
  position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-end;
  gap: clamp(6px, 2.4vw, 24px); margin: 0; direction: ltr;
  --err404-px: clamp(9px, 5vw, 40px);
  --err404-cat-px: clamp(4px, 1.3vw, 9px);
}
.err404-pixel-digit {
  position: relative; z-index: 2; display: grid;
  grid-template-columns: repeat(5, var(--err404-px)); grid-template-rows: repeat(7, var(--err404-px));
  will-change: transform; transition: transform .45s cubic-bezier(.16, 1.3, .4, 1);
}
.err404-pixel-digit span { background: #eef2ff; }
/* A small pixel-art cat wanders left and right behind the "404" blocks,
   ducking out of sight behind the solid pixels and reappearing through the
   open middle of the "0" -- pure CSS, no per-frame sprite assets needed. */
.err404-cat-track {
  position: absolute; z-index: 1; inset-inline: 0; top: 44%; transform: translateY(-50%);
  height: calc(var(--err404-cat-px) * 5); pointer-events: none;
}
.err404-cat {
  position: absolute; top: 0; left: 0; transform-origin: 50% 100%;
  animation: err404-cat-walk 12s ease-in-out infinite;
}
.err404-cat-bob {
  display: grid; grid-template-columns: repeat(8, var(--err404-cat-px)); grid-template-rows: repeat(5, var(--err404-cat-px));
  animation: err404-cat-bob .45s ease-in-out infinite alternate;
}
.err404-cat-bob span { background: #6ea3ff; }
@keyframes err404-cat-walk {
  0% { left: 0%; transform: scaleX(1); }
  49% { transform: scaleX(1); }
  50% { left: calc(100% - var(--err404-cat-px) * 8); transform: scaleX(-1); }
  99% { transform: scaleX(-1); }
  100% { left: 0%; transform: scaleX(1); }
}
@keyframes err404-cat-bob { 0% { transform: translateY(0); } 100% { transform: translateY(-3px); } }
.err404-dust {
  position: absolute; bottom: -2px; width: 4px; height: 4px; border-radius: 50%;
  background: #9fabce; opacity: 0; animation: err404-dust-puff 3s ease-in-out infinite;
}
@keyframes err404-dust-puff {
  0%, 100% { opacity: 0; transform: translateY(0) scale(.6); }
  30% { opacity: .8; transform: translateY(-6px) scale(1); }
  60% { opacity: 0; transform: translateY(-14px) scale(.8); }
}
.err404-tagline { position: relative; z-index: 1; margin: var(--s-5) 0 0; font-size: clamp(18px, 3vw, 26px); font-weight: 800; color: #f4f6ff; }
.err404-sub { position: relative; z-index: 1; margin: 6px 0 0; max-width: 480px; color: #9fabce; font-size: 14px; line-height: 1.9; }
.err404-cta {
  position: relative; z-index: 1; margin-top: var(--s-6); display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 30px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px;
  color: #04060c; background: linear-gradient(135deg, #6ea3ff, #35d6c1);
  box-shadow: 0 10px 30px -8px rgba(110, 163, 255, .55);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.err404-cta:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 36px -8px rgba(110, 163, 255, .7); }
.err404-hint { position: relative; z-index: 1; margin-top: var(--s-4); font-size: 12px; color: #5f6b93; display: none; animation: err404-pulse 2.4s ease-in-out infinite; }
@keyframes err404-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@media (pointer: fine) { .err404-hint { display: inline-block; } }
@media (prefers-reduced-motion: reduce) {
  body.err404-body::before { -webkit-mask-image: none; mask-image: none; opacity: .12; }
  .err404-radar-ring, .err404-stars span, .err404-cat, .err404-cat-bob, .err404-dust { animation: none; opacity: .5; }
  .err404-pixel-digit { transition: none; }
  .err404-hint { display: none; }
}
@media (max-width: 560px) {
  .err404-radar { width: 100px; height: 100px; top: 4%; }
  .err404-digits { gap: 2px; }
}
/* The shared sitewide footer note ("نتایج آزمون‌ها...") doesn't fit this
   page's full dark takeover, so it's hidden here only; the page-transition
   overlay markup from _footer.html stays untouched and still works. */
body.err404-body footer { display: none; }
