:root {
  color-scheme: dark;
  --bg: #0a0d13;
  --surface: #12161f;
  --surface-2: #1a2029;
  --line: #262d3a;
  --line-soft: #1a202b;
  --text: #d6deea;
  --muted: #7c8899;
  --dim: #55606f;
  --green: #35c46b;
  --red: #e0575f;
  --amber: #e0a53c;
  --cyan: #40c0d0;
  --accent: #40c0d0;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(1100px 520px at 82% -12%, rgba(64, 192, 208, 0.06), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(53, 196, 107, 0.04), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-width: 0;
  cursor: pointer;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}

.shell {
  width: 100%;
  margin: 0 auto;
  padding: 20px clamp(12px, 1.5vw, 24px) 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}

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

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
}

.subline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.state-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.state-pill,
.safety-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
}

.state-pill.ready,
.safety-pill.clear {
  border-color: rgba(47, 192, 111, 0.45);
  color: #a7f0c6;
}

.state-pill.blocked,
.safety-pill.blocked {
  border-color: rgba(224, 90, 99, 0.55);
  color: #ffb8bf;
}

.state-pill.candidate {
  border-color: rgba(225, 174, 72, 0.55);
  color: #ffd991;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.area {
  min-width: 0;
}

.area-main,
.area-wide {
  grid-column: 1;
}

.area-side {
  grid-column: 2;
}

.area-full {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  margin-bottom: 10px;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(430px, 1fr) minmax(300px, 0.62fr);
  grid-template-areas:
    "physical routes events";
  gap: clamp(12px, 1.2vw, 18px);
  align-items: start;
}

.work-pane {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 14px;
  background: #202124;
}

.physical-pane {
  grid-area: physical;
  container-type: inline-size;
}

.route-pane {
  grid-area: routes;
  display: flex;
  max-height: calc(100vh - 112px);
  flex-direction: column;
  overflow: hidden;
}

.external-pane {
  grid-area: events;
  position: sticky;
  top: 16px;
}

body[data-dashboard-view="routes"] .ops-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "routes";
}

body[data-dashboard-view="routes"] .route-pane {
  max-height: none;
}

body[data-dashboard-view="routes"] .route-pane .route-log-table {
  max-height: min(66vh, 720px);
}

body[data-dashboard-view="routes"] .physical-pane,
body[data-dashboard-view="routes"] .external-pane {
  display: none;
}

body[data-dashboard-view="site"] .route-pane {
  display: none;
}

body[data-dashboard-view="site"] .ops-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "events"
    "physical";
}

body[data-dashboard-view="site"] .external-pane {
  position: static;
}

body[data-dashboard-view="site"] .physical-grid {
  grid-template-columns: minmax(440px, 1.1fr) repeat(2, minmax(240px, 0.75fr));
  align-items: start;
}

body[data-dashboard-view="site"] .physical-grid .device-block-wide {
  grid-column: auto;
  grid-row: span 2;
}

body[data-dashboard-view="site"] .barrier-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-dashboard-view="site"] .barrier-row {
  grid-template-columns: 6px minmax(54px, 0.46fr) 42px minmax(0, 1fr);
  grid-template-rows: minmax(48px, auto) 38px;
  min-height: 120px;
  align-items: center;
  padding: 0 10px 10px 0;
}

body[data-dashboard-view="site"] .barrier-accent {
  grid-row: 1 / -1;
}

body[data-dashboard-view="site"] .barrier-number {
  font-size: 20px;
}

body[data-dashboard-view="site"] .barrier-meta {
  padding: 10px 6px 6px;
}

body[data-dashboard-view="site"] .segmented {
  grid-column: 2 / -1;
  width: calc(100% - 2px);
  margin-right: 0;
}

body[data-dashboard-view="site"] .external-pane .event-board {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

body[data-dashboard-view="site"] .tool-drawer {
  display: none;
}

body[data-dashboard-view="site"][data-lab-enabled="true"] .tool-drawer {
  display: block;
}

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

.device-block {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
  background: #242528;
}

.device-block-wide {
  grid-column: 1 / -1;
}

.device-block .barrier-list,
.device-block .device-list {
  padding: 10px;
}

.tool-drawer,
.lab-drawer {
  margin-top: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #202225;
}

.lab-drawer {
  display: none;
}

body[data-lab-enabled="true"] .lab-drawer {
  display: block;
}

.tool-drawer summary,
.lab-drawer summary {
  min-height: 40px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.drawer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 12px;
  padding: 0 12px 12px;
}

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

.route-pane .route-tabs button:last-child {
  grid-column: 1 / -1;
}

.route-pane .trace-grid,
.route-pane .access-context-grid {
  grid-template-columns: 1fr;
}

.route-pane .route-trace-header,
.route-pane .route-trace-row {
  grid-template-columns:
    82px minmax(48px, 0.45fr) minmax(82px, 0.8fr) minmax(82px, 0.8fr)
    minmax(92px, 0.85fr) minmax(0, 1.6fr);
}

.route-pane .route-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.route-pane .route-log-table {
  max-height: min(52vh, 520px);
  overflow: auto;
}

.event-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.external-pane .event-board {
  grid-template-columns: 1fr;
}

.event-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 10px;
  background: var(--surface);
}

