:root {
  --bg: #f7f8fb;
  --panel: #fff;
  --ink: #172033;
  --muted: #66738a;
  --line: #dce3ed;
  --blue: #246bfe;
  --green: #14845f;
  --red: #c73535;
  --amber: #b97708;
  --shadow: 0 12px 30px rgba(25, 42, 70, .07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, select, input { font: inherit; }
.loading { padding: 32px; color: var(--muted); }
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}
aside {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px;
  height: 100vh;
  overflow: auto;
  position: sticky;
  top: 0;
}
main {
  min-width: 0;
  padding: 26px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
.subtitle, .muted { color: var(--muted); }
.subtitle { margin-top: 5px; }
.filter-group {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}
label {
  display: block;
  color: #3f4a5f;
  font-weight: 850;
  font-size: 12px;
  margin-bottom: 8px;
}
select, input {
  width: 100%;
  border: 1px solid #d4dde8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 42px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button {
  border: 1px solid #d4dde8;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 13px;
  font-weight: 800;
  cursor: pointer;
}
.button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric { padding: 18px; min-height: 112px; }
.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.metric-value {
  margin-top: 8px;
  font-size: 38px;
  line-height: 1;
  font-weight: 950;
}
.metric-note { color: var(--muted); margin-top: 8px; }
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .9fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-body { padding: 18px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 250px) minmax(0, 1fr) 64px;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
  font-weight: 750;
}
.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track { background: #e8edf2; height: 14px; }
.bar-fill { height: 100%; background: var(--amber); min-width: 2px; }
.bar-fill.hot { background: #d03636; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #3d485c; }
.review-grid {
  display: grid;
  grid-template-columns: minmax(360px, .78fr) minmax(0, 1.35fr);
  gap: 16px;
}
.review-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.review-filter {
  border: 1px solid #c3ccd4;
  background: white;
  border-radius: 7px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 800;
}
.review-filter.active { background: var(--blue); border-color: var(--blue); color: white; }
.review-list {
  max-height: 700px;
  overflow: auto;
  border: 1px solid var(--line);
  background: white;
}
.review-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: start;
}
.review-item:hover, .review-item.active { background: #f5f8fc; }
.qid { font-weight: 900; }
.preview {
  color: #4d5968;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}
.pill.correct { background: rgba(20,132,95,.12); color: var(--green); }
.pill.wrong { background: rgba(199,53,53,.12); color: var(--red); }
.pill.unanswered { background: #eef2f5; color: #4e5962; }
.review-detail {
  border: 1px solid var(--line);
  background: white;
  padding: 18px;
  min-height: 520px;
  max-height: 780px;
  overflow: auto;
}
.review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 13px;
  margin-bottom: 14px;
}
.answer-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.answer-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #f9fbfd;
}
.answer-box .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.answer-box .value {
  margin-top: 5px;
  font-size: 25px;
  font-weight: 950;
}
.question-text { line-height: 1.55; white-space: pre-wrap; }
.review-images { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.review-images img {
  max-width: 440px;
  max-height: 320px;
  border: 1px solid #cbd4dd;
  background: white;
}
.choice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  margin: 8px 0;
}
.choice.correct-choice { border-color: var(--green); background: rgba(20,132,95,.08); }
.choice.selected-wrong { border-color: var(--red); background: rgba(199,53,53,.06); }
.box {
  border-left: 4px solid var(--blue);
  background: #f6f9ff;
  padding: 12px;
  line-height: 1.5;
  margin-top: 12px;
}
.box.explanation { border-left-color: var(--green); background: #f6fbf8; }
.empty { color: var(--muted); padding: 14px; }
@media (max-width: 1100px) {
  .layout, .grid, .review-grid, .answer-summary { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  main { padding: 18px 12px; }
  .metrics { grid-template-columns: 1fr; }
  .topbar { display: block; }
  .actions { margin-top: 14px; }
  .bar-row { grid-template-columns: 1fr; gap: 5px; }
}
