@charset "UTF-8";

:root {
	--portal-navy: #1e4b91;
	--portal-blue: #2856a2;
	--portal-active: #3867f5;
	--portal-bg: #edf3fb;
	--portal-panel: #f6f9fd;
	--portal-card: #ffffff;
	--portal-ink: #183b5c;
	--portal-muted: #607b95;
	--portal-border: #d6e1ed;
	--portal-control: #ffffff;
	--portal-focus: #7fa9ff;
}

/* =========================================
   1. GLOBAL & LAYOUT
   ========================================= */
html, body {
	margin: 0;
	height: 100%;
	font-family: system-ui, Arial, sans-serif;
	color: #142b3b;
	overflow: hidden;
}

body {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--portal-bg, #edf3fb);
}

header {
	padding: 10px 16px;
	background: var(--portal-navy, #153b54);
	color: white;
	display: flex;
	gap: 14px;
	align-items: center;
	flex-wrap: wrap;
	flex: 0 0 auto;
}

header strong { font-size: 17px; }
header small { opacity: .8; }

#map {
	width: 100%;
	height: 100%;
	min-height: 300px;
	flex: 1 1 auto;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 18px #173b501a;
}

.leaflet-tile { 
	outline: 1px solid transparent;
	margin: -0.5px; 
}
.leaflet-bottom.leaflet-left { bottom: 6px; left: 6px; }

/* =========================================
   2. CONTROLS & UI ELEMENTS
   ========================================= */