.event-card-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.normalize-btn {
  min-width: 86px;
}

.release-status {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 10px;
  background: #222327;
}

.release-status.clear {
  border-color: rgba(47, 192, 111, 0.38);
}

.release-status.blocked {
  border-color: rgba(224, 90, 99, 0.48);
}

.release-status.warning {
  border-color: rgba(225, 174, 72, 0.5);
}

.release-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.release-status-head strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.release-status-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.release-blocker-list {
  display: grid;
  gap: 8px;
}

.release-blocker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.68fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.03);
}

.release-blocker.blocked {
  border-color: rgba(224, 90, 99, 0.45);
}

.release-blocker.warning {
  border-color: rgba(225, 174, 72, 0.5);
}

.release-blocker-main {
  min-width: 0;
}

.release-blocker-main strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.release-blocker-main span,
.release-blocker-action {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.release-blocker-action {
  color: #d8e8f1;
}

.command-table {
  margin-top: 12px;
}

.lab-panel {
  padding: 0 12px 12px;
}

.ghost-btn,
.solid-btn,
.event-grid button,
.hss-event-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-2);
}

.ghost-btn {
  padding: 0 12px;
  color: var(--muted);
}

.solid-btn {
  padding: 0 14px;
  border-color: rgba(79, 180, 200, 0.55);
  background: #315765;
}

.barrier-list {
  display: grid;
  gap: 10px;
}

.barrier-row {
  display: grid;
  grid-template-columns: 6px 54px 42px minmax(0, 1fr) minmax(150px, auto);
  align-items: center;
  min-height: 64px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.barrier-accent {
  align-self: stretch;
  background: var(--line);
}

.barrier-row.open .barrier-accent {
  background: var(--green);
}

.barrier-row.closed .barrier-accent {
  background: var(--red);
}

.barrier-row.hold .barrier-accent {
  background: var(--amber);
}

.barrier-number {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-right: 1px solid var(--line);
  color: #e8f5ff;
  font-size: 18px;
  font-weight: 700;
}

.barrier-icon {
  position: relative;
  width: 30px;
  height: 36px;
  margin-left: 8px;
}

.barrier-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 5px;
  width: 8px;
  height: 22px;
  border-radius: 2px 2px 0 0;
  background: #f4f6f7;
}

.barrier-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  width: 25px;
  height: 4px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    90deg,
    #f4f6f7 0,
    #f4f6f7 5px,
    #777 5px,
    #777 8px
  );
  transform-origin: left center;
}

.barrier-row.open .barrier-icon::after {
  transform: rotate(-28deg);
}

.barrier-row.closed .barrier-icon::after,
.barrier-row.hold .barrier-icon::after {
  transform: rotate(0deg);
}

.barrier-meta {
  min-width: 0;
  padding: 0 8px;
}

