/* Atlas legacy front-end contract stylesheet.
 * Keep selectors stable during parity migration.
 */

:root {
  /* Atlas-legacy internal tokens */
  --atlas-text: #0b1020;
  --atlas-muted: #5c667a;
  --atlas-link: #0a53c1;
  --atlas-bg: #ffffff;
  --atlas-line: #d8deeb;
  --atlas-panel-bg: #fff;
  --atlas-popular-bg: #fff3d8;
  --atlas-popular-text: #8a4f00;

  /* APR brand tokens — must match live site inline CSS exactly */
  --apr-bg: #ffffff;
  --apr-text: #0f172a;
  --apr-muted: #475569;
  --apr-line: #e2e8f0;
  --apr-accent-50: #eff6ff;
  --apr-accent-200: #bfdbfe;
  --apr-accent-300: #93c5fd;
  --apr-accent-700: #1e3a8a;
  --apr-link: #0a53c1;
  --apr-positive: #16a34a;
  --apr-negative: #dc2626;
  --apr-neutral: #64748b;
  --apr-warning: #f59e0b;
  --apr-heading: #1e293b;
  --apr-table-header-bg: #2c3e50;
  --apr-table-header-text: #ffffff;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.atlas-shell,
body.atlas-home,
body.atlas-report,
body.atlas-ticker {
  margin: 0 auto;
  padding: 16px;
  max-width: 1120px;
  color: var(--apr-text, #0f172a);
  background: var(--apr-bg, #ffffff);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 9999;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  background: #fff;
  color: #111;
  border: 1px solid #111;
}

a {
  color: var(--apr-link, #0a53c1);
}

a:hover {
  text-decoration-thickness: 2px;
}

.meta-muted {
  color: var(--apr-muted, #475569);
}

/* Body handles max-width/padding/margin (matching live site).
   .page used for interior pages that may not have atlas-home body class. */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand img {
  width: 44px;
  height: 44px;
}

.tagline {
  margin: 0;
  font-weight: 600;
}

.stats {
  margin-top: 0.25rem;
  color: var(--atlas-muted);
}

/* No card borders on filters/table sections — matches live flat layout */
.filters-section {
  margin-bottom: 8px;
}

.reports-section {
  margin-bottom: 1rem;
}

/* Filter form — matches live site search-form class */
.search-form {
  margin: 14px 0 16px;
  display: grid;
  gap: 8px;
}

@media (min-width: 760px) {
  .search-form {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto auto;
    align-items: end;
  }
  .search-form button[type="submit"] { min-width: 90px; }
}

.search-form div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.search-form label {
  display: block;
  font-size: 0.86rem;
  color: var(--apr-muted, #475569);
  margin-bottom: 3px;
}

.search-form input,
.search-form select {
  font: inherit;
  padding: 6px 9px;
  border-radius: 6px;
  border: 1px solid #bbb;
  background: #fff;
  color: var(--apr-text, #0f172a);
  min-height: 36px;
  width: 100%;
}

.search-form button[type="submit"] {
  padding: 6px 9px;
  font: inherit;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  min-height: 36px;
  min-width: 90px;
  white-space: nowrap;
}

.search-form button[type="submit"]:hover {
  background: #e2e8f0;
}

/* Legacy atlas-filters class kept for backwards compat */
.atlas-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.atlas-filters__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.35rem;
}

.atlas-filters__actions a {
  white-space: nowrap;
}

.results-count {
  margin: 4px 0 8px;
  color: var(--apr-muted, #475569);
  font-size: 0.85rem;
}

.active-filter-bar {
  background: var(--apr-accent-50, #eff6ff);
  border: 1px solid var(--apr-accent-300, #93c5fd);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
}

.reset-link {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-decoration: none;
  color: #334155;
  background: #f1f5f9;
  white-space: nowrap;
  text-align: center;
}

.reset-link:hover {
  background: #e2e8f0;
  color: #334155;
}

.reports-table {
  table-layout: fixed;
  border-collapse: collapse;
  width: 100%;
}

/* Column widths — match atlaspeakresearch.com exactly */
.reports-table th:nth-child(1) { width: 9%; }
.reports-table th:nth-child(2) { width: 7%; }
.reports-table th:nth-child(3) { width: 13%; }
.reports-table th:nth-child(4) { width: 16%; }
.reports-table th:nth-child(5) { width: 47%; }
.reports-table th:nth-child(6) { width: 8%; }

.reports-table th {
  font-size: 12px;
  color: var(--apr-muted, #475569);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 12px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  box-shadow: 0 1px 0 var(--apr-line, #e2e8f0);
  text-align: left;
  overflow: visible;
  text-overflow: unset;
}

.reports-table td {
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.reports-table tbody tr:nth-child(even) { background: #f1f5f9; }
.reports-table tbody tr:hover { background: #eef2ff; cursor: pointer; }
.reports-table tbody tr:nth-child(5n) { border-bottom: 2px solid #e2e8f0; }

td.ticker-col {
  font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
}

.reports-table .ticker-col a {
  font-family: inherit;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
}

.reports-table td.sector-col { color: #475569; }

.row-link {
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
  text-underline-offset: 2px;
}

.row-link:hover { text-decoration-color: #1e3a8a; }

.report-meta-mobile {
  display: none;
}

/* Full-row clickability (A28/A34 parity) */
.reports-table tbody tr { position: relative; cursor: pointer; }
.reports-table td.report-col { position: relative; }
.reports-table td.report-col a.row-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
}
.reports-table td.report-col a.row-link,
.reports-table td.report-col .badge-new,
.reports-table td.report-col .popular-badge,
.reports-table td.report-col .report-badge {
  position: relative;
  z-index: 1;
}

.reports-table td.views-cell {
  text-align: right;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.reports-table th.views-th { text-align: right; }

.badge-new {
  display: inline-block;
  background: var(--apr-accent-50, #eff6ff);
  border: 1px solid var(--apr-accent-300, #93c5fd);
  color: var(--apr-accent-700, #1e3a8a);
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 6px;
}

.report-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.report-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.report-badge--popular {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
}

.reports-pagination {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.reports-pagination__links {
  display: flex;
  gap: 0.75rem;
}

/* Spec-compliant .pagination nav (used by new pagination render) */
.pagination {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination a {
  padding: 8px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
}

.pagination a:hover {
  background: #eef2ff;
}

/* Wrapper row: breadcrumbs left, view count right */
.report-breadcrumb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.report-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0;
  color: var(--atlas-muted);
  font-size: 0.88rem;
  line-height: 1.25;
}

.report-view-count {
  font-size: 0.75rem;
  color: var(--apr-muted, #475569);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Breadcrumb list — one inline row, no numbers (Safari-safe) */
.breadcrumb-list {
  list-style: none;
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.breadcrumb-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.breadcrumb-list li::marker {
  content: none;
  display: none;
}

.breadcrumb-list li + li::before {
  content: "›";
  color: #94a3b8;
  margin-right: 0.1rem;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.report-header .tagline {
  color: var(--atlas-muted);
}

.report-hero {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--apr-line, #e2e8f0);
}

.report-hero h1 {
  margin: 0 0 0.55rem;
  line-height: 1.2;
}

/* .report-meta-line removed — metadata line removed from report detail pages (PR #245) */

.report-share-row {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  color: var(--atlas-muted);
  font-size: 0.82rem;
}

.report-contents {
  margin: 1rem 0 1.25rem;
  padding: 12px 14px 14px;
  border: 1px solid var(--apr-line, #e2e8f0);
  border-radius: 6px;
  background: #fafcff;
}

.report-contents .toc-title,
.report-related h2 {
  margin-top: 0;
}

.report-contents .toc-title {
  margin: 0 0 0.65rem;
  color: var(--apr-muted, #475569);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-contents__links {
  columns: 2;
  column-gap: 1.5rem;
}

.report-contents__links a {
  display: block;
  break-inside: avoid;
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
  margin-bottom: 3px;
}

.report-contents__links a:hover {
  text-decoration: underline;
}

.report-body {
  margin-top: 1rem;
}

.report-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.report-related li {
  display: grid;
  gap: 0.25rem;
}

.report-related li span {
  color: var(--atlas-muted);
  font-size: 0.9rem;
}

.related-more-link {
  display: inline-flex;
  margin-top: 0.8rem;
}

.report-nav {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.report-feedback-row {
  margin-top: 1rem;
  border-top: 1px solid #e6eaf3;
  padding-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.2rem;
  text-align: center;
}

.report-feedback-row__sentiment {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

/* Newsletter strip (ticker + index parity) */
.newsletter-strip {
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--apr-line, #e2e8f0);
  border-radius: 10px;
  background: linear-gradient(110deg, var(--apr-accent-50, #f8fbff) 0%, var(--apr-bg, #ffffff) 65%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  align-items: center;
}

.newsletter-strip__text {
  min-width: 0;
}

.newsletter-strip__label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--apr-muted, #475569);
}

.newsletter-strip__tagline {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--apr-text, #0f172a);
}

.newsletter-strip__form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.newsletter-strip__input {
  min-width: 220px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--apr-text, #0f172a);
  font: inherit;
}

.newsletter-strip__input::placeholder {
  color: #64748b;
}

.newsletter-strip__btn {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f1f5f9;
  color: #334155;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.newsletter-strip__btn:hover {
  background: #e2e8f0;
}

.newsletter-strip__status {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.2em;
  font-size: 12px;
  color: var(--apr-muted, #475569);
}

.newsletter-strip__status--success {
  color: #166534;
}

.newsletter-strip__status--error {
  color: #b91c1c;
}

/* Dedicated /ticker page polish */
.page-ticker {
  padding-top: 8px;
}

.page-ticker .report-breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--apr-line, #e2e8f0);
}

.page-ticker .back-link {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.ticker-landing-section {
  border: 1px solid var(--apr-line, #e2e8f0);
  border-radius: 10px;
  background: #fff;
  padding: 16px 18px;
}

.ticker-landing-section h1 {
  margin: 0;
  line-height: 1.15;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.ticker-sub-heading {
  margin: 8px 0 14px;
  color: var(--apr-muted, #475569);
  font-size: 0.95rem;
}

.ticker-newsletter-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--apr-line, #e2e8f0);
}

.reports-table--ticker {
  table-layout: auto;
}

.reports-table--ticker th:nth-child(1) {
  width: 18%;
}

.reports-table--ticker th:nth-child(2) {
  width: 22%;
}

.reports-table--ticker th:nth-child(3) {
  width: 60%;
}

.reports-table--ticker td {
  vertical-align: top;
}

.reports-table--ticker td:nth-child(1),
.reports-table--ticker td:nth-child(2) {
  white-space: nowrap;
}

.reports-table--ticker td:nth-child(3) {
  white-space: normal;
}

@media (max-width: 860px) {
  .report-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-share-row {
    gap: 0.4rem;
  }

  .newsletter-strip {
    grid-template-columns: 1fr;
  }

  .newsletter-strip__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .newsletter-strip__input {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .search-form,
  .atlas-filters {
    grid-template-columns: 1fr;
  }

  /* Card layout — each report row becomes a compact card */
  .reports-table,
  .reports-table thead,
  .reports-table tbody,
  .reports-table th,
  .reports-table td,
  .reports-table tr {
    display: block;
  }

  .reports-table thead {
    display: none;
  }

  .reports-table tbody tr {
    border: 1px solid var(--apr-line, #e2e8f0);
    border-left: 3px solid #94a3b8; /* default: gray — overridden per type below */
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 0.82rem;
  }

  /* Left-border accent per report type — quick visual scan on mobile */
  .reports-table tbody tr.report-type-earnings_debrief,
  .reports-table tbody tr.report-type-debrief_v2 { border-left-color: #6366f1; }   /* indigo */
  .reports-table tbody tr.report-type-desk_note   { border-left-color: #0ea5e9; }   /* sky */
  .reports-table tbody tr.report-type-earnings,
  .reports-table tbody tr.report-type-earnings_preview { border-left-color: #22c55e; } /* green */
  .reports-table tbody tr.report-type-call,
  .reports-table tbody tr.report-type-earnings_call { border-left-color: #f59e0b; }  /* amber */
  .reports-table tbody tr.report-type-company_briefing { border-left-color: #8b5cf6; } /* purple */
  .reports-table tbody tr.report-type-research    { border-left-color: #14b8a6; }   /* teal */

  .reports-table td {
    padding: 2px 0;
    border: none;
    font-size: 0.82rem;
  }

  /* Hide individual date/ticker/sector/type/views cells — all shown inline via report-meta-mobile */
  .reports-table td[data-label="Date"],
  .reports-table td[data-label="Ticker"],
  .reports-table td[data-label="Sector"],
  .reports-table td[data-label="Type"],
  .reports-table td.views-cell {
    display: none;
  }

  .newsletter-strip {
    padding: 12px;
    gap: 10px;
  }

  .newsletter-strip__form {
    grid-template-columns: 1fr;
  }

  .newsletter-strip__btn {
    width: 100%;
    min-height: 44px;
  }

  .page-ticker .report-breadcrumbs {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .ticker-landing-section {
    padding: 12px 14px;
  }

  .ticker-sub-heading {
    margin-bottom: 10px;
    font-size: 0.88rem;
  }

  .ticker-newsletter-wrap {
    margin-top: 10px;
    padding-top: 10px;
  }

  .reports-table--ticker td[data-label="Date"],
  .reports-table--ticker td[data-label="Type"] {
    display: flex;
  }

  .reports-table--ticker td {
    align-items: baseline;
    gap: 8px;
    white-space: normal;
  }

  .reports-table--ticker td::before {
    content: attr(data-label);
    min-width: 44px;
    color: var(--apr-muted, #475569);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .reports-table--ticker td[data-label="Report"] {
    display: block;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--apr-line, #e2e8f0);
  }

  .reports-table--ticker td[data-label="Report"]::before {
    content: none;
  }

  .reports-table--ticker td[data-label="Report"] a {
    display: block;
    min-height: 44px;
    font-size: 0.9rem;
    font-weight: 600;
  }

  /* Report title cell — no label prefix, full width, min tap height */
  .reports-table td.report-col::before { content: none; }
  .reports-table td.report-col {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    font-size: 0.9rem;
    font-weight: 600;
    padding-bottom: 4px;
    min-height: 44px;
  }

  /* Meta summary line (Date · Ticker · Sector · Type · 👁 Views) — all inline */
  .report-meta-mobile {
    display: block;
    font-size: 0.75rem;
    color: var(--apr-muted, #475569);
    margin-top: 4px;
    line-height: 1.4;
  }

  /* Full card tap feedback */
  .reports-table tbody tr:active {
    background: #dbeafe !important;
  }

  .badge-new {
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
  }

  .popular-badge {
    display: inline-block !important;
    margin-left: 6px !important;
    vertical-align: middle;
  }

  .report-badge {
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
  }

  /* Mobile body padding */
  body.atlas-home,
  body.atlas-shell,
  body.atlas-report,
  body.atlas-ticker { padding: 20px; }

  /* Mobile sticky filter */
  .filter-wrap {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    padding: 8px 0;
    border-bottom: 1px solid var(--apr-line, #e2e8f0);
    display: block;
  }
  .filter-wrap summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--apr-accent-700, #1e3a8a);
    padding: 10px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    list-style: none;
  }
  .filter-wrap summary::before { content: "▸ "; }
  .filter-wrap[open] summary::before { content: "▾ "; }
  .filter-wrap summary::-webkit-details-marker { display: none; }

  /* Apply button larger tap target */
  .search-form button[type="submit"] {
    min-height: 44px;
    padding: 10px 0;
  }

  /* Mobile pagination — full-width, large tap targets */
  nav.pagination a {
    padding: 12px 0;
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
    display: block;
    text-align: center;
    background: var(--apr-accent-50, #eff6ff);
    border-radius: 8px;
  }

  .reports-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  /* Reduce header vertical footprint on mobile */
  .site-header {
    padding-bottom: 6px;
  }

  .report-contents__links {
    columns: 1;
  }

  /* Bug 11 (PR #248): keep feedback row centered on mobile, not left-aligned */
  .report-feedback-row {
    flex-direction: column;
    align-items: center;
  }
}

@media print {
  nav, .filter-wrap, .filters-section, .pagination, footer,
  .fb-link, .feedback-link, .success-banner,
  header a, .reset-link, button[type="submit"],
  .atlas-filters,
  .skip-link,
  .report-feedback-row,
  .report-nav,
  .report-share-row,
  .reports-pagination {
    display: none !important;
  }

  body {
    padding: 0;
    max-width: none;
    font-size: 11pt;
    line-height: 1.5;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }
}

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

/* ── Header — match live site body padding/max-width ── */
body.atlas-home header,
body.atlas-shell header,
body.atlas-ticker header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--apr-line, #e2e8f0);
  margin-bottom: 12px;
}

/* ── Header layout ── */
/* New structure: site-header > header-top-row (logo only) + header-tagline + hdr-stats-block */

/* Desktop: single-line grid — logo | tagline | feedback/stats all on one row */
.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

.header-top-row {
  display: flex;
  align-items: center;
}

.header-brand {
  min-width: 0;
  margin: 0;
  line-height: 1;
}

.brand-logo {
  display: block;
  width: 260px;
  max-width: 100%;
  height: auto;
}

.fb-link {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--apr-accent-300, #93c5fd);
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.1;
  color: var(--apr-accent-700, #1e3a8a);
  background: var(--apr-accent-50, #eff6ff);
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-tagline {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--apr-muted, #475569);
  margin: 0;
  /* grid child: takes the 1fr middle column; no white-space:nowrap so it wraps gracefully if viewport is narrow */
}

.hdr-stats-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-self: end;
  box-sizing: border-box;
}

.hdr-meta-line {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: right;
  font-size: 0.73rem;
  color: var(--apr-muted, #475569);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* First stats line: feedback left, stats text right */
.hdr-meta-line--stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hdr-stats-text {
  text-align: right;
}

.fb-link:hover {
  background: var(--apr-accent-200, #bfdbfe);
}

/* ── Mobile header (explicit grid, full-width stretch) ── */
@media (max-width: 639px) {
  .site-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    row-gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    box-sizing: border-box !important;
    padding-bottom: 6px;
  }

  .header-top-row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .header-top-row > * {
    min-width: 0 !important;
  }

  .brand-logo {
    width: 180px;
  }

  .header-tagline {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    text-align: center !important;
    justify-self: stretch !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    font-size: 14px;
  }

  .hdr-stats-block {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    justify-items: stretch !important;
    align-items: start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    align-self: stretch !important;
    justify-self: stretch !important;
  }

  /* First stats line: feedback left, stats right */
  .hdr-meta-line--stats {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    gap: 8px;
  }

  .hdr-meta-line--stats .fb-link {
    flex-shrink: 0;
  }

  .hdr-meta-line--stats .hdr-stats-text {
    text-align: right;
    flex: 1;
    min-width: 0;
  }

  .hdr-meta-line {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    justify-self: stretch !important;
    text-align: right !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.68rem !important;
    color: #475569 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* Footer — matches live: margin-top:16px, color:muted, font-size:0.9rem, NO border-top, NO monospace */
.site-footer {
  margin-top: 16px;
  color: var(--apr-muted, #475569);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  text-align: center;
}

.site-footer a {
  color: var(--apr-link, #0a53c1);
}

/* --- Details/summary filter collapsibility --- */
/* Desktop: always show filter contents, hide the toggle summary */
@media (min-width: 641px) {
  .filter-wrap > summary {
    display: none;
  }
}
details > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}

/* ── Focus-visible (accessibility parity with live) ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 2px;
}

/* ── Skip link (live parity) ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 16px;
  background: var(--apr-accent-700, #1e3a8a);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }

/* ── Banner styles (live parity) ── */
.success-banner {
  background: var(--apr-accent-50, #eff6ff);
  border: 1px solid var(--apr-accent-300, #93c5fd);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.95rem;
}
.error-banner {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.92rem;
}

/* ── Sector pill (ticker/report pages) ── */
.sector-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* ── View count ── */
.view-count {
  font-size: 0.85rem;
  color: var(--apr-muted, #475569);
}

/* ── Honeypot ── */
.ohnohoney { display: none !important; }
.hp-trap { position: absolute; left: -9999px; }

/* ── Latest Hero (PR7 — product polish) ── */
.latest-hero {
  border: 1px solid var(--apr-accent-200, #bfdbfe);
  border-left: 3px solid var(--apr-link, #0a53c1);
  background: var(--apr-accent-50, #eff6ff);
  border-radius: 6px;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}

.latest-hero__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--apr-link, #0a53c1);
  margin: 0 0 0.3rem;
}

.latest-hero__link {
  text-decoration: none;
}

.latest-hero__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--apr-text, #0f172a);
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.latest-hero__link:hover .latest-hero__title {
  color: var(--apr-link, #0a53c1);
  text-decoration: underline;
}

.latest-hero__meta {
  font-size: 0.78rem;
  color: var(--apr-muted, #475569);
  margin: 0 0 0.35rem;
}

.latest-hero__summary {
  font-size: 0.82rem;
  color: var(--apr-muted, #475569);
  margin: 0.25rem 0 0;
  line-height: 1.45;
}

@media (max-width: 639px) {
  .latest-hero {
    padding: 0.75rem;
  }
  .latest-hero__title {
    font-size: 0.95rem;
  }
}

/* ── Dark mode CSS variable foundations (PR7 — no toggle yet, vars only) ── */
/* Future: add [data-theme="dark"] selector and toggle JS */
:root {
  --dm-bg: #0f172a;
  --dm-surface: #1e293b;
  --dm-text: #f1f5f9;
  --dm-muted: #94a3b8;
  --dm-border: #334155;
  --dm-link: #60a5fa;
  --dm-link-visited: #a78bfa;
  --dm-accent: #1e40af;
}