:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f0f4f7;
  --text: #202733;
  --muted: #6b7280;
  --border: #d9dee6;
  --primary: #2563eb;
  --positive: #c64949;
  --negative: #118a74;
  --line: #2e6dd8;
  --shadow: 0 16px 32px rgba(31, 41, 55, 0.08);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0f1218;
  --surface: #151a23;
  --surface-soft: #1e2633;
  --text: #eef2f7;
  --muted: #9aa4b2;
  --border: #303949;
  --primary: #5b8cff;
  --positive: #ff6b6b;
  --negative: #42c6a7;
  --line: #76a7ff;
  --shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.trend-popout-open {
  overflow: hidden;
}

body.tip-dialog-open {
  overflow: hidden;
}

body.help-panel-open {
  overflow: hidden;
}

body.question-dialog-open {
  overflow: hidden;
}

button,
select {
  font: inherit;
}

button {
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
}

button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

select {
  min-width: 180px;
  max-width: 280px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
}

.app-shell {
  width: min(1760px, calc(100vw - 32px));
  margin: 22px auto 36px;
  position: relative;
}

.copyright-line {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
  opacity: 0.72;
  text-align: center;
}

.copyright-line span {
  overflow-wrap: anywhere;
}

.copyright-line span + span::before {
  content: " · ";
  color: var(--border);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
  padding-right: 226px;
}

.topbar-content {
  min-width: 0;
}

h1 {
  margin: 0 0 5px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-row h1 {
  margin-bottom: 0;
}

.support-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 560px;
  min-width: min(100%, 390px);
  max-width: min(760px, 52vw);
}

.support-row .thanks-ticker {
  flex: 1 1 auto;
  width: auto;
  min-width: 260px;
}

.support-row .tip-button {
  flex: 0 0 auto;
}

.support-row .featured-thanks {
  flex: 0 0 auto;
}

.featured-thanks {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 31px;
  padding: 0 13px;
  overflow: hidden;
  border: 1px solid rgba(184, 116, 18, 0.82);
  border-radius: 999px;
  background:
    linear-gradient(110deg, rgba(255, 232, 150, 0.98), rgba(255, 255, 255, 0.96) 40%, rgba(255, 207, 95, 0.94)),
    var(--surface);
  color: #6f3f00;
  box-shadow:
    0 0 0 1px rgba(255, 231, 145, 0.42),
    0 10px 28px rgba(184, 116, 18, 0.22);
  white-space: nowrap;
}

.featured-thanks::after {
  content: "";
  position: absolute;
  inset: -22px auto -22px -42%;
  width: 38%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.86), transparent);
  transform: skewX(-18deg);
  animation: thanks-shine 4.8s ease-in-out infinite;
  pointer-events: none;
}

.featured-thanks-label,
.featured-thanks-name {
  position: relative;
  z-index: 1;
}

.featured-thanks-label {
  color: #9a5b00;
  font-size: 11px;
  font-weight: 800;
}

.featured-thanks-name {
  color: #4c2a00;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.thanks-ticker {
  position: relative;
  display: flex;
  align-items: center;
  width: min(460px, 42vw);
  min-width: 300px;
  height: 31px;
  overflow: hidden;
  border: 1px solid rgba(230, 169, 45, 0.65);
  border-radius: 999px;
  background:
    linear-gradient(110deg, rgba(255, 247, 213, 0.96), rgba(255, 255, 255, 0.96) 45%, rgba(232, 243, 255, 0.96)),
    var(--surface);
  box-shadow: 0 0 0 1px rgba(255, 219, 117, 0.32), 0 10px 28px rgba(206, 148, 35, 0.18);
}

.thanks-ticker::after {
  content: "";
  position: absolute;
  inset: -24px auto -24px -35%;
  width: 34%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  transform: skewX(-18deg);
  animation: thanks-shine 3.6s ease-in-out infinite;
  pointer-events: none;
}

.thanks-ticker-label {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 0 10px 0 12px;
  color: #8c5c00;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border-right: 1px solid rgba(230, 169, 45, 0.45);
}

.thanks-ticker-window {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.thanks-ticker-window::before,
.thanks-ticker-window::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 28px;
  pointer-events: none;
}

.thanks-ticker-window::before {
  left: 0;
  background: linear-gradient(90deg, rgba(255, 250, 229, 0.98), transparent);
}

.thanks-ticker-window::after {
  right: 0;
  background: linear-gradient(270deg, rgba(235, 244, 255, 0.98), transparent);
}

.thanks-ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-width: max-content;
  padding-left: 16px;
  animation: thanks-scroll 42s linear infinite;
  will-change: transform;
}

.thanks-ticker-track span {
  color: #3a4251;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.thanks-ticker:hover .thanks-ticker-track {
  animation-play-state: paused;
}

.tip-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 31px;
  padding: 0 12px;
  overflow: hidden;
  border-color: rgba(219, 119, 30, 0.7);
  border-radius: 999px;
  background:
    linear-gradient(110deg, rgba(255, 229, 155, 0.98), rgba(255, 255, 255, 0.95) 42%, rgba(255, 210, 226, 0.98)),
    var(--surface);
  color: #7d3b00;
  box-shadow: 0 9px 22px rgba(219, 119, 30, 0.22);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.tip-button::after {
  content: "";
  position: absolute;
  inset: -20px auto -20px -45%;
  width: 42%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  transform: skewX(-18deg);
  animation: thanks-shine 3s ease-in-out infinite;
  pointer-events: none;
}

.tip-button-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  color: #c2410c;
  font-size: 12px;
  line-height: 1;
}

.tip-backdrop[hidden],
.tip-dialog[hidden] {
  display: none;
}

.tip-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(32, 39, 51, 0.42);
  backdrop-filter: blur(5px);
}

.tip-dialog {
  position: fixed;
  inset: 0;
  z-index: 61;
  display: grid;
  place-items: center;
  padding: 22px;
  pointer-events: none;
}

