:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #eef2f6;
  --line: #d8dee7;
  --text: #111827;
  --muted: #667085;
  --blue: #2563eb;
  --green: #087f5b;
  --red: #b42318;
  --amber: #b54708;
  --ink-soft: #344054;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.topbar p,
.detail-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.sync-form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input {
  height: 36px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 11px;
}

#handleInput {
  width: 190px;
}

.limit-field input {
  width: 88px;
}

button,
#providerLink {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #1d4ed8;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  padding: 0 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button[type="button"],
#providerLink {
  border-color: var(--line);
  background: #fff;
  color: var(--ink-soft);
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

main {
  padding: 18px 28px 28px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics > div,
.price-strip > div {
  min-height: 72px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
}

.metrics span,
.price-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.metrics strong,
.price-strip strong {
  font-size: 24px;
  line-height: 1.2;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(520px, 1.05fr) minmax(420px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.symbols-pane,
.detail-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.pane-head,
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.pane-head input {
  width: 160px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 238px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}

td {
  border-bottom: 1px solid #edf0f4;
  padding: 11px 12px;
  vertical-align: middle;
  white-space: nowrap;
}

tr.symbol-row {
  cursor: pointer;
}

tr.symbol-row:hover,
tr.symbol-row.active {
  background: #f0f6ff;
}

.symbol-cell {
  display: grid;
  gap: 3px;
}

.symbol-cell strong {
  font-size: 14px;
}

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

.positive {
  color: var(--green);
  font-weight: 700;
}

.negative {
  color: var(--red);
  font-weight: 700;
}

.neutral {
  color: var(--muted);
}

.detail-pane {
  overflow: hidden;
}

.chart {
  height: 240px;
  padding: 14px 16px 4px;
  border-bottom: 1px solid var(--line);
}

.chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.price-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.price-strip > div {
  min-height: 64px;
  background: var(--surface-soft);
}

.price-strip strong {
  font-size: 18px;
}

.posts-list {
  max-height: calc(100vh - 506px);
  min-height: 220px;
  overflow: auto;
  padding: 6px 0;
}

.post {
  display: grid;
  gap: 9px;
  padding: 14px 16px;
  border-bottom: 1px solid #edf0f4;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

.post-meta a {
  color: var(--blue);
  text-decoration: none;
}

.post-text,
.quote-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
  font-size: 14px;
}

.quote-text {
  border-left: 3px solid var(--line);
  color: var(--ink-soft);
  padding-left: 10px;
  font-size: 13px;
}

.post-stats {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 440px;
  background: #101828;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.24);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 1060px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sync-form {
    justify-content: flex-start;
  }

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

  .table-wrap,
  .posts-list {
    max-height: none;
  }
}

@media (max-width: 680px) {
  .topbar,
  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .metrics,
  .price-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .workspace {
    gap: 14px;
  }

  .symbols-pane,
  .detail-pane {
    border-radius: 6px;
  }

  #handleInput,
  .pane-head input {
    width: 100%;
  }

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

