:root {
  --ink: #2d3142;
  --paper: #f7fff7;
  --amber: #ff9f1c;
  --teal: #2ec4b6;
  --line: rgba(45, 49, 66, 0.18);
  --muted: #687076;
  --red: #c43c35;
  --green: #247a4d;
  --white: #ffffff;
  --shadow: 0 14px 34px rgba(45, 49, 66, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100svh;
  background:
    linear-gradient(90deg, rgba(45, 49, 66, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(45, 49, 66, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
}

.command-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(190px, 270px) 1fr minmax(220px, 360px);
  gap: 18px;
  align-items: center;
  min-height: 72px;
  padding: 12px clamp(14px, 3vw, 34px);
  border-bottom: 3px solid var(--ink);
  background: rgba(247, 255, 247, 0.95);
  backdrop-filter: blur(12px);
}

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

.brand img {
  flex: 0 0 auto;
  border-radius: 8px;
  box-shadow: 0 0 0 2px var(--ink);
}

.brand strong,
h1,
h2,
.stage-column header strong {
  font-family: Georgia, "Times New Roman", serif;
}

.brand strong {
  display: block;
  font-size: 1.08rem;
  line-height: 1;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.screen-tabs,
.stage-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab,
.stage-filter button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.tab.is-active,
.stage-filter button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.command-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 6px 8px;
}

.search-box span {
  color: var(--muted);
  font-size: 0.75rem;
}

.search-box input {
  width: 100%;
  min-width: 120px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  transition: transform 160ms ease, background-color 160ms ease;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.icon-button:hover {
  background: var(--amber);
  transform: translateY(-1px);
}

main {
  padding: clamp(16px, 3vw, 34px);
}

.screen {
  display: none;
  animation: liftIn 260ms ease both;
}

.screen.is-active {
  display: block;
}

.overview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  gap: 8px;
  min-width: min(100%, 520px);
}

.status-strip div,
.metric-skeleton {
  min-height: 66px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  padding: 10px;
  box-shadow: 4px 4px 0 var(--teal);
}

.status-strip small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.status-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.stage-filter {
  margin: 0 0 16px;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 12px;
  align-items: start;
}

.stage-column {
  min-height: 420px;
  border-left: 3px solid var(--ink);
  padding-left: 10px;
}

.stage-column header {
  position: sticky;
  top: 85px;
  z-index: 3;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 0;
  background: rgba(247, 255, 247, 0.96);
}

.stage-column header div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.stage-column header span {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.stage-column header strong {
  font-size: 2rem;
}

meter {
  width: 100%;
  height: 8px;
}

.pipeline-item {
  position: relative;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 1px 0 rgba(45, 49, 66, 0.08);
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.pipeline-item:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
  box-shadow: var(--shadow);
}

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.cue {
  display: inline-flex;
  width: 44px;
  height: 12px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--green);
}

.public-yellow {
  background: #f6d55c;
}

.public-orange {
  background: var(--amber);
}

.public-teal {
  background: var(--teal);
}

.public-green {
  background: #4caf50;
}

.pipeline-item h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.22;
}

.meta {
  min-height: 38px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.progress,
.finance-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(45, 49, 66, 0.12);
}

.progress span,
.finance-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 260ms ease;
}

.pipeline-item dl,
.finance-band dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

dt {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  font-size: 0.86rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.incident-action,
.primary-action {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
}

.primary-action {
  background: var(--amber);
}

.status-delayed {
  border-color: rgba(196, 60, 53, 0.5);
  box-shadow: inset 4px 0 0 var(--red);
}

.empty-column,
.api-error {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.api-error {
  grid-column: 1 / -1;
  color: var(--red);
  background: #fff5f4;
}

.event-stream {
  margin-top: 18px;
  border-top: 3px solid var(--ink);
  padding-top: 12px;
}

.stream-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.stream-head span {
  color: var(--muted);
  font-size: 0.8rem;
}

.stream-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stream-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}

.stream-type {
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 7px;
  font-size: 0.68rem;
}

.stream-row strong {
  min-width: 0;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.stream-row small {
  color: var(--muted);
  font-size: 0.76rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 440px) minmax(280px, 1fr);
  gap: clamp(18px, 4vw, 44px);
  align-items: start;
}

.form-panel form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.form-panel label {
  display: grid;
  gap: 6px;
  font-weight: 800;
  font-size: 0.86rem;
}

.form-panel input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 0 12px;
}

.process-ledger {
  border-left: 3px solid var(--ink);
  padding-left: clamp(14px, 3vw, 28px);
}

.process-ledger ol {
  display: grid;
  gap: 14px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: wayline;
}

.process-ledger li {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  counter-increment: wayline;
}

.process-ledger li::before {
  content: counter(wayline);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--teal);
  font-weight: 900;
}

.process-ledger strong,
.process-ledger span {
  display: block;
}

.process-ledger span {
  margin-top: 4px;
  color: var(--muted);
}

.dense-table-wrap {
  overflow-x: auto;
  margin-top: 22px;
  border-top: 3px solid var(--ink);
}

.dense-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  background: var(--white);
}

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

.dense-table th {
  background: var(--ink);
  color: var(--paper);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.dense-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.doc-state {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}

.finance-grid {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  max-width: 920px;
}

.finance-band {
  display: grid;
  grid-template-columns: 210px minmax(160px, 1fr) 320px;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.finance-band header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.finance-band header strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
}

.finance-band dl {
  margin: 0;
}

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

@media (max-width: 1180px) {
  .command-bar {
    grid-template-columns: 1fr;
  }

  .command-tools {
    justify-content: stretch;
  }

  .search-box {
    flex: 1 1 auto;
  }

  .pipeline-board {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    padding-bottom: 6px;
  }

  .stream-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 780px) {
  main {
    padding: 16px 12px 24px;
  }

  .command-bar {
    min-height: 64px;
    gap: 10px;
    padding: 10px 12px;
  }

  .overview-head,
  .workspace-grid,
  .finance-band {
    grid-template-columns: 1fr;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .pipeline-board {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .stage-column {
    min-height: 0;
  }

  .stage-column header {
    position: static;
  }

  .stream-list {
    grid-template-columns: 1fr;
  }

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

  .stream-row small {
    grid-column: 2;
  }

  .process-ledger {
    border-left: 0;
    padding-left: 0;
    border-top: 3px solid var(--ink);
    padding-top: 14px;
  }
}

@media (max-width: 430px) {
  .brand small {
    display: none;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }

  .command-tools {
    align-items: stretch;
  }

  .search-box {
    grid-template-columns: 1fr;
  }
}

