/* =====================================================
   VIBRA MUNICIPALITY — Dashboard B2G v1.0
   VibraWorld · Urban Intelligence Infrastructure
   ===================================================== */

/* ── Panel Base ── */
#vm-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #04020d;
  overflow-y: auto;
  font-family: var(--mono, 'DM Mono', monospace);
  -webkit-overflow-scrolling: touch;
}
#vm-panel.vm-open { display: block; }

/* ── Header ── */
.vm-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(4,2,13,.96);
  border-bottom: 1px solid rgba(0,200,130,.2);
  backdrop-filter: blur(12px);
  padding: env(safe-area-inset-top,0) 1rem 0;
}
.vm-header-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 0;
}
.vm-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg,#00c882,#0af);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.vm-title-block { flex: 1; min-width: 0; }
.vm-title {
  font-family: var(--sans, 'Syne', sans-serif);
  font-size: .95rem;
  font-weight: 800;
  color: #e8fff5;
  letter-spacing: .02em;
  line-height: 1.1;
}
.vm-subtitle {
  font-size: .55rem;
  color: rgba(0,200,130,.7);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 2px;
}
.vm-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(240,235,255,.7);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── City Selector ── */
.vm-city-bar {
  display: flex;
  gap: .5rem;
  padding: .5rem 0 .75rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.vm-city-bar::-webkit-scrollbar { display: none; }
.vm-city-pill {
  flex-shrink: 0;
  padding: .3rem .75rem;
  border-radius: 20px;
  border: 1px solid rgba(0,200,130,.3);
  background: transparent;
  color: rgba(0,200,130,.8);
  font-size: .6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s;
}
.vm-city-pill.active {
  background: rgba(0,200,130,.15);
  border-color: #00c882;
  color: #00c882;
}

/* ── Body ── */
.vm-body {
  padding: 1rem;
  padding-bottom: calc(env(safe-area-inset-bottom,0) + 2rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── UHI Hero Card ── */
.vm-uhi-card {
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(0,200,130,.12) 0%, rgba(0,170,255,.08) 100%);
  border: 1px solid rgba(0,200,130,.25);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.vm-uhi-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,200,130,.15) 0%, transparent 70%);
  pointer-events: none;
}
.vm-uhi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.vm-uhi-label {
  font-size: .55rem;
  color: rgba(0,200,130,.7);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: .25rem;
}
.vm-uhi-city {
  font-family: var(--sans, 'Syne', sans-serif);
  font-size: 1.3rem;
  font-weight: 900;
  color: #e8fff5;
  line-height: 1;
}
.vm-uhi-time {
  font-size: .55rem;
  color: rgba(255,255,255,.4);
  margin-top: .25rem;
}
.vm-uhi-score-wrap {
  text-align: right;
}
.vm-uhi-score {
  font-family: var(--sans, 'Syne', sans-serif);
  font-size: 2.8rem;
  font-weight: 900;
  color: #00c882;
  line-height: 1;
  letter-spacing: -.03em;
}
.vm-uhi-score-label {
  font-size: .5rem;
  color: rgba(0,200,130,.6);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.vm-uhi-ring-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.vm-uhi-ring { flex-shrink: 0; }
.vm-uhi-kpis {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.vm-kpi {
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  padding: .5rem .6rem;
  border: 1px solid rgba(255,255,255,.06);
}
.vm-kpi-val {
  font-family: var(--sans, 'Syne', sans-serif);
  font-size: 1.1rem;
  font-weight: 800;
  color: #e8fff5;
  line-height: 1;
}
.vm-kpi-label {
  font-size: .48rem;
  color: rgba(255,255,255,.4);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.vm-kpi-trend {
  font-size: .5rem;
  margin-top: 2px;
}
.vm-kpi-trend.up { color: #00c882; }
.vm-kpi-trend.down { color: #ff4d6d; }
.vm-kpi-trend.flat { color: rgba(255,255,255,.3); }

/* ── Section Header ── */
.vm-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}
.vm-section-title {
  font-size: .6rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.vm-section-action {
  font-size: .55rem;
  color: rgba(0,200,130,.7);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: .06em;
}

/* ── Dept Breakdown ── */
.vm-dept-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
}
.vm-dept-card {
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  padding: .75rem;
  position: relative;
  overflow: hidden;
}
.vm-dept-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}
.vm-dept-card.mobility::after  { background: #00d4ff; }
.vm-dept-card.culture::after   { background: #b088ff; }
.vm-dept-card.economy::after   { background: #ffc400; }
.vm-dept-card.energy-d::after  { background: #00e676; }
.vm-dept-card.vitality::after  { background: #f06292; }

.vm-dept-top {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .5rem;
}
.vm-dept-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vm-dept-name {
  font-size: .58rem;
  color: rgba(255,255,255,.6);
  letter-spacing: .08em;
  text-transform: uppercase;
  flex: 1;
}
.vm-dept-change {
  font-size: .52rem;
}
.vm-dept-change.up { color: #00c882; }
.vm-dept-change.down { color: #ff4d6d; }
.vm-dept-score {
  font-family: var(--sans, 'Syne', sans-serif);
  font-size: 1.6rem;
  font-weight: 900;
  color: #e8fff5;
  line-height: 1;
  margin-bottom: .4rem;
}
.vm-dept-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 4px;
  overflow: hidden;
}
.vm-dept-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(.2,0,.1,1);
}
.vm-dept-meta {
  font-size: .48rem;
  color: rgba(255,255,255,.3);
  margin-top: .35rem;
}

/* ── Zone Heatmap ── */
.vm-zone-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.vm-zone-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: .6rem .75rem;
  cursor: pointer;
  transition: background .15s;
}
.vm-zone-row:active { background: rgba(255,255,255,.06); }
.vm-zone-rank {
  font-size: .6rem;
  color: rgba(255,255,255,.25);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.vm-zone-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.vm-zone-info { flex: 1; min-width: 0; }
.vm-zone-name {
  font-size: .72rem;
  color: rgba(240,235,255,.85);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vm-zone-sub {
  font-size: .5rem;
  color: rgba(255,255,255,.3);
  margin-top: 1px;
}
.vm-zone-energy-wrap { text-align: right; flex-shrink: 0; }
.vm-zone-energy {
  font-family: var(--sans, 'Syne', sans-serif);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}
.vm-zone-status {
  font-size: .48rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 1px;
}
.vm-zone-bar-row {
  width: 48px;
  height: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 3px;
  margin-left: auto;
}
.vm-zone-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .8s ease;
}

/* Status colors */
.vm-status-surge   { color: #ff6b35; }
.vm-status-hot     { color: #ff4d6d; }
.vm-status-warm    { color: #ffc400; }
.vm-status-cold    { color: #00c882; }

/* ── Signal Timeline ── */
.vm-timeline-card {
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  padding: .9rem;
}
.vm-timeline-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.vm-timeline-title {
  font-size: .6rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.vm-timeline-legend {
  display: flex;
  gap: .75rem;
}
.vm-tl-leg {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .48rem;
  color: rgba(255,255,255,.4);
}
.vm-tl-leg-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.vm-timeline-canvas-wrap {
  position: relative;
  height: 80px;
}
#vm-timeline-canvas {
  width: 100%;
  height: 80px;
}
.vm-timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: .3rem;
  padding: 0 2px;
}
.vm-timeline-labels span {
  font-size: .45rem;
  color: rgba(255,255,255,.25);
}

/* ── Alerts ── */
.vm-alerts-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.vm-alert-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  padding: .7rem;
}
.vm-alert-item.critical {
  background: rgba(255,77,109,.05);
  border-color: rgba(255,77,109,.2);
}
.vm-alert-item.warning {
  background: rgba(255,196,0,.04);
  border-color: rgba(255,196,0,.15);
}
.vm-alert-item.info {
  background: rgba(0,200,130,.04);
  border-color: rgba(0,200,130,.12);
}
.vm-alert-icon { font-size: 1rem; flex-shrink: 0; line-height: 1.2; }
.vm-alert-body { flex: 1; min-width: 0; }
.vm-alert-title {
  font-size: .65rem;
  color: rgba(240,235,255,.85);
  font-weight: 500;
  line-height: 1.2;
}
.vm-alert-detail {
  font-size: .52rem;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}
.vm-alert-time {
  font-size: .48rem;
  color: rgba(255,255,255,.25);
  flex-shrink: 0;
  align-self: flex-end;
}

/* ── Export Card ── */
.vm-export-card {
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,200,130,.1), rgba(0,170,255,.06));
  border: 1px solid rgba(0,200,130,.2);
  padding: 1rem;
}
.vm-export-title {
  font-family: var(--sans, 'Syne', sans-serif);
  font-size: .85rem;
  font-weight: 800;
  color: #e8fff5;
  margin-bottom: .25rem;
}
.vm-export-sub {
  font-size: .52rem;
  color: rgba(255,255,255,.4);
  margin-bottom: .9rem;
  line-height: 1.4;
}
.vm-export-btns {
  display: flex;
  gap: .5rem;
}
.vm-export-btn {
  flex: 1;
  padding: .65rem;
  border-radius: 10px;
  border: 1px solid rgba(0,200,130,.3);
  background: rgba(0,200,130,.1);
  color: #00c882;
  font-family: var(--mono, 'DM Mono', monospace);
  font-size: .58rem;
  letter-spacing: .08em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all .2s;
}
.vm-export-btn:active {
  background: rgba(0,200,130,.2);
}
.vm-export-btn.secondary {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.1);
  color: rgba(255,255,255,.6);
}

/* ── Live Indicator ── */
.vm-live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #00c882;
  margin-right: .35rem;
  animation: vmPulse 1.5s ease-in-out infinite;
}
@keyframes vmPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

/* ── Tab nav ── */
.vm-tab-nav {
  display: flex;
  gap: .35rem;
  padding: .5rem 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.vm-tab-nav::-webkit-scrollbar { display: none; }
.vm-tab-btn {
  flex-shrink: 0;
  padding: .35rem .7rem;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: rgba(255,255,255,.45);
  font-family: var(--mono, 'DM Mono', monospace);
  font-size: .55rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s;
}
.vm-tab-btn.active {
  background: rgba(0,200,130,.12);
  border-color: rgba(0,200,130,.4);
  color: #00c882;
}

/* ── Empty state ── */
.vm-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255,255,255,.25);
  font-size: .6rem;
  letter-spacing: .08em;
}

/* ── Sponsor Badge ── */
.vm-sponsor {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .75rem;
  background: rgba(255,196,0,.05);
  border: 1px solid rgba(255,196,0,.15);
  border-radius: 10px;
  margin-top: .5rem;
}
.vm-sponsor-label {
  font-size: .5rem;
  color: rgba(255,196,0,.7);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.vm-sponsor-name {
  font-size: .65rem;
  color: rgba(255,196,0,.9);
  font-weight: 500;
}

/* ── Drawer button badge ── */
#vm-drawer-btn .vm-badge {
  display: inline-block;
  background: #00c882;
  color: #04020d;
  border-radius: 8px;
  font-size: .42rem;
  padding: 0 .3rem;
  margin-left: .2rem;
  font-weight: 700;
  letter-spacing: .04em;
  vertical-align: middle;
}

/* ── Responsive micro ── */
@media (max-width: 360px) {
  .vm-dept-grid { grid-template-columns: 1fr; }
  .vm-uhi-score { font-size: 2.2rem; }
}
