:root {
  color-scheme: light;
  --header-height: 4.5rem;
  --page-max: 96rem;
  --page-pad: clamp(1.5rem, 3vw, 3rem);
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f4f5f6;
  --surface-hover: #fff8f4;
  --ink: #111315;
  --ink-soft: #3f454b;
  --ink-muted: #687078;
  --line: #d9dde0;
  --line-soft: #eceeef;
  --line-strong: #777f86;
  --accent: #e4572e;
  --accent-strong: #ad3513;
  --positive: #08784f;
  --warning: #8a5700;
  --negative: #ba3147;
  --focus: #e4572e;
  /* Named so no colour lives only inside a rule (audit E: 8 off-palette values). */
  --ink-hover: #2b2e32;       /* design.json button hover */
  --accent-soft: #f2c8b5;     /* text selection background */
  --accent-ink: #341205;      /* text selection foreground */
  --control-height: 3rem;
  --input-height: 3.75rem;    /* design.json: search input 60px */
  --control-radius: 0.25rem;
  /* DESIGN.md spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 20rem;
  background: var(--surface);
  scrollbar-color: var(--line-strong) var(--surface-soft);
  scrollbar-width: thin;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-wrap: break-word;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 480;
  line-height: 1.45;
  word-break: keep-all;
}

body::-webkit-scrollbar,
.table-shell::-webkit-scrollbar {
  width: 0.625rem;
  height: 0.625rem;
}

body::-webkit-scrollbar-track,
.table-shell::-webkit-scrollbar-track {
  background: var(--surface-soft);
}

body::-webkit-scrollbar-thumb,
.table-shell::-webkit-scrollbar-thumb {
  border: 0.125rem solid var(--surface-soft);
  border-radius: var(--control-radius);
  background: var(--line-strong);
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

a {
  color: inherit;
}

button,
input,
select,
summary {
  color: inherit;
  font: inherit;
}

button,
select,
summary {
  cursor: pointer;
}

input,
select {
  caret-color: var(--accent);
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

.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;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

:where(a, button, input, select, summary):focus-visible {
  outline: 0.1875rem solid var(--focus);
  outline-offset: 0.125rem;
}

.app-shell,
.workspace,
.console-page,
.results-region {
  min-width: 0;
}

.app-shell {
  min-height: 100dvh;
}

.page-width {
  width: min(100%, var(--page-max));
  min-width: 0;
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--page-pad);
  padding-left: var(--page-pad);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-inner {
  display: grid;
  grid-template-columns: 16rem minmax(21rem, 1fr) auto;
  align-items: stretch;
  height: var(--header-height);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-right: 2rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand strong {
  font-size: 1.5rem;
  font-weight: 880;
  line-height: 1;
}

.primary-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7.5rem;
  padding: 0 1.375rem;
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 130ms ease;
}

.nav-link::after {
  position: absolute;
  right: 1.375rem;
  bottom: 0;
  left: 1.375rem;
  height: 0.25rem;
  background: transparent;
  content: "";
}

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

.nav-link.is-active {
  color: var(--ink);
  font-weight: 780;
}

.nav-link.is-active::after {
  background: var(--accent);
}

.market-scope {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.875rem;
  min-width: 0;
  padding-left: 1.5rem;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.scope-label {
  color: var(--ink-muted);
  font-weight: 560;
}

.scope-primary {
  color: var(--ink);
  font-weight: 720;
}

.scope-secondary {
  padding-left: 0.875rem;
  border-left: 1px solid var(--line);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.workspace {
  min-height: calc(100dvh - var(--header-height));
}

.route-header {
  background: var(--canvas);
}

.route-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
  padding-top: 2.75rem;
  padding-bottom: 2rem;
}

.route-heading {
  max-width: 42rem;
}

.route-heading h1 {
  color: var(--ink);
  font-size: 2.5rem;
  font-weight: 850;
  line-height: 1.08;
}

.route-heading p {
  max-width: 70ch;
  margin-top: 0.625rem;
  color: var(--ink-soft);
  font-size: 1rem;
}

.route-facts {
  display: grid;
  grid-template-columns: minmax(10rem, 1.4fr) minmax(7rem, 1fr) minmax(7rem, 1fr);
  min-width: min(100%, 34rem);
}

.route-facts > div {
  min-width: 0;
  padding: 0.25rem 1.75rem;
  border-left: 1px solid var(--line);
}

.route-facts dt,
.coverage-summary dt,
.company-metrics dt,
.entity-meta dt {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 580;
}

.route-facts dd {
  margin-top: 0.4rem;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 740;
  line-height: 1.3;
}

.route-context {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.route-context span {
  padding: 0 1.25rem;
}

.route-context span:first-child {
  padding-left: 0;
}

.route-context span + span {
  border-left: 1px solid var(--line);
}

.command-surface,
.filter-surface,
.coverage-summary {
  background: var(--canvas);
}

.command-inner {
  position: relative;
}

.query-form {
  position: relative;
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.query-copy {
  display: grid;
  gap: 0.2rem;
}

.query-copy label,
.form-group label {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
}

.query-copy span {
  color: var(--ink-muted);
  font-size: 0.8125rem;
}

.query-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11rem;
  gap: 0.75rem;
  min-width: 0;
}

.search-input,
.form-control {
  width: 100%;
  border: 1px solid var(--line-strong); /* >= 3:1 against the control surface */
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 130ms ease, background-color 130ms ease;
}

