/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-hover: #f3f5f9;
  --surface-alt: #fbfcfe;
  --border: #e4e8ef;
  --border-light: #eff2f7;
  --text: #1a2332;
  --text-secondary: #5b6678;
  --text-muted: #9aa3b2;
  --accent: #5b7a8a;
  --accent-light: #e8eef1;
  --accent-lighter: #f0f4f7;
  --accent-dark: #3d5a68;
  --accent-gradient: linear-gradient(135deg, #5b7a8a 0%, #78a0b5 100%);
  --success: #059669;
  --success-bg: #ecfdf5;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-light: #fecaca;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.10);
  --transition: 0.15s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-dark);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* === Sidebar === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
}

.sidebar.open {
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,0.12);
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.sidebar__brand:hover {
  color: var(--text);
}

.sidebar__logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.sidebar__brand-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar__close {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 6px;
}

.sidebar__close:hover {
  background: var(--surface-hover);
}

.sidebar__nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.sidebar__section-label {
  padding: 16px 12px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar__link:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.sidebar__link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar__link:hover svg {
  opacity: 1;
}

.sidebar__bottom {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-light), #d5dee3);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar__user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar__username {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sidebar__logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.sidebar__logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

.sidebar-overlay.open {
  display: block;
}

/* === App Wrapper === */
.app-wrapper {
  margin-left: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Topbar === */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  z-index: 50;
}

.topbar__burger {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
}

.topbar__burger:hover {
  background: var(--surface-hover);
}

.topbar__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar__right {
  margin-left: auto;
}

.topbar__user {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === Main Content === */
.main-content {
  flex: 1;
  padding: 20px 32px 40px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(91,122,138,0.25);
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 4px 10px rgba(91,122,138,0.28);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: #d1d5db;
}

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

.btn-danger:hover {
  background: #b91c1c;
  color: #fff;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  padding: 0;
}

.btn-link:hover {
  color: var(--accent-dark);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 0.95rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* === Auth === */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 28px;
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

/* === Forms === */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text);
  font-size: 0.85rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--surface);
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,122,138,0.15);
}

/* Native number input — remove ugly default appearance */
.form-group input[type="number"] {
  -moz-appearance: textfield;
  width: 110px;
  text-align: center;
  font-weight: 600;
}
.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Custom select with arrow */
.form-group select,
select.match-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6678' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* File input */
.form-group input[type="file"] {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}
.form-group input[type="file"]::file-selector-button {
  border: none;
  background: var(--accent);
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-right: 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.form-group input[type="file"]::file-selector-button:hover {
  background: var(--accent-dark);
}

/* Global checkbox / radio (when used outside .answer-option) */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

.form-row {
  display: flex;
  gap: 16px;
}
.form-row > .form-group { margin-bottom: 0; }
.form-row + .form-row { margin-top: 20px; }

.form-group--flex { flex: 1; }
.form-group--inline { margin-bottom: 0; display: inline-block; }

.form-container {
  max-width: 560px;
}

.form-container--wide {
  max-width: 880px;
}

.form-actions {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.checkbox-label,
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  user-select: none;
  margin-right: 10px;
}
.checkbox-label input,
.checkbox-inline input { margin: 0; }

/* Utility */
.hidden { display: none !important; }

/* === Alerts === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

/* === Hero === */
.hero {
  text-align: center;
  padding: 48px 0 36px;
}

.hero h1 {
  font-size: 2.2rem;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* (Level card styles are now in Home Hero section below) */

/* === Page Header === */
.page-header {
  margin-bottom: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.page-header h1 {
  color: var(--text);
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  flex: 1;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 100%;
}

.back-link:hover {
  color: var(--accent);
}

/* === Test Cards (Level Page) === */
.tests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}

.test-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.test-card h3 {
  color: var(--text);
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 600;
}

.test-card p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.test-card__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.test-card__score {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* === Quiz Progress (v2) === */
.quiz-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 28px;
  max-width: 760px;
}
.quiz-progress__bar {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.quiz-progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.4s ease;
}
.quiz-progress__text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* === Quiz Navigation === */
.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 20px 0 0;
  max-width: 760px;
}
.quiz-nav--forward { justify-content: flex-end; }

/* === Test Taking (v2) === */
.test-form { max-width: 760px; }

.test-description {
  color: var(--text-secondary);
  margin: -18px 0 24px;
  max-width: 760px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.question-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 38px;
  margin-bottom: 4px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.question-number {
  display: inline-block;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  background: var(--accent-lighter);
  padding: 4px 12px;
  border-radius: 999px;
}

.question-text {
  font-size: 1.25rem;
  line-height: 1.5;
  margin-bottom: 24px;
  color: var(--text);
  font-weight: 600;
}

.question-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-style: italic;
}

.answers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
  background: var(--surface);
  user-select: none;
}
.answer-option:hover {
  border-color: var(--accent);
  background: var(--accent-lighter);
}
.answer-option input[type="radio"],
.answer-option input[type="checkbox"] {
  width: 20px; height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.answer-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-lighter);
  box-shadow: 0 0 0 3px rgba(91, 122, 138, 0.12);
}
.answer-text {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
}

