/* ================================================================ tokens */
:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --surface-3: #e9edf5;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --grid: #e7ebf2;
  --axis: #cbd3df;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);

  --brand: #4f46e5;
  --brand-2: #0ea5e9;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #2563eb 55%, #0ea5e9 100%);
  --brand-soft: #eef0ff;
  --accent-text: #4338ca;

  /* chart series (validated palette slots 1–4) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;

  /* status: gain / loss */
  --good: #0ca30c;
  --good-text: #067306;
  --good-bg: #e8f6e8;
  --bad: #d03b3b;
  --bad-text: #b02e2e;
  --bad-bg: #fbeaea;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 24px -8px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, 0.25);
  --radius: 16px;
  --radius-sm: 10px;

  --hero-glow-1: rgba(79, 70, 229, 0.16);
  --hero-glow-2: rgba(14, 165, 233, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0a0d14;
    --surface: #121722;
    --surface-2: #19202e;
    --surface-3: #212a3b;
    --text: #f1f5f9;
    --text-2: #c2cad8;
    --muted: #8b96a8;
    --grid: #232b3a;
    --axis: #364055;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --brand-soft: rgba(99, 102, 241, 0.16);
    --accent-text: #a5b4fc;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --good-text: #3ccc3c;
    --good-bg: rgba(12, 163, 12, 0.14);
    --bad-text: #f47f7f;
    --bad-bg: rgba(208, 59, 59, 0.16);
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
    --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
    --hero-glow-1: rgba(79, 70, 229, 0.28);
    --hero-glow-2: rgba(14, 165, 233, 0.18);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0a0d14;
  --surface: #121722;
  --surface-2: #19202e;
  --surface-3: #212a3b;
  --text: #f1f5f9;
  --text-2: #c2cad8;
  --muted: #8b96a8;
  --grid: #232b3a;
  --axis: #364055;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --brand-soft: rgba(99, 102, 241, 0.16);
  --accent-text: #a5b4fc;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --good-text: #3ccc3c;
  --good-bg: rgba(12, 163, 12, 0.14);
  --bad-text: #f47f7f;
  --bad-bg: rgba(208, 59, 59, 0.16);
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
  --hero-glow-1: rgba(79, 70, 229, 0.28);
  --hero-glow-2: rgba(14, 165, 233, 0.18);
}

/* ================================================================ base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
/* Components set display:flex/grid; the hidden attribute must still win. */
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.num {
  font-variant-numeric: tabular-nums;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 720px) {
  .wrap {
    padding: 0 24px;
  }
}

