/* Navigation and reading layer. Data and analytical rules live in dashboard.js. */
html { scroll-behavior: smooth; scroll-padding-top: 140px; }
body { background: #eef1ed; padding-bottom: 0; color: #16352e; }
.page-shell { width: min(1320px, calc(100% - 48px)); padding: 24px 0 48px; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 200; padding: 14px; background: white; color: #16352e; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid #b07212; outline-offset: 3px; }
button, select, input, summary, .button-secondary, .button-primary { min-height: 44px; }
button, a, summary { touch-action: manipulation; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
.app-header { grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); gap: 24px; padding: 28px 30px; border-radius: 16px; margin-bottom: 16px; }
.app-header .hero-copy h1 { font-family: inherit; font-size: clamp(1.65rem, 2.7vw, 2.5rem); max-width: 24ch; line-height: 1.15; letter-spacing: -.035em; margin: 12px 0; }
.app-header .hero-copy p { font-size: .95rem; line-height: 1.55; max-width: 65ch; margin: 0; }
.header-summary { padding: 0 0 0 24px; border-left: 1px solid #496258; background: none; border-radius: 0; }
.header-subject { display: none; }
.header-status-row { line-height: 1.6; flex-wrap: wrap; }
.header-actions { flex-wrap: wrap; }
.header-actions a { font-size: .8rem; }
.tabs-nav { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; min-height: 64px; margin: 0; padding: 6px; gap: 4px; border: 1px solid #d2ddd5; border-radius: 12px 12px 0 0; background: #fff; box-shadow: none; }
.tabs-nav .tab-button { min-width: 0; min-height: 52px; padding: 8px 12px; border-radius: 7px; font-size: .94rem; color: #456057; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tabs-nav .tab-button span { font-size: inherit; }
.tabs-nav .tab-button span::before, .tabs-nav .tab-button span::after, .tabs-nav .tab-button::before, .tabs-nav .tab-button::after { content: none; }
.tabs-nav .tab-button small { display: block; font-size: .72rem; font-weight: 400; color: inherit; }
.tabs-nav .tab-button.active { background: #153e32; color: white; box-shadow: none; }
.tabs-nav .tab-button:hover:not(.active) { background: #edf3ee; }
.public-deployment .tab-button-admin { display: none; }
.persistent-filter-tools { position: sticky; inset: auto; top: 65px; z-index: 29; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 60px; margin: 0 0 20px; padding: 8px 12px; background: #f9fbf8; color: #16352e; border: 1px solid #d2ddd5; border-top: 0; border-radius: 0 0 12px 12px; box-shadow: 0 5px 12px #153e3208; backdrop-filter: none; }
.persistent-tool-button { width: auto; min-height: 44px; color: #173d31; border: 1px solid #bccdc0; background: white; border-radius: 7px; font-size: .82rem; }
.persistent-tool-button:hover:not(:disabled) { background: #e0ebe2; color: #153e32; }
.active-filter-summary, .has-active-filters .active-filter-summary { position: static; width: auto; height: auto; clip: auto; white-space: normal; color: #435d52; font-size: .8rem; flex: 1; line-height: 1.4; }
.active-filter-count { background: #dce9dc; color: #173d31; }
.reading-intro { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 4px 0 18px; }
.reading-intro h2 { margin: 0 0 6px; font-size: 1.4rem; letter-spacing: -.025em; }
.reading-intro p { margin: 0; color: #52685e; font-size: .9rem; line-height: 1.5; max-width: 80ch; }
.reading-intro .applied-period { margin-top: 10px; font-size: .78rem; color: #214f36; font-weight: 600; }
.panel, .metric-card { border-radius: 12px; box-shadow: none; border-color: #d7e0d8; }
.panel { padding: 24px; margin-bottom: 20px; }
.panel h2 { font-family: inherit; font-size: 1.2rem; line-height: 1.35; letter-spacing: -.015em; }
.panel h3 { font-size: 1rem; line-height: 1.4; }
.panel-caption, .panel p, .post-card p, .comment-card p { line-height: 1.6; }
.panel-caption { font-size: .9rem; }
.eyebrow { font-size: .68rem; letter-spacing: .12em; }
.tab-panel { scroll-margin-top: 145px; }
.collection-coverage-panel { order: 5; border-left: 4px solid #b28337; background: #fffcf4; }
.collection-coverage-panel h2 { font-size: 1.05rem; margin: 8px 0; }
.collection-coverage-panel p { font-size: .87rem; margin: 8px 0; }
.dashboard-order-intro { order: 10; }
.dashboard-order-kpis { order: 20; }
.dashboard-order-conclusions { order: 25; }
.dashboard-order-social-charts { order: 30; }
.civic-agenda-panel { order: 35; }
.dashboard-order-magnitude { order: 95; }
.agenda-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.agenda-card { min-width: 0; padding: 16px; background: #f5f8f3; border: 1px solid #dce5d8; border-radius: 10px; }
.agenda-card h3 { margin-top: 0; }
.agenda-card p { font-size: .85rem; }
.agenda-grid:not(.show-all) > :nth-child(n+4) { display: none; }
.agenda-more { margin: 14px 0; }
details > summary { display: list-item; cursor: pointer; padding: 12px 0; font-size: .85rem; font-weight: 650; color: #20543d; }
details[open] > summary { margin-bottom: 8px; }
.reading-detail { margin: 0 0 20px; padding: 0 20px; border: 1px solid #d7e0d8; border-radius: 12px; background: white; }
.reading-detail > summary { font-size: 1rem; padding: 20px 0; }
.reading-detail > section { margin-bottom: 20px; }
.reading-detail > section.panel { padding: 0; border: 0; }
.chart-shell { min-width: 0; height: 320px; }
.chart-reading-modes { display: flex; gap: 6px; margin-bottom: 16px; padding: 4px; background: #edf3ec; border-radius: 8px; }
.chart-reading-modes button { width: auto; flex: 1; min-width: 0; min-height: 44px; padding: 8px; font-size: .78rem; border-radius: 6px; border: 1px solid transparent; color: #31543d; background: transparent; }
.chart-reading-modes button[aria-pressed="true"] { background: white; border-color: #bacfbb; color: #163e28; font-weight: 700; }
.chart-data { margin-top: 12px; border-top: 1px solid #e0e7df; }
.chart-data > summary { font-size: .8rem; }
.chart-data-scroll, .coverage-scroll { max-width: 100%; overflow-x: auto; max-height: 420px; }
.chart-data table { border-collapse: collapse; width: 100%; font-size: .82rem; font-variant-numeric: tabular-nums; }
.chart-data th, .chart-data td { text-align: right; padding: 10px; border-bottom: 1px solid #e0e7df; white-space: nowrap; }
.chart-data th:first-child, .chart-data td:first-child { text-align: left; white-space: normal; min-width: 110px; }
.chart-data caption { text-align: left; color: #506456; padding: 10px 0; }
.chart-data thead { position: sticky; top: 0; background: #eff5ef; }
.filter-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid #becdc1; border-radius: 16px; color: #173d31; background: #fff; box-shadow: 0 25px 80px #10281b44; }
.filter-dialog::backdrop { background: #10281ba8; }
body.filters-modal-open { overflow: hidden; }
.filter-dialog .filters-card { display: block; margin: 0; border: 0; border-radius: 0; padding: 24px; box-shadow: none; }
.filter-dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 24px; background: #f0f5ee; border-bottom: 1px solid #d1dfd1; }
.filter-dialog-head h2 { font-size: 1.1rem; margin: 0; }
.filter-dialog-head button { width: auto; flex: 0 0 auto; }
.filter-dialog .filters-card > .section-heading h2, .filter-dialog .filters-card > .section-heading .eyebrow { display: none; }
.filter-dialog .filters-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.filter-dialog .filters-grid .wide-field { grid-column: 1 / -1; }
.filter-dialog label { min-width: 0; font-size: .85rem; line-height: 1.5; }
.filter-dialog input, .filter-dialog select { width: 100%; min-width: 0; max-width: 100%; min-height: 48px; font-size: 16px; }
.filter-dialog .filters-card .advanced-filter { display: none; }
.filter-dialog .filters-card.advanced-open .advanced-filter { display: grid; }
.filter-dialog .platform-shortcuts { display: flex; flex-wrap: wrap; }
.filter-dialog .filters-actions { grid-column: 1 / -1; position: sticky; bottom: -24px; background: #fff; padding: 12px 0; z-index: 1; }
.status-banner { position: relative; z-index: 1; border-radius: 8px; }
.list-navigation { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.list-navigation button { width: auto; flex: 1; }
.metric-card strong { font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) {
  .app-header { grid-template-columns: 1fr; gap: 20px; }
  .header-summary { padding: 16px 0 0; border-left: 0; border-top: 1px solid #496258; }
  .header-actions { margin-top: 4px; }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .agenda-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  html { scroll-padding-top: 85px; }
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .page-shell { width: calc(100% - 24px); padding-top: 12px; }
  .app-header { padding: 20px; gap: 14px; border-radius: 12px; }
  .app-header .hero-copy h1 { font-size: 1.7rem; max-width: 24ch; }
  .app-header .hero-copy p { font-size: .85rem; }
  .header-summary { gap: 8px; padding-top: 12px; }
  .header-status-row, .header-automation-row { font-size: .73rem; line-height: 1.5; }
  .header-actions { gap: 8px; }
  .header-actions a { flex: 1; padding: 8px; font-size: .73rem; text-align: center; }
  .tabs-nav { position: fixed; inset: auto 0 0; z-index: 40; width: 100%; min-height: 68px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-radius: 0; gap: 4px; box-shadow: 0 -4px 20px #173d3114; }
  .tabs-nav .tab-button { min-height: 52px; padding: 8px 2px; font-size: .76rem; }
  .tabs-nav .tab-button span { font-size: .76rem; }
  .tabs-nav .tab-button small { display: none; }
  .persistent-filter-tools { position: sticky; inset: auto; top: 0; min-height: 64px; padding: 8px; gap: 6px; margin-bottom: 16px; border: 1px solid #c5d5c8; border-radius: 8px; flex-wrap: nowrap; }
  .persistent-tool-button { min-height: 44px; font-size: .76rem; padding: 0 10px; flex: 0 0 auto; }
  .active-filter-summary { font-size: .7rem; max-height: 42px; overflow-y: auto; }
  .chart-density-button { display: none; }
  .persistent-reset-button { font-size: .72rem; color: #305340; border-color: #c5d5c8; }
  .reading-intro { padding-bottom: 14px; }
  .reading-intro h2 { font-size: 1.2rem; }
  .reading-intro p { font-size: .83rem; }
  .panel { padding: 18px; margin-bottom: 16px; }
  .panel h2 { font-size: 1.08rem; }
  .section-heading { flex-wrap: wrap; gap: 10px; }
  .panel-caption { font-size: .84rem; }
  .metrics-grid, .metrics-grid-dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { padding: 14px; min-width: 0; }
  .metric-card strong { font-size: 1.7rem; }
  .metric-card span, .metric-card small { font-size: .77rem; overflow-wrap: anywhere; }
  .magnitude-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .magnitude-item-primary { grid-column: 1 / -1; }
  .agenda-grid, .content-grid, .executive-conclusions-grid, .executive-insights-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-shell, .chart-shell-large, .chart-shell-compact { height: 300px; min-height: 280px; }
  .chart-shell-image { height: 380px; }
  .chart-toggle-button { width: auto; min-height: 44px; }
  .reading-detail { padding: 0 16px; }
  .reading-detail > summary { font-size: .93rem; }
  .tab-panel, .panel { scroll-margin-top: 84px; }
  .filter-dialog { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .filter-dialog-head { padding: 12px 18px; }
  .filter-dialog .filters-card { padding: 18px; }
  .filter-dialog .filters-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-dialog .filter-header-actions { display: flex; gap: 8px; width: 100%; }
  .filter-dialog .filter-header-actions button { flex: 1; }
  .filter-dialog .filters-actions { bottom: -18px; }
  .filter-dialog .platform-chip { width: auto !important; min-height: 44px; font-size: .78rem; padding: 8px 10px; }
  .filter-dialog .core-filter { display: grid; }
  .post-card, .comment-card, .news-card, .agenda-card, .event-card { min-width: 0; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
