/* The approved desktop panels now occupy a fluid, viewport-sized grid. */
.viewport:has(.stage-space){overflow:auto;overscroll-behavior:none;background:#f5f7f9}
.stage-space{width:100%;height:100%;margin:0;position:relative}
.stage-space .app-canvas{width:var(--canvas-width,1280px);height:var(--canvas-height,720px);top:0;left:0;margin:0;transform:scale(var(--stage-scale,1));transform-origin:top left;overflow:visible}
#app{display:grid;grid-template-rows:145px minmax(0,1fr) 65px;grid-template-areas:'header' 'content' 'footer'}
#app>.app-header{position:relative;inset:auto;grid-area:header;height:auto;min-width:0}
#app>.footer-nav{position:relative;inset:auto;grid-area:footer;margin:5px 28px 10px;height:50px;min-width:0}
#app>.screen-content{position:relative;grid-area:content;min-width:0;min-height:0}
.screen-content>*{min-width:0}
/* Enlarge readable controls and labels, never the page itself. */
.action{font-size:calc(15px * var(--density))}
.footer-nav a{font-size:calc(14px * var(--density))}
.side-list button{font-size:calc(16px * var(--density))}
.settings-sidebar .side-list button{font-size:calc(14px * var(--density));line-height:1.1}
.card-info small{font-size:calc(14px * var(--density));white-space:normal;line-height:1.1}
.card-info strong{font-size:clamp(35px,calc(39px * var(--density)),46px)}
.card-info strong small{font-size:calc(25px * var(--density))}
.status-card small{font-size:calc(10px * var(--density))}
.status-card strong{font-size:clamp(23px,calc(25px * var(--density)),29px)}
.status-card.compact strong{font-size:calc(20px * var(--density))}
.status-stack .action{font-size:calc(14px * var(--density))}
.status-stack.link .action{font-size:calc(12px * var(--density))}
.segmented button{font-size:calc(14px * var(--density))}
.segmented button small{font-size:calc(9px * var(--density))}
.field input,.select-control{font-size:calc(14px * var(--density))}
.device-table{font-size:calc(14px * var(--density))}
.device-table td{height:calc(33.5px * var(--density))}
.device-table th{font-size:calc(11px * var(--density))}
.pagination button{font-size:calc(15px * var(--density))}
.inspector-row strong{font-size:clamp(25px,calc(29px * var(--density)),32px)}
.inspector-row small{font-size:calc(10px * var(--density))}
.preview-widget{max-width:100%;width:350px}
.preview-cell strong{font-size:clamp(24px,calc(28px * var(--preview-scale)),32px)}
.preview-cell .unit{font-size:clamp(11px,calc(13px * var(--preview-scale)),15px)}
.preview-logo{transform:none;max-width:65%}
.preview-inner{display:flex;flex-direction:column}
.preview-viewport{flex:1;min-height:255px;margin-top:10px;height:auto}
.preview-inner>.action{flex:none;margin-top:10px}

/* Overview: grow the three cards and graph into the space available. */
[data-screen=home]{display:grid;grid-template-rows:58px 62px minmax(203px,1.2fr) minmax(157px,1fr);gap:8px;padding:0 17px 6px}
[data-screen=home]>.home-heading,[data-screen=home]>.overview-strip,[data-screen=home]>.product-cards,[data-screen=home]>.chart-panel{position:relative;inset:auto;width:auto;height:auto;margin:0}
[data-screen=home]>.home-heading{margin-left:39px;margin-right:23px;padding-top:4px;align-items:flex-start}
[data-screen=home]>.overview-strip{margin:0 23px}
[data-screen=home]>.product-cards{margin:0 12px}
.overview-stat{justify-content:space-between;min-width:0;gap:20px;padding:0 38px}
.product-card{padding-top:10px}
.product-card .card-info{height:calc(100% - 97px);min-height:68px;max-height:140px}
.product-card .action{height:39px;font-size:calc(15px * var(--density))}
.chart-main{display:flex;flex-direction:column;min-height:0}
.chart-heading{flex:none}
.chart-area,.reports-chart .chart-area{height:auto;flex:1;min-height:0}
.chart-extra{flex:none}

/* Meter screens keep controls in their own column and chart below the readings. */
[data-screen=prime],[data-screen=link],[data-screen=mbus]{display:grid;grid-template-columns:204px minmax(0,1fr) 209px;grid-template-rows:minmax(342px,1fr) 157px;column-gap:40px;row-gap:6px;padding:4px 7px 1px 20px}
[data-screen=prime]>.device-sidebar,[data-screen=link]>.device-sidebar,[data-screen=mbus]>.device-sidebar{position:relative;inset:auto;grid-column:1;grid-row:1;width:auto;height:318px}
.device-content{position:relative;inset:auto;grid-column:2;grid-row:1;width:auto;height:327px;padding-top:9px}
.status-stack{position:relative;inset:auto;grid-column:3;grid-row:1;width:auto;align-self:start}
.hero-art,.hero-art.prime,.hero-art.mbus{left:auto;right:227px;top:-4px}
.detail-chart{position:relative;inset:auto;grid-column:1/-1;grid-row:2;width:auto;height:auto;margin-left:-3px;margin-right:10px}
.device-content .flow-box{top:257px}
.device-content .water-note{top:266px}
.device-content .link-diagram{top:250px}
.device-content .module-photo{top:118px}

/* Registry, reports, map and settings use columns instead of fixed left offsets. */
[data-screen=devices]{display:grid;grid-template-columns:minmax(0,1fr) 274px;grid-template-rows:45px minmax(0,1fr);gap:8px 9px;padding:6px 7px 11px 21px}
.registry-heading{position:relative;inset:auto;grid-column:1/-1;grid-row:1;width:auto;height:auto;margin-left:8px}
.registry-body{position:relative;inset:auto;grid-column:1;grid-row:2;width:auto;height:auto;min-height:0;display:flex;flex-direction:column}
.filters{flex:none;min-width:0}
.filters>*{min-width:0}
.table-wrap{height:auto;min-height:0;flex:1;overflow:auto}
.device-table{min-width:925px}
.pagination{flex:none;flex-wrap:wrap;gap:7px;margin-top:12px}
.pagination .table-totals{gap:15px}
.device-inspector{position:relative;inset:auto;grid-column:2;grid-row:2;width:auto;height:auto;min-height:0}
.inspector-inner{display:flex;flex-direction:column}
.inspector-metrics{flex:1;display:flex;flex-direction:column;min-height:0}
.inspector-row{flex:1;min-height:52px;height:auto}
.inspector-inner>.action{flex:none}

[data-screen=settings]{display:grid;grid-template-columns:204px minmax(0,1fr) 428px;gap:29px;padding:14px 12px 45px 20px;align-items:start}
.settings-sidebar{position:relative;inset:auto;width:auto;height:312px}
.settings-main{position:relative;inset:auto;width:auto;min-width:0;padding:0 0 0 10px}
.preview-frame{position:relative;inset:auto;width:auto;height:438px;margin-top:7px}
.settings-main .page-title{font-size:40px}
.setting-lower{gap:30px}
.theme-thumb{background-repeat:no-repeat;background-color:#f3f5f7}

[data-screen=reports]{display:grid;grid-template-rows:76px 35px minmax(180px,1fr) 184px;gap:5px;padding:4px 18px 1px 17px}
.reports-heading,.report-filters,.reports-chart,.report-bottom{position:relative;inset:auto;width:auto;height:auto}
.reports-heading,.report-filters{margin-left:22px;margin-right:7px}
.report-bottom{margin-left:3px}
.report-comparison{overflow:auto;min-height:0}
.report-comparison table{min-width:650px}
.summary-cards{min-width:0}
.summary-card{min-width:0}
.distribution{min-width:0}

[data-screen=map]{display:grid;grid-template-columns:190px minmax(0,1fr) 277px;grid-template-rows:61px minmax(0,1fr);gap:8px 12px;padding:1px 7px 10px 25px}
.map-summary{position:relative;inset:auto;grid-column:1/-1;grid-row:1;width:auto;height:auto}
.map-sidebar{position:relative;inset:auto;grid-column:1;grid-row:2;width:auto;height:auto;padding-top:4px}
.map-canvas{position:relative;inset:auto;grid-column:2;grid-row:2;width:auto;height:auto;min-height:0}
.map-inspector{position:relative;inset:auto;grid-column:3;grid-row:2;width:auto;height:auto}
.map-inspector .inspector-row{min-height:60px}

/* Narrow windows reflow in document order rather than shrinking a desktop image. */
@media(max-width:999px){
 .stage-space{height:auto;min-height:100%;width:100%}
 .stage-space .app-canvas{position:relative;width:100%;height:auto;min-height:100dvh;transform:none}
 #app{display:flex;flex-direction:column;gap:14px}
 #app>.app-header{height:145px;flex:none;order:0}
 #app>.screen-content{order:1;flex:1;min-height:0}
 #app>.footer-nav{order:2;flex:none;margin:0 12px 12px;height:64px;padding:0;gap:4px}
 .footer-signature{display:none}
 .footer-nav a{padding:5px;gap:7px;font-size:calc(12px * var(--density));clip-path:polygon(7% 0,93% 0,100% 12%,100% 88%,93% 100%,7% 100%,0 88%,0 12%)}
 .footer-nav a:first-child{clip-path:polygon(7% 0,93% 0,100% 12%,100% 88%,93% 100%,7% 100%,0 88%,0 12%)}
 .footer-nav .icon{width:24px;height:24px}
 .app-header::before{background-position:0 0}
 .header-controls{right:12px;top:12px;width:auto;height:42px;gap:14px}
 .brand-link{width:243px}
 .product-nav{left:calc(50% - 299px);top:70px}
 .page-title{font-size:28px;letter-spacing:-.7px;white-space:normal!important;transform:none!important;width:auto!important}
 [data-screen=home]{grid-template-rows:auto auto auto auto;gap:14px;padding:0 12px}
 [data-screen=home]>.home-heading{margin:0;padding:0;display:block;height:auto}
 .home-heading .page-title{font-size:29px;width:auto;transform:none}
 .home-subtitle{margin:12px 0 0;max-width:none;border:0;padding:0}
 [data-screen=home]>.overview-strip,[data-screen=home]>.product-cards{margin:0}
 .overview-strip .black-inner{padding:12px 18px}
 .overview-stat,.overview-stat:first-child{padding:0 14px;gap:8px;flex-wrap:wrap;justify-content:center}
 .overview-stat .icon{width:24px;height:24px}
 .overview-stat label{font-size:calc(11px * var(--density));white-space:normal}
 .overview-stat strong{font-size:30px}
 .product-cards{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
 .product-card{padding:14px 20px;min-height:240px;display:flex;flex-direction:column;gap:8px}
 .product-card h2{font-size:27px;transform:none;width:auto}
 .product-card .card-info{height:auto;max-height:none;min-height:75px;gap:10px;flex:1}
 .card-info>.icon{width:50px;height:50px}
 .card-info>div{padding-left:10px}
 .card-info strong{font-size:32px}
 .card-info strong small{font-size:24px}
 .product-card .action{position:relative;inset:auto;width:100%;flex:none;margin-top:8px}
 .chart-panel .black-inner{flex-direction:column;padding:16px 18px;gap:12px}
 .chart-main{min-height:180px}
 .chart-heading{height:auto;min-height:25px;flex-wrap:wrap;font-size:12px;gap:6px}
 .chart-area,.reports-chart .chart-area{min-height:145px;margin-top:8px}
 .chart-extra,.detail-chart .chart-extra{width:auto;border:0;border-top:1px solid #46524b;padding:10px 0 0;overflow:visible}
 .detail-chart,.detail-chart>.black-inner{clip-path:polygon(3% 0,97% 0,100% 5%,100% 95%,97% 100%,3% 100%,0 95%,0 5%)}
 .chart-key{order:3;width:100%;font-size:10px;margin:5px 0}
 .chart-key+.period-buttons{margin-left:auto}
 .period-buttons{gap:4px}
 .period-buttons button{min-width:34px}
 .event{font-size:12px;grid-template-columns:10px 40px 75px 1fr;white-space:normal}
 [data-screen=prime],[data-screen=link],[data-screen=mbus]{grid-template-columns:minmax(0,1fr) 220px;grid-template-rows:auto auto auto;gap:16px;padding:0 12px}
 [data-screen=prime]>.device-sidebar,[data-screen=link]>.device-sidebar,[data-screen=mbus]>.device-sidebar{grid-column:1/-1;grid-row:1;height:auto;padding:5px 10px 10px}
 .device-sidebar .side-heading{height:auto;padding:10px 6px}
 .device-sidebar .side-list{display:flex;margin-top:8px;gap:5px;flex-wrap:wrap}
 .device-sidebar .side-list button{width:auto;flex:1;min-width:100px;padding:8px 10px;height:auto;min-height:40px;font-size:calc(14px * var(--density));gap:8px}
 .device-sidebar::after{display:none}
 .device-content{grid-column:1;grid-row:2;min-height:340px;height:auto;padding:5px 10px}
 .hero-art{display:none}
 .device-content .product-name{font-size:36px;width:auto;transform:none}
 .hero-number{font-size:clamp(42px,7vw,80px);letter-spacing:-2px}
 .hero-number .unit{font-size:.4em}
 .flow-box{width:290px;max-width:100%;padding:10px 16px}
 .device-content .water-note{display:none}
 .status-stack{grid-column:2;grid-row:2;width:auto}
 .detail-chart{grid-column:1/-1;grid-row:3;margin:0}
 .link-metadata{width:100%}
 .link-metadata .imei{position:static;font-size:13px}
 .dual-meters{width:100%;grid-template-columns:1fr 1fr;gap:12px}
 .meter-reading strong{font-size:clamp(27px,4.5vw,47px);letter-spacing:-1px}
 .meter-reading strong .unit{font-size:.4em}
 .meter-reading small{font-size:12px;white-space:normal;gap:5px}
 .meter-reading+.meter-reading{padding-left:12px}
 .device-content .link-diagram{left:10px;top:250px;grid-template-columns:55px 70px minmax(0,1fr)}
 .branches::after{left:40px;width:28px}
 .module-photo{display:none}
 [data-screen=settings]{grid-template-columns:minmax(0,1fr);gap:20px;padding:0 12px}
 .settings-sidebar{height:auto;padding:5px 10px 10px}
 .settings-sidebar .side-list button{min-width:130px}
 .settings-main{padding:0 10px}
 .settings-main .page-title{font-size:32px;width:auto;transform:none;letter-spacing:-.8px}
 .preview-frame{width:min(100%,600px);height:438px;justify-self:center;margin:0}
 .theme-choices{gap:10px}
 .theme-thumb{background-position:center;background-size:cover;background-image:url("../reference-native/prime.5d44bde56c96.png")}
 .theme-choice{height:165px}
 .setting-lower{gap:24px}
 [data-screen=devices]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto;padding:0 12px;gap:15px}
 .registry-heading{grid-column:1;grid-row:1;margin:0;flex-wrap:wrap;gap:10px}
 .registry-heading .section-title{width:auto;padding-right:12px}
 .registry-heading h1{font-size:26px}
 .registry-heading .count{font-size:25px}
 .registry-body{grid-column:1;grid-row:2;padding:12px;min-height:0}
 .filters{grid-template-columns:1fr 1fr;height:auto;gap:10px}
 .filters .field,.filters .select-control,.filters .action{min-height:44px}
 .table-wrap{flex:none;max-height:420px;min-height:180px}
 .pagination{gap:6px}
 .pagination .table-totals{width:100%;margin:6px 0 0;justify-content:flex-end}
 .device-inspector{grid-column:1;grid-row:3;min-height:430px;max-width:520px;width:100%;justify-self:center}
 [data-screen=reports]{grid-template-rows:auto auto auto auto;gap:14px;padding:0 12px}
 .reports-heading{margin:0;flex-direction:column;gap:16px}
 .reports-title{width:auto}
 .reports-title h1{font-size:28px}
 .summary-cards{gap:8px}
 .summary-card{padding:10px;gap:8px;height:auto;min-height:70px}
 .summary-card strong{font-size:29px}
 .summary-card .icon{width:25px;height:25px}
 .report-filters{margin:0;height:auto;flex-wrap:wrap;gap:10px}
 .filter-divider{display:none}
 .report-bottom{grid-template-columns:1fr;gap:18px;margin:0}
 .report-comparison{max-height:350px;overflow:auto}
 .distribution{border:0;padding:0 8px}
 .donut-content{height:auto;min-height:125px}
 .exports .action{height:44px}
 [data-screen=map]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto 450px auto;gap:14px;padding:0 12px}
 .map-summary{grid-column:1;grid-row:1;flex-wrap:wrap}
 .map-stat{min-width:30%;flex:1;padding:10px;gap:8px}
 .map-caption{width:auto;flex:1}
 .map-sidebar{grid-column:1;grid-row:2;padding:10px;display:grid;grid-template-columns:1fr 1fr;gap:6px 14px}
 .map-sidebar>.field{grid-column:1/-1}
 .map-sidebar .filter-heading{grid-column:1/-1;margin:10px 0 0}
 .map-canvas{grid-column:1;grid-row:3;min-height:400px}
 .map-inspector{grid-column:1;grid-row:4;min-height:410px}
}
@media(max-width:600px){
 .app-header::before{background-size:950px auto}
 .brand-link{width:192px;height:49px;left:8px;top:6px}
 .header-controls{gap:10px;right:10px;top:7px;padding:4px;height:40px}
 .header-swatches{gap:8px}
 .header-swatches .swatch{width:11px;height:11px}
 .demo-badge{font-size:13px;gap:6px;letter-spacing:.5px}
 .demo-badge b{width:8px;height:8px}
 .logout-button{padding-left:9px}
 .logout-button .icon{width:23px;height:23px}
 .product-nav{left:12px;right:12px;width:auto;height:62px;top:68px;padding:6px 12px}
 .product-nav a{font-size:13px;gap:8px;transform:none}
 .product-nav a>*{transform:none}
 .product-nav .icon{width:24px;height:24px}
 .footer-nav a{flex-direction:column;gap:5px;font-size:calc(10px * var(--density))}
 .home-heading .page-title{font-size:24px}
 .overview-strip .black-inner{padding:14px 8px}
 .overview-stat,.overview-stat:first-child{padding:0 6px;gap:6px;flex-direction:column;text-align:center}
 .overview-stat strong{font-size:28px}
 .product-cards{grid-template-columns:1fr}
 .product-card{padding:16px 30px;min-height:215px}
 .product-card h2{font-size:34px}
 .product-card .card-info{gap:25px;min-height:75px}
 .card-info>.icon{width:65px;height:60px}
 .card-info strong{font-size:39px}
 .card-info small{font-size:calc(14px * var(--density))}
 [data-screen=prime],[data-screen=link],[data-screen=mbus]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto auto}
 .device-content{grid-column:1;grid-row:2;min-height:335px}
 .status-stack{grid-column:1;grid-row:3;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .status-card,.status-stack.link .status-card{height:72px;padding:10px 12px;gap:10px}
 .status-card>.icon{width:28px;height:28px}
 .status-card small{font-size:calc(9px * var(--density));letter-spacing:0}
 .status-card strong{font-size:calc(18px * var(--density))}
 .status-card.compact strong{font-size:calc(16px * var(--density))}
 .status-stack .action,.status-stack.link .action{height:44px;font-size:calc(12px * var(--density));gap:8px;padding:5px 8px}
 .status-stack.link>.action:last-child{grid-column:1/-1}
 .detail-chart{grid-row:4}
 .hero-number{font-size:clamp(45px,13vw,72px)}
 .mbus-content .hero-number{font-size:clamp(45px,13vw,67px)}
 .device-content .flow-box{top:250px;left:10px}
 .link-metadata{align-items:flex-start;gap:10px}
 .link-metadata .imei{font-size:12px;align-self:center}
 .dual-meters{margin-top:24px}
 .meter-reading strong{font-size:clamp(27px,8vw,42px)}
 .meter-reading .metric-label{font-size:9px;letter-spacing:1px}
 .device-content .link-diagram{grid-template-columns:50px 60px minmax(0,1fr)}
 .end-meter{gap:8px}
 .end-meter strong{font-size:10px}
 .end-meter small{font-size:11px}
 .settings-main{padding:0}
 .settings-main .page-title{font-size:26px}
 .settings-subtitle{letter-spacing:1px;line-height:1.5}
 .theme-choice{padding:6px;height:145px;border-radius:8px}
 .theme-choice.selected{padding:5px}
 .theme-thumb{height:76px}
 .theme-choice strong{font-size:14px;margin-top:8px}
 .theme-choice small{font-size:8px;letter-spacing:0;line-height:1.2}
 .choice-check{width:23px;height:23px;right:4px;top:4px}
 .setting-lower{grid-template-columns:1fr;gap:18px;margin-top:22px}
 .preview-frame{height:420px;padding:6px}
 .preview-inner{padding:20px 12px}
 .preview-widget{padding:9px;gap:4px;grid-template-columns:1.8fr 1fr;height:235px}
 .preview-cell{padding:5px;gap:4px}
 .preview-cell strong{font-size:clamp(22px,calc(25px * var(--preview-scale)),29px)}
 .preview-cell.compact strong{font-size:clamp(14px,calc(15px * var(--preview-scale)),18px)}
 .preview-cell .unit{font-size:12px}
 .preview-cell>.icon{width:22px;height:22px}
 .preview-cell.compact>.icon{width:18px;height:18px}
 .preview-cell.compact small{font-size:7px}
 .preview-cell.supply small{font-size:6px}
 .preview-logo{max-width:62%;background-size:1100px auto;background-position:-767px -217px;height:40px}
 .preview-brand span{font-size:10px;gap:4px}
 .preview-brand .icon{width:20px;height:20px}
 .filters{grid-template-columns:1fr}
 .pagination button{min-width:31px}
 .summary-cards{grid-template-columns:1fr}
 .summary-card{justify-content:flex-start;gap:18px}
 .summary-card strong{font-size:32px}
 .date-range{width:100%;justify-content:space-between}
 .report-filters .select-control{flex:1}
 .chart-panel .black-inner{padding:14px 12px}
 .map-stat small{font-size:9px;letter-spacing:.5px}
 .map-stat strong{font-size:26px}
 .map-stat.water strong{font-size:23px}
 .map-sidebar{grid-template-columns:1fr}
}
/* Mask the reference image's printed DEMO label when the header grows wider. */
@media(min-width:1000px){
 .app-header::after{content:'';position:absolute;top:0;left:1000px;right:0;height:57px;background:linear-gradient(110deg,#fafbfc,#f7f8fa);z-index:-1;pointer-events:none}
}
/* Crop a clean part of the original decoration, without baked-in check marks. */
.theme-thumb{background-image:url("../reference-native/login.0f45ccf02f33.png");background-size:750px 421.875px;background-position:-135px -95px;background-repeat:no-repeat;max-width:300px;margin-inline:auto}
@media(max-width:999px){
 #app .app-header::before{background:linear-gradient(130deg,#fff 0%,#eef1f3 43%,#fff 43.4%,#f3f6f7 72%,#e4e9e8 72.4%,#fff 73%);border-bottom:1px solid #d5dcdf}
 #app .brand-link{background:url("../reference-native/home.c2e73d315877.png") -15px -5px/1280px 720px no-repeat}
}
@media(max-width:600px){
 #app .brand-link{background-position:-11px -4px;background-size:950px 534.375px}
}
/* Constrain the preview grid itself, including its intrinsic brand row. */
.preview-viewport{grid-template-columns:minmax(0,1fr);min-width:0}
.preview-widget{width:100%;max-width:350px}
.preview-brand{min-width:0;gap:6px}
.preview-brand span{flex:none}