.tip-card {
  position: relative;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid rgba(219, 119, 30, 0.32);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(32, 39, 51, 0.24);
  padding: 20px;
  pointer-events: auto;
}

.tip-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.tip-kicker {
  width: fit-content;
  margin-bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fff4cc;
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
}

.tip-card h2 {
  margin: 0 64px 6px 0;
  font-size: 20px;
  letter-spacing: 0;
}

.tip-title-mobile {
  display: none;
}

.tip-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.tip-mobile-note {
  display: none;
}

.tip-mobile-pay {
  display: none;
}

.tip-mobile-pay-button {
  height: 48px;
  border-color: #1677ff;
  border-radius: 8px;
  background: #1677ff;
  color: #ffffff;
  font-size: 15px;
  font-weight: 750;
}

.tip-mobile-pay-button:hover,
.tip-mobile-pay-button:focus-visible {
  border-color: #0958d9;
  background: #0958d9;
}

.tip-mobile-pay-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.tip-mobile-pay-status:empty {
  display: none;
}

.tip-mobile-pay-status.is-active {
  color: #0958d9;
  font-weight: 650;
}

.tip-qr-fallback {
  height: 40px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.tip-qr-panel {
  display: block;
}

.tip-qr {
  display: block;
  width: 100%;
  max-height: min(560px, 68vh);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

@keyframes thanks-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes thanks-shine {
  0% {
    left: -35%;
  }
  46%,
  100% {
    left: 112%;
  }
}

.site-brand {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.meta-line,
.status-line {
  color: var(--muted);
}

.topbar .meta-line {
  font-size: 12px;
  line-height: 1.35;
}

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

.theme-toggle.is-dark {
  border-color: #f6c453;
  color: #f8d97a;
}

.global-page-controls {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100vw - 32px);
}

.global-page-controls button {
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.12);
  white-space: nowrap;
}

.tooltip-toggle {
  min-width: 96px;
}

.tooltip-toggle.is-off {
  color: var(--muted);
}

body.theme-dark .global-page-controls button {
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

body.theme-dark .thanks-ticker {
  border-color: rgba(246, 196, 83, 0.45);
  background:
    linear-gradient(110deg, rgba(76, 55, 18, 0.92), rgba(21, 26, 35, 0.96) 45%, rgba(22, 45, 70, 0.92)),
    var(--surface);
}

body.theme-dark .thanks-ticker-label {
  color: #f8d97a;
  border-right-color: rgba(246, 196, 83, 0.32);
}

body.theme-dark .thanks-ticker-track span,
body.theme-dark .tip-button {
  color: var(--text);
}

body.theme-dark .thanks-ticker-window::before {
  background: linear-gradient(90deg, rgba(54, 42, 20, 0.98), transparent);
}

body.theme-dark .thanks-ticker-window::after {
  background: linear-gradient(270deg, rgba(20, 40, 61, 0.98), transparent);
}

body.theme-dark .featured-thanks {
  border-color: rgba(246, 196, 83, 0.58);
  background:
    linear-gradient(110deg, rgba(85, 58, 16, 0.96), rgba(25, 28, 34, 0.98) 42%, rgba(105, 73, 18, 0.92)),
    var(--surface);
  box-shadow:
    0 0 0 1px rgba(246, 196, 83, 0.18),
    0 10px 26px rgba(0, 0, 0, 0.28);
}

body.theme-dark .featured-thanks-label {
  color: #f8d97a;
}

body.theme-dark .featured-thanks-name {
  color: #fff4bd;
}

body.theme-dark .tip-button {
  border-color: rgba(246, 196, 83, 0.45);
  background:
    linear-gradient(110deg, rgba(78, 50, 14, 0.95), rgba(21, 26, 35, 0.96) 42%, rgba(68, 30, 48, 0.92)),
    var(--surface);
}

body.theme-dark .tip-button-mark {
  background: rgba(255, 255, 255, 0.12);
  color: #f8d97a;
}

body.theme-dark .tip-card,
body.theme-dark .tip-qr {
  background: var(--surface);
}

body.theme-dark .tip-kicker {
  background: rgba(246, 196, 83, 0.12);
  color: #f8d97a;
}

body.theme-dark .tip-mobile-pay-status.is-active {
  color: #b6ceff;
}

body.theme-dark .range-summary-item:hover,
body.theme-dark .trend-table tr:hover td {
  background: #1a2740;
}

body.theme-dark .range-summary-item.is-active,
body.theme-dark .etf-row.is-active,
body.theme-dark .mobile-view-switch button.is-active {
  background: #20345a;
}

body.theme-dark .etf-row:hover,
body.theme-dark .etf-row.is-aggregate {
  background: var(--surface-soft);
}

body.theme-dark .trend-aggregate-summary,
body.theme-dark .trend-table tr.aggregate-row td {
  background: #1a2d4d;
}

body.theme-dark .quick-feedback button {
  border-color: rgba(154, 164, 178, 0.28);
  background: rgba(21, 26, 35, 0.38);
}

body.theme-dark .quick-feedback button:hover,
body.theme-dark .quick-feedback button:focus-visible,
body.theme-dark .quick-feedback button.is-selected {
  border-color: rgba(91, 140, 255, 0.45);
  background: rgba(91, 140, 255, 0.14);
  color: var(--primary);
}

body.theme-dark .quick-feedback-divider {
  background: rgba(154, 164, 178, 0.24);
}

body.theme-dark .poll-line button {
  border-color: rgba(154, 164, 178, 0.26);
  background: rgba(21, 26, 35, 0.3);
}

body.theme-dark .poll-line button:hover,
body.theme-dark .poll-line button:focus-visible,
body.theme-dark .poll-line button.is-selected {
  border-color: rgba(91, 140, 255, 0.42);
  background: rgba(91, 140, 255, 0.13);
  color: var(--primary);
}

body.theme-dark .poll-line-hot {
  border-color: rgba(248, 113, 113, 0.32);
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.22), rgba(69, 26, 3, 0.16));
}

