/* Tests — единый дизайн раздела */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Page shell */
.test-page-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.test-page-back {
  margin-bottom: 12px;
}

.test-page {
  max-width: 1120px;
}

.test-preview-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 500;
}

.test-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.test-save-hint {
  font-size: 13px;
  color: var(--status-published);
  font-weight: 500;
}

/* List page */
.tests-page .page-header {
  align-items: flex-start;
}

.tests-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tests-empty {
  margin-top: 0;
}

.tests-review-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.test-card-meta,
.test-card-tags,
.test-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-ack-btn {
  font-weight: 600;
}

/* Editor layout */
.test-editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  gap: 16px;
  align-items: start;
}

.test-settings-panel {
  position: sticky;
  top: 16px;
  min-width: 0;
  overflow: hidden;
}

.test-settings-panel .settings-form {
  min-width: 0;
}

.test-settings-panel .settings-form-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.test-settings-panel .settings-field {
  min-width: 0;
}

.test-settings-panel .settings-field input,
.test-settings-panel .settings-field select,
.test-settings-panel .settings-field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.test-settings-panel .settings-readonly-field {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-panel-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  line-height: 1.1;
}

.test-panel-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-3);
}

.test-questions-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.test-questions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Add question — как в редакторе статей */
.test-add-row {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 4px;
  padding-left: 4px;
}

.test-add-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--surface);
  color: var(--text-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.test-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-soft);
}

.test-add-menu {
  position: absolute;
  left: 40px;
  bottom: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 10;
}

.test-add-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.test-add-menu-item:hover {
  background: var(--paper-2);
}

.test-weight-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--paper-2);
  font-size: 13px;
  color: var(--text-2);
}

.test-weight-bar.is-ok {
  border-color: color-mix(in oklch, var(--status-published) 35%, var(--border));
  background: color-mix(in oklch, var(--status-published) 6%, var(--surface));
}

.test-weight-bar strong {
  color: var(--text);
}

.test-questions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Question card */
.test-q-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.test-q-card.is-dragging {
  opacity: 0.45;
}

.test-q-card.is-drop-target {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.test-q-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.test-q-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.test-q-drag {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--paper-2);
  color: var(--text-3);
  cursor: grab;
}

.test-q-drag:active {
  cursor: grabbing;
}

.test-q-index {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--ink);
  color: var(--text-inverse);
  padding: 4px 10px;
  border-radius: var(--r-full);
}

.test-q-type-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--r-full);
  background: var(--paper-2);
  color: var(--text-2);
}

.test-q-type-tag--open {
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
  color: var(--accent-text);
}

.test-q-card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.test-q-reorder {
  display: flex;
  gap: 2px;
}

.test-q-tool-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.test-q-tool-btn:hover:not(:disabled) {
  border-color: var(--border);
  color: var(--text);
}

.test-q-tool-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.test-q-tool-btn--danger:hover:not(:disabled) {
  border-color: var(--coral);
  color: var(--coral);
}

.test-q-weight {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.test-q-weight input {
  width: 56px;
  min-width: 56px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  text-align: center;
  box-sizing: border-box;
}

.test-q-weight-suffix {
  color: var(--text-3);
}

.test-q-open-hint {
  font-size: 12px;
  color: var(--text-3);
}

.test-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--paper-2);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.test-timer.is-urgent {
  background: var(--coral-soft);
  color: var(--coral);
}

.test-welcome-hint {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-3);
  text-align: center;
}

.test-timed-out-notice {
  margin-bottom: 16px;
}

.test-q-field {
  margin: 0;
}

.test-q-text {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  background: var(--surface);
}

.test-q-text:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.test-q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-q-options-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 2px;
}

.test-option-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.test-option-radio {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.12s, background 0.12s;
}

.test-option-radio.is-checked {
  border-color: var(--status-published);
  background: var(--status-published);
}

.test-option-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: var(--surface);
}

.test-option-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.test-option-item.is-correct .test-option-input {
  border-color: color-mix(in oklch, var(--status-published) 40%, var(--border));
}

.test-option-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.12s, color 0.12s;
}

.test-option-remove:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.test-option-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.test-option-add:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-soft);
}

/* Take flow */
.test-welcome {
  max-width: 480px;
  margin: 0 auto;
}

.test-welcome .settings-info-box {
  margin: 16px 0;
  text-align: center;
}

.test-welcome-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.test-welcome-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  text-align: center;
}

.test-welcome-stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.test-welcome-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.test-welcome-start {
  width: 100%;
  margin-top: 16px;
}

.test-take-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.test-take-nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(420px, 50vh);
  overflow-y: auto;
  margin-bottom: 12px;
}

.test-take-nav-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.12s, background 0.12s;
}

.test-take-nav-row:hover {
  border-color: var(--border);
  background: var(--paper-2);
}

.test-take-nav-row.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--text-inverse);
}

