*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --paper: oklch(0.965 0.008 92);
  --paper-warm: oklch(0.985 0.006 90);
  --ink: oklch(0.22 0.02 248);
  --ink-2: oklch(0.34 0.018 248);
  --muted: oklch(0.54 0.014 248);
  --faint: oklch(0.72 0.012 248);
  --line: oklch(0.22 0.02 248 / 0.13);
  --panel: oklch(0.995 0.004 90 / 0.86);
  --panel-strong: oklch(0.99 0.004 90 / 0.95);
  --green: oklch(0.44 0.075 174);
  --green-soft: oklch(0.44 0.075 174 / 0.12);
  --amber: oklch(0.74 0.105 82);
  --amber-soft: oklch(0.74 0.105 82 / 0.16);
  --red: oklch(0.57 0.13 32);
  --red-soft: oklch(0.57 0.13 32 / 0.12);
  --blue: oklch(0.46 0.08 238);
  --blue-soft: oklch(0.46 0.08 238 / 0.11);
  --plum: oklch(0.42 0.07 322);
  --shadow: 0 28px 70px -38px oklch(0.22 0.02 248 / 0.32);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    linear-gradient(120deg, oklch(0.88 0.035 182 / 0.52), transparent 34%),
    radial-gradient(circle at 88% 6%, oklch(0.86 0.05 78 / 0.48), transparent 30%),
    linear-gradient(180deg, var(--paper-warm), var(--paper) 44%, oklch(0.92 0.012 95));
  letter-spacing: 0;
}

button,
a,
input {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
}

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

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 15px 18px;
  border: 1px solid oklch(1 0 0 / 0.62);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
}

.brand em {
  color: var(--green);
  font-style: italic;
}

.mark {
  width: 32px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  color: var(--green);
}

.mark svg {
  width: 100%;
  height: 100%;
}

.toplinks {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.toplinks a {
  padding: 9px 13px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  transition: background 160ms ease, color 160ms ease;
}

.toplinks a:hover {
  background: oklch(1 0 0 / 0.54);
  color: var(--ink);
}

.demo-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: oklch(1 0 0 / 0.5);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px var(--green-soft);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 38px 4px 24px;
}

.kicker,
.eyebrow {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
}

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

h1 {
  max-width: 900px;
  margin-bottom: 14px;
  font-family: var(--serif);
  font-size: 72px;
  font-weight: 400;
  line-height: 0.96;
}

.intro-copy {
  max-width: 850px;
  margin-bottom: 0;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1.55;
}

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

.primary-action,
.quiet-action {
  min-height: 52px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0 17px 0 21px;
  color: var(--paper-warm);
  background: linear-gradient(135deg, var(--ink), oklch(0.3 0.03 230));
  box-shadow: 0 18px 30px -18px oklch(0.22 0.02 248 / 0.58);
}

.primary-action:hover,
.quiet-action:hover {
  transform: translateY(-1px);
}

.primary-action:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.action-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper-warm);
}

.quiet-action {
  padding: 0 18px;
  color: var(--ink-2);
  background: oklch(1 0 0 / 0.58);
  border: 1px solid var(--line);
}

.operator-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(440px, 1.28fr) minmax(320px, 0.86fr);
  grid-template-areas:
    "queue live evidence"
    "queue live results";
  gap: 14px;
  align-items: stretch;
}

.panel {
  border: 1px solid oklch(1 0 0 / 0.62);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.queue-panel {
  grid-area: queue;
}

.live-panel {
  grid-area: live;
  min-height: 700px;
}

.evidence-panel {
  grid-area: evidence;
  min-height: 332px;
}

.results-panel {
  grid-area: results;
  min-height: 354px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.12;
}

.status-chip {
  flex: 0 0 auto;
  min-height: 29px;
  font-size: 10px;
}

.status-chip.active {
  color: var(--green);
  background: var(--green-soft);
  border-color: oklch(0.44 0.075 174 / 0.25);
}

.status-chip.warning {
  color: oklch(0.46 0.09 72);
  background: var(--amber-soft);
  border-color: oklch(0.74 0.105 82 / 0.35);
}

.status-chip.muted {
  color: var(--muted);
}

.work-pack {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.file-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: oklch(1 0 0 / 0.42);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.file-card.open {
  transform: translateX(4px);
  border-color: oklch(0.44 0.075 174 / 0.38);
  background: var(--green-soft);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.file-card:nth-child(2n) .file-icon {
  background: var(--amber-soft);
  color: oklch(0.46 0.09 72);
}

.file-card:nth-child(3n) .file-icon {
  background: oklch(0.42 0.07 322 / 0.11);
  color: var(--plum);
}

.file-meta strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.run-meter {
  display: grid;
  gap: 7px;
  width: 138px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

.meter-track {
  height: 8px;
  border-radius: 999px;
  background: oklch(0.22 0.02 248 / 0.1);
  overflow: hidden;
}

.meter-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
  transition: width 260ms ease;
}

.worker-stage {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 16px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, oklch(0.22 0.02 248), oklch(0.29 0.035 230));
  color: var(--paper-warm);
}

.worker-avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: oklch(1 0 0 / 0.08);
  border: 1px solid oklch(1 0 0 / 0.14);
}

.worker-avatar span {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 45%, oklch(1 0 0 / 0.72) 45% 55%, transparent 55%),
    linear-gradient(0deg, transparent 45%, oklch(1 0 0 / 0.72) 45% 55%, transparent 55%),
    var(--green);
}

