/* View Transitions API: native crossfade between MPA navigations in supporting
   browsers (Chrome 111+). No-op elsewhere — prefetch + SW keep things instant. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

:root {
  --bg: #09111f;
  --bg-2: #0f172a;
  --panel: rgba(15, 23, 42, 0.94);
  --panel-2: #162033;
  --line: #334155;
  --line-soft: rgba(148, 163, 184, 0.16);
  --text: #e5eefc;
  --muted: #9db1ca;
  --accent: #60a5fa;
  --accent-2: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #13203c 0%, #09111f 55%);
  color: var(--text);
}
code { color: #bfdbfe; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell {
  display: grid;
  grid-template-columns: 378px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: rgba(2, 6, 23, 0.9);
  border-right: 1px solid var(--line-soft);
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
}
.main-content {
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
}
.brand {
  margin-bottom: 16px;
}
.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  color: #bfdbfe;
  font-size: 0.76rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.brand h1 {
  margin: 0 0 10px;
  font-size: 1.48rem;
}
.brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel.compact { padding: 12px 16px; }
.panel h2 {
  margin: 0;
  font-size: 1rem;
}
.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-header.tight { margin-bottom: 10px; align-items: center; }
label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}
input, select, button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 12px;
}
select[multiple] { min-height: 182px; }
button {
  font-weight: 600;
  transition: border-color .2s ease, transform .15s ease, background .2s ease;
}
button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
button:active { transform: translateY(0); }
.ghost-btn {
  background: rgba(96, 165, 250, 0.08);
}
.small-btn {
  width: auto;
  padding: 8px 12px;
  font-size: 0.86rem;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.toggle-stack {
  display: grid;
  gap: 8px;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}
.checkbox-row input { width: auto; }
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.toolbar-left, .toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  padding: 6px 10px;
  font-size: 0.82rem;
  background: rgba(96, 165, 250, 0.08);
}
.pill.muted {
  background: rgba(148, 163, 184, 0.07);
  color: var(--muted);
}
.warning-strip {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.11);
  color: #fde68a;
  line-height: 1.45;
}
.hidden { display: none !important; }
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.overview-card {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 14px;
}
.overview-card .label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 6px;
}
.overview-card .value {
  font-size: 1.35rem;
  font-weight: 700;
}
.overview-card .sub {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}
.map-and-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 16px;
  margin-bottom: 16px;
}
.map-panel, .detail-panel { min-height: 620px; }
#map-wrapper {
  position: relative;
  min-height: 560px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(2, 6, 23, 0.96));
  border: 1px solid var(--line-soft);
}
#map-svg {
  width: 100%;
  height: min(70vh, 720px);
  display: block;
}
.empty-state {
  color: var(--muted);
  line-height: 1.55;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.42);
}
#map-empty-state {
  position: absolute;
  inset: 18px;
}
.tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  max-width: 300px;
  background: rgba(2, 6, 23, 0.97);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
}
#legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  font-size: 0.8rem;
  background: rgba(15, 23, 42, 0.65);
}
.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.25);
}
.legend-gradient {
  display: inline-block;
  width: 84px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
}
.status-grid {
  display: grid;
  gap: 8px;
}
.status-item {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 10px;
  background: rgba(15,23,42,.45);
}
.status-item strong { display: block; margin-bottom: 4px; }
.badge-ok { color: #86efac; }
.badge-warn { color: #fcd34d; }
.badge-bad { color: #fca5a5; }
.detail-block { margin-bottom: 14px; }
.detail-block h3 { margin: 0 0 8px; font-size: 0.95rem; }
.keyvals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.keyvals div {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 8px 10px;
}
.keyvals span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.story-box {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(34, 197, 94, 0.09);
  border: 1px solid rgba(34, 197, 94, 0.2);
  line-height: 1.5;
  color: #dcfce7;
}
.lineage-box {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.18);
}
.lineage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.lineage-grid div {
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(15, 23, 42, 0.35);
}
.result-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.3fr) 4fr 90px 70px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.result-row:last-child { border-bottom: 0; }
.result-bar-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}
.result-bar-fill {
  height: 100%;
  border-radius: 999px;
}
.chart-box {
  margin-top: 12px;
}
#timeline-chart, #dominance-strip {
  width: 100%;
  border-radius: 16px;
  background: rgba(15,23,42,.38);
  border: 1px solid var(--line-soft);
}
#timeline-chart { height: 300px; }
#dominance-strip { height: 92px; margin-top: 10px; }
.comparison-and-table {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 16px;
}
.comparison-grid {
  display: grid;
  gap: 12px;
}
.comparison-box {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(15,23,42,.45);
}
.comparison-box h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.ranked-list {
  display: grid;
  gap: 6px;
}
.ranked-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.ranked-item:last-child { border-bottom: 0; }
.table-wrap { overflow: auto; max-height: 430px; }
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}
thead th {
  position: sticky;
  top: 0;
  background: #0b1220;
  z-index: 1;
}
tr:hover td { background: rgba(96,165,250,.06); }
tr.is-selected td { background: rgba(34,197,94,.08); }
.methodology-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}
.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  background: rgba(245, 158, 11, 0.1);
  font-size: 0.76rem;
}
.map-path { transition: fill .18s ease, stroke-width .18s ease, opacity .18s ease; }
.map-path.is-selected {
  stroke: #f8fafc;
  stroke-width: 1.7;
}
.map-path.is-faded { opacity: .28; }
@media (max-width: 1420px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-and-table { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .map-and-detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .two-col, .button-grid, .overview-grid, .lineage-grid, .keyvals { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
}


.time-nav-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(15, 23, 42, 0.35);
}
.time-nav-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.helper-text {
  color: var(--muted);
  font-size: 0.83rem;
  margin-top: 8px;
}
.detail-actions-row {
  display: flex;
  gap: 10px;
  margin: 10px 0 8px;
  flex-wrap: wrap;
}
.compare-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.24);
  color: #dbeafe;
  font-size: 0.82rem;
}
.compare-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 18px;
  margin-top: 18px;
}
.multi-compare-panel svg,
#multi-compare-chart,
#timeline-chart,
#dominance-strip {
  width: 100%;
  height: auto;
}
.map-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
#map-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
}
#map-svg {
  display: block;
  width: 100%;
  height: auto;
}
.ranking-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ranked-item button.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.compare-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}
@media (max-width: 1420px) {
  .analysis-grid { grid-template-columns: 1fr; }
}


.preset-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.preset-btn {
  background: rgba(148, 163, 184, 0.08);
  font-size: 0.84rem;
  font-weight: 600;
}
.preset-btn:hover {
  border-color: var(--accent-2);
}
.recent-stack {
  display: grid;
  gap: 8px;
}
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(15,23,42,.45);
}
.recent-item .meta {
  color: var(--muted);
  font-size: 0.78rem;
}
.recent-item button {
  width: auto;
  padding: 6px 10px;
  border-radius: 10px;
}
.insights-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
  margin-top: 18px;
}
#heatmap-chart {
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: rgba(15,23,42,.38);
  border: 1px solid var(--line-soft);
}
.province-insights-grid {
  display: grid;
  gap: 10px;
}
.province-card {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(15,23,42,.45);
}
.province-card.is-selected {
  border-color: rgba(96,165,250,.65);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,.18);
}
.province-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.province-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.province-metrics .mini {
  padding: 8px;
  border-radius: 12px;
  background: rgba(2,6,23,.34);
  border: 1px solid var(--line-soft);
}
.province-metrics .mini .k {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.province-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.province-actions button {
  width: auto;
  padding: 7px 10px;
  border-radius: 10px;
}
.map-path.is-compared {
  filter: saturate(1.05);
}
.heatmap-cell {
  stroke: rgba(255,255,255,.08);
}
.heatmap-axis text {
  fill: var(--muted);
  font-size: 11px;
}
.heatmap-axis path,
.heatmap-axis line {
  stroke: #475569;
}
.heatmap-highlight {
  font-weight: 700;
  fill: #f8fafc !important;
}
@media (max-width: 1420px) {
  .insights-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .preset-grid, .province-metrics { grid-template-columns: 1fr; }
}


.filter-chip-bar {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:14px;
}
.filter-chip {
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  background:rgba(148,163,184,.08);
  border:1px solid var(--line-soft);
  color:var(--muted);
  font-size:.82rem;
}
.filter-chip strong { color: var(--text); font-weight: 600; }
.compare-map-toolbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:12px;
}
.compare-map-grid {
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  margin-bottom:12px;
}
.mini-map-box {
  border:1px solid var(--line-soft);
  border-radius:16px;
  background:rgba(15,23,42,.55);
  overflow:hidden;
}
.mini-map-title {
  padding:10px 12px;
  border-bottom:1px solid var(--line-soft);
  color:var(--muted);
  font-size:.86rem;
}
.mini-map-wrap {
  min-height:240px;
  background:linear-gradient(180deg, rgba(15,23,42,.6), rgba(2,6,23,.96));
}
#compare-map-a, #compare-map-b { width:100%; height:260px; display:block; }
.mini-map-path { transition: opacity .18s ease, stroke-width .18s ease; }
.mini-map-path.is-selected { stroke: #f8fafc !important; stroke-width: 1.8px !important; }
.mini-map-path.is-muted { opacity: .45; }
.table-pager {
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:10px;
  margin-top:12px;
}
.diagnostics-panel {
  margin-top:12px;
  display:grid;
  gap:10px;
}
.diagnostic-box {
  border:1px solid var(--line-soft);
  border-radius:16px;
  padding:12px;
  background:rgba(15,23,42,.42);
}
.diagnostic-grid {
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:8px;
  margin-top:8px;
}
.diagnostic-stat {
  border:1px solid var(--line-soft);
  border-radius:12px;
  padding:8px 10px;
  background:rgba(2,6,23,.26);
}
.diagnostic-stat .v { display:block; font-size:1.06rem; font-weight:700; color:var(--text); }
.coverage-audit {
  display:grid;
  gap:8px;
  margin-top:12px;
}
.coverage-item {
  display:grid;
  grid-template-columns: 1fr auto;
  gap:10px;
  align-items:center;
  padding:8px 10px;
  border-radius:12px;
  background:rgba(15,23,42,.42);
  border:1px solid var(--line-soft);
  font-size:.88rem;
}
.coverage-item.ok { border-color: rgba(34,197,94,.3); }
.coverage-item.partial { border-color: rgba(245,158,11,.35); }
.coverage-item.missing { border-color: rgba(239,68,68,.35); }
.coverage-badge {
  border-radius:999px;
  padding:4px 8px;
  font-size:.75rem;
  font-weight:700;
}
.coverage-badge.ok { background: rgba(34,197,94,.15); color:#86efac; }
.coverage-badge.partial { background: rgba(245,158,11,.15); color:#fde68a; }
.coverage-badge.missing { background: rgba(239,68,68,.15); color:#fca5a5; }
.shortcuts-hint { margin-top: 10px; }
kbd {
  padding:2px 6px;
  border-radius:8px;
  border:1px solid var(--line);
  background:rgba(2,6,23,.7);
  color:var(--text);
  font-size:.78rem;
}
.recent-group-title {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing:.04em;
}
.recent-group { display:grid; gap:8px; }
.star-btn {
  width:auto;
  padding:6px 10px;
  border-radius:999px;
}
.star-btn.is-on {
  border-color: rgba(245,158,11,.55);
  background: rgba(245,158,11,.14);
  color:#fde68a;
}
@media (max-width: 1200px) {
  .compare-map-grid { grid-template-columns: 1fr; }
}

.research-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 18px;
  margin-top: 18px;
}
.similarity-grid {
  display: grid;
  gap: 12px;
}
.similarity-card,
.cluster-card,
.small-multiple-card {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(15,23,42,.45);
}
.similarity-card h3,
.cluster-card h3,
.small-multiple-card h3 {
  margin: 0 0 8px;
  font-size: .95rem;
}
.similarity-list {
  display: grid;
  gap: 8px;
}
.similarity-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.similarity-item:last-child { border-bottom: 0; }
.similarity-item button.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.similarity-meta {
  color: var(--muted);
  font-size: .8rem;
  margin-top: 3px;
}
.similarity-score {
  min-width: 70px;
  text-align: right;
  font-weight: 700;
}
.cluster-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34,197,94,.11);
  border: 1px solid rgba(34,197,94,.25);
  color: #bbf7d0;
  font-size: .8rem;
  margin-bottom: 10px;
}
.small-multiple-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.small-multiple-card.is-selected {
  border-color: rgba(96,165,250,.6);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,.18);
}
.small-multiple-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.small-multiple-head .meta {
  color: var(--muted);
  font-size: .78rem;
}
.sparkline-svg {
  width: 100%;
  height: 84px;
  display: block;
  border-radius: 12px;
  background: rgba(2,6,23,.28);
  border: 1px solid var(--line-soft);
}
.small-multiple-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.small-multiple-actions button {
  width: auto;
  padding: 7px 10px;
  border-radius: 10px;
}
.cluster-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.cluster-metric {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(2,6,23,.25);
}
.cluster-metric .k {
  display: block;
  color: var(--muted);
  font-size: .76rem;
  margin-bottom: 4px;
}
.cluster-metric strong {
  font-size: 1rem;
}
@media (max-width: 1420px) {
  .research-grid, .small-multiple-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .cluster-grid { grid-template-columns: 1fr; }
}


.trajectory-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin: .9rem 0 .4rem;
  flex-wrap: wrap;
}

.trajectory-controls {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
}

.trajectory-controls label {
  min-width: 220px;
}

.mini-section-title {
  font-size: .9rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: .15rem;
}

.story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 14px;
}
.story-card {
  border: 1px solid var(--line-soft);
  background: rgba(96,165,250,.06);
  border-radius: 16px;
  padding: 12px;
}
.story-card h4 {
  margin: 0 0 8px;
  font-size: .92rem;
}
.story-card .big {
  font-size: 1.25rem;
  font-weight: 700;
}
.annotation-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(15,23,42,.55);
}
.annotation-box textarea {
  resize: vertical;
  min-height: 100px;
}
.swipe-compare-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.swipe-stage {
  position: relative;
  margin-top: 8px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(2, 6, 23, 0.96));
}
#swipe-map-svg {
  width: 100%;
  height: 320px;
  display: block;
}
.swipe-map-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(248,250,252,.95);
  box-shadow: 0 0 0 1px rgba(15,23,42,.4), 0 0 24px rgba(248,250,252,.25);
  pointer-events: none;
}
.swipe-label {
  font-size: 11px;
  fill: #e5eefc;
}
.map-path.is-faded,
.mini-map-path.is-muted {
  opacity: .35;
}
.mini-map-path.is-selected,
.map-path.is-selected {
  filter: drop-shadow(0 0 7px rgba(255,255,255,.22));
}
.mini-map-path.is-compared,
.map-path.is-compared {
  filter: drop-shadow(0 0 4px rgba(96,165,250,.25));
}
.note-saved-ok {
  color: #86efac;
}
.note-saved-muted {
  color: var(--muted);
}
@media (max-width: 1200px) {
  .story-grid { grid-template-columns: 1fr; }
}


.audit-panel { margin-top: 2px; }
.readiness-grid { display:grid; grid-template-columns: 1.2fr .9fr; gap:12px; }
.readiness-box, .gap-box { border:1px solid var(--line-soft); border-radius:16px; padding:12px; background:rgba(15,23,42,.46); }
.audit-table { width:100%; border-collapse: collapse; font-size:.84rem; }
.audit-table th, .audit-table td { padding:8px 10px; border-bottom:1px solid var(--line-soft); text-align:left; vertical-align:top; }
.audit-table th { color: var(--muted); font-weight:600; }
.audit-badge { display:inline-flex; align-items:center; padding:3px 8px; border-radius:999px; font-size:.74rem; font-weight:700; border:1px solid var(--line-soft); }
.audit-badge.ok { background: rgba(34,197,94,.14); color:#86efac; }
.audit-badge.partial { background: rgba(245,158,11,.14); color:#fde68a; }
.audit-badge.missing { background: rgba(239,68,68,.14); color:#fca5a5; }
.gap-list { display:grid; gap:8px; }
.gap-item { border:1px solid var(--line-soft); border-radius:14px; padding:10px 12px; background:rgba(2,6,23,.24); }
.gap-item .title { font-weight:700; display:block; margin-bottom:4px; }
.gap-item .meta { color:var(--muted); font-size:.84rem; }
.diagnostic-list { margin-top:10px; display:grid; gap:6px; }
.diagnostic-list .row { display:flex; justify-content:space-between; gap:10px; padding:6px 0; border-bottom:1px dashed var(--line-soft); font-size:.83rem; }
.helper-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; margin-top:10px; }
.helper-card { border:1px solid var(--line-soft); border-radius:14px; padding:10px; background:rgba(15,23,42,.36); }
.helper-card .k { color:var(--muted); font-size:.78rem; display:block; margin-bottom:4px; }
.helper-card .v { font-size:1.05rem; font-weight:700; }
@media (max-width: 1200px) { .readiness-grid { grid-template-columns:1fr; } .helper-grid { grid-template-columns:1fr; } }

.report-box {
  margin-top: 12px;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 16px;
  padding: 12px;
  background: rgba(15,23,42,.36);
}

.report-grid .story-card {
  min-height: 100%;
}

.external-panel .diagnostic-box code {
  color: var(--accent, #93c5fd);
}

#context-compare-chart {
  width: 100%;
  height: auto;
  margin-top: 6px;
}


.advanced-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

#archetype-panel-content, #transition-matrix-content {
  display:flex;
  flex-direction:column;
  gap:14px;
}

.archetype-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.archetype-card, .transition-card {
  border:1px solid rgba(148,163,184,.22);
  border-radius:16px;
  padding:14px;
  background:rgba(15,23,42,.38);
}

.archetype-badge {
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:999px;
  padding:4px 10px;
  background:rgba(59,130,246,.15);
  color:#bfdbfe;
  font-size:12px;
  margin-bottom:8px;
}

.archetype-list, .transition-list {
  display:flex;
  flex-direction:column;
  gap:8px;
}

.archetype-item, .transition-item {
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
  padding:8px 0;
  border-top:1px dashed rgba(148,163,184,.18);
}

.archetype-item:first-child, .transition-item:first-child { border-top:0; }

.archetype-count {
  font-weight:700;
  color:#f8fafc;
}

.group-compare-panel svg, .transitions-panel table {
  width:100%;
}

.transition-table {
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.transition-table th, .transition-table td {
  border:1px solid rgba(148,163,184,.18);
  padding:8px;
  text-align:left;
}

.transition-table th {
  background:rgba(30,41,59,.9);
  color:#e2e8f0;
}

.transition-cell-strong {
  background:rgba(59,130,246,.16);
  font-weight:700;
}

@media (max-width: 1100px) {
  .advanced-grid { grid-template-columns:1fr; }
  .archetype-grid { grid-template-columns:1fr; }
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 42vw;
  height: 42vw;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(90px);
  opacity: .16;
  z-index: 0;
}
body::before {
  top: -12vw;
  right: -10vw;
  background: radial-gradient(circle, rgba(96,165,250,.9) 0%, rgba(96,165,250,0) 68%);
}
body::after {
  bottom: -16vw;
  left: -8vw;
  background: radial-gradient(circle, rgba(34,197,94,.9) 0%, rgba(34,197,94,0) 66%);
}
.app-shell, .loading-overlay, .command-palette, .toast-stack { position: relative; z-index: 1; }
.brand h1 {
  background: linear-gradient(92deg, #ffffff 0%, #93c5fd 42%, #86efac 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.7rem;
  letter-spacing: -.03em;
}
.sidebar { backdrop-filter: blur(18px); }
.main-content { position: relative; }
.panel {
  backdrop-filter: blur(14px);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.panel:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.26);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.34);
}
button {
  background: linear-gradient(180deg, rgba(30,41,59,.95), rgba(22,32,51,.95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
button:not(.ghost-btn) {
  border-color: rgba(96, 165, 250, .26);
}
button:not(.ghost-btn):hover {
  background: linear-gradient(180deg, rgba(37,99,235,.25), rgba(30,41,59,.96));
}
.ghost-btn {
  background: linear-gradient(180deg, rgba(96,165,250,.12), rgba(96,165,250,.06));
}
.toolbar {
  position: sticky;
  top: 14px;
  z-index: 8;
  backdrop-filter: blur(14px);
}
.filter-chip-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-chip-bar .pill { background: rgba(15,23,42,.72); }
.map-header-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.overview-card {
  background: linear-gradient(180deg, rgba(22,32,51,.96), rgba(15,23,42,.86));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.overview-card .value {
  font-size: 1.58rem;
  letter-spacing: -.03em;
}
.status-panel .pill, .toolbar .pill {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3,7,18,.72);
  backdrop-filter: blur(12px);
  z-index: 50;
}
.loading-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(17,24,39,.96));
  border: 1px solid rgba(96,165,250,.18);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.loading-orb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #93c5fd, #22c55e);
  box-shadow: 0 0 0 0 rgba(147,197,253,.45);
  animation: pulseOrb 1.4s infinite;
}
@keyframes pulseOrb {
  0% { transform: scale(.95); box-shadow: 0 0 0 0 rgba(147,197,253,.38); }
  70% { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(147,197,253,0); }
  100% { transform: scale(.95); box-shadow: 0 0 0 0 rgba(147,197,253,0); }
}
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 60;
}
.toast {
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(96,165,250,.22);
  background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(17,24,39,.92));
  box-shadow: 0 18px 42px rgba(0,0,0,.34);
}
.toast.success { border-color: rgba(34,197,94,.3); }
.toast.warning { border-color: rgba(245,158,11,.35); }
.toast.error { border-color: rgba(239,68,68,.32); }
.command-palette {
  position: fixed;
  inset: 0;
  z-index: 55;
}
.command-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2,6,23,.72);
  backdrop-filter: blur(10px);
}
.command-dialog {
  position: relative;
  margin: 6vh auto 0;
  width: min(760px, calc(100vw - 32px));
  padding: 20px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(15,23,42,.985), rgba(17,24,39,.96));
  border: 1px solid rgba(96,165,250,.2);
  box-shadow: 0 28px 80px rgba(0,0,0,.5);
}
.command-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.command-header h2 { margin: 6px 0 0; }
.command-results {
  display: grid;
  gap: 8px;
  max-height: 56vh;
  overflow: auto;
  margin: 12px 0;
}
.command-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.16);
  background: rgba(15,23,42,.7);
}
.command-item.is-active,
.command-item:hover {
  border-color: rgba(96,165,250,.35);
  background: linear-gradient(180deg, rgba(30,41,59,.95), rgba(22,32,51,.92));
}
.command-item-title { font-weight: 700; }
.command-item-sub { color: var(--muted); font-size: .84rem; }
.command-item-kicker {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #93c5fd;
}
.focus-mode .sidebar {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: 0;
}
.focus-mode .app-shell { grid-template-columns: 0 minmax(0,1fr); }
.focus-mode .toolbar { top: 10px; }
body.map-fullscreen-active .toolbar { top: 10px; }
.compare-map-grid, .analysis-grid, .insights-grid, .research-grid, .advanced-grid {
  gap: 16px;
}
#map-wrapper, .mini-map-wrap, .swipe-stage {
  border-radius: 20px;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(96,165,250,.08), rgba(15,23,42,.88));
  border: 1px solid rgba(148,163,184,.14);
}
#map-svg path, #compare-map-a path, #compare-map-b path, #swipe-map-svg path {
  transition: fill .18s ease, stroke .18s ease, opacity .18s ease;
}
#map-svg path:hover, #compare-map-a path:hover, #compare-map-b path:hover {
  stroke-width: 1.8px;
}
.diagnostic-box,
.report-box,
.story-box,
.annotation-box,
.comparison-box,
.archetype-card,
.province-card,
.similarity-card {
  background: linear-gradient(180deg, rgba(22,32,51,.84), rgba(15,23,42,.7));
  border: 1px solid rgba(148,163,184,.14);
  border-radius: 18px;
}
.helper-text { color: var(--muted); }
#results-table tbody tr {
  transition: background .14s ease;
}
#results-table tbody tr:hover {
  background: rgba(96,165,250,.08);
}
.readiness-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}
.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.health-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.14);
  background: linear-gradient(180deg, rgba(22,32,51,.88), rgba(15,23,42,.78));
}
.health-card strong {
  display: block;
  font-size: 1.25rem;
  margin-top: 6px;
}
.health-card .sub { color: var(--muted); font-size: .84rem; }
.mini-kicker {
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .72rem;
}
@media (max-width: 1220px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-and-detail { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .toolbar { position: static; }
  .two-col, .button-grid { grid-template-columns: 1fr; }
}


body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 12%, rgba(34,197,94,.09), transparent 22%),
    radial-gradient(circle at 92% 10%, rgba(96,165,250,.14), transparent 26%),
    radial-gradient(circle at 80% 80%, rgba(236,72,153,.07), transparent 18%);
  z-index: 0;
}
.app-shell, .command-palette, .toast-stack, .loading-overlay { position: relative; z-index: 1; }
.toolbar.panel.compact {
  position: sticky;
  top: 12px;
  z-index: 18;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(17,24,39,.92), rgba(15,23,42,.82));
}
.main-content > section { scroll-margin-top: 80px; }
.mode-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.mode-btn {
  min-height: 52px;
  text-align: left;
  background: linear-gradient(180deg, rgba(30,41,59,.95), rgba(15,23,42,.92));
}
.mode-btn.is-active {
  border-color: rgba(96,165,250,.7);
  box-shadow: 0 0 0 1px rgba(96,165,250,.28), 0 10px 26px rgba(37,99,235,.18);
  background: linear-gradient(180deg, rgba(30,64,175,.24), rgba(15,23,42,.92));
}
.saved-view-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,23,42,.5);
  border: 1px solid var(--line-soft);
}
.saved-view-item + .saved-view-item { margin-top: 8px; }
.ghost-mini {
  width: auto;
  min-width: 40px;
  padding: 8px 10px;
  background: rgba(239,68,68,.08);
}
.insight-feed {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.insight-card {
  text-align: left;
  min-height: 132px;
  border-radius: 18px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(30,41,59,.9), rgba(15,23,42,.96)),
    radial-gradient(circle at top right, rgba(96,165,250,.16), transparent 34%);
  border: 1px solid rgba(148,163,184,.16);
  box-shadow: 0 14px 30px rgba(2,6,23,.28);
}
.insight-card:hover {
  border-color: rgba(96,165,250,.5);
  transform: translateY(-2px);
}
.insight-value {
  display: block;
  margin: 8px 0 6px;
  font-size: 1.05rem;
  line-height: 1.3;
}
.next-actions {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(96,165,250,.08);
  border: 1px dashed rgba(96,165,250,.22);
}
.legend-caption {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #bfdbfe;
  padding-right: 6px;
}
.legend-caption.subtle {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
#legend {
  gap: 8px;
  align-items: center;
}
.table-wrap table thead th {
  position: sticky;
  top: 0;
  background: rgba(15,23,42,.98);
  z-index: 2;
}
tbody tr:hover td {
  background: rgba(96,165,250,.08);
}
.density-compact .panel { padding: 12px; border-radius: 16px; }
.density-compact .overview-grid,
.density-compact .analysis-grid,
.density-compact .insights-grid,
.density-compact .research-grid,
.density-compact .advanced-grid,
.density-compact .comparison-and-table { gap: 12px; }
.density-compact .main-content,
.density-compact .sidebar { padding: 14px; }
.vision-high-contrast {
  --bg: #020617;
  --bg-2: #020617;
  --panel: rgba(2,6,23,0.98);
  --panel-2: #000;
  --line: #94a3b8;
  --line-soft: rgba(226,232,240,.36);
  --text: #f8fafc;
  --muted: #dbeafe;
  --accent: #93c5fd;
  --shadow: 0 0 0 1px rgba(255,255,255,.05), 0 18px 46px rgba(0,0,0,.36);
}
.vision-high-contrast body,
body.vision-high-contrast {
  background: radial-gradient(circle at top left, #0f172a 0%, #020617 62%);
}
.vision-colorblind {
  --accent: #0ea5e9;
  --accent-2: #eab308;
}
.shortcuts-hint {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-soft);
}
kbd {
  font-family: inherit;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: rgba(148,163,184,.12);
  color: var(--text);
  font-size: .78rem;
}
@media (max-width: 1400px) {
  .insight-feed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line-soft); max-height: none; }
  .insight-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .insight-feed, .mode-button-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
}

.jump-bar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
  background: linear-gradient(180deg, rgba(15,23,42,.92), rgba(15,23,42,.76));
}
.jump-bar-left {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.jump-nav {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.pill.warning {
  background: rgba(245,158,11,.14);
  color:#fde68a;
  border-color: rgba(245,158,11,.35);
}
.pill.bad {
  background: rgba(239,68,68,.14);
  color:#fecaca;
  border-color: rgba(239,68,68,.32);
}
.panel-collapse-btn {
  margin-left:auto;
}
.panel.is-collapsed > :not(.panel-header),
.panel.collapsed > :not(.panel-header) {
  display:none !important;
}
.panel.is-collapsed .panel-header,
.panel.collapsed .panel-header {
  margin-bottom:0;
}
.selection-dock {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 48;
  padding: 12px 14px;
  border-radius: 22px;
  border: 1px solid rgba(96,165,250,.24);
  background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(17,24,39,.92));
  box-shadow: 0 22px 56px rgba(0,0,0,.42);
  backdrop-filter: blur(16px);
}
.selection-dock-main {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
}
.selection-dock-actions {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.selection-dock.hidden { display:none; }
.onboarding-modal {
  position: fixed;
  inset: 0;
  z-index: 58;
}
.onboarding-backdrop {
  position:absolute;
  inset:0;
  background: rgba(2,6,23,.78);
  backdrop-filter: blur(10px);
}
.onboarding-dialog {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  margin: 7vh auto 0;
  padding: 20px;
  border-radius: 28px;
  border: 1px solid rgba(96,165,250,.22);
  background: linear-gradient(180deg, rgba(15,23,42,.985), rgba(17,24,39,.96));
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
}
.onboarding-grid {
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:12px;
  margin: 14px 0;
}
.onboarding-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(180deg, rgba(30,41,59,.88), rgba(15,23,42,.72));
}
.onboarding-card strong { display:block; margin: 6px 0; }
.onboarding-card p { margin:0; color: var(--muted); line-height:1.55; }
.smart-empty-state {
  border:1px dashed rgba(96,165,250,.28);
  background: linear-gradient(180deg, rgba(30,41,59,.42), rgba(15,23,42,.18));
}
#history-back-btn:disabled,
#history-forward-btn:disabled,
button:disabled {
  opacity:.45;
  cursor:not-allowed;
}
@media (max-width: 980px) {
  .jump-bar,
  .selection-dock-main { flex-direction:column; align-items:stretch; }
  .onboarding-grid { grid-template-columns: 1fr; }
}


/* v15: premium polish, simplicity toggle, trust language */
:root {
  --bg: #08101d;
  --bg-2: #101a2a;
  --panel: rgba(14, 22, 36, 0.94);
  --panel-2: #111b2d;
  --line: #2d3a50;
  --line-soft: rgba(148, 163, 184, 0.14);
  --text: #ecf3ff;
  --muted: #98abc4;
  --accent: #6ea8fe;
  --accent-2: #34d399;
  --shadow: 0 16px 34px rgba(2, 8, 23, 0.26);
}
body {
  background:
    radial-gradient(circle at 12% 0%, rgba(90, 129, 255, 0.14), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(52, 211, 153, 0.08), transparent 28%),
    linear-gradient(180deg, #08101d 0%, #0a1322 100%);
}
.panel {
  backdrop-filter: blur(12px);
  border-radius: 22px;
}
.toolbar, .jump-bar, .quickstart-strip.panel.compact { backdrop-filter: blur(18px); }
.pill.ok, .audit-badge.ok { background: rgba(52, 211, 153, 0.12); color: #d1fae5; border-color: rgba(52, 211, 153, 0.28); }
.pill.partial, .audit-badge.partial { background: rgba(245, 158, 11, 0.12); color: #fde68a; border-color: rgba(245, 158, 11, 0.28); }
.pill.missing, .audit-badge.missing { background: rgba(239, 68, 68, 0.12); color: #fecaca; border-color: rgba(239, 68, 68, 0.28); }
.view-mode-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.view-mode-toggle {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--line-soft);
  margin-bottom: 8px;
}
.view-mode-toggle button {
  width: auto;
  min-width: 92px;
  border-radius: 12px;
  padding: 8px 12px;
}
.view-mode-toggle button.active {
  background: linear-gradient(135deg, rgba(110, 168, 254, 0.22), rgba(52, 211, 153, 0.16));
  border-color: rgba(110, 168, 254, 0.42);
}
.basic-mode .advanced-only { display: none !important; }
.quickstart-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.quickstart-card {
  text-align: left;
  padding: 14px;
  min-height: 118px;
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, rgba(20, 31, 49, 0.9), rgba(12, 20, 34, 0.92));
}
.quickstart-card strong { font-size: 0.96rem; }
.quickstart-card span { color: var(--muted); font-weight: 500; line-height: 1.45; }
.quickstart-card em { font-style: normal; color: #dbeafe; font-size: 0.84rem; }
.trust-box {
  margin: 12px 0 14px;
  border-radius: 18px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(15, 23, 42, 0.7);
}
.trust-box.ok { border-color: rgba(52, 211, 153, 0.26); background: rgba(6, 78, 59, 0.16); }
.trust-box.partial { border-color: rgba(245, 158, 11, 0.25); background: rgba(120, 53, 15, 0.14); }
.trust-box.missing { border-color: rgba(239, 68, 68, 0.25); background: rgba(127, 29, 29, 0.14); }
.trust-box-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.trust-reason-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.trust-reason {
  border-radius: 12px;
  padding: 9px 11px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}
.selection-dock, .toolbar, .jump-bar {
  box-shadow: 0 10px 26px rgba(0,0,0,0.18);
}
.story-card, .overview-card, .onboarding-card, .helper-card { border-radius: 18px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(110, 168, 254, 0.9);
  outline-offset: 2px;
}
.basic-mode .quickstart-card:last-child { grid-column: auto; }
.basic-mode .quickstart-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.basic-mode .toolbar-right .ghost-btn.small-btn:nth-child(1),
.basic-mode .toolbar-right .ghost-btn.small-btn:nth-child(2) { display: none; }
.basic-mode .jump-bar .jump-nav button[data-jump-target="readiness-audit"],
.basic-mode .jump-bar .jump-nav button[data-jump-target="similarity-panel-content"] { display: none; }
.basic-mode .methodology-panel,
.basic-mode .status-panel { display: none !important; }
@media (max-width: 1180px) {
  .quickstart-cards { grid-template-columns: 1fr; }
  .basic-mode .quickstart-cards { grid-template-columns: 1fr; }
}

/* Hardening / graceful fallback */
.main-content {
  padding-bottom: 112px;
}
body.geometry-missing .map-panel {
  border-color: rgba(245, 158, 11, 0.34);
}
body.geometry-missing .compare-map-grid,
body.geometry-missing .swipe-compare-box,
body.geometry-missing .mini-map-box {
  display: none;
}
body.geometry-missing #map-wrapper {
  min-height: 240px;
}
body.geometry-missing #map-empty-state {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(15, 23, 42, 0.72));
  border-color: rgba(245, 158, 11, 0.32);
}
@media (max-width: 900px) {
  .main-content {
    padding-bottom: 136px;
  }
}


/* v23 hardening + local bundle */
.dataset-banner {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.52);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.dataset-banner.ok {
  border-color: rgba(34, 197, 94, 0.28);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(15, 23, 42, 0.54));
}
.dataset-banner.warning {
  border-color: rgba(245, 158, 11, 0.28);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(15, 23, 42, 0.54));
}
.dataset-banner.error {
  border-color: rgba(239, 68, 68, 0.28);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08), rgba(15, 23, 42, 0.54));
}
body.data-first-mode .comparison-panel,
body.data-first-mode .comparison-maps-panel,
body.data-first-mode .swipe-panel {
  order: 10;
}
body.data-first-mode .map-panel {
  order: 6;
}
body.data-first-mode .table-panel,
body.data-first-mode .rankings-panel,
body.data-first-mode .detail-panel {
  order: 4;
}
body.data-first-mode .jump-nav button[data-jump-target="map-panel"],
body.data-first-mode .jump-nav button[data-jump-target="comparison-maps-panel"],
body.data-first-mode .jump-nav button[data-jump-target="swipe-panel"] {
  opacity: 0.55;
}
@media (max-width: 900px) {
  body.data-first-mode .selection-dock {
    bottom: 12px;
    left: 12px;
    right: 12px;
  }
}