body.theme-dark .top-hot-polls .poll-label,
body.theme-dark .poll-line-hot .poll-question {
  color: #fecaca;
}

body.theme-dark .poll-line-hot button {
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(127, 29, 29, 0.18);
  color: #fecaca;
}

body.theme-dark .poll-line-hot button:hover,
body.theme-dark .poll-line-hot button:focus-visible,
body.theme-dark .poll-line-hot button.is-selected {
  border-color: rgba(248, 113, 113, 0.62);
  background: rgba(248, 113, 113, 0.2);
  color: #fee2e2;
}

body.theme-dark .poll-count {
  background: rgba(154, 164, 178, 0.16);
  color: rgba(238, 242, 247, 0.82);
}

body.theme-dark .question-card,
body.theme-dark .question-field textarea {
  background: var(--surface);
}

body.theme-dark .question-kicker {
  background: rgba(91, 140, 255, 0.12);
  color: #9bbcff;
}

body.theme-dark .question-category-list button {
  border-color: rgba(154, 164, 178, 0.34);
  background: rgba(21, 26, 35, 0.5);
  color: var(--muted);
}

body.theme-dark .question-category-list button:hover,
body.theme-dark .question-category-list button:focus-visible,
body.theme-dark .question-category-list button.is-selected {
  border-color: rgba(91, 140, 255, 0.52);
  background: rgba(91, 140, 255, 0.15);
  color: var(--primary);
}

body.theme-dark .percentile-chip {
  background: #252d3a;
}

body.theme-dark .percentile-chip.is-high {
  background: rgba(255, 107, 107, 0.18);
  color: #ff9a9a;
}

body.theme-dark .percentile-chip.is-low {
  background: rgba(66, 198, 167, 0.16);
  color: #70ddc2;
}

.mobile-view-switch {
  display: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.summary-item .metric-label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.summary-item strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.quick-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  margin: -2px 0 10px;
  color: var(--muted);
  opacity: 0.78;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.top-feedback {
  width: max-content;
  max-width: calc(100vw - 300px);
  margin: 5px 0 0;
  overflow: visible;
}

.mobile-feedback-triggers {
  display: none;
}

.quick-feedback-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

.quick-feedback::-webkit-scrollbar {
  display: none;
}

.quick-feedback:hover,
.quick-feedback:focus-within {
  opacity: 1;
}

.quick-feedback-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 650;
}

.feature-poll-label {
  font-weight: 750;
}

.feature-poll-toast {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.feature-poll-toast[hidden] {
  display: none;
}

.quick-feedback-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 14px;
  margin: 0 2px;
  background: rgba(107, 114, 128, 0.22);
}

.quick-feedback button {
  flex: 0 0 auto;
  height: 24px;
  padding: 0 9px;
  border-color: rgba(107, 114, 128, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.quick-feedback button:hover,
.quick-feedback button:focus-visible {
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(232, 240, 255, 0.58);
  color: var(--primary);
  outline: none;
}

.quick-feedback button.is-selected {
  border-color: rgba(37, 99, 235, 0.56);
  background: rgba(232, 240, 255, 0.78);
  color: var(--primary);
}

.feature-poll-group button.is-selected {
  border-color: rgba(37, 99, 235, 0.68);
  background: rgba(219, 234, 254, 0.94);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
}

.question-box-button {
  margin-left: 4px;
}

.feedback-toast {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.feedback-toast[hidden] {
  display: none;
}


.interaction-polls {
  display: grid;
  gap: 5px;
  max-width: min(100%, 980px);
  margin-top: 6px;
  color: var(--muted);
  opacity: 0.78;
}

.interaction-polls:hover,
.interaction-polls:focus-within {
  opacity: 1;
}

.top-hot-polls {
  max-width: min(100%, 1120px);
  margin: 0 0 8px;
  opacity: 1;
}

.top-hot-polls .poll-label {
  color: #b42318;
  font-weight: 850;
}

.poll-line-hot {
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 2px 7px 2px 6px;
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(254, 242, 242, 0.94), rgba(255, 247, 237, 0.76));
  box-shadow: 0 4px 12px rgba(153, 27, 27, 0.06);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.poll-line-hot::-webkit-scrollbar {
  display: none;
}

.hot-poll-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.poll-flame {
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(185, 28, 28, 0.18));
}

.poll-line-hot .poll-question {
  color: #991b1b;
  font-weight: 720;
}

.poll-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  overflow: hidden;
  white-space: nowrap;
}

.poll-topic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 0 0 auto;
}

.poll-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
}

.poll-question {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 620;
  color: var(--muted);
}

.poll-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 14px;
  margin: 0 2px;
  background: rgba(107, 114, 128, 0.22);
}

