
:root {
  --bg: #F4F5F7;
  --bg-card: #FFFFFF;
  --ink: #0F1B2D;
  --ink-muted: #5C6878;
  --ink-light: #9BABBF;
  --accent: #0F1B2D;
  --accent-soft: #E8EDF3;
  --accent2: #E8500A;
  --accent2-soft: #FEF0EA;
  --green: #1DBF6E;
  --green-soft: #E8FAF1;
  --tt-blue: #0075BE;
  --tt-blue-soft: #E5F3FB;
  --tt-navy: #0F1B2D;
  --border: #E2E6EB;
  --border-strong: #C8CDD5;
  --shadow-sm: 0 1px 3px rgba(15,27,45,0.07);
  --shadow-md: 0 4px 16px rgba(15,27,45,0.09);
  --shadow-lg: 0 12px 40px rgba(15,27,45,0.14);
  --r: 12px;
  --r-lg: 20px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

h1,h2,h3,h4,h5 { font-family: 'Syne', sans-serif; }

/* ── NAV ── */
.nav {
  background: var(--tt-navy);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.nav-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.nav-logo span { color: var(--tt-navy); }
.nav-tabs { display: flex; gap: 2px; }
.nav-tab {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #aaa;
  cursor: pointer;
  border: none;
  background: none;
  transition: all .2s;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}
.nav-tab:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-tab.active { background: var(--accent); color: #fff; }
/* Hide text labels on small screens, show only emoji */
.nav-tab-label { display: inline; }
.nav-user {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
/* Hamburger button (hidden on desktop) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #fff;
  font-size: 22px;
  line-height: 1;
}
/* Mobile drawer */
.nav-drawer {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: #1a1a1a;
  z-index: 99;
  flex-direction: column;
  padding: 8px 0 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-drawer.open { display: flex; }
.nav-drawer-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.nav-drawer-btn:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-drawer-btn.active { color: #fff; background: rgba(26,60,255,0.25); }
.nav-drawer-btn .drawer-icon { font-size: 18px; }

@media (max-width: 820px) {
  .nav-tabs { display: none; }
  .nav-hamburger { display: block; }
  .nav { padding: 0 16px; }
  .page { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tests-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  #page-send > div { grid-template-columns: 1fr !important; }
  .qe-layout { grid-template-columns: 1fr; height: auto; }
  .qe-sidebar { min-height: 300px; max-height: 40vh; border-right: none; border-bottom: 1.5px solid var(--border); }
}

/* ── PAGES ── */
.page { display: none; padding: 36px 40px; max-width: 1200px; margin: 0 auto; }
.page.active { display: block; }
#page-editor { padding: 0 !important; max-width: none !important; margin: 0 !important; }
#page-editor.active { display: flex !important; flex-direction: column; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.8px; }
.page-subtitle { color: var(--ink-muted); font-size: 14px; margin-top: 4px; font-weight: 300; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary { background: var(--tt-blue); color: #fff; }
.btn-primary:hover { background: #005A95; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg-card); color: var(--ink); border: 1.5px solid var(--border-strong); }
.btn-secondary:hover { background: var(--bg); border-color: var(--ink-muted); }
.btn-danger { background: #FFF0EE; color: #D0360A; border: 1.5px solid #FFCFC4; }
.btn-danger:hover { background: #FFE0D8; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 9px; }

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .2s;
}
.stat-card:hover::before { opacity: 1; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 32px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.stat-delta { font-size: 12px; color: var(--green); margin-top: 6px; font-weight: 500; }
.stat-icon { position: absolute; right: 20px; top: 20px; font-size: 24px; opacity: 0.15; }

/* ── TABLE ── */
.table-wrap { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1.5px solid var(--border);
}
.table-header h3 { font-size: 16px; font-weight: 700; }
.table-filters { display: flex; gap: 8px; align-items: center; }
.filter-select {
  padding: 7px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--accent); }
.search-input {
  padding: 7px 12px 7px 36px;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
  width: 200px;
  position: relative;
}
.search-input:focus { border-color: var(--accent); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); width: 15px; height: 15px; }

table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1.5px solid var(--border); }
thead th {
  padding: 12px 20px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Syne', sans-serif;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  cursor: pointer;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
td { padding: 14px 20px; font-size: 14px; }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: var(--green-soft); color: #0E9B52; }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-orange { background: #FFF4E0; color: #C47900; }
.badge-red { background: var(--accent2-soft); color: var(--accent2); }
.badge-gray { background: #F0F0EC; color: var(--ink-muted); }

/* ── SCORE BAR ── */
.score-bar-wrap { display: flex; align-items: center; gap: 10px; }
.score-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}
.score-bar-fill.high { background: var(--green); }
.score-bar-fill.mid { background: #F5A623; }
.score-bar-fill.low { background: var(--accent2); }
.score-text { font-weight: 700; font-size: 13px; min-width: 36px; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  width: 90%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1.5px solid var(--border);
}
.modal-head h2 { font-size: 20px; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--ink-muted);
  transition: all .15s;
}
.modal-close:hover { background: var(--border); color: var(--ink); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 28px 24px;
  border-top: 1.5px solid var(--border);
}

/* ── FORM ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-label span { color: var(--accent2); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  background: #fff;
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--ink-muted); margin-top: 5px; }

/* ── TEST CARD ── */
.tests-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.test-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: all .2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.test-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.test-card-accent {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.test-card-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.test-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.test-card p { font-size: 13px; color: var(--ink-muted); line-height: 1.5; margin-bottom: 16px; }
.test-card-meta { display: flex; gap: 16px; }
.test-meta-item { font-size: 12px; color: var(--ink-muted); display: flex; align-items: center; gap: 4px; }

/* ── RESULT DETAIL ── */
.result-hero {
  background: var(--ink);
  border-radius: var(--r-lg);
  padding: 32px;
  color: #fff;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.result-hero-name { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.result-hero-sub { color: #aaa; font-size: 14px; }
.result-big-score {
  font-family: 'Syne', sans-serif;
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  text-align: center;
}
.result-big-score span { font-size: 24px; color: #aaa; }

.result-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.section-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
}
.section-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.section-topic { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-topic-name { font-size: 13px; color: var(--ink-muted); }
.section-topic-score { font-size: 13px; font-weight: 600; }

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── CHIP GROUP ── */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border-strong);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all .15s;
  background: none;
  font-family: 'DM Sans', sans-serif;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { font-size: 18px; }

/* ── CANDIDATE TEST PAGE ── */
.test-intro {
  max-width: 640px;
  margin: 60px auto 0;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 48px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.test-intro-icon {
  width: 72px; height: 72px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 24px;
}
.test-intro h1 { font-size: 28px; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.8px; }
.test-intro p { color: var(--ink-muted); line-height: 1.6; margin-bottom: 28px; }
.test-intro-meta { display: flex; gap: 24px; justify-content: center; margin-bottom: 32px; }
.test-intro-meta-item { text-align: center; }
.test-intro-meta-item strong { display: block; font-size: 22px; font-weight: 800; font-family: 'Syne', sans-serif; }
.test-intro-meta-item span { font-size: 12px; color: var(--ink-muted); }

/* ── QUIZ ── */
.quiz-wrap { max-width: 720px; margin: 0 auto; padding: 32px 0; }
.quiz-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 32px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .4s ease;
}
.quiz-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.quiz-q-num { font-size: 13px; color: var(--ink-muted); font-weight: 500; }
.quiz-timer {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 6px 14px;
}
.quiz-timer.warning { color: #D95C0A; border-color: #FFCFA8; background: #FFF6EF; }

.quiz-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.quiz-topic-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.quiz-question { font-size: 18px; font-weight: 600; line-height: 1.4; margin-bottom: 24px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  padding: 14px 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  text-align: left;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.quiz-option:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.quiz-option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.quiz-option.correct { border-color: var(--green); background: var(--green-soft); color: #0E9B52; }
.quiz-option.wrong { border-color: var(--accent2); background: var(--accent2-soft); color: var(--accent2); }
.quiz-option.show-correct { border-color: var(--green); background: var(--green-soft); color: #0E9B52; }
.quiz-option-letter {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.quiz-option.selected .quiz-option-letter { background: var(--accent); color: #fff; }
.quiz-option.correct .quiz-option-letter { background: var(--green); color: #fff; }
.quiz-option.wrong .quiz-option-letter { background: var(--accent2); color: #fff; }

.quiz-explanation {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 12px;
  display: none;
}
.quiz-explanation.show { display: block; }
.quiz-explanation.correct-exp { background: var(--green-soft); color: #0E9B52; border: 1px solid #A8EFD0; }
.quiz-explanation.wrong-exp { background: var(--accent2-soft); color: #C73B1A; border: 1px solid #FFBFAD; }

.quiz-nav { display: flex; justify-content: space-between; align-items: center; }

/* ── RESULT PAGE ── */
.quiz-result {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 0;
  text-align: center;
}
.result-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  margin: 0 auto 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
}
.result-circle-score { font-size: 42px; font-weight: 800; line-height: 1; }
.result-circle-max { font-size: 14px; opacity: 0.7; }
.result-grade { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.result-feedback { color: var(--ink-muted); font-size: 15px; margin-bottom: 32px; line-height: 1.6; }

.result-breakdown {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  text-align: left;
  margin-bottom: 24px;
}
.result-breakdown h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
}
.breakdown-row:last-child { margin-bottom: 0; }
.breakdown-label { color: var(--ink-muted); flex: 1; }
.breakdown-bar { flex: 2; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 0 12px; }
.breakdown-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.breakdown-pct { font-weight: 700; min-width: 36px; text-align: right; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: 14px; line-height: 1.5; }

/* ── TABS ── */
.inner-tabs { display: flex; gap: 4px; background: var(--border); border-radius: 10px; padding: 4px; width: fit-content; margin-bottom: 24px; }
.inner-tab {
  padding: 7px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink-muted);
  transition: all .15s;
}
.inner-tab.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── LOGIN ── */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  position: fixed;
  inset: 0;
  z-index: 500;
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 48px;
  width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 24px; margin-bottom: 32px; }
.login-logo span { color: var(--tt-blue); }
.login-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-card p { color: var(--ink-muted); font-size: 14px; margin-bottom: 28px; }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .35s ease forwards; }
.fade-up-2 { animation: fadeUp .35s .1s ease forwards; opacity: 0; }
.fade-up-3 { animation: fadeUp .35s .2s ease forwards; opacity: 0; }

/* ── QUESTION EDITOR ── */
.qe-layout { display: grid; grid-template-columns: 280px 1fr; gap: 0; flex: 1; min-height: 600px; overflow: hidden; }
.qe-sidebar {
  background: var(--bg-card);
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 600px;
}
.qe-sidebar-head {
  padding: 20px 20px 14px;
  border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}
.qe-sidebar-head h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.qe-test-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 9px;
  padding: 3px;
}
.qe-test-btn {
  flex: 1;
  padding: 8px 8px 6px;
  border-radius: 7px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  text-align: center;
  line-height: 1.2;
  color: var(--ink-muted);
  transition: all .15s;
  text-align: center;
}
.qe-test-btn.active { background: var(--bg-card); color: var(--ink); box-shadow: var(--shadow-sm); }
.qe-search {
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.qe-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 9px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}
.qe-search input:focus { border-color: var(--accent); }

.qe-topic-group { flex-shrink: 0; }
.qe-topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 6px;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.qe-topic-header:hover { background: var(--bg); }
.qe-topic-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-muted); }
.qe-topic-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--border);
  color: var(--ink-muted);
  border-radius: 10px;
  padding: 1px 7px;
}
.qe-q-list { overflow-y: auto; flex: 1; padding-bottom: 12px; }
.qe-q-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .12s;
  position: relative;
}
.qe-q-item:hover { background: var(--bg); }
.qe-q-item.active { background: var(--accent-soft); border-left-color: var(--accent); }
.qe-q-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-light);
  min-width: 22px;
  padding-top: 1px;
}
.qe-q-text {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.qe-q-item.active .qe-q-text { color: var(--accent); }
.qe-sidebar-footer {
  padding: 14px 20px;
  border-top: 1.5px solid var(--border);
  flex-shrink: 0;
}

/* Editor main panel */
.qe-main {
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--bg);
}
.qe-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--ink-muted);
  gap: 12px;
}
.qe-empty-state-icon { font-size: 48px; opacity: 0.3; }
.qe-editor-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 720px;
}
.qe-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--border);
}
.qe-editor-badge {
  display: flex; align-items: center; gap: 10px;
}
.qe-editor-title { font-size: 15px; font-weight: 700; }
.qe-editor-actions { display: flex; gap: 8px; }

.qe-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.qe-option-letter {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
  background: var(--border);
  color: var(--ink-muted);
  font-family: 'Syne', sans-serif;
}
.qe-option-letter.correct-letter { background: var(--green); color: #fff; }
.qe-correct-radio {
  width: 18px; height: 18px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}
.qe-option-input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 9px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}
.qe-option-input:focus { border-color: var(--accent); background: #fff; }
.qe-option-input.is-correct { border-color: var(--green); background: var(--green-soft); }
.qe-remove-opt {
  width: 30px; height: 30px;
  border-radius: 7px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all .12s;
  flex-shrink: 0;
}
.qe-remove-opt:hover { background: var(--accent2-soft); color: var(--accent2); }

.qe-unsaved-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent2);
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}

/* Stats strip in sidebar */
.qe-stats-strip {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.qe-stats-strip-item {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-right: 1px solid var(--border);
}
.qe-stats-strip-item:last-child { border-right: none; }
.qe-stats-strip-val { font-size: 18px; font-weight: 800; font-family: 'Syne', sans-serif; line-height: 1; }
.qe-stats-strip-lbl { font-size: 10px; color: var(--ink-muted); margin-top: 2px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tests-grid { grid-template-columns: 1fr; }
  .result-sections { grid-template-columns: 1fr; }
  .page { padding: 24px 20px; }
  .qe-layout { grid-template-columns: 1fr; }
}

/* ── AI GENERATOR ── */
@keyframes shake {
  0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-6px)} 40%,80%{transform:translateX(6px)}
}
.ai-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-loading { animation: fadeIn .3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }
.ai-q-card { animation: fadeIn .3s ease; }
.ai-q-card:hover { border-color: var(--accent) !important; }
#page-ai .form-textarea { min-height: 200px; resize: vertical; font-size: 13px; line-height: 1.6; }
#page-ai [id^="ai-type-"] { transition: all .2s; }
@media (max-width: 820px) {
  #page-ai > div > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