.province-boundary{pointer-events:none}.status-banner{padding:12px 14px;border-radius:16px;margin-bottom:12px}.status-banner.ok{border:1px solid rgba(16,185,129,.35);background:rgba(16,185,129,.10)}.status-banner.warn{border:1px solid rgba(245,158,11,.35);background:rgba(245,158,11,.10)}.chip-btn{background:#0f172a;border:1px solid rgba(148,163,184,.28);color:#e5eefc;border-radius:999px;padding:6px 10px;margin:4px 4px 0 0;cursor:pointer}.trust-box{padding:10px 12px;border-radius:14px;border:1px solid rgba(148,163,184,.22);background:rgba(15,23,42,.45)}.trust-box.ok{border-color:rgba(16,185,129,.4)}.trust-box.partial{border-color:rgba(245,158,11,.4)}.trust-box.missing{border-color:rgba(239,68,68,.4)}

/* v23 local bundle + data catalog */
.local-bundle-panel code { font-size: 0.9em; }
.two-up { grid-template-columns: repeat(2, minmax(0,1fr)); }
.data-package-panel { overflow: hidden; }
.coverage-matrix { display:grid; gap:10px; margin-bottom:14px; }
.coverage-matrix-table { width:100%; border-collapse:collapse; font-size:12px; }
.coverage-matrix-table th, .coverage-matrix-table td { padding:8px 10px; border-bottom:1px solid rgba(148,163,184,.16); text-align:left; }
.coverage-dot { display:inline-flex; align-items:center; justify-content:center; min-width:28px; height:22px; border-radius:999px; font-weight:700; font-size:11px; padding:0 8px; }
.coverage-dot.ok { background: rgba(34,197,94,.18); color:#bbf7d0; }
.coverage-dot.partial { background: rgba(245,158,11,.18); color:#fde68a; }
.coverage-dot.none { background: rgba(148,163,184,.16); color:#cbd5e1; }
.data-catalog-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:12px; }
.data-card { border:1px solid rgba(148,163,184,.16); border-radius:18px; padding:14px; background: rgba(15,23,42,.55); }
.data-card h3 { margin:0 0 8px; font-size:15px; }
.data-meta { display:grid; gap:6px; font-size:12px; color:var(--muted); }
.data-actions { margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }
.data-actions .ghost-btn, .data-actions button { padding:8px 10px; }
@media (max-width: 900px) {
  .two-up { grid-template-columns: 1fr; }
  .coverage-matrix-table { font-size:11px; }
}


.method-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.note-list,.registry-list,.codebook-panel,.snippet-panel,.update-log-panel{display:grid;gap:10px}.note-card,.registry-card,.codebook-card,.snippet-card,.update-card{background:rgba(15,23,42,.52);border:1px solid rgba(148,163,184,.18);border-radius:16px;padding:12px 14px}.severity-pill{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:700;margin-bottom:8px}.severity-pill.info{background:rgba(59,130,246,.16);color:#93c5fd}.severity-pill.warn{background:rgba(245,158,11,.16);color:#fcd34d}.severity-pill.error{background:rgba(239,68,68,.18);color:#fca5a5}.registry-meta,.update-meta,.codebook-meta{font-size:12px;color:var(--muted)}.snippet-card pre{margin:8px 0 0;white-space:pre-wrap;word-break:break-word;font-size:12px;line-height:1.5;color:#dbeafe}.methodology-panel .mini-section-title{margin-bottom:8px}.compact-chip-row{display:flex;flex-wrap:wrap;gap:6px}.compact-chip{display:inline-flex;padding:4px 8px;border-radius:999px;background:rgba(148,163,184,.12);border:1px solid rgba(148,163,184,.18);font-size:12px;color:#cbd5e1}.status-banner .compact-chip{background:rgba(15,23,42,.4)}@media (max-width: 980px){.method-grid{grid-template-columns:1fr}}


.audience-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.audience-btn {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.audience-btn.is-active,
.audience-btn:hover {
  border-color: rgba(96, 165, 250, 0.7);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.22) inset;
  background: rgba(30, 41, 59, 0.92);
}

.reading-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.reading-guide-columns {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.reading-card,
.glossary-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.58);
  border-radius: 16px;
  padding: 14px 15px;
}

.reading-card strong,
.glossary-card strong {
  display: block;
  margin-bottom: 6px;
}

.reading-card p,
.glossary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.checklist-stack {
  display: grid;
  gap: 10px;
}

.checklist-item {
  position: relative;
  padding: 11px 12px 11px 34px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.checklist-item::before {
  content: '✓';
  position: absolute;
  left: 12px;
  top: 10px;
  color: #93c5fd;
  font-weight: 800;
}

.glossary-grid {
  display: grid;
  gap: 10px;
}

body[data-audience-mode="research"] .reading-guide-panel {
  border-color: rgba(125, 211, 252, 0.2);
}

body[data-audience-mode="press"] .reading-guide-panel {
  border-color: rgba(251, 191, 36, 0.2);
}

body[data-audience-mode="admin"] .reading-guide-panel {
  border-color: rgba(74, 222, 128, 0.2);
}

@media (max-width: 900px) {
  .reading-guide-columns,
  .audience-button-grid {
    grid-template-columns: 1fr;
  }
}


.briefing-headline {
  font-size: 1.18rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 6px;
}

.briefing-standfirst {
  margin-bottom: 14px;
  max-width: 100ch;
}

.briefing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.briefing-list {
  display: grid;
  gap: 10px;
}

.briefing-item {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 12px 13px;
  background: rgba(15, 23, 42, 0.6);
  line-height: 1.5;
}

.briefing-item.can {
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.12);
}

.briefing-item.caution {
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.14);
}

.briefing-item.cannot {
  box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.14);
}

.briefing-note {
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  padding: 13px 14px;
  background: rgba(15, 23, 42, 0.42);
  line-height: 1.55;
  color: #dbeafe;
}

@media (max-width: 1100px) {
  .briefing-grid {
    grid-template-columns: 1fr;
  }
}

/* v27 guided questions + evidence ladder */
.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.question-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(20, 31, 49, 0.82), rgba(12, 20, 34, 0.88));
  display: grid;
  gap: 10px;
}

