:root {
  --ink: #0d1b2a;
  --paper: #f5ebe0;
  --steel: #778da9;
  --amber: #e0a458;
  --panel: #14263a;
  --paper-deep: #eadccf;
  --line: rgba(13, 27, 42, 0.16);
  --line-dark: rgba(245, 235, 224, 0.16);
  --green: #5e8f71;
  --red: #b45f53;
  --shadow: 0 18px 50px rgba(7, 15, 25, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(13, 27, 42, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 27, 42, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 320px;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 14px;
}

.topbar {
  grid-column: 1 / -1;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) minmax(220px, 320px) 46px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid rgba(245, 235, 224, 0.18);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--paper);
  text-decoration: none;
  font-weight: 860;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand img {
  flex: 0 0 auto;
  border: 1px solid rgba(245, 235, 224, 0.22);
}

.screen-tabs {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}

.tab,
.icon-button,
.text-button,
.primary-button {
  min-height: 42px;
  border: 1px solid var(--line-dark);
  color: var(--paper);
  background: #18304a;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.tab {
  padding: 0 14px;
  white-space: nowrap;
}

.tab.is-active,
.primary-button {
  color: #17130d;
  background: var(--amber);
  border-color: rgba(224, 164, 88, 0.8);
}

.tab:hover,
.icon-button:hover,
.text-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line-dark);
  background: rgba(245, 235, 224, 0.08);
}

.search-box span,
.mono,
.eyebrow {
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.search-box input::placeholder {
  color: rgba(245, 235, 224, 0.56);
}

.icon-button {
  width: 46px;
  padding: 0;
  font-size: 21px;
}

.workspace,
.metrics-spine,
.right-rail {
  min-width: 0;
}

.metrics-spine,
.right-rail > section,
.board-shell,
.market-shell,
.inspector-panel,
.resource-rack,
.report-panel,
.calendar-day {
  border: 1px solid var(--line);
  background: rgba(245, 235, 224, 0.88);
}

.metrics-spine {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  color: var(--paper);
  border-color: var(--line-dark);
  box-shadow: var(--shadow);
}

.spine-head {
  padding: 14px;
  border: 1px solid var(--line-dark);
  background: #0f2134;
}

.spine-head strong {
  display: block;
  font-size: 54px;
  line-height: 0.95;
  margin: 8px 0;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.spine-head small {
  color: rgba(245, 235, 224, 0.72);
}

.metric-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric-tile {
  min-height: 82px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line-dark);
  background: rgba(245, 235, 224, 0.07);
}

.metric-tile span {
  color: rgba(245, 235, 224, 0.72);
  font-size: 12px;
}

.metric-tile strong {
  font-size: 22px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.lever-panel {
  margin-top: auto;
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line-dark);
  background: rgba(13, 27, 42, 0.42);
}

.lever-panel label {
  display: grid;
  gap: 5px;
  color: rgba(245, 235, 224, 0.74);
  font-size: 12px;
}

.lever-panel input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-dark);
  padding: 9px;
  color: var(--paper);
  background: #0d1b2a;
}

.workspace {
  grid-column: 2;
  grid-row: 2;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
  animation: rise 180ms ease-out;
}

.workspace-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 12px 2px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #526a84;
  font-weight: 760;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

h3 {
  font-size: 15px;
  line-height: 1.2;
}

.workflow-mark {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 4px;
  min-width: min(420px, 100%);
  padding: 4px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid rgba(13, 27, 42, 0.26);
}

.workflow-mark span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-dark);
  font-size: 12px;
  text-transform: uppercase;
}

.section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.quiet-count,
.mono {
  color: #5d7189;
  font-weight: 760;
}

.board-shell,
.market-shell,
.inspector-panel,
.resource-rack,
.report-panel {
  padding: 14px;
  margin-bottom: 14px;
}

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

.lane {
  min-width: 0;
  border: 1px solid rgba(13, 27, 42, 0.2);
  background: rgba(255, 250, 244, 0.72);
}

.lane-head {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: var(--paper);
  background: var(--ink);
}

.lane-head span {
  display: block;
  margin-top: 2px;
  color: rgba(245, 235, 224, 0.66);
  font-size: 12px;
}

.lane-head b {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--amber);
}

.lane-cards {
  display: grid;
  gap: 9px;
  min-height: 180px;
  padding: 9px;
}

.booking-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(13, 27, 42, 0.18);
  background: var(--paper);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.booking-card:hover,
.booking-card.is-selected {
  transform: translateY(-2px);
  border-color: var(--amber);
  box-shadow: 0 10px 24px rgba(13, 27, 42, 0.18);
}

.card-top,
.status-row,
.offer-top,
.offer-dials,
.detail-grid,
.invoice-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.ticket-code,
.priority {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 800;
  background: var(--ink);
  color: var(--paper);
}