.search-input {
  height: var(--input-height);
  padding: 0 1.125rem;
  font-size: 1rem; /* DESIGN.md: inputs use the body face */
}

.form-control {
  height: var(--control-height);
  padding: 0 0.875rem;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.search-input::placeholder,
.form-control::placeholder {
  color: var(--ink-muted);
  opacity: 1;
}

.search-input:hover,
.form-control:hover {
  border-color: var(--line-strong);
}

.search-input:focus,
.form-control:focus {
  border-color: var(--accent);
}

/* Mouse focus keeps only the border cue; keyboard focus keeps the ring
   from the :focus-visible rule above (this used to blanket-remove it). */
.search-input:focus:not(:focus-visible),
.form-control:focus:not(:focus-visible) {
  outline: none;
}

/* Anchored section headings land below the sticky header and record nav. */
.workspace-section h2[id] {
  scroll-margin-top: calc(var(--header-height) + 4rem);
}

/* Text an HTMX request failed to replace. */
.request-error {
  margin: 0.5rem 0 0;
  color: var(--negative);
  font-size: 0.8125rem;
  font-weight: 560;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  font-size: 0.9375rem;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 130ms ease, color 130ms ease, transform 80ms ease;
}

.button-primary {
  background: var(--ink);
  color: var(--surface);
}

.button-primary:hover {
  background: var(--ink-hover);
}

.button:active {
  transform: translateY(1px);
}

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

.query-control .button {
  min-height: 3.75rem;
}

.request-status {
  position: absolute;
  right: 0;
  bottom: -1.55rem;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 680;
}

.htmx-indicator {
  opacity: 0;
  visibility: hidden;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
  visibility: visible;
}

.filter-console {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.filter-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
  list-style: none;
}

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

.filter-summary::after {
  margin-left: auto;
  color: var(--ink-muted);
  content: "+";
  font-size: 1.125rem;
  font-weight: 520;
}

.filter-console[open] .filter-summary::after {
  content: "-";
}

.filter-summary span {
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 740;
}

.filter-summary small {
  color: var(--ink-muted);
  font-size: 0.8125rem;
}

.filter-panel {
  padding: 0.375rem 0 1.25rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.05fr repeat(6, minmax(0, 1fr));
  gap: 0.875rem;
}

.form-group {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  min-width: 0;
}

.input-with-unit {
  position: relative;
  min-width: 0;
}

.input-with-unit .form-control {
  padding-right: 4.75rem;
}

.input-with-unit > span {
  position: absolute;
  top: 50%;
  right: 0.875rem;
  max-width: 4rem;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 580;
  text-overflow: ellipsis;
  transform: translateY(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 1.25rem;
  padding-top: 1.125rem;
  border-top: 1px solid var(--line);
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  cursor: pointer;
}

.checkbox-field input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--accent);
}