.question-card-top {
  display: grid;
  gap: 8px;
}

.question-card p {
  margin: 0;
  line-height: 1.55;
  color: #e2e8f0;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* v34 simplification pass: the basic UI now behaves like a real guided surface,
   while the dense research shell stays available in expert mode. */
body.basic-mode .dashboard-tab[data-section-view="analysis"],
body.basic-mode .site-hero,
body.basic-mode .signature-panel,
body.basic-mode .site-layers-panel,
body.basic-mode .method-explainers-panel,
body.basic-mode .pathway-strip,
body.basic-mode .quickstart-strip,
body.basic-mode .question-workbench-panel,
body.basic-mode .reading-guide-panel,
body.basic-mode .briefing-panel,
body.basic-mode .evidence-panel,
body.basic-mode .faq-panel,
body.basic-mode .release-studio-panel,
body.basic-mode .insight-strip,
body.basic-mode .analysis-grid,
body.basic-mode .insights-grid,
body.basic-mode .research-grid,
body.basic-mode .advanced-grid,
body.basic-mode .transitions-panel,
body.basic-mode .audit-panel,
body.basic-mode .compare-map-grid,
body.basic-mode .swipe-compare-box {
  display: none !important;
}

body.basic-mode .dashboard-intro-strip {
  padding-top: 0;
  margin-bottom: 6px;
}

body.basic-mode .dashboard-intro-aside,
body.basic-mode .dashboard-intro-meta {
  display: none !important;
}

body.basic-mode .dashboard-intro-strip h1 {
  font-size: 2.1rem;
  max-width: 14ch;
}

body.basic-mode .dashboard-intro-text {
  max-width: 72ch;
  font-size: 1rem;
}

body.basic-mode .dashboard-section-tabs {
  max-width: 720px;
}

body.basic-mode .dashboard-section-tabs .dashboard-tab {
  min-width: 0;
  flex: 1 1 0;
}

body.basic-mode .panel.control-panel > .panel-header .panel-subtitle::after {
  content: ' In questa vista la provincia e i relativi filtri usano la provincia corrente; la provincia osservata resta visibile nella scheda del comune quando differisce.';
}

body.basic-mode .comparison-and-table {
  grid-template-columns: 1fr;
}

body.basic-mode .comparison-panel .panel-subtitle::after {
  content: ' La modalita base mostra il confronto essenziale senza mini-mappe aggiuntive.';
}

body.basic-mode .detail-panel .detail-narrative-grid,
body.basic-mode .detail-panel .detail-meta-block.detail-chart-block:last-of-type,
body.basic-mode .detail-panel .annotation-box {
  display: none !important;
}

body.basic-mode .detail-panel .detail-lineage-grid {
  grid-template-columns: 1fr;
}

body.basic-mode .table-panel .panel-subtitle::after {
  content: ' La tabella usa province correnti per filtro e lettura pubblica.';
}

@media (max-width: 900px) {
  body.basic-mode .dashboard-section-tabs {
    max-width: none;
  }
}

.evidence-list {
  display: grid;
  gap: 10px;
}

.evidence-item {
  border-radius: 16px;
  padding: 12px 13px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.54);
  line-height: 1.5;
}

.evidence-item.next {
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.12);
}

.evidence-pill.strong {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.evidence-pill.cautious {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
}

.evidence-pill.exploratory {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

body[data-audience-mode="research"] .question-workbench-panel {
  border-color: rgba(125, 211, 252, 0.2);
}

body[data-audience-mode="press"] .question-workbench-panel {
  border-color: rgba(251, 191, 36, 0.2);
}

body[data-audience-mode="admin"] .question-workbench-panel {
  border-color: rgba(74, 222, 128, 0.2);
}

@media (max-width: 980px) {
  .evidence-grid {
    grid-template-columns: 1fr;
  }
}


.product-card {
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(15,23,42,0.45);
}
.product-card + .product-card { margin-top: 10px; }

/* v30 hero + release studio */
body {
  background:
    radial-gradient(circle at top left, rgba(30, 64, 175, 0.24) 0%, transparent 28%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12) 0%, transparent 24%),
    linear-gradient(180deg, #08111f 0%, #0b1424 100%);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.94), rgba(3, 7, 18, 0.9));
  backdrop-filter: blur(12px);
}

.main-content {
  padding: 20px;
}

.toolbar.panel.compact,
.jump-bar.panel.compact {
  backdrop-filter: blur(10px);
}

.site-hero {
  overflow: hidden;
  position: relative;
  border-color: rgba(96, 165, 250, 0.2);
  background:
    radial-gradient(circle at 80% 15%, rgba(96, 165, 250, 0.18), transparent 24%),
    radial-gradient(circle at 15% 10%, rgba(34, 197, 94, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(16, 24, 39, 0.96), rgba(11, 19, 33, 0.94));
}

.site-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% 45%;
  height: 320px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.16), transparent 62%);
  pointer-events: none;
}