.worker-label {
  margin: 0 0 5px;
  color: oklch(1 0 0 / 0.62);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

#workerState {
  margin: 0;
  font-size: 15px;
  line-height: 1.42;
}

.timeline {
  display: grid;
  gap: 9px;
  max-height: 548px;
  padding: 0 16px 16px;
  overflow: auto;
}

.timeline-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: oklch(1 0 0 / 0.46);
  animation: rise 240ms ease both;
}

.timeline-item.done {
  border-color: oklch(0.44 0.075 174 / 0.22);
}

.timeline-item.warn {
  border-color: oklch(0.74 0.105 82 / 0.42);
  background: oklch(0.98 0.03 82 / 0.42);
}

.step-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.timeline-item.done .step-dot {
  background: var(--green-soft);
  color: var(--green);
}

.timeline-item.warn .step-dot {
  background: var(--amber-soft);
  color: oklch(0.46 0.09 72);
}

.step-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.step-title strong {
  font-size: 14px;
}

.step-title span {
  flex: 0 0 auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.step-body {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.42;
}

.evidence-window {
  min-height: 250px;
  padding: 16px;
}

.empty-state {
  display: grid;
  min-height: 218px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  max-width: 36ch;
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.45;
}

.empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(0deg, var(--line) 1px, transparent 1px),
    oklch(1 0 0 / 0.58);
  background-size: 12px 12px;
}

.evidence-card {
  display: grid;
  gap: 12px;
  animation: rise 220ms ease both;
}

.evidence-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.evidence-title strong {
  font-size: 15px;
}

.evidence-title span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

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

.kv {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid oklch(0.22 0.02 248 / 0.08);
}

.kv .k {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.kv .v {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.35;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
  font-size: 12px;
}

.mini-table th,
.mini-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.mini-table th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 16px 16px 0;
}

.metric {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: oklch(1 0 0 / 0.48);
}

.metric-k {
  display: block;
  min-height: 27px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.25;
  text-transform: uppercase;
}

.metric strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 14px 16px 0;
}

.tab {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: oklch(1 0 0 / 0.42);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.tab.active {
  color: var(--paper-warm);
  border-color: transparent;
  background: var(--ink);
}

.result-view {
  display: none;
  padding: 14px 16px 16px;
}

.result-view.active {
  display: block;
}

.exception-list,
.approval-list {
  display: grid;
  gap: 9px;
}

.exception,
.approval {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: oklch(1 0 0 / 0.48);
}

.exception.high {
  border-color: oklch(0.57 0.13 32 / 0.28);
  background: var(--red-soft);
}

.exception.medium {
  border-color: oklch(0.74 0.105 82 / 0.34);
  background: var(--amber-soft);
}

.exception strong,
.approval strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.exception p,
.approval p {
  margin-bottom: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.42;
}

.approval-actions {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}

.approval-actions button {
  min-height: 33px;
  padding: 0 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.approve {
  color: var(--paper-warm);
  background: var(--green);
}

.hold {
  color: var(--ink-2);
  background: oklch(1 0 0 / 0.58);
  border: 1px solid var(--line);
}

.tracker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tracker-table th,
.tracker-table td {
  padding: 9px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.tracker-table th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.tracker-status {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.tracker-status.hold {
  background: var(--amber-soft);
  color: oklch(0.46 0.09 72);
}

.tracker-status.blocked {
  background: var(--red-soft);
  color: var(--red);
}

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

@media (max-width: 1220px) {
  .operator-grid {
    grid-template-columns: minmax(250px, 0.8fr) minmax(410px, 1.2fr);
    grid-template-areas:
      "queue live"
      "evidence results";
  }

  .live-panel {
    min-height: 620px;
  }

  .timeline {
    max-height: 466px;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, 760px);
    padding-top: 10px;
  }

  .topbar,
  .intro {
    grid-template-columns: 1fr;
  }

  .toplinks {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .demo-pill {
    justify-self: start;
  }

  h1 {
    font-size: 48px;
  }

  .intro-copy {
    font-size: 16px;
  }

  .intro-actions {
    width: 100%;
  }

  .primary-action {
    flex: 1 1 auto;
    justify-content: space-between;
  }

  .operator-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "live"
      "queue"
      "evidence"
      "results";
  }

  .live-panel {
    min-height: 470px;
  }

  .timeline {
    max-height: 315px;
  }

  .panel-head {
    align-items: flex-start;
  }

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

@media (max-width: 520px) {
  .page-shell {
    width: calc(100% - 16px);
  }

  .topbar {
    border-radius: 18px;
  }

  h1 {
    font-size: 39px;
  }

  .intro-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .quiet-action {
    width: 100%;
  }

  .panel-head {
    flex-direction: column;
  }

  .run-meter {
    width: 100%;
    text-align: left;
  }

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

  .tabs {
    overflow-x: auto;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
