:root {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1c2430;
  --border: #2d3744;
  --text: #eef2f6;
  --muted: #9aa7b7;
  --green: #24c782;
  --red: #ff5b6e;
  --yellow: #f4bd4f;
  --blue: #5aa9ff;
  --cyan: #4fd1c5;
  --violet: #9f7aea;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #11161d;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #2bc48a, #4f8cff 65%, #f4bd4f);
  color: #071018;
  font-weight: 900;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
  line-height: 1.2;
}

.brand p,
.panel p,
.connection-panel span,
.metric-card small {
  color: var(--muted);
}

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

.nav-item {
  height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item svg,
.icon-button svg,
.search-box svg,
.primary-button svg,
.ghost-button svg {
  width: 18px;
  height: 18px;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.connection-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
}

.connection-panel strong,
.connection-panel span {
  display: block;
  font-size: 13px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(244, 189, 79, 0.12);
}

.status-dot.live {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(36, 199, 130, 0.12);
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 91, 110, 0.12);
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  height: 42px;
  width: min(340px, 34vw);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel.full {
  width: 100%;
}

.panel.wide {
  min-height: 290px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 18px;
}

.panel p {
  margin-top: 4px;
  font-size: 13px;
}

.pill {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(79, 209, 197, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(79, 209, 197, 0.25);
  font-size: 12px;
  white-space: nowrap;
}

.heatmap,
.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.group-tile,
.symbol-card,
.feed-item,
.sector-row,
.alert-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111820;
}

.group-tile {
  min-height: 128px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.group-tile strong {
  font-size: 16px;
}

.group-tile .group-stats {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
}

.change {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.change.up {
  color: var(--green);
}

.change.down {
  color: var(--red);
}

.signal-feed,
.sector-list,
.alert-list {
  display: grid;
  gap: 10px;
}

.feed-item,
.sector-row,
.alert-row {
  padding: 12px;
}

.feed-top,
.sector-row,
.alert-row,
.symbol-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feed-item p,
.alert-row p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.buy {
  color: #092015;
  background: var(--green);
}

.tag.sell {
  color: #2a080e;
  background: var(--red);
}

.tag.neutral {
  color: #201704;
  background: var(--yellow);
}

.sector-row span {
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111820;
}

.segment {
  height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 0 11px;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  background: var(--surface-2);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.symbol-card {
  padding: 14px;
  min-height: 130px;
}

.symbol-card strong {
  font-size: 18px;
}

.symbol-card .price {
  display: block;
  margin-top: 12px;
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.symbol-card small {
  color: var(--muted);
}

.settings-panel {
  max-width: 980px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid input {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111820;
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.primary-button,
.ghost-button {
  height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  color: var(--text);
}

.primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #06111f;
  font-weight: 800;
}

.ghost-button {
  background: var(--surface-2);
}

.code-sample {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0a0e13;
  color: #c9d7e6;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.news-list {
  display: grid;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}

.news-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111820;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}

.news-row:hover {
  border-color: var(--cyan);
}

.news-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.news-top strong {
  font-size: 14px;
  color: var(--text);
}

.news-top span {
  color: var(--muted);
  font-size: 12px;
}

.news-title {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  text-decoration: none;
}

a.news-title:hover {
  color: var(--cyan);
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 86px 1fr;
  }

  .brand div:not(.brand-mark),
  .nav-item span,
  .connection-panel div {
    display: none;
  }

  .sidebar {
    align-items: center;
  }

  .nav-item {
    width: 48px;
    justify-content: center;
    padding: 0;
  }

  .connection-panel {
    padding: 14px;
  }

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

  .metric-grid,
  .heatmap,
  .watchlist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
  }

  .brand {
    min-width: 48px;
  }

  .nav-list {
    display: flex;
  }

  .connection-panel {
    margin-left: auto;
    margin-top: 0;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .topbar-actions,
  .search-box {
    width: 100%;
  }

  .metric-grid,
  .heatmap,
  .watchlist-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-direction: column;
  }

  .segmented {
    width: 100%;
    justify-content: space-between;
  }

  .segment {
    flex: 1;
  }
}
