:root {
  color-scheme: light;
  --ink: #171b1f;
  --ink-soft: #4d565c;
  --muted: #788187;
  --line: #d8dddc;
  --line-strong: #aeb7b5;
  --paper: #f3f6f5;
  --surface: #ffffff;
  --surface-quiet: #e9eeec;
  --red: #d34830;
  --red-soft: #f5ddd7;
  --teal: #0b7773;
  --teal-soft: #d9ece9;
  --yellow: #d8a721;
  --yellow-soft: #f4e9c4;
  --blue: #436da3;
  --blue-soft: #e1e8f2;
  --radius: 6px;
  --header-height: 76px;
  --rail-width: 260px;
  --shadow: 0 18px 60px rgb(21 29 31 / 12%);
  font-family: "Avenir Next", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

button,
input,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(11 119 115 / 24%);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.mobile-only {
  display: none !important;
}

.app-header {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, var(--rail-width)) minmax(280px, 620px) auto;
  align-items: center;
  gap: 24px;
  height: var(--header-height);
  padding: 0 24px;
  color: #fff;
  background: var(--ink);
  border-bottom: 4px solid var(--red);
}

.brand-block {
  min-width: 0;
}

.brand-kicker {
  margin: 0 0 2px;
  color: #aeb8b7;
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.brand-block h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

.global-search {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  color: #d8dfdd;
  background: #2a3034;
  border: 1px solid #485055;
  border-radius: var(--radius);
  transition: border-color 160ms ease, background 160ms ease;
}

.global-search:focus-within {
  background: #31383c;
  border-color: #a8b7b3;
}

.global-search > span {
  font-family: Georgia, serif;
  font-size: 25px;
  line-height: 1;
  transform: translateY(-1px);
}

.global-search input {
  min-width: 0;
  height: 100%;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 0;
  outline: 0;
}

.global-search input::placeholder {
  color: #97a2a1;
}

kbd {
  min-width: 34px;
  padding: 3px 6px;
  color: #bfc8c6;
  font-family: inherit;
  font-size: 10px;
  text-align: center;
  background: #1b1f22;
  border: 1px solid #4d575b;
  border-radius: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.data-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #bfc7c5;
  font-size: 12px;
  white-space: nowrap;
}

.data-status i {
  width: 8px;
  height: 8px;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(216 167 33 / 12%);
}

.data-status.is-ready i {
  background: #58b99e;
  box-shadow: 0 0 0 4px rgb(88 185 158 / 12%);
}

.data-status.is-error i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgb(211 72 48 / 15%);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.button:hover {
  background: var(--surface-quiet);
  border-color: var(--ink-soft);
}

.app-header .button.secondary {
  color: #fff;
  border-color: #626b70;
}

.app-header .button.secondary:hover {
  background: #353d41;
  border-color: #909a9f;
}

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

.button.primary-link:hover {
  background: var(--teal);
  border-color: var(--teal);
}

.workspace {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  height: calc(100dvh - var(--header-height));
}

.filter-rail {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 18px 16px;
  overflow: auto;
  background: #edf1ef;
  border-right: 1px solid var(--line-strong);
}

.rail-heading,
.analysis-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.rail-heading > div,
.analysis-heading > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-index {
  color: var(--red);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 11px;
  font-weight: 800;
}

.rail-heading h2,
.analysis-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 19px;
  line-height: 1;
}

#filterForm {
  display: grid;
  gap: 15px;
  margin-top: 24px;
}

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

