:root {
  --data-error: oklch(40% 0.15 28);
}

.data-page { background: var(--color-bg); overflow-x: clip; }
.data-page [hidden] { display: none !important; }
.data-page h1, .data-page h2, .data-page h3 { text-wrap: balance; }
.data-page button, .data-page input, .data-page select { border-radius: var(--radius-sm); }
.data-page .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.skip-link {
  position: fixed; z-index: 200; top: 8px; left: 16px;
  transform: translateY(-160%); padding: 8px 14px;
  background: var(--color-text); color: var(--color-bg); text-decoration: none;
}
.skip-link:focus { transform: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.data-shell {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  padding: 28px var(--page-x) 64px;
}

/* ── Masthead ── */
.data-masthead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding-bottom: 18px;
}
.data-masthead h1 {
  margin: 0 0 6px;
  font: 700 34px/1.18 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.data-lede {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.65;
  max-width: 68ch;
}
.data-stamp {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--color-muted);
  flex: 0 0 auto;
}
.data-stamp strong { display: block; color: var(--color-text); font-weight: 600; }
.data-stamp span { display: block; font-size: 12px; color: var(--color-muted); }

/* ── 4-Column Editorial KPI Ledger ── */
.data-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 22px;
  padding: 14px 0 16px;
  border-top: 2px solid var(--color-text);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 22px;
}
.dkpi {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.dkpi span { font-size: 12px; color: var(--color-muted); font-weight: 500; }
.dkpi strong {
  font: 700 22px/1.25 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.dkpi small { font-size: 12px; color: var(--color-muted); line-height: 1.45; }

/* ── Two-Column Workspace Frame ── */
.data-workspace {
  display: grid;
  grid-template-columns: 274px minmax(0, 1fr);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  min-height: 640px;
  overflow: hidden;
}

.company-directory {
  min-width: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  display: flex;
  flex-direction: column;
}
.mobile-company-summary { display: none; }
.directory-controls {
  padding: 15px 14px 10px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-soft);
}
.directory-controls label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-soft);
}
.directory-controls kbd {
  font: 10.5px var(--font-mono);
  padding: 1px 5px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-raised);
  color: var(--color-muted);
  border-radius: 2px;
}
.data-page input,
.data-page select {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--color-border-strong);
  padding: 5px 9px;
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-size: 12px;
}
.data-page input::placeholder { color: var(--color-dim); opacity: 1; }
.directory-controls input { width: 100%; }
.dir-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-top: 7px;
}
.dir-select-row select { width: 100%; font-size: 11.5px; padding: 4px 6px; }

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.qp-btn {
  padding: 2px 7px;
  min-height: 22px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-raised);
  color: var(--color-text-soft);
  font: 600 10.5px/1.3 var(--font-mono);
  cursor: pointer;
}
.qp-btn:hover { border-color: var(--color-text); color: var(--color-text); }
.qp-btn.active {
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
  background: color-mix(in srgb, var(--color-accent) 9%, var(--color-surface-raised));
}

.directory-count {
  font: 12px/1.4 var(--font-mono);
  color: var(--color-muted);
  margin: 8px 0 0;
}