.site-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.hero-eyebrow {
  width: max-content;
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.12);
}

.hero-title {
  margin: 0;
  font-size: clamp(1.65rem, 2.6vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-standfirst {
  margin: 0;
  color: #d7e7fb;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 72ch;
}

.hero-badge-row,
.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-primary-btn {
  width: auto;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.32);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.28), rgba(37, 99, 235, 0.22));
  color: #eff6ff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

.hero-stat-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hero-stat-card {
  min-height: 122px;
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(21, 31, 49, 0.9), rgba(10, 18, 31, 0.86));
  display: grid;
  align-content: start;
  gap: 8px;
  box-shadow: 0 18px 34px rgba(2, 6, 23, 0.26);
}

.hero-stat-card.accent {
  border-color: rgba(96, 165, 250, 0.22);
  background: linear-gradient(180deg, rgba(29, 78, 216, 0.28), rgba(12, 20, 34, 0.86));
}

.hero-stat-card .label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-stat-card strong {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.hero-stat-card .sub {
  color: #c8d7ea;
  font-size: 0.86rem;
  line-height: 1.45;
}

.pathway-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.pathway-card {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 14px;
  background: linear-gradient(180deg, rgba(18, 28, 45, 0.82), rgba(9, 16, 28, 0.92));
  display: grid;
  gap: 10px;
}

.pathway-kicker {
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.74rem;
}

.pathway-card p {
  margin: 0;
  color: #d4e0ef;
  line-height: 1.55;
}

.pathway-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.release-studio-panel {
  border-color: rgba(96, 165, 250, 0.18);
}

.release-studio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.release-card {
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 15px;
  background: linear-gradient(180deg, rgba(13, 20, 34, 0.82), rgba(9, 15, 26, 0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.release-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.release-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.release-stack {
  display: grid;
  gap: 10px;
}

.release-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.release-meta-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.release-note {
  border-radius: 14px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.12);
  padding: 12px 13px;
  line-height: 1.55;
  color: #dbeafe;
}

.release-list {
  display: grid;
  gap: 8px;
}

.release-list-item {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  padding: 10px 11px;
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #d8e5f4;
}

.compact-snippet pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 14px;
  padding: 12px;
  background: rgba(7, 13, 24, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #dbeafe;
}

@media (max-width: 1180px) {
  .site-hero-grid,
  .release-studio-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hero-stat-grid {
    grid-template-columns: 1fr;
  }
}

/* v31 front door + explainers + faq */
.site-layers-panel,
.method-explainers-panel,
.faq-panel {
  border-color: rgba(125, 211, 252, 0.14);
}

.site-layers-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.site-layer-card,
.method-explainer-card,
.release-studio-card,
.faq-item {
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(12, 19, 32, 0.9), rgba(9, 14, 24, 0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 10px 30px rgba(2, 6, 23, 0.2);
}

.site-layer-card {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.site-layer-card.explore {
  border-color: rgba(96, 165, 250, 0.24);
}

.site-layer-card.understand {
  border-color: rgba(45, 212, 191, 0.24);
}

.site-layer-card.analyze {
  border-color: rgba(244, 114, 182, 0.2);
}

.site-layer-eyebrow {
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.site-layer-card h3 {
  margin: 0;
  font-size: 1.22rem;
}

.site-layer-card p {
  margin: 0;
  color: #d8e5f4;
  line-height: 1.6;
}

.site-layer-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.site-layer-btn {
  padding-inline: 14px;
}

.method-explainers-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.method-explainer-card {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.method-explainer-card.scope { border-color: rgba(96, 165, 250, 0.18); }
.method-explainer-card.nodata { border-color: rgba(244, 114, 182, 0.18); }
.method-explainer-card.boundary { border-color: rgba(45, 212, 191, 0.18); }
.method-explainer-card.evidence { border-color: rgba(250, 204, 21, 0.16); }

.method-explainer-card p {
  margin: 0;
  line-height: 1.58;
  color: #d7e3f3;
}

.release-studio-card {
  padding: 16px;
}

.faq-accordion {
  display: grid;
  gap: 10px;
}

.faq-item {
  padding: 0;
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-weight: 700;
}

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

.faq-answer {
  padding: 0 18px 18px;
  color: #d8e5f4;
  line-height: 1.62;
}

@media (max-width: 1180px) {
  .site-layers-grid,
  .method-explainers-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .site-layers-grid,
  .method-explainers-grid,
  .release-studio-grid {
    grid-template-columns: 1fr;
  }
}


/* v32 memorable signature layer */
.signature-panel {
  overflow: hidden;
  position: relative;
  border-color: rgba(244, 114, 182, 0.14);
  background:
    radial-gradient(circle at 8% 20%, rgba(34, 197, 94, 0.12), transparent 20%),
    radial-gradient(circle at 85% 15%, rgba(244, 114, 182, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(14, 20, 34, 0.96), rgba(8, 13, 24, 0.98));
}

.signature-panel::after {
  content: "";
  position: absolute;
  inset: auto -5% -52% 35%;
  height: 320px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.12), transparent 62%);
  pointer-events: none;
}

.signature-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: start;
}

.signature-copy {
  display: grid;
  gap: 14px;
}

.signature-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 2.15rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.signature-standfirst {
  margin: 0;
  color: #d7e7fb;
  line-height: 1.65;
  max-width: 70ch;
}

.signature-statement {
  display: grid;
  gap: 12px;
}

.signature-statement-quote {
  border-radius: 20px;
  border: 1px solid rgba(96, 165, 250, 0.16);
  background: linear-gradient(180deg, rgba(22, 31, 49, 0.84), rgba(10, 18, 30, 0.94));
  padding: 18px 18px 18px 20px;
  font-size: 1.05rem;
  line-height: 1.68;
  color: #eef6ff;
  box-shadow: inset 4px 0 0 rgba(96, 165, 250, 0.5);
}

.signature-statement-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.signature-proof-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.signature-proof-card {
  position: relative;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(14, 22, 38, 0.92), rgba(8, 13, 24, 0.98));
  padding: 16px;
  display: grid;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 14px 34px rgba(2, 6, 23, 0.24);
}

.signature-proof-card.same_engine { border-color: rgba(96, 165, 250, 0.24); }
.signature-proof-card.declared_limits { border-color: rgba(244, 114, 182, 0.22); }
.signature-proof-card.release_backed { border-color: rgba(45, 212, 191, 0.22); }
.signature-proof-card.boundary_aware { border-color: rgba(250, 204, 21, 0.2); }

.signature-proof-eyebrow {
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.signature-proof-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.signature-proof-card p {
  margin: 0;
  color: #d8e5f4;
  line-height: 1.58;
}

.signature-proof-detail {
  margin-top: 4px;
  border-radius: 14px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.12);
  padding: 10px 11px;
  color: #dbeafe;
  line-height: 1.5;
}

.signature-marquee {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.signature-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(8, 15, 27, 0.78);
  color: #dce9f8;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

@media (max-width: 1180px) {
  .signature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .signature-proof-grid {
    grid-template-columns: 1fr;
  }
}


/* v33 dashboard redesign */
:root {
  --bg: #eef3f8;
  --bg-2: #f6f9fc;
  --panel: #ffffff;
  --panel-2: #f8fbff;
  --line: #d5dde8;
  --line-soft: rgba(15, 23, 42, 0.08);
  --text: #112033;
  --muted: #5f7189;
  --accent: #184e88;
  --accent-2: #1f7a53;
  --warning: #c98616;
  --danger: #c2410c;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}
html { scroll-padding-top: 88px; }
body {
  background: linear-gradient(180deg, #f7fafc 0%, #eef3f8 100%);
  color: var(--text);
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); }
.app-shell {
  grid-template-columns: 330px minmax(0, 1fr);
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 76px);
}
.sidebar {
  background: transparent;
  border-right: 1px solid var(--line-soft);
  padding: 20px 20px 28px;
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
}
.main-content {
  padding: 22px 26px 48px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand {
  margin-bottom: 14px;
  padding: 4px 2px 8px;
}
.brand h1 {
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand p, .panel-subtitle, .helper-text, label { color: var(--muted); }
.eyebrow {
  background: #e8f0fb;
  color: var(--accent);
  border: 1px solid rgba(24, 78, 136, 0.08);
}
.panel, .overview-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
input, select, button, textarea {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}
button {
  background: #fff;
  font-weight: 600;
}
button:hover { border-color: var(--accent); }
.ghost-btn {
  background: #f8fbff;
  color: var(--text);
}
.small-btn { border-radius: 999px; }
.toolbar.panel.compact {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin-bottom: -4px;
}
.pill {
  background: #edf4fb;
  color: #24486f;
  border-color: rgba(36,72,111,0.1);
}
.pill.muted {
  background: #f4f6f9;
  color: var(--muted);
}
.jump-bar,
.site-hero,
.signature-panel,
.site-layers-panel,
.method-explainers-panel,
.pathway-strip,
.quickstart-strip,
.question-workbench-panel,
.reading-guide-panel {
  display: none !important;
}
.dashboard-intro-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
}
.dashboard-intro-copy h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.dashboard-intro-text {
  max-width: 860px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
}
.dashboard-intro-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: #35516f;
  font-size: 0.88rem;
}
.dashboard-section-tabs {
  display: flex;
  gap: 10px;
  padding: 8px;
  position: sticky;
  top: 84px;
  z-index: 25;
}
.dashboard-tab {
  width: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
}
.dashboard-tab.is-active {
  background: #ecf3fb;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(24,78,136,0.08);
}
.hidden-by-view { display: none !important; }
.overview-grid { order: 2; margin-top: 0; }
.map-and-detail { order: 3; grid-template-columns: 1fr; align-items: start; }
.map-panel, .detail-panel { min-height: 0; }
#map-wrapper {
  min-height: 600px;
  border-radius: 12px;
  background: #f7fafc;
  border: 1px solid var(--line);
}
#map-svg { height: min(72vh, 760px); }
#legend {
  margin-left: auto;
  gap: 8px;
}
.comparison-and-table,
.analysis-grid,
.insights-grid,
.research-grid,
.advanced-grid {
  display: grid;
  gap: 16px;
}
.comparison-and-table { grid-template-columns: 1fr; }
.analysis-grid,
.insights-grid,
.research-grid,
.advanced-grid { grid-template-columns: 1fr 1fr; }
.table-wrap {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
#results-table th {
  background: #f8fbff;
  color: #35516f;
}
.warning-strip {
  background: #fff9ed;
  color: #9a6700;
  border-color: rgba(201, 134, 22, 0.25);
}
.tooltip {
  background: rgba(255,255,255,0.98);
  color: var(--text);
  border-color: var(--line);
  box-shadow: 0 18px 40px rgba(15,23,42,0.15);
}
.selection-dock {
  background: rgba(255,255,255,0.95);
  border-top: 1px solid var(--line-soft);
  box-shadow: 0 -10px 30px rgba(16,24,40,0.08);
}
.loading-card,
.command-dialog,
.onboarding-dialog {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-soft);
  box-shadow: 0 20px 50px rgba(16,24,40,0.18);
}
.saved-views-panel,
.recent-panel,
.status-panel,
.external-panel,
.methodology-panel:first-of-type {
  display: none;
}
#active-filter-chips { order: 1; }
#dashboard-intro { order: 0; }
.dashboard-section-tabs { order: 1; }
#warning-strip { order: 2; }
.section-view { order: 3; }
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .dashboard-section-tabs { top: 72px; overflow-x: auto; }
  .analysis-grid,
  .insights-grid,
  .research-grid,
  .advanced-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .site-header-inner,
  .main-content,
  .sidebar { padding-left: 16px; padding-right: 16px; }
  .site-header-inner { align-items: flex-start; }
  .dashboard-intro-copy h1 { font-size: 1.7rem; }
  .two-col, .button-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  #map-wrapper { min-height: 420px; }
  #map-svg { height: 58vh; }
}


/* v34 dashboard redesign: lighter, cleaner, closer to a public data explorer */
:root {
  --bg: #f3f5f7;
  --bg-2: #edf1f5;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #cfd8e3;
  --line-soft: rgba(15, 23, 42, 0.09);
  --text: #13243d;
  --muted: #53657f;
  --accent: #2f5f8f;
  --accent-2: #2b6cb0;
  --warning: #c58916;
  --danger: #c0392b;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
html { background: var(--bg); }
body { background: var(--bg); color: var(--text); }
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,0.96); border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line-soft); backdrop-filter: blur(8px); }
.site-header-inner { max-width: 1280px; margin: 0 auto; padding: 0 28px; min-height: 66px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.site-brand { font-size: 1.02rem; font-weight: 800; letter-spacing: 0.01em; color: #10233c; text-decoration: none; }
.site-nav { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.site-nav a { color:#1f3552; text-decoration:none; font-weight:500; padding:12px 16px; border-radius:10px 10px 0 0; border:1px solid transparent; border-bottom:2px solid transparent; }
.site-nav a:hover, .site-nav a:focus-visible { background:#f7fafc; border-color: var(--line-soft); border-bottom-color: var(--accent); }
.app-shell { max-width:1280px; margin:0 auto; padding:28px 28px 48px; display:grid; grid-template-columns:300px minmax(0,1fr); gap:26px; min-height:auto; }
.sidebar { background:transparent; border-right:none; padding:0; overflow:visible; position:sticky; top:92px; align-self:start; max-height:calc(100vh - 110px); }
.main-content { padding:0; overflow:visible; }
.brand { margin-bottom:18px; padding:0 4px; }
.eyebrow { background:#eef4fb; color:var(--accent); border:1px solid rgba(47,95,143,0.14); }
.brand h1 { font-size:1.85rem; line-height:1.08; letter-spacing:-0.02em; color:#10233c; }
.brand p, .panel-subtitle, label, .helper-text, .shortcuts-hint, .methodology-list, .dashboard-intro-text, .site-footer p, .site-footer li, .site-footer a { color: var(--muted); }
.panel { background:var(--panel); border:1px solid var(--line-soft); border-radius:18px; padding:18px; box-shadow:var(--shadow); }
.panel.compact { padding:14px 18px; }
.panel h2, .main-content h1, .main-content h2, .main-content h3 { color:#13243d; }
input, select, button, textarea { background:#fff; color:var(--text); border:1px solid var(--line); border-radius:10px; padding:10px 12px; box-shadow:none; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline:2px solid rgba(47,95,143,0.16); outline-offset:1px; border-color:var(--accent); }
button { font-weight:600; }
button:hover { border-color:var(--accent); background:#f7fbff; transform:none; }
.ghost-btn { background:#f6f9fc; }
.pill, .meta-pill { background:#f6f9fc; color:#27476d; border:1px solid var(--line-soft); }
.pill.muted { color: var(--muted); }
.toolbar { background:transparent; border:none; box-shadow:none; padding:0; margin-bottom:8px; }
.filter-chip-bar, .jump-bar, .site-hero, .signature-panel, .site-layers-panel, .method-explainers-panel, .pathway-strip, .quickstart-strip, .question-workbench-panel, .reading-guide-panel, .insight-strip, .modes-panel, .audience-panel, .preferences-panel, .saved-views-panel, .recent-panel, .external-panel, .methodology-panel.section-view-method, .quick-actions-panel, .local-bundle-panel, .status-panel, .warning-strip, #overview-cards { display:none !important; }
.dashboard-intro-strip { background:transparent; border:none; box-shadow:none; padding:8px 0 8px; margin-bottom:10px; }
.dashboard-intro-strip h1 { margin:0 0 8px; font-size:2.65rem; letter-spacing:-0.03em; line-height:1.05; }
.dashboard-intro-text { margin:0; font-size:1.05rem; line-height:1.65; max-width:980px; }
.dashboard-intro-meta { margin-top:18px; display:flex; gap:10px; flex-wrap:wrap; }
.meta-pill { padding:8px 12px; border-radius:999px; font-size:0.9rem; }
.dashboard-section-tabs { padding:0; border-radius:14px; overflow:hidden; background:#fff; }
.dashboard-section-tabs .dashboard-tab { border:none; border-right:1px solid var(--line-soft); background:#fff; color:#1d3557; padding:15px 18px; font-weight:500; }
.dashboard-section-tabs .dashboard-tab:last-child { border-right:none; }
.dashboard-section-tabs .dashboard-tab.is-active { background:#173455; color:#fff; }
.control-panel .panel-subtitle { margin-top:4px; }
.two-col-main { margin-bottom:2px; }
.control-panel .two-col-main.single-control-row { grid-template-columns:minmax(0,1fr) !important; }
.advanced-sidebar-details { margin-top:14px; border-top:1px solid var(--line-soft); padding-top:14px; }
.advanced-sidebar-details summary { cursor:pointer; color:#1f3552; font-weight:600; margin-bottom:12px; }
.advanced-sidebar-grid { margin-top:14px; }
.compact-time-nav { background:#f8fafc; border:1px solid var(--line-soft); border-radius:14px; padding:12px; margin-bottom:8px; }
.time-nav-actions { gap:8px; flex-wrap:wrap; }
.time-nav-actions .small-btn { width:auto; }
.map-and-detail { display:grid; grid-template-columns:minmax(0,1.45fr) minmax(320px,0.9fr); gap:18px; align-items:start; }
.map-panel .panel-header, .detail-panel .panel-header { align-items:flex-start; }
.map-panel .panel-header h2, .detail-panel .panel-header h2 { font-size:1.1rem; }
.map-header-actions { gap:10px; align-items:flex-start; }
#legend { min-width:160px; }
#map-wrapper { min-height:620px; background:#f7f9fc; border:1px solid var(--line-soft); border-radius:16px; overflow:hidden; }
#map-svg { width:100%; height:100%; background:#f7f9fc; }
.overview-card, .release-studio-card, .catalog-card, .dataset-card, .fact-card, .story-card, .insight-card, .metric-card, .comparison-card { background:#fff; border:1px solid var(--line-soft); border-radius:16px; box-shadow:none; }
.section-view-method { margin-top:18px; }
#usage-notes-panel, #release-studio-panel, .audit-panel, .faq-panel { margin-top:18px; }
.hidden-by-view { display:none !important; }
.site-footer { background:#12243d; color:#dce7f5; margin-top:24px; }
.site-footer-inner { max-width:1280px; margin:0 auto; padding:34px 28px 38px; display:grid; gap:28px; grid-template-columns:1.3fr 1fr 1fr; }
.site-footer h3 { margin:0 0 12px; font-size:1rem; color:#ffffff; }
.site-footer p, .site-footer ul { margin:0; line-height:1.6; font-size:0.95rem; }
.site-footer ul { padding-left:18px; }
.site-footer a { color:#dce7f5; }
.command-dialog, .onboarding-dialog { background:#fff; color:var(--text); border:1px solid var(--line-soft); box-shadow:0 24px 56px rgba(15,23,42,0.18); }
.loading-card, .toast { background:#fff; color:var(--text); border:1px solid var(--line-soft); }
@media (max-width:1140px){ .app-shell{grid-template-columns:1fr;} .sidebar{position:static;max-height:none;} .map-and-detail{grid-template-columns:1fr;} .site-footer-inner{grid-template-columns:1fr;} }
@media (max-width:860px){ .site-header-inner, .app-shell, .site-footer-inner { padding-left:16px; padding-right:16px; } .dashboard-intro-strip h1{font-size:2rem;} .two-col, .button-grid{grid-template-columns:1fr;} .site-nav a{padding:10px 12px;} }

/* v35 professional polish: editorial structure, refined borders, quieter graphics */
:root {
  --bg: #f2f4f7;
  --bg-2: #eef2f6;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #c4d0dd;
  --line-soft: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(19, 36, 61, 0.14);
  --accent: #2b5a87;
  --accent-deep: #16324f;
  --accent-soft: rgba(43, 90, 135, 0.12);
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 4px 18px rgba(15, 23, 42, 0.04);
}
html, body { min-height: 100%; }
body {
  background:
    radial-gradient(circle at top left, rgba(43,90,135,0.08), transparent 26%),
    radial-gradient(circle at top right, rgba(15,23,42,0.03), transparent 26%),
    linear-gradient(180deg, #f7f8fa 0%, #f2f4f7 18%, #f2f4f7 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.24) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.24) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.7), transparent 72%);
}
.site-header {
  background: rgba(255,255,255,0.98);
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid rgba(19,36,61,0.08);
  box-shadow: 0 6px 24px rgba(15,23,42,0.04);
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(43,90,135,0.22), transparent);
}
.site-header-inner { min-height: 72px; }
.site-brand {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.98rem;
}
.site-nav { gap: 2px; }
.site-nav a {
  position: relative;
  padding: 22px 16px 18px;
  border-radius: 0;
  border: none;
  font-weight: 600;
  color: #213956;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}
.site-nav a:first-child,
.site-nav a:hover,
.site-nav a:focus-visible {
  background: transparent;
  color: var(--accent-deep);
}
.site-nav a:first-child::after,
.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  background: var(--accent);
}
.app-shell { gap: 30px; padding-top: 30px; }
.sidebar { top: 102px; }
.brand {
  position: relative;
  margin-bottom: 24px;
  padding: 10px 6px 0 0;
}
.brand::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 86px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-deep), rgba(43,90,135,0.18));
}
.brand h1 { font-size: 1.96rem; margin-bottom: 10px; }
.brand p { max-width: 32ch; line-height: 1.65; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(19,36,61,0.09);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}
.panel::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), rgba(43,90,135,0.1));
  border-radius: 0 0 999px 999px;
  pointer-events: none;
}
.panel.compact::before { left: 18px; right: 18px; }
.panel:hover { box-shadow: var(--shadow); }
.panel-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(19,36,61,0.08);
}
.panel-header.tight { margin-bottom: 14px; padding-bottom: 10px; }
.panel h2 {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.panel h3 {
  letter-spacing: -0.01em;
}
.panel-subtitle {
  max-width: 58ch;
  line-height: 1.55;
  font-size: 0.94rem;
}
input, select, button, textarea {
  border-color: rgba(19,36,61,0.14);
  border-radius: 12px;
  min-height: 44px;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
input, select, textarea { box-shadow: inset 0 1px 0 rgba(255,255,255,0.75); }
button {
  font-weight: 700;
  letter-spacing: 0.01em;
}
button:hover { background: #f8fbff; box-shadow: inset 0 0 0 1px rgba(43,90,135,0.08); }
.ghost-btn {
  background: linear-gradient(180deg, #fbfcfe, #f4f7fb);
  border-color: rgba(19,36,61,0.11);
}
#reset-btn, .small-btn { min-height: 38px; }
label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dashboard-intro-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(280px, 0.72fr);
  gap: 24px;
  align-items: stretch;
  padding: 0 0 8px;
  background: transparent;
  border: none;
  box-shadow: none;
}
.dashboard-intro-strip::before { display:none; }
.dashboard-intro-copy {
  padding: 6px 0 18px;
  border-bottom: 1px solid rgba(19,36,61,0.10);
}
.dashboard-kicker {
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.dashboard-intro-strip h1 {
  margin: 0 0 10px;
  font-size: 3rem;
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.dashboard-intro-text {
  max-width: 62ch;
  font-size: 1.04rem;
  line-height: 1.72;
}
.dashboard-intro-meta { gap: 8px; }
.meta-pill {
  background: #fff;
  border: 1px solid rgba(19,36,61,0.10);
  color: #26486d;
  font-weight: 600;
}
.dashboard-intro-aside {
  display: grid;
  gap: 12px;
  align-content: start;
}
.intro-note-card {
  position: relative;
  padding: 16px 16px 16px 18px;
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  border: 1px solid rgba(19,36,61,0.10);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}
.intro-note-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-deep), rgba(43,90,135,0.22));
}
.intro-note-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.intro-note-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
  line-height: 1.3;
  color: #10233c;
}
.intro-note-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}
.dashboard-section-tabs {
  position: sticky;
  top: 72px;
  z-index: 12;
  padding: 4px;
  margin-bottom: 18px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(19,36,61,0.09);
  box-shadow: 0 10px 28px rgba(15,23,42,0.04);
  backdrop-filter: blur(10px);
}
.dashboard-section-tabs::before { display:none; }
.dashboard-section-tabs .dashboard-tab {
  position: relative;
  min-height: 52px;
  border-radius: 12px;
  border-right: none;
  font-size: 0.95rem;
  font-weight: 700;
}
.dashboard-section-tabs .dashboard-tab::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 10px;
  height: 2px;
  background: transparent;
}
.dashboard-section-tabs .dashboard-tab:hover { background: #f7fafe; }
.dashboard-section-tabs .dashboard-tab.is-active {
  background: linear-gradient(180deg, #173455, #132b47);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.dashboard-section-tabs .dashboard-tab.is-active::after { background: rgba(255,255,255,0.65); }
.control-panel,
.map-panel,
.detail-panel,
.comparison-panel,
.table-panel,
.heatmap-panel,
.rankings-panel,
.audit-panel,
#usage-notes-panel,
#release-studio-panel,
.faq-panel {
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}
.control-panel .two-col-main,
.control-panel .advanced-sidebar-grid,
.compare-map-grid,
.table-wrap,
.annotation-box,
.story-box,
.report-box,
.mini-map-box,
.swipe-compare-box,
.coverage-audit,
.summary-grid,
.profile-grid,
.fact-grid {
  position: relative;
}
.control-panel .two-col-main::before,
.annotation-box::before,
.story-box::before,
.report-box::before,
.swipe-compare-box::before,
.table-wrap::before,
.mini-map-box::before,
.coverage-audit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  pointer-events: none;
}
.compact-time-nav,
.annotation-box,
.story-box,
.report-box,
.mini-map-box,
.swipe-compare-box,
.table-wrap,
.compare-map-toolbar,
.detail-actions-row,
.compare-chip-list,
#municipality-profile,
#municipality-trust-box,
#single-election-results,
#lineage-panel {
  background: #f9fbfd;
  border: 1px solid rgba(19,36,61,0.08);
  border-radius: 16px;
}
.detail-actions-row,
.compare-chip-list,
#single-election-results,
#lineage-panel { padding: 14px; }
.map-and-detail { gap: 20px; }
.map-panel .panel-header,
.detail-panel .panel-header { align-items: flex-start; }
.map-header-actions { gap: 12px; }
#legend {
  padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff, #f7fafd);
  border: 1px solid rgba(19,36,61,0.08);
  border-radius: 14px;
}
#map-wrapper {
  position: relative;
  min-height: 640px;
  background: linear-gradient(180deg, #fbfcfe, #f5f8fb);
  border: 1px solid rgba(19,36,61,0.10);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65);
}
#map-wrapper::before {
  content: "Livello comunale";
  position: absolute;
  left: 16px;
  top: 14px;
  z-index: 4;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(19,36,61,0.08);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #29486d;
}
#map-wrapper::after {
  content: "Seleziona un comune per aprire la scheda";
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 4;
  font-size: 0.76rem;
  color: #607188;
  background: rgba(255,255,255,0.84);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(19,36,61,0.06);
}
#map-svg {
  background:
    radial-gradient(circle at 20% 20%, rgba(43,90,135,0.04), transparent 18%),
    linear-gradient(180deg, rgba(255,255,255,0.0), rgba(43,90,135,0.02));
}
.tooltip {
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(19,36,61,0.10);
  box-shadow: 0 18px 36px rgba(15,23,42,0.14);
  color: var(--text);
}
.table-wrap {
  padding: 8px 10px;
  background: linear-gradient(180deg, #fbfcfe, #f7fafd);
}
#results-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f7fa;
  color: #203854;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid rgba(19,36,61,0.10);
}
#results-table td { border-bottom: 1px solid rgba(19,36,61,0.06); }
#results-table tbody tr:hover { background: #f8fbff; }
svg[id$="chart"],
#compare-map-a,
#compare-map-b,
#swipe-map-svg,
#heatmap-chart,
#timeline-chart,
#dominance-strip,
#context-compare-chart {
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  border: 1px solid rgba(19,36,61,0.08);
  border-radius: 16px;
}
.analysis-tab-row,
.compare-map-toolbar,
.trajectory-toolbar,
.table-pager,
.change-controls,
.scatter-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.site-footer {
  position: relative;
  margin-top: 34px;
  border-top: 4px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, #11213a, #0d1c31);
}
.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
}
.site-footer-inner { padding-top: 38px; }
.site-footer h3 {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.site-footer ul li + li { margin-top: 8px; }
@media (max-width: 1140px) {
  .dashboard-intro-strip { grid-template-columns: 1fr; }
  .dashboard-intro-copy { padding-bottom: 14px; }
  .dashboard-intro-aside { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  body::before { display: none; }
  .site-header-inner { min-height: 64px; }
  .site-nav a { padding-top: 16px; padding-bottom: 14px; }
  .dashboard-intro-strip { gap: 14px; }
  .dashboard-intro-strip h1 { font-size: 2.3rem; }
  .dashboard-intro-aside { grid-template-columns: 1fr; }
  .dashboard-section-tabs { top: 64px; }
  #map-wrapper { min-height: 460px; }
  #map-wrapper::after { display: none; }
}

/* v36 professional reset: clearer public platform, closer to GERDA structure */
:root {
  --bg: #f4f6f8;
  --bg-2: #eef2f5;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --line: #d3dbe4;
  --line-soft: rgba(30, 41, 59, 0.10);
  --text: #182433;
  --muted: #5a6778;
  --accent: #2c5f8a;
  --accent-deep: #213d5a;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 2px 10px rgba(15, 23, 42, 0.04);
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Aptos, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body::before,
.site-header::after,
.panel::before {
  display: none !important;
}

h1,
h2,
h3,
h4,
.site-brand-mark {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.98);
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.site-header-inner,
.app-shell,
.site-footer-inner {
  max-width: 1120px;
}

.site-header-inner {
  min-height: 68px;
  padding: 0 24px;
  gap: 20px;
}

.site-brand {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  text-decoration: none;
}

.site-brand-mark {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-deep);
}

.site-brand-subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.site-nav {
  gap: 2px;
  margin-left: auto;
}

.site-nav a {
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  color: #314760;
  font-size: 0.95rem;
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: #f3f6f9;
  color: var(--accent);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  margin: 0 auto;
  padding: 26px 24px 48px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  padding: 0;
  background: transparent;
  border: 0;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0;
  overflow: visible;
}

.brand {
  margin-bottom: 18px;
  padding: 0;
}

.brand h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.05;
  color: var(--accent-deep);
}

.brand p {
  margin: 0 0 14px;
  max-width: 28ch;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-facts {
  display: grid;
  gap: 10px;
}

.brand-fact {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.brand-fact-label {
  display: block;
  margin-bottom: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-fact strong {
  font-size: 0.96rem;
  color: var(--text);
}

.panel {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow: visible;
}

.panel:hover {
  box-shadow: var(--shadow-soft);
}

.panel.compact {
  padding: 14px 16px;
}

.panel-header {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1f4;
}

.panel-header.tight {
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.panel h2 {
  color: var(--accent-deep);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
}

.panel-subtitle,
.helper-text,
.brand p,
.dashboard-intro-text,
.intro-note-card p,
.site-footer p,
.site-footer li,
.site-footer a {
  color: var(--muted);
}

label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

input,
select,
button,
textarea {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(44, 95, 138, 0.12);
}

button {
  font-weight: 600;
  letter-spacing: 0;
}

button:hover {
  background: #f7f9fb;
  border-color: #bcc9d6;
}

.ghost-btn {
  background: #f7f9fb;
}

.toolbar {
  order: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.toolbar-left,
.toolbar-right {
  gap: 8px;
  flex-wrap: wrap;
}

.pill,
.meta-pill {
  background: #f5f8fb;
  border: 1px solid #e1e8ef;
  color: #355273;
  border-radius: 999px;
  padding: 6px 10px;
}

.pill.muted {
  color: var(--muted);
}

.filter-chip-bar,
.jump-bar,
.site-hero,
.signature-panel,
.site-layers-panel,
.method-explainers-panel,
.pathway-strip,
.quickstart-strip,
.question-workbench-panel,
.reading-guide-panel,
.insight-strip {
  display: none !important;
}

.quick-actions-panel,
.modes-panel,
.audience-panel,
.preferences-panel,
.saved-views-panel,
.recent-panel,
.status-panel,
.local-bundle-panel,
.external-panel {
  display: block !important;
}

#dashboard-intro {
  order: 0;
}

.dashboard-intro-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 22px;
  padding: 0 0 18px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.dashboard-intro-copy {
  padding: 4px 0 18px;
  border-bottom: 1px solid #e5eaef;
}

.dashboard-kicker {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-intro-strip h1 {
  margin: 0 0 10px;
  font-size: 2.8rem;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--accent-deep);
}

.dashboard-intro-text {
  margin: 0;
  max-width: 58ch;
  font-size: 1.03rem;
  line-height: 1.7;
}

.dashboard-intro-meta {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-intro-aside {
  display: grid;
  gap: 12px;
  align-content: start;
}

.intro-note-card {
  padding: 14px 14px 14px 16px;
  background: #fff;
  border: 1px solid #e5eaef;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  box-shadow: none;
}

.intro-note-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-note-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 1rem;
}

.dashboard-section-tabs {
  order: 1;
  position: static;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.dashboard-section-tabs .dashboard-tab {
  min-height: 44px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #41566f;
  font-weight: 600;
}

.dashboard-section-tabs .dashboard-tab::after {
  display: none;
}

.dashboard-section-tabs .dashboard-tab:hover {
  background: #f4f7fa;
}

.dashboard-section-tabs .dashboard-tab.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

#overview-cards {
  order: 4;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.overview-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}

.overview-card .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.overview-card .value {
  margin-top: 8px;
  color: var(--accent-deep);
  font-size: 1.6rem;
}

.overview-card .sub {
  margin-top: 6px;
  color: var(--muted);
}

.map-and-detail {
  order: 5;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.86fr);
  gap: 18px;
}

.comparison-and-table,
.analysis-grid,
.insights-grid,
.research-grid,
.advanced-grid,
.transitions-panel {
  order: 6;
}

.section-view-method {
  order: 7;
}

.map-panel,
.detail-panel,
.comparison-panel,
.table-panel,
.rankings-panel,
.multi-compare-panel,
.province-panel,
.heatmap-panel,
.similar-panel,
.province-trends-panel,
.pattern-panel,
.group-compare-panel,
.transitions-panel,
.data-package-panel,
#usage-notes-panel,
#release-studio-panel,
.faq-panel,
.audit-panel,
.briefing-panel,
#evidence-panel {
  background: #fff;
}

#map-wrapper {
  min-height: 640px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfdff 0%, #f6f8fb 100%);
  overflow: hidden;
}

#map-wrapper::before {
  content: "Livello comunale";
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dfe7ee;
  color: #48627f;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#map-wrapper::after {
  content: "Seleziona un comune per aprire la scheda";
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dfe7ee;
  color: var(--muted);
  font-size: 0.75rem;
}

#map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(72vh, 760px);
  background: transparent;
  cursor: grab;
  touch-action: none;
}

#map-canvas:active {
  cursor: grabbing;
}

#map-svg.is-canvas-backed {
  display: none;
  pointer-events: none;
}

#map-svg {
  background: transparent;
}

#legend {
  min-width: 180px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.legend-stack {
  display: grid;
  gap: 8px;
}

.legend-heading {
  display: grid;
  gap: 3px;
}

.legend-rows {
  display: grid;
  gap: 8px;
}

.legend-item {
  justify-content: flex-start;
  width: 100%;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid #e4eaf0;
  color: var(--text);
}

.legend-item-block {
  align-items: flex-start;
}

.legend-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.map-toolbar-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-context-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.map-context-block {
  padding: 12px 14px;
  background: #f9fbfc;
  border: 1px solid #e5eaef;
  border-radius: 10px;
}

.map-context-label,
.detail-section-title {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-context-block strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-deep);
  font-size: 0.96rem;
}

.map-context-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.tooltip {
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  max-width: 340px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
}

.tooltip-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.tooltip-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tooltip-header strong {
  font-size: 1rem;
  color: var(--accent-deep);
}

.tooltip-badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f5f8fb;
  border: 1px solid #e1e8ef;
  color: #3d5877;
  font-size: 0.75rem;
  font-weight: 600;
}

.tooltip-meta,
.tooltip-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.tooltip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tooltip-grid div {
  padding: 8px 9px;
  background: #f8fafc;
  border: 1px solid #e6edf3;
  border-radius: 8px;
}

.tooltip-grid span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tooltip-grid strong {
  color: var(--text);
  font-size: 0.9rem;
}

.tooltip-note {
  padding: 10px 11px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  font-size: 0.84rem;
  line-height: 1.5;
}

.compact-time-nav,
.annotation-box,
.story-box,
.report-box,
.mini-map-box,
.swipe-compare-box,
.table-wrap,
#municipality-profile,
#municipality-trust-box,
#single-election-results,
#lineage-panel {
  background: #f9fbfc;
  border: 1px solid #e5eaef;
  border-radius: 10px;
}

.detail-summary-shell,
.detail-narrative-grid,
.detail-lineage-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-summary-shell,
.detail-lineage-grid {
  grid-template-columns: 1fr 1fr;
}

.detail-meta-block {
  margin-bottom: 12px;
  padding: 12px;
  background: #fcfdfe;
  border: 1px solid #e7edf3;
  border-radius: 10px;
}

.detail-meta-block:last-child {
  margin-bottom: 0;
}

.detail-chart-block {
  padding: 14px;
}

.chart-frame {
  margin-top: 10px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #e5eaef;
  border-radius: 10px;
}

.chart-frame svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-frame-sm {
  margin-top: 8px;
}

.detail-meta-block .detail-actions-row,
.detail-meta-block .compare-chip-list {
  margin-top: 10px;
}

.detail-inline-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.detail-inline-note strong {
  color: var(--accent-deep);
}

.detail-panel .trajectory-toolbar {
  margin-bottom: 0;
}

.table-wrap {
  padding: 8px 10px;
}

#results-table th {
  background: #f3f6f9;
  color: #344a63;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#results-table tbody tr:hover {
  background: #f6f9fc;
}

.sidebar-tools {
  margin-top: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.sidebar-tools > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  color: var(--accent-deep);
  font-size: 0.95rem;
  font-weight: 700;
}

.sidebar-tools > summary::-webkit-details-marker {
  display: none;
}

.sidebar-tools[open] > summary {
  border-bottom: 1px solid #edf1f4;
}

.sidebar-tools-copy {
  padding: 0 16px 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.sidebar-tools > section {
  margin: 12px 12px 0;
}

.sidebar-tools > section:last-of-type {
  margin-bottom: 12px;
}

.site-footer {
  margin-top: 32px;
  background: #fff;
  color: var(--text);
  border-top: 1px solid var(--line-soft);
}

.site-footer::before {
  display: none;
}

.site-footer-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 24px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.site-footer h3 {
  color: var(--accent-deep);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
}

.site-footer a {
  color: var(--accent);
}

.site-footer-copy {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 28px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(220, 231, 245, 0.72);
  font-size: 0.82rem;
}
.site-footer-copy p { margin: 0; }
@media (max-width: 860px) {
  .site-footer-copy { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 1140px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .map-and-detail,
  .site-footer-inner,
  .dashboard-intro-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .site-header-inner,
  .app-shell,
  .site-footer-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .site-header-inner {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-intro-strip h1 {
    font-size: 2.15rem;
  }

  #overview-cards {
    grid-template-columns: 1fr 1fr;
  }

  .map-context-strip,
  .detail-summary-shell,
  .detail-lineage-grid {
    grid-template-columns: 1fr;
  }

  .tooltip-grid {
    grid-template-columns: 1fr;
  }

  .two-col,
  .button-grid {
    grid-template-columns: 1fr;
  }

  #map-wrapper {
    min-height: 460px;
  }

  #map-wrapper::after {
    display: none;
  }
}

@media (max-width: 560px) {
  #overview-cards {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: flex-start;
  }
}

/* v36.1 public documentation pages */

.site-nav a.is-active {
  color: var(--accent-deep);
}

.site-doc-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  display: grid;
  gap: 24px;
}