.quiz-input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.96rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--surface);
  color: var(--text);
}
.quiz-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 122, 138, 0.15);
}

/* === Result Page (v2) === */
.result-card {
  text-align: center;
  margin: 0 0 24px;
  padding: 48px 32px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  max-width: 760px;
}

.result-score__circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 8px solid var(--border);
  margin-bottom: 20px;
  background: var(--surface);
  transition: border-color 0.3s ease;
}
.result-score--good { border-color: var(--success); }
.result-score--ok { border-color: var(--warning); }
.result-score--bad { border-color: var(--danger); }

.result-score__number {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.result-score__text {
  color: var(--text-secondary);
  font-size: 1rem;
}

.result-details {
  max-width: 760px;
  margin: 0 0 32px;
}

.result-details h2 {
  color: var(--text);
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
  border-left: 4px solid var(--border);
  box-shadow: var(--shadow);
}

.detail-card--correct {
  border-left-color: var(--success);
}

.detail-card--wrong {
  border-left-color: var(--danger);
}

.detail-card h4 {
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.detail-card--correct h4 {
  color: var(--success);
}

.detail-card--wrong h4 {
  color: var(--danger);
}

.detail-question {
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 500;
}

.detail-answers {
  list-style: none;
  padding: 0;
}

.detail-answers li {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.correct-answer {
  background: var(--success-bg);
}

.wrong-answer {
  background: var(--danger-bg);
}

.answer-mark {
  margin-left: 8px;
  font-weight: 700;
}

.answer-mark--correct {
  color: var(--success);
}

.answer-mark--wrong {
  color: var(--danger);
}

.result-actions {
  display: flex;
  gap: 12px;
  max-width: 760px;
}

/* === Admin === */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.admin-welcome {
  padding: 28px 0 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.admin-welcome__eyebrow {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-lighter);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.admin-welcome h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.admin-welcome p {
  color: var(--text-secondary);
  font-size: 0.98rem;
}

.admin-stat {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  border: 1px solid var(--border);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.admin-stat:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.admin-stat__icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.admin-stat__icon--users { background: #4f79a6; }
.admin-stat__icon--modules { background: #6d9c7f; }
.admin-stat__icon--tests { background: #c9854f; }
.admin-stat__icon--results { background: #8b6fb5; }

.stat-number {
  display: block;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.admin-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.admin-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  padding: 20px 22px;
  border-radius: var(--radius);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--transition);
}
.admin-nav__icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--accent-lighter);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.admin-nav__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-nav__title { font-weight: 600; color: var(--text); font-size: 1rem; }
.admin-nav__hint { font-size: 0.82rem; color: var(--text-muted); }

.admin-nav__link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.admin-nav__link:hover .admin-nav__icon { background: var(--accent); color: white; }

/* === Tables (v2) === */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.data-table th,
.data-table td {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.9rem;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 14px;
  padding-bottom: 14px;
}

.data-table td {
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--surface-hover);
}

.actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* === Admin Analytics === */
.analytics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.analytics-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--transition);
}
.analytics-stat:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.analytics-stat__num {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}
.analytics-stat__lbl {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.analytics-section {
  margin-bottom: 36px;
}
.analytics-section__head {
  margin-bottom: 16px;
}
.analytics-section__head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.analytics-section__head p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.analytics-bars {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}
.analytics-bar-row {
  display: grid;
  grid-template-columns: 28px minmax(130px, 220px) 1fr 60px 70px;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.analytics-bar-row:hover { background: var(--surface-hover); }
.analytics-bar-row__num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-lighter);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.analytics-bar-row__title {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}
.analytics-bar-row__track {
  height: 8px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.analytics-bar-row__fill {
  height: 100%;
  transition: width 0.5s ease;
  border-radius: 6px;
}
.analytics-bar-row__pct {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.analytics-bar-row__count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.user-picker {
  margin-bottom: 16px;
}
.user-picker__form {
  display: flex;
  gap: 10px;
  align-items: center;
}
.user-picker__select {
  flex: 1;
  max-width: 500px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}
.user-picker__select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,122,138,0.15);
}

.user-analytics-header {
  padding: 12px 18px;
  background: var(--accent-lighter);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 0.95rem;
}
.user-analytics-header__meta {
  color: var(--text-muted);
  margin-left: 8px;
}

.empty-state-sm {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.score-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--surface-hover);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.score-badge--good { background: var(--success-bg); color: var(--success); }
.score-badge--ok { background: var(--warning-bg); color: var(--warning); }
.score-badge--bad { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 720px) {
  .analytics-bar-row {
    grid-template-columns: 28px 1fr 60px;
    gap: 10px;
  }
  .analytics-bar-row__track,
  .analytics-bar-row__count { display: none; }
}

.retake-granted {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--success-bg);
  color: var(--success);
  white-space: nowrap;
}

/* Password change form inside users table */
.pwd-row td {
  background: var(--accent-lighter) !important;
  padding: 14px 20px !important;
}
.pwd-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pwd-form label {
  font-size: 0.88rem;
  color: var(--text);
  margin-right: 6px;
}
.pwd-form input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
}
.pwd-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,122,138,0.15);
}

/* Level/role badges for admin tables */
.lvl-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-lighter);
  color: var(--accent-dark);
}
.role-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role-pill--admin {
  background: var(--warning-bg);
  color: var(--warning);
}
.role-pill--user {
  background: var(--accent-lighter);
  color: var(--accent-dark);
}

