:root {
  --ink: #1d3557;
  --paper: #fff8f0;
  --mint: #2a9d8f;
  --coral: #e76f51;
  --line: rgba(29, 53, 87, .16);
  --muted: rgba(29, 53, 87, .64);
  --white: #ffffff;
  --shadow: 0 18px 42px rgba(29, 53, 87, .11);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(42, 157, 143, .08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(29, 53, 87, .07) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  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: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 24px 18px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: inset -1px 0 0 rgba(255, 248, 240, .14);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  text-decoration: none;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  line-height: 1.05;
  text-transform: uppercase;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  margin-top: 36px;
}

.nav-tab {
  min-height: 42px;
  border: 1px solid rgba(255, 248, 240, .13);
  border-radius: 8px;
  color: rgba(255, 248, 240, .74);
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.nav-tab:hover,
.nav-tab.active {
  color: var(--paper);
  border-color: rgba(42, 157, 143, .72);
  background: rgba(42, 157, 143, .18);
}

.workspace {
  min-width: 0;
  padding: 28px clamp(16px, 3vw, 38px) 38px;
}

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

.eyebrow,
.toolbar span,
.metric span,
.lane-meta,
.status-pill,
.setting-key {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.sync-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .54);
  color: var(--muted);
  white-space: nowrap;
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(42, 157, 143, .16);
}

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

.metric {
  min-height: 96px;
  padding: 16px;
  background: rgba(255, 255, 255, .68);
}

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

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: .95;
}

.metric.danger strong {
  color: var(--coral);
}

.metric.warn strong {
  color: #b66511;
}

.view-panel {
  display: none;
}

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

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.toolbar label {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.toolbar .search {
  flex: 1 1 auto;
}

.toolbar span {
  color: var(--muted);
  font-size: 11px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .82);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, .14);
}

.lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.lane {
  min-width: 220px;
  border-left: 3px solid var(--mint);
  background: rgba(255, 255, 255, .56);
  box-shadow: var(--shadow);
}

.lane[data-step="assembly"] {
  border-left-color: var(--coral);
}

.lane-head {
  min-height: 68px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.lane-head h2 {
  margin: 0 0 7px;
  font-size: 18px;
}

.lane-meta {
  color: var(--muted);
  font-size: 11px;
}

.lane-items {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.resource-item {
  position: relative;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--white);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.resource-item:hover {
  transform: translateY(-2px);
  border-color: rgba(42, 157, 143, .45);
  box-shadow: 0 12px 28px rgba(29, 53, 87, .12);
}

.resource-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.resource-title {
  min-width: 0;
}

.resource-title h3 {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.24;
}

.resource-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 7px;
  color: var(--ink);
  background: rgba(42, 157, 143, .14);
  font-size: 10px;
}

.status-critical .status-pill {
  color: #8f2e1e;
  background: rgba(231, 111, 81, .17);
}

.status-watch .status-pill {
  color: #8a540d;
  background: rgba(231, 111, 81, .1);
}

.stock-line {
  display: grid;
  gap: 6px;
}

.stock-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(29, 53, 87, .1);
}

.stock-bar span {
  display: block;
  height: 100%;
  width: var(--stock-width);
  border-radius: inherit;
  background: var(--mint);
}

.status-critical .stock-bar span {
  background: var(--coral);
}

.status-watch .stock-bar span {
  background: #d08a22;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.resource-chip {
  min-width: 0;
  border: 1px solid rgba(29, 53, 87, .1);
  border-radius: 7px;
  padding: 7px;
  background: rgba(255, 248, 240, .72);
}

.resource-chip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.resource-chip strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 2px;
  font-size: 13px;
}

.move-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.move-row button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  color: var(--paper);
  background: var(--ink);
  padding: 6px 10px;
}

.section-head {
  max-width: 760px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 8px;
  font-size: 26px;
}

.section-head p {
  color: var(--muted);
}

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

.timeline-row {
  display: grid;
  grid-template-columns: 180px minmax(160px, 240px) 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-row time,
.timeline-row .actor {
  color: var(--muted);
  font-size: 13px;
}

.timeline-row strong {
  display: block;
  margin-bottom: 4px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.setting {
  border-left: 3px solid var(--mint);
  padding: 14px;
  background: rgba(255, 255, 255, .66);
  box-shadow: var(--shadow);
}

.setting:nth-child(2n) {
  border-left-color: var(--coral);
}

.setting-key {
  color: var(--muted);
  font-size: 11px;
}

.setting strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.team-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
}

.team-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

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

.team-table th {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.empty-state,
.error-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, .58);
}

.error-state {
  color: #8f2e1e;
  border-color: rgba(231, 111, 81, .45);
}

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

  .rail {
    position: static;
    min-height: auto;
    padding: 14px;
  }

  .brand {
    justify-content: space-between;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(88px, 1fr));
    margin-top: 14px;
    overflow-x: auto;
  }

  .nav-tab {
    text-align: center;
  }

  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .sync-box {
    width: fit-content;
  }

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

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

@media (max-width: 560px) {
  .workspace {
    padding: 18px 12px 28px;
  }

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

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

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