.site-doc-hero {
  padding: 28px 30px 30px;
  background:
    linear-gradient(135deg, rgba(215, 227, 239, 0.52), rgba(249, 251, 252, 0.96)),
    #fff;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.site-doc-hero h1 {
  margin: 8px 0 12px;
  color: var(--accent-deep);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.site-doc-standfirst {
  max-width: 860px;
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.doc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.doc-section {
  padding: 26px 28px 28px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.doc-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.doc-section-head h2 {
  margin: 6px 0 0;
  color: var(--accent-deep);
  font-size: 1.52rem;
  letter-spacing: -0.03em;
}

.doc-section-copy {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.page-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid #dbe5ef;
  border-radius: 16px;
}

.stat-card-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat-card-value {
  color: var(--accent-deep);
  font-size: 1.52rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.stat-card-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.doc-card-grid {
  display: grid;
  gap: 16px;
}

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

.doc-card-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-card-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.doc-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fbfdff;
  border: 1px solid #e3ebf2;
  border-radius: 16px;
  min-width: 0;
}

.doc-card-wide {
  margin-top: 16px;
}

.doc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-card-head strong {
  color: var(--accent-deep);
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.doc-card p,
.doc-card li,
.doc-card span {
  min-width: 0;
}

.doc-meta-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.doc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef4fa;
  border: 1px solid #d7e2ec;
  color: #36506b;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc-pill.tone-good,
.tone-good .doc-pill,
.doc-pill.tone-good {
  background: #eefaf0;
  border-color: #cde9d2;
  color: #25603c;
}

.doc-pill.tone-muted,
.tone-muted .doc-pill,
.doc-pill.tone-muted {
  background: #f3f6f9;
  border-color: #dce5ec;
  color: #5a7085;
}

.tone-info {
  border-color: #d8e6f4;
  background: #f8fbfe;
}

.tone-warn {
  border-color: #f2d3ab;
  background: #fff9f1;
}

.tone-error {
  border-color: #f3c5c5;
  background: #fff6f6;
}

.doc-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.doc-list li + li {
  margin-top: 6px;
}

.doc-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.doc-table-wrap {
  overflow-x: auto;
  border: 1px solid #e3ebf2;
  border-radius: 16px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.doc-table thead th {
  padding: 14px 16px;
  background: #f4f8fb;
  border-bottom: 1px solid #dde7ef;
  color: #39536c;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

.doc-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f6;
  color: var(--text);
  line-height: 1.55;
  vertical-align: top;
}

.doc-table tbody tr:hover {
  background: #fbfdff;
}

.table-muted {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.doc-download-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: #edf4fb;
  border: 1px solid #d5e3ef;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.doc-download-link:hover {
  background: #e5eef8;
}

.doc-code {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: #0f1720;
  border: 1px solid #1d2833;
  border-radius: 14px;
  color: #e4edf5;
  font-size: 0.86rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.copy-btn {
  white-space: nowrap;
}

.doc-accordion {
  display: grid;
  gap: 12px;
}

.doc-accordion-item {
  border: 1px solid #e3ebf2;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.doc-accordion-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  color: var(--accent-deep);
  font-weight: 700;
}

.doc-accordion-item > summary::-webkit-details-marker {
  display: none;
}

.doc-accordion-item[open] > summary {
  border-bottom: 1px solid #edf2f6;
}

.doc-accordion-body {
  padding: 18px 20px 20px;
}

.contract-rules-head {
  margin-top: 10px;
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 16px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, #d5e1eb, #eef3f7);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 16px;
}

.timeline-marker {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  margin-top: 14px;
  border-radius: 999px;
  background: #fff;
  border: 5px solid #d4e2ef;
}

.timeline-card {
  padding: 18px 20px;
  background: #fbfdff;
  border: 1px solid #e3ebf2;
  border-radius: 16px;
}

.timeline-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.timeline-head strong {
  color: var(--accent-deep);
  font-size: 1rem;
}

.timeline-date {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.doc-alert {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #f3c5c5;
  background: #fff6f6;
  color: #8f2020;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .page-stat-grid,
  .doc-card-grid-4,
  .doc-card-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .site-doc-main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .doc-section,
  .site-doc-hero {
    padding-left: 20px;
    padding-right: 20px;
  }

  .doc-section-head,
  .doc-card-head,
  .doc-accordion-item > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-stat-grid,
  .doc-card-grid-2,
  .doc-card-grid-3,
  .doc-card-grid-4,
  .doc-split-grid {
    grid-template-columns: 1fr;
  }
}


body.basic-mode .sidebar-tools {
  display: none !important;
}

.doc-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* ============================================================ */
/* Dashboard-on-top layout (gerda parity)                       */
/*                                                              */
/* Rather than a 378-px left sidebar + right main area, the     */
/* controls flow as a compact horizontal strip above a          */
/* full-width map. HTML structure is unchanged so every JS      */
/* binding keeps working — only placement is reshaped via grid. */
/* ============================================================ */

@media (min-width: 960px) {
  body[data-site-page="dashboard"] .app-shell {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    padding-top: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: none !important;
  }

  body[data-site-page="dashboard"] .sidebar {
    position: sticky !important;
    top: 0 !important;
    z-index: 18 !important;
    padding: 12px 18px !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    min-width: 0 !important;
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--line-soft) !important;
    background: rgba(2, 6, 23, 0.94);
    backdrop-filter: saturate(1.1) blur(8px);
    overflow: visible !important;
    display: grid !important;
    grid-template-columns: minmax(260px, 22%) minmax(0, 1fr) !important;
    column-gap: 18px;
    row-gap: 10px;
    align-items: start;
  }

  /* Compact brand block on the left of the topbar. */
  body[data-site-page="dashboard"] .sidebar .brand {
    margin-bottom: 0;
    display: grid;
    gap: 4px;
  }
  body[data-site-page="dashboard"] .sidebar .brand h1 {
    font-size: 1.02rem;
    line-height: 1.1;
    margin: 0;
  }
  body[data-site-page="dashboard"] .sidebar .brand > p,
  body[data-site-page="dashboard"] .sidebar .brand .brand-facts {
    display: none;
  }
  body[data-site-page="dashboard"] .sidebar .brand .eyebrow {
    margin-bottom: 0;
    padding: 2px 8px;
    font-size: 0.68rem;
  }

  /* Control panel becomes a flat horizontal dashboard toolbar. */
  body[data-site-page="dashboard"] .sidebar .panel.control-panel {
    margin-bottom: 0;
    padding: 8px 12px;
    border-radius: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 8px 10px;
    align-items: end;
    box-shadow: none;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .panel-header {
    grid-column: 1 / -1;
    margin-bottom: 2px;
    align-items: center;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .panel-header h2 {
    font-size: 0.92rem;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .panel-subtitle {
    font-size: 0.76rem;
    margin: 2px 0 0;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .two-col,
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .two-col-main {
    display: contents;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel label {
    margin-bottom: 0;
    font-size: 0.8rem;
    gap: 2px;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel input,
  body[data-site-page="dashboard"] .sidebar .panel.control-panel select {
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .time-nav-box {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 4px 0 0;
    border-top: 1px solid var(--line-soft);
    margin-top: 4px;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .time-nav-actions {
    display: flex;
    gap: 6px;
    order: 1;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .time-nav-box label {
    margin: 0;
    order: 2;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.76rem;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .time-nav-box label > input[type="range"] {
    flex: 1;
    min-width: 140px;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel #slider-year-label {
    order: 3;
    margin: 0;
    white-space: nowrap;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .advanced-sidebar-details {
    grid-column: 1 / -1;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .advanced-sidebar-details > summary {
    font-size: 0.82rem;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .advanced-sidebar-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .advanced-sidebar-grid label {
    margin-bottom: 0;
  }

  /* Secondary panels (data source, tools, etc.) are pushed below the      */
  /* strip — they remain accessible as collapsed details but out of sight. */
  body[data-site-page="dashboard"] .sidebar > :not(.brand):not(.control-panel) {
    grid-column: 1 / -1;
  }
  body[data-site-page="dashboard"] .sidebar .data-source-panel,
  body[data-site-page="dashboard"] .sidebar .quick-actions-panel,
  body[data-site-page="dashboard"] .sidebar .sidebar-tools,
  body[data-site-page="dashboard"] .sidebar > .panel.compact {
    margin-bottom: 0;
  }

  /* Main content gets the full width under the strip. */
  body[data-site-page="dashboard"] .main-content {
    padding: 18px 22px 28px !important;
    max-width: none !important;
  }
  body[data-site-page="dashboard"] .map-and-detail {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    gap: 16px !important;
  }
  body[data-site-page="dashboard"] .map-panel {
    min-height: min(72vh, 780px);
  }
  body[data-site-page="dashboard"] #map-wrapper {
    aspect-ratio: auto;
    min-height: min(64vh, 680px);
  }
}

/* On narrow viewports, restore the stacked sidebar layout so nothing is */
/* clipped on phones/tablets. */
@media (max-width: 959.98px) {
  body[data-site-page="dashboard"] .app-shell {
    grid-template-columns: 1fr;
  }
  body[data-site-page="dashboard"] .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
  }
}

/* ============================================================ */
/* gerda-minimal dashboard (always-on, all UI levels)           */
/*                                                              */
/* Public-facing atlas should render as a map-first surface:    */
/* thin topbar, compact control strip, full map, compact        */
/* profile card. Every secondary panel, narrative section,      */
/* redundant header and explainer is hidden unconditionally.    */
/* ============================================================ */

/* (1) Global dashboard-page kill-list. These selectors apply   */
/* regardless of uiLevel so the public URL is always minimal.   */
body[data-site-page="dashboard"] .dashboard-intro-strip,
body[data-site-page="dashboard"] .dashboard-section-tabs,
body[data-site-page="dashboard"] .site-hero,
body[data-site-page="dashboard"] .signature-panel,
body[data-site-page="dashboard"] .site-layers-panel,
body[data-site-page="dashboard"] .method-explainers-panel,
body[data-site-page="dashboard"] .pathway-strip,
body[data-site-page="dashboard"] .quickstart-strip,
body[data-site-page="dashboard"] .question-workbench-panel,
body[data-site-page="dashboard"] .reading-guide-panel,
body[data-site-page="dashboard"] .briefing-panel,
body[data-site-page="dashboard"] .evidence-panel,
body[data-site-page="dashboard"] .faq-panel,
body[data-site-page="dashboard"] .release-studio-panel,
body[data-site-page="dashboard"] .audit-panel,
body[data-site-page="dashboard"] .transitions-panel,
body[data-site-page="dashboard"] .analysis-grid,
body[data-site-page="dashboard"] .insights-grid,
body[data-site-page="dashboard"] .research-grid,
body[data-site-page="dashboard"] .advanced-grid,
body[data-site-page="dashboard"] .compare-map-grid,
body[data-site-page="dashboard"] .swipe-compare-box,
body[data-site-page="dashboard"] .insight-strip,
body[data-site-page="dashboard"] .overview-grid,
body[data-site-page="dashboard"] #overview-cards,
body[data-site-page="dashboard"] .data-package-panel,
body[data-site-page="dashboard"] .usage-notes-panel,
body[data-site-page="dashboard"] #usage-notes-panel,
body[data-site-page="dashboard"] .methodology-panel,
body[data-site-page="dashboard"] .toolbar,
body[data-site-page="dashboard"] .jump-bar,
body[data-site-page="dashboard"] .filter-chip-bar,
body[data-site-page="dashboard"] .quick-actions-panel,
body[data-site-page="dashboard"] .modes-panel,
body[data-site-page="dashboard"] .audience-panel,
body[data-site-page="dashboard"] .preferences-panel,
body[data-site-page="dashboard"] .saved-views-panel,
body[data-site-page="dashboard"] .recent-panel,
body[data-site-page="dashboard"] .status-panel,
body[data-site-page="dashboard"] .local-bundle-panel,
body[data-site-page="dashboard"] .external-panel,
body[data-site-page="dashboard"] .sidebar-tools,
body[data-site-page="dashboard"] .map-context-strip,
body[data-site-page="dashboard"] .detail-narrative-grid,
body[data-site-page="dashboard"] .detail-lineage-grid,
body[data-site-page="dashboard"] .detail-chart-block {
  display: none !important;
}

/* (2) Hide the sidebar brand block on desktop: the site header  */
/* already shows the brand so this is pure duplication.          */
@media (min-width: 960px) {
  body[data-site-page="dashboard"] .sidebar .brand {
    display: none !important;
  }
}

/* (3) Hide secondary profile sections until a municipality is   */
/* selected. The JS reveals them via state changes; in the       */
/* default empty state only the main profile card is shown.     */
body[data-site-page="dashboard"] .detail-panel .detail-summary-shell > .detail-meta-block:nth-child(2),
body[data-site-page="dashboard"] .detail-panel .detail-meta-block:has(#trajectory-report),
body[data-site-page="dashboard"] .detail-panel .detail-meta-block:has(#compare-chip-list) {
  display: none !important;
}

/* (4) Header: shrink brand subtitle so the topbar does not      */
/* shout. The subtitle is still visible but in-line small.       */
/* Scoped to dashboard only — other pages keep their header.     */
body[data-site-page="dashboard"] .site-brand-subtitle {
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--muted) !important;
}
body[data-site-page="dashboard"] .site-brand-monogram {
  width: 32px !important;
  height: 32px !important;
  font-size: 0.82rem !important;
}
body[data-site-page="dashboard"] .site-header { padding: 6px 0 !important; }

/* (5) Slim the control panel. Keep Elezione, Mostra in mappa,  */
/* Partito and the timeline. Hide the rest (they are still      */
/* reachable via Controlli avanzati and URL hash state).        */
body[data-site-page="dashboard"] .sidebar .panel.control-panel label:has(#party-mode-select) {
  display: none !important;
}

/* (6) Compact reset button + panel header stay out of the way. */
body[data-site-page="dashboard"] .sidebar .panel.control-panel .panel-header .ghost-btn#reset-btn {
  align-self: center;
}

/* (7) Map-panel header stays hidden on desktop: the canvas is  */
/* clearly the map, the h2 label is noise. Keep the fullscreen  */
/* + reset buttons as a floating toolbar on the canvas edge.    */
@media (min-width: 960px) {
  body[data-site-page="dashboard"] .map-panel > .panel-header {
    display: none !important;
  }
  body[data-site-page="dashboard"] .map-header-actions {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 6;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(140%) blur(6px);
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid rgba(17, 33, 58, 0.08);
    display: none; /* re-enable if legend has content */
  }
  body[data-site-page="dashboard"] .map-panel { position: relative; }
}

/* (8) Detail panel: empty state is understated; no subtitle.   */
body[data-site-page="dashboard"] .detail-panel > .panel-header .panel-subtitle {
  display: none !important;
}

/* ============================================================ */

@media (min-width: 960px) {
  /* Drop the redundant above-map chrome in the default basic mode. */
  body[data-site-page="dashboard"].basic-mode .toolbar,
  body[data-site-page="dashboard"].basic-mode .jump-bar,
  body[data-site-page="dashboard"].basic-mode .filter-chip-bar,
  body[data-site-page="dashboard"].basic-mode .dashboard-intro-strip,
  body[data-site-page="dashboard"].basic-mode .dashboard-section-tabs,
  body[data-site-page="dashboard"].basic-mode .overview-grid,
  body[data-site-page="dashboard"].basic-mode #overview-cards,
  body[data-site-page="dashboard"].basic-mode .insight-strip,
  body[data-site-page="dashboard"].basic-mode .data-package-panel,
  body[data-site-page="dashboard"].basic-mode .usage-notes-panel,
  body[data-site-page="dashboard"].basic-mode #usage-notes-panel,
  body[data-site-page="dashboard"].basic-mode .methodology-panel {
    display: none !important;
  }

  /* GERDA-parity: narrow vertical left sidebar (controls + legend +    */
  /* quick-stats + download), map fills the rest of the row. Sticky so  */
  /* the sidebar stays flush with the top of the map while the main     */
  /* column scrolls.                                                    */
  body[data-site-page="dashboard"].basic-mode .app-shell {
    grid-template-columns: 320px minmax(0, 1fr) !important;
    gap: 24px !important;
    align-items: start !important;
  }
  body[data-site-page="dashboard"].basic-mode .sidebar {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: min-content !important;
    gap: 14px !important;
    padding: 16px !important;
    height: auto !important;
    position: sticky !important;
    top: 16px !important;
    align-self: start !important;
    border-right: 0 !important;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
  }
  /* Fallback for non-basic (advanced) uiLevel: keep the old topbar. */
  body[data-site-page="dashboard"]:not(.basic-mode) .sidebar {
    grid-template-columns: minmax(220px, 20%) minmax(0, 1fr) !important;
    padding: 10px 18px !important;
  }

  /* In basic mode hide the secondary sidebar panels entirely: they were  */
  /* already relegated below the strip, but the topbar is the whole UI   */
  /* visible in the viewport, so leaving them there leaks into the map.  */
  body[data-site-page="dashboard"].basic-mode .sidebar > :not(.brand):not(.control-panel):not(.map-companion) {
    display: none !important;
  }

  /* Remove the inner h2 labels inside the map & profile panels — the   */
  /* panels themselves are clearly framed and the label is noise.       */
  body[data-site-page="dashboard"].basic-mode .map-panel > .panel-header,
  body[data-site-page="dashboard"].basic-mode .detail-panel > .panel-header {
    display: none !important;
  }

  /* Map takes all the space we can give it. */
  body[data-site-page="dashboard"] .map-and-detail {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) !important;
    gap: 16px !important;
    align-items: start;
  }
  body[data-site-page="dashboard"] .map-panel {
    padding: 10px 12px 14px !important;
  }
  body[data-site-page="dashboard"] .detail-panel {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: 14px 16px !important;
  }
  body[data-site-page="dashboard"] #map-wrapper {
    min-height: min(76vh, 820px);
  }

  /* Further-in: slim the control strip headings so the topbar reads    */
  /* like a toolbar, not a card.                                         */
  body[data-site-page="dashboard"] .sidebar .panel.control-panel {
    background: transparent !important;
    border: 0 !important;
    padding: 4px 0 0 !important;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .panel-header {
    display: none !important;
  }
}

/* Trim the sub-page Tabler card styling on docs pages so they read as   */
/* clean editorial typography instead of a wall of rounded boxes.        */
body[data-site-page="data-download"] .site-doc-main .card,
body[data-site-page="usage-notes"] .site-doc-main .card,
body[data-site-page="update-log"] .site-doc-main .card,
body[data-site-page="products"] .site-doc-main .card,
body[data-site-page="programmatic-access"] .site-doc-main .card {
  box-shadow: none;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line-soft);
  background: transparent;
  padding: 18px 0 4px;
}
body[data-site-page="data-download"] .site-doc-main .card + .card,
body[data-site-page="usage-notes"] .site-doc-main .card + .card,
body[data-site-page="update-log"] .site-doc-main .card + .card,
body[data-site-page="products"] .site-doc-main .card + .card,
body[data-site-page="programmatic-access"] .site-doc-main .card + .card {
  margin-top: 8px;
}
body[data-site-page="data-download"] .site-doc-main .card:first-of-type,
body[data-site-page="usage-notes"] .site-doc-main .card:first-of-type,
body[data-site-page="update-log"] .site-doc-main .card:first-of-type,
body[data-site-page="products"] .site-doc-main .card:first-of-type,
body[data-site-page="programmatic-access"] .site-doc-main .card:first-of-type {
  border-top: 0;
  padding-top: 0;
}
body[data-site-page="data-download"] .site-doc-main .card .card-body,
body[data-site-page="usage-notes"] .site-doc-main .card .card-body,
body[data-site-page="update-log"] .site-doc-main .card .card-body,
body[data-site-page="products"] .site-doc-main .card .card-body,
body[data-site-page="programmatic-access"] .site-doc-main .card .card-body {
  padding: 0;
}

/* ============================================================ */
/* gerda-parity (round 4) — the dashboard should match          */
/* https://german-elections.com/dashboard/ in information        */
/* density and visual chrome: thin topbar, narrow sidebar with   */
/* year/metric/legend, full-bleed map, profile BELOW the map     */
/* only after a comune is selected.                              */
/* ============================================================ */

/* (A) Brand block: force a single horizontal row so the EI      */
/* monogram sits inline with the text, not stacked above it.    */
.site-header-inner .site-brand {
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
}
.site-header-inner .site-brand .site-brand-copy {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
@media (max-width: 720px) {
  body[data-site-page="dashboard"] .site-brand-subtitle {
    display: none !important;
  }
}

/* (B) Skip-link visible in the top-left bleeds into the layout  */
/* of every page. Keep it available to screen readers but make   */
/* it truly invisible until focused.                             */
.skip-link {
  position: absolute !important;
  top: -40px !important;
  left: 8px !important;
  z-index: 100;
  padding: 6px 10px;
  background: var(--accent-deep, #10233c);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.12s ease-out;
}
.skip-link:focus { top: 8px !important; }

/* (C) Hide only stale top-level leftovers after controls are moved */
/*     into "Strumenti avanzati". Keep the section header visible   */
/*     so the sidebar still reads as "Esplora il voto".             */
body[data-site-page="dashboard"] .sidebar .panel.control-panel > .time-nav-box,
body[data-site-page="dashboard"] .sidebar .panel.control-panel > .two-col:has(#territorial-mode-select) {
  display: none !important;
}

/* (D) Detail is now a standalone page (`municipality-detail.html`).
 * Hide the inline detail-panel entirely on the dashboard and let the
 * map claim the full width; the "Vai al dettaglio" CTA next to the
 * map takes the user to the dedicated page when a comune is selected. */
body[data-site-page="dashboard"] .detail-panel {
  display: none !important;
}
@media (min-width: 960px) {
  body[data-site-page="dashboard"] .map-and-detail {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start;
  }
}

/* Map-adjacent CTA "Vai al dettaglio del comune" */
body[data-site-page="dashboard"] .map-detail-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 0 0;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  color: #e2e8f0;
  font-size: 13px;
}
body[data-site-page="dashboard"] .map-detail-cta.hidden {
  display: none !important;
}
body[data-site-page="dashboard"] .map-detail-cta-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: #94a3b8;
}
body[data-site-page="dashboard"] .map-detail-cta strong {
  font-size: 15px;
  color: #f8fafc;
}
body[data-site-page="dashboard"] .map-detail-cta a {
  margin-left: auto;
  text-decoration: none;
}

/* Loading indicator overlay on top of the map canvas */
#map-wrapper { position: relative; }
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
  color: #e2e8f0;
  font-size: 13px;
  z-index: 6;
  pointer-events: none;
}
.map-loading.hidden {
  display: none !important;
}
.map-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(148, 163, 184, 0.25);
  border-top-color: #60a5fa;
  animation: mapLoadingSpin 0.75s linear infinite;
}
.map-loading-label {
  letter-spacing: 0.02em;
}
@keyframes mapLoadingSpin {
  to { transform: rotate(360deg); }
}

/* (E) Control panel becomes a narrow vertical GERDA-style       */
/* sidebar on desktop: labels stacked, single column, no two-col */
/* grid. Visually separated from the map by generous gap.        */
@media (min-width: 960px) {
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .two-col.two-col-main {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel label {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel select,
  body[data-site-page="dashboard"] .sidebar .panel.control-panel input[type="text"] {
    font-size: 0.92rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
  }
}

/* (F) Map panel: strip the card chrome so it reads as a canvas  */
/* on the page, not a card-in-a-card. GERDA's map sits directly  */
/* on the page background with a 1px border.                     */
@media (min-width: 960px) {
  body[data-site-page="dashboard"] .map-panel {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  body[data-site-page="dashboard"] #map-wrapper {
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    overflow: hidden;
    background: #fafbfd;
  }
}

/* ============================================================ */
/* gerda-parity (round 5) — legend + quick-stats + download in    */
/* the sidebar, below the control-panel, always visible.          */
/* ============================================================ */

body[data-site-page="dashboard"] .sidebar .panel.map-companion {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px 16px;
  border: 1px solid var(--line-soft, #e5e9f2);
  border-radius: 10px;
  background: #fff;
}
body[data-site-page="dashboard"] .sidebar-legend:empty,
body[data-site-page="dashboard"] .sidebar-quick-stats:empty,
body[data-site-page="dashboard"] .sidebar-party-results:empty { display: none; }
body[data-site-page="dashboard"] .sidebar-party-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft, #e5e9f2);
}
body[data-site-page="dashboard"] .party-results-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body[data-site-page="dashboard"] .party-results-header .eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
body[data-site-page="dashboard"] .party-results-scope {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #0f172a);
}
body[data-site-page="dashboard"] .party-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
body[data-site-page="dashboard"] .party-results-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 80px 56px;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}
body[data-site-page="dashboard"] .party-results-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.15);
}
body[data-site-page="dashboard"] .party-results-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text, #0f172a);
}
body[data-site-page="dashboard"] .party-results-bar {
  display: block;
  height: 8px;
  background: var(--line-soft, #e5e9f2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
body[data-site-page="dashboard"] .party-results-bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.18s ease-out;
}
body[data-site-page="dashboard"] .party-results-pct {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
  color: var(--text, #0f172a);
}
body[data-site-page="dashboard"] .sidebar-legend .legend-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body[data-site-page="dashboard"] .sidebar-legend .legend-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body[data-site-page="dashboard"] .sidebar-legend .legend-caption {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
body[data-site-page="dashboard"] .sidebar-legend .legend-caption.subtle {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.85;
}
body[data-site-page="dashboard"] .sidebar-legend .legend-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
body[data-site-page="dashboard"] .sidebar-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text);
}
body[data-site-page="dashboard"] .sidebar-legend .legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
}
body[data-site-page="dashboard"] .sidebar-legend .legend-gradient {
  width: 100%;
  height: 10px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.12);
}
body[data-site-page="dashboard"] .sidebar-legend .legend-item-block {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
}

body[data-site-page="dashboard"] .sidebar-quick-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft, #e5e9f2);
}
body[data-site-page="dashboard"] .quick-stats-header {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
body[data-site-page="dashboard"] .quick-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0;
}
body[data-site-page="dashboard"] .quick-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body[data-site-page="dashboard"] .quick-stat dt {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
body[data-site-page="dashboard"] .quick-stat dd {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
body[data-site-page="dashboard"] .quick-stats-empty {
  font-size: 0.82rem;
  color: var(--muted);
}

body[data-site-page="dashboard"] .sidebar-layers {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0 12px;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line-soft, #e5e9f2);
}
body[data-site-page="dashboard"] .sidebar-layers legend {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0;
  margin-bottom: 2px;
}
body[data-site-page="dashboard"] .sidebar-layer-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
body[data-site-page="dashboard"] .sidebar-layer-toggle input[type="checkbox"] {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: #0f172a;
}
body[data-site-page="dashboard"] .sidebar-download-row {
  display: flex;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft, #e5e9f2);
}
body[data-site-page="dashboard"] .sidebar-download-btn {
  width: 100%;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 500;
}

/* (G) Sidebar flush with map top — drop the .sidebar top padding */
/* that made the control-panel float ~14px below the map frame.   */
@media (min-width: 960px) {
  body[data-site-page="dashboard"] .map-and-detail {
    align-items: flex-start !important;
  }
  body[data-site-page="dashboard"] .sidebar {
    padding-top: 0 !important;
    gap: 14px;
  }
  body[data-site-page="dashboard"] .sidebar > .brand {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  body[data-site-page="dashboard"] .sidebar .panel.control-panel {
    margin-top: 0 !important;
  }
}

/* (H) Loading overlay: make sure it sits above the map and is    */
/* actually visible during first fetch / election change. The     */
/* base class already provides the chrome — we only make sure it  */
/* isn't hidden by the parent stacking context.                   */
body[data-site-page="dashboard"] #loading-overlay {
  z-index: 1200;
}
body[data-site-page="dashboard"] #loading-overlay.hidden {
  display: none !important;
}

body[data-site-page="dashboard"] .selection-dock {
  left: auto;
  right: 18px;
  width: min(620px, calc(100vw - 32px));
}
body[data-site-page="dashboard"] .selection-dock-main {
  align-items: flex-end;
}
body[data-site-page="dashboard"] .selection-dock-actions {
  justify-content: flex-end;
}

/* ============================================================ */
/* GERDA-copy dashboard cleanup                                 */
/* ============================================================ */

body[data-site-page="dashboard"] .site-brand-subtitle,
body[data-site-page="dashboard"] .map-detail-cta,
body[data-site-page="dashboard"] #map-wrapper::after {
  display: none !important;
}

body[data-site-page="dashboard"] .site-nav-icon {
  display: none !important;
}

body[data-site-page="dashboard"] .selection-dock {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: 100% !important;
  z-index: auto !important;
  padding: 12px 0 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--line-soft, #e5e9f2) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body[data-site-page="dashboard"] .selection-dock-main {
  display: grid !important;
  gap: 12px !important;
  align-items: start !important;
  min-width: 0 !important;
  width: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-site-page="dashboard"] .selection-dock-copy {
  display: grid;
  gap: 4px;
}

body[data-site-page="dashboard"] .selection-dock-copy .eyebrow {
  margin-bottom: 0;
}

body[data-site-page="dashboard"] .selection-dock-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

body[data-site-page="dashboard"] .selection-dock-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body[data-site-page="dashboard"] .selection-dock-stat span {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

body[data-site-page="dashboard"] .selection-dock-stat strong {
  font-size: 0.96rem;
  color: var(--text);
}

body[data-site-page="dashboard"] .selection-dock-actions {
  justify-content: stretch !important;
}

body[data-site-page="dashboard"] .selection-dock-actions button {
  flex: 1 1 0;
}

@media (min-width: 960px) {
  body[data-site-page="dashboard"] .app-shell {
    grid-template-columns: 320px minmax(0, 1fr) !important;
    gap: 24px !important;
    align-items: start !important;
  }

  body[data-site-page="dashboard"] .sidebar {
    position: sticky !important;
    top: 16px !important;
    align-self: start !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
    padding: 16px !important;
    border: 1px solid var(--line-soft, #e5e9f2) !important;
    border-radius: 14px !important;
    border-bottom: 1px solid var(--line-soft, #e5e9f2) !important;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(18px) !important;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08) !important;
    overflow: visible !important;
    color: #0f172a !important;
  }

  body[data-site-page="dashboard"] .sidebar > .brand,
  body[data-site-page="dashboard"] .sidebar > :not(.control-panel):not(.map-companion) {
    display: none !important;
  }

  body[data-site-page="dashboard"] .main-content {
    padding: 18px 0 28px !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel .panel-header {
    display: none !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel .panel-subtitle {
    display: none !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel .two-col,
  body[data-site-page="dashboard"] .sidebar .panel.control-panel .two-col-main {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel label {
    margin-bottom: 0 !important;
    gap: 4px !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    color: var(--muted) !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel input,
  body[data-site-page="dashboard"] .sidebar .panel.control-panel select {
    padding: 10px 12px !important;
    border-radius: 10px !important;
    border: 1px solid rgba(148, 163, 184, 0.28) !important;
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: none !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel .advanced-sidebar-details {
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft, #e5e9f2);
  }

  body[data-site-page="dashboard"] .sidebar .panel.control-panel .advanced-sidebar-details > summary {
    font-size: 0.74rem !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    color: var(--muted) !important;
    font-weight: 600 !important;
  }

  body[data-site-page="dashboard"] .sidebar .panel.map-companion {
    margin: 0 !important;
    padding: 14px 0 0 !important;
    border: 0 !important;
    border-top: 1px solid var(--line-soft, #e5e9f2) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body[data-site-page="dashboard"] .sidebar .helper-text,
  body[data-site-page="dashboard"] .sidebar .quick-stats-header,
  body[data-site-page="dashboard"] .sidebar .quick-stat dt,
  body[data-site-page="dashboard"] .sidebar .legend-caption,
  body[data-site-page="dashboard"] .sidebar .legend-caption.subtle,
  body[data-site-page="dashboard"] .sidebar .selection-dock-stat span,
  body[data-site-page="dashboard"] .sidebar .selection-dock-copy .eyebrow {
    color: #64748b !important;
  }

  body[data-site-page="dashboard"] .sidebar .legend-item,
  body[data-site-page="dashboard"] .sidebar .quick-stat dd,
  body[data-site-page="dashboard"] .sidebar .selection-dock-copy strong,
  body[data-site-page="dashboard"] .sidebar .selection-dock-stat strong,
  body[data-site-page="dashboard"] .sidebar .sidebar-layers,
  body[data-site-page="dashboard"] .sidebar .sidebar-layers span {
    color: #0f172a !important;
  }

  body[data-site-page="dashboard"] .map-and-detail {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
  }

  body[data-site-page="dashboard"] .map-panel {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  body[data-site-page="dashboard"] #map-wrapper {
    min-height: min(78vh, 840px) !important;
    border-radius: 10px !important;
    border: 1px solid var(--line-soft, #e5e9f2) !important;
  }
}

@media (max-width: 959.98px) {
  body[data-site-page="dashboard"] .selection-dock-stats {
    grid-template-columns: 1fr;
  }
}


/* ---------------------------------------------------------------
   Municipality detail page (municipality-detail.html)
   --------------------------------------------------------------- */
body[data-site-page="municipality-detail"] .detail-breadcrumb-link {
  color: inherit;
  text-decoration: none;
}
body[data-site-page="municipality-detail"] .detail-breadcrumb-link:hover {
  text-decoration: underline;
}
body[data-site-page="municipality-detail"] .detail-error {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
  font-size: 14px;
}
body[data-site-page="municipality-detail"] .detail-error.hidden {
  display: none !important;
}
body[data-site-page="municipality-detail"] .detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
body[data-site-page="municipality-detail"] .detail-kv {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--line-soft, #e2e8f0);
  border-radius: 12px;
}
body[data-site-page="municipality-detail"] .detail-kv-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
body[data-site-page="municipality-detail"] .detail-kv-value {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}
body[data-site-page="municipality-detail"] .detail-placeholder {
  padding: 14px;
  color: #475569;
  font-size: 14px;
}
body[data-site-page="municipality-detail"] .detail-placeholder-muted {
  color: #94a3b8;
  font-style: italic;
}
body[data-site-page="municipality-detail"] .detail-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  margin-top: 12px;
}
body[data-site-page="municipality-detail"] .detail-chart-card {
  background: #ffffff;
  border: 1px solid var(--line-soft, #e2e8f0);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body[data-site-page="municipality-detail"] .detail-chart-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}
body[data-site-page="municipality-detail"] .detail-chart-head p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}
body[data-site-page="municipality-detail"] .detail-chart-body {
  position: relative;
  min-height: 200px;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  font-family: inherit;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .axis text {
  fill: #64748b;
  font-size: 11px;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .axis line,
body[data-site-page="municipality-detail"] .detail-chart-body svg .axis path,
body[data-site-page="municipality-detail"] .detail-chart-body svg .grid line {
  stroke: #e2e8f0;
  stroke-width: 1;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .series-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .series-dot {
  fill: #2563eb;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .series-bar {
  fill: #6366f1;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .series-bar-neg {
  fill: #ef4444;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .leader-tile rect {
  stroke: #ffffff;
  stroke-width: 1;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .leader-tile text.leader-name {
  fill: #ffffff;
  font-weight: 600;
  font-size: 11px;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .leader-tile text.leader-share {
  fill: rgba(255,255,255,0.85);
  font-size: 10px;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .chart-empty {
  fill: #94a3b8;
  font-size: 12px;
  font-style: italic;
}

/* Multi-series turnout chart: comune (primary) on top of province + Italia
 * reference lines. Dashes keep the chart readable in B/W print as well. */
body[data-site-page="municipality-detail"] .detail-chart-body svg .series-line-province {
  stroke: #f59e0b;
  stroke-width: 1.6;
  stroke-dasharray: 4 3;
  opacity: 0.85;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .series-line-italy {
  stroke: #94a3b8;
  stroke-width: 1.4;
  stroke-dasharray: 2 3;
  opacity: 0.85;
}

/* Inline legend in the chart card subtitle. */
body[data-site-page="municipality-detail"] .detail-chart-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-left: 6px;
  font-size: 12px;
  color: #475569;
}
body[data-site-page="municipality-detail"] .legend-swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-right: 4px;
  border-radius: 2px;
  vertical-align: middle;
}
body[data-site-page="municipality-detail"] .legend-swatch-comune { background: #2563eb; }
body[data-site-page="municipality-detail"] .legend-swatch-province {
  background: linear-gradient(to right, #f59e0b 0 6px, transparent 6px 9px, #f59e0b 9px 14px);
}
body[data-site-page="municipality-detail"] .legend-swatch-italy {
  background: linear-gradient(to right, #94a3b8 0 4px, transparent 4px 7px, #94a3b8 7px 11px, transparent 11px 14px);
}

/* Block-dominante chart: categorical strips. */
body[data-site-page="municipality-detail"] .detail-chart-body svg .block-tile {
  stroke: #ffffff;
  stroke-width: 1;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .block-tile-ref {
  stroke: #e2e8f0;
  stroke-width: 0.5;
}
body[data-site-page="municipality-detail"] .detail-chart-body svg .block-tile-label {
  fill: #ffffff;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* "Comune vs Italia" KPI strip — Tabler-style cards. */
body[data-site-page="municipality-detail"] .detail-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
body[data-site-page="municipality-detail"] .detail-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--line-soft, #e2e8f0);
  border-left: 3px solid #cbd5e1;
  border-radius: 12px;
}
body[data-site-page="municipality-detail"] .detail-kpi-positive {
  border-left-color: #16a34a;
}
body[data-site-page="municipality-detail"] .detail-kpi-negative {
  border-left-color: #dc2626;
}
body[data-site-page="municipality-detail"] .detail-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  font-weight: 600;
}
body[data-site-page="municipality-detail"] .detail-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.15;
}
body[data-site-page="municipality-detail"] .detail-kpi-hint {
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}

/* Make the block strip card span the full row so all elections fit. */
body[data-site-page="municipality-detail"] .detail-chart-card-wide {
  grid-column: 1 / -1;
}