/* ================================================================ top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--page) 80%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover {
  text-decoration: none;
}
.brand svg {
  flex: none;
  filter: drop-shadow(0 4px 10px rgba(79, 70, 229, 0.35));
}
.nav {
  display: flex;
  gap: 4px;
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
}
.nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
}
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}
.nav-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}
.search {
  position: relative;
  flex: 1;
  max-width: 440px;
  margin-left: auto;
}
.search input {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 38px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder {
  color: var(--muted);
}
.search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 18%, transparent);
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font: 600 11px/1 var(--font);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 6px;
  pointer-events: none;
}
.search input:focus ~ .search-kbd {
  display: none;
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-height: 64vh;
  overflow-y: auto;
  z-index: 40;
}
.search-results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.search-results li[aria-selected="true"],
.search-results li:hover {
  background: var(--surface-2);
}
.search-results .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.search-results .sym {
  font-weight: 700;
  font-size: 14px;
}
.search-results .nm {
  color: var(--text-2);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-results .tag {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.search-results .empty {
  color: var(--muted);
  cursor: default;
}
.icon-btn {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text-2);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

main {
  flex: 1;
  outline: none;
  padding-bottom: 72px;
}

/* ================================================================ shared */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.card h2,
.section-title {
  font-size: 17px;
  font-weight: 700;
}
.sub {
  color: var(--muted);
  font-size: 13px;
  margin: 2px 0 0;
}
.section {
  margin-top: 28px;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
  border: 1px solid var(--border);
}
.badge.brand {
  background: var(--brand-soft);
  color: var(--accent-text);
  border-color: transparent;
}
.up {
  color: var(--good-text);
}
.down {
  color: var(--bad-text);
}
.muted {
  color: var(--muted);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
}
.pill.up {
  background: var(--good-bg);
  color: var(--good-text);
}
.pill.down {
  background: var(--bad-bg);
  color: var(--bad-text);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  color: var(--text);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  border: 0;
  color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 6px 18px -6px rgba(79, 70, 229, 0.6);
}
.btn.primary:hover {
  filter: brightness(1.06);
}
.btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.btn.active {
  background: var(--brand-soft);
  color: var(--accent-text);
  border-color: transparent;
}
.state {
  padding: 64px 16px;
  text-align: center;
  color: var(--text-2);
}
.state h2 {
  font-size: 20px;
  color: var(--text);
  margin-bottom: 8px;
}
.state .btn {
  margin-top: 12px;
}
.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border: 3px solid var(--grid);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .spinner {
    animation-duration: 3s;
  }
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.segmented button {
  border: 0;
  background: none;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.segmented button:hover {
  color: var(--text);
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
select.select {
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 11px center;
  appearance: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* avatar: initials tile */
.avatar {
  --hue: 230;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  color: hsl(var(--hue) 65% 38%);
  background: hsl(var(--hue) 80% 95%);
  border: 1px solid hsl(var(--hue) 60% 88%);
}
:root[data-theme="dark"] .avatar {
  color: hsl(var(--hue) 85% 78%);
  background: hsl(var(--hue) 45% 18%);
  border-color: hsl(var(--hue) 40% 26%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar {
    color: hsl(var(--hue) 85% 78%);
    background: hsl(var(--hue) 45% 18%);
    border-color: hsl(var(--hue) 40% 26%);
  }
}
.avatar.sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 11px;
}
.avatar.lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 19px;
}

.spark {
  display: block;
  overflow: visible;
}
.spark .area {
  opacity: 0.12;
}
.spark.up {
  color: var(--good);
}
.spark.down {
  color: var(--bad);
}

/* ================================================================ home: hero */
.hero {
  position: relative;
  padding: 40px 0 8px;
  background: radial-gradient(900px 380px at 8% -20%, var(--hero-glow-1), transparent 65%),
    radial-gradient(800px 380px at 95% -10%, var(--hero-glow-2), transparent 65%);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--brand-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.5);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(12, 163, 12, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(12, 163, 12, 0);
  }
}
.hero h1 {
  font-size: clamp(30px, 4.6vw, 48px);
  font-weight: 800;
  letter-spacing: -0.035em;
  max-width: 18ch;
}
.grad-text {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 17px;
  max-width: 60ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.index-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.1fr);
  gap: 14px;
  margin-top: 28px;
}
.index-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.index-card .name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.index-card .val {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.index-card .row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.breadth .bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  gap: 2px;
  margin: 10px 0 8px;
  background: var(--surface-2);
}
.breadth .bar i {
  display: block;
}
.breadth .bar .adv {
  background: var(--good);
}
.breadth .bar .dec {
  background: var(--bad);
}
.breadth .legend-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}
.breadth .mood {
  font-size: 18px;
  font-weight: 700;
}

