:root {
  --ink: #1a1a2e;
  --paper: #f2e9e4;
  --mauve: #9a8c98;
  --clay: #c9ada7;
  --cream: #fffaf3;
  --sage: #5b6f56;
  --line: rgba(26, 26, 46, 0.18);
  --shadow: 0 18px 45px rgba(26, 26, 46, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(26, 26, 46, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(26, 26, 46, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  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: 248px minmax(0, 1fr) 328px;
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px;
  color: var(--paper);
  background: var(--ink);
  border-right: 2px solid rgba(255, 250, 243, 0.14);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.1;
}

.brand span,
.rail-note span {
  color: rgba(242, 233, 228, 0.68);
  font-size: 12px;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  color: rgba(242, 233, 228, 0.74);
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
}

.nav-item.active,
.nav-item:hover {
  color: var(--paper);
  background: rgba(242, 233, 228, 0.08);
  border-left-color: var(--clay);
}

.rail-note {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(242, 233, 228, 0.18);
}

.rail-note strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.18;
}

.workspace {
  min-width: 0;
  padding: 26px 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: end;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--mauve);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 0.98;
  letter-spacing: 0;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 8px;
}

.search-box input,
.search-box select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0;
  border: 2px solid var(--ink);
  background: var(--cream);
  box-shadow: var(--shadow);
}

.metric {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(28px, 3.5vw, 46px);
  line-height: 1;
}

.canvas {
  min-height: 420px;
}

.queue-head,
.queue-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(170px, 1fr) 96px 160px;
  gap: 18px;
  align-items: center;
}

.queue-head {
  padding: 0 16px 9px;
  color: var(--mauve);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.queue-list {
  display: grid;
  border-top: 2px solid var(--ink);
}

.queue-row {
  min-height: 112px;
  padding: 16px;
  background: rgba(255, 250, 243, 0.68);
  border-bottom: 1px solid var(--line);
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.queue-row:hover,
.queue-row.selected {
  background: var(--cream);
  box-shadow: inset 5px 0 0 var(--clay);
  transform: translateX(2px);
}

.row-main,
.vendor-cell {
  min-width: 0;
}

.row-main strong,
.vendor-cell strong {
  display: block;
  overflow-wrap: anywhere;
}

.row-main span,
.row-main small,
.vendor-cell span {
  display: block;
  margin-top: 5px;
  color: rgba(26, 26, 46, 0.66);
}

.risk-cell strong {
  font-size: 24px;
}

.risk-cell span {
  display: block;
  width: 72px;
  height: 7px;
  margin-top: 9px;
  background: linear-gradient(90deg, var(--sage) 0%, var(--clay) calc(var(--risk) * 1%), rgba(26, 26, 46, 0.12) 0);
}

.action-button {
  min-height: 42px;
  padding: 0 12px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  transition: background 160ms ease, color 160ms ease;
}

.action-button:hover {
  color: var(--ink);
  background: var(--clay);
}

.action-button:disabled {
  cursor: default;
  color: rgba(26, 26, 46, 0.55);
  background: rgba(154, 140, 152, 0.18);
  border-color: transparent;
}

.inspector {
  padding: 26px 22px;
  background: var(--cream);
  border-left: 2px solid var(--ink);
}

.drawer-head {
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.drawer-head span,
.pulse-panel span {
  color: var(--mauve);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.drawer-head strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.selected-details {
  padding: 18px 0;
}

.selected-details p {
  color: rgba(26, 26, 46, 0.66);
}

.selected-details dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.selected-details dt {
  color: var(--mauve);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.selected-details dd {
  margin: -8px 0 0;
  overflow-wrap: anywhere;
}

.pulse-panel {
  margin-top: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.pulse-line {
  height: 64px;
  margin-top: 12px;
  background:
    linear-gradient(90deg, transparent 0 10%, var(--ink) 10% 12%, transparent 12% 22%, var(--clay) 22% 24%, transparent 24% 35%, var(--ink) 35% 37%, transparent 37% 54%, var(--sage) 54% 56%, transparent 56% 72%, var(--ink) 72% 74%, transparent 74%),
    linear-gradient(180deg, transparent 47%, rgba(26, 26, 46, 0.2) 47% 53%, transparent 53%);
  animation: pulseShift 2200ms ease-in-out infinite;
}

.timeline,
.workflow-grid,
.team-grid {
  display: grid;
  gap: 0;
  border-top: 2px solid var(--ink);
}

.timeline-row,
.workflow-step,
.team-row {
  display: grid;
  gap: 8px;
  padding: 18px 16px;
  background: rgba(255, 250, 243, 0.74);
  border-bottom: 1px solid var(--line);
}

.timeline-row {
  grid-template-columns: 170px minmax(0, 1fr) 150px;
  align-items: center;
}

.timeline-row time,
.timeline-row span,
.workflow-step span,
.workflow-step em,
.team-row span {
  color: var(--mauve);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  text-transform: uppercase;
}

.workflow-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-left: 2px solid var(--ink);
}

.workflow-step {
  min-height: 168px;
  border-right: 1px solid var(--line);
}

.workflow-step strong {
  font-size: 24px;
}

.workflow-step p,
.team-row p {
  margin: 0;
  color: rgba(26, 26, 46, 0.68);
}

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

.team-row strong {
  font-size: 22px;
}

.empty-state {
  padding: 28px;
  background: var(--cream);
  border: 2px solid var(--ink);
}

.empty-state strong {
  font-size: 24px;
}

.is-busy .canvas {
  opacity: 0.62;
}

@keyframes pulseShift {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    border-top: 2px solid var(--ink);
    border-left: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    padding: 16px;
  }

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

  .nav-item {
    padding: 0 8px;
    text-align: center;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .nav-item.active,
  .nav-item:hover {
    border-bottom-color: var(--clay);
  }

  .rail-note {
    display: none;
  }

  .workspace {
    padding: 18px 14px;
  }

  .topbar,
  .search-box,
  .metrics,
  .workflow-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .queue-head {
    display: none;
  }

  .queue-row,
  .timeline-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .action-button {
    width: 100%;
  }
}

