/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --cf-red:        #E11E36;
  --cf-red-2:      #F33C53;
  --cf-red-deep:   #B71428;
  --cf-red-soft:   #FCE7EA;
  --cf-red-softer: #FDF1F3;

  --cf-cream:      #F6F4EF;
  --cf-cream-2:    #EEEBE3;
  --cf-paper:      #FFFFFF;
  --cf-ink:        #0F0D0E;
  --cf-ink-2:      #2A2526;
  --cf-text:       #1A1718;
  --cf-text-2:     #6B6566;
  --cf-text-3:     #9C9696;

  --cf-line:       rgba(15,13,14,0.08);
  --cf-line-2:     rgba(15,13,14,0.14);
  --cf-line-3:     rgba(15,13,14,0.22);

  --cf-green:      #1F8A5B;
  --cf-green-soft: #E6F4EC;
  --cf-amber:      #C77A00;
  --cf-amber-soft: #FBF1DF;
  --cf-slate:      #BCB7B0;

  --font-display:  'Poppins', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body:     'Poppins', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono:     'Azeret Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --shadow-card:   0 1px 0 rgba(255,255,255,0.6) inset, 0 18px 60px -22px rgba(15,13,14,0.18), 0 4px 14px -6px rgba(15,13,14,0.08);
  --shadow-pop:    0 24px 60px -16px rgba(15,13,14,0.32), 0 0 0 1px rgba(15,13,14,0.06);
  --shadow-soft:   0 8px 20px -10px rgba(15,13,14,0.12);
  --shadow-red:    0 14px 30px -10px rgba(225,30,54,0.42);

  --map-h:         820px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--cf-cream);
  color: var(--cf-text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
button { font: inherit; }

/* ============================================================
   SECTION SHELL
   ============================================================ */
.cf-section {
  position: relative;
  width: 100%;
  background: var(--cf-cream);
  padding: 0;
}
.cf-section.cf-tone-dark {
  background: var(--cf-ink);
  background-image:
    radial-gradient(ellipse 60% 50% at 0% 30%, rgba(225,30,54,0.20), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 70%, rgba(225,30,54,0.12), transparent 60%);
  color: #E9E5E6;
  --cf-text: #E9E5E6;
  --cf-text-2: rgba(233,229,230,0.62);
  --cf-text-3: rgba(233,229,230,0.42);
  --cf-line: rgba(255,255,255,0.10);
  --cf-line-2: rgba(255,255,255,0.18);
  --cf-paper: rgba(255,255,255,0.05);
  --cf-cream-2: rgba(255,255,255,0.06);
}

.cf-inner { max-width: 1440px; margin: 0 auto; padding: 0 40px; }
@media (max-width: 768px) { .cf-inner { padding: 0 20px; } }

/* ============================================================
   HEADER STRIP
   ============================================================ */
.cf-head {
  padding: 64px 0 40px;
}
.cf-head-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.85fr);
  gap: 80px;
  align-items: end;
}
@media (max-width: 980px) { .cf-head-grid { grid-template-columns: 1fr; gap: 32px; } }

.cf-eyebrow {
  display: inline-flex; align-items: center; gap: 14px;
  color: var(--cf-red);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  margin-bottom: 22px;
}
.cf-eyebrow-dash { width: 28px; height: 1.5px; background: currentColor; display: inline-block; }

.cf-h2 {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 4vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--cf-ink);
  text-wrap: balance;
}
.cf-section.cf-tone-dark .cf-h2 { color: #fff; }
.cf-h2 em {
  font-style: normal;
  color: var(--cf-red);
}

.cf-lede {
  margin: 0;
  max-width: 52ch;
  color: var(--cf-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
}

/* Header metrics */
.cf-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--cf-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--cf-line);
}
.cf-metric {
  background: var(--cf-cream);
  padding: 22px 20px 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.cf-section.cf-tone-dark .cf-metric { background: rgba(255,255,255,0.03); }
.cf-metric-lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-text-2);
}
.cf-metric-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--cf-ink);
  display: flex; align-items: baseline; gap: 6px;
  font-variant-numeric: tabular-nums;
}
.cf-section.cf-tone-dark .cf-metric-num { color: #fff; }
.cf-metric-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cf-red);
  letter-spacing: 0.02em;
}
.cf-metric-delta {
  position: absolute;
  top: 12px; right: 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--cf-green);
  background: var(--cf-green-soft);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.cf-section.cf-tone-dark .cf-metric-delta { background: rgba(31,138,91,0.18); }

