body.a-app {
  --a-teal: #0f8f88;
  --a-teal-dark: #0b6f6a;
  --a-teal-soft: #e3f5f2;
  --a-ink: #10302e;
  --a-muted: #5d7472;
  --a-line: #dcebe8;
  --a-card: rgba(255, 255, 255, 0.94);
  --a-shadow: 0 6px 24px rgba(16, 60, 56, 0.12);
  --a-good: #22c55e;
  --a-mod: #f59e0b;
  --a-high: #ef4444;
  --a-header-h: 84px;
  margin: 0;
  background: #e9f6f3;
  color: var(--a-ink);
  font-family: 'IBM Plex Sans Thai', 'Kanit', sans-serif;
}
body.a-app.a-full { height: 100vh; overflow: hidden; }

.a-header { height: var(--a-header-h); display: flex; align-items: center; gap: 1.25rem; padding: 0 1.25rem; background: #fff; box-shadow: 0 2px 12px rgba(16, 60, 56, 0.08); position: relative; z-index: 20; }
.a-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--a-ink); flex-shrink: 0; }
.a-brand img { height: 56px; width: auto; display: block; }
.a-menu { display: flex; gap: 0.35rem; flex: 1; justify-content: center; min-width: 0; }
.a-menu a { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.1rem; border-radius: 999px; text-decoration: none; color: var(--a-ink); font-family: 'Kanit', sans-serif; font-size: 1rem; white-space: nowrap; }
.a-menu a:hover { background: var(--a-teal-soft); }
.a-menu a.active { background: var(--a-teal-dark); color: #fff; box-shadow: 0 4px 12px rgba(11, 111, 106, 0.35); }
.a-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.a-update-pill { display: flex; align-items: center; gap: 0.45rem; border: 0; border-radius: 999px; padding: 0.55rem 1rem; background: linear-gradient(90deg, #0f8f88, #14b8a6); color: #fff; font: 600 0.85rem 'IBM Plex Sans Thai', sans-serif; cursor: pointer; white-space: nowrap; }
.a-datetime { display: flex; align-items: center; gap: 0.5rem; border: 0; border-left: 1px solid var(--a-line); background: none; padding: 0 0.6rem 0 0.9rem; color: var(--a-ink); cursor: pointer; text-align: left; }
.a-datetime small { display: block; font-size: 0.78rem; }
.a-datetime b { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 1.15rem; }
.a-icon-btn { position: relative; border: 0; background: none; color: var(--a-ink); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.a-icon-btn:hover { background: var(--a-teal-soft); }
.a-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--a-high); }
@media (max-width: 1440px) { .a-menu a span, .a-header .a-update-pill { font-size: 0.8rem; } .a-menu a { padding: 0.48rem 0.68rem; gap: 0.35rem; font-size: 0.88rem; } .a-header .a-update-pill { padding: 0.5rem 0.8rem; } .a-header { gap: 0.65rem; padding: 0 0.9rem; } .a-brand img { height: 46px; } }
.a-short { display: none; }
@media (max-width: 1360px) and (min-width: 769px) { .a-header .a-update-pill { display: none; } }
@media (max-width: 1120px) and (min-width: 769px) { .a-header { gap: 0.45rem; padding: 0 0.75rem; } .a-brand img { height: 40px; } .a-menu { gap: 0.15rem; } .a-menu a { padding: 0.42rem 0.55rem; font-size: 0.78rem; } }
@media (max-width: 1000px) and (min-width: 769px) { .a-menu a .a-long { display: none; } .a-menu a .a-short { display: inline; } }

.a-stage { position: relative; height: calc(100vh - var(--a-header-h)); }
.a-map { position: absolute !important; inset: 0; }
.a-card { background: var(--a-card); border-radius: 18px; box-shadow: var(--a-shadow); backdrop-filter: blur(6px); }
.a-float { position: absolute; z-index: 5; }
.a-float[hidden] { display: none !important; }

.a-left { top: 18px; left: 18px; width: 380px; max-height: calc(100% - 110px); overflow-y: auto; overflow-x: hidden; scrollbar-width: none; -ms-overflow-style: none; display: flex; flex-direction: column; gap: 12px; padding-bottom: 4px; }
.a-left::-webkit-scrollbar, .a-sensor-right::-webkit-scrollbar { display: none; }
.a-panel { padding: 0.9rem 1rem; box-sizing: border-box; }
.a-panel > summary { list-style: none; display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-family: 'Kanit', sans-serif; font-size: 1.15rem; font-weight: 600; }
.a-panel > summary::-webkit-details-marker { display: none; }
.a-panel > summary .a-chev { margin-left: auto; transition: transform 0.2s; }
.a-panel[open] > summary .a-chev { transform: rotate(180deg); }
.a-search { display: flex; align-items: center; gap: 0.5rem; background: #fff; border: 1px solid var(--a-line); border-radius: 999px; padding: 0.5rem 0.9rem; margin: 0.75rem 0 0.6rem; }
.a-search input { border: 0; outline: 0; flex: 1; font: inherit; background: none; color: var(--a-ink); }
.a-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.a-chip { border: 1px solid var(--a-line); background: #fff; color: var(--a-ink); border-radius: 999px; padding: 0.3rem 0.8rem; font: 500 0.82rem 'IBM Plex Sans Thai', sans-serif; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; }
.a-chip.active { background: var(--a-teal-dark); border-color: var(--a-teal-dark); color: #fff; }
.a-chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.a-sensor { border: 1px solid var(--a-line); border-radius: 14px; padding: 0.65rem 0.8rem; margin-top: 0.55rem; background: #fff; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.5rem; font-size: 0.82rem; }
.a-sensor.selected { border-color: var(--a-teal); box-shadow: 0 0 0 2px rgba(15, 143, 136, 0.25); background: #f3fbfa; }
.a-sensor strong { font-size: 0.98rem; }
.a-sensor .a-meta { color: var(--a-muted); }
.a-sensor .a-status { width: 11px; height: 11px; border-radius: 50%; justify-self: end; align-self: center; }
.a-sensor .a-tools { grid-row: 2 / span 2; grid-column: 2; display: flex; gap: 0.3rem; align-self: end; }
.a-mini-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--a-line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--a-ink); }
.a-badge { display: inline-block; padding: 0.15rem 0.7rem; border-radius: 999px; background: var(--a-teal-soft); color: var(--a-teal-dark); font: 600 0.85rem 'IBM Plex Mono', monospace; }
.a-aermod { border: 2px solid #9fdcd3; }
.a-status-list { background: #f1faf8; border-radius: 12px; padding: 0.55rem 0.8rem; margin: 0.6rem 0; font-size: 0.85rem; line-height: 1.8; }
.a-status-list li, .a-bullets li { list-style: none; position: relative; padding-left: 1rem; }
.a-status-list li::before, .a-bullets li::before { content: ''; position: absolute; left: 0; top: 0.65em; width: 7px; height: 7px; border-radius: 50%; background: var(--a-good); }
.a-sub { border-top: 1px solid var(--a-line); }
.a-sub > summary { list-style: none; display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.2rem; cursor: pointer; font-weight: 600; }
.a-sub > summary::-webkit-details-marker { display: none; }
.a-sub > summary .a-chev { margin-left: auto; transform: rotate(-90deg); transition: transform 0.2s; }
.a-sub[open] > summary .a-chev { transform: rotate(0); }
.a-sub-body { background: #f1faf8; border-radius: 12px; padding: 0.6rem 0.8rem; margin-bottom: 0.6rem; font-size: 0.85rem; line-height: 1.7; }
.a-bullets { margin: 0; padding: 0; }

.a-layerbar { top: 18px; left: 416px; display: flex; gap: 0.4rem; padding: 0.35rem; border-radius: 999px; }
.a-layerbar button { border: 0; background: none; border-radius: 999px; padding: 0.5rem 1.1rem; font: 500 0.95rem 'Kanit', sans-serif; color: var(--a-ink); display: flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.a-layerbar button.active { background: var(--a-teal-dark); color: #fff; }

.a-right { top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; }
.a-round { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--a-shadow); display: grid; place-items: center; cursor: pointer; color: var(--a-ink); }
.a-round.active { background: var(--a-teal-dark); color: #fff; }
.a-round-group { background: #fff; border-radius: 26px; box-shadow: var(--a-shadow); display: flex; flex-direction: column; }
.a-round-group .a-round { box-shadow: none; background: none; }

.a-timeline { bottom: 18px; left: 50%; transform: translateX(-50%); width: min(820px, calc(100% - 820px)); min-width: 560px; padding: 0.8rem 1.4rem 0.7rem; }
.a-tl-top { display: flex; justify-content: space-between; align-items: center; gap: 0.45rem; flex-wrap: wrap; position: relative; }
.a-tl-date { display: flex; align-items: center; gap: 0.6rem; border: 1px solid var(--a-line); border-radius: 999px; padding: 0.25rem 0.5rem; font: 600 1.05rem 'IBM Plex Mono', monospace; }
.a-tl-date button { border: 0; background: none; cursor: pointer; font-size: 1.1rem; color: var(--a-ink); padding: 0 0.4rem; }
.a-forecast-pill { position: absolute; right: 0; background: var(--a-teal-dark); color: #fff; border-radius: 999px; padding: 0.25rem 0.8rem; font-size: 0.82rem; font-weight: 600; }
.a-forecast-pill[hidden] { display: none; }
.a-sensor-ts-pill { display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--a-line); background: rgba(255, 255, 255, 0.78); color: var(--a-teal-dark); border-radius: 999px; padding: 0.2rem 0.65rem; font: 600 0.72rem 'IBM Plex Sans Thai', sans-serif; white-space: nowrap; }
.a-realtime-pill { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid #86efac; background: #f0fdf4; color: #166534; border-radius: 999px; padding: 0.2rem 0.65rem; font: 600 0.72rem 'IBM Plex Sans Thai', sans-serif; cursor: pointer; white-space: nowrap; }
.a-rt-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; display: inline-block; box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); animation: aRtPulse 1.8s infinite; flex-shrink: 0; }
@keyframes aRtPulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); } 70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
.a-realtime-pill.is-past { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.a-realtime-pill.is-past .a-rt-dot { background: #d97706; animation: none; box-shadow: none; }
.a-tl-mid { display: flex; align-items: center; gap: 0.8rem; margin: 0.45rem 0; }
.a-play { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--a-teal-dark); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 14px rgba(11, 111, 106, 0.35); flex-shrink: 0; }
.a-step { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--a-line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--a-ink); flex-shrink: 0; }
.a-range { flex: 1; accent-color: var(--a-teal-dark); }
.a-tl-bottom { display: flex; justify-content: center; align-items: center; gap: 0.6rem; font-size: 0.85rem; flex-wrap: wrap; }
.a-tl-bottom button.a-link { border: 0; background: none; display: flex; align-items: center; gap: 0.35rem; cursor: pointer; font: inherit; color: var(--a-ink); }
.a-select { border: 0; border-radius: 999px; background: var(--a-teal-soft); color: var(--a-teal-dark); padding: 0.3rem 0.8rem; font: 600 0.82rem 'IBM Plex Sans Thai', sans-serif; cursor: pointer; }


.a-sheet { display: contents; } 
.a-sheet-btn { display: none; }

.a-grid-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 8px; margin-top: 0.5rem; font: 0.72rem 'IBM Plex Mono', monospace; }
.a-grid-legend[hidden], #aSmoothLegend[hidden] { display: none; }
.a-grid-legend span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.a-grid-legend i { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; border: 1px solid rgba(0, 0, 0, 0.08); }
.a-legend { right: 18px; bottom: 18px; width: 360px; padding: 0.8rem 1rem; }
.a-legend-head { display: flex; align-items: center; gap: 0.5rem; font-family: 'Kanit', sans-serif; font-weight: 600; }
.a-legend-head .a-select { margin-left: auto; }
.a-ramp { height: 16px; border-radius: 8px; margin: 0.55rem 0 0.25rem; background: linear-gradient(90deg, rgba(124,58,237,0.12), rgba(59,130,246,0.54), rgba(6,182,212,0.78), rgba(34,197,94,0.87), rgba(250,204,21,0.92), rgba(249,115,22,0.95), rgb(239,68,68)), repeating-conic-gradient(#e5e7eb 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.a-ramp-rain { background: linear-gradient(90deg, #22d3ee, #3b82f6, #22c55e, #facc15, #f97316, #ef4444, #d946ef); }
.a-ramp-labels { display: flex; justify-content: space-between; font: 0.8rem 'IBM Plex Mono', monospace; }
.a-info-pop { right: 18px; bottom: 245px; width: 420px; padding: 1rem 1.2rem; font-size: 0.9rem; line-height: 1.6; z-index: 12; box-sizing: border-box; }
.a-info-pop[hidden] { display: none; }
.a-info-pop h4 { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.5rem; font-family: 'Kanit', sans-serif; font-size: 1.1rem; }
.a-close { margin-left: auto; border: 0; background: none; font-size: 1.2rem; cursor: pointer; color: var(--a-ink); }
.a-scale { left: 18px; bottom: 18px; }
.a-map .maplibregl-ctrl-bottom-left { display: flex; align-items: center; gap: 8px; left: 10px; bottom: 10px; }
.a-map .maplibregl-ctrl-bottom-left .maplibregl-ctrl { margin: 0; }
.a-map .maplibregl-ctrl-scale { background: #fff; border-radius: 999px; padding: 0.2rem 0.9rem; border: 0; box-shadow: var(--a-shadow); }
.a-unit-note { font-size: 0.72rem; color: var(--a-muted); margin-top: 0.3rem; }

.a-marker { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45); cursor: pointer; }
.a-marker.source { width: 40px; height: 40px; background: #0f766e; display: grid; place-items: center; border-width: 3px; }
.a-marker.sel { outline: 3px solid rgba(15, 143, 136, 0.6); outline-offset: 2px; }

.a-wx-cards { top: 18px; left: 416px; right: 86px; display: flex; gap: 12px; }
.a-wx-cards .a-card { padding: 0.8rem 1.1rem; flex: 1; min-width: 0; }
.a-wx-cards h4 { margin: 0 0 0.4rem; font-family: 'Kanit', sans-serif; font-size: 1.05rem; }
.a-bars { display: flex; align-items: flex-end; gap: 6px; height: 54px; }
.a-bars div { flex: 1; text-align: center; font-size: 0.72rem; }
.a-bars span { display: block; background: linear-gradient(180deg, #2dd4bf, #0f8f88); border-radius: 4px 4px 0 0; margin-top: 2px; }
.a-radio-list label { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 10px; cursor: pointer; }
.a-radio-list label:has(input:checked) { background: var(--a-teal-soft); outline: 1px solid #9fdcd3; }
.a-radio-list input { margin-left: auto; accent-color: var(--a-teal-dark); }
.a-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a-tile { background: #fff; border: 1px solid var(--a-line); border-radius: 12px; padding: 0.5rem 0.7rem; font-size: 0.8rem; }
.a-tile b { display: block; font-size: 1.3rem; font-family: 'Kanit', sans-serif; }
.a-h { font-family: 'Kanit', sans-serif; font-weight: 600; font-size: 1rem; margin: 0.9rem 0 0.4rem; }

.a-cols { display: grid; grid-template-columns: 300px minmax(0, 1fr) 520px; gap: 0; height: calc(100vh - var(--a-header-h)); }
.a-cols > .a-col-mid { grid-column: 2; grid-row: 1; }
.a-cols .a-col-right { grid-column: 3; grid-row: 1; }
.a-cols .a-col-left { grid-column: 1; grid-row: 1; }
.a-cols .a-timeline { grid-column: 2; grid-row: 1; align-self: end; position: relative; left: auto; bottom: auto; transform: none; width: auto; min-width: 0; margin: 0 18px 18px; z-index: 5; }
.a-col-left { background: #fff; padding: 1rem 1.2rem; overflow: auto; border-right: 1px solid var(--a-line); }
.a-col-left label { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; cursor: pointer; font-size: 0.92rem; }
.a-col-left input { accent-color: var(--a-teal-dark); width: 18px; height: 18px; }
.a-col-mid { position: relative; }
.a-col-right { background: #fff; padding: 1rem 1.2rem; overflow: auto; border-left: 1px solid var(--a-line); }
.a-tabs { display: flex; background: #eef6f5; border-radius: 12px; padding: 4px; margin: 0.7rem 0; }
.a-tabs button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 0.55rem; font: 500 0.95rem 'Kanit', sans-serif; cursor: pointer; color: var(--a-ink); }
.a-tabs button.active { background: var(--a-teal-dark); color: #fff; }
.a-big { font: 600 2.6rem 'Kanit', sans-serif; line-height: 1.1; }
.a-level { display: inline-block; border-radius: 999px; padding: 0.2rem 0.9rem; font-weight: 600; }
.a-level.good { background: #dcfce7; color: #15803d; } .a-level.mod { background: #fef3c7; color: #b45309; } .a-level.high { background: #fee2e2; color: #b91c1c; }
.a-stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 0.7rem; }
.a-stat3 div { border-radius: 12px; padding: 0.6rem 0.8rem; font-size: 0.85rem; }
.a-stat3 b { display: block; font: 600 1.5rem 'Kanit', sans-serif; }
.a-box { border: 1px solid var(--a-line); border-radius: 14px; padding: 0.8rem 1rem; margin-top: 0.7rem; }
.a-map-search { top: 16px; left: 16px; width: min(460px, calc(100% - 220px)); margin: 0; box-shadow: var(--a-shadow); }
.a-col-mid .a-right { flex-direction: row; top: 14px; }

.a-report { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; padding: 16px; min-height: calc(100vh - var(--a-header-h)); box-sizing: border-box; }
.a-filters { padding: 1.1rem 1.2rem; align-self: start; position: sticky; top: 16px; }
.a-filters h2 { display: flex; align-items: center; gap: 0.6rem; font: 600 1.35rem 'Kanit', sans-serif; margin: 0 0 1rem; }
.a-filters h3 { display: flex; align-items: center; gap: 0.5rem; font: 600 1rem 'Kanit', sans-serif; margin: 1.1rem 0 0.45rem; }
.a-filters select, .a-filters input[type=date] { width: 100%; border: 1px solid var(--a-line); border-radius: 10px; padding: 0.5rem 0.7rem; font: inherit; background: #fff; color: var(--a-ink); box-sizing: border-box; }
.a-filters label { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0; cursor: pointer; }
.a-filters input[type=checkbox] { accent-color: var(--a-teal-dark); width: 18px; height: 18px; }
.a-rtabs { display: flex; gap: 0.3rem; padding: 0.35rem; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.a-rtabs::-webkit-scrollbar { display: none; }
.a-rtabs a { flex: 1 0 auto; white-space: nowrap; text-align: center; padding: 0.5rem 0.65rem; border-radius: 999px; text-decoration: none; color: var(--a-ink); font: 500 0.9rem 'Kanit', sans-serif; }
.a-rtabs a.active { background: var(--a-teal-dark); color: #fff; }
@media (max-width: 1360px) and (min-width: 1025px) {
  .a-report { grid-template-columns: 250px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .a-rtabs a { padding: 0.45rem 0.48rem; font-size: 0.82rem; }
}
@media (max-width: 1024px) and (min-width: 769px) {
  .a-report { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
  .a-report > section { min-width: 0; }
}
.a-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.a-kpi { padding: 0.9rem 1.1rem; display: flex; gap: 0.9rem; align-items: flex-start; }
.a-kpi .a-kpi-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.a-kpi small { display: block; font-weight: 600; font-size: 0.92rem; }
.a-kpi b { display: block; font: 600 2rem 'Kanit', sans-serif; line-height: 1.2; }
.a-kpi span { font-size: 0.85rem; color: var(--a-muted); }
.a-kpi.red { background: #fff1f1; } .a-kpi.red b { color: #dc2626; } .a-kpi.red .a-kpi-ic { background: #fee2e2; color: #dc2626; }
.a-kpi.amber { background: #fff8eb; } .a-kpi.amber b { color: #d97706; } .a-kpi.amber .a-kpi-ic { background: #fef3c7; color: #d97706; }
.a-kpi.green { background: #f0fdf4; } .a-kpi.green b { color: #16a34a; } .a-kpi.green .a-kpi-ic { background: #dcfce7; color: #16a34a; }
.a-kpi.teal .a-kpi-ic { background: var(--a-teal-soft); color: var(--a-teal-dark); }
.a-block { padding: 1rem 1.2rem; margin-bottom: 14px; }
.a-block h3 { display: flex; align-items: center; gap: 0.5rem; font: 600 1.1rem 'Kanit', sans-serif; margin: 0 0 0.6rem; }
.a-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; }
.a-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.a-table th { background: #0f6f5c; color: #fff; padding: 0.5rem; font-weight: 600; text-align: center; }
.a-table th:first-child { border-top-left-radius: 8px; } .a-table th:last-child { border-top-right-radius: 8px; }
.a-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--a-line); text-align: center; }
.a-table.gray th { background: #6b7c7a; }
.a-red { color: #dc2626; font-weight: 700; }
.a-pill-red { background: #fee2e2; color: #b91c1c; border-radius: 6px; padding: 0.1rem 0.5rem; font-weight: 600; }
.a-windrow { display: flex; gap: 2px; align-items: center; overflow: hidden; font-size: 0.75rem; margin-top: 0.4rem; }
.a-windrow svg { flex: 1; min-width: 6px; }
.a-trust { padding: 0.55rem 1rem; font-size: 0.8rem; display: flex; gap: 1rem; flex-wrap: wrap; color: var(--a-muted); }
.a-seg { display: inline-flex; background: #eef6f5; border-radius: 999px; padding: 3px; }
.a-seg button { border: 0; background: none; border-radius: 999px; padding: 0.3rem 0.9rem; cursor: pointer; font: 500 0.85rem 'IBM Plex Sans Thai', sans-serif; color: var(--a-ink); }
.a-seg button.active { background: var(--a-teal-dark); color: #fff; }
.a-pager { display: flex; justify-content: center; gap: 0.3rem; margin-top: 0.6rem; }
.a-pager button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--a-line); background: #fff; cursor: pointer; }
.a-pager button.active { background: var(--a-teal-dark); color: #fff; border-color: var(--a-teal-dark); }

body.a-app .app-dialog { color-scheme: light; }

.a-stage .a-card, .a-col-mid .a-card, .a-stage .a-round, .a-stage .a-round-group, .a-col-mid .a-round, .a-col-mid .a-round-group {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.38));
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(255, 255, 255, 0.25), 0 8px 28px rgba(16, 60, 56, 0.16);
}
.a-stage .a-round-group .a-round, .a-col-mid .a-round-group .a-round { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.a-stage .a-round.active, .a-col-mid .a-round.active { background: var(--a-teal-dark); }
.a-stage .a-sensor, .a-stage .a-search, .a-stage .a-tile, .a-stage .a-chip:not(.active) { background: rgba(255, 255, 255, 0.55); }
.a-stage .a-box { background: rgba(255, 255, 255, 0.68); }
.a-stage .a-status-list, .a-stage .a-sub-body { background: rgba(241, 250, 248, 0.6); }

.a-sensor-left { padding: 0.9rem 1rem; box-sizing: border-box; gap: 0; }
.a-sensor-left label { display: flex; align-items: center; gap: 0.6rem; padding: 0.32rem 0; cursor: pointer; font-size: 0.9rem; }
.a-sensor-left input[type="checkbox"], .a-sensor-left input[type="radio"] { accent-color: var(--a-teal-dark); width: 17px; height: 17px; flex-shrink: 0; }
.a-sensor-right { top: 18px; right: 18px; width: 450px; max-height: calc(100% - 36px); overflow-y: auto; overflow-x: hidden; scrollbar-width: none; -ms-overflow-style: none; padding: 1rem 1.15rem; box-sizing: border-box; z-index: 7; }

@media (min-width: 769px) {
  .a-timeline { width: min(600px, calc(100% - 800px)); min-width: 500px; padding: 0.55rem 1.1rem 0.5rem; border-radius: 24px; box-sizing: border-box; }
  .a-stage.is-sensors-mode .a-right { right: 482px; }
  .a-stage.is-sensors-mode .a-timeline { left: calc(50% - 35px); width: min(560px, calc(100% - 904px)); min-width: 390px; }
  .a-tl-date { font-size: 0.9rem; padding: 0.15rem 0.4rem; gap: 0.3rem; background: rgba(255, 255, 255, 0.5); }
  .a-forecast-pill { font-size: 0.75rem; padding: 0.15rem 0.6rem; }
  .a-stage.is-sensors-mode .a-tl-top { justify-content: center; flex-wrap: wrap; gap: 0.35rem; }
  .a-stage.is-sensors-mode .a-realtime-pill { position: static; transform: none; }
  .a-tl-mid { margin: 0.35rem 0; gap: 0.5rem; }
  .a-play { width: 46px; height: 46px; box-shadow: 0 4px 10px rgba(11, 111, 106, 0.3); }
  .a-play svg { width: 20px; height: 20px; }
  .a-step { width: 30px; height: 30px; background: rgba(255, 255, 255, 0.5); }
  .a-tl-mid .a-range { min-width: 0; }
  .a-tl-bottom { gap: 0.4rem; font-size: 0.78rem; }
  .a-tl-bottom .a-select { font-size: 0.74rem; padding: 0.22rem 0.6rem; background: rgba(227, 245, 242, 0.75); }
  .a-cols .a-timeline { width: auto; min-width: 0; }
}

@media (max-width: 1360px) and (min-width: 769px) {
  .a-left { width: 320px; left: 12px; max-height: calc(100% - 145px); }
  .a-legend { width: 300px; right: 12px; bottom: 12px; padding: 0.65rem 0.85rem; }
  .a-timeline { left: calc(50% + 10px); width: min(520px, calc(100% - 664px)); min-width: 320px; bottom: 12px; padding: 0.5rem 0.9rem 0.45rem; }
  .a-layerbar { left: 344px; padding: 0.25rem; gap: 0.25rem; }
  .a-layerbar button { padding: 0.4rem 0.72rem; font-size: 0.85rem; }
  .a-cols { grid-template-columns: 260px minmax(0, 1fr) 410px; }
  .a-stage.is-sensors-mode .a-right { right: 422px; }
  .a-xsec-pop { width: 305px; right: 68px; }
}

@media (max-width: 1120px) and (min-width: 769px) {
  .a-left { width: 285px; left: 10px; }
  .a-legend { width: 275px; right: 10px; padding: 0.6rem 0.75rem; }
  .a-timeline { width: min(460px, calc(100% - 596px)); min-width: 260px; padding: 0.45rem 0.75rem; }
  .a-layerbar { left: 306px; }
  .a-layerbar button { padding: 0.35rem 0.52rem; font-size: 0.78rem; gap: 0.3rem; }
}

@media (max-height: 820px) and (min-width: 769px) {
  .a-right { top: 10px; right: 12px; gap: 6px; }
  .a-right .a-round { width: 38px; height: 38px; }
}

@media (max-width: 768px) {
  body.a-app { --a-header-h: 58px; --a-tabbar-h: 62px; padding-bottom: calc(var(--a-tabbar-h) + env(safe-area-inset-bottom)); }
  body.a-app.a-full { height: auto; overflow: auto; }
  .a-header { gap: 0.3rem; padding: 0 0.6rem; }
  .a-header .a-brand { flex-shrink: 1; min-width: 0; }
  .a-brand img { height: 36px !important; max-width: 100%; object-fit: contain; }
  .a-header .a-update-pill, .a-datetime small { display: none; }
  .a-datetime { border: 0; padding: 0 0.2rem; margin-left: auto; }
  .a-datetime svg { display: none; }
  .a-datetime b { font-size: 0.95rem; }
  .a-icon-btn { width: 36px; height: 36px; }
  .a-actions { gap: 0.1rem; flex: 1; justify-content: flex-end; }
  .a-menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--a-tabbar-h); padding-bottom: env(safe-area-inset-bottom); background: #fff; box-shadow: 0 -2px 12px rgba(16, 60, 56, 0.12); justify-content: space-around; gap: 0; }
  .a-menu a { flex: 1; flex-direction: column; gap: 2px; padding: 0.45rem 0.2rem; border-radius: 0; font-size: 0.72rem; justify-content: center; }
  .a-menu a.active { background: none; color: var(--a-teal-dark); box-shadow: none; font-weight: 600; }
  .a-menu a.active svg { background: var(--a-teal-soft); border-radius: 999px; padding: 2px 14px; box-sizing: content-box; }
  .a-menu a .a-long { display: none; }
  .a-short { display: inline; }


  .a-stage { height: calc(100dvh - var(--a-header-h) - var(--a-tabbar-h) - env(safe-area-inset-bottom)); overflow: hidden; } 
  .a-layerbar { top: 10px; left: 10px; right: 10px; border-radius: 16px; padding: 4px; gap: 4px; }
  .a-layerbar button { flex: 1; min-width: 0; flex-direction: column; gap: 2px; padding: 0.4rem 0.2rem; border-radius: 12px; font-size: 0.75rem; white-space: nowrap; }
  .a-layerbar button svg { width: 18px; height: 18px; }
  .a-right { top: 10px !important; right: 10px; gap: 8px; }
  .a-layerbar ~ .a-right { top: 78px !important; }
  .a-stage.is-sensors-mode .a-right { top: 10px !important; right: 10px; }
  .a-round { width: 40px; height: 40px; }
  #aPlayRound, #aFull { display: none; }
  .a-sheet { display: flex; flex-direction: column; gap: 10px; position: absolute; left: 0; right: 0; bottom: 0; height: 64%; z-index: 8; overflow-y: auto; overscroll-behavior: contain; padding: 14px 10px 16px; box-sizing: border-box; background: rgba(233, 246, 243, 0.97); border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(16, 60, 56, 0.18); transform: translateY(105%); transition: transform 0.25s ease; }
  .a-sheet.open { transform: none; }
  .a-sheet > .a-float { position: static; transform: none; width: auto; min-width: 0; max-height: none; margin: 0; }
  .a-sheet .a-left { order: 2; overflow: visible; padding: 0; }
  .a-sheet .a-sensor-left { order: 2; overflow: visible; padding: 0.9rem 1rem; }
  .a-sheet .a-sensor-right { order: 1; overflow: visible; padding: 0.9rem 1rem; }
  .a-sheet .a-timeline { order: 0; padding: 0.6rem 0.8rem; }
  .a-sheet .a-legend { order: 1; }
  .a-sheet .a-wx-cards { order: 3; flex-direction: column; }
  .a-sheet-btn { display: flex; align-items: center; gap: 0.4rem; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 9; border: 0; border-radius: 999px; padding: 0.6rem 1.1rem; background: var(--a-teal-dark); color: #fff; font: 600 0.92rem 'Kanit', sans-serif; box-shadow: 0 6px 16px rgba(11, 111, 106, 0.4); cursor: pointer; transition: bottom 0.25s ease; }
  .a-sheet-btn.open { bottom: calc(64% + 8px); }
  .a-sheet-btn.open svg { transform: rotate(180deg); }
  .a-tl-top { justify-content: center; flex-wrap: wrap; gap: 0.4rem; }
  .a-forecast-pill { position: static; }
  .a-realtime-pill { position: static; transform: none; }
  .a-tl-date { font-size: 0.92rem; }
  .a-play { width: 46px; height: 46px; }
  .a-step { width: 32px; height: 32px; }
  .a-tl-mid { gap: 0.4rem; }
  .a-tl-bottom { gap: 0.35rem; font-size: 0.78rem; }
  .a-tl-bottom > span { display: none; }
  .a-info-pop { position: fixed; left: 10px; right: 10px; bottom: calc(var(--a-tabbar-h) + 10px); width: auto; z-index: 45; }
  .a-readout { display: none; }
  .maplibregl-ctrl-scale { display: none; }

  .a-cols { display: block; position: relative; height: calc(100dvh - var(--a-header-h) - var(--a-tabbar-h) - env(safe-area-inset-bottom)); overflow: hidden; }
  .a-cols > .a-col-mid { position: absolute; inset: 0; }
  .a-col-mid .a-map { position: absolute !important; inset: 0; }
  .a-col-mid .a-round-group { bottom: auto !important; top: 64px; }
  .a-col-mid .a-right { top: 10px !important; }
  .a-map-search { width: calc(100% - 130px); top: 10px; left: 10px; }
  .a-cols .a-sheet .a-timeline { margin: 0; z-index: auto; }
  .a-sheet > .a-col-right, .a-sheet > .a-col-left { order: 1; border: 0; border-radius: 18px; padding: 0.9rem 1rem; overflow: visible; }
  .a-sheet > .a-col-left { order: 2; }

  .a-report { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 10px; }
  .a-filters { position: static; padding: 0.9rem 1rem; min-width: 0; }
  .a-filters h2 { font-size: 1.15rem; margin-bottom: 0.3rem; }
  .a-filters h3 { margin: 0.6rem 0 0.3rem; font-size: 0.9rem; }
  .a-filters > label { display: inline-flex; margin-right: 0.8rem; font-size: 0.85rem; }
  .a-report > section { min-width: 0; }
  .a-rtabs { overflow-x: auto; scrollbar-width: none; }
  .a-rtabs a { flex: 0 0 auto; padding: 0.5rem 0.9rem; font-size: 0.9rem; white-space: nowrap; }
  .a-kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 8px; }
  .a-kpi { padding: 0.7rem; gap: 0.5rem; flex-direction: column; }
  .a-kpi .a-kpi-ic { width: 36px; height: 36px; }
  .a-kpi .a-kpi-ic svg { width: 20px; height: 20px; }
  .a-kpi b { font-size: 1.45rem; }
  .a-kpi small { font-size: 0.8rem; }
  .a-kpi span { font-size: 0.75rem; }
  .a-grid2 { grid-template-columns: minmax(0, 1fr) !important; }
  .a-block { padding: 0.8rem; overflow-x: auto; }
  .a-block h3 { flex-wrap: wrap; font-size: 1rem; }
  .a-table { font-size: 0.78rem; min-width: 460px; }
  .a-trust { font-size: 0.72rem; }
  .a-block div[style*="repeat(4"] { grid-template-columns: 1fr 1fr !important; }
  .a-report form.a-block > p { margin-left: 0 !important; }
}
