:root {
  color-scheme: light;
  --ink: #102a43;
  --paper: #f5f7fa;
  --danger: #d64545;
  --teal: #56a3a6;
  --line: rgba(16, 42, 67, 0.14);
  --muted: #60738a;
  --white: #ffffff;
  --shadow: 0 22px 60px rgba(16, 42, 67, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 42, 67, 0.055) 1px, transparent 1px) 0 0 / 84px 84px,
    linear-gradient(0deg, rgba(86, 163, 166, 0.08) 1px, transparent 1px) 0 0 / 84px 84px,
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  color: var(--paper);
  background:
    linear-gradient(180deg, rgba(86, 163, 166, 0.20), transparent 38%),
    var(--ink);
}

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

.brand span {
  font-size: 21px;
  font-weight: 800;
  line-height: 0.92;
}

.screen-nav {
  display: grid;
  gap: 8px;
}

.screen-nav button,
.ghost-button,
.primary-button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 10px 13px;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.screen-nav button {
  text-align: left;
  color: rgba(245, 247, 250, 0.72);
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 800;
}

.screen-nav button:hover,
.screen-nav button.is-active {
  color: var(--white);
  background: rgba(245, 247, 250, 0.12);
}

.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 5px;
  color: rgba(245, 247, 250, 0.68);
  font-size: 12px;
  text-transform: uppercase;
}

.rail-foot strong {
  color: var(--paper);
  font-size: 16px;
}

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

.topbar,
.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
}

.topbar h1,
.section-title h2,
.workflow-layout h2 {
  margin: 0;
  line-height: 1.02;
}

.topbar h1 {
  max-width: 760px;
  font-size: clamp(33px, 5vw, 72px);
}

.section-title h2,
.workflow-layout h2 {
  font-size: clamp(24px, 3vw, 42px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.search-box {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-box input {
  width: min(280px, 34vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.primary-button {
  color: var(--white);
  background: var(--danger);
  box-shadow: 0 12px 24px rgba(214, 69, 69, 0.22);
}

.ghost-button:hover,
.primary-button:hover,
.build-card:hover {
  transform: translateY(-1px);
}

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

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

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.metric-tile {
  min-height: 106px;
  display: grid;
  align-content: space-between;
  padding: 18px;
  background: rgba(255, 255, 255, 0.86);
}

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

.metric-tile strong {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

.queue-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 22px;
  align-items: start;
}

.radar-wall,
.detail-sheet,
.workflow-layout > section,
.history-table,
.team-grid {
  border-top: 3px solid var(--ink);
  padding-top: 18px;
}

.build-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.build-card {
  position: relative;
  min-height: 184px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(16, 42, 67, 0.04) 0 10px, transparent 10px 20px),
    var(--white);
  box-shadow: 0 10px 26px rgba(16, 42, 67, 0.08);
}

.build-card.is-selected {
  outline: 3px solid rgba(86, 163, 166, 0.32);
}

.build-card.is-danger {
  border-color: rgba(214, 69, 69, 0.42);
}

.drawer-code {
  width: max-content;
  padding: 4px 8px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 5px;
  font-weight: 900;
}

.stage-chip {
  width: max-content;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stage-group { background: rgba(86, 163, 166, 0.16); color: #276f72; }
.stage-project { background: rgba(16, 42, 67, 0.10); color: var(--ink); }
.stage-build { background: rgba(214, 69, 69, 0.13); color: var(--danger); }
.stage-demo { background: #fff0b8; color: #806000; }

.build-card strong {
  font-size: 24px;
  line-height: 1.04;
}

.build-card small,
.card-row,
.stage-row span,
.team-person span,
.team-person small {
  color: var(--muted);
  line-height: 1.45;
}

.card-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.card-row b {
  color: var(--danger);
}

.mini-meter,
.drawer-meter div,
.team-person {
  overflow: hidden;
}

.mini-meter,
.drawer-meter div {
  height: 8px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.10);
}

.mini-meter i,
.drawer-meter i,
.team-person i {
  display: block;
  height: 100%;
  background: var(--teal);
  transition: width 260ms ease;
}

.detail-sheet {
  position: sticky;
  top: 26px;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--danger);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.detail-sheet h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.08;
}

.quality-dial {
  width: 170px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 22px auto;
  border: 14px solid rgba(86, 163, 166, 0.25);
  border-top-color: var(--danger);
  border-radius: 50%;
}

.quality-dial span {
  font-size: 40px;
  font-weight: 900;
}

.quality-dial small {
  max-width: 100px;
  text-align: center;
  color: var(--muted);
  line-height: 1.15;
}

.detail-list {
  display: grid;
  gap: 11px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.drawer-meter {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.drawer-meter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.part-list {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.part-row,
.stage-row,
.history-row,
.team-person {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.part-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.history-table {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.history-row {
  display: grid;
  grid-template-columns: 150px 120px 120px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
}

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

.history-row p {
  margin: 0;
  line-height: 1.45;
}

.workflow-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 28px;
}

.stage-settings {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.stage-row {
  display: grid;
  grid-template-columns: 120px 100px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.forecast-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.forecast-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.forecast-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
}

.forecast-output {
  margin-top: 14px;
  padding: 18px;
  border-left: 4px solid var(--teal);
  background: rgba(86, 163, 166, 0.12);
  font-size: 26px;
  font-weight: 900;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.team-person {
  position: relative;
  min-height: 154px;
  display: grid;
  grid-template-rows: 1fr auto auto 7px;
  gap: 10px;
  padding: 16px;
}

.team-person strong {
  display: block;
  font-size: 22px;
  line-height: 1.05;
}

.team-person b {
  font-size: 34px;
}

.team-person i {
  background: var(--danger);
}

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

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

  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

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

  .rail-foot {
    margin-left: auto;
    margin-top: 0;
  }

  .queue-layout,
  .workflow-layout {
    grid-template-columns: 1fr;
  }

  .detail-sheet {
    position: static;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 20px 14px 30px;
  }

  .topbar,
  .section-title,
  .top-actions,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box input {
    width: 100%;
  }

  .screen-nav {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-strip,
  .build-board,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .history-row,
  .stage-row,
  .detail-list div {
    grid-template-columns: 1fr;
  }

  .build-card,
  .metric-tile,
  .team-person {
    min-height: auto;
  }
}