/* ============================================================
   SWITCHER BAR — light bar with simple underline tabs
   ============================================================ */
.cf-switch-bar {
  position: relative;
  background: var(--cf-paper);
  border-top: 1px solid var(--cf-line);
  border-bottom: 1px solid var(--cf-line);
}
.cf-section.cf-tone-dark .cf-switch-bar {
  background: rgba(255,255,255,0.04);
  border-top-color: rgba(255,255,255,0.08);
  border-bottom-color: rgba(255,255,255,0.08);
}
.cf-switch-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
}
@media (max-width: 768px) { .cf-switch-inner { padding: 0 20px; } }

.cf-tabs {
  display: flex;
  gap: 4px;
  width: 100%;
}

.cf-tab {
  appearance: none; border: 0; background: transparent;
  padding: 18px 4px;
  margin-right: 32px;
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  color: var(--cf-text-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  position: relative;
  transition: color 200ms ease;
  white-space: nowrap;
}
.cf-tab svg { width: 16px; height: 16px; opacity: 0.7; transition: opacity 200ms; }
.cf-tab::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--cf-red);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 240ms cubic-bezier(.2,.7,.2,1);
}
.cf-tab:hover:not(.is-active) { color: var(--cf-ink); }
.cf-section.cf-tone-dark .cf-tab:hover:not(.is-active) { color: #fff; }
.cf-tab:hover svg { opacity: 1; }
.cf-tab.is-active { color: var(--cf-red); }
.cf-tab.is-active svg { opacity: 1; }
.cf-tab.is-active::after { transform: scaleX(1); }

.cf-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--cf-cream-2);
  color: var(--cf-text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}
.cf-section.cf-tone-dark .cf-tab-count {
  background: rgba(255,255,255,0.08);
  color: var(--cf-text-2);
}
.cf-tab.is-active .cf-tab-count {
  background: var(--cf-red-softer);
  color: var(--cf-red);
}
.cf-section.cf-tone-dark .cf-tab.is-active .cf-tab-count {
  background: rgba(225,30,54,0.18);
  color: var(--cf-red-2);
}

/* ============================================================
   MAP BAND
   ============================================================ */