/* ================================================================ home: sectors & movers */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}
.sector-tile {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.12s, box-shadow 0.12s;
}
.sector-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.sector-tile:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.sector-tile .nm {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sector-tile .chg {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sector-tile .meta {
  font-size: 12px;
  color: var(--muted);
}
.sector-tile[data-tone="up-3"] {
  background: color-mix(in oklab, var(--good) 22%, var(--surface));
}
.sector-tile[data-tone="up-2"] {
  background: color-mix(in oklab, var(--good) 13%, var(--surface));
}
.sector-tile[data-tone="up-1"] {
  background: color-mix(in oklab, var(--good) 6%, var(--surface));
}
.sector-tile[data-tone="down-1"] {
  background: color-mix(in oklab, var(--bad) 6%, var(--surface));
}
.sector-tile[data-tone="down-2"] {
  background: color-mix(in oklab, var(--bad) 13%, var(--surface));
}
.sector-tile[data-tone="down-3"] {
  background: color-mix(in oklab, var(--bad) 22%, var(--surface));
}

.movers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.mover-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mover-list li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  margin: 0 -8px;
  border-radius: 12px;
  color: inherit;
}
.mover-list li a:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.mover-list .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mover-list .sym {
  font-weight: 700;
  font-size: 14px;
}
.mover-list .nm {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mover-list .px {
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

/* ================================================================ screener */
.screener-card {
  padding: 0;
  overflow: hidden;
}
.screener-top {
  padding: 22px 22px 12px;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  margin: 14px 0 4px;
  scrollbar-width: thin;
}
.chip {
  flex: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-2);
}
.chip:hover {
  background: var(--surface-2);
  color: var(--text);
}
.chip[aria-pressed="true"] {
  background: var(--text);
  color: var(--page);
  border-color: var(--text);
}
.chip .count {
  margin-left: 5px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-group > .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.result-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
}
.table-wrap {
  position: relative; /* contain visually-hidden (absolute) text so it can't widen the page */
  overflow-x: auto;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th,
table.data td {
  padding: 12px 12px;
  text-align: right;
  white-space: nowrap;
}
table.data th.left,
table.data td.left {
  text-align: left;
}
table.data thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
table.data thead th button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
table.data thead th button:hover {
  color: var(--text);
}
table.data thead th button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 2px;
}
table.data thead th[aria-sort] {
  color: var(--text);
}
table.data tbody tr {
  border-top: 1px solid var(--grid);
}
table.data tbody tr:first-child {
  border-top: 0;
}
table.screener tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
table.screener tbody tr:hover {
  background: var(--surface-2);
}
table.screener tbody tr.selected {
  background: color-mix(in oklab, var(--brand) 6%, var(--surface));
}
.col-pick {
  width: 44px;
  padding-right: 0 !important;
}
.pick {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
}
.company {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  max-width: 300px;
}
.company .txt {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.company a {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.company .sym {
  font-size: 12px;
  color: var(--muted);
}
.range-bar {
  position: relative;
  width: 84px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, color-mix(in oklab, var(--bad) 35%, var(--grid)), var(--grid) 50%, color-mix(in oklab, var(--good) 35%, var(--grid)));
  display: inline-block;
  vertical-align: middle;
}
.range-bar i {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 14px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--surface);
}
.trend-pill {
  font-size: 12px;
}
.table-foot {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--grid);
}

/* ================================================================ stock page */
.page-top {
  padding-top: 24px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}
.back:hover {
  color: var(--text);
}
.stock-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.stock-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--brand-grad);
}
.stock-id {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.stock-id h1 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  margin-bottom: 8px;
}
.stock-id .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.quote {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.quote .px {
  text-align: right;
}
.quote .price {
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.quote .chg-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.quote .mc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.verdicts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.verdict-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 4px 0 12px;
}
.verdict .body {
  flex: 1;
  min-width: 0;
}
.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.verdict .label {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.verdict p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}
.tone-good .label {
  color: var(--good-text);
}
.tone-bad .label {
  color: var(--bad-text);
}
.split {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.split .stat {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
}
.split .stat b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.gauge {
  flex: none;
  display: block;
}
.gauge .track {
  stroke: var(--axis);
  opacity: 0.55;
}
.gauge .val.pos {
  stroke: var(--good);
}
.gauge .val.neg {
  stroke: var(--bad);
}
.gauge .needle {
  fill: var(--surface);
  stroke-width: 3;
}
.gauge .needle.pos {
  stroke: var(--good);
}
.gauge .needle.neg {
  stroke: var(--bad);
}
.gauge .score {
  fill: var(--text);
  font-weight: 800;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}
.gauge .cap {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font);
}

.tags-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  align-items: start;
  margin-bottom: 16px;
}
.tags-card .k {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  padding-top: 4px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
}
.tag.good {
  background: var(--good-bg);
  color: var(--good-text);
}
.tag.bad {
  background: var(--bad-bg);
  color: var(--bad-text);
}
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid color-mix(in oklab, var(--brand) 18%, transparent);
}
.callout .ic {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface);
  font-size: 13px;
}
.callout b {
  color: var(--text);
}

/* chart */
.chart-card {
  margin-bottom: 16px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.key {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
}
.key-1 {
  background: var(--series-1);
}
.key-2 {
  background: var(--series-2);
}
.key-3 {
  background: var(--series-3);
}
.key-4 {
  background: var(--series-4);
}
.dot-key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}
.dot-key.key-1 {
  background: var(--series-1);
}
.dot-key.key-2 {
  background: var(--series-2);
}
.dot-key.key-3 {
  background: var(--series-3);
}
.dot-key.key-4 {
  background: var(--series-4);
}
.chart {
  position: relative;
  touch-action: pan-y;
}
.chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.chart svg:focus {
  outline: none;
}
.chart svg:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 4px;
}
.chart .grid {
  stroke: var(--grid);
  stroke-width: 1;
}
.chart .baseline {
  stroke: var(--axis);
  stroke-width: 1;
}
.chart .zero {
  stroke: var(--axis);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}
