@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --theme-ink: #07111f;
  --theme-ink-2: #0d1b2e;
  --theme-paper: #f6f8fc;
  --theme-white: #ffffff;
  --theme-muted: #607087;
  --theme-line: #dfe6f0;
  --theme-blue: #176bff;
  --theme-cyan: #44d7ff;
  --theme-violet: #7c55ff;
  --theme-lime: #b9f55a;
  --theme-shadow: 0 18px 60px rgba(19, 44, 77, .10);
  --theme-radius: 24px;
  --text: var(--theme-ink);
  --muted: var(--theme-muted);
  --line: var(--theme-line);
  --primary: var(--theme-blue);
  --primary2: #0d55d8;
  --bg: var(--theme-paper);
  --card: var(--theme-white);
  --shadow: var(--theme-shadow);
  --radius: var(--theme-radius);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  color: var(--theme-ink);
  background:
    radial-gradient(circle at -8% 12%, rgba(68, 215, 255, .14), transparent 30rem),
    radial-gradient(circle at 108% 4%, rgba(124, 85, 255, .12), transparent 32rem),
    var(--theme-paper);
  font-family: Manrope, "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
  letter-spacing: .002em;
}
body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: .58;
  background-image:
    linear-gradient(rgba(7, 17, 31, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 17, 31, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}
body > .topbar,
body > .shell,
body > footer { position: relative; z-index: 1; }
a { color: var(--theme-blue); }
h1, h2, h3 {
  font-family: "Space Grotesk", Manrope, "Segoe UI", sans-serif;
  line-height: 1.08;
  letter-spacing: -.045em;
}
h1 { font-weight: 700; }
h2, h3 { font-weight: 700; }

/* Header: transparent, compact and technology-oriented. */
.topbar {
  height: 78px;
  padding: 0;
  background: rgba(246, 248, 252, .78);
  border-bottom: 1px solid rgba(7, 17, 31, .09);
  box-shadow: 0 8px 30px rgba(19, 44, 77, .045);
  backdrop-filter: blur(18px) saturate(145%);
}
.topbar-inner {
  width: 100%;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  gap: 25px;
}
.brand {
  min-width: 214px;
  gap: 11px;
  color: var(--theme-ink);
}
.brand-mark {
  position: relative;
  width: 39px;
  height: 39px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  color: var(--theme-cyan);
  background: var(--theme-ink);
  box-shadow: 0 10px 24px rgba(7, 17, 31, .18), inset 0 1px 0 rgba(255, 255, 255, .12);
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.08em;
}
.brand-mark.brand-logo-mark {
  display: block !important;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  right: -16px;
  bottom: -22px;
  border: 1px solid rgba(68, 215, 255, .40);
  border-radius: 50%;
}
.brand b {
  color: var(--theme-ink);
  font-family: "Space Grotesk", Manrope, sans-serif;
  font-size: 17px;
  letter-spacing: -.035em;
  line-height: 1;
}
.brand small {
  margin-top: 3px;
  color: var(--theme-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.topbar nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 11px;
  color: #4c5b70;
  font-size: 12px;
  font-weight: 800;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}
.topbar nav a::after {
  content: "";
  position: absolute;
  right: 11px;
  bottom: 4px;
  left: 11px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--theme-blue), var(--theme-cyan));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .2s ease;
}
.topbar nav a:hover {
  color: var(--theme-blue);
  background: rgba(232, 238, 255, .82);
  transform: translateY(-1px);
}
.topbar nav a.active {
  color: #2447b9;
  background: rgba(224, 232, 255, .88);
}
.topbar nav a.active::after { transform: scaleX(1); }
.userbox { gap: 7px; color: var(--theme-ink); }
.nav-utility {
  padding: 8px 10px !important;
  border-radius: 10px;
  color: #53627a !important;
  font-size: 11px !important;
  font-weight: 800 !important;
}
.nav-utility:hover { color: var(--theme-blue) !important; background: rgba(255, 255, 255, .72); }
.user-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--theme-ink);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.user-profile:hover {
  border-color: rgba(174, 188, 224, .55);
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 6px 18px rgba(34, 50, 94, .07);
}
.user-avatar {
  width: 35px;
  height: 35px;
  border: 1px solid #d6e0ff;
  border-radius: 11px;
  color: #294bbb;
  background: linear-gradient(145deg, #eef3ff, #dbe6ff);
  font-size: 11px;
  font-weight: 850;
}
.user-meta { max-width: 150px; }
.user-meta b { font-size: 11px; }
.user-meta small { margin-top: 3px; color: #8b98ad; font-size: 9px; }
.icon-btn { color: #607087; }
.icon-btn:hover { color: var(--theme-blue); background: #fff; }
.mobile-nav-toggle {
  border: 1px solid #ccd8f1;
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 6px 16px rgba(34, 50, 94, .08);
}
.mobile-nav-toggle span { background: var(--theme-ink); }

/* Content rhythm and typography. */
.shell {
  width: 100%;
  max-width: 1240px;
  flex: 1;
  padding: 72px 20px 96px;
}
.page-head { margin: 0 0 38px; }
.page-eyebrow,
.page-head .page-eyebrow,
.kicker {
  margin-bottom: 14px;
  color: var(--theme-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.page-head h1 {
  margin: 0 0 12px;
  color: var(--theme-ink);
  font-size: clamp(2.7rem, 5.4vw, 5.2rem);
  line-height: 1;
}
.page-head p {
  max-width: 780px;
  color: var(--theme-muted);
  font-size: 15px;
  line-height: 1.7;
}
.section-title { margin: 52px 0 18px; }
.section-title h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); }
.section-title .section-caption { color: #8a99ae; }

/* AIDT-inspired pills, cards and interaction states. */
.btn {
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--theme-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(23, 107, 255, .22);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover {
  background: #075adf;
  box-shadow: 0 15px 34px rgba(23, 107, 255, .30);
  transform: translateY(-2px);
}
.btn-sm { min-height: 42px; padding: 0 17px; font-size: 11px; }
.btn-ghost {
  border: 1px solid var(--theme-line);
  color: var(--theme-ink);
  background: rgba(255, 255, 255, .78);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--theme-blue); background: #fff; border-color: #a9c5ff; box-shadow: 0 9px 22px rgba(19, 44, 77, .09); }
.btn-secondary { background: var(--theme-ink); }
.btn-danger { background: #c92f4c; }
.actions { gap: 10px; }
.card {
  padding: 26px;
  border: 1px solid rgba(214, 224, 239, .94);
  border-radius: var(--theme-radius);
  background: rgba(255, 255, 255, .90);
  box-shadow: var(--theme-shadow);
}
.card h2, .card h3 { color: var(--theme-ink); }
.card-sub { color: var(--theme-muted); line-height: 1.55; }
.card-hover { transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.card-hover:hover {
  border-color: #a8c7ff;
  box-shadow: 0 24px 70px rgba(19, 44, 77, .14);
  transform: translateY(-6px);
}
.metric {
  position: relative;
  min-height: 136px;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--theme-line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 16px 46px rgba(19, 44, 77, .08);
  transition: transform .25s ease, box-shadow .25s ease;
}
.metric::after {
  content: "";
  position: absolute;
  top: -78px;
  right: -56px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(23, 107, 255, .14), transparent 67%);
}
.metric:hover { box-shadow: 0 23px 55px rgba(19, 44, 77, .13); transform: translateY(-4px); }
.metric span { position: relative; z-index: 1; color: #70819a; font-size: 10px; letter-spacing: .13em; }
.metric strong { position: relative; z-index: 1; margin: 7px 0 3px; font-family: "Space Grotesk", sans-serif; font-size: 38px; }
.metric small { position: relative; z-index: 1; color: var(--theme-muted); font-size: 11px; }
.metric.good { border-top: 3px solid #1aa879; border-left: 1px solid var(--theme-line); }
.metric.warn { border-top: 3px solid #eca31b; border-left: 1px solid var(--theme-line); }
.metric.bad { border-top: 3px solid #dc5268; border-left: 1px solid var(--theme-line); }
.badge, .role-pill {
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.badge.neutral { color: #53647a; background: #eef2f7; }
.badge.info { color: #294bbb; background: #e6edff; }
.badge.success { color: #087a55; background: #dcf8ec; }
.badge.warning { color: #946008; background: #fff2cf; }

/* Dashboard hero. */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 285px;
  margin-bottom: 26px;
  padding: 48px 52px;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 18%, rgba(68, 215, 255, .36), transparent 28%),
    linear-gradient(120deg, #07111f 0%, #12305b 43%, #176bff 100%);
  box-shadow: 0 28px 78px rgba(19, 44, 77, .27);
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -205px;
  right: -56px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 50%;
  box-shadow: 0 0 0 74px rgba(255, 255, 255, .035), 0 0 0 148px rgba(255, 255, 255, .025);
}
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .42;
  background-image:
    linear-gradient(rgba(255, 255, 255, .11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .11) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(90deg, #000, transparent 74%);
}
.hero > * { position: relative; z-index: 1; }
.hero .kicker { color: var(--theme-cyan); }
.hero h1 { max-width: 820px; margin: 0 0 14px; color: #fff; font-size: clamp(2.35rem, 5vw, 4.5rem); }
.hero p { max-width: 780px; color: #d9e8ff; font-size: 15px; line-height: 1.75; }
.hero-actions { margin-top: 26px; }
.hero-actions .btn-ghost { border-color: rgba(255,255,255,.30); color: #fff; background: rgba(255,255,255,.12); }
.hero-actions .btn-ghost:hover { border-color: rgba(255,255,255,.58); color: #fff; background: rgba(255,255,255,.20); }
.student-hero { min-height: 300px; }
.student-hero .hero-actions { display: flex; flex-wrap: wrap; }

/* Lists, tables and forms. */
.entity-card, .assessment-card { min-height: 230px; }
.entity-card h3, .assessment-card h3 { font-size: 20px; }
.entity-card .entity-meta, .assessment-discipline { color: var(--theme-muted); }
.entity-card .entity-stats { margin-top: auto; padding-top: 22px; }
.entity-stat b { font-family: "Space Grotesk", sans-serif; font-size: 23px; }
.assessment-time-box {
  padding: 12px 13px;
  border: 1px solid #e2e8f2;
  border-radius: 13px;
  background: #f8fafd;
}
.assessment-time-box span { color: #8a99ae; font-size: 9px; letter-spacing: .08em; }
.assessment-time-box b { color: #34465d; font-size: 11px; }
.table-toolbar { margin-bottom: 16px; }
.table-wrap {
  overflow: auto;
  border: 1px solid var(--theme-line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 14px 44px rgba(19, 44, 77, .075);
}
table { font-size: 13px; }
th {
  padding: 14px 15px;
  color: #73839a;
  background: #f7f9fd;
  font-size: 10px;
  letter-spacing: .08em;
}
td { padding: 14px 15px; color: #34465d; }
tbody tr { transition: background .18s ease; }
tbody tr:hover { background: #f1f5ff; }
.table-primary { color: var(--theme-ink); font-weight: 800; }
.table-secondary { color: #8a99ae; }
.field { gap: 7px; }
.field label { color: #52627a; font-size: 11px; font-weight: 800; }
.field input, .field select, .field textarea {
  border: 1px solid #d6e0ee;
  border-radius: 13px;
  padding: 12px 13px;
  color: var(--theme-ink);
  background: rgba(255, 255, 255, .90);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #b3c7ed; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #6d8df3;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(23, 107, 255, .11);
}
.form-section, .qe-card {
  border: 1px solid var(--theme-line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 14px 44px rgba(19, 44, 77, .075);
}
.form-section-num, .qe-step { border-radius: 10px; color: var(--theme-blue); background: #e9efff; }
.form-actions, .qe-bottom-actions {
  border: 1px solid rgba(204, 216, 239, .95);
  border-radius: 17px;
  background: rgba(255, 255, 255, .90);
  box-shadow: 0 16px 44px rgba(19, 44, 77, .13);
  backdrop-filter: blur(15px);
}
.pill {
  border: 1px solid #dbe4f1;
  border-radius: 999px;
  color: #52627a;
  background: rgba(255, 255, 255, .76);
}
.pill:has(input:checked) { color: #294bbb; border-color: #adc0f6; background: #eaf0ff; }
.notice { border-color: #cddcff; border-radius: 16px; background: linear-gradient(135deg, #eef4ff, #fbfcff); color: #344c8e; }
.flash { border-radius: 16px; box-shadow: 0 10px 28px rgba(19, 44, 77, .08); }
.empty { border-radius: 20px; background: rgba(255, 255, 255, .52); }

/* Authentication and student-facing screens. */
.auth { margin-top: 32px; }
.auth-card, .auth .card {
  border-radius: 28px;
  background: rgba(255, 255, 255, .91);
  box-shadow: 0 24px 74px rgba(19, 44, 77, .13);
}
.auth-tabs { gap: 8px; margin-bottom: 14px; }
.auth-tab { border-radius: 999px; color: #66788f; background: rgba(255, 255, 255, .68); }
.auth-tab.active { color: #fff; background: var(--theme-blue); box-shadow: 0 10px 24px rgba(23, 107, 255, .20); }
.auth-panel-head h1 { font-size: 38px; }
.auth-links { border-top-color: #e5ebf4; }
.student-status-item, .student-retake-state { border-color: #dbe4f1; border-radius: 15px; background: rgba(255,255,255,.82); }
.student-mobile-actions-menu { border: 1px solid #d4def0; border-radius: 20px; background: rgba(255,255,255,.98); box-shadow: 0 24px 64px rgba(19,44,77,.22); }
.student-mobile-actions-menu a:hover { background: #eef3ff; }

/* Footer: dark, calm and contact-oriented. */
footer {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 34px max(20px, calc((100vw - 1200px) / 2)) 38px;
  border-top: 0;
  color: #8da0b7;
  background: var(--theme-ink);
  font-size: 11px;
  box-shadow: 0 -18px 50px rgba(7, 17, 31, .07);
}
footer > span:first-child { color: #f4f8ff; font-weight: 800; }
.footer-contact { color: var(--theme-cyan); font-weight: 800; transition: color .2s ease, transform .2s ease; }
.footer-contact:hover { color: #fff; transform: translateY(-1px); }

/* Motion: subtle, purposeful and disabled for users who request less motion. */
@keyframes theme-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes theme-pulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(7, 17, 31, .18), inset 0 1px 0 rgba(255,255,255,.12); }
  50% { box-shadow: 0 14px 30px rgba(23, 107, 255, .24), inset 0 1px 0 rgba(255,255,255,.18); }
}
@keyframes theme-orbit {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(2deg) translateY(-5px); }
}
@media (prefers-reduced-motion: no-preference) {
  .brand-mark { animation: theme-pulse 5s ease-in-out infinite; }
  .hero::before { animation: theme-orbit 8s ease-in-out infinite; transform-origin: 50% 50%; }
  .shell > * { animation: theme-rise .48s cubic-bezier(.2,.78,.28,1) both; }
  .shell > *:nth-child(2) { animation-delay: .04s; }
  .shell > *:nth-child(3) { animation-delay: .08s; }
  .shell > *:nth-child(4) { animation-delay: .12s; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1100px) {
  .topbar-inner { gap: 14px; }
  .brand { min-width: 190px; }
  .topbar nav a { padding-inline: 8px; font-size: 11px; }
}
@media (max-width: 1100px) {
  .topbar { height: 70px; }
  .topbar-inner { padding: 0 16px; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .mobile-nav-toggle { display: grid; place-items: center; }
  .topbar #main-nav {
    position: fixed;
    z-index: 1001;
    top: 84px;
    right: 14px;
    left: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    max-height: calc(100vh - 100px);
    overflow: auto;
    padding: 14px;
    border: 1px solid #d5e0f2;
    border-radius: 22px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 24px 70px rgba(19, 44, 77, .22);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity .22s ease, visibility .22s ease, transform .22s ease;
  }
  .topbar #main-nav.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
  .topbar #main-nav a { min-height: 45px; padding: 11px 13px; border-radius: 13px; font-size: 13px; }
  .topbar #main-nav a::after { right: auto; bottom: 7px; left: 13px; width: 30px; }
  .user-meta { display: none; }
  .shell { padding-top: 52px; }
  .page-head h1 { font-size: clamp(2.45rem, 8vw, 4.1rem); }
}
@media (max-width: 680px) {
  body { background-position: center top; }
  body::before { background-size: 32px 32px; }
  .topbar { height: 66px; }
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .brand b { font-size: 15px; }
  .brand small { font-size: 8px; }
  .topbar #main-nav { top: 78px; right: 10px; left: 10px; }
  .shell { padding: 40px 14px 66px; }
  .page-head { margin-bottom: 28px; }
  .page-head h1 { font-size: 2.7rem; }
  .page-head p { font-size: 13px; }
  .hero { min-height: 0; padding: 32px 23px 36px; border-radius: 24px; }
  .hero h1 { font-size: clamp(2.25rem, 11vw, 3.1rem); }
  .hero p { font-size: 13px; }
  .hero-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .hero-actions .btn { width: 100%; }
  .student-hero .hero-actions { display: none; }
  .card { padding: 19px; border-radius: 20px; }
  .metric { min-height: 122px; padding: 19px; border-radius: 19px; }
  .metric strong { font-size: 32px; }
  .section-title { margin-top: 35px; }
  .section-title h2 { font-size: 1.85rem; }
  .form-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .table-wrap { border-radius: 16px; }
  .table-wrap table { min-width: 680px; }
  .auth { margin-top: 10px; }
  .auth-card, .auth .card { border-radius: 22px; }
  .auth-panel-head h1 { font-size: 30px; }
  footer { align-items: flex-start; flex-direction: column; gap: 9px; padding: 28px 14px 32px; }
}

/* v1.9.1: clearer desktop navigation and a dedicated question-bank workspace. */
.topbar-inner {
  max-width: 1480px;
  padding-inline: 28px;
  gap: 18px;
}
.brand {
  min-width: 205px;
  flex: 0 0 auto;
}
.topbar nav {
  min-width: 0;
  gap: 2px;
  overflow: visible;
}
.topbar nav a {
  min-width: max-content;
  padding-inline: 8px;
  white-space: nowrap;
  font-size: 11.5px;
  letter-spacing: -.01em;
}
.topbar nav a[href="/questions"] {
  padding-inline: 9px;
  color: #40536e;
}
.topbar nav a[href="/questions"]:hover,
.topbar nav a[href="/questions"].active {
  color: #2447b9;
}
.userbox {
  flex: 0 0 auto;
  margin-left: auto;
}
.user-meta {
  max-width: 166px;
}

/* The question bank gets its own visual hierarchy without changing its behavior. */
.shell:has(#questions-table) .page-head {
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 4px;
}
.shell:has(#questions-table) .page-head p {
  max-width: 720px;
}
.shell:has(#questions-table) .page-head .actions {
  max-width: 560px;
  justify-content: flex-end;
  gap: 8px;
}
.shell:has(#questions-table) .page-head .actions .btn {
  min-height: 38px;
  padding-inline: 13px;
  border-radius: 12px;
  font-size: 11px;
}
.shell:has(#questions-table) .grid.grid-3 {
  gap: 14px;
  margin-bottom: 18px !important;
}
.shell:has(#questions-table) .filter-card {
  display: grid;
  grid-template-columns: minmax(210px, .72fr) minmax(300px, 1.5fr) auto;
  align-items: end;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(241,246,255,.82));
}
.shell:has(#questions-table) .filter-card .field,
.shell:has(#questions-table) .filter-card .filter-note {
  margin: 0;
}
.shell:has(#questions-table) .filter-card .filter-note {
  align-self: center;
  color: #71819a;
  font-size: 11px;
  line-height: 1.55;
}
.shell:has(#questions-table) .filter-card > .btn {
  white-space: nowrap;
}
.shell:has(#questions-table) .table-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0 0;
  padding: 16px 20px 14px;
  border: 1px solid var(--theme-line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: rgba(255,255,255,.75);
}
.shell:has(#questions-table) .table-toolbar .field {
  width: min(440px, 100%);
  margin: 0;
}
.shell:has(#questions-table) .table-summary {
  padding-bottom: 9px;
  color: #7c8ba2;
  font-size: 11px;
  white-space: nowrap;
}
.shell:has(#questions-table) .table-wrap {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: 0 18px 52px rgba(19,44,77,.09);
}
#questions-table {
  min-width: 1040px;
  table-layout: fixed;
}
#questions-table th:nth-child(1) { width: 32%; }
#questions-table th:nth-child(2) { width: 17%; }
#questions-table th:nth-child(3) { width: 11%; }
#questions-table th:nth-child(4) { width: 11%; }
#questions-table th:nth-child(5) { width: 8%; }
#questions-table th:nth-child(6) { width: 9%; }
#questions-table th:nth-child(7) { width: 20%; }
#questions-table td { vertical-align: middle; }
#questions-table td:first-child .table-primary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--theme-ink);
  font-family: "Space Grotesk", Manrope, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}
#questions-table td:nth-child(2) > div:first-child {
  color: #344c8e;
  font-weight: 800;
}
#questions-table .stars { letter-spacing: 1px; }
#questions-table .row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
#questions-table .question-view-btn,
#questions-table .table-link {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid #cbd8f6;
  border-radius: 10px;
  color: #3654a6;
  background: #f7f9ff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}
#questions-table .question-view-btn:hover,
#questions-table .table-link:hover {
  border-color: #8da9f5;
  color: #2447b9;
  background: #eaf0ff;
  transform: translateY(-1px);
}
#questions-table .question-view-btn[aria-expanded="true"] {
  color: #fff;
  border-color: #2f58d3;
  background: #3659d8;
}
#questions-table .question-bank-row.question-row-open > td {
  border-bottom-color: transparent;
  background: #f4f7ff;
}
#questions-table .question-detail-row > td {
  padding: 0 18px 18px;
  background: #f4f7ff;
}
.question-preview-card {
  border: 1px solid #d5e0f6;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff, #f5f8ff);
  box-shadow: 0 12px 30px rgba(32,61,125,.08);
}
.question-preview-head {
  border-bottom-color: #e1e8f5;
}
.question-preview-head h3 {
  color: var(--theme-ink);
  font-family: "Space Grotesk", Manrope, sans-serif;
}

@media (max-width: 1100px) {
  .topbar-inner { gap: 12px; padding-inline: 16px; }
  .brand { min-width: 185px; }
  .topbar nav a { padding-inline: 6px; font-size: 10.5px; }
  .user-meta { max-width: 130px; }
  .topbar #main-nav a { min-height: 45px; padding: 11px 13px; font-size: 13px; }
}
@media (max-width: 760px) {
  .shell:has(#questions-table) .page-head .actions {
    max-width: none;
    justify-content: flex-start;
  }
  .shell:has(#questions-table) .filter-card,
  .shell:has(#questions-table) .table-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .shell:has(#questions-table) .filter-card > .btn { width: 100%; }
  .shell:has(#questions-table) .table-summary { padding-bottom: 0; }
}
@media (max-width: 1100px) {
  .topbar #main-nav a {
    min-height: 45px;
    padding: 11px 13px;
    font-size: 13px;
  }
}

/* Keep student status and row actions in independent, predictable columns. */
#students-table {
  width: 100%;
  min-width: 1120px;
  table-layout: fixed;
}
#students-table th:nth-child(1) { width: 4%; }
#students-table th:nth-child(2) { width: 32%; }
#students-table th:nth-child(3) { width: 14%; }
#students-table th:nth-child(4) { width: 11%; }
#students-table th:nth-child(5) { width: 39%; }
#students-table td.row-actions {
  display: table-cell;
  width: 39%;
  text-align: right;
  vertical-align: middle;
  min-width: 0;
  overflow: hidden;
}
#students-table .student-row-actions {
  width: 100%;
  min-width: 0;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
}
#students-table .student-row-action {
  flex: 0 0 auto;
  padding-inline: 7px;
  font-size: 9.5px;
}
#students-table .table-status-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Give the administration shortcuts a clear home instead of floating beside the title. */
main:has(.admin-card) .page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 410px);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  margin-bottom: 48px;
}
main:has(.admin-card) .page-head > div:first-child {
  min-width: 0;
}
main:has(.admin-card) .page-head > div:first-child p {
  max-width: 690px;
}
main:has(.admin-card) .page-head > .actions.wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: center;
  gap: 9px;
  padding: 13px;
  border: 1px solid #d7e1f3;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(237,244,255,.88));
  box-shadow: 0 18px 42px rgba(36,60,119,.10), inset 0 1px 0 rgba(255,255,255,.8);
}
main:has(.admin-card) .page-head > .actions.wrap::before {
  content: "Быстрые действия";
  grid-column: 1 / -1;
  padding: 2px 4px 5px;
  color: #6c7e9b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}
main:has(.admin-card) .page-head > .actions.wrap .btn {
  min-height: 46px;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(202,216,241,.95);
  border-radius: 14px;
  color: #30466e;
  background: rgba(255,255,255,.72);
  box-shadow: none;
  font-size: 11px;
  text-align: left;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
main:has(.admin-card) .page-head > .actions.wrap .btn::after {
  content: "↗";
  margin-left: auto;
  color: #7890bd;
  font-size: 14px;
  transition: transform .18s ease, color .18s ease;
}
main:has(.admin-card) .page-head > .actions.wrap .btn:hover {
  border-color: #9bb3eb;
  color: #2447b9;
  background: #fff;
  box-shadow: 0 8px 18px rgba(45,75,155,.10);
  transform: translateY(-1px);
}
main:has(.admin-card) .page-head > .actions.wrap .btn:hover::after {
  color: #3157d5;
  transform: translate(2px, -2px);
}
main:has(.admin-card) .admin-overview {
  position: relative;
  z-index: 1;
}

@media (max-width: 900px) {
  main:has(.admin-card) .page-head {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 32px;
  }
  main:has(.admin-card) .page-head > .actions.wrap {
    width: 100%;
    max-width: 620px;
  }
}
@media (max-width: 560px) {
  main:has(.admin-card) .page-head > .actions.wrap {
    grid-template-columns: 1fr;
    border-radius: 20px;
  }
}

/* Administration shortcuts sit below the intro and read as one horizontal navigation row. */
main:has(.admin-card) .page-head {
  display: block;
  margin-bottom: 42px;
}
main:has(.admin-card) .page-head > .actions.wrap {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  max-width: none;
  margin-top: 26px;
  padding: 10px;
  gap: 8px;
  border-radius: 20px;
}
main:has(.admin-card) .page-head > .actions.wrap::before {
  display: none;
}
main:has(.admin-card) .page-head > .actions.wrap .btn {
  min-width: 0;
  min-height: 48px;
  justify-content: center;
  padding-inline: 10px;
  text-align: center;
}
main:has(.admin-card) .page-head > .actions.wrap .btn::after {
  margin-left: 3px;
}

@media (max-width: 980px) {
  main:has(.admin-card) .page-head > .actions.wrap {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  main:has(.admin-card) .page-head > .actions.wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 440px) {
  main:has(.admin-card) .page-head > .actions.wrap {
    grid-template-columns: 1fr;
  }
}

/* Shared page-head pattern: intro first, then a calm horizontal action rail. */
main:not(:has(.admin-card)) .page-head:has(> .actions) {
  display: block;
  margin-bottom: 38px;
}
main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  max-width: none;
  margin-top: 22px;
  padding: 9px;
  gap: 8px;
  border: 1px solid #d7e1f3;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(240,245,255,.74));
  box-shadow: 0 12px 30px rgba(36,60,119,.065), inset 0 1px 0 rgba(255,255,255,.8);
}
main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions .btn {
  min-height: 42px;
  justify-content: center;
  padding-inline: 14px;
  border: 1px solid rgba(202,216,241,.95);
  border-radius: 12px;
  color: #3b5078;
  background: rgba(255,255,255,.78);
  box-shadow: none;
  font-size: 11px;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions .btn:hover {
  border-color: #9bb3eb;
  color: #2447b9;
  background: #fff;
  box-shadow: 0 7px 16px rgba(45,75,155,.09);
  transform: translateY(-1px);
}
main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions form {
  display: flex;
  align-items: stretch;
}
main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions form .btn {
  height: 100%;
}
/* The question-bank toolbar also uses the full content width for its actions. */
.shell:has(#questions-table) .page-head .actions {
  max-width: none;
  justify-content: flex-start;
}

@media (max-width: 760px) {
  main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions {
    flex-wrap: wrap;
  }
  main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions .btn,
  main:not(:has(.admin-card)) .page-head:has(> .actions) > .actions form {
    flex: 1 1 auto;
  }
}