.cf-map-band {
  position: relative;
  width: 100%;
  height: var(--map-h);
  background: #eef0ec;
  overflow: hidden;
}
.cf-section.cf-tone-dark .cf-map-band { background: #1a1718; }
.cf-map { position: absolute; inset: 0; }

/* Leaflet overrides */
.leaflet-container { font-family: var(--font-mono); font-size: 11px; background: transparent !important; outline: 0 !important; }
.leaflet-container :focus { outline: 0 !important; }
.leaflet-control-container { font-family: var(--font-mono); }
.leaflet-bottom.leaflet-right { right: 0 !important; bottom: 0 !important; left: 0 !important; }
.leaflet-bottom.leaflet-right .leaflet-control { float: none !important; }

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 8px 20px -6px rgba(15,13,14,0.20) !important;
  border-radius: 12px !important;
  overflow: hidden;
  margin: 18px 0 0 18px !important;
}
.leaflet-control-zoom a {
  background: rgba(255,255,255,0.98) !important;
  color: var(--cf-ink) !important;
  border: 0 !important;
  width: 36px !important; height: 36px !important; line-height: 36px !important;
  font-size: 18px !important; font-weight: 600 !important;
}
.leaflet-control-zoom a:hover { background: var(--cf-red) !important; color: #fff !important; }
.leaflet-bar a:first-child { border-bottom: 1px solid rgba(15,13,14,0.08) !important; }
.leaflet-control-attribution {
  background: rgba(255,255,255,0.92) !important;
  color: var(--cf-text-3) !important;
  font-family: var(--font-mono);
  font-size: 9.5px !important;
  padding: 3px 10px !important;
  border-radius: 0 !important;
  margin: 0 !important;
  display: block;
  width: 100%;
  text-align: right;
}
.leaflet-control-attribution a { color: var(--cf-text-2) !important; }

/* ============================================================
   FLOATING PANEL (left, on map)
   ============================================================ */
.cf-fpanel {
  position: absolute;
  top: 24px;
  left: max(24px, calc((100vw - 1440px) / 2 + 40px));
  width: 400px;
  max-height: calc(var(--map-h) - 80px);
  z-index: 500;
  background: var(--cf-paper);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: cfPanelIn 320ms cubic-bezier(.2,.7,.2,1);
}
.cf-section.cf-tone-dark .cf-fpanel {
  background: #1f1b1c;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
}
@keyframes cfPanelIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

.cf-fpanel-head {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--cf-line);
  display: flex; flex-direction: column; gap: 4px;
}
.cf-fpanel-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-red);
  display: flex; align-items: center; gap: 10px;
}
.cf-fpanel-eyebrow::before {
  content: ''; width: 14px; height: 1.5px; background: currentColor; display: inline-block;
}
.cf-fpanel-title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: normal;
  color: var(--cf-ink);
}
.cf-section.cf-tone-dark .cf-fpanel-title { color: #fff; }
.cf-fpanel-sub {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--cf-text-2);
}
.cf-fpanel-count-pill {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px;
  align-self: flex-start;
  background: var(--cf-red-softer);
  color: var(--cf-red);
  padding: 5px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.cf-section.cf-tone-dark .cf-fpanel-count-pill { background: rgba(225,30,54,0.18); }
.cf-fpanel-count-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cf-red); }

/* List */
.cf-list {
  list-style: none; margin: 0; padding: 6px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.18) transparent;
}
.cf-list::-webkit-scrollbar { width: 8px; }
.cf-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.16); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
.cf-list::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); border: 2px solid transparent; background-clip: content-box; }

.cf-list-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 160ms ease;
}
.cf-list-item:hover { background: var(--cf-cream); }
.cf-section.cf-tone-dark .cf-list-item:hover { background: rgba(255,255,255,0.05); }
.cf-list-item.is-active { background: var(--cf-red-softer); }
.cf-section.cf-tone-dark .cf-list-item.is-active { background: rgba(225,30,54,0.16); }

.cf-list-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cf-red-2), var(--cf-red-deep));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.cf-list-avatar-img {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  max-width: none !important; max-height: none !important;
  object-fit: cover !important;
  border-radius: 50%;
  display: block;
}
.cf-list-avatar::after {
  content: ''; position: absolute; inset: -2px;
  border-radius: 50%; border: 1.5px solid var(--cf-paper);
  pointer-events: none;
}
.cf-list-info { min-width: 0; }
.cf-list-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--cf-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cf-section.cf-tone-dark .cf-list-name { color: #fff; }
.cf-list-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cf-text-2);
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cf-list-meta .sep { opacity: 0.5; }

.cf-list-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--cf-ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-align: right;
}
.cf-section.cf-tone-dark .cf-list-amount { color: #fff; }
.cf-list-amount-unit {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--cf-red);
  margin-left: 4px;
  letter-spacing: 0.04em;
}

