* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root, [data-theme="dark"] {
  --bg-0: #0a0e1a;
  --bg-1: #111827;
  --bg-2: #1a2234;
  --bg-3: #242e44;
  --border: #2a3548;
  --text: #e5ecf7;
  --text-dim: #9ba9c0;
  --text-muted: #6b7a92;
  --accent: #f7931a;
  --accent-dim: #cc7a14;
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --purple: #a855f7;
  --yellow: #facc15;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --graph-bg-inner: #111827;
  --graph-bg-outer: #0a0e1a;
  --edge-color: #3b4d6b;
  --node-text-outline: #0a0e1a;
}

[data-theme="light"] {
  --bg-0: #f4f6fb;
  --bg-1: #ffffff;
  --bg-2: #f0f3f9;
  --bg-3: #e4e9f3;
  --border: #d4dbe8;
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #94a3b8;
  --accent: #f7931a;
  --accent-dim: #cc7a14;
  --blue: #2563eb;
  --green: #059669;
  --red: #dc2626;
  --purple: #9333ea;
  --yellow: #ca8a04;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --graph-bg-inner: #ffffff;
  --graph-bg-outer: #eef2f9;
  --edge-color: #94a3b8;
  --node-text-outline: #ffffff;
}

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select {
  font-family: inherit;
  font-size: 14px;
}

code {
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

/* === Topbar === */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: linear-gradient(to bottom, var(--bg-1), var(--bg-0));
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 12px rgba(247, 147, 26, 0.3);
}

.brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.tagline {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btc-price {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(247, 147, 26, 0.12), rgba(247, 147, 26, 0.04));
  border: 1px solid rgba(247, 147, 26, 0.35);
  padding: 6px 14px;
  border-radius: 10px;
  margin-right: 10px;
  line-height: 1.2;
}

.btc-price::before {
  content: "₿ BTC";
  font-size: 9px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.price-usd {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.price-chf {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
}

.price-loading {
  font-size: 11px;
  color: var(--text-muted);
}

.fiat-inline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.detail-row.fiat {
  padding-top: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.detail-value.fiat-value {
  color: var(--green);
  font-weight: 600;
  font-size: 12px;
}

.stat-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}

.balance-card {
  background: linear-gradient(135deg, rgba(247, 147, 26, 0.12), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(247, 147, 26, 0.35);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(247, 147, 26, 0.1);
}

.balance-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 8px;
}

.balance-btc {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  margin-bottom: 6px;
}

.balance-usd {
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 4px;
}

.balance-chf {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 8px;
}

.balance-rate {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

/* ===== Investigation Mode ===== */
.investigation-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 20px;
}

.investigation-panel h4 {
  color: var(--accent);
  margin-bottom: 12px;
}

.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag-btn {
  font-size: 11px;
  padding: 6px 10px;
  background: var(--bg-1);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-weight: 600;
  transition: all 0.15s;
}

.tag-btn:hover {
  border-color: var(--tag-color, var(--accent));
  color: var(--text);
}

.tag-btn.active {
  background: var(--tag-color, var(--accent));
  border-color: var(--tag-color, var(--accent));
  color: white;
}

.tag-btn.clear {
  background: transparent;
  color: var(--text-muted);
}

.case-note-input {
  width: 100%;
  min-height: 70px;
  padding: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
}

.case-note-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Case tab */
.case-header {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.case-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 8px;
  font-family: inherit;
}

.case-input:focus {
  outline: none;
  border-color: var(--accent);
}

.case-input.small { flex: 1; }

.case-meta-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.case-label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.case-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.case-btn {
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  flex: 1;
  transition: all 0.15s;
}

.case-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.case-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: white;
  border-color: var(--accent);
}

.case-btn.primary:hover { filter: brightness(1.1); }

.case-btn.full {
  width: 100%;
  margin-top: 6px;
}

.case-btn.small {
  padding: 6px 10px;
  font-size: 11px;
  flex: none;
}

.case-btn.active {
  background: rgba(250, 204, 21, 0.15);
  color: var(--yellow);
  border-color: var(--yellow);
}

.case-section {
  margin-bottom: 20px;
}

.case-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.count-pill {
  background: var(--bg-3);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

.case-textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  resize: vertical;
  margin-bottom: 6px;
}

.case-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.case-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 12px;
  text-align: center;
  font-style: italic;
}