.barrier-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.barrier-status {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(46px, 1fr));
  width: min(190px, calc(100% - 8px));
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button {
  min-width: 0;
  height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active-open {
  background: rgba(47, 192, 111, 0.28);
  color: #e8fff1;
}

.segmented button.active-close {
  background: rgba(224, 90, 99, 0.3);
  color: #ffe9ec;
}

.segmented button.active-hold {
  background: rgba(225, 174, 72, 0.28);
  color: #fff0ca;
}

.sign-preview {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 0 16px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #111315;
  color: #ffd76d;
  font-size: 22px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.device-list {
  display: grid;
  gap: 10px;
}

.display-row,
.light-row,
.estop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
}

.display-name,
.light-name,
.estop-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.display-value,
.light-status,
.estop-status {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.display-update {
  margin-top: 5px;
  color: #808893;
  font-size: 11px;
}

.light-summary {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.light-lamp {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #45474c;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.light-lamp.red {
  border-color: rgba(224, 90, 99, 0.75);
  background: var(--red);
}

.light-lamp.orange {
  border-color: rgba(225, 174, 72, 0.75);
  background: var(--amber);
}

.light-lamp.green {
  border-color: rgba(47, 192, 111, 0.75);
  background: var(--green);
}

.light-lamp.off {
  background: #3c3e43;
}

.light-controls {
  display: grid;
  gap: 6px;
  width: min(240px, 100%);
}

.light-segment {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.light-color {
  grid-template-columns: repeat(4, minmax(38px, 1fr));
}

.light-sound {
  grid-template-columns: repeat(2, minmax(54px, 1fr));
}

.light-phase {
  grid-template-columns: repeat(2, minmax(54px, 1fr));
}

.light-segment button {
  min-width: 0;
  min-height: 30px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

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

.light-segment .active-red {
  background: rgba(224, 90, 99, 0.3);
  color: #ffe9ec;
}

.light-segment .active-orange {
  background: rgba(225, 174, 72, 0.28);
  color: #fff0ca;
}

.light-segment .active-green {
  background: rgba(47, 192, 111, 0.24);
  color: #e8fff1;
}

.light-segment .active-off,
.light-segment .active-sound {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.estop-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(54px, 1fr));
  gap: 6px;
}

.estop-actions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.estop-actions button.active-press {
  background: rgba(224, 90, 99, 0.3);
  color: #ffe9ec;
}

.estop-actions button.active-release {
  background: rgba(47, 192, 111, 0.22);
  color: #e8fff1;
}

.event-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.event-grid button {
  padding: 0 10px;
  color: var(--muted);
}

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

@container (max-width: 720px) {
  .physical-grid {
    grid-template-columns: 1fr;
  }
}

@container (max-width: 560px) {
  .light-row,
  .estop-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .light-controls,
  .estop-actions {
    width: 100%;
  }
}

@container (max-width: 500px) {
  body[data-dashboard-view="site"] .barrier-list,
  .barrier-list {
    grid-template-columns: 1fr;
  }

  .barrier-row {
    grid-template-columns: 6px 52px 38px minmax(0, 1fr);
    row-gap: 8px;
    padding-bottom: 10px;
  }

  .segmented {
    grid-column: 2 / -1;
    width: calc(100% - 8px);
  }
}

.hss-control-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(120px, 0.7fr) minmax(120px, 0.8fr) 68px 64px;
  gap: 8px;
  margin-bottom: 10px;
}

.hss-live-row {
  display: grid;
  grid-template-columns:
    minmax(120px, 1fr) 82px minmax(112px, 0.9fr) minmax(100px, 0.8fr)
    minmax(100px, 0.8fr) 78px 62px 88px;
  gap: 8px;
  margin-bottom: 10px;
}

.cam6-person-row {
  display: grid;
  grid-template-columns:
    minmax(150px, 1fr) minmax(150px, 1fr) 86px 58px 104px 104px
    minmax(152px, 0.8fr) minmax(144px, 0.8fr) minmax(96px, 0.6fr) minmax(96px, 0.6fr);
  gap: 8px;
  margin-bottom: 10px;
}

.hss-control-row input,
.hss-control-row select,
.hss-live-row input,
.cam6-person-row input {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #202124;
  color: var(--text);
}

.cam6-person-row .monitor-pill {
  justify-content: center;
  min-height: 36px;
}

.active-monitoring {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.monitor-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #222327;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.monitor-pill.ready {
  border-color: rgba(47, 192, 111, 0.45);
  color: #a7f0c6;
}

.monitor-pill.blocked {
  border-color: rgba(224, 90, 99, 0.55);
  color: #ffb8bf;
}

.monitor-pill.candidate {
  border-color: rgba(225, 174, 72, 0.55);
  color: #ffd991;
}

.access-context-panel {
  margin: 0 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
  background: #202225;
}

.mini-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #222327;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.access-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
}

.access-context-card {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  min-height: 156px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.access-context-accent {
  align-self: stretch;
  background: var(--amber);
}

.access-context-card.done .access-context-accent {
  background: var(--green);
}

.access-context-card.waiting .access-context-accent {
  background: var(--cyan);
}

.access-context-card.blocked .access-context-accent {
  background: var(--red);
}

.access-context-body {
  min-width: 0;
  padding: 10px 12px;
}

.access-context-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}

.access-context-title {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.access-context-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #dce7ef;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.access-context-gridline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.context-metric {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #1f2023;
}

.context-metric-label {
  color: #89939d;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.context-metric-value {
  margin-top: 3px;
  color: #edf5fa;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.access-context-next {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.access-context-next strong {
  color: #dff6ff;
}

.hss-diff-panel {
  margin: 0 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
  background: #202225;
}

.hss-diff-controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 88px minmax(180px, 0.8fr) 92px;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.hss-diff-controls input[type="text"],
.hss-diff-controls input[type="file"] {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #202124;
  color: var(--text);
}

.hss-diff-controls input[type="file"] {
  padding: 6px 10px;
  color: var(--muted);
}

.hss-diff-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.diff-stat {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
}

.diff-stat.wide {
  grid-column: span 2;
}

.diff-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.diff-stat strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
}

.hss-diff-flows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.diff-flow-card {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
}

.diff-flow-main,
.diff-flow-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.diff-flow-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.diff-flow-main span,
.diff-flow-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.hss-diff-rows {
  padding: 10px;
}

.diff-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}

