:root {
  --bg: #0d1117;
  --panel: rgba(16, 24, 35, 0.84);
  --panel-strong: #131c28;
  --panel-soft: #172333;
  --border: rgba(154, 176, 199, 0.16);
  --text: #eef4fb;
  --muted: #91a3b8;
  --accent: #67d08b;
  --accent-strong: #4ab874;
  --accent-soft: rgba(103, 208, 139, 0.12);
  --alert: #ff7f6f;
  --alert-soft: rgba(255, 127, 111, 0.12);
  --focus: #7ac6ff;
  --shadow: 0 20px 60px rgba(4, 10, 17, 0.42);
  --mono: "IBM Plex Mono", monospace;
  --sans: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(103, 208, 139, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(122, 198, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #081018 0%, var(--bg) 45%, #09111a 100%);
  color: var(--text);
  font-family: var(--sans);
}

body {
  padding: 24px;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(16px);
}

.top-bar-title {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  color: var(--accent);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-user {
  color: var(--muted);
  font-size: 0.85rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-card,
.stats-card,
.panel,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  border-radius: 24px;
}

.hero-card {
  padding: 28px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.hero-title span {
  color: var(--accent);
}

.hero-copy,
.meta-copy,
.status-copy {
  color: var(--muted);
  line-height: 1.55;
}

.hero-actions,
.inline-actions,
.control-row,
.panel-actions,
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 18px;
}

.stats-card {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 14px 16px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1.3rem;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.sidebar,
.content {
  min-width: 0;
}

.panel {
  padding: 18px;
}

.panel + .panel {
  margin-top: 18px;
}

.panel-title,
.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-copy,
.mono-note,
.empty-note {
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  background: linear-gradient(135deg, var(--accent-soft), rgba(122, 198, 255, 0.12));
  border-color: rgba(103, 208, 139, 0.28);
}

.stack {
  display: grid;
  gap: 14px;
}

.button,
.ghost-button,
.danger-button,
.tiny-button {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, background 120ms ease;
}

.button:hover,
.ghost-button:hover,
.danger-button:hover,
.tiny-button:hover {
  transform: translateY(-1px);
}

.button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #07120c;
}

.ghost-button,
.tiny-button {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--border);
}

.danger-button {
  background: var(--alert-soft);
  color: #ffd7d1;
  border: 1px solid rgba(255, 127, 111, 0.28);
}

.tiny-button {
  padding: 6px 10px;
  font-size: 0.83rem;
}

.field,
.comment-input,
.search-input,
.ticker-input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(7, 13, 20, 0.64);
  color: var(--text);
  padding: 12px 14px;
}

.field:focus,
.comment-input:focus,
.search-input:focus,
.ticker-input:focus,
select:focus {
  outline: 2px solid rgba(122, 198, 255, 0.3);
  border-color: rgba(122, 198, 255, 0.3);
}

select {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(7, 13, 20, 0.64);
  color: var(--text);
  padding: 12px 14px;
}

.list-group {
  display: grid;
  gap: 8px;
}

.watchlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  padding-right: 8px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.watchlist-item-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  border-radius: 16px;
}

.watchlist-delete-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.watchlist-item:hover .watchlist-delete-btn {
  opacity: 1;
}

.watchlist-delete-btn:hover {
  background: var(--alert-soft);
  color: var(--alert);
}

.watchlist-item.active {
  border-color: rgba(103, 208, 139, 0.3);
  background: linear-gradient(135deg, rgba(103, 208, 139, 0.12), rgba(122, 198, 255, 0.08));
}

.watchlist-meta {
  display: grid;
  gap: 4px;
  text-align: left;
}

.watchlist-name,
.comment-author {
  font-weight: 700;
}

.watchlist-owner,
.subtle-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-shared,
.badge-buy {
  background: rgba(103, 208, 139, 0.14);
  color: #b8ffd0;
}

.badge-private {
  background: rgba(122, 198, 255, 0.14);
  color: #c5e7ff;
}

.badge-sell {
  background: rgba(255, 127, 111, 0.16);
  color: #ffd0ca;
}

.badge-none {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.kelly-positive {
  color: #3fb950;
  font-weight: 600;
}

.kelly-none {
  color: var(--muted);
}

.high-beta {
  color: var(--alert);
  font-weight: 600;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.info-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 8px 0 0;
}

.info-heading {
  margin: 0;
  font-size: 1rem;
  font-family: var(--mono);
  color: var(--text);
}

.info-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.info-table td {
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.info-table td:first-child {
  font-family: var(--mono);
  white-space: nowrap;
  color: var(--text);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chip-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

thead th {
  position: sticky;
  top: 0;
  background: #101a25;
  z-index: 1;
}

.sort-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sort-indicator {
  color: var(--muted);
  font-size: 0.8rem;
}

.sort-indicator.active {
  color: var(--text);
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

tbody tr.buy-row {
  background: rgba(103, 208, 139, 0.06);
}

tbody tr.sell-row {
  background: rgba(255, 127, 111, 0.05);
}

.ticker-button,
.ticker-link {
  border: 0;
  background: transparent;
  color: var(--focus);
  padding: 0;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.sector-group {
  display: grid;
  gap: 10px;
}

.sector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chart-card {
  padding: 12px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(7, 13, 20, 0.55);
  min-height: 520px;
}

.chart-host {
  width: 100%;
  height: 520px;
}

.comments {
  display: grid;
  gap: 10px;
}

.comment {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-time,
.mono-note {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.auth-screen {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 2.1rem;
}

.error-banner {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 127, 111, 0.12);
  border: 1px solid rgba(255, 127, 111, 0.22);
  color: #ffd7d1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--focus));
}

@media (max-width: 1100px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .hero-card,
  .stats-card,
  .panel,
  .auth-card {
    border-radius: 20px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}