:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #1f2a2e;
  --muted: #637174;
  --line: #d9ded9;
  --green: #1e6f5c;
  --blue: #2f5f95;
  --amber: #9b6a20;
  --red: #a33d35;
  --shadow: 0 14px 40px rgba(23, 35, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.topnav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topnav a {
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 700;
}

.topnav a.active {
  border-color: var(--green);
  color: var(--green);
  background: #eef8f3;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 28px auto 60px;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidebar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.progress-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.progress-step:last-child {
  border-bottom: 0;
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-weight: 800;
  background: var(--surface-2);
  color: var(--muted);
}

.progress-step.active {
  color: var(--ink);
  background: #f8fbf9;
  font-weight: 800;
}

.progress-step.active .step-number {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
}

.panel > p {
  color: var(--muted);
  line-height: 1.55;
}

.login-panel {
  max-width: 460px;
  margin: 0 auto;
}

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

.form-grid.single {
  grid-template-columns: 1fr;
  margin: 0;
}

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

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

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

textarea {
  min-height: 96px;
  resize: vertical;
}

.checkbox-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  margin: 12px 0;
  color: var(--muted);
  line-height: 1.45;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  color: #ffffff;
  background: var(--green);
  min-height: 42px;
}

button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

button.danger {
  background: var(--red);
}

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

.recorder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.prompt-label {
  color: var(--green);
  text-transform: uppercase;
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 8px;
}

.prompt-text {
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 0;
}

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

audio {
  width: min(460px, 100%);
  height: 42px;
}

.status-text,
.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.quiz-list {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.quiz-item {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

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

.option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  color: var(--muted);
}

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

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.admin-header.compact {
  align-items: center;
  margin-bottom: 12px;
}

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

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

.metric-grid.compact {
  margin-bottom: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

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

.metric strong {
  font-size: 26px;
}

.list-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 18px;
  align-items: end;
}

.candidate-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.candidate-table th,
.candidate-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.candidate-table th {
  background: var(--surface-2);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.candidate-table tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--line);
  background: #f9faf8;
}

.badge.top_candidate {
  color: var(--green);
  border-color: #b7d8cb;
  background: #edf8f2;
}

.badge.interview {
  color: var(--blue);
  border-color: #bfd0e1;
  background: #eef5fb;
}

.badge.manual_review {
  color: var(--amber);
  border-color: #e5d0a7;
  background: #fff8e8;
}

.badge.early_exit {
  color: var(--red);
  border-color: #e5b8b3;
  background: #fff1ef;
}

.detail-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

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

.continuation-block {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
}

.email-history {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.email-history ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.calibration-health {
  margin: 16px 0;
}

.calibration-example-list {
  display: grid;
  gap: 8px;
}

.calibration-example {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 3px;
  padding-top: 10px;
}

.calibration-example:first-child {
  border-top: 0;
  padding-top: 0;
}

.calibration-example span,
.calibration-example p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.score-detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.score-detail-list div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.score-detail-list div:first-child {
  border-top: 0;
  padding-top: 0;
}

.score-detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.score-detail-list dd {
  margin: 4px 0 0;
  line-height: 1.45;
}

.transcript-item {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.transcript-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.transcript-item summary {
  cursor: pointer;
  font-weight: 900;
}

.transcript-item p {
  color: var(--muted);
  line-height: 1.5;
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

.error {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 860px) {
  .topbar,
  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .form-grid,
  .list-controls,
  .metric-grid,
  .detail-row {
    grid-template-columns: 1fr;
  }

  .candidate-table {
    display: block;
    overflow-x: auto;
  }
}
