* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

main { width: min(480px, 96vw); }

.account-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  font-size: 0.85rem;
}
.account-strip > div { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.account-strip .value {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 14px;
  padding: 1.5rem 1.5rem 1.25rem;
  text-align: center;
}

.symbol-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.symbol-row select,
.symbol-row input,
.symbol-row button {
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
}
.symbol-row select { flex: 1; min-width: 0; }
.symbol-row input { flex: 1; min-width: 0; }
.symbol-row button { cursor: pointer; }
.symbol-row button:hover { background: #1c2128; }
#add-preset { background: #1f6feb; border-color: #1f6feb; color: white; }
#add-preset:hover { background: #1158c7; }
#manage-toggle { padding: 0.35rem 0.55rem; }

.manage-panel {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 1rem;
  text-align: left;
  font-size: 0.85rem;
  max-height: 180px;
  overflow-y: auto;
}
.manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
}
.manage-row + .manage-row { border-top: 1px solid #21262d; }
.manage-row button {
  background: transparent;
  color: #f85149;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.manage-row button:hover { background: rgba(248, 81, 73, 0.12); }

.symbol-label {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.big-price {
  font-size: 3.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1.25rem;
  transition: color 0.4s ease;
  color: #e6edf3;
}
.big-price.up { color: #3fb950; }
.big-price.down { color: #f85149; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid #30363d;
  border-bottom: 1px solid #30363d;
}
.grid > div { display: flex; flex-direction: column; gap: 0.25rem; }
.label {
  font-size: 0.7rem;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.value {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.meta {
  margin-top: 0.85rem;
  font-size: 0.8rem;
  opacity: 0.75;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.sep { opacity: 0.4; }

.status {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.status.ok   { background: rgba(63, 185, 80, 0.15); color: #3fb950; }
.status.warn { background: rgba(210, 153, 34, 0.18); color: #d29922; }
.status.err  { background: rgba(248, 81, 73, 0.15); color: #f85149; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #161b22;
  border: 1px solid #30363d;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  max-width: 90vw;
}
.toast.warn { color: #d29922; border-color: rgba(210, 153, 34, 0.4); }
.toast.err  { color: #f85149; border-color: rgba(248, 81, 73, 0.4); }
.toast.ok   { color: #3fb950; border-color: rgba(63, 185, 80, 0.4); }

.footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.72rem;
  opacity: 0.4;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.tab {
  flex: 1;
  padding: 0.45rem 0.75rem;
  background: #161b22;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { background: #1c2128; color: #e6edf3; }
.tab.active { background: #1f6feb; border-color: #1f6feb; color: #fff; }

/* ── Insider Clusters ── */
.clusters-card { text-align: left; padding: 1.25rem; }

.cluster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.cluster-title { font-weight: 600; font-size: 1rem; }
#cluster-refresh {
  background: transparent;
  border: 1px solid #30363d;
  color: #8b949e;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-size: 1rem;
  cursor: pointer;
}
#cluster-refresh:hover { background: #1c2128; color: #e6edf3; }
#cluster-refresh:disabled { opacity: 0.4; cursor: not-allowed; }

.cluster-meta {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-bottom: 0.85rem;
}

.cluster-row {
  padding: 0.6rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.cluster-row:hover { background: #1c2128; }
.cluster-row.active { background: #1c2128; border-left: 2px solid #1f6feb; padding-left: 0.4rem; }
.cluster-row + .cluster-row { border-top: 1px solid #21262d; }

.cluster-row-main {
  display: grid;
  grid-template-columns: 4rem 3.5rem 4.5rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.9rem;
}
.cluster-ticker-wrap { display: inline-flex; align-items: baseline; }
.cluster-ticker { font-weight: 700; font-variant-numeric: tabular-nums; }
.cluster-tv {
  color: #6b7280;
  text-decoration: none;
  margin-left: 6px;
  font-size: 0.85em;
  opacity: 0.55;
  transition: opacity 120ms ease, color 120ms ease;
}
.cluster-tv:hover { color: #4a9eff; opacity: 1; }
.cluster-ins { font-size: 0.8rem; opacity: 0.7; }
.cluster-dollars { font-variant-numeric: tabular-nums; }
.cluster-score { text-align: right; font-size: 0.8rem; opacity: 0.55; font-variant-numeric: tabular-nums; }

.cluster-row-sub {
  font-size: 0.72rem;
  opacity: 0.45;
  margin-top: 0.15rem;
  padding-left: 0.1rem;
}

.cluster-empty {
  text-align: center;
  opacity: 0.45;
  font-size: 0.85rem;
  padding: 1.5rem 0;
}

.cluster-detail-loading {
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
  opacity: 0.55;
}

#cluster-detail {
  margin-top: 0.75rem;
  border-top: 1px solid #30363d;
  padding-top: 0.75rem;
}
.cluster-detail-header {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  opacity: 0.8;
}
.cluster-txn {
  padding: 0.5rem 0;
  font-size: 0.82rem;
}
.cluster-txn + .cluster-txn { border-top: 1px solid #21262d; }
.cluster-txn-who { font-weight: 500; margin-bottom: 0.15rem; }
.cluster-txn-role {
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.55;
  margin-left: 0.4rem;
}
.cluster-txn-what { font-variant-numeric: tabular-nums; opacity: 0.75; }
.cluster-txn-when { font-size: 0.72rem; opacity: 0.45; margin-top: 0.1rem; }
