@media screen{
 .detail-summary-layout{display:grid;grid-template-columns:minmax(280px,38%) minmax(0,1fr);gap:20px;margin:20px 0;align-items:start}
 .detail-summary-side{display:grid;gap:16px;min-width:0}.detail-summary-side>.panel,.detail-summary-side .water-layout{margin:0!important;width:100%;max-width:none}
 .detail-summary-layout #detailVideoMount{width:100%;max-width:none;margin:0}
 .detail-summary-layout #detailVideoMount .home-camera video{aspect-ratio:3/4;width:100%;height:auto;max-height:600px;object-fit:contain;background:var(--bg)}
 .detail-summary-layout .fleet-video-panel{margin:0}.detail-summary-layout .fleet-detail-media{aspect-ratio:3/4;max-height:600px}.detail-summary-layout .fleet-detail-media #fleetImage{width:100%;height:100%;object-fit:contain}
 .detail-station-info{padding:20px}.detail-station-info h2{font-size:16px;margin:0 0 14px}.detail-station-info dl{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:0 0 18px}.detail-station-info dl>div{min-width:0}.detail-station-info dt{font-size:12px;color:var(--muted)}.detail-station-info dd{margin:4px 0 0;font-weight:700;overflow-wrap:anywhere}
 .detail-summary-side .water-body{grid-template-columns:1fr;gap:12px}.detail-summary-side .level-context{border-left:0;border-top:1px solid var(--line);padding:12px 0 0}.detail-summary-side .water-number #waterLevel{font-size:52px}.detail-summary-side .water-panel{padding:20px}.detail-summary-side .water-foot{margin-top:12px}
 #stationDetail>.device-strip{display:none}#stationDetail .home-bottom{display:grid;grid-template-columns:1fr;gap:20px}#stationDetail #trend{margin-top:0}
 .event-table-scroll{overflow-x:auto}.station-event-table{width:100%;border-collapse:collapse;min-width:650px;font-size:13px}.station-event-table caption{text-align:left;color:var(--muted);padding:8px 0 14px}.station-event-table th,.station-event-table td{border:1px solid var(--line);padding:12px;text-align:left;vertical-align:middle}.station-event-table th{background:var(--surface);font-weight:700}.station-event-table tbody tr:nth-child(even){background:color-mix(in srgb,var(--surface) 50%,transparent)}.station-event-table img{width:100px;height:65px;object-fit:contain;border-radius:6px}.station-event-table td:first-child{width:50px}
 @media(max-width:760px){.detail-summary-layout{grid-template-columns:1fr}.detail-summary-layout #detailVideoMount .home-camera video{aspect-ratio:16/9;max-height:420px}.detail-summary-layout .fleet-detail-media{aspect-ratio:16/9}.detail-station-info dl{grid-template-columns:1fr 1fr}}
}

@media screen{
.detail-summary-layout{grid-template-columns:minmax(260px,32%) minmax(0,1fr);gap:24px;padding:20px;border:1px solid var(--line);border-radius:18px;background:var(--panel);align-items:start}
.detail-summary-side{gap:14px}.detail-summary-layout .panel{border:0!important;box-shadow:none!important;border-radius:0;background:transparent!important}.detail-summary-side .detail-station-info{padding:0 0 12px;border-bottom:1px solid var(--line)!important}.detail-station-info h2{display:none}.detail-station-info dl{gap:12px;margin:0 0 14px}.detail-station-info dl>div{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}.detail-station-info dt{font-size:14px}.detail-station-info dd{text-align:left;font-size:15px;margin:0}.detail-summary-side .water-panel,.detail-summary-side .fleet-reading-panel{padding:0!important}.detail-summary-side .water-number #waterLevel{font-size:44px}.detail-summary-side .water-title .tag,.detail-summary-side .water-title small,.detail-summary-side .water-foot{display:none}.detail-summary-side .water-body{margin-top:12px;gap:10px}.detail-summary-side .water-body p{margin:8px 0}.reading-technical summary,.level-context summary{cursor:pointer;font-size:14px;min-height:36px;display:list-item;align-content:center}.reading-technical{margin-top:8px}.detail-summary-side .level-context{padding:8px 0 0}.level-context h3{display:none}.detail-summary-layout #detailVideoMount .home-camera video{aspect-ratio:16/9;max-height:360px}.detail-summary-layout .fleet-detail-media{aspect-ratio:16/9;max-height:360px}.detail-summary-layout .home-camera>.actions:first-child,.detail-summary-layout .fleet-video-panel>header{padding:0 0 12px!important}.detail-summary-layout .home-camera>.actions:not(:first-child){padding:8px 0!important}.detail-summary-layout .home-camera>#state{margin:4px 0!important}.detail-summary-layout .fleet-reading-panel #fleetLevel{font-size:44px}.event-table-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:16px 0 0}.event-table-pagination button{min-width:110px;min-height:44px;font-size:16px;border-radius:10px;padding:8px 16px}.event-table-pagination button:disabled{opacity:.45;cursor:default}.event-table-pagination span{font-size:15px}.station-event-table{font-size:15px}.station-event-table th,.station-event-table td{padding:10px 12px}.station-event-table img{width:80px;height:48px}.station-event-table a{display:inline-flex;align-items:center;gap:8px;min-height:44px}.station-event-table a span{font-size:14px;white-space:nowrap}
@media(max-width:760px){.detail-summary-layout{grid-template-columns:1fr;padding:16px;gap:16px}.detail-station-info dl{grid-template-columns:1fr}.event-table-pagination{justify-content:center}.event-table-pagination span{flex-basis:100%;text-align:center;order:-1}}
}

@media screen{.detail-summary-side .water-body{grid-template-columns:minmax(180px,1fr) minmax(260px,1.2fr);align-items:start;gap:20px}.detail-summary-side .level-context{grid-column:1/-1;grid-row:2}.water-quick-summary{grid-column:2;grid-row:1;padding:18px;border:1px solid var(--line);border-radius:14px;background:var(--surface);min-width:0}.water-quick-summary h3{margin:0 0 12px;font-size:18px}.water-quick-summary h4{margin:18px 0 6px;font-size:14px;color:var(--muted)}.water-quick-summary p{font-size:14px;line-height:1.7}.water-quick-summary strong{font-size:18px}.quick-meter{position:relative;height:18px;margin:22px 8px 16px}.quick-meter span{display:block;height:100%;border-radius:10px;background:var(--line)}.quick-meter i{position:absolute;top:-7px;width:5px;height:32px;background:var(--text,#fff);border:2px solid var(--panel);border-radius:4px;transform:translateX(-50%)}.fleet-reading-panel .water-quick-summary{margin-top:16px}@media(max-width:1100px){.detail-summary-side .water-body{grid-template-columns:1fr}.water-quick-summary{grid-column:1;grid-row:2}.detail-summary-side .level-context{grid-row:3}}}@media print{.water-quick-summary{display:none}}

@media screen{.detail-summary-layout #stats,.detail-summary-layout .home-camera .tag,.detail-summary-side .reading-technical,.detail-summary-side .level-context{display:none!important}.detail-summary-side .water-body{margin-bottom:0}.detail-station-info dl{margin-bottom:0}}

@media screen{
.detail-summary-layout{gap:16px;padding:16px;margin:14px 0;grid-template-columns:minmax(260px,36%) minmax(0,1fr)}
.detail-summary-side{gap:10px}.detail-station-info dl{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-width:660px}
.detail-summary-side .water-body{grid-template-columns:minmax(150px,190px) minmax(0,1fr);gap:16px;margin-top:8px}.water-quick-summary{padding:14px}.water-quick-summary h4{margin-top:12px}.water-quick-summary h3{margin-bottom:8px}.quick-meter{margin-top:16px;margin-bottom:12px}
#stationDetail .home-bottom{gap:14px;margin-top:14px}#stationDetail>.ops-hero{margin-bottom:14px;padding-top:12px;padding-bottom:12px}.ops-footer{margin-top:20px;padding-top:12px}
@media(max-width:1100px){.detail-summary-side .water-body{grid-template-columns:1fr}.water-quick-summary{grid-column:1;grid-row:2}}
@media(max-width:760px){.detail-summary-layout{grid-template-columns:1fr}.detail-station-info dl{grid-template-columns:1fr}}
}

@media screen{#stationDetail #alerts{display:none!important}.event-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.detail-summary-layout .fleet-video-panel video{width:100%;aspect-ratio:16/9;object-fit:contain;max-height:360px}.fleet-reading-panel>strong{font-size:44px}.sample-detail{background:transparent!important;border:0!important;padding:0!important}}

@media screen and (min-width:1101px){.fleet-reading-panel{display:grid;grid-template-columns:minmax(150px,190px) minmax(0,1fr);column-gap:16px;align-content:start}.fleet-reading-panel>h2,.fleet-reading-panel>p,.fleet-reading-panel>strong,.fleet-reading-panel>a{grid-column:1}.fleet-reading-panel .water-quick-summary{grid-column:2;grid-row:1/7;margin-top:0}.fleet-reading-panel>h2{font-size:16px}}

@media screen{.detail-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:16px 0 8px}.detail-account{display:flex;gap:12px;align-items:center;border:0!important;padding:0!important;margin:0!important;min-height:0!important}.detail-account>b{display:none}.reading-history{display:inline-flex;margin-top:22px;min-height:44px;align-items:center}.detail-summary-side .water-body{column-gap:28px;grid-template-columns:minmax(170px,210px) minmax(0,1fr)}.quick-meter,[data-limits]{display:none}.quick-bands{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:16px 0}.quick-band{padding:12px 8px;border:1px solid var(--line);border-top:4px solid #269bb6;border-radius:9px}.quick-band.warning{border-top-color:#d99a16}.quick-band.critical{border-top-color:#e14e65}.quick-band span{display:block;font-size:14px}.quick-band strong{display:block;margin-top:8px;font-size:17px}.quick-distance{grid-column:1/-1;margin:6px 0!important}.fleet-detail>.page-toolbar #fleetUser{margin-left:auto;order:2}.fleet-detail>.page-toolbar [data-theme-toggle]{order:3}.fleet-detail>.page-toolbar #fleetLogout{order:4}.fleet-reading-panel .reading-history{grid-column:1}@media(max-width:1100px){.detail-summary-side .water-body{grid-template-columns:1fr}}@media(max-width:480px){.quick-bands{grid-template-columns:1fr}.quick-band{display:flex;justify-content:space-between;align-items:center}.quick-band strong{margin:0}.detail-account{flex-wrap:wrap}.detail-account .tag{font-size:12px}}}

@media screen{
#stationOverview>.ops-hero{display:grid;grid-template-columns:minmax(240px,1fr) auto auto;gap:20px;align-items:center}#stationOverview .overview-tools{display:flex;gap:10px;align-items:end}#stationOverview .detail-account{justify-content:flex-end}#stationOverview .detail-account #user{max-width:180px;white-space:normal}#stationOverview .detail-account button{white-space:nowrap}.detail-station-info.has-expand{display:flex;align-items:start;justify-content:space-between;gap:16px}.detail-station-info.has-expand dl{flex:1}.detail-station-info.has-expand #realCameraLink{white-space:nowrap;flex-shrink:0}.detail-camera-badge{display:flex;flex-direction:column;align-items:center;width:58px;gap:8px;margin:0 0 18px}.detail-camera-badge small{font-size:9px;color:var(--muted)}.detail-camera-badge b{font-size:28px;line-height:1}.detail-camera-badge .station-signal{position:static;display:block;width:14px;height:14px}.detail-summary-side .water-body{grid-template-columns:minmax(145px,165px) minmax(0,1fr);column-gap:24px}.detail-summary-layout{grid-template-columns:minmax(280px,36%) minmax(0,1fr)}.detail-summary-side .water-title{display:none}.water-body>.water-quick-summary{align-self:end}.water-body>div:first-child:has(.water-number) .water-number:before{content:'ระดับน้ำปัจจุบัน';display:block;font-size:16px;letter-spacing:0;font-weight:700;width:100%}.water-number{flex-wrap:wrap;row-gap:8px}.fleet-reading-panel .detail-camera-badge{grid-column:1}.fleet-reading-panel .water-quick-summary{grid-row:1/9}.detail-summary-side .reading-history{margin-top:20px}
@media(max-width:1250px){#stationOverview>.ops-hero{grid-template-columns:1fr auto}#stationOverview .detail-account{grid-column:1/-1}#stationOverview .overview-tools{flex-wrap:wrap}}
@media(max-width:1100px){.detail-summary-side .water-body{grid-template-columns:1fr}.detail-station-info.has-expand{flex-wrap:wrap}.water-body>.water-quick-summary{align-self:start}}
@media(max-width:760px){.detail-summary-layout{grid-template-columns:1fr}#stationOverview>.ops-hero{grid-template-columns:1fr}#stationOverview .detail-account{justify-content:flex-start;flex-wrap:wrap}.detail-station-info.has-expand dl{flex-basis:100%}}
}

/* Compact mode preserves the complete original card; only scale and grid density change. */
@media screen{
body.monitor-mode .home-main:has(#stationOverview:not([hidden])){max-width:none}
.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.monitor-mode #stationOverview .station-card{zoom:.70}
@media(min-width:2200px){.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(6,minmax(0,1fr))}}
@media(max-width:1599px){.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:1250px){.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:850px){.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:540px){.monitor-mode #stationOverview .station-grid{grid-template-columns:1fr}.monitor-mode #stationOverview .station-card{zoom:1}}
}

@media screen{#stationOverview .home-metrics{gap:10px;margin-bottom:16px}#stationOverview .home-metrics>.panel{padding:12px 16px;border-radius:14px;min-height:0}#stationOverview .home-metrics small{font-size:12px}#stationOverview .home-metrics .metric{font-size:22px;line-height:1.25;margin:6px 0}#stationOverview .home-metrics p{font-size:12px;line-height:1.4;margin:4px 0 0}}

.home-sidebar nav>button{font:inherit;font-size:14px;text-align:left;padding:12px;border:0;background:transparent;color:var(--accent);cursor:pointer;border-radius:10px}.home-sidebar nav>button:hover{background:var(--surface)}.sidebar-dialog{width:min(680px,calc(100vw - 32px));max-height:85vh;box-sizing:border-box;overflow:auto;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:18px;padding:24px}.sidebar-dialog::backdrop{background:#0009}.sidebar-dialog header{display:flex;justify-content:space-between;align-items:center;gap:12px}.sidebar-dialog header h2{font-size:22px}.sidebar-dialog section{border-top:1px solid var(--line);padding:12px 0}.sidebar-dialog p{line-height:1.8}.sidebar-dialog label{display:block;margin:16px 0}.sidebar-dialog input{display:block;box-sizing:border-box;width:100%;margin-top:6px;padding:12px;font:inherit;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:8px}.sidebar-dialog button{min-height:44px;padding:10px 16px;cursor:pointer}

@media screen{
.home-sidebar .sidebar-account{margin-top:auto;display:grid;gap:12px}.home-sidebar>.panel{display:none}.sidebar-account .tag{white-space:normal}.sidebar-account button{min-height:44px}.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(9,minmax(0,1fr));gap:8px}.monitor-mode #stationOverview .station-card{zoom:.48}.home-layout{grid-template-columns:200px minmax(0,1fr)}.home-sidebar{padding:20px 16px}.monitor-mode .home-main{padding-left:20px;padding-right:20px}#stationOverview>.monitor-header{grid-template-columns:minmax(210px,1.3fr) minmax(360px,1.5fr) auto auto;gap:12px;align-items:center}#stationOverview .monitor-header h1{font-size:24px}#stationOverview .monitor-header .home-metrics{display:grid;grid-template-columns:1fr 1.3fr;margin:0;gap:8px}#stationOverview .monitor-header .home-metrics>.panel:nth-child(n+3){display:none}#stationOverview .monitor-header .metric{font-size:18px}#stationOverview .monitor-header .station-search input{width:180px}.monitor-header .detail-account{grid-column:auto!important}
@media(max-width:1599px){#stationOverview>.monitor-header{grid-template-columns:1fr 1fr}#stationOverview .monitor-header .detail-account{justify-content:flex-end}.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(6,minmax(0,1fr))}.monitor-mode #stationOverview .station-card{zoom:.58}}
@media(max-width:1023px){.home-layout{grid-template-columns:1fr}.sidebar-account{display:flex!important;align-items:center;flex-wrap:wrap}.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:650px){#stationOverview>.monitor-header{grid-template-columns:1fr}.monitor-mode #stationOverview .station-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.monitor-mode #stationOverview .station-card{zoom:.65}}
@media(max-width:390px){.monitor-mode #stationOverview .station-grid{grid-template-columns:1fr}.monitor-mode #stationOverview .station-card{zoom:.85}}
}

@media screen{
.home-sidebar nav{gap:6px}
.home-sidebar nav>a,.home-sidebar nav>button{display:flex!important;align-items:center;justify-content:flex-start!important;width:100%;box-sizing:border-box;min-height:46px;margin:0!important;padding:12px!important;border:0!important;border-radius:10px!important;background:transparent!important;box-shadow:none!important;color:var(--accent)!important;text-align:left!important;font-family:inherit!important;font-size:14px!important;font-weight:400!important;line-height:1.5;text-decoration:none;cursor:pointer}
.home-sidebar nav>a.active{background:color-mix(in srgb,var(--accent) 12%,transparent)!important;box-shadow:inset 3px 0 var(--accent)!important}
.home-sidebar nav>a:hover,.home-sidebar nav>button:hover{background:var(--surface)!important}
.home-sidebar nav>a:focus-visible,.home-sidebar nav>button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
#stationOverview>.monitor-header{display:flex;justify-content:flex-start;align-items:center;gap:14px;flex-wrap:wrap;padding:18px 0;margin:0 0 12px}
#stationOverview>.monitor-header>div:first-child{flex:0 1 350px;min-width:250px}
#stationOverview .monitor-header .home-metrics{flex:0 1 460px;min-width:350px;grid-template-columns:minmax(125px,.75fr) minmax(200px,1.25fr)}
#stationOverview .monitor-header .home-metrics>.panel{padding:10px 12px}
#stationOverview .monitor-header .overview-tools{display:flex;justify-content:flex-start;align-items:flex-end;gap:10px;flex:0 1 auto;margin:0;flex-wrap:wrap}
#stationOverview .monitor-header .station-search{margin:0;display:grid;gap:6px}#stationOverview .monitor-header .station-search input{margin:0;width:180px}
#stationOverview .monitor-header .detail-account{margin:0!important;align-self:center}#stationOverview .monitor-header .manage-cameras{margin:0!important}
#stationOverview .monitor-header h1{margin:6px 0;font-size:23px}
@media(max-width:650px){#stationOverview>.monitor-header>div:first-child,#stationOverview .monitor-header .home-metrics{flex-basis:100%;min-width:0}#stationOverview .monitor-header .home-metrics{grid-template-columns:1fr 1fr}#stationOverview .monitor-header .overview-tools{flex:1 1 250px}#stationOverview .monitor-header .station-search{flex:1}#stationOverview .monitor-header .station-search input{width:100%}}
}

@media screen{
#stationOverview .monitor-header .home-metrics{flex:0 1 530px;grid-template-columns:repeat(3,minmax(0,1fr));min-width:390px}#stationOverview .monitor-header .home-metrics>.panel:nth-child(3){display:block}#stationOverview .monitor-header .home-metrics>.panel:nth-child(n+4){display:none}#stationOverview .monitor-header .overview-tools{gap:8px;flex:0 0 auto;justify-content:flex-start}#stationOverview .monitor-header .station-search{width:180px;min-width:0;flex:0 0 180px}#stationOverview .monitor-header .station-search input{width:180px;min-width:0;box-sizing:border-box}#stationOverview .monitor-header .manage-cameras{align-self:flex-end}#stationOverview .monitor-header .detail-account{margin-left:auto!important}#stationOverview>.monitor-header>div:first-child{flex-basis:325px}#stationOverview>.monitor-header{gap:12px}#cameraOfflineCount{color:var(--muted)}
@media(max-width:650px){#stationOverview .monitor-header .home-metrics{min-width:0;flex-basis:100%;grid-template-columns:repeat(3,minmax(0,1fr))}#stationOverview .monitor-header .home-metrics>.panel{padding:10px 8px}#stationOverview .monitor-header .home-metrics p{font-size:11px}#stationOverview .monitor-header .overview-tools{flex:1 1 auto}}
}

/* Camera removal stays separate from the number and status light. */
.fleet-card{position:relative}

.camera-delete-button{position:absolute;right:8px;top:6px;width:36px;height:30px;padding:0;line-height:1;font-size:28px;border:1px solid #a64753;border-radius:6px;color:#ff9ca6;background:var(--panel,#102131);cursor:pointer}
.camera-delete-dialog{max-width:480px;width:calc(100% - 32px)}
.camera-delete-dialog label{display:block}
.camera-delete-dialog input{display:block;width:100%;box-sizing:border-box;margin:8px 0 16px;padding:12px}
.camera-delete-dialog button{margin:8px 8px 0 0}
.camera-delete-dialog [role=alert]{color:#ef667a}

/* Keep the remove control on the outer corner, above the camera number. */
#stationOverview .fleet-card{overflow:visible}
#stationOverview .fleet-card .station-meta{border-radius:24px 24px 0 0}
#stationOverview .fleet-card .station-actions{border-radius:0 0 24px 24px;overflow:hidden}
#stationOverview .camera-delete-button{top:-24px;right:-8px;width:32px;height:32px;min-width:0;min-height:0;max-height:32px;border-radius:50%;z-index:3;background:var(--panel);color:var(--text);display:grid;place-items:center;font-size:24px}
.camera-layout-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0 22px;font-size:13px}
.camera-layout-tools label{display:flex;align-items:center;gap:8px}
.camera-layout-tools select,.camera-layout-tools button{padding:7px 10px;min-height:36px}
.monitor-mode #stationOverview #stationGrid[data-custom-layout]{grid-template-columns:repeat(var(--camera-columns),minmax(0,1fr));gap:14px 12px}
.monitor-mode #stationOverview #stationGrid[data-custom-layout] .station-card{zoom:var(--camera-zoom)}
#stationGrid .camera-page-hidden{display:none!important}

/* Desktop overview: only the camera grid owns vertical scrolling. */
@media screen and (min-width:1024px){
 body:has(#dashboard:not([hidden]) #stationOverview:not([hidden])){height:100dvh;overflow:hidden}
 body:has(#dashboard:not([hidden]) #stationOverview:not([hidden])) .home-layout{height:100dvh;min-height:0;overflow:hidden}
 body:has(#dashboard:not([hidden]) #stationOverview:not([hidden])) .home-sidebar{height:100dvh;box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain}
 body:has(#dashboard:not([hidden]) #stationOverview:not([hidden])) .home-main{height:100dvh;min-height:0;box-sizing:border-box;display:flex;flex-direction:column;padding-bottom:12px;overflow:hidden}
 body:has(#stationOverview:not([hidden])) #dashboard:not([hidden]){flex:1;min-height:0;display:flex;flex-direction:column}
 #dashboard:not([hidden]) #stationOverview:not([hidden]){flex:1;min-height:0;display:flex;flex-direction:column}
 #stationOverview>.monitor-header,#stationOverview>#cameraLayoutTools{flex-shrink:0}
 .monitor-mode #stationOverview #stationGrid{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;align-content:start;grid-auto-rows:max-content;padding:14px 10px 12px 2px;margin-top:0}
 #stationOverview>#cameraLayoutTools{margin-bottom:4px}
}

#cameraLayoutTools #networkMessage{order:5;margin:0;font-size:12px;flex-basis:100%}
#cameraLayoutTools #networkMessage:empty{display:none}
@media screen and (min-width:1024px){
 body:has(#dashboard:not([hidden]) #stationOverview:not([hidden])) .home-main{padding-bottom:0}
 .monitor-mode #stationOverview #stationGrid{margin-bottom:0;padding-bottom:8px}
}

#stationOverview .monitor-header .home-metrics{grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch}
#stationOverview .monitor-header .home-metrics>.panel{height:78px;min-height:78px;box-sizing:border-box;overflow:hidden}
#stationOverview .monitor-header .home-metrics p{display:none!important}
#stationOverview .monitor-header .home-metrics .metric{line-height:26px;height:26px;margin:4px 0 0;white-space:nowrap}
#stationGrid{overflow-anchor:none}
.management-dialog{width:min(1200px,96vw);height:90dvh;max-width:96vw;max-height:94dvh;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--bg);color:var(--text);overflow:hidden}
.management-dialog[open]{display:flex;flex-direction:column}
.management-dialog::backdrop{background:#0009}
.management-dialog header{display:flex;justify-content:space-between;align-items:center;padding:12px 20px;gap:16px;border-bottom:1px solid var(--line)}
.management-dialog h2{font-size:20px;margin:0}
.management-dialog iframe{width:100%;flex:1;min-height:0;border:0;background:var(--bg)}


/* Overview uses real element sizes so text and controls remain legible. */
#stationOverview .station-status-badge{display:none!important}
#stationOverview .station-number{border:0!important;background:none;box-shadow:none}
.home-brand .eyebrow{white-space:nowrap;letter-spacing:0;text-transform:none;font-size:11px}
.monitor-mode #stationOverview #stationGrid .station-card{zoom:1!important;width:auto!important;min-width:0;min-height:0!important;height:350px!important;border-radius:12px;display:flex;flex-direction:column}
.monitor-mode #stationOverview #stationGrid{gap:12px;margin:0;padding:8px 4px 16px;grid-template-columns:repeat(9,minmax(0,1fr));align-content:start}
.monitor-mode #stationOverview #stationGrid[data-custom-layout]{grid-template-columns:repeat(var(--camera-columns),minmax(0,1fr))}
#stationOverview .station-card .station-meta{display:flex;height:86px;min-height:86px;padding:10px 8px;gap:4px;box-sizing:border-box}
#stationOverview .station-card .station-meta dl{display:flex;flex-direction:column;gap:3px;padding:0;min-width:0;flex:1}
#stationOverview .station-card .station-meta-pair{display:block;min-width:0}
#stationOverview .station-card .station-meta-pair dt{display:none}
#stationOverview .station-card .station-meta-pair dd{font-size:10px;line-height:1.4;margin:0;overflow-wrap:anywhere}
#stationOverview .station-card .station-meta-pair:first-child dd{font-size:11px;text-decoration:none}
#stationOverview .station-card .station-meta-pair:last-child{display:none}
#stationOverview .station-card .station-number{padding:0;min-width:22px}
#stationOverview .station-card .station-number small{font-size:8px;letter-spacing:0}
#stationOverview .station-card .station-number b{font-size:20px;line-height:1.3}
#stationOverview .station-card .station-reading{display:grid;flex:1;min-height:0!important;height:auto!important;padding:8px;gap:6px;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr)}
#stationOverview .station-card .station-media{min-height:0!important;height:100%;border-radius:8px}
#stationOverview .station-card .station-media img,#stationOverview .station-card .station-media video{width:100%;height:100%;object-fit:cover;margin:0;max-height:none}
#stationOverview .station-card .station-levels{display:flex;flex-direction:column;justify-content:space-between;gap:2px;padding:0;min-width:0}
#stationOverview .station-card .station-levels>div{padding:0;border:0;background:none;min-height:0;box-shadow:none;text-align:center}
#stationOverview .station-card .reading-title{font-size:10px;line-height:1.4;margin:0}
#stationOverview .station-card .station-levels>div>small,#stationOverview .station-card .station-levels b small{display:none}
#stationOverview .station-card .threshold-warning{display:block!important}
#stationOverview .station-card .threshold-critical b{font-size:18px;color:#d5212b}
#stationOverview .station-card .threshold-warning b{font-size:18px;color:#ca7315}
#stationOverview .station-card .station-current b{font-size:clamp(22px,1.6vw,32px);line-height:1.2;color:#00a853;white-space:nowrap}
#stationOverview .station-card .station-levels>div:last-child b{font-size:18px;color:#7a8794}
#stationOverview .station-card .station-actions{height:72px!important;min-height:72px!important;flex-shrink:0;border-radius:0 0 12px 12px}
#stationOverview .station-card .station-actions>a,#stationOverview .station-card .station-actions>button,#stationOverview .station-card .station-actions>.station-control{padding:5px 2px;min-height:0;height:72px;gap:5px;font-size:9px;line-height:1.35;overflow:hidden;box-sizing:border-box}
#stationOverview .station-card .station-actions>*>span:last-of-type{font-size:9px;line-height:1.35;white-space:normal}
#stationOverview .station-card .station-actions .report-icon{font-size:26px;line-height:1;flex-shrink:0}
#stationOverview .station-card .station-actions small{font-size:8px}
#stationOverview .sluice-icon{position:relative;display:block;width:28px;height:26px;color:var(--text)}
.sluice-icon i{display:block;position:absolute;box-sizing:border-box}
.sluice-icon .gate-frame{left:5px;top:1px;width:18px;height:21px;border:3px solid currentColor;border-bottom:0}
.sluice-icon .gate-panel{left:10px;top:5px;width:8px;height:13px;background:currentColor}
.sluice-icon .gate-water{left:1px;bottom:0;width:26px;height:5px;border-top:2px solid #259bb6;border-bottom:2px solid #259bb6}
@media(min-width:1200px){
 .home-layout{grid-template-columns:190px minmax(0,1fr)}
 .home-sidebar{padding:20px 14px}
 .home-brand{gap:8px}
 .home-brand .brand-icon{min-width:42px;width:42px;height:48px}
 .monitor-mode .home-main{padding:16px 16px 0;max-width:none}
 #stationOverview>.monitor-header{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:0;margin:0 0 14px}
 #stationOverview>.monitor-header>div:first-child{display:none}
 #stationOverview .monitor-header .home-metrics{order:1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));flex:0 0 345px;min-width:0;gap:6px;margin:0}
 #stationOverview .monitor-header .home-metrics>.panel{height:60px;min-height:60px;padding:9px;border-radius:12px}
 #stationOverview .monitor-header .home-metrics .metric{font-size:16px;line-height:24px;margin:0}
 #stationOverview .monitor-header .overview-tools{order:2;display:flex;align-items:flex-end;gap:8px;flex-wrap:nowrap}
 #stationOverview .monitor-header .station-search{min-width:0;font-size:11px}
 #stationOverview .monitor-header .station-search input{width:170px;padding:8px;min-height:36px}
 #stationOverview .monitor-header .manage-cameras{white-space:nowrap;min-height:36px;padding:8px 10px}
 #stationOverview .monitor-header #cameraLayoutTools{order:3;margin:0;gap:8px;font-size:11px;flex:0 0 auto}
 #stationOverview .monitor-header .detail-account{order:4!important;margin-left:auto!important}
}
@media(min-width:1024px) and (max-width:1599px){
 .monitor-mode #stationOverview #stationGrid:not([data-custom-layout]){grid-template-columns:repeat(6,minmax(0,1fr))}
}
@media(max-width:1023px){
 .monitor-mode #stationOverview #stationGrid:not([data-custom-layout]){grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
}


/* Balanced desktop toolbar with proportional space for every control group. */
@media(min-width:1200px){
 #stationOverview>.monitor-header{
   display:grid;
   grid-template-columns:minmax(330px,3fr) minmax(260px,2.3fr) minmax(330px,2.6fr) 44px;
   align-items:center;
   gap:16px;
   width:100%;
   box-sizing:border-box;
 }
 #stationOverview .monitor-header .home-metrics{
   width:100%;min-width:0;max-width:none;
   grid-template-columns:repeat(3,minmax(0,1fr));
   gap:10px;margin:0;
 }
 #stationOverview .monitor-header .home-metrics>.panel{
   height:68px;min-height:68px;padding:10px 12px;
 }
 #stationOverview .monitor-header .overview-tools{
   display:grid;grid-template-columns:minmax(140px,1.35fr) minmax(120px,1fr);
   gap:12px;width:100%;min-width:0;align-items:end;
 }
 #stationOverview .monitor-header .station-search{min-width:0;width:100%}
 #stationOverview .monitor-header .station-search input{
   width:100%;height:40px;min-height:40px;box-sizing:border-box;
 }
 #stationOverview .monitor-header .manage-cameras{
   width:100%;min-height:40px;box-sizing:border-box;
   display:flex;align-items:center;justify-content:center;padding:8px;
 }
 #stationOverview .monitor-header #cameraLayoutTools{
   display:flex;flex-wrap:wrap;align-items:center;
   gap:10px;width:100%;min-width:0;margin:0;
 }
 #stationOverview .monitor-header #cameraLayoutTools>label{
   flex:1 1 145px;display:flex;flex-direction:column;
   align-items:stretch;gap:5px;min-width:0;
 }
 #stationOverview .monitor-header #cameraLayoutTools select{
   width:100%;height:40px;min-height:40px;box-sizing:border-box;
 }
 #stationOverview .monitor-header .detail-account{
   width:44px;min-width:44px;margin:0!important;justify-content:center;
 }
}

/* Explicit caption lines avoid splitting Thai words inside narrow actions. */
#stationOverview .station-card .station-actions>a,
#stationOverview .station-card .station-actions>button,
#stationOverview .station-card .station-actions>.station-control{gap:4px;justify-content:flex-start;padding-top:7px}
#stationOverview .station-card .station-actions .report-caption{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:27px;font-size:10px!important;line-height:1.35!important;font-weight:500;letter-spacing:0;color:var(--text)}
#stationOverview .station-card .station-actions .report-caption>span{display:block;font-size:inherit;line-height:inherit;white-space:nowrap;word-break:keep-all;overflow-wrap:normal}
#stationOverview .station-card .station-actions>.station-control>small{font-size:8px;line-height:1.2;white-space:nowrap;color:var(--muted);margin-top:-3px}
#stationOverview .station-card .station-actions{height:82px!important;min-height:82px!important}
#stationOverview .station-card .station-actions>a,#stationOverview .station-card .station-actions>button,#stationOverview .station-card .station-actions>.station-control{height:82px}

/* Give the warning value breathing room below the critical value. */
#stationOverview .station-card .station-levels{
 display:grid;grid-template-rows:18px 28px 34px minmax(40px,1fr) 25px;
 justify-content:stretch;align-items:center;gap:4px;
}
#stationOverview .station-card .station-levels .reading-title{align-self:start}
#stationOverview .station-card .station-levels .threshold-critical{align-self:center}
#stationOverview .station-card .station-levels .threshold-warning{align-self:end}
#stationOverview .station-card .station-levels .station-current{align-self:center}
#stationOverview .station-card .station-levels b{line-height:1.3}
/* Station name leads the header, with supporting metadata below. */
#stationOverview .station-card .station-meta{
 position:relative;height:126px;min-height:126px;padding:10px 9px;
}
#stationOverview .station-card .station-meta dl{
 display:flex;flex-direction:column;gap:5px;padding:0;width:100%;
}
#stationOverview .station-card .station-meta-pair{
 display:flex;align-items:baseline;gap:5px;padding-right:35px;
}
#stationOverview .station-card .station-meta-pair:first-child{
 display:block;padding-right:0;margin-bottom:5px;
}
#stationOverview .station-card .station-meta-pair:first-child dd{
 font-size:15px;font-weight:700;line-height:1.3;text-align:center;
 text-decoration:none;white-space:normal;overflow:visible;
 display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
}
#stationOverview .station-card .station-meta-pair:first-child dt{display:none}
#stationOverview .station-card .station-meta-pair:not(:first-child) dt{
 display:block;font-size:10px;line-height:1.4;font-weight:500;white-space:nowrap;
}
#stationOverview .station-card .station-meta-pair:not(:first-child) dd{
 margin:0;font-size:10px;line-height:1.4;font-weight:400;
 white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
#stationOverview .station-card .station-meta-pair:last-child{display:flex}
#stationOverview .station-card .station-number{
 position:absolute;right:8px;top:57px;text-align:center;padding:0;
}
#stationOverview .station-card .station-number small{display:block;font-size:8px}
#stationOverview .station-card .station-number b{font-size:25px;line-height:1.2}
.monitor-mode #stationOverview #stationGrid .station-card{height:390px!important}
/* Keep the camera badge clear of metadata and fit the alarm caption. */
#stationOverview .station-card .station-number{right:3px;min-width:29px}
#stationOverview .station-card .station-meta-pair:not(:first-child){padding-right:34px}
#stationOverview .station-card .station-meta-pair:not(:first-child) dd{min-width:0;flex:1}
#stationOverview .station-card .station-actions{grid-template-columns:minmax(0,.9fr) minmax(0,1.35fr) minmax(0,.9fr)}
#stationOverview .station-card .station-actions>a,
#stationOverview .station-card .station-actions>button,
#stationOverview .station-card .station-actions>.station-control{min-width:0;padding-left:1px;padding-right:1px}
#stationOverview .station-card .station-actions .report-caption{width:100%;max-width:100%;font-size:9px!important}
#stationOverview .station-card .station-actions .report-caption>span{max-width:100%;white-space:nowrap}
/* Fit explicitly selected rows to the overview viewport. */
@media(min-width:1024px){
 .monitor-mode #stationOverview #stationGrid[data-visible-rows]:not([data-visible-rows="0"]) .station-card{height:var(--fitted-card-height,390px)!important}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-card .station-meta,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-card .station-meta{height:83px;min-height:83px;padding:7px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-meta-pair:first-child dd,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-meta-pair:first-child dd{font-size:12px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-meta dl,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-meta dl{gap:2px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-meta-pair:first-child,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-meta-pair:first-child{margin-bottom:2px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-number,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-number{top:35px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-actions,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-actions{height:65px!important;min-height:65px!important}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-actions>*,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-actions>*{height:65px;padding-top:4px;gap:2px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-reading,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-reading{padding:5px 7px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-levels,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-levels{grid-template-rows:15px 18px 20px minmax(20px,1fr) 18px;gap:2px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-levels .station-current b,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-levels .station-current b{font-size:25px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-levels .threshold-critical b,
 #stationOverview #stationGrid[data-visible-rows="3"] .station-levels .threshold-warning b,
 #stationOverview #stationGrid[data-visible-rows="3"] .station-levels>div:last-child b,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-levels b{font-size:15px}
}
/* Final dense overview polish. */
#stationOverview .camera-delete-button{top:4px;right:4px;width:22px;height:22px;max-height:22px;font-size:17px;z-index:3}
#stationOverview .fleet-card .station-meta-pair:first-child{padding-right:18px}
#stationOverview .fleet-image-message{font-size:10px;line-height:1.5;text-align:center;padding:4px;color:var(--muted);overflow-wrap:normal;word-break:normal;max-width:100%;margin:0}
#stationOverview .station-card .station-actions>.station-control>small{font-size:7px;margin:0;line-height:1.4}
#stationOverview .station-card .station-actions .report-caption{min-height:25px}
@media(min-width:1024px){
 #stationOverview #stationGrid[data-visible-rows="3"] .station-actions,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-actions{height:76px!important;min-height:76px!important}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-actions>*,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-actions>*{height:76px;gap:3px;padding-top:5px}
 #stationOverview #stationGrid[data-visible-rows="3"] .station-actions .report-icon,
 #stationOverview #stationGrid[data-visible-rows="4"] .station-actions .report-icon{font-size:24px}
}

/* Compact layout controls and pagination share a single desktop row. */
#cameraLayoutTools .camera-pagination{display:flex;align-items:center;gap:6px;min-width:0}
#cameraLayoutTools .camera-pagination[hidden]{display:none!important}
#cameraLayoutTools .camera-pagination>button{white-space:nowrap;min-height:34px;padding:5px 8px;font-size:11px}
#cameraLayoutTools .camera-pagination>span{font-size:10px;white-space:nowrap}
@media(min-width:1200px){
 #stationOverview>.monitor-header{grid-template-columns:minmax(300px,3fr) minmax(260px,2.5fr) auto 44px;gap:12px}
 #stationOverview .monitor-header #cameraLayoutTools{display:flex;flex-wrap:nowrap;align-items:flex-end;gap:10px;width:auto}
 #stationOverview .monitor-header #cameraLayoutTools>label{flex:0 0 auto;width:auto;min-width:0;gap:5px}
 #stationOverview .monitor-header #cameraColumns{width:100px;height:36px;min-height:36px;padding:6px 8px}
 #stationOverview .monitor-header #cameraRows{width:92px;height:36px;min-height:36px;padding:6px 8px}
 #stationOverview .monitor-header #cameraLayoutTools .camera-pagination{flex:0 0 auto;margin-bottom:1px}
 #stationOverview .monitor-header #cameraLayoutTools #networkMessage{display:none}
}
@media(min-width:1200px) and (max-width:1500px){
 #stationOverview>.monitor-header{grid-template-columns:minmax(280px,1fr) minmax(260px,1fr) 44px}
 #stationOverview .monitor-header #cameraLayoutTools{grid-column:1/3;grid-row:2;justify-content:flex-end}
 #stationOverview .monitor-header .detail-account{grid-column:3;grid-row:1}
}
/* Reserve pagination space so changing selectors cannot shift the toolbar. */
#cameraLayoutTools .camera-pagination{width:224px;min-width:224px;display:grid;grid-template-columns:72px 74px 66px;gap:6px}
#cameraLayoutTools .camera-pagination.pagination-inactive{visibility:hidden;pointer-events:none}
#cameraLayoutTools .camera-pagination>button{width:100%;box-sizing:border-box}
#cameraLayoutTools .camera-pagination>span{text-align:center;font-variant-numeric:tabular-nums;overflow:hidden}
@media(min-width:1501px){
 #stationOverview>.monitor-header{grid-template-columns:minmax(300px,3fr) minmax(260px,2.5fr) 448px 44px;align-items:center}
 #stationOverview .monitor-header #cameraLayoutTools{width:448px;min-width:448px;gap:10px}
 #stationOverview .monitor-header #cameraLayoutTools>label:first-of-type{width:104px}
 #stationOverview .monitor-header #cameraLayoutTools>label:nth-of-type(2){width:100px}
 #stationOverview .monitor-header #cameraColumns{width:104px}
 #stationOverview .monitor-header #cameraRows{width:100px}
 #stationOverview .monitor-header #cameraLayoutTools .camera-pagination{flex:none}
}
/* One row keeps a natural image height; three rows scroll additional cameras. */
#stationOverview #stationGrid[data-visible-rows="1"]{align-content:start}
#stationOverview #stationGrid[data-visible-rows="3"]{overflow-y:auto;align-content:start;scrollbar-gutter:stable}
/* A small column count enlarges cards only to a readable width. */
.monitor-mode #stationOverview #stationGrid[data-custom-layout]{
 grid-template-columns:repeat(var(--camera-columns),minmax(0,var(--camera-card-width,340px)));
 justify-content:start;
}
/* All column choices use the same card width at a given viewport size. */
.monitor-mode #stationOverview #stationGrid:not([data-custom-layout]){
 grid-template-columns:repeat(var(--automatic-columns,9),minmax(0,var(--uniform-card-width,180px)));
 justify-content:start;
}
.monitor-mode #stationOverview #stationGrid[data-custom-layout]{
 grid-template-columns:repeat(var(--camera-columns),minmax(0,var(--uniform-card-width,180px)));
 justify-content:start;
}
/* Align the theme switch with the toolbar input baseline. */
@media(min-width:1200px){
 #stationOverview .monitor-header .detail-account{align-self:end!important;align-items:center;padding-bottom:0!important}
 #stationOverview .monitor-header .detail-account .theme-switch,
 #stationOverview .monitor-header .detail-account [data-theme-toggle]{width:40px;height:40px;min-height:40px;box-sizing:border-box;margin:0}
}
/* Strong station headings and metadata labels in the light theme. */
:root:not([data-theme="dark"]) #stationOverview .station-card .station-meta-pair:first-child dd,
:root:not([data-theme="dark"]) #stationOverview .station-card .station-meta-pair:nth-child(2) dt,
:root:not([data-theme="dark"]) #stationOverview .station-card .station-meta-pair:nth-child(3) dt{color:#111;font-weight:700}:root:not([data-theme="dark"]) #stationOverview .station-card .station-meta-pair:nth-child(4) dt{color:#111;font-weight:700}

/* Overview reading column (2026-11-30): size the text from the space the column actually has,
   so title, thresholds, current value and OCR note never overlap or spill onto the action row. */
#stationOverview #stationGrid .station-card .station-levels{container-type:size;display:grid!important;grid-template-rows:auto auto auto minmax(0,1fr) auto!important;gap:0!important;padding:0!important;min-height:0;overflow:hidden;align-content:stretch}
#stationOverview #stationGrid .station-card .station-levels>*{align-self:center!important;min-height:0}
#stationOverview #stationGrid .station-card .station-levels .reading-title{font-size:clamp(8px,9cqh,11px)!important;line-height:1.2!important;margin:0!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#stationOverview #stationGrid .station-card .station-levels>div>b{font-size:clamp(10px,min(13cqh,22cqw),22px)!important;line-height:1.15!important}
#stationOverview #stationGrid .station-card .station-levels .station-current{height:auto!important;min-height:0!important;padding:0!important;overflow:hidden;display:flex;flex-direction:column;justify-content:center;border:0!important;background:none!important}
#stationOverview #stationGrid .station-card .station-levels .station-current b{font-size:clamp(14px,min(24cqh,30cqw),58px)!important;line-height:1.1!important}
#stationOverview #stationGrid .station-card .station-levels .fleet-ocr-note{font-size:clamp(7px,7cqh,10px)!important;line-height:1.2!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
#stationOverview #stationGrid .station-card .station-levels .station-current{align-self:stretch!important;max-height:100%}
#stationOverview #stationGrid .station-card .station-levels .station-current small{font-size:clamp(7px,7cqh,10px)!important;line-height:1.2!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;min-height:0!important;height:auto!important}

/* Camera-reported water level (SZY206), 2026-11-30. Dashed violet so it is distinct from the OCR line in both themes. */
.history-line-szy206{fill:none;stroke:#7c3aed;stroke-width:2.5;stroke-dasharray:6 4;vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round}
.history-dot-szy206{fill:#7c3aed;stroke:#fff;stroke-width:1}
:root[data-theme="dark"] .history-line-szy206{stroke:#c4b5fd}
:root[data-theme="dark"] .history-dot-szy206{fill:#c4b5fd;stroke:#0b1220}
.history-legend{font-size:11px}
#stationSzy206{display:block;color:#6d28d9;font-weight:600}
:root[data-theme="dark"] #stationSzy206{color:#c4b5fd}
#stationSzy206[data-state="STALE"],#szy206Detail[data-state="STALE"],#szy206Detail[data-state="DRIFT"]{color:var(--warn,#b45309)}
/* Camera value (SZY206) as a badge on the card thumbnail; the value column is left unchanged. */
#stationOverview .station-card .station-media{position:relative}
#stationSzy206.szy206-badge{position:absolute;left:3px;right:3px;bottom:3px;z-index:2;display:block;padding:1px 2px;border-radius:5px;background:rgba(15,23,42,.82);color:#fff;font-size:9px;letter-spacing:-.1px;font-weight:600;line-height:1.3;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
#stationSzy206.szy206-badge[data-state="STALE"]{background:rgba(180,83,9,.9)}
#stationSzy206.szy206-badge[hidden]{display:none}
#stationOverview #stationGrid .station-card .station-media #stationSzy206.szy206-badge{color:#fff!important;font-size:10px!important;line-height:1.2!important;white-space:normal!important;text-overflow:clip!important;overflow:hidden;padding:2px 3px!important}

/* Locked overview toolbar (2026-11-30): one row in the same order on every desktop/laptop width
   (summary | search + manage | layout selectors + pages | theme). When the space is narrower than the
   natural row, station-event-table.js scales the whole row down with `zoom` instead of re-flowing it.
   Phones and narrow tablets (<1024px) keep the stacked layout. */
@media(min-width:1024px){
 #stationOverview>.monitor-header{display:grid!important;grid-template-columns:minmax(300px,3fr) minmax(260px,2.5fr) 448px 44px!important;grid-template-rows:auto!important;align-items:center!important;gap:12px!important;box-sizing:border-box;padding:0!important;margin:0 0 14px!important}
 #stationOverview>.monitor-header>div:first-child{display:none!important}
 #stationOverview>.monitor-header>*{grid-row:1!important;margin:0!important;min-width:0}
 #stationOverview>.monitor-header>.home-metrics{grid-column:1!important;display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important;width:100%!important;max-width:none!important}
 #stationOverview>.monitor-header>.home-metrics>.panel{height:68px!important;min-height:68px!important;padding:10px 12px!important;box-sizing:border-box}
 #stationOverview>.monitor-header>.home-metrics>.panel:nth-child(n+4){display:none!important}
 #stationOverview>.monitor-header>.home-metrics .metric{font-size:16px!important;line-height:24px!important;white-space:nowrap}
 #stationOverview>.monitor-header>.overview-tools{grid-column:2!important;display:grid!important;grid-template-columns:minmax(140px,1.35fr) minmax(120px,1fr)!important;gap:12px!important;align-items:end!important;width:100%!important}
 #stationOverview>.monitor-header>.overview-tools[data-no-manage]{grid-template-columns:1fr!important}
 #stationOverview>.monitor-header .station-search{min-width:0!important;width:100%!important;font-size:11px}
 #stationOverview>.monitor-header .station-search input{width:100%!important;height:40px!important;min-height:40px!important;box-sizing:border-box}
 #stationOverview>.monitor-header .manage-cameras{width:100%!important;min-height:40px!important;box-sizing:border-box;white-space:nowrap;padding:8px!important}
 #stationOverview>.monitor-header>#cameraLayoutTools{grid-column:3!important;display:flex!important;flex-wrap:nowrap!important;align-items:flex-end!important;justify-content:flex-start!important;gap:10px!important;width:448px!important;min-width:448px!important;font-size:11px}
 #stationOverview>.monitor-header>#cameraLayoutTools>label{flex:0 0 auto!important;display:flex;flex-direction:column;gap:5px;min-width:0}
 #stationOverview>.monitor-header #cameraColumns{width:104px!important;height:40px!important;min-height:40px!important}
 #stationOverview>.monitor-header #cameraRows{width:100px!important;height:40px!important;min-height:40px!important}
 #stationOverview>.monitor-header>#cameraLayoutTools #networkMessage{display:none}
 #stationOverview>.monitor-header>.detail-account{grid-column:4!important;width:44px!important;min-width:44px!important;align-self:end!important;justify-content:center}
 #stationOverview>.monitor-header>.detail-account [data-theme-toggle]{width:40px!important;height:40px!important;min-height:40px!important;box-sizing:border-box;margin:0!important}
}

/* History chart polish (2026-11-30). Series colours validated as a pair (light: #00879b/#7c3aed,
   dark: #12aebf/#9d7ef6 - lightness, chroma, CVD and contrast checks pass); the camera line stays dashed
   so the two series never depend on colour alone. Text uses text tokens, not series colours. */
#waterChart .history-line{stroke:#00879b!important;stroke-width:2.5!important}
#waterChart .history-dot{fill:#00879b!important}
#waterChart .history-line-szy206{stroke:#7c3aed;stroke-width:2;stroke-dasharray:6 4}
#waterChart .history-dot-szy206{fill:#7c3aed;stroke:none;opacity:0;pointer-events:all}
#waterChart .history-dot-szy206:hover,#waterChart .history-dot-szy206:focus{opacity:1;r:4.5;stroke:var(--panel);stroke-width:2}
#waterChart .history-end-szy206,#waterChart .history-hover-szy206{fill:#7c3aed;stroke:var(--panel);stroke-width:2}
#waterChart .history-hover-ocr{fill:#00879b;stroke:var(--panel);stroke-width:2}
#waterChart .history-end-label{font-weight:700;fill:var(--text)}
#waterChart .history-legend-swatch{stroke-width:3!important;filter:none!important}
#waterChart .history-legend .history-label{fill:var(--muted)}
#waterChart .history-zero{opacity:1!important;stroke:var(--muted)!important;stroke-opacity:.55}
#waterChart .history-tick{stroke:var(--line)}
#waterChart .history-crosshair{stroke:var(--muted);stroke-width:1;stroke-dasharray:3 3}
#waterChart .history-tooltip{fill:var(--panel);stroke:var(--line);stroke-width:1;filter:drop-shadow(0 4px 10px rgba(15,23,42,.14))}
#waterChart .history-tooltip-text{font-size:11px;fill:var(--text)}
#waterChart .history-tooltip-time{font-weight:700}
:root[data-theme="dark"] #waterChart .history-line{stroke:#12aebf!important}
:root[data-theme="dark"] #waterChart .history-dot,:root[data-theme="dark"] #waterChart .history-hover-ocr{fill:#12aebf!important}
:root[data-theme="dark"] #waterChart .history-line-szy206{stroke:#9d7ef6}
:root[data-theme="dark"] #waterChart .history-dot-szy206,:root[data-theme="dark"] #waterChart .history-end-szy206,:root[data-theme="dark"] #waterChart .history-hover-szy206{fill:#9d7ef6}

/* Threshold zones (2026-11-30): faint status bands behind the series; the lines keep their series colours.
   Status is never colour-only: each band is named, exceedances get a ⚠ mark and are listed in text. */
#waterChart .history-zone{pointer-events:none}
#waterChart .history-zone-warning{fill:#b87900;fill-opacity:.09}
#waterChart .history-zone-critical{fill:#d33950;fill-opacity:.09}
#waterChart .history-zone-label{font-size:10px;font-weight:600;fill:var(--muted);pointer-events:none}
#waterChart .history-run-warning{fill:#b87900}
#waterChart .history-run-critical{fill:#d33950}
#waterChart .history-run-icon{font-size:11px;pointer-events:none}
#waterChart .history-run-icon-warning{fill:#b87900}
#waterChart .history-run-icon-critical{fill:#d33950}
:root[data-theme="dark"] #waterChart .history-zone-warning{fill:#ffd166;fill-opacity:.08}
:root[data-theme="dark"] #waterChart .history-zone-critical{fill:#ff8c9c;fill-opacity:.09}
:root[data-theme="dark"] #waterChart .history-run-warning,:root[data-theme="dark"] #waterChart .history-run-icon-warning{fill:#ffd166}
:root[data-theme="dark"] #waterChart .history-run-critical,:root[data-theme="dark"] #waterChart .history-run-icon-critical{fill:#ff8c9c}
#waterChart .history-zone-label,#waterChart .history-end-label{paint-order:stroke;stroke:var(--panel);stroke-width:4px;stroke-linejoin:round}
/* Low-water zone (optional `low` threshold): bottom band, named and marked like the high zones. */
#waterChart .history-zone-low{fill:#c2410c;fill-opacity:.08}
#waterChart .history-threshold-low{stroke:#c2410c;fill:#c2410c}
#waterChart .history-run-low,#waterChart .history-run-icon-low{fill:#c2410c}
:root[data-theme="dark"] #waterChart .history-zone-low{fill:#fdba74;fill-opacity:.08}
:root[data-theme="dark"] #waterChart .history-threshold-low{stroke:#fdba74;fill:#fdba74}
:root[data-theme="dark"] #waterChart .history-run-low,:root[data-theme="dark"] #waterChart .history-run-icon-low{fill:#fdba74}
#waterChart .history-threshold-label.history-threshold-low,:root[data-theme="dark"] #waterChart .history-threshold-label.history-threshold-low{stroke:var(--bg)}
/* Right gutter labels (outside the plot): threshold boundaries and the latest camera value. */
#waterChart .history-gutter-label{font-size:12px;font-weight:700}
#waterChart .history-gutter-label.history-end-label{fill:var(--text)}
/* Zone band strength (tuned 2026-11-30): dark bands were indistinguishable; keep the data line dominant. */
#waterChart .history-zone-warning{fill-opacity:.11}
#waterChart .history-zone-critical{fill-opacity:.11}
#waterChart .history-zone-low{fill-opacity:.10}
:root[data-theme="dark"] #waterChart .history-zone-warning{fill:#ffc53d;fill-opacity:.15}
:root[data-theme="dark"] #waterChart .history-zone-critical{fill:#ff6b81;fill-opacity:.16}
:root[data-theme="dark"] #waterChart .history-zone-low{fill:#fdba74;fill-opacity:.12}
/* Chosen cameras-per-row (2026-11-30): fleet-home.js sets --camera-zoom when cards would be narrower than
   150px or shorter than 250px; an older rule forced zoom:1!important on every card. */
.monitor-mode #stationOverview #stationGrid[data-custom-layout] .station-card{zoom:var(--camera-zoom,1)!important}

/* Overview card hover + camera popup (2026-11-30). */
.monitor-mode #stationOverview #stationGrid .station-card{cursor:pointer;transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease}
.monitor-mode #stationOverview #stationGrid .station-card:hover,.monitor-mode #stationOverview #stationGrid .station-card:focus-visible{transform:translateY(-4px)!important;box-shadow:0 10px 22px rgba(15,23,42,.18)!important;border-color:var(--accent)!important;z-index:2}
.monitor-mode #stationOverview #stationGrid .station-card:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.monitor-mode #stationOverview #stationGrid .station-card .station-media img,.monitor-mode #stationOverview #stationGrid .station-card .station-media video{transition:transform .25s ease}
.monitor-mode #stationOverview #stationGrid .station-card:hover .station-media img,.monitor-mode #stationOverview #stationGrid .station-card:hover .station-media video{transform:scale(1.05)}
.monitor-mode #stationOverview #stationGrid .station-card .station-media{overflow:hidden}
:root[data-theme="dark"] .monitor-mode #stationOverview #stationGrid .station-card:hover{box-shadow:0 10px 24px rgba(0,0,0,.45)!important}
@media(prefers-reduced-motion:reduce){.monitor-mode #stationOverview #stationGrid .station-card,.monitor-mode #stationOverview #stationGrid .station-card .station-media img,.monitor-mode #stationOverview #stationGrid .station-card .station-media video{transition:none}.monitor-mode #stationOverview #stationGrid .station-card:hover{transform:none!important}.monitor-mode #stationOverview #stationGrid .station-card:hover .station-media img,.monitor-mode #stationOverview #stationGrid .station-card:hover .station-media video{transform:none}}
/* Enlarged card (click a card): the same card centred over a dimmed backdrop; zoom keeps text crisp. */
.camera-card-backdrop{position:fixed;inset:0;z-index:900;background:rgba(8,15,28,.62);animation:camera-card-fade .18s ease-out}
.camera-card-placeholder{border-radius:16px;border:2px dashed var(--line);opacity:.6}
.monitor-mode #stationOverview #stationGrid .station-card.card-enlarged{position:fixed!important;z-index:901!important;margin:0!important;transform:none!important;box-shadow:0 24px 60px rgba(0,0,0,.45)!important;cursor:zoom-out;animation:camera-card-pop .2s ease-out;width:var(--enlarged-width)!important;height:var(--enlarged-height)!important;min-height:0!important;max-height:none!important;zoom:var(--enlarged-zoom,1)!important;left:var(--enlarged-left)!important;top:var(--enlarged-top)!important;right:auto!important;bottom:auto!important}
.monitor-mode #stationOverview #stationGrid .station-card.card-enlarged .station-media img,.monitor-mode #stationOverview #stationGrid .station-card.card-enlarged .station-media video{transform:none!important}
@keyframes camera-card-fade{from{opacity:0}to{opacity:1}}
@keyframes camera-card-pop{from{opacity:.4;transform:scale(.92)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.camera-card-backdrop,.monitor-mode #stationOverview #stationGrid .station-card.card-enlarged{animation:none}}

/* Demo stations: the current value takes the colour of its zone; ⚠ word stays on the badge and panel. */
#stationOverview .station-card .station-current.demo-level-warning b{color:#bf7900}
#stationOverview .station-card .station-current.demo-level-critical b{color:#e13e50}
#stationOverview .station-card .station-current.demo-level-low b{color:#7a8794}
[data-theme="dark"] #stationOverview .station-card .station-current.demo-level-warning b{color:#ffc53d}
[data-theme="dark"] #stationOverview .station-card .station-current.demo-level-critical b{color:#ff6b81}
[data-theme="dark"] #stationOverview .station-card .station-current.demo-level-low b{color:#a9b6c3}
#stationOverview .station-card .station-current b{transition:color .4s ease}
/* Demo level panel (Shift+D): floats above the grid and the enlarged card. */
.demo-level-panel{position:fixed;right:20px;bottom:20px;z-index:950;width:410px;max-height:calc(100vh - 40px);overflow:auto;box-sizing:border-box;padding:14px 16px;border:1px solid var(--line);border-radius:16px;background:var(--panel);color:var(--text);box-shadow:0 18px 48px #0003;font-size:13px}
.demo-level-panel[hidden]{display:none}
.demo-level-panel header{display:flex;align-items:center;justify-content:space-between;gap:8px}
.demo-level-panel header strong{font-size:15px}
.demo-level-close{width:32px;height:32px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);cursor:pointer}
.demo-level-legend{margin:6px 0 10px;color:var(--muted);font-size:12px;line-height:1.5}
.demo-level-row{padding:8px 0;border-top:1px solid var(--line)}
.demo-level-top{display:flex;justify-content:space-between;gap:8px;font-weight:600}
.demo-level-top output{font-variant-numeric:tabular-nums;white-space:nowrap}
.demo-level-top output[data-state=WARNING]{color:#bf7900}.demo-level-top output[data-state=CRITICAL]{color:#e13e50}.demo-level-top output[data-state=LOW]{color:#7a8794}.demo-level-top output[data-state=SAFE]{color:#169b62}
[data-theme="dark"] .demo-level-top output[data-state=WARNING]{color:#ffc53d}[data-theme="dark"] .demo-level-top output[data-state=CRITICAL]{color:#ff6b81}
.demo-level-row input[type=range]{width:100%;margin:4px 0 6px;accent-color:var(--accent)}
.demo-level-buttons{display:flex;flex-wrap:wrap;gap:4px}
.demo-level-buttons button,.demo-level-reset{min-height:30px;padding:3px 7px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);font:inherit;font-size:12px;cursor:pointer}
.demo-preset[data-state=SAFE]{border-color:#169b62}.demo-preset[data-state=WARNING]{border-color:#bf7900}.demo-preset[data-state=CRITICAL]{border-color:#e13e50}.demo-preset[data-state=LOW]{border-color:#8192a4}
.demo-level-buttons button:hover,.demo-level-reset:hover{background:var(--line)}
.demo-level-reset{width:100%;margin-top:8px}
@media(prefers-reduced-motion:reduce){#stationOverview .station-card .station-current b{transition:none}}
@media print{.demo-level-panel{display:none!important}}