.poll-line button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 23px;
  padding: 0 8px;
  border-color: rgba(107, 114, 128, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.poll-count {
  min-width: 14px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.1);
  color: rgba(75, 85, 99, 0.82);
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.poll-count[hidden] {
  display: none;
}

.poll-line button:hover,
.poll-line button:focus-visible {
  border-color: rgba(37, 99, 235, 0.38);
  background: rgba(232, 240, 255, 0.56);
  color: var(--primary);
  outline: none;
}

.poll-line button.is-selected {
  border-color: rgba(37, 99, 235, 0.46);
  background: rgba(232, 240, 255, 0.68);
  color: var(--primary);
}

.poll-line-hot button {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(255, 255, 255, 0.74);
  color: #b42318;
  font-weight: 720;
}

.poll-line-hot button:hover,
.poll-line-hot button:focus-visible {
  border-color: rgba(220, 38, 38, 0.44);
  background: rgba(254, 226, 226, 0.72);
  color: #991b1b;
}

.poll-line-hot button.is-selected {
  border-color: rgba(220, 38, 38, 0.72);
  background: #dc2626;
  color: #ffffff;
}

.poll-line button.is-locked {
  cursor: default;
}

.poll-toast {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.poll-toast[hidden] {
  display: none;
}

.range-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.range-summary-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(62px, 0.8fr) minmax(48px, 0.66fr) minmax(74px, 1fr) minmax(74px, 1fr);
  gap: 4px 6px;
  align-items: center;
  text-align: left;
  overflow: hidden;
}

.range-summary-item:hover {
  border-color: var(--primary);
  background: #f7faff;
}

.range-summary-item.is-active {
  border-color: var(--primary);
  background: #e8f0ff;
}

.range-summary-title {
  grid-column: auto;
  font-weight: 600;
  font-size: 18px;
  white-space: nowrap;
}

.range-summary-metric {
  min-width: 0;
}

.range-summary-metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.range-summary-metric strong {
  display: block;
  max-width: 100%;
  font-size: clamp(10px, 0.85vw, 13px);
  line-height: 1.22;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
}

.date-range-panel {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.date-range-panel label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.date-range-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.date-range-panel input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.date-range-panel button {
  white-space: nowrap;
}

.trend-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.trend-popout-btn {
  padding: 6px 10px;
  white-space: nowrap;
}

.trend-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(32, 39, 51, 0.34);
}

.trend-panel.is-expanded {
  position: fixed;
  inset: 24px;
  z-index: 30;
  max-height: none;
  width: auto;
  padding: 16px;
}

.trend-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.trend-range-panel {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.trend-range-panel label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.trend-range-panel span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.trend-range-panel input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 8px;
  font: inherit;
}

.trend-range-panel button {
  padding: 7px 10px;
  white-space: nowrap;
}

.trend-aggregate-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid #c8d8f6;
  border-radius: 8px;
  background: #eef4ff;
}

.trend-summary-main,
.trend-summary-metric {
  min-width: 0;
}

.trend-summary-main {
  grid-column: 1 / -1;
}

.trend-summary-main span,
.trend-summary-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.trend-summary-main strong,
.trend-summary-metric strong {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.trend-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 12px;
}

.trend-table.has-margin-columns {
  min-width: 1320px;
}

.trend-panel.is-expanded .trend-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 13px;
}

.trend-panel.is-expanded .trend-table.has-margin-columns {
  min-width: 1320px;
  table-layout: auto;
}

.trend-panel.is-expanded .trend-table th,
.trend-panel.is-expanded .trend-table td {
  padding: 8px 9px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.trend-panel.is-expanded .trend-table th:nth-child(1) {
  width: 18%;
}

.trend-panel.is-expanded .trend-table th:nth-child(2) {
  width: 10%;
}

.trend-panel.is-expanded .trend-table th:nth-child(3),
.trend-panel.is-expanded .trend-table th:nth-child(4),
.trend-panel.is-expanded .trend-table th:nth-child(5),
.trend-panel.is-expanded .trend-table th:nth-child(7),
.trend-panel.is-expanded .trend-table th:nth-child(9) {
  width: 9%;
}

.trend-panel.is-expanded .trend-table th:nth-child(6),
.trend-panel.is-expanded .trend-table th:nth-child(8) {
  width: 13.5%;
}

.trend-panel.is-expanded .trend-table.has-margin-columns th {
  width: auto;
}

.trend-table th,
.trend-table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 7px;
  text-align: right;
  white-space: nowrap;
}

.trend-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-soft);
}

.table-head-label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.trend-table th:first-child .table-head-label,
.trend-table th:nth-child(2) .table-head-label {
  justify-content: flex-start;
}

.mobile-cell-label {
  display: none;
}

.trend-cell-value {
  min-width: 0;
}

.trend-table th:first-child,
.trend-table th:nth-child(2),
.trend-table td:first-child,
.trend-table td:nth-child(2) {
  text-align: left;
}

.trend-table tr.aggregate-row td {
  background: #e7f0ff;
  font-weight: 600;
}

.trend-table tr.trend-group-start td {
  border-top: 2px solid var(--border);
}

.trend-table tr:hover td {
  background: #f7faff;
}

.trend-row-button {
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.trend-row-button:hover {
  color: var(--primary);
}

.cell-positive {
  color: var(--positive);
}

.cell-negative {
  color: var(--negative);
}

.percentile-chip {
  display: inline-block;
  min-width: 48px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #eef2f6;
  color: var(--text);
  text-align: center;
}

.percentile-chip.is-high {
  background: #fbe7e7;
  color: #a23b3b;
}

.percentile-chip.is-low {
  background: #dcf5ed;
  color: #0f6f5d;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 270px minmax(540px, 1fr) minmax(420px, 520px);
  gap: 12px;
  align-items: start;
}

.main-stage {
  min-width: 0;
}

.etf-rail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 28px);
  overflow: auto;
  position: sticky;
  top: 14px;
}

.etf-list {
  display: grid;
  gap: 1px;
}

