:root {
  --ink: #1a1a2e;
  --paper: #f2e9e4;
  --paper-deep: #e5d6cf;
  --muted: #9a8c98;
  --clay: #c9ada7;
  --line: rgba(26, 26, 46, 0.2);
  --green: #3f7d58;
  --amber: #aa6f39;
  --red: #9f3a45;
  --white: #fffaf6;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(26, 26, 46, 0.055) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, rgba(26, 26, 46, 0.045) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px;
  color: var(--paper);
  background: var(--ink);
  border-right: 3px solid var(--clay);
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

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

.brand small,
.metric small,
.table-row small,
.timeline-item small,
.member p,
.workflow-step p,
.board-head p {
  color: inherit;
  opacity: 0.68;
}

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

.tab {
  width: 100%;
  padding: 12px 10px;
  color: var(--paper);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(242, 233, 228, 0.22);
}

.tab.is-active {
  color: var(--ink);
  background: var(--clay);
}

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

.rail-status strong {
  display: block;
  margin-top: 8px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  padding: 2px 0 22px;
  border-bottom: 3px solid var(--ink);
}

.eyebrow,
.mono {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.75rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.28rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: end;
}

.search-box {
  display: grid;
  gap: 4px;
  min-width: min(270px, 100%);
}

.search-box input,
.dialog-form textarea {
  width: 100%;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.search-box input {
  height: 41px;
  padding: 0 11px;
}

.icon-button,
.primary-button,
.dialog-actions button {
  min-height: 42px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.3rem;
}

.primary-button {
  color: var(--paper);
  background: var(--ink);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0;
  border: 3px solid var(--ink);
  background: var(--white);
}

.metric {
  min-width: 0;
  padding: 16px;
  border-right: 2px solid var(--ink);
}

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

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: clamp(1.8rem, 3.4vw, 3.25rem);
  line-height: 0.9;
  overflow-wrap: anywhere;
}

.metric-accent {
  background: var(--clay);
}

.metric-alert {
  color: var(--paper);
  background: var(--ink);
}

.view {
  display: none;
}

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

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

.board-wrap,
.table-zone,
.inspector,
.timeline,
.workflow-grid,
.team-grid {
  background: rgba(255, 250, 246, 0.74);
}

.board-wrap {
  border: 3px solid var(--ink);
}

.board-head,
.section-head {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 2px solid var(--ink);
}

.board-head p {
  margin-bottom: 0;
}

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

.lane {
  min-width: 0;
  border-right: 2px solid var(--ink);
}

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

.lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: rgba(201, 173, 167, 0.24);
  border-bottom: 2px solid var(--ink);
}

.lane-head strong {
  font-size: 1.8rem;
}

.lane-track {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 8px;
  min-height: 182px;
  padding: 14px;
}

.lane-axis {
  position: absolute;
  right: 14px;
  bottom: 25px;
  left: 14px;
  height: 2px;
  background: var(--line);
}

.risk-line {
  position: absolute;
  bottom: 22px;
  left: 14px;
  height: 8px;
  max-width: calc(100% - 28px);
  background: var(--ink);
}

.risk-chip {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  min-width: 108px;
  padding: 9px 10px;
  color: var(--ink);
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
  transition: transform 160ms ease, background-color 160ms ease;
}

.risk-chip:hover,
.table-row:hover,
.table-row.is-selected {
  transform: translateY(-2px);
  background: var(--clay);
}

.risk-chip strong {
  font-size: 1.45rem;
  line-height: 1;
}

.risk-chip.watch,
.risk-text.watch {
  color: var(--amber);
}

.risk-chip.conflict,
.risk-text.conflict {
  color: var(--red);
}

.risk-chip.clear,
.risk-text.clear {
  color: var(--green);
}

.empty-lane {
  position: relative;
  z-index: 1;
  opacity: 0.62;
}

.status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.table-zone,
.inspector,
.timeline,
.workflow-grid,
.team-grid {
  border: 3px solid var(--ink);
}

.request-table {
  display: grid;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) minmax(110px, 0.9fr) minmax(100px, 0.8fr) minmax(100px, 0.7fr) 72px;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 13px 16px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  transition: transform 160ms ease, background-color 160ms ease;
}

.table-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-row strong,
.table-row small {
  display: block;
}

.table-head {
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(154, 140, 152, 0.18);
}

.inspector {
  position: sticky;
  top: 24px;
  padding: 18px;
}

.inspector h2 {
  margin-top: 8px;
  font-size: 1.7rem;
}

.inspector dl {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 18px 0 0;
}

.inspector dt {
  color: var(--muted);
  font-weight: 800;
}

.inspector dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
}

.timeline-item {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-bottom: 2px solid var(--ink);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-item time {
  font-weight: 800;
}

.timeline-item p {
  margin-bottom: 8px;
}

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

.workflow-step,
.member {
  min-width: 0;
  padding: 18px;
  border-right: 2px solid var(--ink);
}

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

.bar {
  height: 10px;
  margin: 16px 0;
  background: rgba(26, 26, 46, 0.14);
}

.bar span {
  display: block;
  height: 100%;
  background: var(--ink);
}

.workflow-step footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.member {
  display: grid;
  align-content: space-between;
  min-height: 210px;
}

.member strong {
  font-size: 2.4rem;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
}

dialog::backdrop {
  background: rgba(26, 26, 46, 0.48);
}

.dialog-form {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.dialog-form label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.dialog-form textarea {
  min-height: 130px;
  padding: 10px;
  resize: vertical;
}

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

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

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

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 16px;
  }

  .rail-status {
    margin-top: 16px;
  }

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

  .inspector {
    position: static;
  }
}

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

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

  .toolbar {
    justify-content: start;
  }

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

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

  .metric:last-child,
  .lane:last-child,
  .workflow-step:last-child,
  .member:last-child {
    border-bottom: 0;
  }

  .table-row {
    grid-template-columns: 1fr 82px;
  }

  .table-row span:nth-child(2),
  .table-row span:nth-child(3) {
    display: none;
  }

  .table-head {
    display: none;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .tabs {
    grid-template-columns: 1fr 1fr;
  }

  .brand {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

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

  .search-box {
    width: 100%;
  }

  .icon-button,
  .primary-button,
  .dialog-actions button {
    width: 100%;
  }
}