.priority {
  background: var(--amber);
  color: #17130d;
}

.booking-card h3 {
  margin: 10px 0 6px;
}

.booking-card p,
.offer-card p,
.selected-ticket p,
.detail-header p {
  margin-bottom: 10px;
  color: #516273;
  font-size: 13px;
  line-height: 1.35;
}

.card-gauges {
  display: grid;
  grid-template-columns: 1fr 0.65fr;
  gap: 6px;
  margin-bottom: 8px;
}

.card-gauges span,
.status-row span,
.status-row strong {
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  background: rgba(119, 141, 169, 0.13);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.status-row strong {
  text-align: right;
  color: #744612;
}

.text-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  border-color: rgba(13, 27, 42, 0.22);
  box-shadow: inset 0 -2px 0 rgba(13, 27, 42, 0.12);
}

.market-shell {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--line-dark);
}

.market-shell .quiet-count,
.market-shell .mono {
  color: rgba(245, 235, 224, 0.68);
}

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

.offer-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-dark);
  background: rgba(245, 235, 224, 0.08);
}

.offer-card.is-selected {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 2px rgba(224, 164, 88, 0.22);
}

.offer-top span {
  padding: 3px 7px;
  color: var(--ink);
  background: var(--paper);
  font-size: 12px;
}

.offer-card h3 {
  margin: 0;
}

.offer-dials span {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--line-dark);
}

.offer-dials b,
.offer-dials small {
  overflow-wrap: anywhere;
}

.offer-card p {
  color: rgba(245, 235, 224, 0.72);
}

.offer-card .text-button {
  color: var(--paper);
  border-color: var(--line-dark);
}

.right-rail {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.right-rail > section {
  padding: 14px;
}

.selected-ticket dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.selected-ticket dl div,
.resource-row,
.vendor-row,
.stream-item {
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.62);
}

.selected-ticket dt {
  color: #5d7189;
  font-size: 11px;
  text-transform: uppercase;
}

.selected-ticket dd {
  margin: 2px 0 0;
  font-weight: 760;
}

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

.stream-item {
  border-left: 4px solid var(--steel);
}

.stream-item[data-tone="amber"] {
  border-left-color: var(--amber);
}

.stream-item[data-tone="green"] {
  border-left-color: var(--green);
}

.stream-item span {
  display: block;
  color: #5d7189;
  font-size: 11px;
  text-transform: uppercase;
}

.stream-item p {
  margin: 5px 0 0;
  color: #516273;
  font-size: 12px;
  line-height: 1.35;
}

.details-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.detail-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 10px 0 6px;
  font-size: 24px;
}

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

.detail-grid div {
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
}

.detail-grid span {
  color: #5d7189;
  font-size: 12px;
}

.detail-grid strong {
  overflow-wrap: anywhere;
}

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

.offer-mini {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(119, 141, 169, 0.12);
}

.resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.resource-row span {
  display: block;
  color: #5d7189;
  font-size: 12px;
}

meter {
  width: 100%;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.calendar-day {
  min-height: 150px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.calendar-day span {
  color: #5d7189;
  font-size: 12px;
  text-transform: uppercase;
}

.calendar-day strong {
  font-size: 38px;
  line-height: 1;
}

.pressure {
  height: 10px;
  border: 1px solid var(--line);
  background: rgba(119, 141, 169, 0.16);
}

.pressure i {
  display: block;
  height: 100%;
  background: var(--amber);
}

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

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

.bar-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.bar-row i {
  height: 12px;
  background: var(--steel);
}

.vendor-row {
  margin-top: 8px;
}

.vendor-row span {
  display: block;
  margin-top: 4px;
  color: #5d7189;
  font-size: 13px;
}

.invoice-row {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(90px, auto) 76px minmax(120px, 1fr);
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
}

.empty-lane,
.empty-state {
  padding: 14px;
  color: #5d7189;
  border: 1px dashed rgba(13, 27, 42, 0.24);
}

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

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

  .right-rail {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .topbar {
    grid-template-columns: auto minmax(260px, 1fr) 46px;
  }

  .search-box {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
    padding: 10px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) 44px;
    margin-bottom: 10px;
  }

  .screen-tabs,
  .search-box {
    grid-column: 1 / -1;
  }

  .metrics-spine,
  .workspace,
  .right-rail {
    margin-bottom: 10px;
  }

  .metric-list,
  .lane-grid,
  .offer-grid,
  .details-layout,
  .report-grid,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .workspace-head {
    display: grid;
  }

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

  h1 {
    font-size: 28px;
  }

  .detail-grid,
  .invoice-row,
  .resource-row {
    grid-template-columns: 1fr;
  }
}