/* Hospital list item — photo placeholder (replaces numbered "6/6" badge) */
.cf-list-hosp-photo {
  width: 52px; height: 52px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e8dfd5 0%, #c8b8a8 50%, #8a7a6a 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 2px 6px -2px rgba(15,13,14,0.18);
}
.cf-list-hosp-photo-img {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  max-width: none !important; max-height: none !important;
  object-fit: cover !important;
  display: block;
}
.cf-list-hosp-photo::before {
  /* subtle architectural stripes — like building windows */
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg,
    rgba(255,255,255,0.15) 0 6px,
    rgba(255,255,255,0) 6px 12px);
  opacity: 0.7;
}
.cf-list-hosp-photo::after {
  /* fade for legibility of the cross icon */
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(15,13,14,0.18));
}
.cf-list-hosp-photo-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
  color: rgba(255,255,255,0.95);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.cf-list-hosp-photo-tag {
  /* monospace label like "PHOTO" placeholder */
  position: absolute;
  left: 0; right: 0; bottom: 3px;
  text-align: center;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
}
.cf-list-hosp-photo-dot {
  position: absolute;
  top: -3px; right: -3px;
  z-index: 3;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--cf-paper);
}
.cf-section.cf-tone-dark .cf-list-hosp-photo-dot { border-color: #1f1b1c; }

/* Footer hint in panel */
.cf-fpanel-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--cf-line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cf-text-2);
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 8px;
}
.cf-fpanel-foot-arrow { color: var(--cf-red); }

/* ============================================================
   FLOATING PANEL — DETAIL (hospital)
   ============================================================ */
.cf-fpanel-detail { padding: 22px 24px 24px; overflow-y: auto; }
.cf-back {
  appearance: none; border: 0; background: transparent; padding: 0;
  color: var(--cf-text-2);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
  transition: color 160ms ease;
}
.cf-back:hover { color: var(--cf-red); }
.cf-back svg { transition: transform 180ms ease; }
.cf-back:hover svg { transform: translateX(-3px); }

.cf-hosp-city {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cf-text-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.cf-hosp-city-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cf-red); }
.cf-hosp-name {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.22;
  letter-spacing: normal;
  color: var(--cf-ink);
  text-wrap: balance;
}
.cf-section.cf-tone-dark .cf-hosp-name { color: #fff; }

.cf-progress-block { margin-top: 20px; }
.cf-progress-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.cf-progress-lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-text-2);
}
.cf-progress-val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--cf-ink);
  font-variant-numeric: tabular-nums;
}
.cf-section.cf-tone-dark .cf-progress-val { color: #fff; }
.cf-progress-track {
  height: 6px;
  background: var(--cf-line);
  border-radius: 999px;
  overflow: hidden;
}
.cf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cf-red), var(--cf-red-2));
  border-radius: 999px;
  transition: width 700ms cubic-bezier(.2,.7,.2,1);
}

/* Timeline */
.cf-tl {
  list-style: none; margin: 24px 0 0; padding: 0;
  position: relative;
}
.cf-tl-item {
  position: relative;
  padding: 0 0 18px 36px;
  display: flex; flex-direction: column; gap: 2px;
}
.cf-tl-item:last-child { padding-bottom: 0; }
/* connector line */
.cf-tl-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 22px;
  bottom: -2px;
  width: 2px;
  background: var(--cf-line-2);
  border-radius: 2px;
}
.cf-tl-item:last-child::before { display: none; }
.cf-tl-item.is-done::before { background: var(--cf-green); }
.cf-tl-item.is-current::before {
  background: linear-gradient(180deg, var(--cf-red), var(--cf-line-2));
}

.cf-tl-node {
  position: absolute;
  left: 0; top: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--cf-paper);
  border: 2px solid var(--cf-line-3);
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 1;
}
.cf-tl-item.is-done .cf-tl-node {
  background: var(--cf-green);
  border-color: var(--cf-green);
}
.cf-tl-item.is-current .cf-tl-node {
  background: var(--cf-paper);
  border-color: var(--cf-red);
  box-shadow: 0 0 0 4px var(--cf-red-softer);
}
.cf-tl-item.is-current .cf-tl-node::before {
  content: ''; width: 8px; height: 8px;
  border-radius: 50%; background: var(--cf-red);
  animation: cfPulse 1.6s ease-out infinite;
}
@keyframes cfPulse {
  0% { box-shadow: 0 0 0 0 rgba(225,30,54,0.6); }
  100% { box-shadow: 0 0 0 12px rgba(225,30,54,0); }
}

