:root {
  --bg: #000;
  --panel: #070c07;
  --panel-strong: #0b140b;
  --line: #1e4c1e;
  --text: #b8ffb8;
  --muted: #78d878;
  --warn: #ffd966;
  --err: #ff6666;
  --ok: #8fff8f;
  --accent: #4cffb0;
  --glow: 0 0 12px rgba(143, 255, 143, 0.35);
  --panel-width-left: 23%;
  --panel-width-center: 45%;
  --panel-width-right: 32%;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.38 "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
  text-shadow: 0 0 2px rgba(157, 255, 157, 0.3);
  background-image:
    radial-gradient(circle at top left, rgba(76, 255, 176, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(0, 32, 0, 0.25), transparent 40%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 3px);
}

.console {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* HEADER */
.console-head {
  border-bottom: 2px solid var(--ok);
  background: linear-gradient(180deg, #081108, var(--panel));
  padding: 10px 14px 8px;
  box-shadow: var(--glow);
  flex-shrink: 0;
}

.logo {
  margin: 0;
  font-size: 10px;
  line-height: 1.1;
  color: var(--ok);
  text-shadow: 0 0 8px var(--ok);
  letter-spacing: 1px;
  text-align: left;
}

.logo-sub {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.05;
  color: var(--accent);
  opacity: 0.85;
}

.head-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 11px;
}

.head-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1;
}

.timestamp,
.local-clock {
  color: var(--muted);
  padding: 2px 6px;
  border-left: 2px solid var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

.timestamp {
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.broadcast-indicator {
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 2px;
  transition: all 0.3s;
}

.broadcast-indicator.ok {
  color: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 6px rgba(125, 255, 125, 0.3);
}

.broadcast-indicator.warn {
  color: var(--warn);
  border-color: var(--warn);
}

.stability-indicator {
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 2px;
  transition: all 0.3s;
}

.stability-indicator.ok {
  color: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 6px rgba(125, 255, 125, 0.2);
}

.stability-indicator.warn {
  color: var(--warn);
  border-color: var(--warn);
}

.stability-indicator.crit {
  color: var(--err);
  border-color: var(--err);
  box-shadow: 0 0 6px rgba(255, 102, 102, 0.25);
}

.head-buttons {
  display: flex;
  gap: 6px;
}

.btn-refresh, .btn-reboot {
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  cursor: pointer;
  font: inherit;
  background: transparent;
  transition: all 0.2s;
}

.btn-refresh {
  color: var(--muted);
  border-color: var(--muted);
}

.btn-refresh:hover {
  color: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 6px rgba(125, 255, 125, 0.3);
}

.btn-refresh.refreshing {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-reboot {
  color: var(--err);
  border-color: var(--err);
}

.btn-reboot:hover {
  background: rgba(255, 100, 100, 0.1);
  box-shadow: 0 0 6px rgba(255, 100, 100, 0.3);
}

.btn-reboot:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* LAYOUT CONTAINER */
.layout-container {
  display: flex;
  flex: 1;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

.layout-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 12, 7, 0.95), rgba(4, 8, 4, 0.98));
  min-width: 200px;
  overflow: hidden;
}

.layout-panel:last-child {
  border-right: none;
}

.left-panel {
  flex: 0 0 var(--panel-width-left);
}

.center-panel {
  flex: 0 0 var(--panel-width-center);
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.resize-handle {
  width: 4px;
  background: var(--line);
  cursor: col-resize;
  transition: background 0.2s;
  flex-shrink: 0;
}

.resize-handle:hover {
  background: var(--ok);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(19, 51, 19, 0.45), transparent);
  flex-shrink: 0;
}

.panel-header h2 {
  margin: 0;
  font-size: 13px;
  color: var(--ok);
  letter-spacing: 1px;
  text-transform: uppercase;
  flex: 1;
}

.resize-hint {
  color: var(--muted);
  font-size: 10px;
  opacity: 0.5;
}

.broadcast-count {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(125, 255, 125, 0.2);
  border-radius: 2px;
  font-size: 11px;
  color: var(--ok);
  font-weight: bold;
}

/* PANEL CONTENT */
.panel-content {
  flex: 1;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

/* WINDOW DECK */
.window-deck {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(30, 76, 30, 0.7);
  background:
    linear-gradient(180deg, rgba(8, 18, 8, 0.85), rgba(3, 8, 3, 0.95)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 18px);
  overflow: hidden;
}

.desktop-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  min-height: 180px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 15, 8, 0.97), rgba(2, 5, 2, 0.97));
  box-shadow: 0 0 0 1px rgba(143, 255, 143, 0.08), 0 8px 18px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  resize: both;
}

