* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0a0a0f;
  color: #e0e0e0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
#header {
  flex-shrink: 0;
  padding: 10px 16px 8px;
  background: #0a0a0f;
  border-bottom: 1px solid #1a1a24;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
h1 {
  font-size: 18px;
  font-weight: 700;
  color: #f59e0b;
  letter-spacing: 0.5px;
  flex: 0 0 auto;
}
#header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
#auth-logged-out, #auth-logged-in {
  display: flex;
  align-items: center;
  gap: 8px;
}
#auth-user {
  color: #34d399;
  font-weight: 600;
}
#solid-login {
  background: #f59e0b;
  color: #0a0a0f;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
#solid-login:hover { background: #fbbf24; }
#solid-login:disabled { background: #444; color: #888; cursor: wait; }
#help-link, #settings-link { font-size: 12px; color: #666; text-decoration: none; }
#help-link:hover, #settings-link:hover { color: #f59e0b; }
#solid-logout {
  background: none;
  color: #666;
  border: 1px solid #333;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
#solid-logout:hover { color: #aaa; border-color: #555; }
.subtitle {
  font-size: 12px;
  color: #888;
  flex: 0 0 100%;
}
.subtitle span { margin-left: 4px; }

/* Connection bar */
#solid-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #111118;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
#solid-bar label { color: #888; font-size: 12px; }
#solid-bar input {
  background: #1a1a24;
  border: 1px solid #333;
  color: #e0e0e0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}
#solid-url { width: 380px; }
#solid-token { width: 160px; }
#solid-bar button {
  background: #4a9eff;
  color: #fff;
  border: none;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
#solid-bar button:disabled { opacity: 0.5; cursor: default; }
#solid-status, #solid-status-in { font-size: 12px; }
#solid-status.connected, #solid-status-in.connected { color: #34d399; }
#solid-status.error, #solid-status-in.error { color: #ef4444; }
#solid-progress { font-size: 12px; color: #888; }

/* Stats bar */
#stats-bar {
  display: flex;
  background: #0f0f16;
  border-bottom: 1px solid #1a1a24;
  flex-shrink: 0;
}
.stat {
  flex: 1;
  padding: 8px 16px;
  border-right: 1px solid #1a1a24;
  text-align: center;
}
.stat:last-child { border-right: none; }
.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #e0e0e0;
  line-height: 1.2;
}
.stat-label {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.stat-hosts .stat-value { color: #34d399; }
.stat-running .stat-value { color: #34d399; }
.stat-stopped .stat-value { color: #ef4444; }
.stat-agents .stat-value { color: #f59e0b; }
.stat-accounts .stat-value { color: #60a5fa; }

/* Tabs */
#tabs {
  display: flex;
  padding: 0 8px;
  background: #0f0f16;
  border-bottom: 1px solid #1a1a24;
  flex-shrink: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #555;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: #aaa; }
.tab-btn.active {
  color: #e0e0e0;
  border-bottom-color: #4a9eff;
}

/* Tab panes */
.tab-pane { display: none; }
.tab-pane.active {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.tab-pane.graph-pane.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.tab-pane.sparql-pane.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 16px;
  gap: 8px;
}

/* Footer */
#seabase-footer {
  flex-shrink: 0;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 6px 16px;
  background: #0a0a0f;
  border-top: 1px solid #1a1a24;
  font-size: 11px;
  color: #333;
}
#seabase-footer a { color: #444; text-decoration: none; }
#seabase-footer a:hover { color: #f59e0b; }

/* Empty state */
.empty-state {
  color: #444;
  font-size: 13px;
  padding: 48px 0;
  text-align: center;
}

/* Host cards (Infrastructure tab) */
.host-card {
  background: #111118;
  border: 1px solid #1e1e2a;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}
.host-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #14141e;
  border-bottom: 1px solid #1e1e2a;
}
.host-name {
  font-weight: 600;
  font-size: 14px;
  color: #34d399;
  flex: 0 0 auto;
}
.host-meta {
  color: #444;
  font-size: 12px;
  flex: 1;
}
.host-svc-count {
  color: #444;
  font-size: 11px;
  flex-shrink: 0;
}

/* Status badges */
.status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #1a1a24;
  color: #666;
  flex-shrink: 0;
}
.status-running { background: rgba(52,211,153,0.12); color: #34d399; }
.status-stopped { background: rgba(239,68,68,0.12); color: #ef4444; }

/* Service table inside host card */
.svc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.svc-table th {
  background: #0f0f16;
  padding: 5px 14px;
  text-align: left;
  border-bottom: 1px solid #1a1a24;
  color: #444;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.4px;
}
.svc-table td {
  padding: 6px 14px;
  border-bottom: 1px solid #0f0f16;
  color: #bbb;
}
.svc-table tr:last-child td { border-bottom: none; }
.svc-table tr:hover td { background: #14141e; }
.health-url {
  color: #444;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Generic data table (Agents, Accounts tabs) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: #111118;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #222;
  color: #555;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.4px;
  position: sticky;
  top: 0;
}
.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #111118;
  color: #bbb;
}
.data-table tr:hover td { background: #111118; }

/* Graph tab */
#toggles {
  display: flex;
  gap: 16px;
  padding: 6px 16px;
  background: #0f0f16;
  border-bottom: 1px solid #1a1a24;
  flex-shrink: 0;
  align-items: center;
}
#toggles label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  cursor: pointer;
  color: #aaa;
}
#toggles label:has(input:checked) { color: #e0e0e0; }
#toggles input[type="checkbox"] { accent-color: #4a9eff; }
.toggle-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
#graph-container {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}
svg { width: 100%; height: 100%; display: block; }

/* Tooltip */
#tooltip {
  display: none;
  position: absolute;
  background: #1a1a24;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  z-index: 10;
  max-width: 320px;
}
#tooltip .tt-title { font-weight: 600; color: #fff; margin-bottom: 4px; }
#tooltip .tt-type { color: #888; font-size: 11px; }
#tooltip .tt-row { color: #bbb; }
#tooltip .tt-row span { color: #e0e0e0; }

/* SPARQL tab */
#sparql-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}
#sparql-presets button {
  background: #1a1a24;
  border: 1px solid #333;
  color: #aaa;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
}
#sparql-presets button:hover { color: #fff; border-color: #4a9eff; }
#sparql-input {
  width: 100%;
  height: 90px;
  background: #0a0a0f;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  resize: vertical;
  flex-shrink: 0;
}
#sparql-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#sparql-run {
  background: #4a9eff;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
#sparql-run:disabled { opacity: 0.5; }
#sparql-engine-status { color: #888; font-size: 12px; }
#sparql-results {
  flex: 1;
  overflow-y: auto;
}
#sparql-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
#sparql-results th {
  background: #1a1a24;
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid #333;
  color: #aaa;
  position: sticky;
  top: 0;
}
#sparql-results td {
  padding: 3px 8px;
  border-bottom: 1px solid #1a1a24;
  color: #ccc;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sparql-results tr:hover td { background: #1a1a24; }
.sparql-error { color: #ef4444; font-size: 12px; }
