:root {
  --bg-0: #05070d;
  --bg-1: #0a0e1a;
  --bg-2: #111727;
  --line: #1d2740;
  --line-soft: #141a2a;
  --text: #dfe6f5;
  --text-dim: #8892b0;
  --text-faint: #4a5269;
  --accent: #00e5ff;
  --accent-2: #ff3df5;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #ef4444;
  --glow: 0 0 24px rgba(0, 229, 255, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at top, #0b1020 0%, var(--bg-0) 70%);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  overflow: hidden;
  letter-spacing: 0.01em;
}
code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

#bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(29, 39, 64, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 39, 64, 0.35) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

.top-bar {
  position: relative; z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(10,14,26,0.9), rgba(10,14,26,0.6));
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent), 0 0 4px #fff;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.45 } }
.brand-name { font-weight: 700; letter-spacing: 0.22em; font-size: 13px; }
.brand-tag { color: var(--text-faint); font-size: 11px; letter-spacing: 0.08em; }

.stats { display: flex; gap: 18px; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 58px; }
.stat-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--text-faint); }
.stat-val { font-family: "JetBrains Mono", monospace; font-size: 18px; color: var(--accent); text-shadow: 0 0 10px rgba(0, 229, 255, 0.5); margin-top: 2px; }

.actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn {
  font-family: inherit; font-size: 11px; letter-spacing: 0.14em;
  padding: 7px 14px; border-radius: 2px; cursor: pointer;
  text-transform: uppercase; transition: all 0.15s ease;
}
.btn-ghost {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--line);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.12), rgba(0, 229, 255, 0.04));
  color: var(--accent); border: 1px solid rgba(0, 229, 255, 0.4);
}
.btn-primary:hover { box-shadow: var(--glow); border-color: var(--accent); }