.desktop-window.is-active {
  border-color: var(--ok);
  box-shadow: var(--glow), 0 8px 20px rgba(0, 0, 0, 0.55);
}

.win-memory {
  top: 10px;
  left: 10px;
  width: calc(50% - 16px);
  height: calc(48% - 14px);
}

.win-network {
  top: 10px;
  right: 10px;
  width: calc(50% - 16px);
  height: calc(48% - 14px);
}

.win-services {
  left: 10px;
  bottom: 10px;
  width: calc(36% - 16px);
  height: calc(52% - 20px);
}

.win-history {
  left: calc(36% + 8px);
  bottom: 10px;
  width: calc(64% - 16px);
  height: calc(25% - 8px);
}

.win-containers {
  right: 10px;
  bottom: calc(25% + 10px);
  width: calc(64% - 16px);
  height: calc(27% - 14px);
}

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(30, 76, 30, 0.55), rgba(10, 20, 10, 0.4));
  cursor: move;
  flex-shrink: 0;
}

.window-header h2 {
  margin: 0;
  font-size: 12px;
  color: var(--ok);
  letter-spacing: 1px;
}

.window-lock-btn {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font: inherit;
  padding: 2px 6px;
  cursor: pointer;
}

.window-lock-btn:hover {
  border-color: var(--ok);
  color: var(--ok);
}

.desktop-window.is-locked {
  resize: none;
}

.desktop-window.is-locked .window-header {
  cursor: default;
}

.desktop-window.is-locked .window-lock-btn {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(255, 217, 102, 0.1);
}

.window-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

/* STATUS TABLE */
.status-table-container {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.status-table tr {
  border-bottom: 1px solid rgba(19, 51, 19, 0.3);
  transition: background 0.15s;
}

.status-table tr:hover {
  background: rgba(19, 51, 19, 0.2);
}

.status-table td {
  padding: 4px 6px;
  text-align: left;
  word-break: break-word;
}

.status-table .key {
  color: var(--muted);
  width: 30%;
  font-weight: bold;
  white-space: nowrap;
}

.status-table .value {
  color: var(--text);
}

.status-table .loading {
  text-align: center;
  color: var(--muted);
}

.process-panel {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  max-height: none;
  resize: vertical;
  overflow: auto;
}

.process-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-bottom: 1px solid rgba(30, 76, 30, 0.75);
  background: rgba(6, 16, 6, 0.7);
}

.process-toolbar input,
.process-toolbar select {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(0, 0, 0, 0.45);
  font: inherit;
  padding: 3px 6px;
}

.process-toolbar input {
  flex: 1;
  min-width: 120px;
}

.process-count {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(125, 255, 125, 0.2);
  border-radius: 2px;
  font-size: 11px;
  color: var(--ok);
  font-weight: bold;
}

.process-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px;
  font-size: 11px;
}

.process-tree-root,
.process-tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.process-tree-children {
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px dashed rgba(120, 216, 120, 0.35);
}

.process-node {
  margin: 2px 0;
}

.process-line {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  border-left: 2px solid transparent;
}

.process-line:hover {
  background: rgba(19, 51, 19, 0.15);
  border-left-color: var(--line);
}

.process-line.match {
  background: rgba(76, 255, 176, 0.12);
  border-left-color: var(--accent);
}

.process-toggle {
  width: 18px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ok);
  font: inherit;
  line-height: 1;
  padding: 1px 0;
  cursor: pointer;
}

.process-toggle:disabled {
  opacity: 0.6;
  cursor: default;
}

