/* ── Global reset & base ── */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }

/* ── Dashboard shell ── */
.dash { background: #f5f7fa; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Tab bar ── */
.tab-bar { background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 0; padding: 0 16px; flex-shrink: 0; }
.tab-bar-title { font-size: 13px; font-weight: 600; color: #185FA5; padding: 12px 16px 12px 0; margin-right: 8px; border-right: 1px solid #e5e7eb; white-space: nowrap; }
.tab { font-size: 12px; color: #6b7280; padding: 12px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: all 0.15s; user-select: none; }
.tab:hover { color: #185FA5; }
.tab.active { color: #185FA5; border-bottom: 2px solid #185FA5; font-weight: 500; }

/* ── Panel content area, top bar & controls ── */
.dash-inner { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.dash-title { font-size: 15px; font-weight: 500; color: #1a1a2e; }
.dash-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.ctrl-group { display: flex; flex-direction: column; gap: 2px; }
.ctrl-label { font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
select { font-size: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: #1a1a2e; height: 30px; }

/* ── Multiselect dropdown (e.g. Bed Type filter) ── */
.multiselect { position: relative; }
.multiselect-toggle { font-size: 12px; padding: 5px 10px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: #1a1a2e; height: 30px; min-width: 90px; text-align: left; cursor: pointer; }
.multiselect-toggle:hover { border-color: #185FA5; }
.multiselect-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: #fff; border: 1px solid #d1d5db; border-radius: 8px; box-shadow: 0 8px 16px rgba(0,0,0,0.1); padding: 6px; min-width: 140px; }
.multiselect-option { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #1a1a2e; padding: 5px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.multiselect-option:hover { background: #f3f4f6; }
.multiselect-option input { cursor: pointer; }

.toggle-group { display: flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; height: 30px; background: #f3f4f6; }
.toggle-btn { font-size: 12px; padding: 0 14px; background: transparent; border: none; cursor: pointer; color: #374151; font-weight: 500; transition: all 0.15s; }
.toggle-btn.active { background: #185FA5; color: #fff; }
.toggle-btn:not(.active):hover { background: #e5e7eb; }

/* ── CoC identifier band ── */
.coc-band { background: #185FA5; border-radius: 8px; padding: 8px 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.coc-name { font-size: 13px; font-weight: 500; color: #fff; }
.coc-year { font-size: 11px; color: rgba(255,255,255,0.75); }

/* ── KPI summary cards ── */
.kpi-row { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi-main { background: #185FA5; border-radius: 12px; padding: 20px 16px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.kpi-main-icon { font-size: 22px; color: rgba(255,255,255,0.6); margin-bottom: 6px; }
.kpi-main-label { font-size: 11px; color: rgba(255,255,255,0.75); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 6px; }
.kpi-main-value { font-size: 40px; font-weight: 500; color: #fff; line-height: 1; margin-bottom: 6px; }
.kpi-main-sub { display: flex; align-items: center; gap: 8px; justify-content: center; }
.kpi-main-pct { font-size: 12px; color: rgba(255,255,255,0.9); font-weight: 500; }
.kpi-main-share { font-size: 11px; color: rgba(255,255,255,0.6); }
.kpi-secondary { background: #fff; border-radius: 12px; padding: 18px 16px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px solid #B5D4F4; }
.kpi-sec-icon { font-size: 18px; color: #185FA5; margin-bottom: 5px; opacity: 0.7; }
.kpi-sec-label { font-size: 11px; color: #4b6280; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 5px; }
.kpi-sec-value { font-size: 30px; font-weight: 500; color: #0C447C; line-height: 1; margin-bottom: 5px; }
.kpi-sec-sub { display: flex; align-items: center; gap: 8px; justify-content: center; }
.kpi-sec-pct { font-size: 12px; font-weight: 500; color: #185FA5; }
.kpi-sec-share { font-size: 11px; color: #378ADD; }

/* ── Section divider labels ── */
.section-label { font-size: 11px; font-weight: 500; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.section-label::after { content:''; flex:1; height: 0.5px; background: #e5e7eb; }

/* ── Trend chart card wrapper & legend ── */
.trend-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.chart-header { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.chart-title-row { display: flex; align-items: center; gap: 6px; }
.chart-title { font-size: 13px; font-weight: 500; color: #1a1a2e; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; width: 100%; justify-content: flex-start; }
.leg-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #6b7280; }
.leg-dot { width: 10px; height: 10px; border-radius: 2px; }

/* Info icon + tooltip */
.info-wrap { position: relative; display: inline-flex; align-items: center; }
.info-btn { width: 16px; height: 16px; border-radius: 50%; border: 1px solid #d1d5db; background: #f3f4f6; font-size: 10px; color: #6b7280; display: inline-flex; align-items: center; justify-content: center; cursor: default; flex-shrink: 0; }
.info-btn:hover + .tooltip, .info-wrap:hover .tooltip { opacity: 1; pointer-events: auto; }
.tooltip { opacity: 0; pointer-events: none; position: absolute; left: 22px; top: 50%; transform: translateY(-50%); background: #1a1a2e; color: #fff; font-size: 11px; line-height: 1.4; padding: 7px 10px; border-radius: 7px; width: 200px; z-index: 99; transition: opacity 0.15s; white-space: normal; }
.tooltip::before { content:''; position: absolute; left: -5px; top: 50%; transform: translateY(-50%); border: 5px solid transparent; border-right-color: #1a1a2e; border-left: 0; }
.tooltip-left { left: auto; right: 22px; }
.tooltip-left::before { left: auto; right: -5px; border-right-color: transparent; border-left-color: #1a1a2e; border-left-width: 5px; }

/* ── Subpopulation trend mini-cards — 6-column grid used in Trend view ── */
.subpop-grid-trend { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 8px; }
.subpop-card-trend { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; }
.subpop-label { font-size: 10px; color: #6b7280; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.subpop-label i { font-size: 13px; }
.subpop-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }

/* ── Snapshot subpopulation stat cards — 3-column grid used in Snapshot view ── */
.snap-subpop-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.snap-card { border-radius: 12px; padding: 14px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px solid #B5D4F4; background: #fff; position: relative; }
.snap-card-icon { font-size: 16px; color: #185FA5; opacity: 0.65; margin-bottom: 4px; }
.snap-card-label { font-size: 10px; color: #4b6280; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; }
.snap-card-value { font-size: 22px; font-weight: 500; color: #0C447C; line-height: 1; margin-bottom: 5px; }
.snap-card-meta { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
.snap-up { font-size: 11px; font-weight: 500; color: #a32d2d; }
.snap-down { font-size: 11px; font-weight: 500; color: #3B6D11; }
.snap-share { font-size: 11px; color: #378ADD; }
.snap-info { position: absolute; top: 8px; right: 8px; }

/* ── Footer ── */
.ft { font-size: 10px; color: #9ca3af; margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; flex-shrink: 0; }

/* ── Loading overlay ── */
.loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(245,247,250,0.95); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1000; border-radius: 12px; }
.loading-overlay.hidden { display: none; }
.spinner { width: 40px; height: 40px; border: 3px solid #e5e7eb; border-top-color: #185FA5; border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: #6b7280; font-weight: 500; }

/* Placeholder tab panels */
.placeholder-panel { padding: 60px 20px; text-align: center; color: #9ca3af; font-size: 13px; background: #fff; border-radius: 12px; border: 1px dashed #d1d5db; }
.placeholder-panel .ph-icon { font-size: 32px; margin-bottom: 10px; color: #d1d5db; }
.placeholder-panel .ph-title { font-size: 15px; font-weight: 500; color: #6b7280; margin-bottom: 6px; }
