/* MasirSanj Design System — Cool Mineral Paper & Deep Cobalt Ink */

:root {
  --bg-canvas: #f2f5f9;
  --bg-surface: #ffffff;
  --bg-recessed: #e8eef5;
  --bg-hover: #f7f9fc;
  --border-subtle: #d8e1ec;
  --border-strong: #bcc9da;

  --ink-primary: #0f1c2e;
  --ink-secondary: #3b4e68;
  --ink-muted: #647791;

  --brand: #1d4ed8;
  --brand-hover: #1e40af;
  --brand-tint: #eff6ff;

  /* Verdict Signals — unmistakably distinct hues */
  --tunnel-ink: #4338ca;
  --tunnel-bg: #eef2ff;
  --tunnel-border: #c7d2fe;
  --tunnel-solid: #4f46e5;

  --cdn-ink: #c2410c;
  --cdn-bg: #fff7ed;
  --cdn-border: #fed7aa;
  --cdn-solid: #ea580c;

  --direct-ink: #047857;
  --direct-bg: #ecfdf5;
  --direct-border: #a7f3d0;
  --direct-solid: #059669;

  --error-ink: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-solid: #dc2626;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg-canvas: #0b121e;
  --bg-surface: #121c2c;
  --bg-recessed: #19263b;
  --bg-hover: #172336;
  --border-subtle: #24344d;
  --border-strong: #354b6e;

  --ink-primary: #e8eef7;
  --ink-secondary: #b4c3d9;
  --ink-muted: #7f94b2;

  --brand: #3b82f6;
  --brand-hover: #2563eb;
  --brand-tint: rgba(59, 130, 246, 0.14);

  --tunnel-ink: #a5b4fc;
  --tunnel-bg: rgba(79, 70, 229, 0.16);
  --tunnel-border: rgba(129, 140, 248, 0.35);
  --tunnel-solid: #6366f1;

  --cdn-ink: #fdba74;
  --cdn-bg: rgba(234, 88, 12, 0.16);
  --cdn-border: rgba(251, 146, 60, 0.35);
  --cdn-solid: #f97316;

  --direct-ink: #6ee7b7;
  --direct-bg: rgba(5, 150, 105, 0.16);
  --direct-border: rgba(52, 211, 153, 0.35);
  --direct-solid: #10b981;

  --error-ink: #fca5a5;
  --error-bg: rgba(220, 38, 38, 0.16);
  --error-border: rgba(248, 113, 113, 0.35);
  --error-solid: #ef4444;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-primary);
  background: var(--bg-canvas);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.brand-text p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-pill.online .status-dot {
  background: var(--direct-solid);
  box-shadow: 0 0 0 3px var(--direct-bg);
}

.status-pill.offline .status-dot {
  background: var(--error-solid);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
  background: var(--bg-hover);
}

html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }

/* Main Layout */
.main-layout {
  padding-top: 22px;
  padding-bottom: 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* Command Deck */
.command-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.input-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.panel-head.compact {
  align-items: center;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.panel-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.segmented {
  display: inline-flex;
  background: var(--bg-recessed);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: 0 1px 2px rgba(15, 28, 46, 0.08);
}

/* Editor */
.editor-wrap {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  overflow: hidden;
  transition: border-color 0.15s;
}

.editor-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.code-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 13px 14px;
  resize: vertical;
  min-height: 148px;
  outline: none;
}

.code-input::placeholder {
  color: var(--ink-muted);
  font-family: var(--font-sans);
  direction: rtl;
  text-align: right;
  opacity: 0.85;
}

.editor-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.detect-badge {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.detect-badge.has-items {
  color: var(--brand);
  font-weight: 600;
}

.editor-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ghost-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.ghost-btn:hover {
  background: var(--bg-recessed);
  color: var(--ink-primary);
}

.ghost-btn.danger-text:hover {
  color: var(--error-ink);
  background: var(--error-bg);
}

/* Controls Row */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  background: var(--brand);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.primary-btn:hover:not(:disabled) {
  background: var(--brand-hover);
}

.primary-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.primary-btn.loading .btn-spinner {
  display: inline-block;
}

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

.inline-alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-ink);
  font-size: 13px;
  font-weight: 500;
}

