/* 2026 map-first visual system. Existing component behavior stays in styles.css. */
:root{--ink:#102e3f;--muted:#577185;--line:#dbe7eb;--teal:#087f7d;--navy:#082438;--bg:#edf4f5;--surface:#fff;--shadow:0 18px 55px rgba(6,39,58,.09)}
html{background:var(--bg)}
body{background:radial-gradient(ellipse at 78% -30%,#cff1ec 0,transparent 48%),var(--bg)}
.topbar{background:#082638;height:70px;border-bottom:1px solid #1c4a59;box-shadow:none}
.brand-mark{border:0;background:#1a7b82;color:#d7fff2;box-shadow:inset 0 1px #ffffff50}
.brand strong{font-size:20px;letter-spacing:-.035em}.brand small{color:#9cc4c8;letter-spacing:1.3px}
.live-chip{background:#153e4b;padding:7px 12px;border:1px solid #295866;border-radius:999px;color:#d4f1ed;font-size:11px}
.top-actions{gap:14px}.icon-button{width:40px;height:40px;border-color:#376371;background:#174252}
.kpi-strip{background:transparent;border:0;gap:10px;max-width:1780px;margin:14px auto 0;padding:0 clamp(18px,3.8vw,64px)}
.kpi{border:1px solid var(--line)!important;border-radius:15px;background:#fff;box-shadow:0 5px 18px #0c395514;text-align:left;padding:13px 16px;transition:transform .2s,box-shadow .2s}
.kpi:hover{transform:translateY(-2px);box-shadow:0 12px 26px #0c395526}
.kpi strong{font-size:26px;color:#103c4c}.kpi span{font-size:12px;color:#5e7987;font-weight:600}
.kpi[data-kpi="risk"]:first-child{border-left:4px solid #d84a55!important}.kpi[data-kpi="camera"]{border-left:4px solid #178e9a!important}
.main{padding-top:22px}.intro{margin-bottom:20px}.eyebrow{font:800 10px Manrope,sans-serif;letter-spacing:2px;color:#117f83}
h1{font-size:clamp(30px,3.2vw,48px);letter-spacing:-.05em;margin:5px 0}h1 em{color:#087f7d}.intro p{font-size:14px;color:#577185}
.intro-meta{padding:5px 0}.clock{color:#13394d}
.workspace{grid-template-columns:270px minmax(380px,1fr) 344px;gap:13px;height:min(770px,calc(100dvh - 265px));min-height:620px}
.sidebar,.insights,.map-panel{border-radius:20px;border-color:#d7e4e8;box-shadow:var(--shadow)}
.sidebar{padding:20px 18px;background:#fbfdfd}.sidebar-head{margin-bottom:16px}.sidebar h2,.insights h2{font-size:19px;letter-spacing:-.025em}
.section-kicker{color:#248487;letter-spacing:1.2px;font-size:10px}.area-icon{border-radius:11px}
.location-card{border:1px solid #cde6e4;background:linear-gradient(145deg,#e9f8f5,#f7fcfb);border-radius:15px;padding:15px}
.location-card strong{color:#123d4a}.small-primary{background:#087f7d;border-color:#087f7d}
.layer-row{padding:11px 0}.layer-icon{border-radius:10px}.layer-text strong{font-size:12.5px}.layer-text small{color:#67828f}
.switch{width:38px;height:22px}.switch:after{width:16px;height:16px}.layer-row input:checked+.switch{background:#0b8e8d}.layer-row input:checked+.switch:after{transform:translateX(16px)}
.map-panel{background:#dbeae9}.map-explore{left:16px;top:16px;width:min(425px,calc(100% - 88px))}.map-search{height:50px;border-radius:13px;box-shadow:0 6px 24px #0a34452b}
.map-search button{background:#0b667a}.quick-filters button{padding:7px 13px;border-radius:10px;font-size:11px;box-shadow:0 4px 14px #10283f19}
.quick-filters button.selected{background:#0b667a;border-color:#0b667a}.map-top{top:116px}.map-badge{border-radius:11px;box-shadow:0 4px 18px #173b4b25}
.map-legend{border-radius:12px;gap:8px 13px;max-width:calc(100% - 36px);padding:9px 12px}
.map-locate{bottom:140px}.nont-shortcut{position:absolute;z-index:501;right:16px;bottom:80px;display:flex;align-items:center;gap:11px;min-height:52px;padding:6px 11px;border:1px solid #b8e1dc;border-radius:14px;background:#0c4d60;color:#fff;box-shadow:0 8px 25px #0d354550;text-align:left}
.nont-shortcut strong,.nont-shortcut small{display:block;white-space:nowrap}.nont-shortcut strong{font-size:12px}.nont-shortcut small{font-size:10px;color:#b4e1df}.shortcut-live{width:9px;height:9px;flex:none;background:#4be5b7;box-shadow:0 0 0 4px #4be5b72e;border-radius:50%}.shortcut-arrow{font:800 18px Manrope,sans-serif;color:#aaf3e4;margin-left:3px}
.insights{background:#fff}.insights-head{padding:19px 18px 13px;background:linear-gradient(145deg,#fff,#f4faf9)}.insights-head p{font-size:11px;color:#6c8792;margin:5px 0 0}
.tablist{padding:6px;gap:3px;background:#edf4f4;margin:0 12px;border-radius:12px;border:0;flex-wrap:wrap}.tab{border:0!important;border-radius:8px;padding:8px 6px!important;flex:1 1 29%;font-size:11px!important;color:#54707d}.tab.active{color:#065c64;background:#fff;box-shadow:0 2px 8px #0c44511c}
.tab-content{padding:14px}.station-card,.info-card{border-color:#e0eaed;border-radius:13px;padding:14px}.station-card:hover{background:#f7fbfa}.content-heading strong{font-size:13px}.link-button{font-size:12px;min-height:38px;border-radius:9px}
.cam-grid{gap:9px}.cam-card{aspect-ratio:4/3;border-radius:13px;background:linear-gradient(135deg,#143849,#071e30);border:1px solid #244d5e}.cam-card:has(.cam-video){background:radial-gradient(circle at 75% 20%,#236e79,#0b293d 67%)}.cam-video{font-size:25px;color:#b7e5df}.cam-caption{padding:28px 10px 9px}.cam-caption strong{font-size:12px}.cam-caption small{font-size:10px}.cam-badge{background:#0b293dd9;font-size:10px;padding:4px 8px}
.camera-intro{background:linear-gradient(145deg,#0b374b,#0e6871);color:#fff;border-radius:16px;padding:18px;margin:0 0 18px;box-shadow:0 10px 24px #0b465333}.camera-intro .section-kicker{color:#8ee2d1}.camera-intro h3{font-size:19px;letter-spacing:-.03em;margin:5px 0}.camera-intro p{font-size:11px;line-height:1.6;color:#c9e5e3;margin:0 0 13px}.camera-stat{display:grid;grid-template-columns:auto 1fr auto 1fr;align-items:center;gap:4px 7px;border-top:1px solid #ffffff2c;padding-top:11px}.camera-stat strong{font:800 20px Manrope,sans-serif}.camera-stat span{font-size:10px;line-height:1.2;color:#cce5e6}
.camera-filter-label{display:block;font-size:11px;font-weight:700;color:#526f7c;margin:0 4px 6px}.camera-province{width:100%;min-height:44px;border:1px solid #c9dfe1;border-radius:10px;background:#f8fbfb;color:#193c4c;padding:8px 12px;font:600 13px 'IBM Plex Sans Thai',sans-serif}.camera-coverage{font-size:11px;color:#67828f;margin:6px 4px 12px}
.camera-preview video{width:100%;height:100%;object-fit:contain;background:#071c29}.camera-fullscreen{border:0;cursor:pointer;margin-top:8px}.camera-popup a{margin-left:5px}
.camera-popup strong{color:#123b4c}.camera-viewer{border-radius:20px}.viewer-head{padding:17px 18px}.viewer-foot{padding:14px 18px}
.footer{color:#667f8d;padding-top:18px}.footer strong{color:#0b667a}.footer a{color:#317488}
@media(max-width:1250px){.workspace{grid-template-columns:245px minmax(310px,1fr)}.insights{grid-column:1/-1}.tab-content{max-height:420px}.map-panel{min-height:620px}}
@media(max-width:720px){
  body{background:#eff5f5}.topbar{height:58px;padding:0 15px}.brand-mark{width:34px;height:34px;border-radius:10px}.brand strong{font-size:17px}.brand small{font-size:8px}.updated-at{font-size:10px}.updated-at b{font-size:11px}.top-actions{gap:8px}.icon-button{width:34px;height:34px}
  .kpi-strip{gap:5px;padding:6px 8px;margin:0;background:#f2f7f6}.kpi{padding:6px 6px;border-radius:9px;text-align:center;box-shadow:none}.kpi strong{font-size:18px}.kpi span{font-size:9px;line-height:1.1;display:block}
  .main{padding:0 0 calc(64px + env(safe-area-inset-bottom))}.workspace{gap:0}.map-panel{border:0;border-radius:0;min-height:0;box-shadow:none}.map-explore{left:10px;top:10px;width:calc(100% - 20px)}.map-search{height:45px}.map-search input{font-size:13px}.filter-button{background:#fff;border-color:#cfe0e4;color:#0b667a;box-shadow:0 4px 14px #10283f24}.map-top{top:66px;left:10px;right:10px}.map-badge{font-size:10px;padding:8px 10px}.map-locate{bottom:143px;right:10px;font-size:11px;min-height:40px}.nont-shortcut{right:10px;bottom:82px;min-height:50px;max-width:190px}.nont-shortcut strong{font-size:11px}.nont-shortcut small{font-size:9px}
  .insights{border:0;box-shadow:none}.tab-content{padding:15px 13px 25px;max-height:none}.camera-intro{padding:19px}.cam-grid{gap:10px}.cam-card{aspect-ratio:4/3}.cam-caption strong{font-size:12px}.camera-province{font-size:16px}
  .mobile-nav{background:#fff;border-top:1px solid #dce8e9;box-shadow:0 -8px 26px #10283f12}.mobile-nav button{color:#5d7986;font-size:21px}.mobile-nav button.active{color:#087f7d}.mobile-nav button[data-nav="camera"]{color:#087f7d}.mobile-nav button[data-nav="camera"] .nav-icon{background:#e5f7f3;border-radius:9px;padding:0 6px}
  .sidebar.is-open{border-radius:22px 22px 0 0}.sheet-close{min-height:40px}
}

/* v0.6.1 — map canvas with contextual drawers instead of three fixed columns. */
.water-trend{display:inline-flex;align-items:center;gap:4px;margin:7px 0 2px;padding:3px 8px;border-radius:7px;background:#edf5f4;color:#466476;font-size:11px;font-weight:750}
.water-trend small{font-size:10px;font-weight:500;color:#66818a}
.water-trend.is-up{background:#fff0e8;color:#b44c23}
.water-trend.is-down{background:#e7f6f2;color:#087d65}
.water-trend.is-flat{background:#edf2f6;color:#405f73}
.water-trend.is-unknown{background:#f0f3f4;color:#68818b;font-weight:500}
@media(min-width:721px){
  .shell{height:100dvh;min-height:680px;display:flex;flex-direction:column;overflow:hidden}
  .topbar{height:64px;flex:none;padding:0 22px;z-index:2}
  .top-actions .nont-shortcut{position:static;min-height:38px;max-width:none;padding:4px 10px;border-radius:10px;box-shadow:none;background:#12495b;color:#fff}
  .nont-shortcut strong{font-size:11px}.nont-shortcut small{font-size:9px}
  .alert-banner{flex:none;min-height:34px;padding:6px 22px;font-size:12px;text-align:left}
  .kpi-strip{max-width:none;width:100%;margin:0;padding:6px 20px;gap:0;display:flex;flex:none;background:#f8fbfa;border-bottom:1px solid #dce9e8}
  .kpi{display:flex;align-items:baseline;gap:8px;min-width:0;flex:0 1 190px;padding:3px 12px!important;border:0!important;border-right:1px solid #dbe7e8!important;border-radius:0;box-shadow:none;background:none}
  .kpi[data-kpi="risk"]:first-child,.kpi[data-kpi="camera"]{border-left:0!important}
  .kpi strong{font-size:21px}.kpi span{white-space:nowrap;font-size:11px}.kpi:hover{transform:none;box-shadow:none;background:#eef7f5}
  .main{max-width:none;width:100%;min-height:0;flex:1;display:flex;flex-direction:column;margin:0;padding:0}
  .intro{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .workspace{position:relative;display:block;flex:1;min-height:0;height:auto;isolation:isolate}
  .map-panel{position:absolute;inset:0;width:100%;min-height:0;border:0;border-radius:0;box-shadow:none}
  .map-explore{left:20px;top:18px;width:min(470px,calc(100% - 440px));display:grid;grid-template-columns:1fr auto;gap:8px;align-items:start}
  .map-search{grid-column:1/-1}.quick-filters{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:6px}
  .filter-button{display:inline-flex;grid-column:2;grid-row:1;min-height:48px;align-items:center;border:1px solid #d0e1e2;border-radius:12px;background:#fff;padding:0 14px;font-size:12px;font-weight:800;color:#0a6572;box-shadow:0 5px 20px #103b4b24}
  .map-explore .map-search{grid-column:1;grid-row:1}.map-explore .search-message{grid-column:1/-1}
  .map-top{left:20px;right:auto;top:134px}.map-top .map-tool{display:none}.map-badge{font-size:11px;padding:8px 11px}
  .sidebar{display:none;position:absolute;z-index:800;left:20px;top:85px;bottom:18px;width:310px;min-height:0;padding:18px;border-radius:16px;box-shadow:0 24px 70px #092d3c3b}
  .sidebar.is-open{display:flex}.sheet-close{display:block;align-self:flex-end;border:0;background:#eaf3f3;color:#194659;border-radius:8px;padding:5px 10px;margin:-5px -5px 10px;font-weight:700}
  .insights{position:absolute;z-index:600;right:18px;top:18px;bottom:18px;width:350px;min-height:0;border-radius:18px;box-shadow:0 20px 65px #092d3c33}
  .insights-head{padding:16px 18px 10px}.insights h2{font-size:17px}.insights-head p{margin:3px 0 0}
  .tablist{margin:0 12px}.tab-content{min-height:0;max-height:none}
  .map-locate{right:386px;bottom:31px;width:48px;height:48px;min-width:48px;min-height:48px;padding:0;border:1px solid #cee2e4;border-radius:13px;display:grid;place-items:center;background:#fff;color:#096b78;box-shadow:0 8px 22px #103b4b2e;font-size:0}
  .map-locate svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
  .map-legend{left:20px;bottom:20px;right:460px;max-width:620px;width:max-content;max-height:62px;overflow:hidden;font-size:10px;padding:7px 10px}
  .footer{display:none}
}
@media(min-width:721px) and (max-width:1100px){
  .insights{width:315px}.map-explore{width:min(430px,calc(100% - 370px))}.map-locate{right:348px}.map-legend{right:370px}
}
@media(max-width:720px){
  .top-actions .nont-shortcut{position:static;min-height:36px;max-width:none;padding:6px 9px;border-radius:10px;box-shadow:none;background:#12495b}
  .top-actions .nont-shortcut small,.top-actions .shortcut-arrow{display:none}
  .top-actions .nont-shortcut strong{font-size:10px}
  .updated-at{display:none}
  .map-locate{right:11px;bottom:21px;width:48px;height:48px;min-height:48px;min-width:48px;padding:0;border-radius:13px;display:grid;place-items:center;font-size:0}
  .map-locate svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
}
.traffic-grid{display:flex;flex-direction:column;gap:7px}
.traffic-grid .cam-card{display:grid;grid-template-columns:88px minmax(0,1fr);align-items:stretch;min-height:79px;aspect-ratio:auto;border:1px solid #dce8e9;border-radius:11px;background:#f7fbfb;color:#173e50}
.traffic-grid .cam-thumb{position:relative;inset:auto;grid-column:1;grid-row:1;min-height:78px;background:#d7e7e9;overflow:hidden}
.traffic-grid .cam-thumb img{width:100%;height:100%;object-fit:cover}
.traffic-grid .cam-caption{position:static;inset:auto;grid-column:2;grid-row:1;align-self:center;padding:9px 10px;background:none;min-width:0}
.traffic-grid .cam-caption strong{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-size:11px;line-height:1.4;color:#173e50}
.traffic-grid .cam-caption small{display:block;margin-top:4px;color:#6b8791;font-size:10px}
.traffic-grid .cam-badge{left:5px;top:5px;padding:2px 5px;font-size:9px;z-index:2}
.traffic-grid .cam-card:has(.cam-badge.is-offline) .cam-thumb{background:#e7eff0}
.traffic-grid .cam-card:has(.cam-badge.is-offline) .cam-thumb img{visibility:hidden}
.traffic-grid .cam-card:has(.cam-badge.is-offline) .cam-badge{background:#526c78}
.traffic-grid .cam-card:hover{border-color:#69aaa9;background:#eef9f6}
/* v0.7.0 — live camera list (ui/live-grid.js): big live cards, then compact tiles by distance. */
.cam-grid.cam-heroes{display:grid;grid-template-columns:1fr;gap:12px}
.cam-grid.cam-tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin-bottom:12px}
.cam-grid.cam-water{grid-template-columns:repeat(2,minmax(0,1fr))}
.cam-card{background:#0d1b26;border:0;color:#fff}
.cam-card.cam-hero{aspect-ratio:16/9;border-radius:16px;box-shadow:0 8px 22px #0a2a3a33}
.cam-card.cam-tile{aspect-ratio:16/10;border-radius:12px}
.cam-thumb{background:#14222d}
.cam-thumb img{transition:opacity .25s}
.cam-live{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:transparent;opacity:0;transition:opacity .3s;pointer-events:none}
.cam-card.is-playing .cam-live{opacity:1}
.cam-card.is-playing .cam-thumb img{opacity:0}
.cam-card.is-streaming .cam-placeholder{display:none}
.cam-card.is-offline .cam-thumb img{opacity:.35}
.cam-placeholder{width:42px;height:42px;border-radius:50%;background:#ffffff26;display:grid;place-items:center;font-size:15px;color:#fff;padding-left:3px;backdrop-filter:blur(4px)}
.cam-tile .cam-placeholder{width:34px;height:34px;font-size:12px}
.cam-badge{z-index:2;left:auto;right:8px;top:8px;background:#0b1720d9;color:#fff;border-radius:999px;padding:4px 10px;font:700 11px Manrope,'IBM Plex Sans Thai',sans-serif;letter-spacing:.2px;max-width:calc(100% - 16px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cam-badge[hidden]{display:none}
.cam-hero .cam-badge{right:12px;top:12px;padding:6px 12px;font-size:12px}
.cam-badge.is-live{background:#0b1720e6}
.cam-badge.is-live::before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;background:#ff3b30;margin-right:6px;vertical-align:0;animation:live-dot 1.4s ease-in-out infinite}
.cam-badge.is-offline{background:#7a2334e6}
.cam-badge.is-idle{background:#0b1720b3}
.cam-caption{display:flex;align-items:flex-end;justify-content:space-between;gap:8px;padding:26px 10px 8px;background:linear-gradient(transparent,#000c)}
.cam-title{min-width:0;display:block}
.cam-title strong,.cam-title small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cam-distance{flex:none;font:700 11px Manrope,'IBM Plex Sans Thai',sans-serif;opacity:.9}
.cam-hero .cam-caption{padding:44px 16px 13px}
.cam-hero .cam-title strong{font-size:17px}.cam-hero .cam-title small{font-size:12px;opacity:.8;margin-top:2px}
.cam-hero .cam-distance{font-size:14px}
.cam-tile .cam-title strong{font-size:11px}.cam-tile .cam-title small{display:none}.cam-tile .cam-distance{font-size:10px}
.cam-tile .cam-caption{padding:18px 7px 6px}
.cam-tile .cam-badge{right:5px;top:5px;padding:2px 7px;font-size:10px}
.live-heading strong{display:flex;align-items:center;gap:7px;font-size:15px}
.live-dot{width:9px;height:9px;border-radius:50%;background:#ff3b30;box-shadow:0 0 0 4px #ff3b3026}
.band-heading{font-size:12px;font-weight:700;color:#6b8491;margin:14px 4px 8px}
@keyframes live-dot{50%{opacity:.35}}
@media(prefers-reduced-motion:reduce){.cam-badge.is-live::before{animation:none}.cam-live,.cam-thumb img{transition:none}}
/* v0.8.0 — emergency hotlines and rain radar. */
.hotlines{margin-top:18px}
.hotline-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.hotline{display:flex;align-items:center;gap:10px;min-height:58px;padding:9px 11px;border:1px solid #e0eaed;border-radius:13px;background:#fff;color:#123b4c;text-decoration:none}
.hotline:hover,.hotline:focus-visible{border-color:#38aaa5;background:#f4fbfa}
.hotline-icon{width:36px;height:36px;flex:none;border-radius:50%;display:grid;place-items:center;background:#1fa35b;color:#fff}
.hotline.is-urgent .hotline-icon{background:#e5484d}
.hotline-icon svg{width:17px;height:17px;fill:currentColor}
.hotline-text{min-width:0}
.hotline-text strong{display:block;font:800 17px Manrope,'IBM Plex Sans Thai',sans-serif;letter-spacing:.3px}
.hotline-text small{display:block;font-size:11px;color:#5d7986;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.radar-card .link-button{margin-right:6px}
.legend-dot.radar{background:linear-gradient(90deg,#8fd3ff,#2f6fe0,#f5c542,#e5484d)}