.chart .tick {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}
.chart .line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-width: 2;
}
.chart .s-1 {
  stroke: var(--series-1);
}
.chart .s-2 {
  stroke: var(--series-2);
}
.chart .s-3 {
  stroke: var(--series-3);
}
.chart .s-4 {
  stroke: var(--series-4);
}
.chart .thin {
  stroke-width: 1.5;
}
.chart .area {
  stroke: none;
}
.chart .end-label {
  fill: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
}
.chart .crosshair {
  stroke: var(--text-2);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart .dot {
  stroke: var(--surface);
  stroke-width: 2;
}
.chart .dot.s-1 {
  fill: var(--series-1);
}
.chart .dot.s-2 {
  fill: var(--series-2);
}
.chart .dot.s-3 {
  fill: var(--series-3);
}
.chart .dot.s-4 {
  fill: var(--series-4);
}
.tooltip {
  position: absolute;
  top: 0;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 10px 12px;
  font-size: 12px;
  min-width: 160px;
  z-index: 2;
}
.tooltip .date {
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.tooltip .row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.8;
}
.tooltip .row b {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.tooltip .row span:last-child {
  color: var(--text-2);
}
.chart-table {
  margin-top: 14px;
  font-size: 14px;
}
.chart-table summary {
  cursor: pointer;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 13px;
}
.chart-table .table-wrap {
  margin-top: 10px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* good / bad */
.pros-cons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}
.list-card {
  padding: 0;
  overflow: hidden;
}
.list-card > header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 16px;
}
.list-card.good > header {
  background: var(--good-bg);
  color: var(--good-text);
}
.list-card.bad > header {
  background: var(--bad-bg);
  color: var(--bad-text);
}
.list-card > header .count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface);
}
.list-card .signal-list,
.list-card .empty-list {
  padding: 4px 20px 12px;
}
.signal-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.signal-list li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 2px 12px;
  padding: 14px 0;
  border-top: 1px solid var(--grid);
}
.signal-list li:first-child {
  border-top: 0;
}
.icon {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.signal-list .icon {
  grid-row: span 2;
  margin-top: 1px;
}
.icon.good {
  background: var(--good);
}
.icon.bad {
  background: var(--bad);
}
.icon.neutral {
  background: var(--surface-3);
  color: var(--text-2);
}
.signal-list .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
}
.signal-list .head .val {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.signal-list .note {
  color: var(--text-2);
  font-size: 14px;
}
.signal-list .group {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  vertical-align: 1px;
}
.empty-list {
  color: var(--muted);
  margin: 0;
  padding: 16px 0;
}
details.neutral-card {
  margin-bottom: 16px;
}
details.neutral-card summary {
  cursor: pointer;
  font-weight: 700;
}
details.neutral-card .signal-list {
  margin-top: 8px;
}

.key-card {
  margin-bottom: 16px;
}
.kn-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.kn-summary > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 10px;
}
.metric {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
}
.metric.v-good {
  background: color-mix(in oklab, var(--good) 7%, var(--surface));
  border-color: color-mix(in oklab, var(--good) 24%, transparent);
}
.metric.v-bad {
  background: color-mix(in oklab, var(--bad) 7%, var(--surface));
  border-color: color-mix(in oklab, var(--bad) 24%, transparent);
}
.metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.metric .k {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-top: 3px;
}
.metric .v {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.metric .st {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-top: 2px;
}
.metric .st.good {
  color: var(--good-text);
}
.metric .st.bad {
  color: var(--bad-text);
}
.metric .s {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-strong);
}
.metric {
  cursor: pointer;
  transition: box-shadow 0.12s, transform 0.12s;
}
.metric:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.metric .k {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.info-btn {
  all: unset;
  cursor: pointer;
  flex: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: inline-grid;
  place-items: center;
  font: italic 700 10px/1 Georgia, "Times New Roman", serif;
  color: var(--muted);
}
.info-btn:hover {
  color: var(--accent-text);
}
.info-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* normal-range bar */
.range {
  margin-top: 10px;
}
.range-track {
  position: relative;
  height: 8px;
}
.range-zones {
  display: flex;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  gap: 2px;
}
.range-zones .seg {
  display: block;
  height: 100%;
}
.seg.good {
  background: color-mix(in oklab, var(--good) 60%, var(--surface));
}
.seg.neutral {
  background: var(--axis);
}
.seg.bad {
  background: color-mix(in oklab, var(--bad) 60%, var(--surface));
}
.range .marker {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 18px;
  margin-left: -2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--surface);
}
.range .marker.off-low,
.range .marker.off-high {
  width: 0;
  height: 0;
  margin-left: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}
.range .marker.off-high {
  border-left: 9px solid var(--text);
  margin-left: -9px;
}
.range .marker.off-low {
  border-right: 9px solid var(--text);
}
.range.compact {
  margin-top: 8px;
}
.range.compact .range-track {
  height: 5px;
}
.range.compact .marker {
  height: 12px;
  width: 3px;
}
.range-ticks {
  position: relative;
  height: 16px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.range-ticks span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}
.range-ends {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.range-now {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 8px 0 0;
}
.range-now .dot {
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--text);
}