.company-list {
  max-height: 640px;
  overflow-y: auto;
  padding: 0;
}
.company-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: baseline;
  width: 100%;
  padding: 10px 13px;
  text-align: left;
  border: 0;
  border-left: 2.5px solid transparent;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0 !important;
  background: transparent;
  cursor: pointer;
  color: var(--color-text);
  transition: background-color 120ms ease;
}
.company-option:hover { background: var(--color-surface); }
.company-option[aria-pressed="true"] {
  border-left-color: var(--color-accent-strong);
  background: var(--color-surface-raised);
}
.company-option .company-code {
  font: 700 12.5px/1.3 var(--font-mono);
  color: var(--color-text);
}
.company-option[aria-pressed="true"] .company-code { color: var(--color-accent-strong); }
.company-option .company-badge {
  font: 500 10.5px/1.3 var(--font-mono);
  color: var(--color-muted);
  white-space: nowrap;
}
.company-option .company-name {
  grid-column: 1 / -1;
  color: var(--color-muted);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.company-option .company-coverage {
  grid-column: 1 / -1;
  font: 10.5px/1.3 var(--font-mono);
  color: var(--color-dim);
}
.directory-empty { padding: 14px; font-size: 12px; color: var(--color-muted); margin: 0; }

/* ── Right Detail Pane ── */
.data-detail {
  min-width: 0;
  padding: 20px 24px 26px;
}
.data-detail:focus { outline: none; }

.company-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding-bottom: 14px;
  margin-bottom: 4px;
}
.company-heading h2 {
  margin: 0;
  font: 700 22px/1.25 var(--font-serif);
  color: var(--color-text);
}
.company-heading h2 .ticker {
  font-family: var(--font-mono);
  font-size: 20px;
  margin-right: 10px;
  color: var(--color-accent-strong);
}
.company-heading h2 .name {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}
.company-heading p {
  margin: 5px 0 0;
  font: 11.5px/1.5 var(--font-mono);
  color: var(--color-muted);
}
.company-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.data-act {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  min-height: 30px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-bg-soft);
  color: var(--color-text-soft);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.data-act:hover {
  border-color: var(--color-text);
  color: var(--color-text);
  background: var(--color-surface);
}
.text-link {
  color: var(--color-accent-strong);
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 3px;
}
.text-link:hover { text-decoration-color: currentColor; }

/* ── Tabs ── */
.data-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--color-border-strong);
}
.data-tabs button {
  position: relative;
  padding: 9px 0 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.data-tabs button[aria-selected="true"] {
  color: var(--color-text);
  font-weight: 700;
}
.data-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  height: 2px;
  bottom: -1px;
  left: 0;
  right: 0;
  background: var(--color-text);
}
.data-tabs button:hover { color: var(--color-text); }
.data-tabs button span {
  margin-left: 4px;
  font: 11px var(--font-mono);
  color: var(--color-dim);
}

.data-panel { padding-top: 16px; }
.filter-bar {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}
.filter-bar label {
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
}
.filter-bar .metric-query { flex: 1; }
.filter-bar input, .filter-bar select { width: 100%; }

.result-count {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--color-muted);
  font: 11.5px/1.5 var(--font-mono);
  margin: 0 0 10px;
}
.result-count p { margin: 0; }
.plain-button {
  color: var(--color-accent-strong);
  border: 0;
  background: transparent;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 12px;
}

