:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #172033;
  --muted: #65758b;
  --line: #e2e8f0;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warning: #b54708;
  --success: #047857;
  --shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(135deg, #edfdf9 0%, var(--bg) 42%, #f8fafc 100%);
  color: var(--ink);
  min-height: 100vh;
}

.app-shell {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar, .dashboard-header, .section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar {
  margin-bottom: 22px;
}

h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(28px, 4vw, 44px); }
h2 { font-size: clamp(24px, 3vw, 34px); }
h3 { font-size: 20px; }

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 0 0 6px;
  font-size: 12px;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 18px 0;
}

.login-card {
  max-width: 700px;
  margin: 52px auto;
}

.grid { display: grid; gap: 16px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 650;
  margin: 12px 0;
}

input, select, textarea {
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px 13px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 17px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.ghost { background: #e6fffb; color: var(--accent-dark); border: 1px solid #99f6e4; }
.hidden { display: none !important; }
.msg { min-height: 22px; color: var(--muted); font-weight: 650; }
.error { color: var(--danger); }
.success { color: var(--success); }

.quiz-card {
  text-align: left;
  padding: 24px;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.quiz-card strong { display: block; font-size: 22px; margin-bottom: 8px; }
.quiz-card span { color: var(--muted); }

.question-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
  background: #fbfdff;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2ff;
  color: #3730a3;
}
.badge.good { background: #dcfce7; color: #166534; }
.badge.warn { background: #ffedd5; color: #9a3412; }
.badge.bad { background: #fee2e2; color: #991b1b; }

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 8px 0;
  background: #fff;
  cursor: pointer;
  font-weight: 550;
}
.option input { box-shadow: none; }

.result-answer {
  border-left: 5px solid var(--line);
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 12px;
  margin: 10px 0;
}
.result-answer.correct { border-left-color: var(--success); }
.result-answer.wrong { border-left-color: var(--danger); }

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.kpi strong { display: block; font-size: 28px; margin-top: 6px; }
.kpi span { color: var(--muted); font-weight: 700; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { color: #475569; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }

.question-list-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin: 10px 0;
  background: #fff;
}

.warning-box {
  padding: 13px 14px;
  border-radius: 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 700;
}

@media (max-width: 800px) {
  .two, .three, .four { grid-template-columns: 1fr; }
  .topbar, .dashboard-header, .section-title { align-items: flex-start; flex-direction: column; }
  .card { padding: 18px; border-radius: 18px; }
  .login-card { margin-top: 22px; }
}

.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi small { display: block; color: var(--muted); margin-top: 6px; font-weight: 700; }
.section-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mini-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #f8fafc;
}
.action-stack { display: flex; gap: 8px; flex-wrap: wrap; }
button.small { padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.wide-table { min-width: 1080px; }

@media (max-width: 1020px) {
  .five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .five { grid-template-columns: 1fr; }
}

.question-list-item ol { margin: 10px 0 0 22px; color: #334155; }
.question-list-item li { margin: 4px 0; }
#questionAvailability { white-space: nowrap; }
@media (max-width: 1020px) { .five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.weak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.weak-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.weak-card h4 { margin: 8px 0; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  padding-top: 26px;
}
.checkbox-label input { width: auto; box-shadow: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.timer-badge {
  display: inline-flex;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #ecfeff;
  color: #155e75;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.timer-badge.expired { background: #fee2e2; color: #991b1b; }
select[multiple] { min-height: 170px; }
.matrix-table { min-width: 1400px; }
.matrix-table td { min-width: 130px; }
code { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }

.topbar-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
