:root {
  --bg-body: #090d16;
  --bg-surface: #111827;
  --bg-surface-2: #161f32;
  --bg-hover: #1c273f;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --emerald: #10b981;
  --emerald-bright: #34d399;
  --emerald-bg: rgba(16, 185, 129, 0.14);
  --emerald-border: rgba(16, 185, 129, 0.38);

  --cyan: #22d3ee;
  --cyan-bg: rgba(34, 211, 238, 0.14);
  --cyan-border: rgba(34, 211, 238, 0.35);

  --violet: #a78bfa;
  --violet-bg: rgba(167, 139, 250, 0.14);
  --violet-border: rgba(167, 139, 250, 0.35);

  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.14);
  --amber-border: rgba(251, 191, 36, 0.35);

  --rose: #fb7185;
  --rose-bg: rgba(251, 113, 133, 0.14);
  --rose-border: rgba(251, 113, 133, 0.35);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

/* App Shell */
.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 22px 36px;
}

/* Header */
.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(34, 211, 238, 0.16));
  border: 1px solid var(--emerald-border);
  color: var(--emerald-bright);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-title-row h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

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

/* Badges & Buttons */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
}

.badge-platform {
  color: var(--cyan);
  background: var(--cyan-bg);
  border-color: var(--cyan-border);
}

.badge-local {
  color: var(--cyan);
  background: var(--cyan-bg);
  border-color: var(--cyan-border);
}

.badge-gateway {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: var(--amber-border);
}

.badge-connected {
  color: var(--emerald-bright);
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn:focus-visible,
.tab-btn:focus-visible,
.filter-pill:focus-visible,
.btn-icon-only:focus-visible,
.btn-close:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

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

.btn-primary {
  background: var(--emerald);
  color: #04130d;
}

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

.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

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

.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn.loading .btn-icon {
  display: none;
}

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

/* Status Banner */
.status-banner {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.status-banner.error {
  background: var(--rose-bg);
  border-color: var(--rose-border);
  color: #fecdd3;
}

.status-banner.success {
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
  color: #a7f3d0;
}

/* Subnet Summary Bar */
.subnet-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-card-wide {
  grid-column: span 2;
}

.summary-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.summary-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.summary-counts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.count-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.count-active {
  color: var(--emerald-bright);
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
}

.count-wifi {
  color: var(--cyan);
  background: var(--cyan-bg);
  border-color: var(--cyan-border);
}

.count-inactive {
  color: var(--text-secondary);
  background: rgba(100, 116, 139, 0.14);
}

/* View Tabs */
.view-tabs {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-surface-2);
  border-color: var(--border-strong);
}

.tab-badge {
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-secondary);
}

/* Toolbar */
.main-content {
  margin-top: 14px;
}

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

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

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

.filter-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.filter-pill.active {
  background: var(--cyan-bg);
  color: var(--cyan);
  border-color: var(--cyan-border);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 7px 10px 7px 32px;
  font-size: 0.84rem;
  width: 250px;
  max-width: 100%;
}

.search-box input:focus {
  outline: none;
  border-color: var(--cyan);
}

.scan-timestamp {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* LAN Data Table */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 820px;
}

.data-table th {
  padding: 11px 14px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.65);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background-color 0.12s ease, opacity 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* CRITICAL: Inactive LAN node dimming */
.node-inactive {
  opacity: 0.45;
  color: var(--text-muted);
}

.node-inactive:hover {
  opacity: 0.72;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 16px !important;
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill-active {
  color: var(--emerald-bright);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.status-pill-active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-bright);
}

.status-pill-inactive {
  color: var(--text-muted);
  background: rgba(100, 116, 139, 0.14);
  border: 1px solid rgba(100, 116, 139, 0.28);
}

.cell-primary {
  font-weight: 600;
  color: var(--text-primary);
}

.cell-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.history-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.hist-pill {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.24);
  opacity: 0.75;
}

/* Ports summary pills */
.ports-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 280px;
}