.case-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.case-item:hover {
  border-color: var(--accent);
}

.case-item.alert-item {
  border-left: 3px solid var(--red);
  background: rgba(239, 68, 68, 0.06);
}

.case-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.case-item-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.case-item-hash {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--text-dim);
  word-break: break-all;
}

.case-item-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-style: italic;
}

.tag-pill-sm {
  display: inline-block;
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 4px;
}

.case-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-remove:hover {
  background: var(--red);
  color: white;
}

/* ===== Alert Banner (exchange reached) ===== */
.alert-banner {
  position: absolute;
  top: 60px;
  left: 20px;
  right: 20px;
  max-width: 600px;
  margin: 0 auto;
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(220, 38, 38, 0.4);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  z-index: 50;
  animation: alertPulse 1.5s ease-in-out infinite alternate, slideDown 0.4s ease-out;
  cursor: pointer;
}

@keyframes alertPulse {
  from { box-shadow: 0 8px 32px rgba(220, 38, 38, 0.4); }
  to { box-shadow: 0 8px 40px rgba(220, 38, 38, 0.8); }
}

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.alert-icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.alert-msg {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.alert-addr {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 6px;
}

.alert-action {
  font-size: 11px;
  font-style: italic;
  opacity: 0.95;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 10px;
  border-radius: 6px;
}

.alert-close {
  color: white;
  font-size: 24px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.alert-close:hover {
  background: rgba(0, 0, 0, 0.5);
}

.topnav a {
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.topnav a:hover {
  color: var(--text);
  background: var(--bg-2);
  text-decoration: none;
}

.topnav a.active {
  color: var(--accent);
  background: rgba(247, 147, 26, 0.1);
}

/* === Main === */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* === Search panel === */
.search-panel {
  padding: 20px 24px 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#search-form {
  max-width: 1200px;
  margin: 0 auto;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 4px 4px 16px;
  gap: 10px;
  transition: border-color 0.15s;
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.15);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  padding: 14px 0;
  font-size: 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

#search-input::placeholder {
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#search-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.1s, box-shadow 0.15s;
  flex-shrink: 0;
}

#search-btn:hover {
  box-shadow: 0 4px 12px rgba(247, 147, 26, 0.4);
  transform: translateY(-1px);
}

#search-btn:active { transform: translateY(0); }

.search-options {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.opt span {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.opt select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

.opt select option {
  background: var(--bg-2);
}

.examples {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.examples span {
  font-size: 12px;
  color: var(--text-muted);
}

.ex {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}

.ex:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* === Workspace === */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* === Sidebar === */
.sidebar {
  width: 360px;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 14px 10px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
}

.tab-pane {
  display: none;
  padding: 20px;
}

.tab-pane.active { display: block; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* Details panel */
.detail-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.detail-type {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  margin-bottom: 10px;
}

.detail-type.address {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}

.detail-type.tx {
  background: rgba(247, 147, 26, 0.15);
  color: var(--accent);
}

.detail-hash {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
  padding: 10px;
  background: var(--bg-2);
  border-radius: 8px;
  margin-bottom: 8px;
}

.detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.label-badge {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-2);
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(247, 147, 26, 0.15);
}

.label-badge.cat-exchange { border-color: var(--blue); box-shadow: 0 2px 12px rgba(59, 130, 246, 0.15); }
.label-badge.cat-seizure, .label-badge.cat-scam, .label-badge.cat-hack { border-color: var(--red); box-shadow: 0 2px 12px rgba(239, 68, 68, 0.15); }
.label-badge.cat-mining { border-color: var(--green); box-shadow: 0 2px 12px rgba(16, 185, 129, 0.15); }
.label-badge.cat-mixer { border-color: var(--purple); box-shadow: 0 2px 12px rgba(168, 85, 247, 0.15); }
.label-badge.cat-org, .label-badge.cat-historic { border-color: var(--accent); }

.label-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.label-content {
  flex: 1;
  min-width: 0;
}

.label-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.label-cat {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 6px;
}

.label-note {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.heuristic-badge {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  border: 1px solid;
}

.heuristic-badge.high {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--blue);
  color: var(--blue);
}

.heuristic-badge.med {
  background: rgba(250, 204, 21, 0.1);
  border-color: var(--yellow);
  color: var(--yellow);
}

[data-theme="light"] .heuristic-badge.med { color: #a16207; }

.detail-action {
  font-size: 12px;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  transition: all 0.15s;
}

.detail-action:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--text-dim);
}

.detail-value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

.detail-value.big {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.detail-section {
  margin-top: 20px;
}

.detail-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 600;
}

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

.inout-item {
  background: var(--bg-2);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  border-left: 3px solid var(--blue);
  cursor: pointer;
  transition: background 0.15s;
}

.inout-item:hover { background: var(--bg-3); }

.inout-item.out { border-left-color: var(--green); }

.inout-addr {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: var(--text);
  word-break: break-all;
  margin-bottom: 3px;
}

.inout-amount {
  color: var(--accent);
  font-weight: 600;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: var(--bg-2);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.stat-value.accent { color: var(--accent); }

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--bg-2);
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
}

.history-item:hover {
  border-color: var(--accent);
  background: var(--bg-3);
}

.history-hash {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.history-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* === Graph area === */
.graph-area {
  flex: 1;
  position: relative;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.graph-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 2;
}

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

.graph-toolbar button {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.graph-toolbar button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

#btn-layout,
#btn-path {
  width: auto;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
}

.separator {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.legend {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 12px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.dot.addr { background: var(--blue); }
.dot.tx { background: var(--accent); }
.dot.root { background: var(--yellow); }
.dot.labeled { background: var(--accent); border: 2px solid var(--yellow); width: 12px; height: 12px; }

#cy {
  flex: 1;
  width: 100%;
  background: radial-gradient(ellipse at center, var(--graph-bg-inner) 0%, var(--graph-bg-outer) 100%);
}

/* Theme toggle button */
#theme-toggle {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
  margin-left: 8px;
}

#theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

#theme-toggle .sun { display: none; }
[data-theme="light"] #theme-toggle .sun { display: inline; }
[data-theme="light"] #theme-toggle .moon { display: none; }

/* Overlay (empty state) */
.graph-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
  padding: 40px;
}

.graph-overlay.hidden { display: none; }

.overlay-content {
  text-align: center;
  max-width: 440px;
}

.overlay-icon {
  font-size: 80px;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(247, 147, 26, 0.4);
  margin-bottom: 16px;
  font-weight: 800;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.overlay-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.overlay-content p {
  color: var(--text-dim);
  margin-bottom: 6px;
}

.overlay-content .sub {
  color: var(--text-muted);
  font-size: 12px;
}

/* Progress */
.graph-progress {
  position: absolute;
  top: 60px;
  right: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
  min-width: 280px;
  z-index: 10;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 10px;
}

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

.progress-text {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-bar {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--yellow));
  width: 0%;
  transition: width 0.3s;
}

.progress-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-3);
  color: var(--text);
}

