@charset "UTF-8";

:root {
  --ink: #2b2d42;
  --paper: #edf2f4;
  --line: #8d99ae;
  --danger: #ef233c;
  --white: #ffffff;
  --amber: #f2c14e;
  --green: #1b998b;
  --shadow: 0 22px 55px rgba(43, 45, 66, 0.16);
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  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(43, 45, 66, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(43, 45, 66, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
  font-family: var(--sans);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 18px 12px;
  color: var(--paper);
  background: var(--ink);
  border-right: 4px solid var(--danger);
}

.brand {
  display: grid;
  gap: 8px;
  place-items: center;
  color: var(--paper);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.05;
  text-transform: uppercase;
}

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

.rail-nav {
  display: grid;
  gap: 10px;
}

.rail-btn {
  width: 52px;
  height: 44px;
  border: 1px solid rgba(237, 242, 244, 0.22);
  border-radius: 8px;
  color: var(--paper);
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.rail-btn:hover,
.rail-btn.is-active {
  color: var(--ink);
  background: var(--paper);
  transform: translateX(3px);
}

.rail-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(237, 242, 244, 0.78);
  font-family: var(--mono);
  font-size: 11px;
}

.signal-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(27, 153, 139, 0.18);
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 0 18px;
}

.mono-label {
  margin: 0 0 7px;
  color: #626d82;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  max-width: 780px;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 0.98;
}

h2 {
  font-size: 22px;
  line-height: 1.15;
}

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

.search-box {
  display: grid;
  gap: 6px;
  color: #626d82;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.search-box input {
  width: min(35vw, 330px);
  min-width: 210px;
  min-height: 42px;
  border: 1px solid rgba(43, 45, 66, 0.18);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

.search-box input:focus {
  border-color: var(--danger);
}

.primary-btn,
.action-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--paper);
  background: var(--ink);
  font-weight: 750;
}

.primary-btn.large {
  min-height: 54px;
  justify-self: start;
}

.alert-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 16px;
  padding: 9px 13px;
  color: var(--ink);
  background: rgba(141, 153, 174, 0.16);
  border-left: 6px solid var(--line);
  font-size: 14px;
}

.alert-strip.RISK,
.alert-strip.ERR {
  border-left-color: var(--danger);
  background: rgba(239, 35, 60, 0.1);
}

.alert-strip.OK {
  border-left-color: var(--green);
  background: rgba(27, 153, 139, 0.1);
}

.alert-code {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.screen {
  display: none;
  animation: screenIn 220ms ease both;
}

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

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

.canvas-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.map-canvas,
.inspector,
.timeline-panel,
.bottleneck-panel,
.import-panel,
.public-status {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(43, 45, 66, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.map-canvas {
  min-height: 660px;
  overflow: hidden;
}

.canvas-head,
.inspector-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid rgba(43, 45, 66, 0.12);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.filter-chip {
  min-height: 34px;
  border: 1px solid rgba(43, 45, 66, 0.18);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
}

.filter-chip.is-active,
.filter-chip:hover {
  color: var(--paper);
  background: var(--danger);
  border-color: var(--danger);
}

.stage-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 0;
  min-height: 594px;
  background:
    linear-gradient(90deg, rgba(43, 45, 66, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(43, 45, 66, 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
}

.stage-lane {
  min-width: 0;
  border-right: 1px solid rgba(43, 45, 66, 0.14);
}

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

.stage-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 12px;
  color: var(--paper);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.stage-lane-head strong {
  color: var(--amber);
}

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

.task-row {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 126px;
  border: 1px solid rgba(43, 45, 66, 0.16);
  border-left: 5px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.task-row:hover,
.task-row.is-selected {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(43, 45, 66, 0.14);
  border-color: var(--ink);
}

.task-row.status-blocked,
.task-row.status-at_risk {
  border-left-color: var(--danger);
}

.task-row.status-done {
  border-left-color: var(--green);
}

.task-zone,
.task-meta {
  color: #667086;
  font-family: var(--mono);
  font-size: 11px;
}

.task-row strong {
  font-size: 15px;
  line-height: 1.25;
}

.task-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.risk-bar {
  height: 5px;
  overflow: hidden;
  background: rgba(141, 153, 174, 0.22);
  border-radius: 999px;
}

.risk-bar i {
  display: block;
  height: 100%;
  background: var(--danger);
}

.empty-lane {
  min-height: 70px;
  display: grid;
  place-items: center;
  color: #667086;
  border: 1px dashed rgba(43, 45, 66, 0.2);
  border-radius: 8px;
  font-size: 13px;
}

.inspector {
  min-height: 660px;
  display: flex;
  flex-direction: column;
}

.selected-details {
  padding: 18px;
}

.selected-details dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.selected-details dl div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(43, 45, 66, 0.1);
}

.selected-details dt {
  color: #667086;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.selected-details dd {
  margin: 0;
  font-weight: 700;
}

.note {
  margin: 18px 0 0;
  padding: 14px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 8px;
  line-height: 1.45;
}

.action-stack {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 18px;
}

.action-btn.danger {
  background: var(--danger);
}

.action-btn.quiet {
  color: var(--ink);
  background: rgba(141, 153, 174, 0.22);
}

.analytics-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.metric-board {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-tile {
  min-height: 132px;
  display: grid;
  align-content: space-between;
  padding: 16px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 8px;
}

.metric-tile span {
  color: rgba(237, 242, 244, 0.72);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.metric-tile strong {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 0.9;
}

.metric-retention {
  background: var(--danger);
}

.metric-load {
  background: #344e41;
}

.metric-blocked {
  background: #6d597a;
}

.metric-done {
  background: var(--line);
}

.event-list,
.bottleneck-list,
.public-status-list {
  display: grid;
  gap: 0;
  padding: 0 18px 18px;
}

.event-row,
.bottleneck-row,
.public-row {
  display: grid;
  gap: 5px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(43, 45, 66, 0.12);
}

.event-row time,
.event-row span,
.bottleneck-row span,
.public-row span {
  color: #667086;
  font-family: var(--mono);
  font-size: 11px;
}

.bottleneck-row p {
  margin: 0;
  color: #4f596d;
}

.import-panel,
.public-status {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.import-panel p {
  max-width: 680px;
  margin: 10px 0 0;
  color: #4f596d;
  line-height: 1.5;
}

.import-log {
  min-height: 170px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 8px;
  font-family: var(--mono);
  white-space: pre-wrap;
}

.public-row {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 280px) 64px;
  align-items: center;
  gap: 18px;
}

.public-meter {
  height: 9px;
  overflow: hidden;
  background: rgba(141, 153, 174, 0.25);
  border-radius: 999px;
}

.public-meter i {
  display: block;
  height: 100%;
  background: var(--green);
}

.public-row b {
  text-align: right;
}

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

  .canvas-grid,
  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .stage-map {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
  }

  .inspector,
  .map-canvas {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .side-rail {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 4px solid var(--danger);
  }

  .brand {
    grid-auto-flow: column;
  }

  .rail-nav {
    display: flex;
    overflow-x: auto;
  }

  .rail-foot {
    display: none;
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .top-actions,
  .canvas-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .metric-board {
    grid-template-columns: 1fr 1fr;
  }

  .public-row,
  .selected-details dl div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .metric-board {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 32px;
  }
}
