:root {
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --bg-row: #181818;
  --border: #1f1f1f;
  --border-strong: #2c2c2c;
  --text: #f2f2f2;
  --text-dim: #b4b4b4;
  --text-faint: #777;
  --accent: #ff7a00;
  --accent-soft: rgba(255, 122, 0, 0.12);
  --warn: #d97706;
  --up: #22c55e;
  --down: #ef4444;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Consolas", "Roboto Mono", Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --maxw: 1400px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

/* === Topbar === */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  padding: 10px 28px;
  background: #000;
  border-bottom: 1px solid var(--border-strong);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__brand { justify-self: start; }
.topbar__nav { justify-self: center; }
.topbar__status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.16em;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.55);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.status-text { color: var(--up); font-weight: 600; }
.status-time { color: var(--text-faint); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand__mark {
  background: var(--accent);
  color: #000;
  padding: 3px 8px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.brand__name {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--text);
}

.topbar__nav {
  display: flex;
  gap: 24px;
  justify-content: center;
}
.topbar__nav a {
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.16em;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  line-height: 1;
}
.topbar__nav a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* === Ticker (compact, body-text sized) === */
.ticker {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 36px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #0f0f0f, #0a0a0a);
}
.quote {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--mono);
}
.quote__label {
  font-size: 18px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 500;
}
.quote__sub {
  font-size: 14px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  opacity: 0.75;
}
.quote__value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
.quote__delta {
  font-size: 18px;
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.quote__delta.up   { color: var(--up);   background: rgba(34, 197, 94, 0.12); }
.quote__delta.down { color: var(--down); background: rgba(239, 68, 68, 0.12); }

/* === Layout === */
.layout {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding: 40px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 26px 32px;
  border-bottom: 1px solid var(--border-strong);
}
.panel__title {
  margin: 0;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text);
  text-transform: uppercase;
}
.panel__hint {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-weight: 600;
}
.panel__hint--warn {
  color: var(--warn);
  border-color: var(--warn);
}

/* === Pager === */
.pager {
  display: flex;
  align-items: center;
  gap: 18px;
}
.pager__label {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  min-width: 110px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.pager__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: all 0.12s ease;
  border-radius: 3px;
}
.pager__btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pager__btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.pager__btn[hidden] { display: none; }

/* === Data table === */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
}
.data-table th,
.data-table td {
  padding: 20px 28px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table th {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  background: #0c0c0c;
  text-transform: uppercase;
}
.data-table td.num,
.data-table th.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr:hover { background: var(--bg-row); }
.data-table .rank {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 16px;
}
.data-table .ticker-cell {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 16px;
}
.data-table .company-cell {
  color: var(--text);
  font-weight: 500;
  font-size: 17px;
  white-space: normal;
  line-height: 1.35;
}
.company-cell__name {
  color: var(--text);
  font-weight: 500;
}
.company-cell__summary {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 400;
  margin-top: 4px;
  font-family: var(--sans);
}
.data-table .country-cell {
  font-size: 23px;
  line-height: 1;
  letter-spacing: 0;
}

/* === Filings table — reuses .data-table for visual consistency with holdings === */
.data-table--clickable tbody tr {
  cursor: pointer;
}
.data-table .source-cell {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.data-table .date-cell {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* === Stories === */
.stories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 28px;
}
.story {
  position: relative;
  background: #0c0c0c;
  border: 1px solid var(--border-strong);
  padding: 28px 30px 56px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  max-height: 340px;
  overflow: hidden;
  transition: max-height 0.45s ease, background 0.2s ease;
}
.story:hover { background: #111; }
.story.is-expanded {
  max-height: 6000px;
}
.story::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  height: 90px;
  background: linear-gradient(to bottom, transparent, #0c0c0c 90%);
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.story:hover::after {
  background: linear-gradient(to bottom, transparent, #111 90%);
}
.story.is-expanded::after { opacity: 0; }
.story__expand {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 30px;
  background: #0c0c0c;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
}
.story:hover .story__expand { background: #111; }
.story:not(.is-expanded) .story__expand::before { content: "READ MORE →"; }
.story.is-expanded .story__expand::before { content: "← COLLAPSE"; }

.story__kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 600;
}
.story__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}
.story__meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}
.story__body p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-dim);
}
.story__body p:last-child { margin-bottom: 0; }

@media (max-width: 960px) {
  .stories { grid-template-columns: 1fr; padding: 18px; gap: 18px; }
  .story { padding: 22px 22px 48px; max-height: 300px; }
}

/* === Articles === */
.articles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1px;
  background: var(--border);
}
.article {
  background: var(--bg-elev);
  padding: 32px 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
}
.article__kicker {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 600;
}
.article__title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
}
.article__excerpt {
  margin: 0;
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.6;
}
.article__meta {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

/* === Footer === */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 36px;
  border-top: 1px solid var(--border-strong);
  background: #000;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
}
.footer__legal,
.footer__meta { letter-spacing: 0.12em; white-space: nowrap; }