.diff-row-head {
  min-height: 30px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.diff-row.match {
  border-left: 3px solid var(--green);
}

.diff-row.mismatch {
  border-left: 3px solid var(--red);
}

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

.diff-row strong {
  display: block;
  color: var(--text);
  font-weight: 700;
}

.diff-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.diff-row em {
  color: #ffb8bf;
  font-style: normal;
}

.hss-event-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.hss-event-grid button {
  padding: 0 8px;
  color: var(--muted);
}

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

.trace-table {
  min-width: 0;
}

.trace-title {
  min-height: 34px;
  padding: 9px 12px 0;
  background: #222327;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.trace-header,
.trace-row {
  display: grid;
  grid-template-columns: 82px 42px minmax(72px, 0.8fr) minmax(72px, 0.8fr) minmax(90px, 0.9fr) minmax(0, 1.45fr);
  gap: 8px;
  align-items: start;
  padding: 8px 12px;
}

.infra-trace-header,
.infra-trace-row {
  grid-template-columns: 82px 42px minmax(70px, 0.7fr) minmax(82px, 0.8fr) minmax(82px, 0.8fr) minmax(0, 1.5fr);
}

.trace-header {
  min-height: 34px;
  background: #222327;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trace-row {
  border-top: 1px solid var(--line-soft);
  color: #e8ecef;
  font-size: 12px;
}

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

.trace-payload {
  display: block;
  max-height: 8.4em;
  overflow: auto;
  overflow-wrap: anywhere;
  color: #d8e0e7;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.4;
  word-break: break-word;
}

.route-panel {
  margin-bottom: 12px;
}

.route-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.route-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.route-tabs button.active {
  border-color: rgba(79, 180, 200, 0.65);
  background: #315765;
  color: var(--text);
}

.route-log-table {
  min-width: 0;
}

.route-trace-header,
.route-trace-row {
  grid-template-columns:
    82px minmax(42px, 0.45fr) minmax(86px, 0.8fr) minmax(86px, 0.8fr)
    minmax(96px, 0.85fr) minmax(0, 1.6fr);
}

.direction-in {
  color: #a7f0c6;
}

.direction-out {
  color: #bfeaff;
}

.config-form,
.message-form {
  display: grid;
  gap: 8px;
}

.config-form {
  grid-template-columns: minmax(104px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr) 44px;
}

.message-form {
  grid-template-columns: minmax(160px, 0.9fr) 86px minmax(0, 1fr) 58px;
  margin-bottom: 10px;
}

.config-form input,
.config-form select,
.message-form input,
.message-form select {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #202124;
  color: var(--text);
}

.catalog-list {
  display: grid;
  gap: 8px;
}

.catalog-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface);
}

.catalog-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #dff6ff;
  font-weight: 800;
}

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

