:root {
  --primary: #f4c300;
  --primary-dark: #c99f00;
  --black: #111827;
  --dark: #0f172a;
  --gray: #64748b;
  --line: #e2e8f0;
  --soft: #f8fafc;
  --white: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 20px;
  --shadow: 0 18px 50px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(244,195,0,.22), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef2f7 45%, #ffffff 100%);
  color: var(--black);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 8px; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
}
.login-hero {
  padding: 64px;
  background:
    linear-gradient(145deg, rgba(17,24,39,.96), rgba(15,23,42,.94)),
    radial-gradient(circle at 20% 20%, rgba(244,195,0,.35), transparent 25%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand strong { display: block; font-size: 18px; letter-spacing: -.03em; }
.brand small { display: block; color: #94a3b8; font-size: 12px; font-weight: 700; }
.brand.big strong { color: #fff; font-size: 26px; }
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--dark);
  font-weight: 950;
  box-shadow: 0 12px 30px rgba(244,195,0,.25);
}
.hero-copy { max-width: 780px; }
.hero-copy h1 {
  margin: 0 0 24px;
  font-size: clamp(40px, 5vw, 72px);
  line-height: .92;
  letter-spacing: -.065em;
}
.hero-copy p { color: #dbe3ef; font-size: 18px; line-height: 1.7; }
.hero-grid {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 14px;
}
.hero-grid div {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.hero-grid b { display: block; margin-bottom: 6px; }
.hero-grid span { color: #cbd5e1; }

.login-panel {
  padding: 42px;
  display: grid;
  place-items: center;
}
.login-card { width: min(100%, 460px); }
.card, .table-card, .question-card, .result-card, .category-card {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 24px; }
.card h2, .card h1 { margin-top: 0; }
.narrow { max-width: 920px; }

label {
  display: block;
  margin: 15px 0 8px;
  font-size: 13px;
  color: #334155;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 13px 15px;
  background: #fff;
  outline: none;
  transition: .2s;
}
textarea.input { min-height: 100px; resize: vertical; }
.input:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 4px rgba(244,195,0,.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 11px 16px;
  border-radius: 14px;
  font-weight: 850;
  gap: 8px;
}
.btn-primary { background: var(--primary); color: var(--black); }
.btn-dark { background: var(--black); color: #fff; }
.btn-light { background: #f1f5f9; color: #0f172a; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-disabled { background: #e2e8f0; color: #64748b; }
.btn-small { min-height: 34px; padding: 7px 10px; font-size: 13px; }
.full { width: 100%; }
.btn:hover { transform: translateY(-1px); }

.demo-box {
  margin-top: 22px;
  padding: 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #475569;
  line-height: 1.7;
}
.muted { color: var(--gray); line-height: 1.6; }
.alert {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
}
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.success { background: #dcfce7; color: #166534; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-pill {
  display: inline-flex;
  padding: 9px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: calc(100vh - 76px);
}
.sidebar {
  padding: 22px;
  background: rgba(255,255,255,.75);
  border-right: 1px solid var(--line);
}
.nav-item {
  display: block;
  padding: 13px 14px;
  border-radius: 14px;
  color: #334155;
  font-weight: 780;
  margin-bottom: 6px;
}
.nav-item.active, .nav-item:hover { background: var(--black); color: #fff; }
.content { padding: 30px; }

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}
.page-title.compact { margin-bottom: 12px; }
.page-title h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: -.055em;
}
.page-title h2 { margin: 0 0 8px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
}
.stat-card span {
  font-size: 12px;
  color: var(--gray);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  letter-spacing: -.05em;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 18px;
}
.category-card {
  padding: 24px;
  min-height: 265px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.cat-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--black);
  font-size: 28px;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 18px;
}
.level-card {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.tag {
  font-size: 12px;
  font-weight: 850;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
}
.center { justify-content: center; }

.timer-box {
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  min-width: 160px;
  text-align: center;
}
.timer-box span {
  display: block;
  font-size: 12px;
  color: var(--gray);
  font-weight: 850;
  text-transform: uppercase;
}
.timer-box strong {
  font-size: 34px;
  letter-spacing: -.04em;
}
.question-card {
  padding: 26px;
  margin-bottom: 18px;
}
.question-card h2 {
  font-size: 20px;
  line-height: 1.45;
}
.option-row {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--black);
  font-weight: 650;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #dbe3ef;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.option-row:hover {
  border-color: var(--primary-dark);
  background: rgba(244,195,0,.12);
}
.submit-bar {
  position: sticky;
  bottom: 0;
  background: rgba(248,250,252,.88);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.result-card {
  max-width: 760px;
  margin: 30px auto;
  padding: 34px;
  text-align: center;
}
.result-status {
  display: inline-flex;
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: 950;
}
.result-card.pass .result-status { background: #dcfce7; color: #166534; }
.result-card.fail .result-status { background: #fee2e2; color: #991b1b; }
.score {
  font-size: 88px;
  font-weight: 950;
  letter-spacing: -.08em;
  line-height: 1;
}
.actions-center {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.table-card {
  overflow-x: auto;
}
.table-card.inner { box-shadow: none; margin-top: 16px; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}
th, td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: #f8fafc;
  color: var(--gray);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}
.badge.success { background: #dcfce7; color: #166534; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.empty { text-align: center; color: var(--gray); padding: 28px; }

.admin-grid {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 18px;
}
.two-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-row .input { width: auto; min-width: 180px; }
.inline { display: inline; }
.actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
}

@media (max-width: 1120px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { min-height: 560px; padding: 42px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; gap: 8px; padding: 14px; }
  .nav-item { white-space: nowrap; margin-bottom: 0; }
  .category-grid, .stats-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { height: auto; padding: 16px; flex-direction: column; align-items: flex-start; }
  .top-actions { flex-wrap: wrap; }
  .content { padding: 18px; }
  .category-grid, .stats-grid, .level-grid, .two-col { grid-template-columns: 1fr; }
  .login-panel { padding: 24px; }
  .login-hero { padding: 30px; }
  .hero-grid { grid-template-columns: 1fr; }
  .page-title { flex-direction: column; }
  .submit-bar { flex-direction: column; }
  .btn { width: 100%; }
}