/* info + guide dialogs */
body:has(dialog.info-dialog[open]) {
  overflow: hidden;
}
dialog.info-dialog {
  width: min(540px, calc(100vw - 32px));
  max-height: 86dvh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
dialog.info-dialog[open] {
  animation: info-in 0.18s ease-out;
}
dialog.info-dialog::backdrop {
  background: rgba(10, 13, 20, 0.45);
  backdrop-filter: blur(2px);
}
@keyframes info-in {
  from {
    transform: translateY(10px) scale(0.98);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog.info-dialog[open] {
    animation: none;
  }
}
.info-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--grid);
}
.info-head h2 {
  font-size: 20px;
  font-weight: 800;
}
.info-body {
  padding: 16px 20px 22px;
}
.info-body h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}
.info-body > p {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
}
.info-now {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
}
.info-now .k {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.info-now .v {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.info-verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-align: right;
}
.info-verdict.good {
  color: var(--good-text);
}
.info-verdict.bad {
  color: var(--bad-text);
}
.band-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.band-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-2);
  border: 1px solid transparent;
}
.band-list li b {
  color: var(--text);
}
.band-list li.current {
  background: var(--brand-soft);
  border-color: color-mix(in oklab, var(--brand) 25%, transparent);
  color: var(--text);
}
.band-list .here {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  white-space: nowrap;
}
.guide-intro {
  margin: 0 0 6px;
}
.guide-item {
  padding: 14px 0;
  border-top: 1px solid var(--grid);
}
.guide-item:first-of-type {
  border-top: 0;
}
.guide-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}
.guide-item p {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}
.guide-bands {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.guide-bands span {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
}
.guide-bands .tone-good {
  background: var(--good-bg);
  color: var(--good-text);
}
.guide-bands .tone-bad {
  background: var(--bad-bg);
  color: var(--bad-text);
}
@media (max-width: 640px) {
  dialog.info-dialog {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    max-height: 88dvh;
    border-radius: 20px 20px 0 0;
  }
}

.thumb {
  flex: none;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}
.thumb.good {
  background: var(--good);
}
.thumb.bad {
  background: var(--bad);
}
.thumb.neutral {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.lower {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}
.about p {
  margin: 0;
  color: var(--text-2);
}
.link-btn {
  border: 0;
  background: none;
  color: var(--accent-text);
  padding: 0;
  cursor: pointer;
  margin-top: 8px;
  font-weight: 600;
}

/* ================================================================ overall rating */
:root {
  --star: #f5a524;
  --rating-mid: #e3a008;
}
.rating-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 16px;
}
.rating-main {
  display: flex;
  align-items: center;
  gap: 22px;
}
.rating-main .label {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 2px 0 6px;
}
.rating-main.tone-good .label {
  color: var(--good-text);
}
.rating-main.tone-bad .label {
  color: var(--bad-text);
}
.rating-main p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-2);
  max-width: 34ch;
}
.rating-main .rank-line {
  margin-top: 10px;
  max-width: none;
}
.rating-main .rank-line:empty {
  display: none;
}
.rating-ring {
  flex: none;
}
.rating-ring .ring-track {
  stroke: var(--surface-2);
}
.rating-ring.tone-good .ring-val {
  stroke: var(--good);
}
.rating-ring.tone-neutral .ring-val {
  stroke: var(--rating-mid);
}
.rating-ring.tone-bad .ring-val {
  stroke: var(--bad);
}
.rating-ring .ring-num {
  fill: var(--text);
  font: 800 32px var(--font);
  letter-spacing: -0.03em;
}
.rating-ring .ring-cap {
  fill: var(--muted);
  font: 600 10px var(--font);
}
.stars {
  position: relative;
  display: inline-block;
  line-height: 1;
  letter-spacing: 2px;
  white-space: nowrap;
}
.stars-bg {
  color: var(--axis);
}
.stars-fg {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  color: var(--star);
}
.cat-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cat-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.cat-label {
  font-weight: 600;
  color: var(--text-2);
}
.cat-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.cat-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.cat-bar i.tone-good {
  background: var(--good);
}
.cat-bar i.tone-neutral {
  background: var(--rating-mid);
}
.cat-bar i.tone-bad {
  background: var(--bad);
}
.cat-val {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cat-val.na {
  grid-column: 2 / 4;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
}
.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
}
.rating-badge b {
  min-width: 30px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: var(--muted);
}
.rating-badge.tone-good b {
  background: var(--good);
}
.rating-badge.tone-neutral b {
  background: var(--rating-mid);
  color: #3a2600; /* white on amber is too faint */
}
.rating-badge.tone-bad b {
  background: var(--bad);
}

/* ================================================================ stock page layout + similar stocks */
.stock-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  grid-template-areas: "top side" "rest side";
  gap: 16px;
  align-items: start;
}
.area-top {
  grid-area: top;
  min-width: 0;
}
.area-top .rating-card {
  margin-bottom: 0;
}
.area-rest {
  grid-area: rest;
  min-width: 0;
}
.area-side {
  grid-area: side;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  border-radius: var(--radius);
}
/* Desktop only: the pinned sidebar leaves room for the compare tray. On narrow screens the
   sidebar isn't pinned, and a height cap there would make its content spill over the next card. */