.cf-tl-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--cf-text);
  letter-spacing: -0.005em;
}
.cf-tl-item.is-done .cf-tl-label { color: var(--cf-ink); }
.cf-section.cf-tone-dark .cf-tl-item.is-done .cf-tl-label { color: #fff; }
.cf-tl-item.is-current .cf-tl-label { color: var(--cf-ink); font-weight: 600; }
.cf-section.cf-tone-dark .cf-tl-item.is-current .cf-tl-label { color: #fff; }
.cf-tl-item:not(.is-done):not(.is-current) .cf-tl-label { color: var(--cf-text-3); }

.cf-tl-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-red);
}
.cf-tl-tag::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor;
  animation: cfBlink 1.4s ease-in-out infinite;
}
@keyframes cfBlink { 0%,100%{opacity:1;} 50%{opacity:0.35;} }

.cf-tl-done-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--cf-green);
}

/* Note + contact */
.cf-note {
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--cf-cream);
  border-radius: 12px;
  border-left: 3px solid var(--cf-red);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--cf-text);
}
.cf-section.cf-tone-dark .cf-note { background: rgba(255,255,255,0.04); color: var(--cf-text); }
.cf-note-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-red);
  margin-bottom: 6px;
}

.cf-contact {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--cf-line);
}
.cf-contact-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-text-2);
  margin-bottom: 4px;
}
.cf-contact-val {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--cf-text);
  line-height: 1.5;
}

/* ============================================================
   INDIVIDUAL POPUP (floating, redesigned)
   ============================================================ */
.cf-ipop {
  position: absolute;
  z-index: 600;
  width: 340px;
  background: var(--cf-paper);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
  animation: cfPopIn 220ms cubic-bezier(.2,.7,.2,1);
}
.cf-section.cf-tone-dark .cf-ipop { background: #1f1b1c; }
@keyframes cfPopIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cf-ipop-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(15,13,14,0.55);
  color: #fff;
  font-size: 16px; line-height: 26px; text-align: center;
  cursor: pointer;
  z-index: 3;
  transition: background 160ms, transform 160ms;
}
.cf-ipop-close:hover { background: rgba(15,13,14,0.85); transform: rotate(90deg); }

.cf-ipop-media {
  position: relative;
  height: 220px;
  overflow: hidden;
}
.cf-ipop-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #f3cbd3 0%, #ec8c9c 45%, #a04d59 100%);
}
.cf-ipop-stripes {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg,
    rgba(255,255,255,0.16) 0 14px,
    rgba(255,255,255,0) 14px 28px);
  opacity: 0.85;
}
.cf-ipop-initials {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 76px;
  letter-spacing: -0.04em;
  color: rgba(255,255,255,0.55);
  text-shadow: 0 6px 24px rgba(0,0,0,0.18);
}
.cf-ipop-fade {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 90px;
  background: linear-gradient(180deg, transparent, rgba(15,13,14,0.6));
}
.cf-ipop-name-wrap {
  position: absolute; left: 18px; right: 18px; bottom: 14px;
  z-index: 2;
}
.cf-ipop-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  letter-spacing: -0.018em;
  line-height: 1.15;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.cf-ipop-age {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.cf-ipop-body { padding: 18px 20px 20px; }
.cf-ipop-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
}
.cf-ipop-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: var(--cf-red-softer);
  color: var(--cf-red);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cf-section.cf-tone-dark .cf-ipop-tag { background: rgba(225,30,54,0.18); }
.cf-ipop-tag svg { flex-shrink: 0; }

.cf-ipop-story {
  margin: 0 0 16px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  color: var(--cf-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cf-ipop-divider {
  height: 1px;
  background: var(--cf-line);
  margin: 0 0 14px;
}

.cf-ipop-amt-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 14px;
}
.cf-ipop-amt-lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cf-text-2);
}
.cf-ipop-amt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--cf-ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cf-section.cf-tone-dark .cf-ipop-amt { color: #fff; }
.cf-ipop-amt-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cf-red);
  margin-left: 4px;
  letter-spacing: 0.04em;
}

.cf-ipop-cta {
  display: inline-flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: var(--cf-ink);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms;
}
.cf-ipop-cta:hover { background: var(--cf-red); }
.cf-ipop-cta-arrow { transition: transform 200ms; }
.cf-ipop-cta:hover .cf-ipop-cta-arrow { transform: translateX(4px); }

