:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --ink: #171923;
  --muted: #667085;
  --line: #d9dce6;
  --brand: #2a1769;
  --brand-dark: #1d104f;
  --brand-soft: #f0edf8;
  --accent: #c69a36;
  --accent-dark: #9c7422;
  --warning: #b45309;
  --danger: #b42318;
  --good: #247a3b;
  --shadow: 0 16px 42px rgba(29, 16, 79, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  background: var(--brand-dark);
  color: #ffffff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 76px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.brand small,
.side-note {
  color: #cbc6df;
}

.brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  color: #f8f7fc;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 7px;
  font-weight: 700;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 3px 0 0 var(--accent);
}

.side-note {
  margin-top: auto;
  font-size: 13px;
  line-height: 1.5;
}

.main {
  padding: 34px;
  overflow-x: hidden;
}

.view {
  max-width: 1180px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.page-header,
.candidate-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.16;
}

h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.toolbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-strip div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  padding: 15px 16px;
  box-shadow: var(--shadow);
}

.metric-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-strip strong {
  font-size: 15px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 14px;
  padding: 18px;
  margin-bottom: 20px;
  align-items: end;
}

.panel {
  padding: 20px;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.panel-header p,
.candidate-header p {
  color: var(--muted);
  margin-bottom: 0;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  color: #303240;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fbfcfc;
  color: var(--ink);
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(42, 23, 105, 0.16);
  border-color: var(--brand);
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.tiny-button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 10px 14px;
}

.tiny-button {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 7px 9px;
  font-size: 13px;
}

.tiny-button.danger {
  color: var(--danger);
}

.secondary-link {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  background: #fafafe;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.status.done {
  background: #e9f6ed;
  color: var(--good);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfbfe;
}

.question-item strong {
  display: block;
  margin-bottom: 6px;
}

.report-preview {
  min-height: 320px;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #151027;
  color: #f7f2df;
  white-space: pre-wrap;
}

.timer {
  min-width: 104px;
  text-align: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  padding: 13px 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.test-form {
  display: grid;
  gap: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .field:last-child {
  grid-column: 1 / -1;
}

.test-question {
  padding: 18px 0 4px;
}

.test-question:first-child {
  border-top: 0;
  padding-top: 0;
}

.test-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.test-panel-header p,
.question-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 0;
}

.lock-state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: #fff9ec;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  padding: 5px 10px;
}

.lock-state.locked {
  background: #e9f6ed;
  color: var(--good);
}

.question-context {
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: #fff9ec;
  color: #3d3522;
  line-height: 1.5;
}

.options {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
}

.option input {
  width: auto;
  margin-top: 2px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}

.question-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .toolbar,
  .grid,
  .form-grid,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .page-header,
  .candidate-header,
  .panel-header,
  .test-panel-header {
    flex-direction: column;
  }

  .question-actions {
    justify-content: stretch;
  }

  .question-actions button {
    flex: 1;
  }

  h1 {
    font-size: 28px;
  }

  .main {
    padding: 20px;
  }
}