.test-take-nav-row.active .test-take-nav-preview {
  color: color-mix(in oklch, var(--text-inverse) 75%, transparent);
}

.test-take-nav-row.done:not(.active) {
  border-color: color-mix(in oklch, var(--status-published) 35%, var(--border));
}

.test-take-nav-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.test-take-nav-preview {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.test-take-nav-grid {
  display: none;
}

.test-take-nav-item {
  display: none;
}

.test-take-finish {
  width: 100%;
}

.test-take-nav-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

.test-progress {
  height: 4px;
  background: var(--paper-2);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-bottom: 18px;
}

.test-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 0.3s ease;
}

.test-q-num {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.test-q-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.018em;
  margin: 0 0 20px;
  line-height: 1.15;
}

.test-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-choice-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.test-choice-item:hover {
  border-color: var(--text-3);
  background: var(--paper-2);
}

.test-choice-item.selected {
  border-color: var(--ink);
  background: var(--paper-2);
}

.test-choice-item.selected .test-choice-marker {
  background: var(--ink);
  color: var(--text-inverse);
  border-color: var(--ink);
}

.test-choice-marker {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--paper-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.test-open-answer {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  font: inherit;
  font-size: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  line-height: 1.45;
}

.test-open-answer:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.test-take-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

/* Results */
.test-results {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.test-result-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}

.test-result-notice--warn {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: var(--text);
}

.test-result-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.test-result-status--pending {
  padding: 8px 0 4px;
}

.test-result-status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  margin-bottom: 4px;
}

.test-result-status-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.test-result-status-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
  max-width: 360px;
}

.test-result-score {
  font-family: var(--font-display);
  font-size: 80px;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 12px 0;
}

.test-result-score.is-pass {
  color: var(--status-published);
}

.test-result-score.is-fail {
  color: var(--coral);
}

.test-result-meta {
  color: var(--text-2);
  margin: 0 0 8px;
  font-size: 14px;
}

.test-result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.test-result-actions .btn {
  width: 100%;
  justify-content: center;
}

.test-breakdown-answer span,
.test-breakdown-correct span {
  color: var(--text-3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 4px;
}

.test-breakdown-verdict.skip {
  color: var(--text-3);
}

.test-breakdown-pending {
  margin: 0;
  font-size: 13px;
  color: var(--accent-text);
}

.test-take-nav-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.test-take-nav-check {
  flex-shrink: 0;
  color: var(--status-published);
}

.test-take-nav-row.active .test-take-nav-check {
  color: var(--text-inverse);
}

.tests-page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tests-review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: var(--r-full);
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.test-user-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.test-user-status--draft {
  background: var(--paper-2);
  color: var(--text-3);
}

.test-user-status--not-started {
  background: var(--paper-2);
  color: var(--text-2);
}

.test-user-status--in-progress {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.test-user-status--pending {
  background: #FEF3C7;
  color: #92400E;
}

.test-user-status--passed {
  background: #DCFCE7;
  color: #166534;
}

.test-user-status--failed {
  background: #FEE2E2;
  color: #991B1B;
}

.test-card-corner-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  z-index: 1;
}

.test-card-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.test-card-icon-btn:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--paper-2);
}

.test-card-icon-btn--danger:hover {
  border-color: var(--coral);
  color: var(--coral);
  background: var(--coral-soft);
}

.tests-page .test-card-bottom {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.tests-page .test-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-left: 0;
  width: 100%;
}

.tests-page .test-card-actions .btn-primary {
  margin-left: auto;
  min-width: 140px;
}

.test-review-hub-summary {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  font-size: 14px;
  color: var(--text);
}

.test-review-hub-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.test-review-hub-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.test-review-hub-title {
  margin: 8px 0 4px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.test-review-hub-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
}

.test-review-hub-table-wrap {
  overflow-x: auto;
}

.test-review-hub-score {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

.test-review-hub-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
}

.test-review-hub-person {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.test-review-hub-person strong {
  display: block;
  font-weight: 600;
}

.test-review-hub-role {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.3;
}

.test-review-hub-action {
  text-align: right;
  white-space: nowrap;
}

.test-review-hub-pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: #FEF3C7;
  color: #92400E;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.test-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-breakdown-verdict {
  font-weight: 600;
  margin: 0;
  font-size: 14px;
}

.test-breakdown-verdict.ok { color: var(--status-published); }
.test-breakdown-verdict.fail { color: var(--coral); }

.test-breakdown-answer {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}

.test-breakdown-correct {
  margin: 0;
  font-size: 14px;
  color: var(--status-published);
}

.test-review-comment {
  margin-top: 8px;
}

.test-review-comment textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

.test-review-card {
  margin-bottom: 12px;
}