.inline-form {
  display: inline;
}

.access-form {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === Admin Test Form === */
.question-block {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent);
}

.question-block__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.question-block__header h3 {
  color: var(--accent-dark);
  font-size: 0.95rem;
}

.answers-container {
  margin-bottom: 12px;
}

.answers-container > label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 0.85rem;
}

.answer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.answer-row input[type="text"] {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all var(--transition);
}

.answer-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,122,138,0.1);
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

/* === Error Page === */
.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-page h1 {
  color: var(--danger);
  margin-bottom: 12px;
  font-size: 1.5rem;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* === Module Cards === */
.module-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.module-card__header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border-light);
}

.module-card__number {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.module-card__title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.module-card__desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.module-card__content {
  padding: 16px 28px 20px;
}

.module-section {
  margin-bottom: 12px;
}

.module-section__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  transition: background var(--transition);
}

.module-item:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.module-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.module-item:hover svg {
  color: var(--accent);
}

.module-item__score {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

/* === Lesson === */
.lesson-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  line-height: 1.8;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.lesson-content h1, .lesson-content h2, .lesson-content h3 {
  color: var(--text);
  margin: 20px 0 10px;
}

.lesson-content p { margin-bottom: 12px; }
.lesson-content ul, .lesson-content ol { margin: 0 0 12px 24px; }
.lesson-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 12px 0; }

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* === Match (test taking) === */
.match-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.match-left {
  flex: 1;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.match-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface);
}

.match-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* === Match (admin form) === */
.match-pair-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.match-pair-row input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.match-pair-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.match-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* === Match Results === */
.match-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.match-result--correct { background: var(--success-bg); }
.match-result--wrong { background: var(--danger-bg); }

