:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #d8dee8;
  --nav: #222832;
  --nav-soft: #343b47;
  --primary: #2f7d68;
  --primary-dark: #246351;
  --accent: #e85157;
  --danger: #b83d49;
  --warning: #b7791f;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.student-url #teacher-app {
  display: none;
}

.student-url #student-app {
  display: block;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.16), transparent 28rem),
    radial-gradient(circle at 80% 0%, rgba(124, 58, 237, 0.15), transparent 24rem),
    var(--bg);
}

.auth-card {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.16);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.auth-brand h1 {
  font-size: 30px;
}

.auth-brand p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 6px;
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--soft-shadow);
}

.auth-form {
  display: none;
  gap: 14px;
}

.auth-form.active {
  display: grid;
}

.auth-form .primary-button {
  width: 100%;
  margin-top: 4px;
}

.auth-hint,
.auth-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--danger);
  font-weight: 800;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #cbd5e1;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #eef2f7;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
}

.nav-button:hover,
.nav-button.active {
  background: var(--nav-soft);
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 124px;
  background: var(--accent);
  color: #fff;
  padding: 26px 36px;
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  opacity: 0.86;
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.topbar-actions,
.section-head,
.panel-head,
.question-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions {
  flex-wrap: wrap;
  align-items: center;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.bottom-editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.editor-switcher-panel {
  padding: 18px 22px;
}

.editor-switcher-panel label {
  max-width: 520px;
}

.view {
  display: none;
  padding: 30px 36px 44px;
}

.view.active {
  display: block;
}

.panel,
.test-card,
.question-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
  margin-bottom: 18px;
}

.panel-head {
  margin-bottom: 18px;
}

.section-head {
  margin-bottom: 18px;
}

.section-head p,
.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-line {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid #bfd6ca;
  border-radius: 8px;
  background: #eef8f3;
  color: #1e684b;
  padding: 8px 12px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 700;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  align-self: end;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  padding: 10px 12px;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
}

select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  font-weight: 800;
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 10px 15px;
  font-weight: 800;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.panel .secondary-button,
.test-card .secondary-button,
.question-card .secondary-button {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #243041;
}

.test-card .danger-button {
  background: var(--danger);
  color: #fff;
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.icon-button {
  width: 38px;
  padding: 0;
  background: #edf2f7;
  color: #1f2937;
  font-size: 20px;
}

.file-button {
  display: inline-grid;
  place-items: center;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.test-list,
.question-list,
.results-list {
  display: grid;
  gap: 16px;
}

.test-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.test-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
}

.link-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.question-card {
  padding: 22px;
}

.question-card-head {
  align-items: center;
  margin-bottom: 16px;
}

.answer-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.answer-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
}

.answer-row input[type="radio"] {
  width: 18px;
  height: 18px;
}

.question-meta-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(100px, 0.35fr) minmax(140px, 0.5fr);
  gap: 12px;
  margin: 14px 0;
}

.question-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.question-meta-pills span,
.review-meta {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 800;
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(360px, 1.35fr);
  gap: 18px;
}

.category-list,
.library-list {
  display: grid;
  gap: 10px;
}

.category-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 10px 12px;
  font-weight: 800;
}

.category-chip.active,
.category-chip:hover {
  border-color: rgba(47, 125, 104, 0.35);
  background: rgba(47, 125, 104, 0.1);
  color: var(--primary-dark);
}

.library-filter-row {
  margin-bottom: 14px;
}

.library-question-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 14px;
}

.library-question-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.student-shell {
  min-height: 100vh;
  background: #edf1f5;
}

.student-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  background: var(--accent);
  color: #fff;
  padding: 30px max(24px, 8vw);
}

.student-header h1 {
  font-size: 36px;
}

.student-header p {
  margin-bottom: 0;
}

.student-timer {
  align-self: center;
  min-width: 130px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  padding: 12px 14px;
  text-align: center;
  font-weight: 800;
}

.student-header-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
  font-weight: 800;
}

.student-header-info span {
  white-space: nowrap;
}

.student-running .student-header {
  align-items: center;
  min-height: 74px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.student-running .student-header .eyebrow,
.student-running #student-test-meta {
  display: none;
}

.student-running .student-header h1 {
  font-size: 28px;
}

.student-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px 44px;
}

.student-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  margin-bottom: 18px;
}

.student-start-card {
  padding: 0;
  overflow: hidden;
}

.student-start-card h2 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
  font-size: 22px;
  font-weight: 500;
}

.student-start-card h2 strong {
  font-weight: 900;
}

.student-start-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(300px, 1.05fr);
  gap: 48px;
  padding: 34px 28px 24px;
}

.student-entry-form {
  display: grid;
  gap: 24px;
}

.student-entry-form label {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
  font-size: 20px;
  font-weight: 500;
}

.student-entry-form input {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 12px;
}

.student-start-info {
  font-size: 21px;
  line-height: 1.4;
}

.student-start-info p {
  margin-bottom: 8px;
}

.student-start-info span {
  color: #000;
}

