:root {
  --ink: #14213d;
  --paper: #ffffff;
  --line: #d9dee8;
  --muted: #5d6678;
  --soft: #f4f6f8;
  --action: #fca311;
  --green: #2a9d8f;
  --dark: #0b1020;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(20, 33, 61, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(90deg, var(--ink) 0 290px, var(--paper) 290px 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 28px 22px;
  color: var(--paper);
  background:
    linear-gradient(135deg, rgba(42, 157, 143, 0.14), transparent 44%),
    var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  line-height: 1;
}

.brand small,
.rail-kicker,
.eyebrow {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.tab {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
  text-align: left;
  padding: 0 14px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
  color: var(--dark);
  background: var(--action);
  transform: translateX(2px);
}

.rail-note {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.rail-note b {
  display: block;
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.35;
}

.workspace {
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 44px) 42px;
}

.topbar,
.command-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--green);
  margin: 0 0 6px;
}

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

h1,
h2,
h3 {
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 66px);
  line-height: 0.94;
}

h2 {
  margin-bottom: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
}

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

p {
  color: var(--muted);
  line-height: 1.5;
}

.operator-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--muted);
  white-space: nowrap;
}

.operator-strip b {
  color: var(--ink);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 24px 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.metric {
  min-height: 126px;
  padding: 18px;
  background: var(--paper);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin: 10px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 0.9;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: rise 220ms ease both;
}

.command-head {
  margin-bottom: 18px;
}

.command-head p {
  max-width: 650px;
  margin-bottom: 0;
}

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

.filters input,
.filters select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  min-width: 210px;
}

.filters select {
  min-width: 140px;
}

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

.queue-list {
  display: grid;
  gap: 10px;
}

.queue-item {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 16px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.queue-item:hover,
.queue-item.is-selected {
  border-color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.queue-topline,
.queue-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.queue-topline b {
  font-size: 18px;
}

.queue-topline em,
.stage-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(252, 163, 17, 0.18);
  color: #8a5200;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  padding: 0 10px;
  white-space: nowrap;
}

.queue-meta,
.queue-bottom small {
  color: var(--muted);
  font-size: 13px;
}

.risk-row {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.risk-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--action));
}

.inspector,
.detail-main,
.detail-list,
.report-panel {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
}

.inspector {
  position: sticky;
  top: 24px;
  padding: 18px;
}

.inspector-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.inspector-head h3 {
  margin-top: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 16px 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.facts div {
  min-height: 82px;
  padding: 12px;
  background: var(--paper);
}

.facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.facts dd {
  margin: 7px 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.action-stack {
  display: grid;
  gap: 9px;
}

.accent-btn,
.plain-btn {
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 800;
  padding: 0 14px;
}

.accent-btn {
  border: 1px solid var(--action);
  background: var(--action);
  color: var(--dark);
}

.plain-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

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

.detail-main,
.detail-list,
.report-panel {
  padding: 18px;
}

.detail-main {
  min-height: 320px;
  color: var(--paper);
  background:
    radial-gradient(circle at 80% 18%, rgba(252, 163, 17, 0.32), transparent 28%),
    linear-gradient(140deg, var(--ink), var(--dark));
}

.detail-main p {
  color: rgba(255, 255, 255, 0.72);
}

.detail-main .stage-chip {
  background: var(--action);
  color: var(--dark);
}

.score-dial {
  display: grid;
  place-items: center;
  width: 152px;
  aspect-ratio: 1;
  margin-top: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
}

.score-dial strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 54px;
  line-height: 0.9;
}

.score-dial span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.detail-list ul,
.rank-list,
.activity-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li,
.rank-list li,
.activity-list li,
.timeline-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.detail-list li {
  display: grid;
}

.detail-list span,
.activity-list span,
.timeline-row span {
  color: var(--muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  border: 1px solid var(--line);
}

.timeline-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 100px;
  align-items: center;
  padding: 16px;
  background: var(--paper);
}

.timeline-row + .timeline-row {
  border-top: 1px solid var(--line);
}

.timeline-row time {
  color: var(--green);
  font-weight: 900;
}

.timeline-row div {
  display: grid;
  min-width: 0;
}

.report-panel.wide {
  grid-column: 1 / -1;
}

.rank-list li b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 22px;
  background: var(--soft);
}

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

@media (max-width: 980px) {
  body {
    background: var(--paper);
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: static;
    height: auto;
    gap: 18px;
  }

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

  .tab {
    text-align: center;
    padding: 0 8px;
  }

  .rail-note {
    display: none;
  }

  .summary-grid,
  .dispatch-layout,
  .detail-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .inspector {
    position: static;
  }
}

@media (max-width: 640px) {
  .workspace,
  .side-rail {
    padding: 18px;
  }

  .topbar,
  .command-head,
  .filters,
  .queue-topline,
  .queue-bottom {
    align-items: stretch;
    flex-direction: column;
  }

  .operator-strip,
  .filters input,
  .filters select {
    width: 100%;
  }

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

  .summary-grid {
    margin-top: 18px;
  }

  .timeline-row {
    grid-template-columns: 1fr;
  }
}