.modal-card h2 {
  font-size: 22px;
  margin-bottom: 16px;
}

.modal-card h3 {
  margin-top: 20px;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--accent);
}

.modal-card p, .modal-card ul {
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.7;
}

.modal-card ul {
  padding-left: 20px;
}

.modal-card li {
  margin-bottom: 4px;
}

.modal-card strong { color: var(--text); }

/* Footer */
.footer {
  padding: 10px 24px;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--red);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 200;
  font-size: 13px;
  max-width: 500px;
  animation: slideUp 0.3s ease-out;
}

.toast.success { border-color: var(--green); }
.toast.info { border-color: var(--blue); }

@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-1);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 5px;
}

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

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    width: 300px;
  }
  .topbar {
    padding: 10px 14px;
  }
  .brand h1 { font-size: 16px; }
  .search-panel { padding: 14px; }
  .tagline { display: none; }
}

@media (max-width: 700px) {
  .workspace {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-top: 1px solid var(--border);
    order: 2;
  }
  .graph-area { order: 1; min-height: 50vh; }
  .topnav a:not(.active) { display: none; }
  .btc-price { padding: 4px 8px; margin-right: 4px; }
  .price-usd { font-size: 12px; }
  .price-chf { display: none; }
  .search-options { gap: 8px; }
  .opt { padding: 6px 10px; }
}