@media (min-width: 1101px) {
  .has-tray .area-side {
    max-height: calc(100vh - 170px);
  }
}
.hero-rating {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 6px 12px 6px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.hero-rating:hover {
  background: var(--surface-3);
}
.hero-rating:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.hero-rating .k {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hero-rating .rating-badge {
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--text);
}
.hero-rating .rating-badge b {
  font-size: 14px;
  padding: 3px 8px;
}
.rating-badge.compact {
  padding: 0;
  background: none;
}
.sim-card {
  padding: 18px;
}
.sim-card .card-head {
  margin-bottom: 12px;
}
.sim-card .segmented {
  display: flex;
  margin-bottom: 6px;
}
.sim-card .segmented button {
  flex: 1;
}
.sim-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}
.sim-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--grid);
}
.sim-item:first-child {
  border-top: 0;
}
.sim-item.self {
  background: var(--brand-soft);
  border-radius: 12px;
  border-top-color: transparent;
}
.sim-item.self + .sim-item {
  border-top-color: transparent;
}
.sim-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-radius: 10px;
  color: inherit;
}
a.sim-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.sim-rank {
  width: 16px;
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.sim-row .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.sim-row .nm {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sim-row .meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.sim-row .meta b {
  color: var(--accent-text);
}
.sim-row .rt {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.sim-add,
.sim-add-spacer {
  flex: none;
  width: 30px;
  height: 30px;
}
.sim-add {
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  color: var(--accent-text);
  font-weight: 800;
  font-size: 15px;
}
.sim-add:hover {
  background: var(--surface-2);
}
.sim-add[aria-pressed="true"] {
  background: var(--good-bg);
  border-color: transparent;
  color: var(--good-text);
}
@media (max-width: 1100px) {
  .stock-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "side" "rest";
  }
  .area-side {
    position: static;
    max-height: none;
    overflow: visible;
  }
}
.cmp-rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

/* ================================================================ compare */
.compare-head {
  padding: 32px 0 8px;
  background: radial-gradient(800px 300px at 10% -30%, var(--hero-glow-1), transparent 65%),
    radial-gradient(700px 300px at 95% -20%, var(--hero-glow-2), transparent 65%);
}
.compare-head h1 {
  font-size: clamp(26px, 3.6vw, 36px);
  font-weight: 800;
}
.picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.pick-chip button {
  all: unset;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
}
.pick-chip button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.pick-chip button:focus-visible {
  outline: 2px solid var(--brand);
}
.add-stock {
  position: relative;
  width: 240px;
}
.add-stock input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 34px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  outline: none;
  font-size: 14px;
}
.add-stock input:focus {
  border-style: solid;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand) 18%, transparent);
}
.add-stock .plus {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}
.add-stock .search-results {
  min-width: 300px;
}
.suggest {
  margin-top: 22px;
}
.suggest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.suggest-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}
.suggest-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.suggest-card strong {
  font-size: 15px;
}
.suggest-card span {
  color: var(--muted);
  font-size: 13px;
}

.cmp-cards {
  display: grid;
  grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 16px;
}
.cmp-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cmp-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
}
.cmp-card.c-1::before {
  background: var(--series-1);
}
.cmp-card.c-2::before {
  background: var(--series-2);
}
.cmp-card.c-3::before {
  background: var(--series-3);
}
.cmp-card.c-4::before {
  background: var(--series-4);
}
.cmp-card .id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cmp-card .id .txt {
  min-width: 0;
}
.cmp-card .id a {
  color: var(--text);
  font-weight: 700;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-card .id .sym {
  font-size: 12px;
  color: var(--muted);
}
.cmp-card .px {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.cmp-card .px b {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.mini-gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mini-gauge {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}
.mini-gauge .k {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mini-gauge .v {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}
.mini-gauge.tone-good .v {
  color: var(--good-text);
}
.mini-gauge.tone-bad .v {
  color: var(--bad-text);
}
.awards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}
.award {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #854d0e;
}
:root[data-theme="dark"] .award {
  background: rgba(234, 179, 8, 0.16);
  color: #fcd34d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .award {
    background: rgba(234, 179, 8, 0.16);
    color: #fcd34d;
  }
}
.cmp-card .full {
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
}

.winner-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--brand-grad);
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.55);
}
.winner-banner b {
  font-weight: 800;
}
.winner-banner .trophy {
  font-size: 20px;
}

table.h2h th,
table.h2h td {
  text-align: right;
}
table.h2h th:first-child,
table.h2h td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  font-weight: 600;
  color: var(--text-2);
}
table.h2h thead th:first-child {
  background: var(--surface-2);
  z-index: 2;
}
table.h2h thead th {
  font-size: 13px;
  color: var(--text);
}
table.h2h .stock-th {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}
table.h2h tr.group td {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 8px;
  padding-bottom: 8px;
}
table.h2h td.best {
  font-weight: 800;
  color: var(--good-text);
}
table.h2h td.best::after {
  content: " ★";
  font-size: 11px;
}
table.h2h tr.wins td {
  font-weight: 800;
  color: var(--text);
  background: var(--surface-2);
}
.h2h-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
}
.sw-grid {
  display: grid;
  grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr));
  gap: 14px;
}
.sw-col h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin-bottom: 10px;
}
.sw-col .tag-list + .tag-list {
  margin-top: 8px;
}