.catalog-message {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.catalog-target {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.catalog-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  gap: 6px;
  margin-left: 10px;
}

.catalog-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.log-table {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
}

.log-header,
.log-row {
  display: grid;
  grid-template-columns: 74px minmax(120px, 1fr) minmax(90px, 0.7fr) minmax(86px, 0.6fr);
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
}

.log-header {
  background: #222327;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.log-row {
  border-top: 1px solid var(--line-soft);
  color: #e8ecef;
  font-size: 13px;
}

.log-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-log {
  min-height: 42px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1460px) {
  .ops-grid {
    grid-template-columns: minmax(460px, 1fr) minmax(360px, 0.72fr);
    grid-template-areas:
      "physical events"
      "routes routes";
  }

  .route-pane {
    max-height: none;
  }

  .external-pane {
    position: static;
  }

  .external-pane .event-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .ops-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "physical"
      "routes"
      "events";
  }

  .route-pane {
    max-height: none;
  }

  .external-pane {
    position: static;
  }

  .external-pane .event-board,
  .route-pane .trace-grid {
    grid-template-columns: 1fr;
  }

  body[data-dashboard-view="site"] .ops-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "events"
      "physical";
  }

  body[data-dashboard-view="site"] .external-pane {
    position: static;
  }

  body[data-dashboard-view="routes"] .ops-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "routes";
  }

  body[data-dashboard-view="routes"] .physical-grid,
  body[data-dashboard-view="site"] .physical-grid {
    grid-template-columns: 1fr;
  }

  body[data-dashboard-view="routes"] .physical-grid .device-block-wide,
  body[data-dashboard-view="site"] .physical-grid .device-block-wide {
    grid-row: auto;
  }
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 620px);
    padding-top: 16px;
  }

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

  .state-strip {
    justify-content: flex-start;
  }

  .ops-grid,
  .physical-grid,
  .drawer-grid,
  .event-board {
    display: block;
  }

  body[data-dashboard-view="routes"] .ops-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "routes";
  }

  body[data-dashboard-view="site"] .ops-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "events"
      "physical";
  }

  .work-pane,
  .device-block,
  .event-card {
    margin-bottom: 12px;
  }

  .layout,
  .area-main,
  .area-side,
  .area-wide,
  .area-full {
    display: block;
  }

  .area {
    margin-bottom: 18px;
  }

  .barrier-row {
    grid-template-columns: 6px 62px 44px minmax(0, 1fr);
    row-gap: 8px;
    padding-bottom: 10px;
  }

  .segmented {
    grid-column: 2 / -1;
    width: calc(100% - 12px);
    margin-left: 0;
  }

  .light-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .release-blocker {
    grid-template-columns: 1fr;
  }

  .light-controls,
  .estop-actions {
    width: 100%;
    margin-left: 0;
  }

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

  .config-form,
  .message-form,
  .catalog-row,
  .hss-control-row,
  .hss-live-row,
  .cam6-person-row,
  .hss-diff-controls,
  .hss-diff-summary,
  .hss-diff-flows,
  .route-tabs,
  .trace-grid {
    grid-template-columns: 1fr;
  }

  .diff-stat.wide {
    grid-column: auto;
  }

  .diff-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .diff-row span:nth-child(3),
  .diff-row span:nth-child(4) {
    grid-column: 2;
  }

  .hss-event-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .access-context-grid,
  .access-context-gridline {
    grid-template-columns: 1fr;
  }

  .trace-header,
  .trace-row,
  .infra-trace-header,
  .infra-trace-row,
  .route-trace-header,
  .route-trace-row {
    grid-template-columns: 42px minmax(72px, 0.6fr) minmax(86px, 0.8fr) minmax(0, 1fr);
  }

  .trace-header span:nth-child(4),
  .trace-row span:nth-child(4),
  .route-trace-header span:nth-child(4),
  .route-trace-row span:nth-child(4) {
    display: none;
  }

  .catalog-actions {
    margin-left: 0;
  }
}

/* ============================================================
   Control-panel theme refinement
   팔레트/타이포/헤더/버튼만 조정 — 레이아웃 그리드는 그대로 유지.
   파일 끝 오버라이드 레이어(later-wins)라 기존 반응형/컨테이너쿼리 불변.
   ============================================================ */

/* 헤더를 보더가 있는 콘솔 바로 */
.topbar {
  margin-bottom: 18px;
  padding: 13px clamp(12px, 1.4vw, 18px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent), var(--surface);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

h1 {
  font-size: clamp(17px, 1.5vw, 21px);
  font-weight: 750;
  letter-spacing: -0.01em;
}

#zoneId,
#clock,
#profileMode {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

#profileMode {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* 섹션 타이틀 → 대문자 eyebrow + 액센트 마커 */
h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text);
}

.section-head h2 {
  position: relative;
  padding-left: 12px;
}

.section-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 13px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(64, 192, 208, 0.55);
}

/* 카드/패널 라운드 + 미세한 깊이감 */
.work-pane {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.24);
}

.work-pane,
.event-card,
.device-block,
.log-table,
.barrier-row,
.access-context-panel,
.access-context-card,
.release-status,
.tool-drawer,
.lab-drawer,
.route-tabs button,
.ghost-btn,
.solid-btn,
.event-grid button,
.hss-event-grid button,
.state-pill,
.safety-pill,
.monitor-pill,
.context-pill {
  border-radius: 9px;
}

/* 미니 헤더 / 테이블 헤더 → 대문자 캡션 */
.mini-section-head,
.trace-title,
.log-header,
.trace-header,
.event-card-title,
.diff-row-head {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
}

.event-card-title {
  color: var(--text);
}