.port-pill {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.port-pill-open {
  color: var(--emerald-bright);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
}

.port-pill-closed {
  color: var(--text-muted);
  background: rgba(100, 116, 139, 0.12);
  border: 1px dashed rgba(100, 116, 139, 0.3);
  text-decoration: line-through;
  opacity: 0.65;
}

/* Historical & Port dimmed classes */
.history-dimmed {
  opacity: 0.48;
  color: var(--text-muted);
}

.port-dimmed {
  opacity: 0.48;
  color: var(--text-muted);
}

.port-dimmed .port-num {
  text-decoration: line-through;
}

/* WiFi Mind-Map Layout */
.zoom-controls {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}

.btn-icon-only {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-icon-only:hover {
  background: var(--bg-hover);
}

.btn-reset-zoom {
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.mindmap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: stretch;
}

.mindmap-stage-wrap {
  position: relative;
  background: radial-gradient(circle at center, #111b2e 0%, #090d16 75%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-height: 580px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mindmap-container {
  flex: 1;
  width: 100%;
  height: 580px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.mindmap-container:active {
  cursor: grabbing;
}

.mindmap-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mindmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(9, 13, 22, 0.85);
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot-connected {
  background: var(--emerald-bright);
  box-shadow: 0 0 8px var(--amber);
}

.dot-24 {
  background: var(--cyan);
}

.dot-5 {
  background: var(--violet);
}

.dot-6 {
  background: var(--amber);
}

.dot-inactive {
  background: transparent;
  border: 1.5px dashed var(--text-muted);
  opacity: 0.6;
}

.mindmap-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 0.78rem;
  box-shadow: var(--shadow-lg);
  min-width: 190px;
  max-width: 260px;
}

/* WiFi Sidebar */
.wifi-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  max-height: 620px;
}

.wifi-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.wifi-sidebar-header h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.wifi-sidebar-list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wifi-side-item {
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, opacity 0.14s ease;
}

.wifi-side-item:hover,
.wifi-side-item.selected {
  border-color: var(--cyan-border);
  background: var(--bg-hover);
}

.wifi-side-item.node-inactive {
  opacity: 0.45;
}

.wifi-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wifi-side-ssid {
  font-weight: 600;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wifi-side-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* Inspector Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.inspector-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.inspector-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.drawer-title-group h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-close {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-section {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.drawer-section h3 {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.kv-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kv-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kv-val {
  font-size: 0.86rem;
  font-weight: 600;
  word-break: break-word;
}

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

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(9, 13, 22, 0.5);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.tag-historical {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Port Scanner Controls in Drawer */
.portscan-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.portscan-controls select,
.portscan-controls input {
  background: var(--bg-body);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 7px 10px;
  font-size: 0.84rem;
}

.portscan-controls input {
  flex: 1;
  min-width: 150px;
}

.portscan-alert-dimmed {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(100, 116, 139, 0.12);
  border: 1px dashed rgba(100, 116, 139, 0.35);
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.drawer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.drawer-table th {
  text-align: left;
  padding: 7px 8px;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.cap-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sparkline-box {
  margin-top: 8px;
  padding: 8px;
  background: rgba(9, 13, 22, 0.55);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* Responsive */
@media (max-width: 1024px) {
  .mindmap-layout {
    grid-template-columns: 1fr;
  }

  .wifi-sidebar {
    max-height: 320px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px 12px 28px;
  }

  .summary-card-wide {
    grid-column: span 1;
  }

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

  .mindmap-stage-wrap,
  .mindmap-container {
    min-height: 440px;
    height: 440px;
  }
}

/* Header Wallet & Engine Strip */
.wallet-strip,
.scan-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

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

.engine-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-bright);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
}

.engine-pill.mode-remote .engine-dot {
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.7);
}

.engine-pill.mode-sandbox .engine-dot {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.7);
}

.credits-pill {
  border-color: var(--amber-border);
  background: var(--amber-bg);
  color: var(--amber);
}

.credits-pill:hover {
  background: rgba(251, 191, 36, 0.22);
  border-color: var(--amber);
}

.credits-unit {
  opacity: 0.85;
  font-weight: 500;
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1c1102;
  border-color: rgba(251, 191, 36, 0.5);
}

.btn-accent:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 999px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Custom Port Scanner Cost Note & Status */
.portscan-cost-note {
  font-size: 0.78rem;
  color: var(--cyan);
  margin: -6px 0 8px;
  font-weight: 600;
}

.portscan-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.portscan-status.success {
  color: var(--emerald-bright);
}

.portscan-status.error {
  color: var(--rose);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(3px);
  z-index: 60;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.modal-wide {
  width: min(740px, calc(100vw - 24px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal-title-group h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-body);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.modal-tab {
  padding: 8px 10px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.modal-tab.active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  background: var(--bg-body);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 11px;
  font-size: 0.88rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--cyan);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.account-summary-card,
.engine-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}

.engine-status-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.account-name,
.engine-mode-heading {
  font-size: 1.05rem;
  font-weight: 700;
}

.account-credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-weight: 700;
}

.modal-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-section h3 {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.credits-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(34, 211, 238, 0.08));
  border: 1px solid var(--amber-border);
}

.credits-hero-balance {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--amber);
}

.credits-hero-unit {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.credits-hero-stats {
  display: flex;
  gap: 18px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 700;
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.pack-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}

.pack-card.featured {
  border-color: var(--amber-border);
  background: rgba(251, 191, 36, 0.06);
}

.pack-title {
  font-weight: 700;
  font-size: 0.94rem;
}

.pack-credits {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--amber);
}

.pack-price {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.pricing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.ledger-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

.ledger-amount.positive {
  color: var(--emerald-bright);
}

.ledger-amount.negative {
  color: var(--rose);
}