/* ================================================================ compare tray + toast */
.compare-tray {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: 18px;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 24px);
}
.compare-tray .lbl {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.tray-items {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.tray-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.tray-item button {
  all: unset;
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.tray-item button:hover {
  background: var(--surface-3);
  color: var(--text);
}
.tray-slot {
  width: 64px;
  height: 28px;
  border-radius: 999px;
  border: 1.5px dashed var(--border-strong);
  flex: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--text);
  color: var(--page);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 32px);
}

/* ================================================================ stock list drawer */
body:has(dialog.drawer[open]) {
  overflow: hidden;
}
dialog.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(540px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  flex-direction: column;
}
dialog.drawer[open] {
  display: flex;
  animation: drawer-in 0.22s ease-out;
}
dialog.drawer::backdrop {
  background: rgba(10, 13, 20, 0.45);
  backdrop-filter: blur(2px);
}
@keyframes drawer-in {
  from {
    transform: translateX(28px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog.drawer[open] {
    animation: none;
  }
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 14px;
}
.drawer-head h2 {
  font-size: 24px;
  font-weight: 800;
}
.drawer-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 20px 14px;
}
.drawer-summary .st {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 8px 10px;
}
.drawer-summary .k {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.drawer-summary .v {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.drawer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--grid);
}
.drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.drawer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--grid);
}
.drawer-item:first-child {
  border-top: 0;
}
.drawer-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
  color: inherit;
}
.drawer-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.drawer-row .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.drawer-row .nm {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-row .meta {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-row .px {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 14px;
}
.drawer-empty {
  padding: 24px 8px;
  color: var(--text-2);
}
.drawer-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--grid);
}
/* home cards that open a list */
.tile-btn {
  font: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.tile-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.tile-btn .open-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
  margin-top: 6px;
}
@media (max-width: 640px) {
  dialog.drawer {
    inset: auto 0 0 0;
    width: 100vw;
    height: 88dvh;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }
  @keyframes drawer-in {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }
  .drawer-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .drawer-row .spk {
    display: none;
  }
}

/* ================================================================ breadcrumbs, Q&A, list pages */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.crumbs a {
  color: var(--text-2);
}
.crumbs > span[aria-hidden] {
  margin: 0 6px;
}
.crumbs [aria-current] {
  color: var(--text);
}
.faq-card {
  margin-bottom: 16px;
}
.faq-item {
  border-top: 1px solid var(--grid);
  padding: 12px 0;
}
.faq-item:first-of-type {
  border-top: 0;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  list-style-position: outside;
}
.faq-item p {
  margin: 8px 0 0;
  color: var(--text-2);
}
.list-page h1 {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 800;
}
.list-page .drawer-summary,
.list-page .drawer-controls {
  padding-left: 0;
  padding-right: 0;
}
.list-page .drawer-controls {
  border-bottom: 0;
}
a.tag:hover {
  text-decoration: none;
  background: var(--surface-3);
}

/* Server-rendered content (what search engines read first); the app replaces it on load. */
.ssr {
  padding-top: 24px;
  padding-bottom: 32px;
  color: var(--text-2);
}
.ssr h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}
.ssr h2 {
  font-size: 19px;
  color: var(--text);
  margin: 24px 0 8px;
}
.ssr h3 {
  font-size: 15px;
  color: var(--text);
  margin: 14px 0 4px;
}
.ssr table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  margin: 8px 0;
}
.ssr th,
.ssr td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--grid);
}
.ssr-note {
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
}