.layout {
  position: relative; z-index: 5;
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  height: calc(100vh - 56px - 140px);
}
.panel {
  background: linear-gradient(180deg, rgba(10,14,26,0.6), rgba(10,14,26,0.35));
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  backdrop-filter: blur(4px);
}
.panel-right { border-right: none; border-left: 1px solid var(--line-soft); }
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
.panel-title {
  font-size: 10px; letter-spacing: 0.24em; color: var(--text-faint);
  text-transform: uppercase;
}
.panel-count {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent); font-size: 12px;
  padding: 2px 8px; border: 1px solid rgba(0, 229, 255, 0.25); border-radius: 2px;
}
.panel-footer { padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.hint { color: var(--text-faint); font-size: 10px; letter-spacing: 0.06em; }

.sites-list, .approvals-list {
  list-style: none; margin: 0; padding: 8px;
  overflow-y: auto; flex: 1;
}
.site-item {
  padding: 10px 12px; margin: 4px 2px;
  border: 1px solid var(--line-soft); border-radius: 2px;
  cursor: pointer; transition: all 0.15s ease;
  display: flex; flex-direction: column; gap: 4px;
}
.site-item:hover { border-color: rgba(0, 229, 255, 0.4); background: rgba(0, 229, 255, 0.04); }
.site-item.active { border-color: var(--accent); background: rgba(0, 229, 255, 0.08); box-shadow: var(--glow); }
.site-domain { font-weight: 600; font-size: 12px; color: var(--text); }
.site-meta { display: flex; gap: 10px; font-size: 10px; color: var(--text-faint); letter-spacing: 0.06em; }
.site-status {
  font-family: "JetBrains Mono", monospace; text-transform: uppercase;
  padding: 1px 6px; border-radius: 2px; font-size: 9px;
}
.site-status.onboarding { color: var(--warn); border: 1px solid rgba(251, 191, 36, 0.3); }
.site-status.healthy { color: var(--ok); border: 1px solid rgba(74, 222, 128, 0.3); }
.site-status.stale { color: var(--text-faint); border: 1px solid var(--line); }

.approval-item {
  padding: 10px 12px; margin: 4px 2px;
  border: 1px solid var(--line-soft); border-radius: 2px;
  display: flex; flex-direction: column; gap: 6px;
}
.approval-top { display: flex; justify-content: space-between; align-items: center; }
.approval-agent {
  font-family: "JetBrains Mono", monospace; font-size: 10px;
  color: var(--accent-2); letter-spacing: 0.08em; text-transform: uppercase;
}
.approval-change { font-size: 10px; color: var(--text-faint); }
.approval-rationale { font-size: 11px; color: var(--text-dim); line-height: 1.45; }
.approval-actions { display: flex; gap: 6px; margin-top: 4px; }
.approval-actions .btn { flex: 1; padding: 5px 8px; font-size: 10px; }
.btn-approve { color: var(--ok); border-color: rgba(74, 222, 128, 0.3); }
.btn-approve:hover { background: rgba(74, 222, 128, 0.1); border-color: var(--ok); }
.btn-reject { color: var(--err); border-color: rgba(239, 68, 68, 0.3); }
.btn-reject:hover { background: rgba(239, 68, 68, 0.1); border-color: var(--err); }

.globe-wrap { position: relative; background: radial-gradient(circle at center, #0a1024 0%, #050810 70%); overflow: hidden; }
#globe { width: 100%; height: 100%; }
.globe-overlay { position: absolute; top: 16px; left: 16px; right: 16px; pointer-events: none; display: flex; justify-content: space-between; }
.legend { display: flex; gap: 16px; background: rgba(5, 7, 13, 0.6); border: 1px solid var(--line-soft); padding: 8px 12px; border-radius: 2px; backdrop-filter: blur(6px); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; }
.legend-item .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-site { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot-hub { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.dot-edge { width: 16px !important; height: 2px !important; border-radius: 0 !important; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.tooltip {
  position: absolute; z-index: 20; pointer-events: none;
  background: rgba(5, 7, 13, 0.92); border: 1px solid rgba(0, 229, 255, 0.4);
  padding: 10px 14px; border-radius: 2px;
  font-size: 11px; min-width: 200px;
  box-shadow: var(--glow);
  backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.12s ease;
}
.tooltip.visible { opacity: 1; }
.tt-domain { font-weight: 600; font-size: 12px; color: var(--accent); margin-bottom: 4px; letter-spacing: 0.04em; }
.tt-row { display: flex; justify-content: space-between; color: var(--text-dim); margin: 2px 0; }
.tt-row b { color: var(--text); font-weight: 500; }

.activity {
  position: relative; z-index: 5;
  height: 140px; border-top: 1px solid var(--line-soft);
  background: rgba(5, 7, 13, 0.8); display: flex; flex-direction: column;
}
.activity-label {
  padding: 10px 24px 4px; font-size: 10px; letter-spacing: 0.24em;
  color: var(--text-faint); text-transform: uppercase;
}
.activity-log {
  padding: 0 24px 12px; overflow-y: auto; flex: 1;
  font-family: "JetBrains Mono", monospace; font-size: 11px;
  color: var(--text-dim); line-height: 1.6;
}
.log-line { display: flex; gap: 12px; }
.log-time { color: var(--text-faint); }
.log-ok { color: var(--ok); }
.log-err { color: var(--err); }
.log-info { color: var(--accent); }

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(5, 7, 13, 0.7); backdrop-filter: blur(8px); }
.modal.hidden { display: none; }
.modal-card { background: var(--bg-1); border: 1px solid rgba(0, 229, 255, 0.3); padding: 24px; min-width: 360px; border-radius: 2px; box-shadow: 0 0 60px rgba(0, 229, 255, 0.15); }
.modal-card h3 { margin: 0 0 6px; letter-spacing: 0.2em; font-size: 13px; text-transform: uppercase; color: var(--accent); }
.modal-sub { color: var(--text-dim); font-size: 12px; margin: 0 0 16px; }
.modal-card input {
  width: 100%; background: var(--bg-0); border: 1px solid var(--line);
  color: var(--text); padding: 10px 12px; font-family: "JetBrains Mono", monospace;
  font-size: 12px; border-radius: 2px; outline: none;
}
.modal-card input:focus { border-color: var(--accent); box-shadow: var(--glow); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.sites-list::-webkit-scrollbar, .approvals-list::-webkit-scrollbar, .activity-log::-webkit-scrollbar { width: 6px; }
.sites-list::-webkit-scrollbar-thumb, .approvals-list::-webkit-scrollbar-thumb, .activity-log::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.sites-list::-webkit-scrollbar-thumb:hover, .approvals-list::-webkit-scrollbar-thumb:hover, .activity-log::-webkit-scrollbar-thumb:hover { background: var(--accent); }
