:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #172033;
  --border: #263449;
  --text: #e2e8f0;
  --muted: #8b98ac;
  --accent: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

header h1 {
  font-size: 1.25rem;
  margin: 0;
}

header nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
}

header nav a:hover {
  color: var(--text);
}

header nav a.active {
  color: var(--text);
  background: var(--panel);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

section h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

button {
  background: var(--accent);
  color: #06210f;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem;
}

form.add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

form.add-form input {
  flex: 1;
  text-transform: uppercase;
}

ul { list-style: none; margin: 0; padding: 0; }

li.watchlist-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

li.watchlist-item:last-child { border-bottom: none; }

.watchlist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

button.ticker-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.25rem 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
}

button.ticker-toggle .ticker-caret {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

button.ticker-toggle.active .ticker-caret {
  transform: rotate(90deg);
}

.ticker-detail {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  overflow-x: auto;
}

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  margin-left: 0.5rem;
}

.cluster-card {
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.cluster-card:last-child { margin-bottom: 0; }

.cluster-card h3 {
  margin: 0 0 0.35rem;
  color: var(--accent);
}

.cluster-card p {
  margin: 0.15rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid var(--border);
}

tr.large-transaction {
  background: rgba(245, 158, 11, 0.08);
  box-shadow: inset 3px 0 0 var(--warning);
}

.large-badge {
  background: var(--warning);
  color: #241a00;
  font-weight: 700;
}

.likely-badge {
  border: 1px dashed var(--muted);
  background: transparent;
}

th { color: var(--muted); font-weight: 500; }

.buy { color: var(--accent); }
.sell { color: var(--danger); }

.empty { color: var(--muted); font-size: 0.9rem; }

li.notification-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

li.notification-item:last-child { border-bottom: none; }

li.notification-item .notification-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

li.notification-item .notification-body {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.2rem 0;
}

li.notification-item time {
  color: var(--muted);
  font-size: 0.75rem;
}

#status-line {
  font-size: 0.8rem;
  color: var(--muted);
}

.section-hint {
  margin: -0.4rem 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

#search-result h3 {
  margin: 0.25rem 0 0.5rem;
}

#search-result .search-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