/* Footer: browse links on every page */
.footer-links {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px 32px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.footer-links h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.footer-links h2:not(:first-child) {
  margin-top: 14px;
}
.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.footer-links a {
  color: var(--text-2);
  font-size: 13px;
}
@media (max-width: 720px) {
  .footer-links {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ================================================================ footer */
.disclaimer {
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  padding: 20px 0 28px;
}
.disclaimer p {
  margin: 0;
  max-width: 90ch;
}

/* ================================================================ responsive */
@media (max-width: 1000px) {
  .index-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cmp-cards,
  .sw-grid {
    grid-template-columns: repeat(min(var(--n, 2), 2), minmax(0, 1fr));
  }
}
@media (max-width: 860px) {
  .verdicts,
  .pros-cons,
  .lower,
  .movers,
  .rating-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .col-sector,
  .col-range,
  .col-spark {
    display: none;
  }
  .nav a[data-nav="home"] {
    display: none;
  }
}
@media (max-width: 640px) {
  .topbar-inner {
    gap: 8px;
  }
  .brand span,
  .search-kbd {
    display: none;
  }
  .nav a {
    padding: 8px;
  }
  .card {
    padding: 16px;
  }
  .screener-top {
    padding: 16px 16px 8px;
  }
  .hero {
    padding-top: 28px;
  }
  .index-card .val {
    font-size: 18px;
  }
  .index-card .spark {
    display: none;
  }
  .quote,
  .quote .px {
    text-align: left;
  }
  .quote .chg-row {
    justify-content: flex-start;
  }
  .cmp-cards,
  .sw-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .add-stock {
    width: 100%;
  }
  .rating-main {
    gap: 14px;
  }
  .rating-main .label {
    font-size: 22px;
  }
  .cat-row {
    grid-template-columns: 110px minmax(0, 1fr) 36px;
    gap: 8px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .metric {
    padding: 10px 11px;
  }
  .metric .v {
    font-size: 16px;
  }
  .col-pe,
  .col-1y,
  .col-mcap {
    display: none;
  }
  table.data th,
  table.data td {
    padding: 11px 8px;
  }
  table.screener td.col-company {
    white-space: normal;
  }
  .company {
    min-width: 0;
    max-width: 150px;
    gap: 8px;
  }
  .company .avatar {
    display: none;
  }
  .trend-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .compare-tray {
    left: 12px;
    right: 12px;
    transform: none;
    bottom: 12px;
  }
  .compare-tray .lbl,
  .tray-slot {
    display: none;
  }
}

/* ================================================================ stock header: buttons + phone layout */
.stock-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-ic {
  display: none;
}

@media (max-width: 640px) {
  /* Top bar: icon-only Compare link so the search box gets room. */
  .nav-ic {
    display: block;
  }
  .nav-label {
    display: none;
  }
  .nav a[data-nav="compare"] {
    position: relative;
    padding: 10px;
  }
  .nav a[data-nav="compare"] .nav-count {
    position: absolute;
    top: 0;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
  }

  /* Stock header: the avatar sits beside the name only; badges, rating and price use the full width. */
  .stock-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-top: 20px;
  }
  .stock-id {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
  }
  .stock-id > div {
    display: contents;
  }
  .stock-id .avatar.lg {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    font-size: 16px;
  }
  .stock-id h1 {
    margin: 0;
    font-size: 21px;
    line-height: 1.2;
  }
  .stock-id .meta,
  .stock-id .hero-rating {
    grid-column: 1 / -1;
  }
  .hero-rating {
    width: 100%;
    margin-top: 0;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 12px;
  }
  .hero-rating .stars {
    margin-left: auto;
  }
  .quote {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .stock-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .stock-actions .btn {
    width: 100%;
    height: 42px;
    padding: 0 10px;
    font-size: 13px;
  }

  /* Rating card: a smaller ring so the label and stars fit beside it. */
  .rating-ring {
    width: 104px;
    height: 104px;
  }
  .rating-main .label {
    font-size: 20px;
  }
  .rating-main p {
    font-size: 12.5px;
  }
}

/* ================================================================ stock list panel: one scroll area */
.drawer-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer-scroll > .drawer-controls {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 10px;
  background: var(--surface);
}
.drawer-scroll > .drawer-list {
  padding: 4px 12px 12px;
}

@media (max-width: 640px) {
  dialog.drawer {
    height: 92dvh;
  }
  dialog.drawer .drawer-head {
    padding: 14px 16px 8px;
  }
  dialog.drawer .drawer-head h2 {
    font-size: 20px;
  }
  dialog.drawer .drawer-head .sub {
    font-size: 12px;
  }
  dialog.drawer .drawer-head .icon-btn {
    width: 36px;
    height: 36px;
  }
  /* All four numbers on one compact line. */
  .drawer-summary,
  dialog.drawer .drawer-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  dialog.drawer .drawer-summary {
    padding: 0 16px 6px;
  }
  .drawer-summary .st {
    padding: 6px 8px;
    border-radius: 10px;
  }
  .drawer-summary .k {
    font-size: 11px;
  }
  .drawer-summary .k-more {
    display: none;
  }
  .drawer-summary .v {
    font-size: 14px;
    white-space: nowrap;
  }
  /* Sort / filter buttons stay on one line and scroll sideways if needed. */
  .drawer-controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .drawer-controls::-webkit-scrollbar {
    display: none;
  }
  dialog.drawer .drawer-controls {
    padding: 8px 16px;
  }
  .drawer-controls .segmented {
    flex: none;
  }
  .drawer-controls .segmented button {
    padding: 5px 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .drawer-row {
    gap: 10px;
    padding: 8px 4px;
  }
  dialog.drawer .drawer-scroll > .drawer-list {
    padding: 0 8px 8px;
  }
  /* Footer buttons side by side instead of stacked. */
  dialog.drawer .drawer-foot {
    flex-wrap: nowrap;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }
  dialog.drawer .drawer-foot > * {
    flex: 1;
    min-width: 0;
  }
}