/* small triangle pointer to pin */
.cf-ipop-tail {
  position: absolute;
  bottom: -10px;
  left: calc(50% - 10px);
  width: 20px; height: 12px;
  background: var(--cf-paper);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 6px 6px rgba(15,13,14,0.12));
}

/* ============================================================
   LEGEND
   ============================================================ */
.cf-legend {
  position: absolute;
  bottom: 36px;
  left: 18px;
  z-index: 400;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cf-text-2);
  box-shadow: 0 8px 24px -10px rgba(15,13,14,0.18);
  display: flex; flex-direction: column; gap: 8px;
  min-width: 170px;
}
.cf-section.cf-tone-dark .cf-legend {
  background: rgba(20,17,18,0.88);
  color: rgba(255,255,255,0.65);
}
.cf-legend-title {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-text);
  margin-bottom: 2px;
}
.cf-section.cf-tone-dark .cf-legend-title { color: #fff; }
.cf-legend-row {
  display: flex; align-items: center; gap: 8px;
}
.cf-legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cf-legend-dot--green { background: var(--cf-green); }
.cf-legend-dot--red { background: var(--cf-red); }
.cf-legend-dot--amber { background: var(--cf-amber); }
.cf-legend-dot--slate { background: var(--cf-slate); }

/* When floating panel is on the left, legend moves to right edge to avoid overlap */
.cf-legend-right {
  left: auto;
  right: 18px;
  bottom: 36px;
}

/* ============================================================
   PIN HOVER overrides (Leaflet)
   ============================================================ */
.cf-divicon { background: transparent !important; border: 0 !important; }
.cf-divicon > svg { display: block; cursor: pointer; transition: transform 200ms cubic-bezier(.4,0,.2,1); transform-origin: 50% 90%; }
.cf-divicon:hover > svg { transform: translateY(-3px) scale(1.08); }
.cf-divicon.is-active > svg { transform: translateY(-2px) scale(1.12); }

/* ============================================================
   PAGE CHROME (nav + footer to show this is a real plugin section)
   ============================================================ */
.pg-nav {
  position: relative;
  z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 40px;
  background: var(--cf-ink);
  color: #fff;
}
.pg-logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: #fff;
  text-decoration: none;
}
.pg-logo-badge {
  background: var(--cf-red);
  padding: 3px 8px;
  font-size: 10px;
  letter-spacing: 0.04em;
  border-radius: 4px;
  font-weight: 700;
}
.pg-nav-links {
  display: flex; gap: 32px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}