.action-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.action-group .request-status {
  position: static;
}

.results-workspace,
.record-workspace {
  padding-bottom: 4rem;
}

.results-workspace {
  margin-top: 2.25rem;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 3.25rem;
  padding: 0 1rem;
}

.toolbar-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 710;
}

.toolbar-title strong {
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 780;
}

.toolbar-context {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.toolbar-context span {
  padding: 0 0.875rem;
}

.toolbar-context span:first-child {
  padding-left: 0;
}

.toolbar-context span + span {
  border-left: 1px solid var(--line);
}

.table-shell {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  background: transparent;
}

.comparison-shell {
  border-top: 2px solid var(--ink);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  height: 3.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table thead th {
  height: 3.25rem;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.data-table tbody tr {
  background: transparent;
  transition: background-color 120ms ease;
}

.data-table tbody tr:hover,
.data-table tbody tr:focus-within {
  background: var(--surface-hover);
}

.data-table tbody th {
  color: var(--ink-soft);
  font-weight: 680;
}

.company-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}

.company-table th:first-child,
.company-table td:first-child {
  width: 10rem;
}

.company-table th:nth-child(3),
.company-table td:nth-child(3) {
  width: 8.5rem;
}

.company-table th:nth-child(4),
.company-table td:nth-child(4) {
  width: 8.5rem;
}

.company-table tbody tr:hover td:first-child,
.company-table tbody tr:focus-within td:first-child {
  border-left: 3px solid var(--accent);
  padding-left: calc(1rem - 3px);
}

.screener-table {
  min-width: 78rem;
}

.screener-table th:first-child,
.screener-table td:first-child {
  width: 7rem;
}

.screener-table th:nth-child(2),
.screener-table td:nth-child(2) {
  min-width: 15rem;
}

.coverage-table {
  min-width: 48rem;
}

.financial-table {
  min-width: max(48rem, 100%);
}

.financial-table .sticky-column {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 9rem;
  background: var(--surface);
}

.data-table thead .sticky-column {
  z-index: 3;
  background: var(--surface-soft);
}

.financial-table tbody tr:hover .sticky-column,
.financial-table tbody tr:focus-within .sticky-column {
  background: var(--surface-hover);
}

.period-column {
  min-width: 7rem;
}

.period-context {
  display: block;
  margin-top: 0.125rem;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 560;
}

/* Basis of a screener row's income figures (TTM ~2026.06 / 연간 FY2025). */
.cell-basis {
  white-space: nowrap;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 520;
}

/* Second line under a number: the years a CAGR spans. */
.cell-secondary {
  display: block;
  margin-top: 0.125rem;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 520;
}

/* Under the company metric strip: what the numbers are based on. */
.metric-context {
  margin: 0.5rem 0 0;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 520;
  line-height: 1.5;
}

.disclosure-table {
  min-width: 44rem;
}

.disclosure-table th:first-child,
.disclosure-table td:first-child {
  width: 9rem;
}

.disclosure-table th:nth-child(3),
.disclosure-table td:nth-child(3) {
  width: 10rem;
}

.disclosure-table th:last-child,
.disclosure-table td:last-child {
  width: 6rem;
}

.numeric {
  text-align: right !important;
}

.cell-code,
.cell-date,
.fact-date,
.stock-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.cell-code {
  color: var(--ink-soft);
  font-size: 0.8125rem !important;
}

.cell-action {
  text-align: right !important;
}

.company-link,
.row-link,
.text-link,
.back-link,
.record-nav a {
  text-underline-offset: 0.22rem;
}

.company-link {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 720;
  text-decoration: none;
}

.company-secondary {
  display: block;
  max-width: 44rem;
  margin-top: 0.15rem;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 480;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-link:hover,
.company-link:focus-visible,
.row-link:hover,
.text-link:hover,
.back-link:hover,
.record-nav a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.row-link,
.text-link {
  color: var(--ink);
  font-weight: 680;
}

.row-link {
  text-decoration: none;
  white-space: nowrap;
}

.market-code {
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 560;
}

.table-empty {
  height: 7rem !important;
  color: var(--ink-muted);
  text-align: center !important;
}

.entity-header {
  background: var(--canvas);
}

.entity-layout {
  display: grid;
  grid-template-columns: minmax(24rem, 1.1fr) minmax(0, 1.55fr);
  align-items: end;
  gap: 3rem;
  padding-top: 2.5rem;
  padding-bottom: 2.25rem;
  border-bottom: 2px solid var(--ink);
}

.entity-identity {
  min-width: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 600;
}

.entity-title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  min-width: 0;
}

.entity-title-line h1 {
  min-width: 0;
  color: var(--ink);
  font-size: 2.75rem;
  font-weight: 850;
  line-height: 1.05;
}

.stock-code {
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-weight: 620;
}

.entity-industry {
  margin-top: 0.625rem;
  color: var(--ink-soft);
  font-size: 1rem;
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.entity-meta > div {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.entity-meta dd {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.company-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
}

.company-metrics > div {
  min-width: 0;
  padding: 0.5rem 1.75rem 0.625rem;
}

.company-metrics > div + div {
  border-left: 1px solid var(--line);
}

.company-metrics dd {
  margin-top: var(--space-sm);
  color: var(--ink);
  font-size: 1.875rem;
  font-weight: 790;
  font-variant-numeric: tabular-nums; /* design.json */
  line-height: 1.15;
  white-space: nowrap;
}

.company-metrics dd span {
  margin-left: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
}

.record-nav {
  position: sticky;
  top: var(--header-height);
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.record-nav-inner {
  display: flex;
  align-items: stretch;
  min-height: 4rem;
}

.record-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 1.5rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-weight: 650;
  text-decoration: none;
}

.record-nav a:first-child {
  color: var(--ink);
  font-weight: 780;
}

.record-nav a:first-child::after {
  position: absolute;
  right: 1.5rem;
  bottom: -1px;
  left: 1.5rem;
  height: 0.25rem;
  background: var(--accent);
  content: "";
}

.record-workspace {
  padding-top: 1.75rem;
}

.workspace-section + .workspace-section {
  margin-top: 3rem;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.625rem 0 0.875rem;
}

.section-heading h2 {
  color: var(--ink);
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.2;
}

.section-heading p,
.section-unit {
  margin-top: 0.3rem;
  color: var(--ink-muted);
  font-size: 0.8125rem;
}

.section-unit {
  margin-top: 0;
  white-space: nowrap;
}

.empty-panel {
  display: grid;
  min-height: 8rem;
  place-items: center;
  border-top: 1px solid var(--ink-soft);
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
}

.service-state {
  align-self: center;
  color: var(--positive);
  font-size: 1.0625rem;
  font-weight: 720;
  white-space: nowrap;
}

.coverage-summary-inner {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr repeat(3, 0.8fr);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.coverage-summary-inner > div {
  min-width: 0;
  padding: 1.5rem 1.75rem;
}

.coverage-summary-inner > div + div {
  border-left: 1px solid var(--line);
}

.coverage-summary dd {
  margin-top: 0.4rem;
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 760;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.coverage-workspace {
  margin-top: 2rem;
}

.coverage-toolbar {
  padding-right: 0;
  padding-left: 0;
}

.coverage-note {
  margin-top: 0.75rem;
  color: var(--ink-muted);
  font-size: 0.75rem;
}

.status-count {
  font-size: 1.0625rem;
  font-weight: 720;
}

.is-positive {
  color: var(--positive) !important;
}

.is-warning {
  color: var(--warning) !important;
}

.is-negative {
  color: var(--negative) !important;
}

@media (max-width: 75rem) {
  :root {
    --page-pad: 1.5rem;
  }

  .header-inner {
    grid-template-columns: 12.5rem minmax(19rem, 1fr) auto;
  }

  .nav-link {
    min-width: 6.5rem;
    padding-right: 0.9rem;
    padding-left: 0.9rem;
  }

  .scope-label {
    display: none;
  }

  .route-header-inner {
    gap: 1.5rem;
  }

  .route-facts > div {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }

  .entity-layout {
    grid-template-columns: minmax(20rem, 0.9fr) minmax(0, 1.4fr);
    gap: 1.5rem;
  }

  .company-metrics > div {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

@media (max-width: 62rem) {
  .market-scope {
    gap: 0.625rem;
  }

  .scope-secondary {
    display: none;
  }

  .route-header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-facts {
    width: 100%;
  }

  .route-context {
    justify-content: flex-start;
  }

  .query-form {
    grid-template-columns: 10.5rem minmax(0, 1fr);
  }

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

  .entity-layout {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .company-metrics {
    border-top: 1px solid var(--line);
    padding-top: 1.25rem;
  }

  .company-metrics > div:first-child {
    padding-left: 0;
  }

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

  .coverage-summary-inner > div:nth-child(4) {
    border-left: 0;
  }

  .coverage-summary-inner > div:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 48rem) {
  :root {
    --header-height: 6.25rem;
    --page-pad: 1rem;
  }

  body {
    font-size: 0.9375rem;
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    padding-right: 0;
    padding-left: 0;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-height: 3.5rem;
    padding-left: var(--page-pad);
  }

  .brand strong {
    font-size: 1.1875rem;
  }

  .market-scope {
    grid-column: 2;
    grid-row: 1;
    min-height: 3.5rem;
    max-width: 12.5rem;
    padding-right: var(--page-pad);
    padding-left: 0.5rem;
    overflow: hidden;
  }

  .scope-primary {
    overflow: hidden;
    font-size: 0.75rem;
    text-overflow: ellipsis;
  }

  .primary-nav {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 2.75rem;
    border-top: 1px solid var(--line);
  }

  .nav-link {
    min-width: 0;
    padding: 0;
    font-size: 0.875rem;
  }

  .nav-link::after {
    right: 1rem;
    left: 1rem;
  }

  .route-header-inner {
    gap: 1.25rem;
    padding-top: 1.75rem;
    padding-bottom: 1.25rem;
  }

  .route-heading {
    padding-left: 0;
  }

  .route-heading h1 {
    font-size: 2rem;
  }

  .route-heading p {
    margin-top: 0.4rem;
    font-size: 0.875rem;
  }

  .route-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--ink-soft);
    border-bottom: 1px solid var(--ink-soft);
  }

  .route-facts > div {
    padding: 0.875rem 0.75rem;
    border-left: 0;
    text-align: center;
  }

  .route-facts > div + div {
    border-left: 1px solid var(--line);
  }

  .route-facts dt {
    font-size: 0.75rem;
  }

  .route-facts dd {
    margin-top: 0.25rem;
    font-size: 0.9375rem;
  }

  .route-context {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.2rem;
    font-size: 0.75rem;
  }

  .route-context span {
    padding-right: 0.85rem;
    padding-left: 0.85rem;
  }

  .query-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    padding: 1rem 0;
  }

  .query-copy {
    gap: 0.1rem;
  }

  .query-control {
    grid-template-columns: minmax(0, 1fr) 4.75rem;
    gap: 0.625rem;
  }

  .search-input,
  .query-control .button {
    height: 3rem;
    min-height: 3rem;
  }

  .search-input {
    padding: 0 0.875rem;
    font-size: 0.9375rem;
  }

  .request-status {
    bottom: -1.35rem;
  }

  .filter-summary {
    min-height: 3rem;
  }

  .filter-summary small {
    display: none;
  }

  .filter-grid {
    gap: 0.75rem;
  }

  .filter-actions {
    align-items: flex-end;
  }

  .checkbox-field {
    align-items: flex-start;
    line-height: 1.35;
  }

  .results-workspace {
    margin-top: 1.5rem;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    min-height: 2.75rem;
    padding: 0.5rem 0 0.625rem;
  }

  .toolbar-title,
  .toolbar-title strong {
    font-size: 0.875rem;
  }

  .toolbar-context {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: normal;
  }

  .toolbar-context span {
    min-width: 0;
    padding-right: 0.6rem;
    padding-left: 0.6rem;
  }

  .toolbar-context span:last-child {
    padding-right: 0;
  }

  .data-table th,
  .data-table td {
    padding: 0.65rem 0.75rem;
  }

  .entity-layout {
    gap: 1.5rem;
    padding-top: 1.25rem;
    padding-bottom: 1.5rem;
  }

  .back-link {
    margin-bottom: 0.75rem;
  }

  .entity-title-line {
    padding-left: 0;
  }

  .entity-title-line h1 {
    flex-basis: 100%;
    font-size: 2.25rem;
  }

  .entity-industry,
  .entity-meta {
    padding-left: 0;
  }

  .company-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 0;
    border-top-color: var(--ink-soft);
    border-bottom: 1px solid var(--ink-soft);
  }

  .company-metrics > div {
    padding: 1rem;
  }

  .company-metrics > div:first-child {
    padding-left: 1rem;
  }

  .company-metrics > div:nth-child(3) {
    border-left: 0;
  }

  .company-metrics > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .company-metrics dd {
    font-size: 1.5rem;
  }

  .record-nav-inner {
    min-height: 3.25rem;
    padding-right: 0;
    padding-left: 0;
  }

  .record-nav a {
    flex: 1;
    justify-content: center;
    padding: 0;
  }

  .record-nav a:first-child::after {
    right: 1rem;
    left: 1rem;
  }

  .record-workspace {
    padding-top: 1.1rem;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h2 {
    font-size: 1.375rem;
  }

  .workspace-section + .workspace-section {
    margin-top: 2rem;
  }

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

  .coverage-summary-inner > div,
  .coverage-summary-inner > div:nth-child(4) {
    padding: 1rem;
    border-top: 0;
    border-left: 0;
  }

  .coverage-summary-inner > div:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .coverage-summary-inner > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .coverage-summary-inner > div:last-child {
    grid-column: 1 / -1;
    border-left: 0;
  }

  .coverage-summary dd {
    font-size: 1.0625rem;
  }

  .coverage-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.55rem 0;
  }
}

@media (max-width: 40rem) {
  .company-table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
  }

  .company-table th,
  .company-table td {
    padding-right: 0.55rem;
    padding-left: 0.55rem;
  }

  .company-table th:first-child,
  .company-table td:first-child {
    width: 24%;
  }

  .company-table th:nth-child(2),
  .company-table td:nth-child(2) {
    width: 43%;
  }

  .company-table th:nth-child(3),
  .company-table td:nth-child(3) {
    width: 15%;
  }

  .company-table th:nth-child(4),
  .company-table td:nth-child(4) {
    width: 18%;
  }

  .company-table .company-link {
    font-size: 0.875rem;
  }

  .company-table .company-secondary {
    font-size: 0.75rem;
  }

  .company-table .cell-code,
  .company-table .market-code,
  .company-table .row-link {
    font-size: 0.75rem !important;
  }

  .company-table tbody tr:hover td:first-child,
  .company-table tbody tr:focus-within td:first-child {
    padding-left: calc(0.55rem - 3px);
  }

  .screener-table {
    min-width: 72rem;
  }

  .financial-table {
    min-width: 46rem;
  }

  .disclosure-table {
    min-width: 40rem;
  }
}

@media (max-width: 22rem) {
  :root {
    --page-pad: 0.75rem;
  }

  .brand strong {
    font-size: 1rem;
  }

  .market-scope {
    max-width: 9.5rem;
  }

  .route-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-facts > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .action-group,
  .action-group .button {
    width: 100%;
  }
}

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

/* Load-more toolbar at the bottom of paginated results */
.load-more-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
}

.load-more-form {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.load-more-form .request-status {
  position: static;
}

.load-more-form .request-error {
  margin: 0;
}

.load-progress {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 580;
  font-variant-numeric: tabular-nums;
}

.load-complete {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 580;
}

.button-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.button-secondary:hover {
  background: var(--surface-soft);
}

.retry-btn {
  min-height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}
