/* ─── COMPARE VIEW ─── */
#compare {
  flex: 1;
  background: var(--ivory);
  overflow: auto;
  padding: 22px 28px 32px;
}
.cmp-hdr {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 6px;
}
.cmp-h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
}
.cmp-sub {
  font-family: var(--font-mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink4);
}
.cmp-empty {
  margin-top: 60px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px; color: var(--ink3);
  font-style: italic;
}
.cmp-empty-sub {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--ink4);
  text-transform: uppercase; letter-spacing: .08em;
}

.cmp-grid {
  display: grid;
  gap: 1px;
  background: var(--bdr);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  overflow: visible;
  margin-top: 18px;
}
.cmp-row {
  display: grid;
  background: var(--ivory);
}
.cmp-grid > .cmp-cell:first-child { border-top-left-radius: 9px; }
.cmp-grid > .cmp-cell:nth-child(4) { border-top-right-radius: 9px; }
.cmp-grid > .cmp-cell:nth-last-child(4) { border-bottom-left-radius: 9px; }
.cmp-grid > .cmp-cell:last-child { border-bottom-right-radius: 9px; }
.cmp-row.cmp-cat {
  background: var(--ivory2);
}
.cmp-cell {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink2);
  display: flex;
  align-items: center;
  border-right: 1px solid var(--bdr);
  min-height: 38px;
}
.cmp-cell:last-child { border-right: none; }
.cmp-cell.cmp-lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink3);
  background: color-mix(in oklab, var(--ivory2) 60%, var(--ivory));
}
.cmp-cell.cmp-cat-h {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink);
  padding: 12px 14px 8px;
}
.cmp-cell.cmp-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}
.cmp-cell.cmp-val.best { background: color-mix(in oklab, var(--green) 12%, transparent); color: var(--green); }
.cmp-cell.cmp-val.worst { background: color-mix(in oklab, var(--red) 10%, transparent); color: var(--red); }
.cmp-cell.cmp-head {
  padding: 0;
  flex-direction: column;
  align-items: stretch;
  min-height: 92px;
}
.cmp-chead-bar { height: 4px; }
.cmp-chead-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cmp-chead-name {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600;
  color: var(--ink); letter-spacing: -.01em;
  line-height: 1;
}
.cmp-chead-meta {
  font-family: var(--font-mono);
  font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink3);
}
.cmp-chead-x {
  position: absolute; top: 6px; right: 6px;
  background: none; border: none;
  color: var(--ink4); cursor: pointer;
  font-size: 14px; padding: 2px 6px;
  border-radius: 3px;
}
.cmp-chead-x:hover { color: var(--red); background: color-mix(in oklab, var(--red) 10%, transparent); }
.cmp-head { position: relative; }

.cmp-slot {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 92px;
  background: color-mix(in oklab, var(--ivory) 80%, var(--ivory2));
  border: 1.5px dashed var(--bdr2);
  color: var(--ink4);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .08em;
  text-align: center;
  cursor: pointer;
  gap: 5px;
  padding: 12px;
}
.cmp-slot:hover { border-color: var(--accent); color: var(--accent); }
.cmp-slot-plus { font-size: 22px; color: var(--ink4); line-height: 1; }
.cmp-slot:hover .cmp-slot-plus { color: var(--accent); }

/* Inline "add country" mini search inside compare slot */
.cmp-add-drop {
  position: absolute;
  top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--ivory);
  border: 1px solid var(--bdr2);
  border-radius: 8px;
  max-height: min(320px, 56vh); overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  padding: 4px;
  margin-top: 2px;
}

/* ─── HEATMAP VIEW ──────────────────────────────────────── */
#heatmap {
  flex: 1;
  background: var(--ivory);
  overflow: auto;
  padding: 22px 28px 32px;
}
.hm-hdr {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 14px;
}
.hm-grid {
  display: grid;
  grid-template-columns: 180px repeat(var(--ind-cols, 10), minmax(74px, 1fr));
  gap: 1px;
  background: var(--bdr);
  border: 1px solid var(--bdr);
  border-radius: 8px;
  overflow: hidden;
  min-width: max-content;
}
.hm-cell {
  background: var(--ivory);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  text-align: center;
  position: relative;
  cursor: pointer;
  min-height: 36px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 100ms;
}
.hm-cell:hover { z-index: 2; transform: scale(1.04); box-shadow: 0 0 0 2px var(--ink); }
.hm-cell.hm-name {
  background: var(--ivory2);
  text-align: left;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  padding-left: 16px;
  position: sticky;
  left: 0;
  z-index: 1;
}
.hm-cell.hm-corner {
  position: sticky;
  left: 0;
  z-index: 2;
}

@media (max-width: 860px) {
  #compare, #heatmap { padding: 16px 14px 24px; }
  .hm-grid { grid-template-columns: 130px repeat(var(--ind-cols, 10), minmax(64px, 1fr)); }
}
.hm-cell.hm-name .iso {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink4);
  margin-left: 6px;
  letter-spacing: .04em;
}
.hm-cell.hm-name::before {
  content: ""; position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--rcol);
}
.hm-cell.hm-head {
  background: var(--ivory2);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink3);
  font-weight: 500;
  padding: 12px 6px;
  text-align: center;
  white-space: normal;
  line-height: 1.25;
}
.hm-cell.hm-corner { background: var(--ivory2); }

/* ─── DENSITY ───────────────────────────────────────────── */
body.density-tight .ch-inner { padding: 11px 16px 10px; }
body.density-tight .cn { font-size: 24px; }
body.density-tight .ss-cell { padding: 8px 12px; }
body.density-tight .ss-v { font-size: 17px; }
body.density-tight .section-body { padding: 4px 16px 8px; }
body.density-tight .dr3 { padding: 5px 0; }

/* Utility: indicator color (used for chropleth + heatmap) */
.swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}