.process-main {
  color: var(--ok);
  font-weight: bold;
  min-width: 72px;
}

.process-meta {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-empty {
  color: var(--muted);
  padding: 4px;
}

.expandable-row {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.expandable-row.expanded {
  background: rgba(19, 51, 19, 0.3);
}

.expand-toggle {
  display: inline-block;
  width: 10px;
  text-align: center;
  color: var(--ok);
  margin-right: 4px;
  transition: transform 0.2s;
}

.expandable-row.expanded .expand-toggle {
  transform: rotate(90deg);
}

.detail-row {
  display: none;
  background: rgba(0, 0, 0, 0.3);
  font-size: 11px;
  color: var(--muted);
}

.expandable-row.expanded + .detail-row {
  display: table-row;
}

.detail-row td {
  padding: 3px 6px 3px 20px;
  border-bottom: 1px solid rgba(19, 51, 19, 0.2);
}

/* MEMORY GRID */
.memory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  height: 100%;
}

.memory-card {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.memory-card h3 {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ok);
  letter-spacing: 1px;
}

.memory-card pre {
  margin: 0;
  flex: 1;
  overflow: auto;
  font-size: 11px;
  border: none;
  padding: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 2px solid var(--line);
}

/* LISTS */
.net-list, .service-list, .container-list, .module-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}

.net-item, .service-item, .container-item, .module-item {
  padding: 4px 6px;
  border-left: 2px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s;
  cursor: pointer;
}

.net-item:hover, .service-item:hover, .container-item:hover, .module-item:hover {
  border-left-color: var(--ok);
  background: rgba(19, 51, 19, 0.1);
}

.service-tree,
.service-group-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.service-group {
  border: 1px solid rgba(30, 76, 30, 0.35);
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.14);
}

.service-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  cursor: pointer;
  border-left: 2px solid var(--line);
  background: rgba(19, 51, 19, 0.2);
}

.service-group-head:hover {
  border-left-color: var(--ok);
}

.service-group-toggle {
  color: var(--ok);
  width: 12px;
  text-align: center;
}

.service-group-label {
  color: var(--ok);
  font-weight: bold;
  letter-spacing: 0.5px;
}

.service-group-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

.service-node-head {
  cursor: pointer;
}

.service-node-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-node-detail-wrap {
  border-left: 2px solid rgba(30, 76, 30, 0.6);
  margin-left: 10px;
  padding-left: 8px;
  padding-bottom: 6px;
}

.service-node-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  font-size: 10px;
  color: var(--muted);
  padding-top: 4px;
}

.item-status {
  display: inline-block;
  padding: 2px 4px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: bold;
}

.status-active {
  background: rgba(125, 255, 125, 0.2);
  color: var(--ok);
}

.status-inactive {
  background: rgba(255, 102, 102, 0.2);
  color: var(--err);
}

.status-up {
  background: rgba(125, 255, 125, 0.2);
  color: var(--ok);
}

.status-down {
  background: rgba(255, 102, 102, 0.2);
  color: var(--err);
}

.containers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  height: 100%;
}

.container-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.container-section h3 {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ok);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.container-section > div {
  flex: 1;
  overflow: auto;
}

.history-scoring-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  height: 100%;
}

.history-card {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.history-timeline-card {
  grid-column: 1 / span 2;
}

.history-card h3 {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ok);
}

.history-card pre {
  margin: 0;
  flex: 1;
  overflow: auto;
  font-size: 11px;
  border: none;
  padding: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 2px solid var(--line);
}

.panel-content-broadcast {
  padding-top: 6px;
}

.stream-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 6px;
  font-size: 10px;
  color: var(--muted);
}

.stream-mode,
.stream-meta {
  padding: 2px 6px;
  border: 1px solid rgba(120, 216, 120, 0.25);
  background: rgba(0, 0, 0, 0.2);
}

.stream-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  flex-wrap: wrap;
}

.stream-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
}

.stream-control input,
.stream-control select {
  width: 72px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  font: inherit;
}

.broadcast-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  flex: 1;
  font-size: 11px;
  min-height: 0;
}