/* ── Framed Metric Table ── */
.metric-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.metric-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}
.metric-table th {
  color: var(--color-muted);
  font-weight: 600;
  padding: 9px 11px;
  background: var(--color-bg-soft);
  border-bottom: 1px solid var(--color-border-strong);
  white-space: nowrap;
  font-size: 11.5px;
}
.metric-table td {
  padding: 11px 11px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.metric-table tbody tr:last-child td { border-bottom: 0; }
.metric-table tbody tr:hover { background: color-mix(in oklch, var(--color-bg-soft), transparent 35%); }
.metric-table th:first-child, .metric-table td:first-child { width: 34%; }
.metric-table th:nth-child(2), .metric-table td:nth-child(2) { width: 22%; text-align: right; }
.metric-table th:nth-child(3), .metric-table td:nth-child(3) { width: 16%; }
.metric-table th:nth-child(4), .metric-table td:nth-child(4) { width: 13%; }

.metric-name { display: block; color: var(--color-text); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.metric-sub { display: block; color: var(--color-muted); font-size: 11px; margin-top: 3px; line-height: 1.4; }
.metric-number {
  display: block;
  font: 700 14px/1.35 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  white-space: nowrap;
}
.metric-raw {
  display: block;
  font: 10.5px/1.4 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-dim);
  margin-top: 2px;
  white-space: nowrap;
}
.metric-period { display: block; white-space: nowrap; font: 600 11.5px/1.45 var(--font-mono); color: var(--color-text-soft); }
.metric-basis { display: inline-block; color: var(--color-text-soft); font-size: 11.5px; font-weight: 500; }
.verify-tag {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 5px;
  font: 500 10px/1.4 var(--font-mono);
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  color: var(--color-muted);
  border-radius: 2px;
}
.source-link {
  color: var(--color-accent-strong);
  text-underline-offset: 3px;
  display: inline-block;
  margin: 0 8px 3px 0;
  font-size: 11.5px;
  font-weight: 500;
}
.source-note { display: block; color: var(--color-dim); font: 10.5px/1.4 var(--font-mono); margin-top: 1px; }
.panel-note { font-size: 11.5px; color: var(--color-muted); margin: 14px 0 0; max-width: 82ch; line-height: 1.65; }

/* ── States, IR, Bio ── */
.data-state { padding: 24px 20px; border: 1px solid var(--color-border); background: var(--color-bg-soft); margin: 14px 0; }
.data-state h3 { font: 600 14.5px var(--font-sans); margin: 0 0 6px; }
.data-state p { color: var(--color-muted); margin: 0 0 8px; font-size: 12.5px; line-height: 1.6; }
.data-state p:last-child { margin-bottom: 0; }
.data-state.error { border-color: color-mix(in oklch, var(--data-error), transparent 55%); }
.data-state.error h3 { color: var(--data-error); }
.loading-lines { padding: 20px 0; }
.loading-lines span { display: block; height: 12px; background: var(--color-bg-soft); margin: 0 0 14px; animation: data-pulse 1.5s ease-in-out infinite; }
.loading-lines span:nth-child(2) { width: 72%; }
.loading-lines span:nth-child(3) { width: 88%; }
@keyframes data-pulse { 50% { opacity: .45; } }

.ir-intro { margin: 0 0 16px; font-size: 12.5px; color: var(--color-muted); }
.ir-event { margin: 0 0 24px; }
.ir-event-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--color-border-strong); padding-bottom: 8px; }
.ir-event-header h3 { margin: 0; font-size: 15px; font-weight: 700; }
.ir-date { font: 12px var(--font-mono); color: var(--color-muted); }
.ir-material { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.ir-material h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.ir-material p { margin: 0 0 8px; max-width: 74ch; font-size: 13px; line-height: 1.75; color: var(--color-text-soft); }
.material-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; color: var(--color-muted); font-size: 11px; }

.bio-notice { padding: 10px 13px; background: var(--color-bg-soft); border: 1px solid var(--color-border); color: var(--color-text-soft); font-size: 12px; margin-bottom: 16px; }
.bio-breadcrumb { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 7px; font-size: 12px; margin: 0 0 14px; }
.bio-breadcrumb button { border: 0; background: none; padding: 3px 0; color: var(--color-accent-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.bio-entity-head { border-bottom: 1px solid var(--color-border); padding-bottom: 14px; margin-bottom: 16px; }
.bio-entity-head h3 { margin: 5px 0 6px; font-size: 18px; font-weight: 700; }
.bio-entity-head p { margin: 6px 0 0; color: var(--color-muted); font-size: 12.5px; max-width: 74ch; line-height: 1.65; }
.entity-type { font: 11px var(--font-mono); color: var(--color-muted); }
.bio-properties { margin: 11px 0 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.bio-properties div { display: flex; gap: 6px; font-size: 11.5px; }
.bio-properties dt { color: var(--color-muted); }
.bio-properties dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.bio-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 20px 0 10px; }
.bio-section-head h4 { font-size: 13.5px; margin: 0; font-weight: 700; }
.bio-section-head span { font: 11px var(--font-mono); color: var(--color-muted); }
.bio-relations { display: grid; gap: 0; }
.relation-row { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--color-border); }
.relation-label { font-size: 11.5px; color: var(--color-muted); padding-top: 2px; }
.relation-title { border: 0; background: transparent; padding: 0; text-align: left; color: var(--color-accent-strong); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere; }
.relation-row p { color: var(--color-text-soft); font-size: 12.5px; margin: 5px 0 3px; max-width: 74ch; line-height: 1.6; }
.relation-row small { color: var(--color-dim); font: 10.5px var(--font-mono); }
.bio-evidence-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 12px; }
.bio-evidence-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--color-muted); }
.evidence-list { margin: 0; padding: 0; list-style: none; }
.evidence-item { padding: 14px 0; border-top: 1px solid var(--color-border); }
.evidence-item h5 { font-size: 13.5px; font-weight: 600; margin: 6px 0; line-height: 1.55; overflow-wrap: anywhere; }
.evidence-item p { font-size: 12.5px; margin: 5px 0; color: var(--color-text-soft); max-width: 74ch; line-height: 1.65; }
.evidence-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; font: 10.5px var(--font-mono); color: var(--color-muted); }
.evidence-status { display: inline-block; padding: 1px 6px; background: var(--color-bg-soft); border: 1px solid var(--color-border); border-radius: 2px; color: var(--color-text-soft); }
.evidence-status.candidate { color: var(--color-accent-strong); border-color: var(--color-border-strong); }
.evidence-explanation { font-size: 11px !important; color: var(--color-muted) !important; }