.etf-row {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.etf-row:hover {
  background: var(--surface-soft);
}

.etf-row.is-active {
  background: #e8f0ff;
}

.etf-row.is-aggregate {
  background: #f6f9ff;
  border-bottom: 2px solid var(--border);
}

.etf-row.is-aggregate .etf-name {
  font-weight: 700;
}

.etf-row:disabled {
  color: var(--muted);
  opacity: 1;
}

.etf-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-code,
.etf-note {
  color: var(--muted);
  font-size: 12px;
}

.chart-stack {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
  position: relative;
}

.chart {
  height: 168px;
  position: relative;
}

.chart[data-chart="flowImpact"] {
  height: 190px;
}

.margin-chart-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.margin-chart-panel[hidden] {
  display: none;
}

.margin-chart {
  height: 320px;
  position: relative;
}

.margin-chart + .margin-chart {
  margin-top: 10px;
}

.time-scroll-panel {
  margin: -2px 0 12px;
  padding: 10px 12px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.time-scroll-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.time-scroll-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.time-scroll-head button {
  min-width: 54px;
  padding: 5px 9px;
  font-size: 12px;
}

.time-scroll-track {
  position: relative;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(17, 138, 116, 0.08)),
    var(--surface-soft);
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.time-scroll-window {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  right: 0;
  min-width: 18px;
  border: 1px solid rgba(37, 99, 235, 0.45);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  cursor: grab;
}

.time-scroll-window.is-dragging {
  cursor: grabbing;
}

.time-scroll-handle {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 2px solid var(--primary);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(31, 41, 55, 0.18);
  transform: translateY(-50%);
  cursor: ew-resize;
}

.time-scroll-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 6px;
  width: 2px;
  border-radius: 2px;
  background: rgba(37, 99, 235, 0.55);
}

.time-scroll-handle-start {
  left: -9px;
}

.time-scroll-handle-end {
  right: -9px;
}

svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.axis text,
.chart-label,
.marker-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-title {
  fill: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.chart-help-svg {
  cursor: pointer;
  outline: none;
}

.chart-help-svg circle {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.2;
}

.chart-help-svg text {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

.chart-help-svg:hover circle,
.chart-help-svg:focus-visible circle {
  fill: #e8f0ff;
  stroke: var(--primary);
}

.chart-help-svg:hover text,
.chart-help-svg:focus-visible text {
  fill: var(--primary);
}

.empty-chart-label {
  fill: var(--muted);
  font-size: 12px;
}

.x-axis-label.is-dense {
  font-size: 10px;
}

.grid-line,
.axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.series-line {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
}

.margin-line-index {
  stroke: var(--primary);
  fill: none;
}

.margin-line-etf {
  stroke: #0f9278;
  fill: none;
}

.margin-legend-line {
  stroke-width: 3;
  stroke-linecap: round;
}

.margin-legend-label,
.margin-axis-label {
  font-size: 11px;
  font-weight: 600;
}

.margin-axis-label.margin-line-index {
  fill: var(--primary);
  stroke: none;
}

.margin-axis-label.margin-line-etf {
  fill: #0f9278;
  stroke: none;
}

body.theme-dark .margin-line-etf {
  stroke: #42c6a7;
}

body.theme-dark .margin-axis-label.margin-line-etf {
  fill: #42c6a7;
}

.benchmark-line {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
  opacity: 0.6;
}

.bar-turnover {
  fill: var(--positive);
  opacity: 0.7;
}

.bar-positive {
  fill: var(--positive);
  opacity: 0.76;
}

.bar-negative {
  fill: var(--negative);
  opacity: 0.74;
}

.zero-line {
  stroke: var(--border);
  stroke-width: 1;
}

.marker-line {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.7;
}

.marker-dot {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 2;
}

.hover-layer,
.axis-pan-layer {
  fill: transparent;
  touch-action: none;
}

.hover-layer {
  cursor: crosshair;
}

.axis-pan-layer {
  cursor: grab;
}

.axis-pan-layer.is-panning {
  cursor: grabbing;
}

.hover-line {
  stroke: var(--primary);
  stroke-width: 1;
  opacity: 0.55;
  pointer-events: none;
}

.hover-line-horizontal {
  stroke-dasharray: 4 4;
}

.crosshair-dot {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 2;
  pointer-events: none;
}

.crosshair-dot.margin-crosshair-dot-etf {
  stroke: #0f9278;
}

body.theme-dark .crosshair-dot.margin-crosshair-dot-etf {
  stroke: #42c6a7;
}

.zoom-selection {
  fill: rgba(37, 99, 235, 0.12);
  stroke: var(--primary);
  stroke-width: 1;
  pointer-events: none;
}

.tooltip {
  position: absolute;
  visibility: hidden;
  z-index: 4;
  pointer-events: none;
  min-width: 300px;
  max-width: min(420px, calc(100vw - 40px));
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(217, 222, 230, 0.58);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.11);
  padding: 9px 10px;
  backdrop-filter: blur(2px);
  cursor: default;
  user-select: none;
  touch-action: none;
}

.tooltip.is-dragging {
  opacity: 0.92;
  cursor: grabbing;
}

.tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.tooltip-row strong {
  color: var(--text);
  font-weight: 500;
}

.tooltip-section-title {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.tooltip-rolling-row {
  align-items: flex-start;
}

.tooltip-rolling-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

body.theme-dark .tooltip {
  background: rgba(21, 26, 35, 0.72);
  border-color: rgba(74, 85, 104, 0.72);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.help-trigger {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border: 1px solid rgba(107, 114, 128, 0.58);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.help-trigger:hover,
.help-trigger:focus-visible {
  border-color: var(--primary);
  background: #e8f0ff;
  color: var(--primary);
  outline: none;
}

.help-backdrop[hidden],
.help-panel[hidden] {
  display: none;
}

.help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: transparent;
}

.help-panel {
  position: fixed;
  z-index: 71;
  max-width: min(340px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 18px 44px rgba(31, 41, 55, 0.18);
  padding: 12px 14px;
  backdrop-filter: blur(12px);
}

.help-panel h2 {
  margin: 0 28px 6px 0;
  font-size: 15px;
}

.help-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.help-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
}

body.theme-dark .help-trigger,
body.theme-dark .chart-help-svg circle,
body.theme-dark .help-close {
  background: var(--surface);
  border-color: rgba(154, 164, 178, 0.58);
  color: var(--muted);
}

body.theme-dark .help-trigger:hover,
body.theme-dark .help-trigger:focus-visible,
body.theme-dark .chart-help-svg:hover circle,
body.theme-dark .chart-help-svg:focus-visible circle {
  background: rgba(91, 140, 255, 0.18);
  border-color: var(--primary);
  color: var(--primary);
}

body.theme-dark .help-panel {
  background: rgba(21, 26, 35, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
}

.question-backdrop[hidden],
.question-dialog[hidden] {
  display: none;
}

.question-backdrop {
  position: fixed;
  inset: 0;
  z-index: 64;
  background: rgba(32, 39, 51, 0.22);
  backdrop-filter: blur(3px);
}

.question-dialog {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 22px;
  pointer-events: none;
}

.question-card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 58px rgba(31, 41, 55, 0.2);
  padding: 16px;
  pointer-events: auto;
}

.question-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.question-kicker {
  width: fit-content;
  margin-bottom: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.question-card h2 {
  margin: 0 64px 12px 0;
  font-size: 18px;
  letter-spacing: 0;
}

.question-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.question-category-list button {
  height: 28px;
  padding: 0 10px;
  border-color: rgba(107, 114, 128, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.question-category-list button:hover,
.question-category-list button:focus-visible,
.question-category-list button.is-selected {
  border-color: rgba(37, 99, 235, 0.48);
  background: rgba(232, 240, 255, 0.78);
  color: var(--primary);
  outline: none;
}

.question-field {
  display: grid;
  gap: 6px;
}

.question-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.question-field textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
  line-height: 1.5;
}

.question-field textarea:focus {
  border-color: rgba(37, 99, 235, 0.52);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.question-status {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.question-status[data-tone="error"] {
  color: var(--positive);
}

.question-status[data-tone="success"] {
  color: var(--negative);
}

.question-actions button {
  flex: 0 0 auto;
}

























.status-line {
  min-height: 22px;
  margin-top: 10px;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100vw - 20px, 1760px);
    margin-top: 14px;
  }

  .topbar {
    display: block;
    padding-top: 44px;
    padding-right: 0;
  }

  .global-page-controls {
    top: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
  }

  .global-page-controls button {
    padding: 7px 10px;
  }

  .tooltip-toggle {
    min-width: 88px;
  }

  .title-row {
    align-items: flex-start;
  }

  .thanks-ticker {
    width: min(100%, 520px);
    min-width: 0;
  }

  .toolbar {
    justify-content: flex-start;
    margin-top: 10px;
  }

  .section-head {
    display: block;
  }

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

  .etf-rail,
  .trend-panel {
    position: static;
    max-height: 240px;
  }

  .trend-panel.is-expanded {
    position: fixed;
    inset: 10px;
    max-height: none;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .range-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .range-summary-item {
    grid-template-columns: minmax(56px, 0.8fr) minmax(42px, 0.62fr) minmax(66px, 1fr) minmax(66px, 1fr);
    gap: 3px 5px;
    padding: 8px;
  }

  .range-summary-title {
    font-size: 16px;
  }

  .range-summary-metric span {
    font-size: 10px;
  }

  .range-summary-metric strong {
    font-size: 10px;
  }

  .trend-range-panel {
    grid-template-columns: 1fr 1fr;
  }

  .trend-aggregate-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-stack {
    display: block;
    padding: 10px;
  }

  .chart {
    height: 178px;
  }
}

@media (min-width: 981px) and (max-width: 1380px) {
  .dashboard-grid {
    grid-template-columns: 250px minmax(480px, 1fr);
  }

  .trend-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 560px) {
  select {
    width: 100%;
    max-width: none;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar select {
    grid-column: span 2;
  }

  .range-summary-item {
    grid-template-columns: 1fr;
  }

  .trend-panel.is-expanded .trend-table {
    font-size: 12px;
  }

  .copyright-line span {
    display: block;
  }

  .copyright-line span + span::before {
    content: "";
  }
}

@media (max-width: 760px), (pointer: coarse) {
  body {
    font-size: 13px;
  }

  .app-shell {
    width: 100%;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top)) 10px 12px;
  }

  .global-page-controls {
    position: static;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    width: auto;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .global-page-controls button {
    min-height: 31px;
    padding: 6px 7px;
    border-radius: 10px;
    box-shadow: none;
    backdrop-filter: blur(10px);
    font-size: 12px;
    line-height: 1;
  }

  .global-page-controls button.secondary {
    background: rgba(255, 255, 255, 0.9);
  }

  body.theme-dark .global-page-controls button.secondary {
    background: rgba(21, 26, 35, 0.82);
    box-shadow: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 0 -10px 10px;
    padding: max(8px, env(safe-area-inset-top)) 10px 10px;
    background: rgba(245, 246, 248, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }

  .topbar-content {
    display: contents;
  }

  .topbar-toolbar {
    order: 6;
    display: grid;
    grid-template-columns: minmax(82px, 0.36fr) minmax(0, 0.64fr);
    grid-template-areas: "group etf";
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  body.theme-dark .topbar {
    background: rgba(15, 18, 24, 0.96);
  }

  .site-brand {
    display: none;
  }

  h1 {
    max-width: 100%;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.16;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .title-row {
    order: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
  }

  .title-row h1 {
    min-width: 0;
  }

  .title-row .global-page-controls {
    align-self: center;
  }

  .title-row .support-row {
    grid-column: 1 / -1;
  }

  .support-row {
    display: grid;
    grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
    align-items: center;
    width: 100%;
    max-width: none;
    min-width: 0;
    gap: 6px;
    margin-top: 6px;
    overflow: visible;
  }

  .featured-thanks {
    justify-content: center;
    height: 28px;
    padding: 0 11px;
    gap: 6px;
    min-width: 0;
  }

  .featured-thanks-label {
    font-size: 10px;
  }

  .featured-thanks-name {
    font-size: 14px;
  }

  .thanks-ticker {
    width: 100%;
    height: 28px;
  }

  .support-row .thanks-ticker {
    grid-row: 2;
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .support-row .featured-thanks {
    grid-row: 1;
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }

  .support-row .tip-button {
    grid-row: 1;
    grid-column: 2;
    width: 100%;
    min-width: 0;
  }

  .tooltip-toggle {
    display: none;
  }

  .thanks-ticker-label {
    padding-left: 10px;
    padding-right: 8px;
    font-size: 11px;
  }

  .thanks-ticker-track {
    gap: 14px;
    padding-left: 12px;
    animation-duration: 36s;
  }

  .thanks-ticker-track span {
    font-size: 12px;
  }

  .tip-button {
    justify-content: center;
    height: 28px;
    padding: 0 11px;
    font-size: 12px;
    min-width: 0;
  }

  .tip-button span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }

  .tip-dialog {
    align-items: end;
    padding: 0 10px max(10px, env(safe-area-inset-bottom));
  }

  .tip-card {
    width: min(420px, 100%);
    max-height: min(86vh, 720px);
    border-radius: 18px 18px 14px 14px;
    padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .tip-card::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    transform: translateX(-50%);
  }

  .tip-card h2 {
    margin-right: 60px;
    font-size: 18px;
  }

  .tip-title-default {
    display: none;
  }

  .tip-title-mobile {
    display: inline;
  }

  .tip-card p {
    margin-bottom: 10px;
    line-height: 1.5;
  }

  .tip-default-note {
    display: none;
  }

  .tip-mobile-note {
    display: inline;
  }

  .tip-qr {
    width: min(100%, 360px);
    max-height: min(54vh, 420px);
    margin: 8px auto 0;
    border-radius: 12px;
  }

  .meta-line {
    font-size: 12px;
  }

  .topbar .meta-line {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.35;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }

  .toolbar {
    margin-top: 0;
  }

  .topbar-toolbar select {
    width: 100%;
    max-width: none;
    min-width: 0;
    border-radius: 10px;
    padding: 7px 8px;
    font-size: 12px;
  }

  #groupSelect {
    display: block;
    grid-area: group;
  }

  #etfSelect {
    grid-area: etf;
  }

  .interaction-polls {
    order: 3;
  }

  .topbar .meta-line {
    order: 4;
  }

  .topbar .quick-feedback {
    order: 5;
  }

  .toolbar button {
    width: 100%;
    border-radius: 10px;
    padding: 10px 8px;
  }

  .mobile-view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  .mobile-view-switch button {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    padding: 9px 10px;
  }

  .mobile-view-switch button.is-active {
    border-color: var(--primary);
    background: #e8f0ff;
    color: var(--text);
    font-weight: 600;
  }

  body.theme-dark .mobile-view-switch button {
    background: #151a23;
    border-color: rgba(154, 164, 178, 0.34);
  }

  body.theme-dark .mobile-view-switch button.is-active {
    background: #20345a;
    border-color: rgba(118, 167, 255, 0.72);
    color: var(--text);
  }

  .dashboard-grid {
    display: block;
  }

  .etf-rail {
    display: none;
  }

  .main-stage {
    display: block;
  }

  .trend-panel {
    display: none;
    position: static;
    max-height: none;
    padding: 10px;
    border-radius: 12px;
    box-shadow: none;
  }

  body.theme-dark .trend-panel,
  body.theme-dark .summary-item,
  body.theme-dark .date-range-panel,
  body.theme-dark .time-scroll-panel,
  body.theme-dark .chart-stack {
    border-color: rgba(154, 164, 178, 0.28);
  }

  body.mobile-trend-view .main-stage {
    display: none;
  }

  body.mobile-trend-view .trend-panel {
    display: flex;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .summary-item {
    border-radius: 10px;
    padding: 9px 10px;
    box-shadow: none;
  }

  .summary-item span {
    font-size: 11px;
  }

  .summary-item strong {
    font-size: 16px;
  }

  .quick-feedback {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    overflow: visible;
    padding-bottom: 0;
    margin: -1px 0 6px;
  }

  .top-feedback {
    width: 100%;
    max-width: 100%;
    margin: 5px 0 0;
  }

  .mobile-feedback-triggers {
    display: grid;
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
    gap: 6px;
    width: 100%;
  }

  .mobile-feedback-trigger {
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    box-shadow: none;
    font-size: 12px;
    font-weight: 650;
  }

  .mobile-feedback-trigger[aria-expanded="true"] {
    border-color: rgba(37, 99, 235, 0.58);
    background: rgba(232, 240, 255, 0.76);
    color: var(--primary);
  }

  body.theme-dark .mobile-feedback-trigger {
    border-color: rgba(154, 164, 178, 0.28);
    background: rgba(21, 26, 35, 0.38);
    color: var(--muted);
  }

  body.theme-dark .mobile-feedback-trigger[aria-expanded="true"] {
    border-color: rgba(91, 140, 255, 0.55);
    background: rgba(91, 140, 255, 0.16);
    color: var(--primary);
  }

  .quick-feedback-group {
    display: none;
    width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 5px;
  }

  .quick-feedback-group.is-mobile-expanded {
    display: flex;
  }

  .quick-feedback-group .quick-feedback-label {
    display: none;
  }

  .quick-feedback-divider {
    display: none;
  }

  .interaction-polls {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin-top: 0;
    overflow: visible;
  }

  .poll-line {
    overflow: visible;
    white-space: normal;
  }

  .poll-line-hot {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    width: 100%;
    padding: 6px 7px;
    border-radius: 14px;
  }

  .poll-line-hot .poll-divider {
    display: none;
  }

  .poll-topic {
    display: grid;
    align-items: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
  }

  .poll-topic-primary {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .poll-topic-secondary {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding-left: 20px;
  }

  .poll-question {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .poll-line button {
    height: 22px;
    padding: 0 7px;
  }

  .question-dialog {
    align-items: end;
    padding: 10px;
  }

  .question-card {
    width: 100%;
    max-height: min(78vh, 620px);
    border-radius: 16px;
    padding: 16px;
  }

  .question-card h2 {
    font-size: 17px;
  }




  .question-category-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-category-list button {
    width: 100%;
  }

  .range-summary-strip {
    display: grid;
    grid-auto-columns: minmax(244px, 82vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    padding: 0;
    margin-bottom: 10px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .range-summary-strip::-webkit-scrollbar {
    display: none;
  }

  .range-summary-item {
    width: 100%;
    min-width: 0;
    border-radius: 10px;
    box-shadow: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px 6px;
    padding: 8px 7px;
    scroll-snap-align: start;
  }

  .range-summary-title {
    grid-column: 1 / -1;
    font-size: 15px;
    align-self: start;
  }

  .range-summary-metric {
    display: block;
    min-width: 0;
  }

  .range-summary-metric span {
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .range-summary-metric strong {
    font-size: 11px;
    line-height: 1.25;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .date-range-panel {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    border-radius: 10px;
    box-shadow: none;
    padding: 9px 10px;
    margin-bottom: 10px;
  }

  .date-range-panel label {
    gap: 3px;
  }

  .date-range-panel span {
    font-size: 11px;
  }

  .date-range-panel input,
  .date-range-panel button {
    width: 100%;
    border-radius: 10px;
    padding: 9px 8px;
    font-size: 13px;
  }

  .chart-stack {
    border-radius: 10px;
    padding: 8px;
    box-shadow: none;
    touch-action: pan-y;
  }

  .chart {
    height: 164px;
    border-bottom: 1px solid var(--border);
    touch-action: pan-y;
  }

  .hover-layer,
  .axis-pan-layer {
    touch-action: pan-y;
  }

  .chart[data-chart="flowImpact"] {
    height: 178px;
    border-bottom: 0;
  }

  .margin-chart-panel {
    margin-top: 12px;
    padding-top: 12px;
  }

  .margin-chart {
    height: 250px;
    border-bottom: 1px solid var(--border);
    touch-action: pan-y;
  }

  .margin-chart + .margin-chart {
    margin-top: 8px;
  }

  .margin-chart:last-child {
    border-bottom: 0;
  }

  .time-scroll-panel {
    margin: -2px 0 10px;
    padding: 9px 10px 8px;
    border-radius: 10px;
    box-shadow: none;
  }

  .time-scroll-head {
    margin-bottom: 6px;
    font-size: 11px;
  }

  .tooltip {
    min-width: 240px;
    max-width: calc(100vw - 36px);
    font-size: 12px;
  }

  .trend-popout-btn {
    display: none;
  }

  .section-head {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .trend-panel .meta-line {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .trend-table-wrap {
    overflow: visible;
  }

  .trend-range-panel {
    gap: 8px;
  }

  .trend-range-panel input,
  .trend-range-panel button {
    width: 100%;
    border-radius: 10px;
    padding: 9px 8px;
    font-size: 13px;
  }

  .trend-aggregate-summary {
    border-radius: 10px;
    padding: 9px 10px;
    box-shadow: none;
  }

  .trend-table,
  .trend-table tbody,
  .trend-table tr,
  .trend-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .trend-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 13px;
    table-layout: fixed;
  }

  .trend-table.has-margin-columns,
  .trend-panel.is-expanded .trend-table,
  .trend-panel.is-expanded .trend-table.has-margin-columns {
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
  }

  .trend-table thead {
    display: none;
  }

  .trend-table tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    padding: 9px 10px;
  }

  .trend-table tr.aggregate-row {
    border-color: #c8d8f6;
    background: #eef4ff;
  }

  body.theme-dark .trend-table tr {
    border-color: rgba(118, 167, 255, 0.22);
    background: #141f31;
    box-shadow: inset 0 0 0 1px rgba(118, 167, 255, 0.04);
  }

  body.theme-dark .trend-table tr.aggregate-row {
    border-color: rgba(118, 167, 255, 0.36);
    background: #162a46;
  }

  .trend-table tr.trend-group-start {
    border-top: 1px solid var(--border);
  }

  .trend-table tr:hover td,
  .trend-table tr.aggregate-row td {
    background: transparent;
  }

  body.theme-dark .trend-table tr:hover td,
  body.theme-dark .trend-table tr.aggregate-row td {
    background: transparent;
  }

  .trend-table td {
    border-bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.theme-dark .trend-table td {
    border-bottom: 1px solid rgba(118, 167, 255, 0.1);
  }

  body.theme-dark .trend-table td:last-child {
    border-bottom: 0;
  }

  .trend-table td::before {
    content: none;
    display: none;
  }

  .mobile-cell-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    text-align: left;
    min-width: 0;
    flex: 0 0 min(46%, 150px);
  }

  .trend-table td:first-child {
    display: block;
    padding-bottom: 7px;
    text-align: left;
    font-weight: 600;
  }

  .trend-table td:first-child::before {
    display: none;
  }

  .trend-table td:first-child .mobile-cell-label {
    display: none;
  }

  .trend-cell-value {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 58%;
    overflow-wrap: anywhere;
    text-align: right;
    visibility: visible;
  }

  .trend-table td:first-child .trend-cell-value {
    max-width: none;
    text-align: left;
  }

  .trend-row-button {
    font-weight: 600;
  }

  .percentile-chip {
    min-width: 0;
  }

  .status-line {
    margin-bottom: 12px;
    font-size: 12px;
  }

  .help-panel.is-sheet {
    left: 10px !important;
    right: 10px;
    top: auto !important;
    bottom: 10px;
    max-width: none;
    border-radius: 16px;
    padding: 16px 18px 18px;
  }

  .help-panel.is-sheet h2 {
    font-size: 17px;
  }

  .help-panel.is-sheet p {
    font-size: 14px;
  }

  .help-backdrop {
    background: rgba(32, 39, 51, 0.28);
  }
}

@media (max-width: 760px) {
  .tip-mobile-pay {
    display: grid;
    gap: 10px;
    margin-top: 14px;
  }

  .tip-qr-panel {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .tip-qr-panel.is-visible {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .featured-thanks::after,
  .thanks-ticker::after,
  .tip-button::after,
  .thanks-ticker-track {
    animation: none;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding: max(8px, env(safe-area-inset-top)) 8px 12px;
  }

  .topbar {
    margin: 0 -8px 8px;
    padding: 8px;
  }

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

  .range-summary-item {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .range-summary-title {
    grid-column: 1 / -1;
    font-size: 14px;
  }

  .trend-table td {
    display: block;
    text-align: left;
  }

  .trend-cell-value {
    max-width: none;
    margin-top: 2px;
    text-align: left;
  }

  .percentile-chip {
    display: inline-flex;
  }
}