.match-result__left { font-weight: 500; }
.match-result__arrow { color: var(--text-muted); }
.match-result__correct { color: var(--success); font-weight: 500; margin-left: 4px; }

/* === Question Images === */
.question-image {
  margin-bottom: 16px;
}

.question-image img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.question-image--small img {
  max-height: 200px;
}

.image-preview {
  margin-bottom: 12px;
}

.image-preview img {
  max-width: 200px;
  max-height: 150px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.image-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.image-input-row input { flex: 1; }
.image-input-row .btn { white-space: nowrap; }

/* === Text Answer (result) === */
.text-result p {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.correct-text {
  color: var(--success);
}

/* === Responsive === */
@media (max-width: 768px) {
  .levels-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

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

  .test-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .form-row {
    flex-direction: column;
  }

  .result-actions {
    flex-direction: column;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }
}

/* === AI Feedback Styles === */
.ai-overall {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  margin: 0 0 24px;
  overflow: hidden;
  max-width: 760px;
  box-shadow: var(--shadow);
}
.ai-overall__header {
  background: var(--accent-lighter);
  padding: 14px 22px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-light);
}
.ai-overall__body {
  padding: 20px 24px;
  line-height: 1.75;
  color: var(--text);
  font-size: 0.95rem;
}
.ai-overall__body p { margin: 0 0 10px; }
.ai-overall__body p:last-child { margin-bottom: 0; }
.ai-overall__body strong { color: var(--accent-dark); font-weight: 700; }
.ai-overall__body ul { margin: 8px 0 12px 20px; }
.ai-overall__body li { margin: 4px 0; }
.ai-overall__body h3 {
  font-size: 1rem;
  color: var(--text);
  margin: 14px 0 6px;
  font-weight: 700;
}
.ai-overall__body h3:first-child { margin-top: 0; }
.ai-icon { font-size: 1.2em; }

.ai-feedback {
  margin-top: 12px;
  background: #f8faff;
  border: 1px solid #dde5f5;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ai-feedback__header {
  background: rgba(59, 100, 180, 0.06);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #3b64b4;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-feedback__text {
  padding: 10px 14px 6px;
  color: #374151;
  line-height: 1.6;
}
.ai-feedback__good {
  padding: 4px 14px 4px;
  color: var(--success);
  font-size: 0.9rem;
}
.ai-feedback__improve {
  padding: 4px 14px 10px;
  color: var(--accent-dark);
  font-size: 0.9rem;
}

.user-answer-block {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 6px 0 0;
  white-space: pre-line;
  color: var(--text);
}

.ai-score-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.ai-score-3 { background: var(--success-bg); color: var(--success); }
.ai-score-2 { background: var(--warning-bg); color: var(--warning); }
.ai-score-1 { background: var(--danger-bg); color: var(--danger); }

/* === Test Intro === */
.test-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  max-width: 760px;
  box-shadow: var(--shadow-md);
}

