:root {
  --ink: #1a1a2e;
  --paper: #f2e9e4;
  --muted: #9a8c98;
  --clay: #c9ada7;
  --ember: #b64926;
  --moss: #3e6b4f;
  --wheat: #d8b35a;
  --line: rgba(26, 26, 46, 0.18);
  --shadow: 0 24px 70px rgba(26, 26, 46, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(26, 26, 46, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(26, 26, 46, 0.04) 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 {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 324px;
  border-top: 8px solid var(--ink);
}

.rail,
.workspace,
.inspector {
  min-width: 0;
}

.rail {
  background: var(--ink);
  color: var(--paper);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
}

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

.brand-lockup strong {
  font-size: 17px;
}

.brand-lockup span,
.eyebrow,
.rail-note span,
small {
  color: rgba(26, 26, 46, 0.62);
  font-size: 12px;
  letter-spacing: 0;
}

.rail .brand-lockup span,
.rail .rail-note span {
  color: rgba(242, 233, 228, 0.62);
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  border: 1px solid rgba(242, 233, 228, 0.18);
  background: transparent;
  color: var(--paper);
  text-align: left;
  padding: 12px 14px;
  border-radius: 0;
}

.nav-item.is-active,
.nav-item:hover {
  background: var(--paper);
  color: var(--ink);
}

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

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

.workspace {
  padding: 26px;
  border-right: 1px solid var(--line);
}

.topbar,
.panel-head,
.toolbar,
.segmented {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow {
  margin: 0 0 5px;
  text-transform: uppercase;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.95;
}

h2 {
  font-size: 20px;
  line-height: 1.12;
}

.toolbar {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-box {
  min-width: min(330px, 100%);
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: rgba(26, 26, 46, 0.64);
}

.search-box input,
.action-form input,
.action-form select {
  width: 100%;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

.search-box input:focus,
.action-form input:focus,
.action-form select:focus {
  box-shadow: inset 0 0 0 2px var(--ember);
}

.primary-action {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: 0;
  font-weight: 800;
}

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

.screen {
  display: none;
  padding-top: 22px;
}

.screen.is-visible {
  display: block;
  animation: rise 260ms ease both;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  border: 1px solid var(--ink);
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.26);
}

.metric {
  padding: 16px 15px;
  border-right: 1px solid var(--ink);
}

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

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

.metric span {
  color: rgba(26, 26, 46, 0.62);
  font-size: 12px;
}

.metric strong {
  margin-top: 7px;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 0.95;
}

.risk-high strong,
.risk-high.row-risk {
  color: var(--ember);
}

.risk-mid strong,
.risk-mid.row-risk {
  color: #8a6916;
}

.risk-low strong,
.risk-low.row-risk {
  color: var(--moss);
}

.workflow-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  border: 1px solid var(--ink);
  background: var(--clay);
}

.workflow-step {
  min-height: 78px;
  border: 0;
  border-right: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

.workflow-step:last-child {
  border-right: 0;
}

.workflow-step span,
.workflow-step strong {
  display: block;
}

.workflow-step strong {
  margin-top: 8px;
  font-size: 25px;
}

.workflow-step.risk {
  background: rgba(182, 73, 38, 0.18);
}

.workflow-step.watch {
  background: rgba(216, 179, 90, 0.22);
}

.workflow-step.ok {
  background: rgba(62, 107, 79, 0.15);
}

.canvas-grid,
.split-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.work-panel {
  background: rgba(242, 233, 228, 0.92);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
}

.large-panel {
  min-height: 420px;
}

.panel-head {
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--ink);
}

.panel-head.compact {
  align-items: flex-start;
}

.segmented {
  border: 1px solid var(--ink);
  flex-wrap: wrap;
}

.segment {
  border: 0;
  border-right: 1px solid var(--ink);
  background: transparent;
  padding: 9px 11px;
  color: var(--ink);
}

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

.segment.is-active {
  background: var(--ink);
  color: var(--paper);
}

.item-list,
.signal-list,
.timeline,
.settings-list,
.team-list {
  display: grid;
}

.item-row,
.signal-row,
.timeline-row,
.team-row,
.setting-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.22);
  color: var(--ink);
  text-align: left;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 86px 110px 104px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}

.item-row:hover,
.signal-row:hover,
.timeline-row:hover,
.team-row:hover {
  background: rgba(201, 173, 167, 0.45);
}

.row-main strong,
.row-main small,
.timeline-row strong,
.timeline-row small,
.team-row strong,
.team-row small,
.setting-row strong,
.setting-row small {
  display: block;
}

.row-main strong,
.timeline-row strong,
.team-row strong,
.setting-row strong {
  overflow-wrap: anywhere;
}

.row-risk {
  font-size: 24px;
  font-weight: 900;
}

.row-meta {
  color: rgba(26, 26, 46, 0.72);
  font-size: 13px;
}

.status-pill {
  border: 1px solid var(--ink);
  padding: 6px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.risk,
.status-pill.late,
.status-pill.tight,
.status-pill.active {
  background: rgba(182, 73, 38, 0.16);
}

.status-pill.watch,
.status-pill.pending,
.status-pill.scheduled,
.status-pill.queued {
  background: rgba(216, 179, 90, 0.28);
}

.status-pill.ok,
.status-pill.done {
  background: rgba(62, 107, 79, 0.16);
}

.signal-row {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  padding: 14px 16px;
}

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

.signal-level {
  width: 10px;
  height: 42px;
  border: 1px solid var(--ink);
  background: var(--moss);
}

.signal-level.high {
  background: var(--ember);
}

.signal-level.medium {
  background: var(--wheat);
}

.empty-state {
  padding: 26px;
  color: rgba(26, 26, 46, 0.68);
}

.timeline-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px 16px;
  padding: 16px;
}

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

.timeline-date {
  color: var(--ember);
  font-weight: 900;
}

.action-form {
  padding: 18px;
  display: grid;
  gap: 13px;
  align-content: start;
}

.action-form label {
  display: grid;
  gap: 6px;
  color: rgba(26, 26, 46, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 300px) 52px 62px;
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.setting-row input[type="range"] {
  accent-color: var(--ember);
}

.toggle {
  position: relative;
  width: 46px;
  height: 24px;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--ink);
  background: rgba(154, 140, 152, 0.35);
}

.toggle span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 16px;
  height: 16px;
  background: var(--ink);
  transition: transform 160ms ease;
}

.toggle input:checked + span {
  background: rgba(62, 107, 79, 0.24);
}

.toggle input:checked + span::after {
  transform: translateX(20px);
}

.team-row {
  display: grid;
  grid-template-columns: 42px minmax(170px, 1fr) minmax(120px, 260px) 52px;
  gap: 13px;
  align-items: center;
  padding: 15px 16px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--clay);
  font-weight: 900;
}

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

