/* ════════════════════════════════════════════════
   Radar de Futuros 2.0 — Sicredi Pioneira
   Design tokens from Pioneira Design System V3
════════════════════════════════════════════════ */
:root {
  /* DS V3 color tokens */
  --primary:        #3FA110;   /* container-primary */
  --primary-dark:   #146E37;   /* content-surface-heading */
  --primary-soft:   #EAF5E0;
  --ink:            #323C32;   /* content-surface-high */
  --ink-2:          #4E5B4E;   /* content-surface-medium */
  --ink-3:          #8A968A;
  --surface:        #FDFDFD;   /* container-surface */
  --bg:             #F4F6F3;
  --rule:           #E2E7E0;

  /* radar canvas (dark "night sky" disc — benchmark convention) */
  --canvas-0:       #0C1A10;
  --canvas-1:       #0A140C;

  /* ring (ação) colors */
  --agir:      #16A34A;
  --preparar:  #CA8A04;
  --observar:  #64748B;

  --font-display: 'Exo 2', 'Helvetica Neue', sans-serif;
  --font-body:    'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --nav-h: 60px;
  --side-w: 288px;
  --list-w: 340px;
  --radius: 12px;
  --shadow: 0 6px 28px rgba(20,110,55,.10);
}

/* ── DARK THEME ──
   Re-point the shared tokens so the whole shell (sidebars, lists, chips,
   drawer) adapts, not just the radar. The header opts out: it uses a literal
   green, so it stays identical in both themes. */
body.theme-dark {
  --primary-dark:   #7FC65B;   /* brighter green for accent TEXT on dark surfaces */
  --primary-soft:   rgba(127,198,91,.15);
  --ink:            #E8F0E8;
  --ink-2:          #AEBCAE;
  --ink-3:          #7B897B;
  --surface:        #0F1A12;
  --bg:             #0A140C;
  --rule:           rgba(255,255,255,.10);
  --shadow:         0 8px 30px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }

/* mobile-only elements — hidden on desktop, revealed in the ≤640px block */
.mobilebar, .fab-filtros, .sheet-head, .drawer-handle, .legend-caret, .touch-hint, .browse { display: none; }
/* legend title is a <button> now; neutralize button chrome on desktop */
.legend-title { background: none; border: 0; width: 100%; text-align: left; cursor: default; font: inherit; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ═══════════ NAVBAR ═══════════ */
.navbar {
  height: var(--nav-h);
  display: flex; align-items: center; gap: 28px;
  padding: 0 22px;
  background: #146E37;   /* literal — header stays identical across themes */
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; }
.brand-mark svg { fill: none; stroke: rgba(255,255,255,.9); stroke-width: 1.4; display: block; }
.brand-text {
  font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1;
  display: flex; flex-direction: column; gap: 3px;
}
.brand-text small { font-family: var(--font-body); font-weight: 500; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .72; }

.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  font-family: var(--font-display); font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.78); text-decoration: none;
  padding: 7px 13px; border-radius: 8px; transition: background .15s, color .15s;
}
.nav-links a:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-links a.active { background: rgba(255,255,255,.16); color: #fff; }

.ghost-btn {
  margin-left: auto;
  font-family: var(--font-display); font-size: 12px; font-weight: 500;
  letter-spacing: .04em;
  color: #fff; background: transparent;
  border: 1px solid rgba(255,255,255,.32); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; transition: background .15s, border-color .15s;
}
.ghost-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.55); }

.theme-toggle {
  width: 38px; height: 38px; flex-shrink: 0; margin-left: auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px; color: #fff; font-size: 16px; cursor: pointer; transition: background .15s;
}
.theme-toggle:hover { background: rgba(255,255,255,.2); }
.theme-toggle .ico-sun { display: none; }
.theme-toggle .ico-moon { display: inline; }
body.theme-dark .theme-toggle .ico-sun { display: inline; }
body.theme-dark .theme-toggle .ico-moon { display: none; }

/* ═══════════ APP SHELL ═══════════ */
.app { display: flex; height: calc(100vh - var(--nav-h)); }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--side-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  position: relative; z-index: 20;
}
.sidebar-scroll { height: 100%; overflow-y: auto; padding: 18px 18px 40px; }
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 8px; }