.test-blocked {
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.test-blocked__icon {
  width: 88px; height: 88px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--warning-bg);
  color: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
}
.test-blocked h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.test-blocked p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}
.test-blocked__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.test-intro__body {
  white-space: pre-line;
  line-height: 1.75;
  font-size: 1.02rem;
  color: var(--text);
  margin-bottom: 32px;
}
.test-intro__actions {
  display: flex;
  justify-content: flex-start;
}
.btn-large {
  padding: 14px 32px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* === Admin AI Report === */
.admin-ai-report {
  background: #fff8e6;
  border: 1px solid #f0d48a;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 12px;
  line-height: 1.65;
  font-size: 0.95rem;
  color: #4a3c10;
}
.admin-ai-report h3 {
  margin: 14px 0 6px;
  font-size: 1rem;
  color: #2d2512;
  border-bottom: 1px solid #e5c870;
  padding-bottom: 3px;
}
.admin-ai-report h3:first-child { margin-top: 0; }
.admin-ai-report p { margin: 6px 0; }
.admin-ai-report strong { color: #2d2512; }
.admin-ai-report ul { margin: 6px 0 10px 20px; }
.admin-ai-report li { margin: 3px 0; }

/* Answers block in admin */
.answers-block {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.answers-block h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--text);
}
.answer-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
  background: #fff;
}
.answer-item--correct { border-left-color: var(--success); background: #f6fdf9; }
.answer-item--wrong { border-left-color: var(--danger); background: #fefaf9; }
.answer-item--text { border-left-color: var(--accent); background: #f7faff; }
.answer-item__q {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.4;
}
.answer-item__a {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}
.answer-item__criteria {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}
.answer-num {
  display: inline-block;
  background: var(--text);
  color: white;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 6px;
}
.answer-type-badge {
  display: inline-block;
  background: var(--surface-hover);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-right: 6px;
}
.answer-verdict {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
}
.answer-verdict--good { background: var(--success-bg); color: var(--success); }
.answer-verdict--bad { background: var(--danger-bg); color: var(--danger); }
.result-row-expandable { cursor: pointer; }
.result-row-detail { display: none; }
.result-row-detail.open { display: table-row; }

/* ============================================
   V2 REDESIGN — Level / Profile / Index
   ============================================ */

/* === Home Hero (v3) === */
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 0 0 40px;
  margin-bottom: 8px;
}
.home-hero__content { max-width: 560px; }
.home-hero__eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-lighter);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.home-hero h1 {
  font-size: 2.75rem;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 16px;
}
.home-hero__content p {
  font-size: 1.08rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 28px;
}
.home-hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }

.home-hero__visual {
  position: relative;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-hero__card {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
  font-size: 0.93rem;
}
.home-hero__card--1 {
  top: 10px;
  right: 10%;
  transform: rotate(-3deg);
  border-left: 4px solid var(--success);
}
.home-hero__card--2 {
  top: 110px;
  right: 0;
  transform: rotate(2deg);
  border-left: 4px solid var(--warning);
  z-index: 2;
}
.home-hero__card--3 {
  top: 210px;
  right: 18%;
  transform: rotate(-1deg);
  border-left: 4px solid var(--success);
}
.home-hero__card-num {
  font-family: 'Inter', -apple-system, monospace;
  font-weight: 800;
  color: var(--text-muted);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.home-hero__card-txt {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}
.home-hero__card-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.home-hero__card-pct--good { color: var(--success); }
.home-hero__card-pct--ok { color: var(--warning); }

/* Home metrics bar */
.home-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 56px;
}
.metric {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
}
.metric:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.metric__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-lighter);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.metric__body { display: flex; flex-direction: column; gap: 2px; }
.metric__value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.metric__label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Home section */
.home-section { margin-bottom: 48px; }
.home-section__head {
  margin-bottom: 20px;
}
.home-section__head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
}
.home-section__head p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Level card — redesigned */
.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition);
  min-height: 240px;
}
.level-card:hover:not(.level-card--locked) {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.level-card--locked {
  opacity: 0.7;
  cursor: not-allowed;
}
.level-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.level-card__icon {
  width: 52px; height: 52px;
  background: var(--accent-lighter);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.level-card--locked .level-card__icon {
  background: var(--surface-hover);
  color: var(--text-muted);
}
.level-card__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.level-card__desc {
  color: var(--text-secondary);
  font-size: 0.93rem;
  flex: 1;
  line-height: 1.5;
}
.level-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}
.level-card__count {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.level-card__arrow {
  font-size: 1.3rem;
  color: var(--accent);
  transition: transform var(--transition);
}
.level-card:hover .level-card__arrow { transform: translateX(4px); }
.level-card__badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-hover);
  color: var(--text-muted);
}
.level-card__badge--open {
  background: var(--success-bg);
  color: var(--success);
}

/* Responsive home */
@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 20px;
  }
  .home-hero h1 { font-size: 2.2rem; }
  .home-hero__visual {
    height: 240px;
    max-width: 100%;
  }
  .home-hero__card { min-width: 240px; }
}
@media (max-width: 520px) {
  .home-hero h1 { font-size: 1.8rem; }
  .home-hero__visual { display: none; }
}

/* Levels grid — v2 */
/* (level-card styles moved up to home section - see .level-card above) */

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Course progress (level page top bar) */
.course-progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.course-progress__text {
  display: flex;
  gap: 32px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.course-progress__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.course-progress__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.course-progress__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.course-progress__bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.course-progress__bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.6s ease;
  border-radius: 6px;
}

