:root {
  --bg: #eef7ff;
  --surface: #ffffff;
  --surface-soft: #f2f8ff;
  --surface-strong: #132238;
  --line: #cfe0f2;
  --line-strong: #a9c5df;
  --text: #1f3248;
  --muted: #60758b;
  --accent: #1f79c9;
  --accent-strong: #155fa6;
  --accent-soft: #dceeff;
  --sky: #7cc4ff;
  --sky-soft: #edf8ff;
  --amber: #9a6a00;
  --amber-soft: #fff3d2;
  --bad: #bc4b5b;
  --bad-soft: #ffe7ec;
  --good: #168269;
  --good-soft: #ddf6ed;
  --ink: #0f1f33;
  --shadow: 0 16px 40px rgba(29, 83, 135, 0.12);
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, #e6f5ff 0%, var(--bg) 38%, #f8fbff 100%);
  color: var(--text);
  font-family: var(--sans);
}

html.home-route .app-shell,
html.dashboard-route .redirect-home {
  display: none;
}

.redirect-home {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.redirect-home-copy {
  display: grid;
  width: min(920px, 100%);
  gap: 18px;
}

.redirect-home-copy p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.home-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-card {
  display: grid;
  min-height: 188px;
  align-content: start;
  gap: 12px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--sky);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dashboard-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.dashboard-card strong {
  color: var(--ink);
  font-size: 1.16rem;
  line-height: 1.2;
}

.dashboard-card small {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.dashboard-card-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.redirect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.redirect-actions span {
  color: var(--muted);
  font-size: 0.84rem;
}

body[data-dashboard-mode="memeShort"] #topicOverview,
body[data-dashboard-mode="congress"] .toolbar,
body[data-dashboard-mode="congress"] .metric-key,
body[data-dashboard-mode="congress"] #topicOverview,
body[data-dashboard-mode="congress"] #activeFilters,
body[data-dashboard-mode="congress"] #stockLookup {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(460px, 720px);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--sky);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.masthead-copy {
  display: grid;
  align-content: center;
  gap: 8px;
}

.eyebrow,
label,
.window-kicker,
th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--ink);
  font-size: 2.1rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.masthead p {
  max-width: 940px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-soft);
}

.status-cell {
  display: grid;
  align-content: center;
  min-height: 78px;
  padding: 12px;
  border-left: 1px solid var(--line);
}

.status-cell:first-child {
  border-left: 0;
}

.status-cell span,
.kpi .label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.status-cell strong {
  display: block;
  min-width: 0;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1.2fr) minmax(200px, 1.2fr) minmax(145px, 0.8fr) minmax(160px, 0.9fr) minmax(160px, 0.9fr) minmax(125px, 0.6fr) minmax(170px, 0.75fr);
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field {
  min-width: 0;
}

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

label {
  display: block;
  margin-bottom: 5px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  color: var(--text);
  background: #f8fcff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  padding: 9px 10px;
}

input[type="file"] {
  padding: 7px;
}

input[type="search"]::-webkit-search-cancel-button {
  appearance: none;
}

.theme-picker {
  position: relative;
}

.theme-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 9px 32px 9px 10px;
  color: var(--text);
  background: #f8fcff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-button::after {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid var(--muted);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  content: "";
}

.theme-button.has-selection {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #aed4f5;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: 282px;
  padding: 6px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.theme-menu[hidden] {
  display: none;
}

.theme-menu-clear {
  width: 100%;
  min-height: 32px;
  margin-bottom: 4px;
  color: var(--accent);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 850;
}

.theme-option,
.theme-menu-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 6px;
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.15;
  text-transform: none;
}

.theme-option:hover {
  background: var(--surface-soft);
}

.theme-menu-empty {
  cursor: default;
}

.theme-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}

.theme-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 121, 201, 0.22);
  outline-offset: 1px;
}

.button-row {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 92px;
  padding: 9px 12px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.button.primary:hover,
.view-tab.is-active:hover {
  background: var(--accent-strong);
}

.button.ghost {
  color: var(--accent);
  background: #fff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.search-control {
  position: relative;
}

.search-control input {
  padding-right: 44px;
}

.search-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 28px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}

.search-clear:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.search-clear[hidden] {
  display: none;
}

.filter-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 2px 0;
}

.filter-strip[hidden] {
  display: none;
}