.pg-nav-links a { text-decoration: none; transition: color 160ms; }
.pg-nav-links a:hover { color: #fff; }

.pg-footer {
  padding: 28px 40px;
  background: var(--cf-ink);
  color: rgba(255,255,255,0.55);
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex; justify-content: space-between; align-items: center;
}

/* ============================================================
   MOBILE / RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  :root { --map-h: 720px; }
  .cf-fpanel { width: 360px; left: 20px; }
}

@media (max-width: 720px) {
  :root { --map-h: 100svh; }

  /* Page chrome */
  .pg-nav { padding: 14px 18px; }
  .pg-nav-links { display: none; }
  .pg-footer { padding: 18px 18px; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 10.5px; }

  /* Section + header */
  .cf-section { padding: 0; }
  .cf-head { padding: 36px 0 24px; }
  .cf-h2 { font-size: clamp(28px, 7vw, 38px); margin-bottom: 14px; }
  .cf-lede { font-size: 14.5px; }
  .cf-metrics { grid-template-columns: 1fr 1fr; }
  .cf-metric { padding: 16px 14px 14px; }
  .cf-metric-num { font-size: 24px; }

  /* Switcher tabs — compact, no icons, smaller */
  .cf-switch-inner { padding: 0 16px; overflow-x: auto; }
  .cf-tab {
    padding: 14px 4px;
    margin-right: 18px;
    font-size: 13px;
    gap: 7px;
  }
  .cf-tab svg { width: 14px; height: 14px; }
  .cf-tab-count { font-size: 10px; min-width: 18px; padding: 1px 6px; }

  /* Map band: fill viewport minus tab strip */
  .cf-map-band {
    height: calc(100svh - 54px);
    min-height: 720px;
  }

  /* Bottom-sheet panel */
  .cf-fpanel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: 54svh;
    z-index: 1000;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px -12px rgba(15,13,14,0.22), 0 0 0 1px rgba(15,13,14,0.06);
    animation: cfSheetIn 320ms cubic-bezier(.2,.7,.2,1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .cf-section.cf-tone-dark .cf-fpanel {
    box-shadow: 0 -12px 40px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
  }
  @keyframes cfSheetIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  /* drag handle */
  .cf-fpanel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(15,13,14,0.18);
    z-index: 20;
    pointer-events: none;
  }
  .cf-section.cf-tone-dark .cf-fpanel::before { background: rgba(255,255,255,0.22); }

  .cf-fpanel-head {
    padding: 22px 18px 14px;
  }
  .cf-fpanel-title { font-size: 18px; }
  .cf-fpanel-sub { font-size: 11.5px; }

  .cf-fpanel-foot { padding: 10px 18px; font-size: 10px; }

  /* List items */
  .cf-list { padding: 4px; }
  .cf-list-item { padding: 9px 10px; gap: 10px; grid-template-columns: 48px 1fr auto; }
  .cf-list-avatar { width: 48px; height: 48px; font-size: 14px; }
  .cf-list-hosp-photo { width: 48px; height: 48px; border-radius: 11px; }
  .cf-list-hosp-photo-icon svg { width: 20px; height: 20px; }
  .cf-list-hosp-photo-tag { font-size: 7px; bottom: 2px; }
  .cf-list-name { font-size: 13.5px; }
  .cf-list-meta { font-size: 10px; }
  .cf-list-amount { font-size: 13px; }

  /* Person detail — shorter photo so the sheet stays usable */
  .cf-photo { aspect-ratio: 16 / 10; }
  .cf-photo-initials { font-size: 78px; }
  .cf-photo-name { font-size: 22px; }
  .cf-photo-city { font-size: 10px; margin-bottom: 6px; }
  .cf-photo-meta { left: 18px; right: 18px; bottom: 16px; }
  .cf-photo-tag { top: 12px; right: 12px; padding: 5px 10px; font-size: 9.5px; }
  .cf-fpanel-detail--person .cf-back { margin: 14px 18px 10px; }

  .cf-tags-row { padding: 14px 18px 0; }
  .cf-detail-story { margin: 10px 18px 0; font-size: 13.5px; line-height: 1.5; }
  .cf-fpanel-detail--person .cf-progress-block { margin: 16px 18px 0; }
  .cf-amount-card { margin: 14px 18px 0; padding: 14px 16px; }
  .cf-amount-val { font-size: 18px; }
  .cf-fpanel-detail--person .cf-ipop-cta { margin: 14px 18px 20px; width: calc(100% - 36px); padding: 11px 14px; font-size: 12.5px; }

  /* Hospital detail */
  .cf-fpanel-detail { padding: 18px 18px 22px; }
  .cf-hosp-name { font-size: 18px; }
  .cf-tl-label { font-size: 13px; }

  /* Legend — moves to top-left so it doesn't collide with the sheet */
  .cf-legend,
  .cf-legend-right {
    bottom: auto;
    top: 12px;
    left: 12px;
    right: auto;
    padding: 8px 10px;
    font-size: 9.5px;
    min-width: 0;
    max-width: 65%;
    gap: 6px;
  }
  .cf-legend-title { font-size: 8.5px; }
  .cf-legend-dot { width: 8px; height: 8px; }

  /* Leaflet zoom controls smaller and top-right so they don't overlap the legend */
  .leaflet-control-zoom {
    margin: 12px 12px 0 0 !important;
  }
  .leaflet-top.leaflet-left { left: auto !important; right: 0 !important; }
  .leaflet-control-zoom a { width: 32px !important; height: 32px !important; line-height: 32px !important; font-size: 16px !important; }

  /* Attribution at the very bottom — hidden by the sheet, but keep accessible if no sheet open */
  .leaflet-control-attribution { font-size: 8.5px !important; padding: 2px 8px !important; }
}

