:root {
  --ink: #2b2d42;
  --paper: #edf2f4;
  --alert: #ef233c;
  --muted: #8d99ae;
  --line: rgba(43, 45, 66, 0.16);
  --surface: #ffffff;
  --soft: #dfe6ea;
  --good: #2f8f72;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

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

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 10px;
  background: var(--ink);
  color: var(--paper);
}

.brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  margin-bottom: 22px;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 11px;
  line-height: 1.1;
  text-transform: uppercase;
}

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

.rail-btn {
  width: 48px;
  height: 42px;
  border: 1px solid rgba(237, 242, 244, 0.22);
  border-radius: 8px;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  letter-spacing: 0;
  transition: background 160ms ease, transform 160ms ease;
}

.rail-btn:hover,
.rail-btn.active {
  background: var(--alert);
  transform: translateX(2px);
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.mono {
  margin: 0 0 6px;
  color: #646d7a;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  font-size: clamp(28px, 5vw, 58px);
  line-height: 0.95;
}

h2 {
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1;
}

h3 {
  font-size: 20px;
}

.status-chip {
  min-width: 170px;
  padding: 10px 12px;
  border-left: 4px solid var(--alert);
  background: var(--surface);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 12px;
  text-align: right;
}

.alert-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin: 18px 0;
  padding: 10px 12px;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

.alert-strip strong {
  color: #fff;
}

.alert-strip span:last-child {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pulse {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: var(--alert);
  animation: blink 1.4s infinite;
}

.pulse.calm {
  background: var(--good);
}

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.78); }
}

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

.screen.active {
  display: block;
}

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

.planner-head,
.split {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
}

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

.filters label {
  display: grid;
  gap: 5px;
  min-width: 160px;
  color: #5a6470;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.filters input,
.filters select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

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

.metric-row div {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
}

.metric-row span,
.status-board span {
  display: block;
  margin-bottom: 6px;
  color: #687282;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.metric-row strong {
  font-size: clamp(22px, 4vw, 36px);
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
}

.map-canvas {
  position: relative;
  min-height: 520px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(43,45,66,0.08) 1px, transparent 1px),
    linear-gradient(rgba(43,45,66,0.08) 1px, transparent 1px),
    var(--surface);
  background-size: 54px 54px;
  overflow: hidden;
}

.map-canvas::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 48%;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--alert) 0 16px, var(--muted) 16px 32px, transparent 32px 44px);
  opacity: 0.85;
}

.map-axis {
  position: absolute;
  z-index: 2;
  padding: 6px 8px;
  background: var(--ink);
  color: var(--paper);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.map-axis.top { top: 10px; left: 50%; transform: translateX(-50%); }
.map-axis.right { right: 10px; top: 50%; transform: translateY(-50%); }
.map-axis.bottom { bottom: 10px; left: 50%; transform: translateX(-50%); }
.map-axis.left { left: 10px; top: 50%; transform: translateY(-50%); }

.event-map {
  position: absolute;
  inset: 42px;
}

.event-node {
  position: absolute;
  width: min(210px, 32vw);
  min-height: 86px;
  border: 1px solid var(--line);
  border-left: 7px solid var(--muted);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(43, 45, 66, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.event-node:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(43, 45, 66, 0.13);
}

.event-node.danger {
  border-left-color: var(--alert);
}

.event-node.good {
  border-left-color: var(--good);
}

.event-node span,
.event-node em {
  display: block;
  color: #677180;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
}

.event-node strong {
  display: block;
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: #66707c;
}

.inspector,
.import-panel,
.public-status,
.timeline {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 18px;
}

.action-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.selected-event {
  padding: 12px;
  background: var(--paper);
  border-left: 6px solid var(--alert);
}

.selected-event span,
.selected-event small,
.action-item span,
.action-item small {
  display: block;
  color: #687282;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.selected-event strong,
.action-item strong {
  display: block;
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.action-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.action-item:hover {
  border-color: var(--alert);
}

.bars {
  display: grid;
  gap: 12px;
  min-width: min(720px, 100%);
  margin-top: 22px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) 54px;
  align-items: center;
  gap: 12px;
}

.bar-row span,
.bar-row strong {
  overflow-wrap: anywhere;
}

.bar-row div {
  height: 14px;
  background: var(--soft);
}

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

.timeline ol {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.timeline li {
  border-left: 6px solid var(--muted);
  padding-left: 12px;
}

.timeline li strong,
.timeline li span {
  display: block;
}

.timeline li span {
  color: #5f6875;
  margin-top: 4px;
}

.import-panel p {
  max-width: 680px;
  color: #5f6875;
}

.primary-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--alert);
  color: #fff;
  cursor: pointer;
}

pre {
  overflow: auto;
  margin-top: 18px;
  padding: 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  white-space: pre-wrap;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  background: var(--line);
  border: 1px solid var(--line);
}

.status-board div {
  min-width: 0;
  padding: 18px;
  background: var(--paper);
}

.status-board strong {
  font-size: clamp(22px, 4vw, 38px);
  overflow-wrap: anywhere;
}

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

  .rail {
    position: sticky;
    z-index: 4;
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .brand {
    grid-auto-flow: column;
    align-items: center;
    margin: 0 8px 0 0;
  }

  .ops-grid,
  .split {
    grid-template-columns: 1fr;
    display: grid;
  }

  .map-canvas {
    min-height: 500px;
  }

  .event-node {
    width: min(190px, 54vw);
  }
}

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

  .topbar,
  .planner-head {
    display: grid;
    align-items: start;
  }

  .status-chip {
    width: 100%;
    text-align: left;
  }

  .filters {
    justify-content: stretch;
  }

  .filters label {
    min-width: 100%;
  }

  .metric-row,
  .status-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-canvas {
    min-height: 560px;
  }

  .event-map {
    inset: 54px 20px;
  }

  .event-node {
    width: min(180px, 72vw);
  }

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

