.header-button.current {
  background: var(--blue-soft);
  color: var(--blue);
}

.search-main {
  width: min(1600px, calc(100% - 32px));
}

.search-overview {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.search-overview h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.section-label,
.search-form > label,
.match-header > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-workbench {
  display: grid;
  grid-template-columns: minmax(290px, 350px) minmax(0, 1fr);
  min-height: min(720px, calc(100vh - 186px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.search-workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.search-form {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.search-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.search-input-row input {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

.search-input-row input::placeholder {
  color: #858d98;
}

.search-input-row input:focus {
  border-color: var(--blue);
}

.search-button {
  min-width: 72px;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--blue);
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.search-button:hover {
  border-color: var(--blue-hover);
  background: var(--blue-hover);
}

.catalog-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  height: 34px;
  margin-top: 9px;
}

.catalog-mode span {
  padding-right: 6px;
  padding-left: 6px;
  font-size: 10px;
  white-space: nowrap;
}

.known-asof-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.known-asof-control > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.known-asof-control input {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 10px;
}

.known-asof-control input:focus {
  border-color: var(--blue);
}

.match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.match-header > span {
  margin: 0;
}

.match-header strong {
  color: var(--muted-strong);
  font-size: 11px;
}

.suggestion-list {
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  min-height: 62px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover,
.suggestion.active,
.suggestion[aria-selected="true"] {
  background: var(--blue-soft);
}

.suggestion-copy {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
}

.suggestion-copy strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-kind {
  align-self: center;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.term-kind.live {
  border-color: #a8d6bf;
  background: var(--green-soft);
  color: var(--green);
}

.search-results-workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  background: var(--surface);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px 17px;
  border-bottom: 1px solid var(--line);
}

.results-header h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.results-header > strong {
  min-width: 54px;
  color: var(--muted-strong);
  font-size: 19px;
  text-align: right;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 6px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.result-state {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.cube-link,
.load-more-button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
  line-height: 26px;
  text-decoration: none;
}

.load-more-button:hover,
.cube-link:hover {
  border-color: #9eb9de;
  background: var(--blue-soft);
}

.load-more-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.observation-table-wrap {
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.observation-table-wrap:focus-visible {
  outline-offset: -3px;
}

.observation-table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--ink);
}

.metric-column {
  width: 16%;
}

.value-column {
  width: 13%;
}

.ticker-column {
  width: 16%;
}

.period-column {
  width: 9%;
}

.asof-column {
  width: 11%;
}

.source-column {
  width: 23%;
}

.filed-column {
  width: 12%;
}

.observation-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  padding: 0 11px;
  border-bottom: 1px solid var(--line-strong);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.observation-table th.numeric,
.observation-table td.numeric {
  text-align: right;
}

.observation-table td {
  height: 66px;
  overflow: hidden;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px;
  vertical-align: top;
}

.observation-table tbody tr:hover td {
  background: var(--surface-soft);
}

.observation-table tbody tr.independent-disagreement td {
  background: var(--amber-soft);
}

.observation-table tbody tr.independent-disagreement:hover td {
  background: #fff5d8;
}

.cell-stack {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cell-stack strong,
.cell-stack > a {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-stack small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-stack.source-cell > a {
  color: var(--blue);
  text-decoration: none;
}

.cell-stack.source-cell > a:hover {
  text-decoration: underline;
}

.metric-key {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.ticker-display {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.comparison-status {
  display: inline-flex;
  width: fit-content;
  margin-top: 2px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.comparison-status.disagrees {
  border-color: #e2b04e;
  background: #fff3cc;
  color: var(--amber);
}

.comparison-status.agrees {
  border-color: #a8d6bf;
  background: var(--green-soft);
  color: var(--green);
}

.comparison-status.filing-differs {
  border-color: #e2b04e;
  background: #fff9e8;
  color: var(--amber);
}

.value-display {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.value-unit {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-label,
.asof-date {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-range {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.table-message td {
  height: 220px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  vertical-align: middle;
}

.table-message.error td {
  color: var(--danger);
}

.loading-results,
.empty-results {
  display: grid;
  min-height: 120px;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 980px) {
  .search-workbench {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  }

  .catalog-mode span {
    font-size: 9px;
  }
}

@media (max-width: 820px) {
  .search-workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(480px, 1fr);
  }

  .search-workspace {
    grid-template-rows: auto auto minmax(0, 220px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .suggestion-list {
    max-height: 220px;
  }

  .search-results-workspace {
    min-height: 480px;
  }
}

@media (max-width: 620px) {
  .product-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .header-state {
    display: none;
  }

  .search-main {
    width: 100%;
    margin-top: 12px;
  }

  .search-overview {
    margin-right: 14px;
    margin-left: 14px;
  }

  .search-overview h1 {
    font-size: 19px;
  }

  .search-overview .index-readout small {
    max-width: 160px;
  }

  .search-workbench {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .search-input-row {
    grid-template-columns: minmax(0, 1fr) 72px;
  }

  .results-header,
  .result-toolbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .results-header h2 {
    font-size: 15px;
  }

  .result-state {
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .search-overview {
    align-items: flex-start;
  }

  .search-overview .index-readout {
    max-width: 140px;
  }

  .catalog-mode span {
    padding-right: 2px;
    padding-left: 2px;
    font-size: 8px;
  }
}