.load-more {
  padding: 8px 16px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-raised);
  color: var(--color-text);
  cursor: pointer;
  font-size: 12px;
  margin-top: 12px;
}
.load-more:hover { background: var(--color-bg-soft); }

.data-footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--color-muted);
  font-size: 11.5px;
}

@media (max-width: 1020px) {
  .data-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dkpi:nth-child(3),
  .dkpi:nth-child(4) { padding-top: 12px; border-top: 1px solid var(--color-border); }
  .data-workspace { grid-template-columns: 230px minmax(0, 1fr); }
  .data-detail { padding: 18px 18px 24px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .metric-query { flex-basis: 100%; }
  .filter-bar label:not(.metric-query) { flex: 1; }
}

@media (max-width: 760px) {
  .data-shell { padding-top: 18px; }
  .data-masthead { align-items: start; flex-direction: column; gap: 10px; padding-bottom: 14px; }
  .data-masthead h1 { font-size: 26px; }
  .data-stamp { text-align: left; }
  .dkpi strong { font-size: 17px; }
  .data-workspace { display: block; min-height: 0; }
  .company-directory { border-right: 0; border-bottom: 1px solid var(--color-border-strong); }
  .mobile-company-summary {
    display: flex; justify-content: space-between; gap: 14px; align-items: center;
    padding: 0 14px; min-height: 46px; cursor: pointer; font-size: 12.5px; list-style: none;
  }
  .mobile-company-summary::-webkit-details-marker { display: none; }
  .mobile-company-summary > span:first-child { font-family: var(--font-mono); font-weight: 700; }
  .mobile-company-summary > span:last-child { color: var(--color-accent-strong); }
  .company-directory details[open] .mobile-company-summary { border-bottom: 1px solid var(--color-border); }
  .company-list { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; max-height: none; padding: 10px 14px 12px; }
  .company-option {
    flex: 0 0 164px; border: 1px solid var(--color-border); border-left-width: 2.5px;
    border-radius: var(--radius-sm) !important; background: var(--color-surface-raised);
  }
  .data-detail { padding: 16px 14px 20px; }
  .company-heading h2 { font-size: 19px; }
  .company-heading h2 .name { font-size: 15px; }
  .metric-table-wrap { border: 0; overflow: visible; }
  .metric-table { display: block; }
  .metric-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .metric-table tbody { display: block; }
  .metric-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
  .metric-table td { display: block; padding: 0; border: 0; width: auto !important; }
  .metric-table td:nth-child(2) { text-align: right; }
  .metric-table td:nth-child(3) { grid-column: 1; padding-top: 8px; }
  .metric-table td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; padding-top: 8px; }
  .metric-table td:nth-child(5) { grid-column: 1 / -1; padding-top: 8px; }
  .relation-row { grid-template-columns: 78px minmax(0, 1fr); gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .data-page *, .data-page *::before, .data-page *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
