:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #181512;
  --muted: #665f55;
  --line: #d8d0c2;
  --accent: #c23b22;
  --ok: #167548;
  --bad: #a52a22;
  --panel: #fffaf0;
}

* {
  box-sizing: border-box;
}

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

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  min-height: 240px;
  align-items: end;
  padding: 32px 0;
  border-bottom: 2px solid var(--ink);
}

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

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 0.98;
}

.sub {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.panel {
  display: grid;
  gap: 18px;
  margin: 24px 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

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

button {
  width: fit-content;
  border: 0;
  border-radius: 8px;
  padding: 13px 18px;
  color: white;
  background: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.result {
  display: grid;
  gap: 18px;
}

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

.card,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  padding: 16px;
}

.card strong {
  display: block;
  font-size: 28px;
}

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

.video-meta {
  padding: 18px;
  background: #181512;
  color: #fffaf0;
  border-radius: 8px;
}

.video-meta p {
  color: #d8d0c2;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

a {
  color: var(--accent);
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-width: 76px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.pill.ok {
  background: var(--ok);
}

.pill.bad {
  background: var(--bad);
}

.tabs {
  display: flex;
  gap: 6px;
  margin-top: 24px;
}

.tab {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  transition: background 0.2s cubic-bezier(0.32, 0.72, 0, 1), color 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.tab.active {
  color: var(--panel);
  background: var(--ink);
  border-color: var(--ink);
}

.tabs + .panel {
  margin-top: 12px;
}

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

.actions {
  display: flex;
  gap: 10px;
}

button.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

.video-block {
  display: grid;
  gap: 10px;
  animation: rise 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.video-block .video-meta {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.video-block .video-meta a {
  color: #fffaf0;
}

.video-block .video-meta p {
  margin: 6px 0 0;
}

.video-block .video-meta b {
  color: #ffb4a6;
}

.index {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent);
  font-weight: 800;
}

tr.flag td {
  background: #fbeee9;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-area {
  display: grid;
  gap: 18px;
}

.progress {
  display: grid;
  gap: 14px;
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  transition: color 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.steps li div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.steps small {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.3s cubic-bezier(0.32, 0.72, 0, 1), border-color 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.steps li.active {
  color: var(--ink);
}

.steps li.active .dot {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  animation: pulse 1.4s cubic-bezier(0.32, 0.72, 0, 1) infinite;
}

.steps li.done {
  color: var(--ink);
}

.steps li.done .dot {
  color: #fff;
  background: var(--ok);
  border-color: var(--ok);
}

.bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.bar span {
  display: block;
  height: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

.progress-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.notice {
  margin: 0;
  padding: 10px 12px;
  color: #6b3a10;
  background: #fbf0dc;
  border: 1px solid #ecd3a6;
  border-radius: 8px;
  font-size: 14px;
}

.candidates {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.candidates summary {
  padding: 16px 20px;
  font-weight: 800;
  cursor: pointer;
}

.candidates .table-wrap {
  max-height: 460px;
  overflow: auto;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.candidates-table {
  min-width: 720px;
}

.candidates-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
}

.candidates-table td {
  padding: 9px 12px;
  font-size: 14px;
}

.candidates-table td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.candidates-table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.candidates-table tr.state-idle td {
  color: var(--muted);
}

.candidates-table tr.state-idle a {
  color: var(--muted);
  font-weight: 600;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: #ece6da;
  color: var(--muted);
}

.tag.busy {
  background: #fbe3dc;
  color: var(--accent);
}

.tag.ok {
  background: #dcefe3;
  color: var(--ok);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(194, 59, 34, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(194, 59, 34, 0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-block,
  .steps li.active .dot {
    animation: none;
  }
}

@media (max-width: 760px) {
  .row,
  .row-3 {
    grid-template-columns: 1fr;
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 14px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 38px;
  }
}