.field > span,
.compact-field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.field select,
.compact-field select {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 10px;
  background-color: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.field select:hover,
.compact-field select:hover {
  border-color: var(--line-strong);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.reset-button {
  width: 100%;
  margin-top: 2px;
  color: var(--ink-soft);
  background: transparent;
}

.rail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 22px;
  color: var(--muted);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 10px;
  border-top: 1px solid var(--line);
}

.rail-foot strong {
  color: var(--ink);
}

.main-stage {
  min-width: 0;
  min-height: 0;
  padding: 18px 22px 32px;
  overflow: auto;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  background: var(--surface);
  border: 1px solid var(--line-strong);
}

.metric {
  position: relative;
  min-width: 0;
  min-height: 102px;
  padding: 15px 17px 13px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric::before {
  position: absolute;
  top: -1px;
  left: -1px;
  width: calc(100% + 2px);
  height: 4px;
  content: "";
  background: var(--line-strong);
}

.metric.primary::before {
  background: var(--teal);
}

.metric.accent::before {
  background: var(--red);
}

.metric span {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 31px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.analysis-band {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding: 17px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.analysis-heading {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.analysis-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.category-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 8px;
  min-height: 106px;
}

.chart-item {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 5px;
  min-width: 0;
  padding: 8px 9px;
  text-align: left;
  background: #f6f8f7;
  border: 1px solid var(--line);
  border-radius: 4px;
}

button.chart-item:hover {
  background: var(--teal-soft);
  border-color: #91bcb8;
}

.chart-track {
  display: flex;
  align-items: flex-end;
  height: 38px;
  background:
    linear-gradient(transparent 49%, #dfe5e3 50%, transparent 52%),
    transparent;
}

.chart-bar {
  width: 100%;
  min-height: 4px;
  background: var(--teal);
  transform-origin: bottom;
  animation: bar-rise 440ms cubic-bezier(.2, .8, .2, 1) both;
}

.chart-item:nth-child(2n) .chart-bar {
  background: var(--blue);
}

.chart-item:nth-child(3n) .chart-bar {
  background: var(--red);
}

.chart-item strong {
  display: -webkit-box;
  min-height: 28px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chart-item span {
  color: var(--muted);
  font-size: 10px;
}

.empty-chart {
  display: grid;
  grid-column: 1 / -1;
  min-height: 96px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  border: 1px dashed var(--line-strong);
}

@keyframes bar-rise {
  from {
    transform: scaleY(0);
  }
}

.data-area {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}

.data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 0 12px 0 4px;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  align-items: stretch;
  align-self: stretch;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  border: 0;
}

.tab::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  content: "";
  background: transparent;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: var(--ink);
}

.tab.is-active::after {
  background: var(--red);
}

.tab span {
  min-width: 22px;
  padding: 2px 5px;
  color: var(--ink-soft);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 10px;
  text-align: center;
  background: var(--surface-quiet);
  border-radius: 3px;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-field select {
  width: auto;
  min-width: 112px;
  height: 34px;
}

.result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 7px 12px;
  background: #f7f9f8;
  border-bottom: 1px solid var(--line);
}

.result-line p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.result-line strong {
  color: var(--ink);
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  color: var(--teal);
  font-size: 10px;
  background: var(--teal-soft);
  border: 0;
  border-radius: 3px;
}

.filter-chip:hover {
  color: #fff;
  background: var(--teal);
}

.view-panel {
  min-height: 420px;
}

.table-wrap {
  min-width: 0;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  background: #eef2f0;
  border-bottom: 1px solid var(--line-strong);
}

.data-table td {
  padding: 11px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.data-table tbody tr {
  background: #fff;
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: #f6f9f8;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.signal-table .number-cell {
  width: 48px;
}

.signal-table th:nth-child(2) {
  width: 190px;
}

.signal-table th:nth-child(4) {
  width: 145px;
}

.signal-table th:nth-child(5) {
  width: 128px;
}

.signal-table .action-cell {
  width: 46px;
}

.row-id {
  color: var(--muted);
  font-family: "DIN Alternate", "Avenir Next Condensed", monospace;
  font-size: 11px;
  font-weight: 700;
}

.category-code {
  display: block;
  margin-bottom: 4px;
  color: var(--red);
  font-family: "DIN Alternate", "Avenir Next Condensed", monospace;
  font-size: 10px;
  font-weight: 800;
}

.category-name {
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.domain-name {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.scenario-text {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.quote-text {
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: "Songti SC", "STSong", serif;
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.source-name {
  display: block;
  font-size: 11px;
  font-weight: 800;
}

.product-name {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 3px 6px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: 3px;
}

.badge.independent {
  color: #075f5b;
  background: var(--teal-soft);
  border-color: #a5ceca;
}

.badge.supply {
  color: #355781;
  background: var(--blue-soft);
  border-color: #bbcbe1;
}

.badge.pending {
  color: #775f13;
  background: var(--yellow-soft);
  border-color: #ddcb89;
}

.badge.counter {
  display: flex;
  width: max-content;
  margin-top: 5px;
  color: #7d3b2f;
  background: var(--red-soft);
  border-color: #e2b0a5;
}

.row-open {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  font-size: 18px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.row-open:hover {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.category-table th:nth-child(1) {
  width: 220px;
}

.category-table th:nth-child(2) {
  width: 220px;
}

.category-table th:nth-child(3) {
  width: 170px;
}

.category-table th:nth-child(4) {
  width: 105px;
}

.category-link {
  width: 100%;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
}

.category-link:hover .category-name {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.evidence-number {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.evidence-number strong {
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 20px;
}

.evidence-number span {
  color: var(--muted);
  font-size: 9px;
}

.evidence-bar {
  display: flex;
  width: 100%;
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  background: var(--surface-quiet);
  border-radius: 2px;
}

.evidence-bar i {
  display: block;
  height: 100%;
}

.evidence-bar .independent {
  background: var(--teal);
}

.evidence-bar .supply {
  background: var(--blue);
}

.evidence-bar .pending {
  background: var(--yellow);
}

.evidence-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.platform-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.platform-list span {
  padding: 3px 5px;
  color: var(--ink-soft);
  font-size: 9px;
  background: var(--surface-quiet);
  border-radius: 3px;
}

.fit-mark {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 900;
  border: 1px solid;
  border-radius: 3px;
}

.fit-mark.high,
.fit-mark.medium_high {
  color: #065c58;
  background: var(--teal-soft);
  border-color: #91bfba;
}

.fit-mark.medium {
  color: #745e18;
  background: var(--yellow-soft);
  border-color: #d8c376;
}

.fit-mark.medium_low,
.fit-mark.low {
  color: var(--muted);
  background: var(--surface-quiet);
  border-color: var(--line);
}

.assessment {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.pain-table th:nth-child(1) {
  width: 230px;
}

.pain-table th:nth-child(2) {
  width: 100px;
}

.pain-table th:nth-child(3) {
  width: 110px;
}

.pain-table th:nth-child(4) {
  width: 220px;
}

.status-label {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 3px 6px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 800;
  background: var(--surface-quiet);
  border-radius: 3px;
}

.pain-name {
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.number-stack {
  display: grid;
  gap: 5px;
}

.number-stack strong {
  font-family: "DIN Alternate", "Avenir Next Condensed", sans-serif;
  font-size: 20px;
}

.number-stack span {
  color: var(--muted);
  font-size: 9px;
}

.cell-copy {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.next-step {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
  border-top: 1px solid var(--line);
}

.empty-state {
  display: grid;
  min-height: 320px;
  place-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-family: "Songti SC", "STSong", serif;
  font-size: 18px;
}

.empty-state button {
  color: var(--teal);
  background: transparent;
  border: 0;
}

.drawer-scrim,
.filter-scrim {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: rgb(15 20 22 / 35%);
  backdrop-filter: blur(2px);
}

.detail-drawer {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(520px, calc(100vw - 36px));
  height: 100dvh;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.detail-drawer > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 82px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-id {
  color: var(--red);
  font-family: "DIN Alternate", "Avenir Next Condensed", monospace;
  font-size: 10px;
  font-weight: 800;
}

.detail-drawer h2 {
  margin: 5px 0 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 21px;
  line-height: 1.25;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.icon-button:hover {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.drawer-content {
  padding: 20px;
  overflow: auto;
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.drawer-section {
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.drawer-section:first-of-type {
  border-top: 0;
}

.drawer-section h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.drawer-section p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.drawer-section.quote p {
  color: var(--ink);
  font-family: "Songti SC", "STSong", serif;
  font-size: 16px;
  line-height: 1.65;
}

.detail-drawer > footer {
  padding: 14px 20px;
  background: #f3f6f5;
  border-top: 1px solid var(--line);
}

.detail-drawer > footer .button {
  width: 100%;
}

.loading-screen {
  position: fixed;
  z-index: 120;
  display: grid;
  place-content: center;
  gap: 16px;
  inset: 0;
  color: #fff;
  text-align: center;
  background: var(--ink);
  transition: opacity 260ms ease, visibility 260ms ease;
}

.loading-screen.is-done {
  visibility: hidden;
  opacity: 0;
}

.loading-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border: 7px solid #465055;
  border-top-color: var(--red);
  border-right-color: var(--teal);
  border-radius: 50%;
  animation: rotate 900ms linear infinite;
}

.loading-screen p {
  margin: 0;
  color: #bdc7c5;
  font-size: 12px;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  z-index: 130;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 11px 14px;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  background: var(--ink);
  border-left: 4px solid var(--teal);
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .app-header {
    grid-template-columns: 210px minmax(260px, 1fr) auto;
  }

  .data-status span {
    display: none;
  }

  .metric-strip {
    grid-template-columns: repeat(5, minmax(100px, 1fr));
  }

  .category-chart {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 68px;
  }

  body {
    overflow: auto;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .icon-button.mobile-only {
    display: grid !important;
  }

  .app-header {
    position: sticky;
    top: 0;
    grid-template-columns: auto minmax(200px, 1fr) auto;
    gap: 12px;
    padding: 0 14px;
  }

  .brand-kicker {
    display: none;
  }

  .brand-block h1 {
    font-size: 19px;
  }

  .header-actions .data-status {
    display: none;
  }

  .app-header .button {
    width: 38px;
    padding: 0;
    font-size: 0;
  }

  .app-header .button span {
    font-size: 17px;
  }

  .workspace {
    display: block;
    height: auto;
  }

  .filter-rail {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    width: min(330px, calc(100vw - 44px));
    height: 100dvh;
    border-right-color: var(--line-strong);
    box-shadow: var(--shadow);
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
  }

  .filter-rail.is-open {
    transform: translateX(0);
  }

  .main-stage {
    padding: 14px 14px 28px;
    overflow: visible;
  }

  .metric-strip {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

  .metric {
    min-height: 90px;
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(3) {
    border-right: 0;
  }

  .metric:nth-child(4),
  .metric:nth-child(5) {
    border-bottom: 0;
  }

  .analysis-band {
    grid-template-columns: 1fr;
  }

  .analysis-heading {
    flex-direction: row;
    align-items: flex-end;
  }

  .data-table {
    min-width: 840px;
  }

  .category-table {
    min-width: 940px;
  }

  .pain-table {
    min-width: 980px;
  }
}

@media (max-width: 620px) {
  .app-header {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .brand-block h1 {
    max-width: 62px;
    font-size: 17px;
    line-height: 1.05;
  }

  .header-actions {
    display: none;
  }

  .global-search {
    height: 40px;
  }

  .global-search kbd {
    display: none;
  }

  .main-stage {
    padding: 10px 10px 24px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 88px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric:nth-child(3) {
    border-right: 1px solid var(--line);
  }

  .metric:nth-child(4) {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(5) {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .metric strong {
    font-size: 27px;
  }

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

  .data-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .tabs {
    width: 100%;
    min-height: 50px;
    overflow-x: auto;
  }

  .tab {
    flex: 1 0 auto;
    padding: 0 10px;
  }

  .toolbar-controls {
    justify-content: space-between;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
  }

  .result-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .active-filters {
    justify-content: flex-start;
  }

  .detail-drawer {
    width: 100vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