.filter-count,
.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 850;
}

.filter-count {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #aed4f5;
}

.filter-chip {
  gap: 7px;
  color: #43576b;
  background: #fff;
}

.filter-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-height: 18px;
  padding: 0;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 900;
}

.filter-chip button:hover {
  color: var(--accent);
}

.filter-strip .button {
  min-height: 30px;
  min-width: auto;
  padding: 5px 10px;
  font-size: 0.74rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  text-transform: none;
}

.toggle input {
  width: 17px;
  min-height: 17px;
}

.screener-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1.2fr) repeat(5, minmax(140px, 0.7fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message {
  min-height: 28px;
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.message strong {
  color: var(--accent);
}

.stock-lookup {
  margin-top: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.lookup-head h3 {
  margin-top: 3px;
  color: var(--ink);
  font-size: 1rem;
}

.lookup-head p,
.lookup-note,
.lookup-empty {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.lookup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lookup-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lookup-ticker {
  font-size: 0.86rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.stat-item {
  min-width: 0;
  padding: 8px 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-item span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-item strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.lookup-note {
  margin-top: 8px;
}

.metric-key {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-key summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.metric-key summary::-webkit-details-marker {
  display: none;
}

.metric-key summary::after {
  color: var(--accent);
  content: "+";
  font-size: 1rem;
  font-weight: 900;
}

.metric-key[open] summary::after {
  content: "-";
}

.metric-key summary small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.key-card {
  min-width: 0;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.key-card h3 {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 0.84rem;
}

.key-card p {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.key-card p + p {
  margin-top: 5px;
}

.view-switch {
  display: inline-grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 2px;
  margin-top: 8px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.view-tab {
  min-height: 38px;
  padding: 8px 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 850;
}

.topic-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.topic-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  min-height: 76px;
  padding: 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
}

.topic-card span {
  min-width: 0;
  color: var(--ink);
  font-weight: 850;
}

.topic-card strong {
  color: var(--accent);
  font-family: var(--mono);
}

.topic-card small {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-tab.is-active {
  color: #fff;
  background: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 8px;
}

.window {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.window[hidden] {
  display: none;
}

.window-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  background: #f7fbff;
  border-bottom: 1px solid var(--line);
}

.window-header h2 {
  margin-top: 2px;
  color: var(--ink);
  font-size: 1rem;
}

.window-header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #aed4f5;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill.neutral {
  color: #43576b;
  background: #e9f2fb;
  border-color: var(--line);
}

.content {
  max-height: calc(100vh - 282px);
  overflow: auto;
  padding: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.kpi {
  min-width: 0;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi .value {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0;
}

.bucket {
  margin-bottom: 16px;
}

.bucket-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
  padding: 9px 10px;
  background: linear-gradient(90deg, var(--surface-soft), #f9fcff);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bucket-title h3 {
  color: var(--ink);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.bucket-title span {
  color: var(--muted);
  font-size: 0.78rem;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.table-block,
.feed-card,
.mini-item {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-block h4 {
  margin: 0;
  padding: 10px;
  color: var(--ink);
  font-size: 0.84rem;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow: auto;
}

.screener-table-shell {
  display: grid;
  gap: 6px;
}

.screener-scrollbar,
.screener-table-wrap {
  scrollbar-color: var(--accent) var(--surface-soft);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.screener-scrollbar {
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.screener-scrollbar-spacer {
  height: 1px;
}

.screener-scrollbar::-webkit-scrollbar,
.screener-table-wrap::-webkit-scrollbar {
  height: 12px;
}

.screener-scrollbar::-webkit-scrollbar-track,
.screener-table-wrap::-webkit-scrollbar-track {
  background: var(--surface-soft);
  border-radius: 999px;
}

.screener-scrollbar::-webkit-scrollbar-thumb,
.screener-table-wrap::-webkit-scrollbar-thumb {
  background: var(--accent);
  border: 3px solid var(--surface-soft);
  border-radius: 999px;
}

table {
  width: 100%;
  min-width: 1540px;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.refined-data-table {
  min-width: 1980px;
}

.screener-data-table {
  min-width: 1814px;
  table-layout: fixed;
  font-size: 0.64rem;
}

.screener-data-table col:nth-child(1) { width: 58px; }
.screener-data-table col:nth-child(2) { width: 145px; }
.screener-data-table col:nth-child(3) { width: 124px; }
.screener-data-table col:nth-child(4) { width: 118px; }
.screener-data-table col:nth-child(5) { width: 72px; }
.screener-data-table col:nth-child(6) { width: 106px; }
.screener-data-table col:nth-child(7) { width: 56px; }
.screener-data-table col:nth-child(8) { width: 56px; }
.screener-data-table col:nth-child(9) { width: 131px; }
.screener-data-table col:nth-child(10) { width: 52px; }
.screener-data-table col:nth-child(11) { width: 56px; }
.screener-data-table col:nth-child(12) { width: 62px; }
.screener-data-table col:nth-child(13) { width: 60px; }
.screener-data-table col:nth-child(14) { width: 52px; }
.screener-data-table col:nth-child(15) { width: 60px; }
.screener-data-table col:nth-child(16) { width: 76px; }
.screener-data-table col:nth-child(17) { width: 70px; }
.screener-data-table col:nth-child(18) { width: 54px; }
.screener-data-table col:nth-child(19) { width: 62px; }
.screener-data-table col:nth-child(20) { width: 76px; }
.screener-data-table col:nth-child(21) { width: 164px; }

.screener-data-table th,
.screener-data-table td {
  padding: 5px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screener-data-table .company,
.screener-data-table .theme-pill,
.screener-data-table .badge,
.screener-data-table .date-range {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.screener-data-table .score-pill,
.screener-data-table .prob-pill {
  min-height: 20px;
  padding: 2px 5px;
  font-size: 0.62rem;
}

.screener-data-table .theme-pill,
.screener-data-table .badge,
.screener-data-table .date-range {
  padding: 2px 5px;
  font-size: 0.6rem;
}

.screener-data-table .muted-cell {
  font-size: 0.62rem;
}

.screener-data-table .reason-cell {
  max-width: none;
  white-space: normal;
}

.congress-table td.left {
  text-align: left;
}

.congress-table .reason-cell {
  min-width: 220px;
  max-width: 360px;
  white-space: normal;
}

.congress-table .ticker-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid #b8d6f0;
  border-radius: 6px;
  background: #edf6ff;
  color: #0f4d75;
  font-size: 0.66rem;
  font-weight: 800;
}

.tracker-table {
  min-width: 1760px;
}

.price-watch-table {
  min-width: 2140px;
}

.price-cell {
  min-width: 112px;
}

.price-input {
  width: 92px;
  min-height: 30px;
  padding: 5px 7px;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: right;
}

.portfolio-detail {
  display: grid;
  gap: 10px;
  margin: 10px 0;
  padding: 10px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.portfolio-detail h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.muted-detail {
  background: var(--surface-soft);
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tracker-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.congress-evidence {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

th,
td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f9ff;
}

.sort-button {
  display: inline-flex;
  justify-content: flex-end;
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  letter-spacing: 0;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.sort-button:hover,
.sort-button.is-active {
  color: var(--accent);
}

th:first-child .sort-button,
th:nth-child(2) .sort-button,
th:nth-child(3) .sort-button,
th:nth-child(4) .sort-button,
th:nth-child(5) .sort-button {
  justify-content: flex-start;
  text-align: left;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  text-align: left;
}

.screener-data-table th:last-child .sort-button,
.screener-data-table th:nth-child(9) .sort-button,
.screener-data-table td:last-child,
.screener-data-table td:nth-child(9) {
  justify-content: flex-start;
  text-align: left;
}

.screener-data-table th:nth-child(5) .sort-button,
.screener-data-table td:nth-child(5) {
  justify-content: flex-end;
  text-align: right;
}

tbody tr:hover td {
  background: #eef7ff;
}

.ticker {
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 900;
}

.ticker-link {
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 900;
}

.ticker-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.company {
  display: inline-block;
  max-width: none;
  color: var(--muted);
  vertical-align: bottom;
  white-space: nowrap;
}

.type-pill,
.theme-pill,
.match-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  color: #43576b;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.theme-pill {
  max-width: none;
}

.type-pill.food {
  color: var(--good);
  background: var(--good-soft);
  border-color: #b8dec5;
}

.theme-pill.meme {
  color: #8a5a00;
  background: #fff4d8;
  border-color: #ead28e;
}

.match-pill {
  color: var(--good);
  background: var(--good-soft);
  border-color: #b8dec5;
}

.match-pill.added {
  color: #8a5a00;
  background: #fff4d8;
  border-color: #ead28e;
}

.pos {
  color: var(--good);
}

.neg {
  color: var(--bad);
}

.bar {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 58px;
  padding: 2px 7px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #aed4f5;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.score {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 900;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 3px 7px;
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid #efb4ac;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
}

.score-pill.mid {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ead28e;
}

.score-pill.high {
  color: var(--good);
  background: var(--good-soft);
  border-color: #b8dec5;
}

.prob-pill,
.date-range {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  white-space: nowrap;
}

.prob-pill {
  min-width: 46px;
  font-family: var(--mono);
}

.prob-pill.low {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: #efb4ac;
}

.prob-pill.mid {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ead28e;
}

.prob-pill.high {
  color: var(--good);
  background: var(--good-soft);
  border-color: #b8dec5;
}

.date-range {
  color: #43576b;
  background: #f8fbff;
}

.muted-cell {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.score-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
}

.confidence {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
}

.confidence.high {
  color: var(--good);
  background: var(--good-soft);
  border-color: #b8dec5;
}

.confidence.mid {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ead28e;
}

.confidence.low {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: #efb4ac;
}

.reason-cell {
  max-width: 220px;
  color: var(--muted);
  line-height: 1.25;
  text-align: left;
  white-space: normal;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.badge {
  display: inline-flex;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  color: #43576b;
  font-size: 0.66rem;
  font-weight: 850;
}

.badge.overlap {
  color: var(--good);
  background: var(--good-soft);
  border-color: #b8dec5;
}

.badge.warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ead28e;
}

.badge.bad {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: #efb4ac;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.feed-card {
  padding: 10px;
}

.feed-card h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.86rem;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.evidence-card {
  min-width: 0;
}

.screener-formula {
  margin: 4px 0 12px;
}

.feed-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.feed-row:first-of-type {
  border-top: 0;
}

.feed-row small,
.method,
.mini-item div {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.mini-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.mini-item {
  padding: 9px;
}

.mini-item strong {
  font-family: var(--mono);
}

.empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty .button {
  margin-top: 10px;
}

.method-content {
  display: grid;
  gap: 12px;
}

.method-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.method-hero h3,
.method-card h3 {
  color: var(--ink);
  font-size: 0.92rem;
}

.method-hero p,
.method-card p,
.method-card li,
.check-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.grade-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 250px;
}

.grade {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.grade.high {
  color: var(--good);
  background: var(--good-soft);
  border-color: #b8dec5;
}

.grade.mid {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ead28e;
}

.grade.low {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: #efb4ac;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.method-card {
  min-width: 0;
  padding: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.method-card.wide {
  grid-column: span 2;
}

.method-card ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.method-card li + li {
  margin-top: 4px;
}

.weight-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.weight-grid.seven {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weight-grid div {
  min-width: 0;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weight-grid strong,
.weight-grid span,
.weight-grid small {
  display: block;
}

.weight-grid strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1rem;
}

.weight-grid span {
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 900;
}

.weight-grid small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.3;
}

.method-card.checklist {
  background: var(--surface-soft);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.check-grid span {
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.footnote {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

@media (max-width: 1320px) {
  .masthead,
  .layout,
  .screener-controls,
  .evidence-grid,
  .method-grid,
  .weight-grid,
  .weight-grid.seven,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .method-card.wide {
    grid-column: span 1;
  }

  .content {
    max-height: none;
  }
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 20px, 1880px);
    padding-top: 10px;
  }

  .masthead,
  .toolbar {
    padding: 12px;
  }

  .status-grid,
  .toolbar,
	  .topic-overview,
	  .home-dashboard-grid,
	  .screener-controls,
  .view-switch,
  .pair,
  .tracker-stats,
  .feed-grid,
  .evidence-grid,
  .mini-list,
  .kpi-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .lookup-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .lookup-actions {
    justify-content: flex-start;
  }

  .span-2 {
    grid-column: span 1;
  }

  .button-row {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .lookup-empty {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-key summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

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

  .detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grade-stack {
    justify-content: flex-start;
    min-width: 0;
  }

  h1 {
    font-size: 1.7rem;
  }
}