/* Topology Visualizer Panel */
.topology-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.count-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-recessed);
  color: var(--ink-secondary);
}

.topology-stage {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
}

.topology-svg {
  width: 100%;
  height: auto;
  display: block;
}

.route-line {
  stroke-width: 2.2;
  stroke-linecap: round;
  opacity: 0.35;
  transition: opacity 0.25s, stroke-width 0.25s;
}

.route-tunnel { stroke: var(--tunnel-solid); }
.route-cdn { stroke: var(--cdn-solid); }
.route-direct { stroke: var(--direct-solid); }

.route-line.active {
  opacity: 1;
  stroke-width: 2.8;
}

.topology-stage.scanning .route-line {
  stroke-dasharray: 7 6;
  opacity: 0.85;
  animation: flowDash 0.9s linear infinite;
}

@keyframes flowDash {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 26; }
}

.node-box {
  fill: var(--bg-surface);
  stroke-width: 1.5;
}

.node-client { stroke: var(--border-strong); }
.node-tunnel { stroke: var(--tunnel-border); fill: var(--tunnel-bg); }
.node-cdn { stroke: var(--cdn-border); fill: var(--cdn-bg); }
.node-direct { stroke: var(--direct-border); fill: var(--direct-bg); }

.svg-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  fill: var(--ink-primary);
}

.svg-tunnel-ink { fill: var(--tunnel-ink); }
.svg-cdn-ink { fill: var(--cdn-ink); }
.svg-direct-ink { fill: var(--direct-ink); }

.svg-sub {
  font-family: var(--font-sans);
  font-size: 9.2px;
  fill: var(--ink-muted);
}

.dest-circle {
  stroke-width: 1.5;
}
.dest-tunnel { fill: var(--tunnel-bg); stroke: var(--tunnel-solid); }
.dest-cdn { fill: var(--cdn-bg); stroke: var(--cdn-solid); }
.dest-direct { fill: var(--direct-bg); stroke: var(--direct-solid); }

.svg-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--ink-primary);
}

/* Distribution Bar */
.dist-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-recessed);
  overflow: hidden;
  display: flex;
}

.dist-seg {
  height: 100%;
  transition: width 0.35s ease;
}

.seg-tunnel { background: var(--tunnel-solid); }
.seg-cdn { background: var(--cdn-solid); }
.seg-direct { background: var(--direct-solid); }
.seg-error { background: var(--error-solid); }

/* Stat Strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-tile {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.stat-tile:hover {
  background: var(--bg-hover);
}

.tile-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.tile-value {
  font-size: 16px;
  font-weight: 800;
}

.tile-tunnel .tile-value { color: var(--tunnel-ink); }
.tile-cdn .tile-value { color: var(--cdn-ink); }
.tile-direct .tile-value { color: var(--direct-ink); }
.tile-error .tile-value { color: var(--error-ink); }

.tile-tunnel.active { border-color: var(--tunnel-solid); background: var(--tunnel-bg); }
.tile-cdn.active { border-color: var(--cdn-solid); background: var(--cdn-bg); }
.tile-direct.active { border-color: var(--direct-solid); background: var(--direct-bg); }
.tile-error.active { border-color: var(--error-solid); background: var(--error-bg); }

/* Progress Strip */
.progress-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-secondary);
}