.filter-group { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.filter-group:last-child { border-bottom: none; }
.search-group { padding-top: 2px; }

.filter-label {
  font-family: var(--font-display); font-size: 10px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 11px; display: flex; align-items: center; gap: 8px;
}
.filter-label .hint {
  font-size: 9px; letter-spacing: .1em; color: var(--ink-3);
  background: var(--bg); border: 1px solid var(--rule); border-radius: 4px; padding: 2px 6px;
}
.filter-label .val { margin-left: auto; color: var(--primary-dark); font-weight: 600; letter-spacing: .04em; }

/* search */
.search-wrap { display: flex; align-items: center; gap: 9px; background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; padding: 0 12px; transition: border-color .15s; }
.search-wrap:focus-within { border-color: var(--primary); }
.search-ico { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--ink-3); stroke-width: 2; }
#search { flex: 1; border: 0; background: transparent; outline: none; font-family: var(--font-body); font-size: 14px; color: var(--ink); padding: 10px 0; }
.counter-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.counter { font-size: 12px; color: var(--ink-2); }
.counter strong { color: var(--primary-dark); font-weight: 700; }
.reset-btn { font-family: var(--font-display); font-size: 11px; font-weight: 500; color: var(--ink-2); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px; cursor: pointer; transition: all .15s; }
.reset-btn:hover { border-color: var(--primary); color: var(--primary-dark); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; transition: all .14s; user-select: none;
}
.chip:hover { border-color: var(--ink-3); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.chips-mega .chip { font-size: 12px; padding: 5px 11px; }
/* shared signal-type marker — sized per context, color via currentColor */
.tipo-mark { flex-shrink: 0; display: block; }
.chip .tipo-mark { width: 13px; height: 13px; color: var(--ink-3); }
.chip.active .tipo-mark { color: var(--primary); }
.pill-mini .tipo-mark { width: 9px; height: 9px; }

/* range */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--rule); outline: none; cursor: pointer; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); cursor: pointer; }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; cursor: pointer; }
.range-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.range-row:last-child { margin-bottom: 0; }
.range-cap { font-size: 11px; color: var(--ink-2); width: 40px; flex-shrink: 0; }
.range-row .val { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--primary-dark); width: 26px; text-align: right; flex-shrink: 0; }