.broadcast-item {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(19, 51, 19, 0.3);
  border-left: 2px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.broadcast-item:hover {
  border-left-color: var(--ok);
  background: rgba(19, 51, 19, 0.15);
}

.broadcast-item.action {
  border-left-color: var(--warn);
  background: rgba(255, 217, 102, 0.08);
}

.broadcast-item.action:hover {
  background: rgba(255, 217, 102, 0.12);
}

.broadcast-timestamp {
  color: var(--muted);
  font-size: 10px;
}

.broadcast-source {
  color: var(--ok);
  font-weight: bold;
  font-size: 11px;
}

.broadcast-msg {
  color: var(--text);
  word-break: break-word;
  line-height: 1.3;
}

.broadcast-group {
  padding: 0;
  border-bottom: 1px solid rgba(19, 51, 19, 0.35);
}

.broadcast-group-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(19, 51, 19, 0.15);
  border-left: 2px solid var(--accent);
  color: var(--accent);
  font-weight: bold;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.broadcast-group-head:hover {
  background: rgba(19, 51, 19, 0.25);
}

.broadcast-group-toggle {
  display: inline-block;
  width: 12px;
  text-align: center;
  color: var(--accent);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.broadcast-group.expanded .broadcast-group-toggle {
  transform: rotate(90deg);
}

.broadcast-group-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.broadcast-group-count {
  color: var(--muted);
  flex-shrink: 0;
}

.broadcast-group-items {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.broadcast-group.collapsed .broadcast-group-items {
  display: none;
}

/* DETAIL OVERLAY */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.detail-overlay[hidden],
.offline-overlay[hidden],
.reset-overlay[hidden] {
  display: none !important;
}

.reset-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.88);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.reset-panel {
  width: min(92vw, 560px);
  border: 2px solid var(--warn);
  background: linear-gradient(180deg, rgba(24, 24, 4, 0.95), rgba(8, 8, 2, 0.97));
  padding: 14px;
  box-shadow: 0 0 18px rgba(255, 217, 102, 0.25);
}

.reset-panel h2 {
  margin: 0 0 8px;
  color: var(--warn);
}

.reset-panel p {
  margin: 0 0 8px;
}

.reset-panel ul {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--muted);
}

.reset-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.detail-panel {
  background: var(--panel);
  border: 2px solid var(--ok);
  border-radius: 4px;
  padding: 16px;
  max-width: 600px;
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--glow), 0 0 20px rgba(0, 0, 0, 0.8);
  position: relative;
}

.detail-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: 1px solid var(--warn);
  color: var(--warn);
  width: 24px;
  height: 24px;
  cursor: pointer;
  font: inherit;
  border-radius: 2px;
  transition: all 0.2s;
}

.detail-close:hover {
  background: rgba(255, 217, 102, 0.1);
  box-shadow: 0 0 6px rgba(255, 217, 102, 0.3);
}

#detailContent {
  width: 100%;
  word-break: break-word;
  line-height: 1.6;
}

#detailContent h3 {
  margin-top: 0;
  color: var(--ok);
  font-size: 14px;
  letter-spacing: 1px;
}

.detail-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
  justify-content: space-between;
}

.detail-tab {
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.detail-tab.active {
  color: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 6px rgba(143, 255, 143, 0.2);
}

.detail-copy-btn {
  padding: 4px 10px;
  border: 1px solid var(--accent);
  background: rgba(76, 255, 176, 0.1);
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  transition: all 0.2s;
}

.detail-copy-btn:hover {
  background: rgba(76, 255, 176, 0.25);
  box-shadow: 0 0 6px rgba(76, 255, 176, 0.3);
}

.detail-view {
  display: none;
}

.detail-view.active {
  display: block;
}

#detailContent pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-left: 2px solid var(--line);
  overflow: auto;
  max-height: 40vh;
  font-size: 11px;
  margin: 0;
}

#detailContent .detail-kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  margin: 4px 0;
  padding: 4px;
  border-bottom: 1px solid rgba(19, 51, 19, 0.2);
}

#detailContent .detail-kv dt {
  color: var(--muted);
  font-weight: bold;
  white-space: nowrap;
}

#detailContent .detail-kv dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