.student-start-rules {
  margin-top: 42px;
}

.student-start-rules p {
  margin-bottom: 6px;
}

.student-start-button {
  margin: 0 28px 28px;
}

.availability-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
  padding: 30px;
  border-left: 6px solid var(--primary);
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.availability-card.closed {
  border-left-color: var(--danger);
  background: linear-gradient(135deg, #ffffff 0%, #fff7f7 100%);
}

.availability-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #eaf1ff;
  color: var(--primary);
  font-size: 28px;
  font-weight: 900;
}

.availability-card.closed .availability-icon {
  background: #fee2e2;
  color: var(--danger);
}

.availability-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.availability-card h2 {
  margin: 0 0 10px;
  border: 0;
  padding: 0;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.15;
}

.availability-message {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.availability-note {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.student-quiz {
  display: grid;
  gap: 16px;
}

.student-question {
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
}

.student-question fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.student-question legend {
  margin-bottom: 14px;
  font-size: 19px;
  font-weight: 800;
}

.student-question-points {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.student-option {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  font-weight: 400;
}

.student-option:hover {
  border-color: var(--primary);
  background: #f0f9f6;
}

.student-submit {
  display: flex;
  justify-content: flex-end;
}

.student-navigation {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
}

.required-answer-message {
  grid-column: 1 / -1;
  min-height: 22px;
  color: var(--danger);
  font-weight: 800;
  text-align: right;
}

.required-answer-message:empty {
  display: none;
}

.secondary-nav-button {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #243041;
  padding: 10px 15px;
  font-weight: 800;
}

.secondary-nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.question-progress {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.student-result {
  border-left: 5px solid var(--primary);
}

.result-card {
  padding: 18px;
}

.result-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.result-card-head p:last-child {
  margin-bottom: 0;
}

.result-card.success {
  border-left: 5px solid var(--primary);
}

.result-card.fail {
  border-left: 5px solid var(--danger);
}

.result-group {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.result-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 18px 20px;
  box-shadow: var(--soft-shadow);
}

.result-group-head h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.result-group-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.result-group-list {
  display: grid;
  gap: 16px;
}

.result-visual {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 16px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #fff 68%, transparent 70%),
    conic-gradient(var(--primary) calc(var(--score) * 1%), #e5e7eb 0);
}

.result-card.fail .score-ring {
  background:
    radial-gradient(circle closest-side, #fff 68%, transparent 70%),
    conic-gradient(var(--danger) calc(var(--score) * 1%), #e5e7eb 0);
}

.score-ring span {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}

.score-summary {
  display: grid;
  gap: 10px;
}

.score-row,
.score-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.score-row span,
.score-grid span {
  color: var(--muted);
  font-weight: 800;
}

.score-row strong,
.score-grid strong {
  color: var(--text);
}

.score-bar {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #e5e7eb;
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.result-card.fail .score-bar span {
  background: linear-gradient(90deg, var(--danger), var(--warning));
}

.result-review {
  margin-top: 14px;
}

.result-review summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 900;
}

.result-review ul {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.result-review li {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.result-review li.correct {
  border-left-color: var(--success);
}

.result-review li.wrong {
  border-left-color: var(--danger);
}

.result-review li span {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 16px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-button {
    text-align: center;
  }

  .topbar,
  .student-header,
  .section-head,
  .panel-head,
  .test-card,
  .result-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .test-card {
    grid-template-columns: 1fr;
  }

  .result-visual {
    grid-template-columns: 1fr;
  }

  .score-ring {
    justify-self: center;
  }

  .form-grid,
  .student-form,
  .link-row,
  .library-layout,
  .question-meta-grid,
  .student-start-layout,
  .student-entry-form label,
  .student-navigation {
    grid-template-columns: 1fr;
  }

  .question-progress {
    text-align: left;
  }

  .view {
    padding: 24px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .student-header {
    padding: 22px;
  }

  h1,
  .student-header h1 {
    font-size: 28px;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .panel,
  .question-card,
  .student-question {
    padding: 18px;
  }
}

/* Modern SaaS redesign */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f1f5f9;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --nav: #ffffff;
  --nav-soft: #eef4ff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #7c3aed;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --soft-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

body {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28rem),
    var(--bg);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

.app-shell {
  grid-template-columns: 268px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 12px 0 38px rgba(15, 23, 42, 0.04);
}

.brand-mark {
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
}

.brand span {
  color: var(--muted);
}

.nav-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  color: #1f2937;
  font-weight: 750;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.nav-button:hover,
.nav-button.active {
  background: var(--nav-soft);
  color: var(--primary);
}

.nav-button.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
}

.ghost-nav {
  opacity: 0.72;
}

.ghost-nav:disabled {
  cursor: default;
}

.ai-card {
  margin-top: 32px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #eef4ff);
  padding: 18px;
  color: #1f2937;
}

.ai-card p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.ai-card span {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.user-card {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 16px;
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.user-card .secondary-button {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(320px, 1.25fr);
  gap: 18px;
}

.account-panel {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 900;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form .primary-button {
  justify-self: start;
}

.settings-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.settings-message.error {
  color: var(--danger);
}

.settings-message.success {
  color: var(--success);
}

.admin-users-panel {
  grid-column: 1 / -1;
}

.pending-users-list {
  display: grid;
  gap: 12px;
}

.pending-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 14px;
}

.pending-user-card strong,
.pending-user-card span {
  display: block;
}

.pending-user-card span {
  margin-top: 4px;
  color: var(--muted);
}

.pending-user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.registered-user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.backup-note {
  margin: 12px 0 0;
}

.user-usage-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.user-usage-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.user-usage-stats strong {
  color: var(--text);
}

.user-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 900;
}

.user-status.approved {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.user-status.pending {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}

.compact-empty {
  padding: 18px;
  text-align: left;
}

.topbar {
  min-height: 108px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.78);
  color: var(--text);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  font-size: 32px;
  letter-spacing: 0;
}

.topbar-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: grid;
  grid-template-columns: minmax(280px, 440px) auto;
  align-items: center;
  gap: 14px;
}

.search-box {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--soft-shadow);
  padding: 0 12px;
  color: var(--muted);
}

.search-box input {
  border: 0;
  border-radius: 0;
  padding: 10px 4px;
  box-shadow: none;
}

.primary-button {
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--primary-dark), #6d28d9);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.secondary-button,
.panel .secondary-button,
.test-card .secondary-button,
.question-card .secondary-button,
.secondary-nav-button {
  border-color: var(--line);
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
}

.danger-button,
.test-card .danger-button {
  border-radius: 10px;
  background: var(--danger);
}

.view {
  padding: 28px 36px 48px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
  padding: 20px;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 900;
}

.stat-card strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.stat-card p {
  margin: 7px 0 0;
  color: var(--muted);
}

.stat-card.purple .stat-icon {
  background: #ede9fe;
  color: var(--accent);
}

.stat-card.blue .stat-icon {
  background: #dbeafe;
  color: var(--primary);
}

.stat-card.green .stat-icon {
  background: #d1fae5;
  color: #059669;
}

.stat-card.amber .stat-icon {
  background: #fef3c7;
  color: var(--warning);
}

.section-head {
  align-items: center;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.filter-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  padding: 8px 14px;
  font-weight: 750;
}

.filter-chip.active,
.filter-chip:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eef4ff;
  color: var(--primary);
}

.panel,
.test-card,
.question-card,
.result-card {
  border-color: var(--line);
  border-radius: 16px;
  box-shadow: var(--soft-shadow);
}

.test-card {
  grid-template-columns: minmax(0, 1fr) auto;
  border-radius: 16px;
  padding: 20px 22px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.test-card:hover {
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}

.test-card-main {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.test-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #dbeafe;
  color: var(--primary);
  font-size: 24px;
  font-weight: 900;
}

.test-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.test-course {
  margin: 5px 0 10px;
  color: var(--primary);
  font-weight: 750;
}

.test-meta,
.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.test-meta {
  color: #475569;
  font-size: 14px;
}

.feature-row {
  margin-top: 12px;
}

.status-pill,
.feature-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 800;
}

.status-pill {
  background: #d1fae5;
  color: #047857;
}

.feature-pill {
  background: #eef4ff;
  color: var(--primary);
}

.muted-pill {
  background: #f1f5f9;
  color: var(--muted);
}

.card-actions {
  gap: 8px;
}

.icon-action {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: #1f2937;
  font-size: 18px;
  font-weight: 900;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease;
}

.icon-action:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--primary);
  transform: translateY(-1px) scale(1.02);
}

.danger-icon:hover {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--danger);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--muted);
  padding: 28px;
  text-align: center;
  font-weight: 750;
}

.status-line {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--primary);
}

input,
textarea,
select,
.checkbox-field {
  border-radius: 10px;
  border-color: #dbe3ef;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.student-header {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --panel: #111827;
    --panel-soft: #1f2937;
    --text: #f8fafc;
    --muted: #94a3b8;
    --line: #273244;
    --nav: #0b1220;
    --nav-soft: #172033;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    --soft-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28rem),
      var(--bg);
  }

  .sidebar,
  .topbar,
  .panel,
  .test-card,
  .question-card,
  .result-card,
  .stat-card,
  .search-box,
  .auth-card,
  .auth-tab.active,
  .user-card,
  .secondary-button,
  .panel .secondary-button,
  .icon-action,
  input,
  select,
  textarea,
  .checkbox-field {
    background: var(--panel);
    color: var(--text);
  }

  .ai-card {
    background: linear-gradient(145deg, #111827, #172033);
  }
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 940px) {
  .sidebar {
    position: static;
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ai-card {
    display: none;
  }

  .test-card-main {
    grid-template-columns: 48px 1fr;
  }
}

@media (max-width: 640px) {
  .stats-grid,
  .nav {
    grid-template-columns: 1fr;
  }

  .test-card-main {
    grid-template-columns: 1fr;
  }

  .test-icon {
    width: 48px;
    height: 48px;
  }
}
