:root {
  --bg-0: #0c1117;
  --bg-1: #111923;
  --bg-2: #1a2633;
  --line: #2b3b4d;
  --text: #e8eef5;
  --text-dim: #a6b4c4;
  --accent: #53a3ff;
  --accent-soft: rgba(83, 163, 255, 0.16);
  --good: #63d1a2;
  --warn: #f2c56d;
  --chip: #1d2b39;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 0%, #1e3044 0%, transparent 40%),
    radial-gradient(circle at 85% 0%, #173128 0%, transparent 40%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.page-shell {
  width: min(1360px, 96vw);
  height: calc(100vh - 20px);
  margin: 10px auto;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  min-height: 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--text-dim);
}

.delay-notice {
  margin: 10px 0 0;
  color: #ffda88;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.refresh-btn {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.refresh-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.logout-link {
  margin-top: 8px;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.refresh-wrap {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: rgba(16, 24, 34, 0.86);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 188px;
}

.refresh-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.refresh-wrap .refresh-btn {
  margin-top: 8px;
}

.refresh-label {
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.refresh-time {
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
}

.controls {
  background: rgba(15, 22, 31, 0.92);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.search-wrap input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 10px 12px;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
}

.chip-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
  align-items: start;
}

.filter-section {
  align-self: start;
}

.chip-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.chip-title {
  margin: 0 0 6px;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.info-tip-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.68rem;
  font-family: "IBM Plex Mono", monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.info-tip-content {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: min(360px, 70vw);
  background: #152130;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--text);
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: normal;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 20;
}

.info-tip:hover .info-tip-content,
.info-tip:focus-visible .info-tip-content {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips.chips-collapsed {
  overflow: hidden;
}

.chip-toggle {
  margin-top: 6px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  cursor: pointer;
}

.chip {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text-dim);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 5px 9px;
  cursor: pointer;
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.table-shell {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: rgba(11, 17, 25, 0.94);
  min-height: 0;
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  text-align: left;
  background: #152130;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody td {
  border-bottom: 1px solid rgba(43, 59, 77, 0.7);
  padding: 10px;
  vertical-align: top;
  font-size: 0.9rem;
}

tbody tr:hover {
  background: rgba(83, 163, 255, 0.08);
}

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

a:hover {
  text-decoration: underline;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.ticker-empty {
  color: var(--text-dim);
}

.pill {
  display: inline-block;
  background: rgba(242, 197, 109, 0.12);
  border: 1px solid rgba(242, 197, 109, 0.38);
  color: #f9d48a;
  font-size: 0.78rem;
  border-radius: 8px;
  padding: 3px 8px;
}

.market-cap-value {
  color: var(--text);
}

.market-cap-band {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.summary-list {
  margin: 0;
  padding-left: 16px;
}

.summary-list li {
  margin-bottom: 4px;
}

.expand-btn {
  margin-top: 6px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  cursor: pointer;
}

.state-message {
  padding: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
}

.scroll-sentinel {
  height: 1px;
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 920px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .page-shell {
    height: auto;
    margin: 20px auto 28px;
    display: block;
  }

  .chip-groups {
    grid-template-columns: 1fr;
  }

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

  .refresh-wrap {
    width: fit-content;
  }
}