/* OFFLINE OVERLAY */
.offline-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgba(0, 0, 0, 0.98);
  color: var(--err);
  z-index: 1000;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.offline-overlay h1 {
  margin: 0 0 12px;
  font-size: 32px;
  text-shadow: 0 0 12px var(--err);
  animation: pulse-err 1s infinite;
}

.offline-overlay p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

@keyframes pulse-err {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ok);
}

/* RESPONSIVE for 13" (1024×768) to 15" (1366×768+) */
@media (max-width: 1200px) {
  :root {
    --panel-width-left: 21%;
    --panel-width-center: 43%;
    --panel-width-right: 36%;
  }

  body { font-size: 12px; }
  .logo,
  .logo-sub { font-size: 9px; }
  .panel-header h2 { font-size: 12px; }
  .status-table { font-size: 11px; }
  .broadcast-list { font-size: 10px; }
}

@media (max-width: 1024px) {
  html,
  body {
    overflow: auto;
    height: auto;
    min-height: 100%;
  }

  .console {
    height: auto;
    min-height: 100dvh;
  }

  .console-head {
    padding: 8px;
  }

  .head-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .head-info {
    gap: 6px;
  }

  .head-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .btn-refresh,
  .btn-reboot {
    min-height: 36px;
  }

  .layout-container {
    flex-direction: column;
    overflow: visible;
    min-height: 0;
  }

  .layout-panel,
  .left-panel,
  .center-panel,
  .right-panel {
    flex: none;
    width: 100%;
    min-height: 0;
    overflow: visible;
  }

  .left-panel {
    height: auto;
    min-height: 32vh;
  }

  .center-panel {
    height: auto;
    min-height: 44vh;
    padding: 6px;
  }

  .right-panel {
    height: auto;
    min-height: 34vh;
  }

  .resize-handle {
    display: none;
  }

  .window-deck {
    min-height: 0;
    overflow: visible;
  }

  .desktop-window {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    resize: both;
    margin-bottom: 10px;
    min-width: 0;
    min-height: 160px;
  }

  .window-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .window-body {
    max-height: none;
  }

  .status-table-container,
  .process-panel,
  .broadcast-list {
    max-height: none;
  }

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

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

  .history-scoring-grid {
    grid-template-columns: 1fr;
  }

  .history-timeline-card {
    grid-column: 1;
  }

  .process-toolbar {
    flex-wrap: wrap;
  }

  .process-toolbar input,
  .process-toolbar select {
    min-height: 34px;
  }

  .stream-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .stream-control {
    width: 100%;
    justify-content: space-between;
  }

  .stream-control input,
  .stream-control select {
    width: 100%;
    min-height: 34px;
  }

  .stream-controls .btn-refresh {
    width: 100%;
    min-height: 34px;
  }
}

@media (max-width: 640px) {
  .logo,
  .logo-sub {
    display: none;
  }

  .console-head {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .head-info {
    font-size: 10px;
  }

  .timestamp,
  .local-clock,
  .broadcast-indicator,
  .stability-indicator {
    width: 100%;
  }

  .head-buttons {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .window-header {
    padding: 6px;
  }

  .panel-header h2,
  .window-header h2 {
    font-size: 11px;
  }

  .window-lock-btn {
    min-width: 40px;
    min-height: 28px;
  }

  .window-body {
    padding: 6px;
    max-height: none;
  }

  .status-table td {
    padding: 5px;
  }

  .status-table .key {
    width: 40%;
  }

  .process-tree,
  .broadcast-list {
    font-size: 10px;
  }

  .detail-panel,
  .reset-panel {
    width: min(96vw, 560px);
    max-height: 90vh;
  }

  .stream-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  body {
    font-size: 12px;
  }

  .panel-content,
  .window-body {
    padding: 5px;
  }

  .memory-card pre,
  .history-card pre {
    font-size: 10px;
  }
}

@media (max-height: 768px) {
  .head-controls {
    margin-top: 2px;
    gap: 8px;
  }

  .logo,
  .logo-sub { font-size: 8px; }
  .panel-header h2 { font-size: 11px; }
}

.expandable-row {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