.progress-track {
  height: 6px;
  background: var(--bg-recessed);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* Results Panel */
.results-panel {
  overflow: hidden;
}

.results-toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pill:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.pill.active {
  background: var(--ink-primary);
  color: var(--bg-surface);
  border-color: var(--ink-primary);
}

.pill-tunnel.active { background: var(--tunnel-solid); border-color: var(--tunnel-solid); color: #fff; }
.pill-cdn.active { background: var(--cdn-solid); border-color: var(--cdn-solid); color: #fff; }
.pill-direct.active { background: var(--direct-solid); border-color: var(--direct-solid); color: #fff; }
.pill-error.active { background: var(--error-solid); border-color: var(--error-solid); color: #fff; }

.pill-count {
  font-size: 11.5px;
  opacity: 0.82;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 10px;
  height: 34px;
  color: var(--ink-muted);
}

.search-box:focus-within {
  border-color: var(--brand);
}

.search-box input {
  border: none;
  background: transparent;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 13px;
  width: 210px;
  outline: none;
}

.outline-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  height: 34px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.outline-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.outline-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sub-banner {
  padding: 10px 18px;
  background: var(--brand-tint);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Empty State */
.empty-state {
  padding: 52px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-recessed);
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.empty-state h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.empty-state p {
  margin: 0;
  max-width: 520px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table thead th {
  text-align: right;
  padding: 11px 14px;
  background: var(--bg-recessed);
  color: var(--ink-secondary);
  font-weight: 700;
  font-size: 12px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.results-table tbody tr.result-row {
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s;
}

.results-table tbody tr.result-row:hover {
  background: var(--bg-hover);
}

.results-table tbody tr.result-row.expanded {
  background: var(--bg-hover);
  border-bottom-color: transparent;
}

.results-table td {
  padding: 11px 11px;
  vertical-align: middle;
}

.col-idx {
  width: 36px;
  color: var(--ink-muted);
  font-size: 12px;
}

.cfg-title-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 215px;
}

.cfg-remark {
  font-weight: 700;
  color: var(--ink-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cfg-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.proto-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-recessed);
  color: var(--ink-secondary);
  text-transform: uppercase;
}

.mini-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--brand-tint);
  color: var(--brand);
}

/* Verdict Badge */
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.verdict-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.verdict-tunnel {
  color: var(--tunnel-ink);
  background: var(--tunnel-bg);
  border-color: var(--tunnel-border);
}
.verdict-tunnel .verdict-dot { background: var(--tunnel-solid); }

.verdict-cdn {
  color: var(--cdn-ink);
  background: var(--cdn-bg);
  border-color: var(--cdn-border);
}
.verdict-cdn .verdict-dot { background: var(--cdn-solid); }

.verdict-direct {
  color: var(--direct-ink);
  background: var(--direct-bg);
  border-color: var(--direct-border);
}
.verdict-direct .verdict-dot { background: var(--direct-solid); }

.verdict-error {
  color: var(--error-ink);
  background: var(--error-bg);
  border-color: var(--error-border);
}
.verdict-error .verdict-dot { background: var(--error-solid); }

/* Host & IP cell */
.host-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  direction: ltr;
  text-align: left;
  font-family: var(--font-mono);
}

.host-primary {
  font-size: 12.5px;
  color: var(--ink-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 205px;
}

.ip-resolved {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Geo cell */
.geo-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.geo-country {
  font-weight: 600;
  color: var(--ink-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.flag-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-recessed);
  color: var(--ink-secondary);
}

.geo-isp {
  font-size: 12px;
  color: var(--ink-muted);
  max-width: 205px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  text-align: right;
  unicode-bidi: isolate;
}

/* Row Actions */
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.small-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.small-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
  background: var(--bg-recessed);
}

/* Expanded Detail Row */
.detail-row {
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
}

.detail-row td {
  padding: 0;
}

.detail-inner {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  border-top: 1px dashed var(--border-subtle);
}

.detail-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-block h4 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-reason {
  margin: 0;
  font-size: 13px;
  color: var(--ink-primary);
  line-height: 1.7;
}

.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  font-size: 12px;
}

.kv-key {
  color: var(--ink-muted);
}

.kv-val {
  color: var(--ink-primary);
  font-weight: 500;
  word-break: break-all;
}

.node-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.node-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
}

.node-status-ok { color: var(--direct-ink); font-weight: 700; }
.node-status-fail { color: var(--error-ink); font-weight: 700; }
.node-status-pending { color: var(--ink-muted); }

.tcp-btn {
  border: 1px solid var(--brand);
  background: var(--brand-tint);
  color: var(--brand);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-self: flex-start;
}

.tcp-btn:hover:not(:disabled) {
  background: var(--brand);
  color: #ffffff;
}

.tcp-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Footer */
.footer {
  padding-top: 8px;
  padding-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-muted);
}

.footer a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.footer a:hover {
  text-decoration: underline;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 22px;
  background: var(--ink-primary);
  color: var(--bg-surface);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 960px) {
  .command-deck {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    padding: 10px 0;
    flex-wrap: wrap;
  }
  .search-box input {
    width: 150px;
  }
  .results-table th:nth-child(1),
  .results-table td:nth-child(1) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