.controls {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	background: var(--portal-bg, #f2f6f8);
	color: var(--portal-ink, #142b3b);
	flex: 0 0 auto;
	box-sizing: border-box;
	scrollbar-width: thin;
	flex-wrap: wrap !important;
	overflow: visible !important;
	min-height: unset !important;
}

.controls > label, .controls > b, .controls > button {
	flex: 0 0 auto;
	white-space: nowrap;
}

select, input, button { font-size: 14px; }
.controls input[type=range] { width: clamp(120px, 20vw, 240px) !important; }

button {
	padding: 6px 12px;
	cursor: pointer;
	border-radius: 6px;
	border: 1px solid var(--portal-border, #d6e1ed);
	background: var(--portal-card, #ffffff);
	color: var(--portal-navy, #1e4b91);
}

select {
	border: 1px solid var(--portal-border, #d6e1ed);
	border-radius: 6px;
	background: var(--portal-control, #ffffff);
	color: var(--portal-ink, #183b5c);
	padding: 7px 10px;
}

select:focus-visible, button:focus-visible, input:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--portal-focus) 55%, transparent);
	outline-offset: 2px;
}

#status, #stationCount, .note { display: none !important; }

.legend {
	background: white;
	padding: 10px;
	border-radius: 5px;
	box-shadow: 0 1px 7px #7778;
	font-size: 11px;
}

.ramp {
	height: 12px;
	width: 180px;
	background: linear-gradient(to right, #e5f5f9, #99d8c9, #2ca25f, #fed976, #fd8d3c, #bd0026);
}

.forecast-dates {
	flex: 0 0 auto;
	background: #e3edf7;
	color: var(--portal-navy, #1e4b91);
	padding: 6px 16px;
	font-size: 13px;
	font-weight: 600;
	min-height: 18px;
}

/* =========================================
   3. WORKSPACE & PANELS
   ========================================= */
.forecast-workspace {
	flex: 1 1 auto;
	min-height: 0;
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr);
	gap: 0;
	background: var(--portal-bg, #edf3fb);
	overflow: hidden;
}

.map-column {
	min-width: 0;
	min-height: 0;
	position: relative;
	padding: 10px 0 10px 10px;
}

.forecast-panel {
	min-width: 0;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--portal-panel, #f6f9fd);
	padding: 18px 20px 20px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 16px;
	font-size: 15px;
}

.panel-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 14px;
}

.eyebrow {
	font-size: 12px;
	letter-spacing: .11em;
	color: #628096;
	font-weight: 700;
}

.panel-top h1 {
	font-size: 25px;
	line-height: 1.15;
	margin: 4px 0;
	color: var(--portal-navy, #153b54);
}

.panel-top p {
	font-size: 15px;
	line-height: 1.35;
	color: #657d8d;
	margin: 0;
}

.panel-current { text-align: right; white-space: nowrap; }
.panel-current .current-pollutant { font-size: 15px; color: #58748a; font-weight: 650; }
.panel-current strong {
	display: block;
	color: var(--portal-navy, #153b54);
	font-size: clamp(42px, 4vw, 52px);
	letter-spacing: -.035em;
	line-height: 1.1;
	margin-top: 4px;
}
.panel-current span { font-size: 14px; color: #71889a; }

/* =========================================
   4. TABS, PICKERS & CARDS
   ========================================= */
.panel-selection { display: grid; gap: 9px; }

.mode-tabs {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	background: #e7edf2;
	border-radius: 9px;
	padding: 3px;
	gap: 3px;
}

.mode-tab {
	border: 1px solid transparent;
	background: var(--portal-card, transparent);
	color: var(--portal-navy, #496579);
	border-color: var(--portal-border, transparent);
	border-radius: 7px;
	padding: 11px 8px;
	font-weight: 650;
	font-size: 14px;
}

.mode-tab.active {
	background: var(--portal-active, white);
	color: #fff;
	border-color: var(--portal-active, transparent);
	box-shadow: 0 1px 4px #153b5422;
}

.picker {
	display: grid;
	gap: 7px;
	font-size: 14px;
	color: #5c7487;
	font-weight: 600;
}

.picker[hidden] { display: none !important; }

.picker select {
	width: 100%;
	padding: 11px 12px;
	border-radius: 9px;
}

.index-card {
	display: flex;
	align-items: center;
	gap: 12px;
	border: 0;
	border-radius: 9px;
	padding: 11px 12px;
	background: #f7fafb;
}
.index-card [hidden] { display: none !important; }

.index-heading { font-size: 13px; color: #657b89; font-weight: 700; }
.index-result { display: flex; align-items: center; gap: 10px; margin-top: 9px; }

.index-copy > strong { display: block; color: #213f54; font-size: 19px; margin-top: 3px; }
.index-completeness { display: block; font-size: 12px; color: #718697; margin-top: 3px; }
.index-copy > p { display: none; }

.primary-forecast-card {
	background: #fff;
	border: 1px solid var(--portal-border, #dce6ed);
	border-radius: 14px;
	padding: 17px 18px 15px;
	box-shadow: 0 5px 18px #153b5410;
	border-left: 6px solid #9aa8b2;
	display: grid;
	gap: 12px;
}

/* Levels Colors */
.index-dot { width: 21px; height: 21px; border-radius: 50%; flex: none; background: #9aa8b2; box-shadow: 0 0 0 5px #ffffffb8; }

.primary-forecast-card.level-1 { border-left-color: #2fe4e0; background: linear-gradient(110deg, #f2fbf5 0%, #fff 42%); }
.primary-forecast-card.level-2 { border-left-color: #45c6a1; background: linear-gradient(110deg, #f6fbf1 0%, #fff 42%); }
.primary-forecast-card.level-3 { border-left-color: #e3df4c; background: linear-gradient(110deg, #fffbee 0%, #fff 42%); }
.primary-forecast-card.level-4 { border-left-color: #ff5a61; background: linear-gradient(110deg, #fff7ef 0%, #fff 42%); }
.primary-forecast-card.level-5 { border-left-color: #a20b3c; background: linear-gradient(110deg, #fff3f1 0%, #fff 42%); }
.primary-forecast-card.level-6 { border-left-color: #80127f; background: linear-gradient(110deg, #fbf1fa 0%, #fff 42%); }

.index-dot.level-1 { background: #2fe4e0; }
.index-dot.level-2 { background: #45c6a1; }
.index-dot.level-3 { background: #e3df4c; }
.index-dot.level-4 { background: #ff5a61; }
.index-dot.level-5 { background: #a20b3c; }
.index-dot.level-6 { background: #80127f; }

.daily-symbol.level-1 { color: #2fe4e0; }
.daily-symbol.level-2 { color: #45c6a1; }
.daily-symbol.level-3 { color: #e3df4c; }
.daily-symbol.level-4 { color: #ff5a61; }
.daily-symbol.level-5 { color: #a20b3c; }
.daily-symbol.level-6 { color: #80127f; }

.daily-card.level-1:before { background: #2fe4e0; }
.daily-card.level-2:before { background: #45c6a1; }
.daily-card.level-3:before { background: #e3df4c; }
.daily-card.level-4:before { background: #ff5a61; }
.daily-card.level-5:before { background: #a20b3c; }
.daily-card.level-6:before { background: #80127f; }

/* =========================================
   5. CHARTS & DAILY FORECAST
   ========================================= */
.panel-chart-section {
	background: white;
	border: 1px solid var(--portal-border, #dce5eb);
	border-radius: 12px;
	padding: 16px 15px 14px;
	box-shadow: 0 4px 15px #153b540b;
}

.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.section-heading h2 { font-size: 18px; margin: 0; color: #153b54; }
.section-heading span { font-size: 13px; color: #718697; }

.chart-pollutant-chip { background: #eef4f8; padding: 6px 10px; border-radius: 20px; font-weight: 700; font-size: 14px; }
.main-chart-wrap { height: 235px; position: relative; margin-top: 13px; }

.chart-tooltip {
	position: absolute; display: none; pointer-events: none; z-index: 5; transform: translate(-50%, -110%);
	background: #fff; color: #17364c; border: 1px solid #d4e1e9;
	border-radius: 9px; padding: 10px 12px; font-size: 14px;
	line-height: 1.45; white-space: nowrap; box-shadow: 0 8px 22px #102f4626;
}
.chart-tooltip strong { display: block; color: #153b54; font-size: 14px; }

.daily-forecast {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 10px;
	margin-top: 12px;
}

.daily-card {
	position: relative;
	min-height: 128px;
	padding: 12px 11px 10px;
	border-radius: 11px;
	background: #fff;
	border: 1px solid var(--portal-border, #e0e8ed);
	box-shadow: 0 3px 10px #173b5009;
	overflow: hidden;
}

.daily-card:before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #9aa8b2; }
.daily-card small { font-size: 13px; color: #536d7e; white-space: normal; }
.daily-symbol { display: block; font-size: 17px; line-height: 1; margin: 9px 0 4px; color: #8797a1; }
.daily-card strong { display: inline-block; font-size: 25px; line-height: 1; color: #183b52; margin: 2px 5px 0 0; }
.daily-card em { font-size: 13px; font-style: normal; color: #667e8e; }
.daily-card .daily-category { display: block; font-size: 15px; font-weight: 700; color: #345469; margin-top: 8px; }
.daily-card .daily-partial { display: block; font-size: 12px; color: #718697; margin-top: 5px; }
.daily-card .daily-level { display: none; }

/* =========================================
   6. DETAILS & ALERTS
   ========================================= */
.public-note {
	margin: 0; border-left: 3px solid #78a8c2; background: #edf4f8;
	color: #526d80; line-height: 1.5; font-size: 13px; padding: 11px 13px; border-radius: 0 9px 9px 0;
}

.method-details, .detail-details {
	background: white; border: 1px solid var(--portal-border, #dce5eb); color: #526d80;
	line-height: 1.5; font-size: 13px; padding: 12px 14px; border-radius: 10px;
}

.method-details summary, .detail-details summary { cursor: pointer; font-weight: 700; color: #365a70; font-size: 15px; }
.method-details div { margin: 8px 0; }
.method-details a { color: #176b87; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.detail-actions button { background: #f6f9fb; border: 1px solid #d4e0e8; border-radius: 6px; color: #315a73; font-size: 13px; padding: 9px 11px; }
.detail-caption { margin: 8px 0 0; }

.freshness { font-size: 13px; color: #687f8f; padding: 0 2px; }
.freshness.stale { color: #a54e35; background: #fff3ed; border-radius: 6px; padding: 8px 9px; }

/* =========================================
   7. DIALOGS & INFO PANELS
   ========================================= */
.chart-backdrop, .info-backdrop {
	display: none; position: fixed; inset: 0; z-index: 2000; align-items: center; justify-content: center; padding: 18px; box-sizing: border-box; background: #102b3b88;
}
.info-backdrop { z-index: 3000; background: #102b3b99; }

.chart-dialog, .info-dialog, .canton-dialog {
	background: white; border-radius: 12px; max-height: 90vh; overflow: auto; padding: 18px; box-shadow: 0 12px 40px #0005; border-color: var(--portal-border);
}
.chart-dialog { width: min(920px, 96vw); }
.info-dialog, .canton-dialog { color: #142b3b; width: min(1050px, 96vw); max-height: 92vh; padding: 20px; box-shadow: 0 14px 44px #0005; }

.chart-head, .info-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chart-head h2, .info-dialog h2 { margin: 0; font-size: 19px; }
.info-dialog h2 { font-size: 20px; }
.chart-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; min-height: 28px; }

#chartStatus { display: inline-flex; align-items: center; min-width: 132px; min-height: 22px; font-size: 12px; color: #526675; white-space: nowrap; }
#chartStatus.loading:before {
	content: ''; width: 11px; height: 11px; margin-right: 7px; border: 2px solid #cbd8df; border-top-color: #176b87; border-radius: 50%; animation: chartSpin .75s linear infinite;
}
@keyframes chartSpin { to {transform: rotate(360deg)} }

.chart-wrap { position: relative; height: min(55vh, 460px); min-height: 260px; }
.chart-meta { font-size: 12px; color: #526675; margin-top: 10px; }

.station-chart-btn { margin-top: 8px; background: #153b54; color: white; border: 0; border-radius: 5px; padding: 7px 10px; }
.close-chart { border: 0; background: #e9eef1; border-radius: 6px; padding: 7px 12px; }

.version-actions { margin-left: auto; display: flex; gap: 8px; }
.version-actions button { border-color: #ffffff66; background: #ffffff16; color: #fff; border-radius: 6px; padding: 7px 11px; }

.canton-kpis { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 9px; margin: 16px 0; }
.canton-kpi, .verify-kpi { padding: 11px; border: 1px solid #dbe5eb; border-radius: 8px; background: #f7fafb; }
.canton-kpi small, .verify-kpi small { display: block; color: #526675; }
.canton-kpi strong, .verify-kpi strong { display: block; margin-top: 5px; font-size: 17px; }
.verify-kpi strong { font-size: 18px; }

.canton-method { font-size: 12px; color: #526675; background: #f2f6f8; border-left: 3px solid #176b87; padding: 10px 12px; line-height: 1.5; }
.info-dialog p, .info-dialog li { line-height: 1.55; }
.info-dialog a { color: #176b87; }

.verify-controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 16px 0; }
.verify-controls label { display: grid; gap: 5px; font-size: 12px; }
.verify-controls select { min-width: 160px; padding: 7px; }
.verify-kpis { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.verify-chart { height: 260px; position: relative; margin: 14px 0; }
.verify-table-wrap { overflow: auto; max-height: 280px; }
.verify-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.verify-table th, .verify-table td { padding: 8px; border-bottom: 1px solid #e1e9ee; text-align: left; white-space: nowrap; }
.verify-table th { background: #f2f6f8; position: sticky; top: 0; }
#verifyMessage { padding: 10px; background: #eef4f7; border-radius: 6px; white-space: pre-wrap; }

.info-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-sections section { background: #f6f9fa; border-radius: 8px; padding: 14px; }

/* =========================================
   8. EMBEDDED BRAND
   ========================================= */
#embeddedBrand { display: none; }
.embedded-brand {
	align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px;
	background: var(--portal-card); color: var(--portal-navy); border-bottom: 1px solid var(--portal-border); box-sizing: border-box;
}
.embedded-brand > div:first-child { display: grid; gap: 3px; }
.embedded-brand strong { font-size: 20px; }
.embedded-brand span { font-size: 13px; color: var(--portal-muted); }
.embedded-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.embedded-actions button { padding: 8px 12px; }

html[data-cams-display="embedded"] #embeddedBrand { display: flex; }
html[data-cams-display="embedded"] header { display: none; }

/* =========================================
   9. MEDIA QUERIES
   ========================================= */
@media (max-width: 1150px) and (min-width: 901px) {
	.forecast-workspace { grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr); }
	.forecast-panel { padding: 15px; }
	.daily-forecast { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
	html, body { height: auto; min-height: 100%; overflow: auto; }
	.body { overflow: auto; }
	.forecast-workspace { grid-template-columns: 1fr; grid-template-rows: minmax(44vh, 56vh) auto; overflow: visible; }
	.map-column { padding: 8px 8px 0; }
	#map { min-height: 360px; }
	.forecast-panel { overflow: visible; padding: 17px 16px 22px; }
	.controls { flex-wrap: wrap; overflow: visible; min-height: unset; }
	.forecast-dates { white-space: normal; }
	.panel-top h1 { font-size: 21px; }
	.panel-current strong { font-size: 44px; }
	.daily-forecast { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
	.embedded-brand { align-items: flex-start; flex-direction: column; }
	.embedded-brand strong { font-size: 18px; }
}

@media (max-width: 800px) {
	.canton-kpis { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
	.canton-dialog { padding: 14px; }
}

@media (max-width: 650px) {
	.verify-kpis { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
	.info-sections { grid-template-columns: 1fr; }
	.version-actions { margin-left: 0; }
	.info-dialog { padding: 14px; }
}

@media (max-width: 600px) {
	header { padding: 8px 12px; }
	header small { display: none; }
	.controls { gap: 9px; padding: 8px 12px; min-height: 49px; }
	.controls input[type=range] { width: 140px; }
}

@media (max-width: 520px) {
	.forecast-workspace { grid-template-rows: minmax(42vh, 52vh) auto; }
	.map-column { padding: 6px 6px 0; }
	#map { min-height: 310px; }
	.forecast-panel { gap: 12px; padding: 13px 11px 20px; }
	.panel-top { align-items: flex-start; }
	.panel-top h1 { font-size: 22px; }
	.panel-top p { font-size: 13px; }
	.panel-current strong { font-size: 38px; }
	.main-chart-wrap { height: 190px; }
	.daily-forecast { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.daily-card { min-height: 118px; }
	.controls input[type=range] { width: 120px; }
}