.inspector {
  background: #fff8f0;
  padding: 26px 20px;
  border-left: 1px solid var(--line);
}

.inspector h2 {
  font-size: 27px;
  line-height: 1;
  margin-bottom: 18px;
  overflow-wrap: anywhere;
}

.inspector-body {
  border-top: 2px solid var(--ink);
}

.inspect-line {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.inspect-line span,
.inspect-line strong {
  display: block;
}

.inspect-line span {
  color: rgba(26, 26, 46, 0.58);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 900;
}

.inspect-line strong {
  margin-top: 4px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

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

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

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

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

  .rail {
    padding: 16px;
  }

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

  .nav-item {
    text-align: center;
    padding: 10px 6px;
  }

  .rail-note {
    display: none;
  }

  .workspace {
    padding: 18px;
    border-right: 0;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar,
  .search-box {
    width: 100%;
  }

  .metric-strip,
  .workflow-line,
  .canvas-grid,
  .split-panel {
    grid-template-columns: 1fr;
  }

  .metric,
  .workflow-step {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .item-row,
  .timeline-row,
  .setting-row,
  .team-row {
    grid-template-columns: 1fr;
  }

  .timeline-row small {
    grid-column: auto;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1 1 50%;
    border-bottom: 1px solid var(--ink);
  }
}