@media (max-width: 380px) {
  .cf-tab { font-size: 12px; margin-right: 14px; }
  .cf-tab span:not(.cf-tab-count) { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cf-fpanel-title { font-size: 17px; }
  .cf-list-name { font-size: 13px; }
  .cf-list-meta { font-size: 9.5px; }
}

/* ============================================================
   PERSON DETAIL VIEW (in left panel)
   ============================================================ */
.cf-fpanel-detail--person { padding: 0; }
.cf-fpanel-detail--person .cf-back {
  margin: 18px 22px 14px;
}

/* Photo placeholder area — replace with <img> when real photo exists */
.cf-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #f0e5e6;
}
.cf-photo-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #f5cdd4 0%, #ed8b9c 45%, #7c3540 100%);
}
.cf-photo-stripes {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg,
    rgba(255,255,255,0.18) 0 14px,
    rgba(255,255,255,0) 14px 28px);
  opacity: 0.8;
}
.cf-photo-initials {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 110px;
  letter-spacing: -0.05em;
  color: rgba(255,255,255,0.5);
  text-shadow: 0 8px 28px rgba(0,0,0,0.18);
  z-index: 1;
}
.cf-photo-fade {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 60%;
  background: linear-gradient(180deg, transparent, rgba(15,13,14,0.78));
  z-index: 2;
}
.cf-photo-meta {
  position: absolute; left: 22px; right: 22px; bottom: 20px;
  z-index: 3;
  color: #fff;
}
.cf-photo-city {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  margin-bottom: 8px;
}
.cf-photo-city .cf-hosp-city-dot { background: #fff; }
.cf-photo-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: 0px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.4);
}
.cf-photo-tag {
  position: absolute; top: 16px; right: 16px;
  z-index: 3;
  padding: 6px 12px;
  background: rgba(255,255,255,0.96);
  color: var(--cf-green);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  backdrop-filter: blur(8px);
}
.cf-photo-tag::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
}

/* Tags row & chip */
.cf-tags-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 18px 22px 0;
}
.cf-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: var(--cf-red-softer);
  color: var(--cf-red);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cf-section.cf-tone-dark .cf-chip { background: rgba(225,30,54,0.18); }
.cf-chip svg { flex-shrink: 0; }

.cf-detail-story {
  margin: 14px 22px 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--cf-text);
}

.cf-fpanel-detail--person .cf-progress-block {
  margin: 22px 22px 0;
}
.cf-progress-val--done {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--cf-green) !important;
}
.cf-progress-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--cf-green);
}
.cf-progress-check svg { width: 11px; height: 11px; }
.cf-progress-fill--done {
  background: linear-gradient(90deg, var(--cf-green), #2cb678) !important;
}

/* Amount card */
.cf-amount-card {
  margin: 18px 22px 0;
  padding: 18px 20px;
  background: var(--cf-cream);
  border-radius: 14px;
  display: flex; justify-content: space-between; align-items: flex-end;
}
.cf-section.cf-tone-dark .cf-amount-card { background: rgba(255,255,255,0.04); }
.cf-amount-lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cf-text-2);
}
.cf-amount-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--cf-ink);
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: baseline; gap: 6px;
}
.cf-section.cf-tone-dark .cf-amount-val { color: #fff; }
.cf-amount-unit {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--cf-red);
  letter-spacing: 0.04em;
}

.cf-fpanel-detail--person .cf-ipop-cta {
  margin: 18px 22px 22px;
  width: calc(100% - 44px);
}

/* ============================================================
   FEATURED IMAGE w detalu podopiecznego (dodane przy integracji WP)
   ============================================================ */
.cf-photo-img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  display: block;
  z-index: 1;
}
.cf-photo-img + .cf-photo-fade { z-index: 2; }