/* Modules grid — v2 */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.module-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: var(--text-muted);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  gap: 18px;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}
.module-v2:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.module-v2--good { border-left-color: var(--success); }
.module-v2--ok   { border-left-color: var(--warning); }
.module-v2--bad  { border-left-color: var(--danger); }
.module-v2--idle { border-left-color: var(--text-muted); }
.module-v2__number {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent-light);
  line-height: 1;
  min-width: 48px;
  font-variant-numeric: tabular-nums;
}
.module-v2--good .module-v2__number { color: var(--success-light); }
.module-v2--ok   .module-v2__number { color: var(--warning-light); }
.module-v2--bad  .module-v2__number { color: var(--danger-light); }
.module-v2__body { flex: 1; display: flex; flex-direction: column; }
.module-v2__title {
  font-size: 1.15rem;
  margin-bottom: 4px;
  color: var(--text);
}
.module-v2__desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 16px;
  flex: 1;
  line-height: 1.5;
}
.module-v2__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.module-v2__score-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.module-v2__percent {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.module-v2--good .module-v2__percent { color: var(--success); }
.module-v2--ok   .module-v2__percent { color: var(--warning); }
.module-v2--bad  .module-v2__percent { color: var(--danger); }
.module-v2__frac {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.module-v2__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Level tabs (profile) */
.level-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.level-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  cursor: pointer;
}
.level-tab:hover:not(.level-tab--locked):not(.level-tab--active) {
  color: var(--text);
}
.level-tab--active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}
.level-tab--locked {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Profile dashboard */
.dash-rings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  box-shadow: var(--shadow);
}
.stat-card--simple { justify-content: flex-start; }
.progress-ring-wrap { flex-shrink: 0; }
.progress-ring__track {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 10;
}
.progress-ring__fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  transition: stroke-dashoffset 0.8s ease-out;
}
.progress-ring__pct {
  font-size: 22px;
  font-weight: 700;
  text-anchor: middle;
  fill: var(--text);
}
.progress-ring__lbl {
  font-size: 10px;
  text-anchor: middle;
  fill: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-card__body h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}
.stat-card__num {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card__hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.big-num {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  padding: 6px 12px;
  min-width: 130px;
  justify-content: center;
}
.big-num__value {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.big-num__total {
  font-size: 1.4rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.dash-section {
  margin-bottom: 32px;
}
.dash-section h2 {
  font-size: 1.2rem;
  margin-bottom: 14px;
  color: var(--text);
}

.modules-progress-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}
.module-progress-row {
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.module-progress-row:hover { background: var(--surface-hover); }
.module-progress-row__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.module-progress-row__num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-lighter);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.module-progress-row__title {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}
.module-progress-row__pct {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.module-progress-row__bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}
.module-progress-row__fill {
  height: 100%;
  transition: width 0.6s ease;
  border-radius: 4px;
}

.history-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.history-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.history-row:last-child { border-bottom: none; }
.history-row:hover { background: var(--surface-hover); }
.history-row--good { border-left: 3px solid var(--success); }
.history-row--ok   { border-left: 3px solid var(--warning); }
.history-row--bad  { border-left: 3px solid var(--danger); }
.history-row__main {
  flex: 1;
  min-width: 0;
}
.history-row__title {
  display: block;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-row__date {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.history-row__pct {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 56px;
  text-align: right;
}
.history-row--good .history-row__pct { color: var(--success); }
.history-row--ok   .history-row__pct { color: var(--warning); }
.history-row--bad  .history-row__pct { color: var(--danger); }
.history-row__frac {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}
.pagination__info {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Page-header meta */
.page-header__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* Responsive */
@media (max-width: 720px) {
  .hero { padding: 32px 22px; }
  .hero h1 { font-size: 1.7rem; }
  .module-v2 { flex-direction: column; gap: 10px; }
  .module-v2__number { font-size: 2rem; }
  .stat-card { flex-direction: column; text-align: center; }
  .course-progress__text { gap: 16px; }
}