/* 기본(green) + 보조 버튼 */
.solid-btn {
  border: 1px solid transparent;
  background: linear-gradient(180deg, #3ccd73, #2fb463);
  color: #06160c;
  font-weight: 750;
}

.solid-btn:hover {
  background: linear-gradient(180deg, #47d67e, #34bd69);
}

.ghost-btn:hover,
.event-grid button:hover,
.hss-event-grid button:hover,
.route-tabs button:hover,
.sequence-flow button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.route-tabs button.active {
  border-color: rgba(64, 192, 208, 0.7);
  background: rgba(64, 192, 208, 0.14);
  color: var(--text);
}

/* 상태 pill → 점 + 모노 */
.state-pill,
.safety-pill,
.monitor-pill {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.safety-pill.clear::before,
.safety-pill.blocked::before,
.state-pill.ready::before,
.state-pill.blocked::before,
.state-pill.candidate::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* 모노스페이스 데이터 셀 */
.barrier-status,
.barrier-number,
.display-value,
.display-update,
.context-metric-value,
.log-row,
.trace-row,
.catalog-number,
.diff-row {
  font-family: var(--mono);
}

/* 시퀀스 스텝 번호 배지 */
.sequence-flow button span {
  color: var(--accent);
  font-family: var(--mono);
}

/* pg/1.0 차량정보 조회 결과 */
.pg-info-result {
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #0d1119;
  color: #cfe9d8;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── 무엇이 문제인가 (모듈별 진단) ─────────────────────────────────────────
   운영/관제 담당이 보는 면이다. 심각도는 색으로, 담당 모듈은 글자로 구분한다
   (색만으로 구분하면 색각 이상에서 정보가 사라진다). */
.fault-pill {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 34rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid transparent;
}
.fault-pill.ok       { background: #10331f; color: #6ee7a8; border-color: #1c5c36; }
.fault-pill.degraded { background: #3a2f10; color: #fbcf5c; border-color: #6b551a; }
.fault-pill.blocked  { background: #3d1417; color: #ff8f96; border-color: #722126; }

.diagnosis-pane {
  margin: 0 0 1rem;
  padding: 0.9rem 1.1rem 1.1rem;
  background: #14181f;
  border: 1px solid #232a36;
  border-radius: 10px;
}
.diagnosis-count {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.diagnosis-count.ok       { background: #10331f; color: #6ee7a8; }
.diagnosis-count.degraded { background: #3a2f10; color: #fbcf5c; }
.diagnosis-count.blocked  { background: #3d1417; color: #ff8f96; }

.diagnosis-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 0.7rem;
  margin-top: 0.7rem;
}
.diagnosis-empty { color: #7c8798; font-size: 0.85rem; margin: 0.5rem 0 0; }

.diagnosis-card {
  position: relative;
  padding: 0.75rem 0.85rem 1.5rem;
  border-radius: 8px;
  background: #191e27;
  border-left: 3px solid #2f3846;
}
.diagnosis-card.blocked  { border-left-color: #d9434f; }
.diagnosis-card.degraded { border-left-color: #e0a92b; }
.diagnosis-card.info     { border-left-color: #3f7fbf; }

.diagnosis-card-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.diagnosis-sev {
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}
.diagnosis-sev.blocked  { background: #3d1417; color: #ff8f96; }
.diagnosis-sev.degraded { background: #3a2f10; color: #fbcf5c; }
.diagnosis-sev.info     { background: #16283a; color: #8fc4f5; }

.diagnosis-module { font-size: 0.85rem; font-weight: 700; color: #e6ebf2; }
.diagnosis-owner  { font-size: 0.74rem; color: #8b96a8; }
.diagnosis-owner::before { content: "· 담당 "; }

.diagnosis-summary { margin: 0 0 0.3rem; font-size: 0.86rem; color: #dfe5ee; line-height: 1.45; }
.diagnosis-detail  { margin: 0 0 0.35rem; font-size: 0.79rem; color: #93a0b2; line-height: 1.45; }
.diagnosis-action  { margin: 0; font-size: 0.8rem; color: #9fd0a8; line-height: 1.45; }
.diagnosis-action::before { content: "확인: "; color: #6f9c78; font-weight: 600; }

.diagnosis-code {
  position: absolute;
  right: 0.7rem;
  bottom: 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  color: #5b6677;
}

/* 로그의 벽시계 시각 컬럼. 시퀀스 clock(mock ms)과 다른 값이다. */
.trace-time {
  font-variant-numeric: tabular-nums;
  color: #9aa0a6;
  white-space: nowrap;
}

/* 장치 heartbeat 목업 토글. 연결/끊김을 눌러 health 를 만든다. */
.health-toggle { display: inline-flex; gap: 4px; margin-top: 6px; }
.health-toggle button {
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  border: 1px solid #3a3d44; background: #26282d; color: #9aa0a6; cursor: pointer;
}
.health-toggle button.active { background: #2f5d3a; border-color: #3f7a4c; color: #d6f5de; }
.health-toggle button[data-device-health="lost"].active { background: #6b2b2b; border-color: #8c3a3a; color: #ffd9d9; }

/* ── 한눈 요약 카드 ─────────────────────────────────────────────── */
.overview {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px; margin: 12px 0;
}
.ov-card {
  background: #1e2024; border: 1px solid #2c2f36; border-left: 3px solid #3a3d44;
  border-radius: 8px; padding: 10px 12px;
}
.ov-card.good { border-left-color: #3f7a4c; }
.ov-card.warn { border-left-color: #b08a2e; }
.ov-card.bad  { border-left-color: #a33b3b; }
.ov-label { font-size: 11px; color: #8b9096; letter-spacing: .3px; }
.ov-value { font-size: 20px; font-weight: 600; color: #e8eaed; margin-top: 2px; }
.ov-sub { font-size: 11px; color: #9aa0a6; margin-top: 3px; word-break: break-all; }

/* ── 입차 진행 띠 ──────────────────────────────────────────────── */
.progress-strip { display: flex; align-items: center; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.pstep { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #7e848b; }
.pstep.done { color: #d6f5de; }
.pdot { width: 9px; height: 9px; border-radius: 50%; background: #3a3d44; display: inline-block; }
.pstep.done .pdot { background: #4c9a63; }
.pline { flex: 1 1 20px; height: 1px; background: #2c2f36; min-width: 16px; }

/* ── 접이식 조작 패널 ──────────────────────────────────────────── */
.foldable { border: 1px solid #2c2f36; border-radius: 8px; background: #1a1c20; margin: 10px 0; }
.foldable > summary {
  cursor: pointer; padding: 10px 14px; font-weight: 600; color: #cfd3d8; list-style: none;
}
.foldable > summary::-webkit-details-marker { display: none; }
.foldable > summary::before { content: "▸ "; color: #7e848b; }
.foldable[open] > summary::before { content: "▾ "; }
.fold-hint { font-weight: 400; font-size: 11px; color: #7e848b; }
.foldable[open] .fold-hint { display: none; }

/* ── 연결 상태판 (접히지 않음) ─────────────────────────────────────── */
.conn-panel {
  background: #1a1c20; border: 1px solid #2c2f36; border-radius: 8px;
  padding: 10px 12px; margin: 10px 0;
}
.conn-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.conn-title { font-weight: 600; color: #cfd3d8; }
.conn-summary { font-weight: 700; font-size: 14px; padding: 2px 8px; border-radius: 4px; }
.conn-summary.good { background: #23402c; color: #b7e7c4; }
.conn-summary.bad { background: #452424; color: #ffc9c9; }
.conn-hint { font-size: 11px; color: #7e848b; }
.conn-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.conn-group { background: #16181c; border: 1px solid #262930; border-radius: 6px; padding: 8px; }
.conn-group-title { font-size: 11px; color: #9aa0a6; margin-bottom: 6px; display: flex; justify-content: space-between; }
.conn-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #a33b3b; flex: 0 0 auto; }
.conn-row.on .conn-dot { background: #4c9a63; }
.conn-name { flex: 1 1 auto; font-size: 12px; color: #cfd3d8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-actions { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.conn-actions button {
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  border: 1px solid #3a3d44; background: #26282d; color: #9aa0a6; cursor: pointer;
}
.conn-actions button.active { background: #2f5d3a; border-color: #3f7a4c; color: #d6f5de; }
.conn-actions button[data-device-health="lost"].active,
.conn-actions button[data-hss-health="lost"].active { background: #6b2b2b; border-color: #8c3a3a; color: #ffd9d9; }

/* ── 좌측 세션 + 본문 2단 배치 ─────────────────────────────────────── */
.cols { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 12px; align-items: start; }
.side {
  position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto;
}
.side .conn-panel { margin: 0; }
/* 사이드바에서는 그룹을 세로로 쌓는다 */
.side .conn-groups { grid-template-columns: 1fr; }
.side .conn-head { flex-direction: column; align-items: flex-start; gap: 4px; }
.side .conn-hint { display: none; }
.mainc { min-width: 0; }
@media (max-width: 1100px) {
  .cols { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .side .conn-groups { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

/* ── 차량 상태 조작판 ─────────────────────────────────────────────────
   사건 버튼이 아니라 차량의 상태를 바꾸는 판. 현재 상태가 한눈에 보여야
   지금 무엇을 시험하고 있는지 알 수 있다. */
.vehicle-state {
  margin: 12px 0 14px;
  padding: 12px 14px;
  border: 1px solid #2a3446;
  border-radius: 10px;
  background: #141a24;
}
.vehicle-state-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.vehicle-state-head strong { font-size: 14px; }
.vehicle-state-head span { display: block; color: #8b97a8; font-size: 11px; }
.vehicle-state-now {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #7fd1a8;
  white-space: nowrap;
}
.vs-grid { display: grid; gap: 8px; }
.vs-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vs-label {
  min-width: 148px;
  font-size: 12px;
  color: #c4ccd8;
}
.vs-label em {
  display: block;
  font-style: normal;
  font-size: 10px;
  color: #6d7889;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.vs-choices { display: flex; gap: 4px; flex-wrap: wrap; }
.vs-choices button,
.vs-inline button {
  padding: 5px 11px;
  font-size: 12px;
  border: 1px solid #2f3a4d;
  border-radius: 6px;
  background: #1b2230;
  color: #cfd6e2;
  cursor: pointer;
}
.vs-choices button:hover, .vs-inline button:hover { border-color: #4a5a75; }
.vs-choices button.active {
  background: #2b4a63;
  border-color: #4d84ad;
  color: #eaf3fb;
}
.vs-inline { display: flex; gap: 4px; align-items: center; }
.vs-inline input {
  width: 84px;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid #2f3a4d;
  border-radius: 6px;
  background: #10151d;
  color: #dfe6f0;
}

/* 진행 차단은 비상과 다른 색으로. 정상화로 푸는 것이 아니다. */
.release-group-title {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #8b97a8;
  margin: 2px 0 6px;
}
.release-blocker-list.progress-list { margin-top: 10px; }
.release-blocker.progress {
  border-color: #4a4326;
  background: #1e1b12;
}
.release-status.progress { border-color: #4a4326; }

/* 상위 응답 대기. 흐름이 상위에서 멈춰 있음을 메인 화면에서도 알린다. */
.upstream-pending {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid #3c4a2c;
  border-radius: 8px;
  background: #1a1f14;
}
.up-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.up-row strong { font-size: 13px; }
.up-row span { color: #9aa0a6; }
.up-row em { font-style: normal; color: #b9d99a; }
.up-row a { color: #8ab4f8; margin-left: auto; }

/* 화면 이동 링크. 서버가 그리는 /error · /theother 와 같은 모양을 쓴다. */
.sacnav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.sacnav a {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 5px;
  text-decoration: none;
  border: 1px solid #2f3a4d;
  background: #1b2230;
  color: #c4ccd8;
}
.sacnav a:hover { border-color: #4a5a75; }
.sacnav a.here { background: #2b4a63; border-color: #4d84ad; color: #eaf3fb; }
.sacnav .navlabel { font-size: 11px; color: #7e848b; margin-right: 4px; letter-spacing: 0.08em; }

/* Infra GW 경계 상태. 연결 상태판 아래에 붙는다. */
.gw-boundary {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #2a3446;
  border-radius: 8px;
  background: #12161f;
  font-size: 11px;
}
.gw-row { display: flex; align-items: center; gap: 6px; }
.gw-row strong { font-size: 12px; }
.gw-dot { width: 8px; height: 8px; border-radius: 50%; background: #6d7889; }
.gw-boundary.on .gw-dot { background: #4c9a63; }
.gw-boundary.err .gw-dot { background: #a33b3b; }
.gw-state { margin-left: auto; color: #9aa0a6; }
.gw-boundary.on .gw-state { color: #7fd1a8; }
.gw-boundary.err .gw-state { color: #ff9c9c; }
.gw-detail {
  margin-top: 3px;
  color: #7e848b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

/* 메시지 로그 내보내기. 지금 탭에 보이는 것을 그대로 파일로 받는다. */
.route-export { margin-left: auto; display: inline-flex; gap: 6px; }
.route-export a {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 5px;
  text-decoration: none;
  border: 1px solid #2f3a4d;
  background: #1b2230;
  color: #9fd0b4;
}
.route-export a:hover { border-color: #4a5a75; }

/* 로봇 상태 행. 차량 상태와 같은 판에 두되 경계를 준다. */
.vs-row.vs-robot { border-top: 1px dashed #26303f; padding-top: 8px; }
.vs-row.vs-robot:first-of-type { border-top: 0; }