/* ── STAGE / CANVAS ── */
/* light is the default theme; dark is opt-in via body.theme-dark */
.stage { position: relative; flex: 1; overflow: hidden; background: radial-gradient(circle at 50% 45%, #ffffff 0%, #eef3ea 58%, #e4ece0 100%); }
body.theme-dark .stage { background: radial-gradient(circle at 50% 45%, #11241a 0%, var(--canvas-0) 55%, var(--canvas-1) 100%); }
#radar { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#radar.grabbing { cursor: grabbing; }

.zoom-ctrl { position: absolute; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.zoom-ctrl button {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.78); backdrop-filter: blur(8px);
  border: 1px solid var(--rule); color: var(--ink);
  font-size: 18px; cursor: pointer; transition: background .15s; line-height: 1;
}
.zoom-ctrl button:hover { background: #fff; border-color: var(--primary); color: var(--primary-dark); }
body.theme-dark .zoom-ctrl button { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.18); color: #fff; }
body.theme-dark .zoom-ctrl button:hover { background: rgba(255,255,255,.20); }

/* legend */
.legend {
  position: absolute; left: 18px; bottom: 18px; z-index: 5;
  width: 210px; padding: 15px 16px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink); box-shadow: var(--shadow);
}
body.theme-dark .legend { background: rgba(10,20,12,.62); border-color: rgba(255,255,255,.12); color: #E8F0E8; box-shadow: none; }
.legend-title { font-family: var(--font-display); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.legend-block { margin-bottom: 12px; }
.legend-block:last-child { margin-bottom: 0; }
.legend-h { display: block; font-family: var(--font-display); font-size: 11px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.legend-block small { font-size: 11px; color: var(--ink-3); line-height: 1.4; }
.legend-rings { display: flex; flex-direction: column; gap: 5px; margin-bottom: 5px; }
.legend-rings span { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.r-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.r-dot.agir { background: var(--agir); }
.r-dot.preparar { background: var(--preparar); }
.r-dot.observar { background: var(--observar); }
.legend-types { display: flex; flex-direction: column; gap: 6px; }
.legend-types span { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.legend-types .tipo-mark { width: 14px; height: 14px; }
.legend-size { display: flex; align-items: center; gap: 7px; }
.legend-size small { font-size: 11px; color: var(--ink-3); margin-left: 2px; }
.legend-size .ls-dot { border-radius: 50%; background: currentColor; color: var(--ink-2); flex-shrink: 0; }
.legend-size .s-lg { width: 12px; height: 12px; }
.legend-size .s-md { width: 9px; height: 9px; }
.legend-size .s-sm { width: 6px; height: 6px; }
body.theme-dark .legend-size .ls-dot { color: rgba(255,255,255,.85); }
body.theme-dark .legend-title, body.theme-dark .legend-block small { color: rgba(255,255,255,.55); }
body.theme-dark .legend-h { color: #fff; }
body.theme-dark .legend-rings span, body.theme-dark .legend-types span { color: rgba(255,255,255,.85); }

/* tooltip */
.tooltip {
  position: absolute; z-index: 8; pointer-events: none;
  max-width: 240px; padding: 9px 12px;
  background: rgba(10,20,12,.92); border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  transform: translate(-50%, calc(-100% - 14px));
}
/* no modo "passar sinais" o card é tocável (recebe o botão "+ detalhes") */
.tooltip.interactive { pointer-events: auto; }
.tt-cta {
  display: block; width: 100%; margin-top: 9px;
  font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: #fff; background: var(--primary); border: 0; border-radius: 8px;
  padding: 8px 10px; cursor: pointer;
}
.tt-cta:active { background: #2f7c0c; }
/* selected-signal callout pin — crisp HTML card pinned above the dot */
.sig-pin {
  position: absolute; z-index: 7; pointer-events: none;
  display: flex; align-items: center; gap: 8px; max-width: 232px;
  padding: 8px 13px;
  background: rgba(10,20,12,.92); color: #fff;
  border: 1px solid rgba(255,255,255,.14); border-radius: 11px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  font-family: var(--font-display); font-weight: 600; font-size: 12.5px; line-height: 1.3;
  transform: translate(-50%, -100%);
}
.sig-pin.below { transform: translate(-50%, 0); }
.sig-pin .pin-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.sig-pin .pin-txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sig-pin::after {
  content: ''; position: absolute; left: 50%; bottom: -6px;
  width: 11px; height: 11px; transform: translateX(-50%) rotate(45deg);
  background: rgba(10,20,12,.92); border-right: 1px solid rgba(255,255,255,.14); border-bottom: 1px solid rgba(255,255,255,.14);
}
.sig-pin.below::after {
  bottom: auto; top: -6px;
  border: 0; border-left: 1px solid rgba(255,255,255,.14); border-top: 1px solid rgba(255,255,255,.14);
}

.tooltip .tt-mega { font-family: var(--font-display); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.tooltip .tt-title { font-size: 13px; font-weight: 700; line-height: 1.25; margin-bottom: 5px; }
/* mini pills — shared by tooltip card and list rows */
.pill-row { display: flex; flex-wrap: wrap; gap: 5px; }
.pill-mini {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-display); font-size: 10px; font-weight: 500; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px; line-height: 1.6; white-space: nowrap;
}
.pill-mini .pdot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.tooltip .pill-row { margin-top: 6px; }
.tooltip .pill-mini { background: rgba(255,255,255,.13); color: #fff; border: 1px solid rgba(255,255,255,.16); }
.srow-main .pill-row { margin-top: 5px; }
.srow .pill-mini { background: var(--bg); color: var(--ink-2); border: 1px solid var(--rule); }
.srow.active .pill-mini { background: var(--surface); }

/* ── SIGNALS LIST (right column) ── */
.listpanel {
  width: var(--list-w, 340px); flex-shrink: 0;
  background: var(--surface); border-left: 1px solid var(--rule);
  display: flex; flex-direction: column; position: relative; z-index: 20;
}
.listpanel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--rule); flex-shrink: 0;
}
.lp-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--ink); }
.lp-count { font-size: 12px; color: var(--ink-2); }
.lp-count strong { color: var(--primary-dark); font-weight: 700; }

/* explicit sort control — update-recency only, with invert (per client) */
.listpanel-sort {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 18px; border-bottom: 1px solid var(--rule); flex-shrink: 0; background: var(--bg);
}
.sort-label { font-size: 11px; color: var(--ink-3); }
.sort-label strong { color: var(--ink-2); font-weight: 600; }
.sort-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 11px; font-weight: 500; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  padding: 4px 10px; cursor: pointer; transition: border-color .15s, color .15s;
}
.sort-toggle:hover { border-color: var(--primary); color: var(--primary-dark); }
.sort-caret { font-size: 12px; line-height: 1; }

/* recency badge on list rows */
.rec-badge {
  flex-shrink: 0; margin-left: 8px;
  font-family: var(--font-display); font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; line-height: 1.5;
  background: var(--bg); color: var(--ink-3); border: 1px solid var(--rule);
}
.rec-badge.fresh { background: var(--primary-soft); color: var(--primary-dark); border-color: rgba(63,161,16,.35); }
.rec-badge.old { opacity: .65; }

.srow-row1 { display: flex; align-items: flex-start; }
.srow-row1 .srow-title { flex: 1; min-width: 0; }

.list-scroll { flex: 1; overflow-y: auto; padding: 2px 0; }
.list-scroll::-webkit-scrollbar { width: 8px; }
.list-scroll::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 8px; }

/* quiet hairline dividers at rest; hover/active provide the "card" lift */
.srow {
  position: relative;
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  padding: 11px 16px 11px 18px; border: 0; border-bottom: 1px solid var(--rule);
  background: transparent; cursor: pointer; text-align: left; font-family: inherit;
  transition: background .12s;
}
.srow:last-child { border-bottom: none; }
.srow:hover, .srow.hover { background: var(--bg); }
.srow.active { background: var(--primary-soft); border-bottom-color: transparent; box-shadow: inset -3px 0 0 var(--primary); }
/* bold full-height megatendência accent bar on the left edge (per Figma 13:215) */
.srow::after { content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 4px; background: var(--srow-accent, var(--ink-3)); }
.srow-main { flex: 1; min-width: 0; }
.srow-title { display: block; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-meta { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ═══════════ DRAWER ═══════════ */
/* scrim dims ONLY the list column, never the radar (detail never covers the map) */
.drawer-scrim { position: fixed; top: var(--nav-h); right: 0; bottom: 0; width: 480px; max-width: 92vw; background: rgba(12,26,16,.04); z-index: 40; }
.drawer {
  position: fixed; top: var(--nav-h); right: 0; bottom: 0;
  width: 480px; max-width: 92vw; z-index: 50;
  background: var(--surface);
  border-left: 1px solid var(--rule);
  box-shadow: -12px 0 42px rgba(12,26,16,.16);
  display: flex; flex-direction: column;
  animation: slideIn .26s cubic-bezier(.22,.61,.36,1);
}
@keyframes slideIn { from { transform: translateX(100%); } }
.drawer-nav {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule); flex-shrink: 0;
}
.dn-btn, .dn-close {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink-2); font-size: 18px; cursor: pointer; transition: all .15s; line-height: 1;
}
.dn-btn:hover, .dn-close:hover { border-color: var(--primary); color: var(--primary-dark); }
.dn-count { font-family: var(--font-display); font-size: 12px; color: var(--ink-3); }
.dn-close { margin-left: auto; }
/* botão Imprimir: ícone de impressora + rótulo, pra ficar evidente */
.dn-print { width: auto; gap: 7px; padding: 0 12px; display: inline-flex; align-items: center; margin-left: auto; }
.dn-print svg { display: block; }
.dn-print + .dn-close { margin-left: 8px; }
.dn-print-label { font-family: var(--font-display); font-size: 12px; font-weight: 600; }
.drawer-body { overflow-y: auto; padding: 0 0 40px; flex: 1; }

/* drawer content */
.d-hero { height: 168px; position: relative; background: linear-gradient(135deg, #11241a, #0a140c); display: flex; align-items: flex-end; overflow: hidden; }
.d-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.d-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(10,20,12,.85)); }
/* bold full-height megatendência accent bar on the left edge (same as the cards) */
.d-hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--hero-accent, var(--primary)); z-index: 3; }
.d-hero-mega { position: relative; z-index: 2; padding: 14px 22px; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #fff; }

.d-section { padding: 20px 22px; border-bottom: 1px solid var(--rule); }
.d-section:last-child { border-bottom: none; }
.d-title { font-family: var(--font-display); font-weight: 600; font-size: 23px; line-height: 1.2; color: var(--ink); margin-bottom: 14px; }
.d-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); }
.badge.ring-agir { background: rgba(22,163,74,.12); color: var(--agir); border-color: rgba(22,163,74,.3); }
.badge.ring-preparar { background: rgba(202,138,4,.12); color: var(--preparar); border-color: rgba(202,138,4,.3); }
.badge.ring-observar { background: rgba(100,116,139,.12); color: var(--observar); border-color: rgba(100,116,139,.3); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge .tipo-mark { width: 11px; height: 11px; }
/* badges de Tipo/Ação clicáveis → abrem a justificativa num popover ancorado */
.badge-just { cursor: pointer; background: var(--surface); transition: border-color .14s, box-shadow .14s; }
.badge-just .b-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 4px; border-radius: 50%;
  font-size: 9px; font-weight: 800; line-height: 1;
  border: 1px solid currentColor; opacity: .85;
}
.badge-just:hover { border-color: currentColor; }
.badge-just:hover .b-help { opacity: 1; }
.badge-just.pop-open { box-shadow: 0 0 0 2px var(--primary-soft); border-color: var(--primary); }
.badge-just.pop-open .b-help { opacity: 1; }

.d-h { font-family: var(--font-display); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.d-h .d-h-tag { font-size: 9px; font-weight: 500; letter-spacing: .1em; color: var(--ink-3); background: var(--bg); border: 1px solid var(--rule); border-radius: 4px; padding: 2px 6px; }
/* ícone "?" de info por campo */
.info-i {
  width: 16px; height: 16px; flex-shrink: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 10px; font-weight: 700; line-height: 1;
  color: var(--ink-3); background: var(--bg); border: 1px solid var(--rule); border-radius: 50%;
  text-transform: none; letter-spacing: 0; transition: all .14s;
}
.info-i:hover { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-soft); }
/* popover de info — fixo, acima de tudo, claro nos dois temas */
.info-pop {
  position: fixed; z-index: 80; max-width: 284px;
  padding: 11px 13px; border-radius: 10px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--rule);
  box-shadow: 0 10px 30px rgba(12,26,16,.22);
  font-family: var(--font-body); font-size: 12.5px; font-weight: 400; line-height: 1.55;
  letter-spacing: 0; text-transform: none;
}
.info-pop strong { color: var(--ink); font-weight: 700; }
.info-pop b { color: var(--ink); font-weight: 600; }
.d-desc { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }

/* metric bars */
.metric { margin-bottom: 14px; }
.metric:last-child { margin-bottom: 0; }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.metric-head .m-label { font-size: 12px; color: var(--ink-2); }
.metric-head .m-val { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--ink); }
.seg-track { display: flex; gap: 3px; }
.seg { flex: 1; height: 7px; border-radius: 3px; background: var(--rule); }
.seg.on { background: var(--primary); }
.seg.on.cp, .seg.on.mp { background: var(--primary); }   /* chance: mesma cor (verde) p/ CP e MP */
.trl-track { display: flex; align-items: flex-end; gap: 3px; height: 46px; }
.trl-bar { flex: 1; border-radius: 3px 3px 0 0; background: var(--rule); }
.trl-bar.on { background: linear-gradient(180deg, var(--primary), var(--primary-dark)); }

/* impacto na região — horizontal value bars (page-native style) */
.bar-track { height: 8px; border-radius: 5px; background: var(--rule); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.m-max { color: var(--ink-3); font-weight: 500; }

/* inovação × engajamento — 2×2 quadrant plot */
.quad-plot {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 230px;
  border: 1px solid var(--rule); border-radius: 12px; background-color: var(--bg);
  background-image: linear-gradient(var(--rule), var(--rule)), linear-gradient(var(--rule), var(--rule));
  background-size: 100% 1px, 1px 100%; background-position: center; background-repeat: no-repeat;
  margin: 4px 0 14px;
}
.quad-xlab, .quad-ylab { position: absolute; font-family: var(--font-display); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.quad-ylab { top: 9px; left: 11px; }
.quad-xlab { bottom: 9px; right: 11px; }
.quad-point {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--surface);
  box-shadow: 0 0 0 5px rgba(63,161,16,.16); transform: translate(-50%, 50%);
}
.quad-vals { display: flex; gap: 18px; font-size: 12.5px; color: var(--ink-2); }
.quad-vals strong { font-family: var(--font-display); color: var(--ink); font-weight: 700; margin-left: 3px; }
.quad-vals .qv-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 7px; vertical-align: middle; }

/* relations (2.0 network) */
.rel-group { margin-bottom: 18px; }
.rel-group:last-child { margin-bottom: 0; }
.rel-group + .rel-group { border-top: 1px solid var(--rule); padding-top: 18px; }
.rel-kind { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.rel-kind .rel-kind-lbl { min-width: 0; }
.rel-kind .ico { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rel-kind .ico .rel-ico-svg { width: 17px; height: 17px; display: block; }
.rel-kind.impulsiona .ico { background: rgba(22,163,74,.14); color: #16A34A; }
.rel-kind.tensiona .ico { background: rgba(214,74,57,.16); color: #D64A39; }
.rel-kind.desdobra .ico { background: rgba(14,165,233,.14); color: #0EA5E9; }
/* amostra da linha que aparece no radar — liga a categoria do drawer ao conector */
.rel-swatch { width: 34px; height: 8px; flex-shrink: 0; margin-left: auto; }
.rel-list { display: flex; flex-direction: column; gap: 6px; }
.rel-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px 9px 15px; border: 1px solid var(--rule); border-radius: 9px; background: var(--surface); cursor: pointer; transition: all .14s; text-align: left; width: 100%; font-family: inherit; box-shadow: inset 4px 0 0 var(--rel-accent, var(--ink-3)); }
.rel-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.rel-item .rel-name { font-size: 13px; color: var(--ink); font-weight: 500; line-height: 1.3; }
.rel-item .rel-arrow { margin-left: auto; color: var(--ink-3); font-size: 14px; }
.rel-illus { font-size: 11px; font-style: italic; color: var(--ink-3); margin-top: 4px; }

/* links + timeline */
.link-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.link-list a { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--primary-dark); text-decoration: none; line-height: 1.4; }
.link-list a:hover { text-decoration: underline; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--rule); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot { position: absolute; left: -22px; top: 2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.tl-dot.create { background: var(--primary); }
.tl-dot.change { background: var(--ink-3); }
.tl-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tl-date { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--ink); }
.tl-field { font-family: var(--font-display); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--bg); border: 1px solid var(--rule); color: var(--ink-2); }
.tl-field.is-create { background: var(--primary-soft); border-color: rgba(63,161,16,.3); color: var(--primary-dark); }
.tl-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.tl-desc b { color: var(--ink); font-weight: 700; }

.committee { font-size: 14px; line-height: 1.65; color: var(--ink-2); background: var(--primary-soft); border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0; padding: 14px 16px; }

/* texto renderizado de markdown (descrição, análises, justificativas) */
.md-text { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.md-text > :first-child { margin-top: 0; }
.md-text > :last-child { margin-bottom: 0; }
.md-text p { margin: 0 0 9px; }
.md-text ul, .md-text ol { margin: 6px 0 9px; padding-left: 20px; }
.md-text li { margin-bottom: 4px; }
.md-text strong { color: var(--ink); font-weight: 700; }
.md-text em { font-style: italic; }
.md-text a { color: var(--primary-dark); text-decoration: underline; }
.md-text code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: var(--bg); border: 1px solid var(--rule); padding: 1px 5px; border-radius: 5px; }
.committee.md-text { font-size: 14px; }
/* acentos sutis: oportunidades (positivo) e ameaças (negativo) */
.md-pos li::marker { color: var(--primary); }
.md-neg li::marker { color: #D64A39; }

/* justificativa recolhível ("por quê?") */
.just-stack { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.metric .just { margin-top: 8px; }
.just > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--primary-dark); width: fit-content;
}
.just > summary::-webkit-details-marker { display: none; }
.just > summary::before { content: '▸'; font-size: 9px; transition: transform .15s; }
.just[open] > summary::before { transform: rotate(90deg); }
.just-body { margin-top: 7px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--rule); border-radius: 8px; font-size: 13px; line-height: 1.55; }
.just-body.md-text { color: var(--ink-2); }
/* box de justificativa SEMPRE aberto (chance de ocorrência) */
.just-box { margin-top: 9px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--rule); border-radius: 8px; font-size: 13px; line-height: 1.55; color: var(--ink-2); }

/* cards Oportunidades (verde) × Ameaças (vermelho), lado a lado */
.oa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.oa-card { border-radius: 10px; padding: 12px 14px; border: 1px solid; }
.oa-head { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; margin-bottom: 9px; }
.oa-ico { width: 15px; height: 15px; flex-shrink: 0; }
.oa-pos { background: rgba(22,163,74,.08); border-color: rgba(22,163,74,.30); }
.oa-pos .oa-head { color: var(--primary-dark); }
.oa-neg { background: rgba(214,74,57,.08); border-color: rgba(214,74,57,.30); }
.oa-neg .oa-head { color: #B23A2E; }
body.theme-dark .oa-neg .oa-head { color: #F08C7E; }
.oa-card .md-text { font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.oa-card .md-text ul { margin: 0; padding-left: 16px; }
.oa-card .md-text li { margin-bottom: 5px; }

/* ═══════════ RESPONSIVE — works down to 1366×600 ═══════════ */
@media (max-height: 720px) {
  :root { --nav-h: 52px; }
  .legend { padding: 11px 13px; width: 188px; }
  .legend-block { margin-bottom: 9px; }
}
@media (max-width: 1280px) {
  :root { --list-w: 300px; }
}
@media (max-width: 1140px) {
  :root { --side-w: 248px; }
  .listpanel { display: none; }   /* protect the radar on small widths; drawer still works */
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .sidebar { position: absolute; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
}

/* ═══════════ PRINT / EXPORT (A4) — only the selected signal ═══════════ */
@media print {
  @page { size: A4; margin: 14mm; }
  html, body { height: auto; overflow: visible; background: #fff; }
  /* hide everything that isn't the signal detail */
  .navbar, .sidebar, .stage, .listpanel, .drawer-scrim, .drawer-nav,
  .zoom-ctrl, .legend, .tooltip, .sig-pin { display: none !important; }

  .app { display: block; height: auto; }
  /* the drawer becomes the printed document */
  .drawer {
    position: static !important; width: 100% !important; max-width: 100% !important;
    box-shadow: none !important; border: 0 !important; animation: none !important;
    display: block !important; height: auto !important;
  }
  .drawer[hidden] { display: none !important; }
  .drawer-body { overflow: visible !important; height: auto !important; padding: 0 !important; }
  /* justificativas recolhíveis: imprimir sempre abertas */
  .just-body { display: block !important; }
  .just > summary::before { display: none; }

  /* print background colors / gradients faithfully */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  .d-hero { height: 120px; }
  .d-section { border-bottom: 1px solid #d8ddd6; padding: 14px 0; break-inside: avoid; }
  .rel-group, .metric, .chart-box, .committee, .tl-item { break-inside: avoid; }
  .chart-box { border: 1px solid #d8ddd6; }
  .rel-item { border: 1px solid #d8ddd6 !important; }
  .rel-arrow { display: none; }
  /* a quiet footer line on every printed page */
  .drawer-body::after {
    content: 'Radar de Futuros 2.0 · Sicredi Pioneira';
    display: block; margin-top: 16px; padding-top: 10px; border-top: 1px solid #d8ddd6;
    font-family: 'Exo 2', sans-serif; font-size: 10px; letter-spacing: .1em;
    text-transform: uppercase; color: #9CAA9C;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE (≤640px) — radar em tela cheia + toggle Radar/Lista,
   filtros e detalhe em bottom sheets. Desktop intacto.
═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  :root { --mbar-h: 46px; }

  /* navbar compacta */
  .navbar { gap: 12px; padding: 0 14px; }
  .brand-text { font-size: 15px; }
  .brand-text small { display: none; }
  .ghost-btn { display: none; }
  .theme-toggle { margin-left: auto; width: 34px; height: 34px; }

  /* ── toolbar mobile (toggle + contagem) ── */
  .mobilebar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: var(--mbar-h); padding: 0 12px;
    background: var(--surface); border-bottom: 1px solid var(--rule);
    position: relative; z-index: 22;
  }
  .vseg { display: inline-flex; flex: 0 0 auto; height: auto; background: var(--bg); border: 1px solid var(--rule); border-radius: 999px; padding: 3px; }
  .vseg-btn {
    font-family: var(--font-display); font-size: 13px; font-weight: 600; line-height: 1; color: var(--ink-2);
    background: transparent; border: 0; border-radius: 999px; padding: 8px 20px; cursor: pointer;
  }
  .vseg-btn.active { background: var(--primary); color: #fff; }
  .mobilebar-count { font-size: 12px; color: var(--ink-2); }
  .mobilebar-count strong { color: var(--primary-dark); font-weight: 700; }

  /* ── app vira coluna única; radar preenche ── */
  .app { display: block; position: relative; height: calc(100dvh - var(--nav-h) - var(--mbar-h)); }
  .stage { position: absolute; inset: 0; }

  /* ── legenda colapsável (chip no topo-esquerdo) ── */
  .legend {
    top: 12px; bottom: auto; left: 12px; width: auto; max-width: 200px; padding: 8px 12px;
  }
  .legend-title {
    display: flex; align-items: center; gap: 8px; justify-content: space-between;
    cursor: pointer; margin: 0;
  }
  .legend-caret { display: inline; transition: transform .2s; font-size: 11px; }
  .legend .legend-block { display: none; margin-top: 12px; }
  .legend.open .legend-block { display: block; }
  .legend.open .legend-title { margin-bottom: 2px; }
  .legend.open .legend-caret { transform: rotate(180deg); }

  /* ── browse control — mesmo padrão visual do chip "Como ler" ── */
  .browse {
    display: flex; align-items: center; gap: 2px;
    position: absolute; top: 12px; right: 12px; z-index: 6;
    background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
    border: 1px solid var(--rule); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 4px 6px;
  }
  body.theme-dark .browse { background: rgba(10,20,12,.62); border-color: rgba(255,255,255,.12); box-shadow: none; }
  .browse-btn {
    width: 24px; height: 24px; flex-shrink: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--ink-3); font-size: 16px; line-height: 1; cursor: pointer;
  }
  .browse-btn:active { color: var(--primary-dark); }
  body.theme-dark .browse-btn { color: rgba(255,255,255,.55); }
  .browse-name {
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    border: 0; background: transparent; cursor: pointer; padding: 0 2px;
    font-family: var(--font-display); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
  }
  body.theme-dark .browse-name { color: rgba(255,255,255,.55); }
  body.detail-open .browse { display: none !important; }

  /* ── botão flutuante Filtros ── */
  .fab-filtros {
    display: inline-flex; align-items: center; gap: 8px;
    position: absolute; left: 14px; bottom: 16px; z-index: 6;
    font-family: var(--font-display); font-size: 13px; font-weight: 600; color: #fff;
    background: var(--primary); border: 0; border-radius: 999px; padding: 11px 18px;
    box-shadow: 0 6px 20px rgba(20,110,55,.35); cursor: pointer;
  }
  .zoom-ctrl { bottom: 16px; right: 14px; }
  .zoom-ctrl button { width: 42px; height: 42px; }

  /* ── SIDEBAR vira bottom sheet de filtros ── */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; z-index: 60;
    max-height: 84vh; border-right: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 42px rgba(12,26,16,.28);
    transform: translateY(100%); transition: transform .3s cubic-bezier(.22,.61,.36,1);
    display: flex; flex-direction: column;
  }
  body.filters-open .sidebar { transform: translateY(0); }
  .sheet-head {
    display: flex; align-items: center; gap: 10px; position: relative;
    padding: 14px 16px 10px; border-bottom: 1px solid var(--rule); flex-shrink: 0;
  }
  .sheet-grab { position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 38px; height: 4px; border-radius: 4px; background: var(--rule); }
  .sheet-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--ink); }
  .sheet-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: 15px; cursor: pointer; }
  .sidebar .sidebar-scroll { padding: 8px 18px 28px; }

  /* scrim compartilhado dos sheets de filtro */
  .sheet-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(12,26,16,.34); }

  /* ── LISTA: tela cheia sobre o radar quando em modo Lista ── */
  .listpanel { display: none; }
  body.mview-list .stage,
  body.mview-list .fab-filtros,
  body.mview-list .legend,
  body.mview-list .zoom-ctrl { display: none !important; }
  body.mview-list .listpanel {
    display: flex; position: absolute; inset: 0; width: 100%; border-left: 0;
  }

  /* ── DRAWER vira bottom sheet (peek/full controlado por JS via transform) ── */
  .drawer-scrim { inset: var(--nav-h) 0 0 0; width: auto; max-width: none; background: rgba(12,26,16,.30); transition: background .25s; }
  /* em peek o radar fica visível e tocável acima do sheet */
  body.sheet-peek .drawer-scrim { background: transparent; pointer-events: none; }
  .drawer {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%; height: 88vh;
    border-left: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 42px rgba(12,26,16,.28);
    transform: translateY(100%); will-change: transform;
  }
  .drawer-handle { display: flex; align-items: center; justify-content: center; padding: 10px 0 5px; flex-shrink: 0; cursor: grab; touch-action: none; }
  .drawer-handle span { width: 42px; height: 5px; border-radius: 4px; background: var(--ink-3); opacity: .5; }
  .drawer-nav { padding: 2px 12px 10px; }

  /* enquanto o detalhe está aberto, limpamos os overlays do radar */
  body.detail-open .fab-filtros, body.detail-open .legend, body.detail-open .zoom-ctrl { display: none !important; }

  /* ── dica de toque (coach) — centralizada, verde do Filtros c/ leve transparência ── */
  .touch-hint {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 6; max-width: 270px; text-align: center;
    padding: 16px 22px; border-radius: 16px;
    background: rgba(63, 161, 16, .9); color: #fff; backdrop-filter: blur(6px);
    font-size: 13px; font-weight: 600; line-height: 1.45;
    box-shadow: 0 8px 26px rgba(20, 110, 55, .35); pointer-events: none;
    animation: hintPulse 2.4s ease-in-out infinite;
  }
  .touch-hint::before { content: '☝'; font-size: 22px; }
  @keyframes hintPulse { 0%,100% { opacity: .9; } 50% { opacity: 1; } }
  body.hint-off .touch-hint, body.mview-list .touch-hint, body.detail-open .touch-hint { display: none !important; }
}

/* telas muito baixas em paisagem: encolhe um pouco mais */
@media (max-width: 640px) and (max-height: 480px) {
  .drawer { height: 94vh; }
  .legend { display: none; }
}
