:root {
  --ink: #102a43;
  --paper: #f5f7fa;
  --red: #d64545;
  --teal: #56a3a6;
  --line: rgba(16, 42, 67, 0.14);
  --muted: #66788a;
  --drawer: #ffffff;
  --shadow: 0 18px 45px rgba(16, 42, 67, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: var(--ink);
  color: var(--paper);
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.brand small,
.metric small,
.request-row small,
.timeline-item small {
  color: var(--muted);
  line-height: 1.45;
}

.side-rail .brand small,
.side-rail .mono {
  color: rgba(245, 247, 250, 0.64);
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-left: 3px solid transparent;
  padding: 10px 12px;
  background: transparent;
  color: rgba(245, 247, 250, 0.76);
  text-align: left;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0;
}

.tab.is-active {
  border-left-color: var(--teal);
  background: rgba(245, 247, 250, 0.08);
  color: #fff;
}

.rail-status {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(245, 247, 250, 0.16);
}

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

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow,
.mono {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}

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

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

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.1;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.15;
}

p {
  line-height: 1.7;
}

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

.search-box {
  display: grid;
  gap: 5px;
}

.search-box input {
  width: min(260px, 58vw);
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline-color: var(--teal);
}

.primary-button,
.icon-button,
.dialog-actions button {
  min-height: 40px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
}

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

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #fff;
  margin-bottom: 18px;
}

.metric {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

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

.metric strong {
  display: block;
  margin: 8px 0 2px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.metric-accent strong {
  color: var(--teal);
}

.metric-alert strong {
  color: var(--red);
}

.view {
  display: none;
}

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

.board-wrap,
.table-zone,
.inspector,
.workflow-step,
.team-member,
.timeline-item,
dialog {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.board-wrap {
  padding: 18px;
  margin-bottom: 18px;
}

.board-head,
.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.board-head p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.lane {
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 0;
  padding: 15px;
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, filter 160ms ease;
}

.lane:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.tile-0 { background: #ffffff; }
.tile-1 { background: #e7f2f2; }
.tile-2 { background: #fdeaea; }
.tile-3 { background: #dfe8ef; }

.lane span,
.lane small {
  position: relative;
  z-index: 1;
}

.lane strong {
  position: relative;
  z-index: 1;
  font-size: 52px;
  line-height: 0.9;
}

.lane i,
.team-member i {
  display: block;
  width: 100%;
  height: 5px;
  background: rgba(16, 42, 67, 0.12);
}

.lane i::before,
.team-member i::before {
  content: "";
  display: block;
  width: var(--fill);
  height: 100%;
  background: var(--teal);
}

.status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.table-zone,
.inspector {
  padding: 18px;
}

.request-table {
  display: grid;
  gap: 8px;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 70px 96px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease;
}

.request-row:hover,
.request-row.is-selected {
  border-color: var(--teal);
  transform: translateX(2px);
}

.row-main {
  min-width: 0;
}

.row-main strong,
.row-main small {
  display: block;
  overflow-wrap: anywhere;
}

.row-badge,
.row-score,
.row-risk {
  justify-self: start;
  padding: 6px 8px;
  background: #f2f5f7;
  font-size: 13px;
  white-space: nowrap;
}

.row-score {
  background: #e7f2f2;
}

.risk-incident {
  background: var(--red);
  color: #fff;
}

.risk-watch {
  background: #fff1d6;
}

.risk-clear {
  background: #e7f2f2;
}

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

.inspector h2 {
  margin-top: 8px;
}

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

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

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

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
}

.dot {
  width: 13px;
  height: 13px;
  margin-top: 3px;
  background: var(--teal);
}

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

.workflow-step,
.team-member {
  min-height: 190px;
  padding: 18px;
}

.step-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 18px;
}

.team-member {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.team-member strong {
  font-size: 36px;
}

.empty {
  padding: 22px;
  border: 1px dashed var(--line);
  color: var(--muted);
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border-radius: 0;
  padding: 0;
}

dialog::backdrop {
  background: rgba(16, 42, 67, 0.45);
}

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

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

.dialog-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  padding: 10px;
}

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

.dialog-actions button:first-child {
  background: #fff;
  color: var(--ink);
}

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

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

  .side-rail {
    position: relative;
    height: auto;
  }

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

  .tab {
    text-align: center;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .tab.is-active {
    border-bottom-color: var(--teal);
  }

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

  .metric-strip,
  .lane-board,
  .workflow-grid,
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .inspector {
    position: static;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 16px;
  }

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

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .request-row {
    grid-template-columns: 1fr 1fr;
  }

  .row-main {
    grid-column: 1 / -1;
  }

  .toolbar {
    width: 100%;
  }

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