.loading {
  text-align: center;
  color: var(--text-faint);
  padding: 48px !important;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.18em;
}

/* === Responsive === */
@media (max-width: 1024px) {
  .layout { padding: 24px; gap: 24px; }
  .ticker { padding: 12px 20px; gap: 24px; }
  .data-table th, .data-table td { padding: 16px 20px; }
  .topbar { padding: 10px 20px; gap: 20px; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar__nav { gap: 16px; }
  .topbar__nav a { font-size: 13px; letter-spacing: 0.12em; }
  .brand__name { font-size: 12px; }
  .brand__mark { font-size: 11px; padding: 3px 7px; }
  .topbar__status { font-size: 10px; gap: 6px; letter-spacing: 0.1em; }
  .status-time { display: none; }

  .ticker {
    padding: 9px 10px;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: center;
  }
  .quote { gap: 4px; min-width: 0; flex-shrink: 1; }
  .quote__label { font-size: 10px; letter-spacing: 0.06em; gap: 3px; }
  .quote__sub { display: none; }
  .quote__value { font-size: 11px; letter-spacing: -0.01em; }
  .quote__delta { font-size: 10px; padding: 1px 4px; }

  .panel__head { padding: 16px 16px; }
  .panel__title { font-size: 12px; letter-spacing: 0.14em; }
  .pager__btn { width: 34px; height: 34px; }
  .pager__label { font-size: 12px; min-width: 80px; }

  /* Tables: fit within viewport, no horizontal scroll */
  .table-wrap { overflow-x: hidden; }
  .data-table { font-size: 13px; table-layout: fixed; width: 100%; }
  .data-table th, .data-table td { padding: 10px 6px; }
  .data-table th { font-size: 10px; letter-spacing: 0.1em; }
  .data-table th:first-child,
  .data-table td:first-child { padding-left: 12px; }
  .data-table th:last-child,
  .data-table td:last-child { padding-right: 12px; }
  .data-table .rank { font-size: 12px; }
  .data-table .ticker-cell { font-size: 12px; }
  .data-table .company-cell { font-size: 13px; }
  .company-cell__summary { font-size: 11px; }
  .data-table .country-cell { font-size: 16px; }
  .data-table .source-cell { font-size: 11px; letter-spacing: 0.05em; }
  .data-table .date-cell { font-size: 12px; }

  .layout { padding: 14px; gap: 14px; }
  .story__title { font-size: 17px; }
  .story__body p { font-size: 13px; line-height: 1.6; }
  .story { padding: 20px 18px 48px; max-height: 280px; }
  .stories { gap: 14px; padding: 14px; }
  .footer {
    padding: 16px 16px;
    font-size: 11px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    letter-spacing: 0.1em;
  }
  .footer__legal,
  .footer__meta { white-space: normal; }
}

@media (max-width: 480px) {
  .topbar__nav { gap: 12px; }
  .topbar__nav a { font-size: 12px; letter-spacing: 0.1em; }
  .topbar__status { display: none; }
  .ticker { gap: 7px; padding: 8px 8px; }
  .quote { gap: 3px; }
  .quote__value { font-size: 10px; }
  .quote__delta { font-size: 9px; padding: 1px 3px; }
  .quote__label { font-size: 9px; }
  .topbar__status { font-size: 9px; gap: 5px; letter-spacing: 0.1em; }
  .status-dot { width: 6px; height: 6px; }
  .data-table th:nth-child(1),
  .data-table td:nth-child(1) { display: none; }
  .stories { grid-template-columns: 1fr; }
}