.test-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.test-review-progress {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--paper-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.test-review-progress.is-complete {
  background: #DCFCE7;
  color: #166534;
}

.test-review-person {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.test-review-role {
  font-size: 12px;
  color: var(--text-3);
}

.test-review-answer {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface);
}

.test-review-answer.is-pending {
  border-color: #FDE68A;
  background: #FFFBEB;
}

.test-review-answer.is-accepted {
  border-color: #BBF7D0;
  background: #F0FDF4;
}

.test-review-answer.is-rejected {
  border-color: #FECACA;
  background: #FEF2F2;
}

.test-review-answer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.test-review-answer-top .test-q-title {
  margin: 0;
  flex: 1;
}

.test-review-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.test-review-verdict.ok {
  background: #DCFCE7;
  color: #166534;
}

.test-review-verdict.fail {
  background: #FEE2E2;
  color: #991B1B;
}

.test-review-answer-text {
  margin-bottom: 10px;
}

.test-review-given-comment {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}

.test-review-given-comment span {
  color: var(--text-3);
}

.test-review-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.test-review-btn-pass {
  background: #166534;
  color: #fff;
  border: 1px solid #166534;
}

.test-review-btn-pass:hover:not(:disabled) {
  background: #14532D;
  border-color: #14532D;
}

.test-review-btn-fail {
  background: var(--surface);
  color: #991B1B;
  border: 1px solid #FECACA;
}

.test-review-btn-fail:hover:not(:disabled) {
  background: #FEF2F2;
  border-color: #F87171;
}

.test-review-done {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.test-review-done .btn {
  margin-top: 12px;
  min-width: 200px;
}

/* Stats */
.test-stats-block {
  margin-bottom: 16px;
}

.test-stats-hint {
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--text-3);
}

.test-stats-table-head {
  padding: 16px 16px 0;
}

.test-stats-table-head .test-panel-title {
  margin: 0;
}

.test-stats-table-card {
  overflow: hidden;
}

.test-stats-table .test-stats-col-toggle {
  width: 32px;
  padding-right: 0;
  color: var(--text-3);
}

.test-stats-person-row {
  cursor: pointer;
  transition: background 0.12s;
}

.test-stats-person-row:hover {
  background: var(--paper-2);
}

.test-stats-person-row.is-open {
  background: var(--paper-2);
}

.test-stats-person-row.is-open td {
  border-bottom: none;
}

.test-stats-person-name {
  font-weight: 600;
}

.test-stats-expand-row td {
  padding: 0 14px 16px !important;
  background: var(--paper-2);
  border-bottom: 1px solid var(--border);
}

.test-stats-expand-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.test-stats-loading {
  padding: 16px 4px;
  font-size: 13px;
  color: var(--text-3);
}

.test-stats-attempt {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.test-stats-attempt.is-open {
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.test-stats-attempt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.test-stats-attempt-row:hover {
  background: var(--paper-2);
}

.test-stats-attempt-left,
.test-stats-attempt-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.test-stats-attempt-right {
  flex-shrink: 0;
  gap: 14px;
  font-size: 13px;
  color: var(--text-2);
}

.test-stats-chevron {
  color: var(--text-3);
  flex-shrink: 0;
}

.test-stats-attempt-num {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.test-stats-attempt-when {
  white-space: nowrap;
}

.test-stats-attempt-dur {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.test-stats-attempt-score {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  min-width: 40px;
  text-align: right;
}

.test-stats-attempt-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border-soft);
}

.test-stats-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.test-stats-answer-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--paper-2);
}

.test-stats-answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.test-stats-q-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.test-stats-review-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}

.test-stats-review-note span {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.test-stats-attempt-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-2);
}

.test-stats-attempt-summary strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}

.test-histogram {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 120px;
  padding-top: 8px;
}

.test-hist-bar {
  flex: 1;
  min-width: 48px;
  background: var(--ink);
  border-radius: var(--r-md) var(--r-md) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 4px;
  gap: 4px;
  color: var(--text-inverse);
  font-size: 10px;
  font-family: var(--font-mono);
}

.test-hist-bar em {
  font-style: normal;
  opacity: 0.8;
}

.test-problem-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.test-problem-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.test-problem-item:last-child {
  border-bottom: none;
}

.test-problem-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.test-choice-text {
  font-size: 14px;
  line-height: 1.4;
}

/* Test cards — list */
.tests-page .test-grid {
  align-items: stretch;
}

.tests-page .test-card {
  cursor: default;
  overflow: visible;
  min-height: 0;
}

.tests-page .test-card:hover {
  transform: none;
}

.tests-page .test-card-body {
  min-width: 0;
}

.tests-page .test-card-title {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.tests-page .test-card-bottom {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.tests-page .test-card-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.test-card-delete,
.test-btn-delete {
  color: var(--coral);
}

.test-card-delete:hover,
.test-btn-delete:hover {
  color: var(--coral);
  background: var(--coral-soft);
}

@media (max-width: 900px) {
  .test-editor-layout,
  .test-take-layout {
    grid-template-columns: 1fr;
  }

  .test-settings-panel {
    position: static;
  }

  .test-page-top {
    flex-direction: column;
  }

  .test-page-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}
