/* Shared presentation layer. Data colours and calculations remain page-owned. */
body[data-energy-tool]{--art-well:#f3f6f7;--art-border:#dce5e9}
:root[data-theme="dark"] body[data-energy-tool]{--art-well:#d4dfe5;--art-border:#a7bac6}
body[data-energy-tool] .tool-heading{display:flex;align-items:center;justify-content:center;gap:24px;max-width:1040px;margin:0 auto 14px}
body[data-energy-tool] .tool-heading h1{margin:0;max-width:820px;text-align:left;min-width:0}
.tool-heading-art{display:block;width:152px;height:88px;object-fit:contain;flex:none;background:var(--art-well);border:1px solid var(--art-border);border-radius:14px}
body[data-energy-tool="index"] .tc-graphic{height:132px;padding:14px;background:var(--surface);border-bottom:1px solid var(--border)}
body[data-energy-tool="index"] .tc-graphic img{display:block;width:240px;height:102px;max-width:100%;object-fit:contain;background:var(--art-well);border:1px solid var(--art-border);border-radius:14px}
body[data-energy-tool="index"] .tc-source{line-height:1.5;min-width:0}
body[data-energy-tool="index"] .tc-meta{align-items:flex-start}
body[data-energy-tool] :is(.chart-legend-inline,.legend-inline){gap:8px 14px;line-height:1.5}
body[data-energy-tool] :is(.chart-legend-item,.legend-item){font-size:12px;white-space:normal;min-width:0}
body[data-energy-tool] .chart-legend-dot{width:9px;height:9px;flex:none}
body[data-energy-tool] .axis-text{font-size:11px;font-variant-numeric:tabular-nums}
body[data-energy-tool] :is(.chart-title,.card-title){line-height:1.55}
body[data-energy-tool] :is(.csv-btn,.dl-btn,.export-btn,.download-btn){min-height:36px;padding:8px 14px;border-radius:8px;border:1px solid var(--border);font:500 12px/1.4 'Inter',system-ui,sans-serif;cursor:pointer}
body[data-energy-tool] :is(.csv-btn,.dl-btn,.export-btn,.download-btn):hover{border-color:var(--amber2)}
body[data-energy-tool] :is(button,a,select,input,summary,[tabindex]):focus-visible{outline:3px solid var(--amber2,#e8a124);outline-offset:3px}
body[data-energy-tool] :is(.chart-tip,#info-tip){box-sizing:border-box;max-width:min(340px,calc(100vw - 24px));font:12px/1.55 'Inter',system-ui,sans-serif;border-radius:8px;white-space:normal;overflow-wrap:break-word;box-shadow:0 5px 18px #0b25452b}
body[data-energy-tool] .chart-tip .tip-row{flex-wrap:wrap;gap:4px}
body[data-energy-tool] :is(.data-tbl-wrap,.tbl-wrap,.city-tbl-wrap,.hdt-scroll,.tv-tblwrap,.scorecard-wrap,.table-scroll){max-width:100%;overscroll-behavior-x:contain;scrollbar-width:thin}
body[data-energy-tool] [data-scroll-region]{outline-offset:2px}
body[data-energy-tool] :is(.data-tbl,.dt,.scorecard,.city-tbl,.hdt-table) :is(th,td){font-variant-numeric:tabular-nums}
body[data-energy-tool] :is(.card,.grid-2,.grid2,.chart-grid,.ctrl,.ctrl-group){min-width:0}
body[data-energy-tool] :is(.cw,.chart-wrap) canvas{max-width:100%}
body[data-energy-tool] .stat-card{min-width:0}
body[data-energy-tool] .header-tools{display:flex;align-items:center;gap:12px;min-width:0;flex-wrap:wrap}
body[data-energy-tool] .header-tools .header-links{display:flex;align-items:center;gap:8px 12px;flex-wrap:wrap;min-width:0}
body[data-energy-tool] .ab-mini .ab-short{font-size:12px}
body[data-energy-tool] .ab-mini .ab-btn{width:auto;min-width:48px;height:32px;padding:2px 8px;line-height:1.4}
@media(max-width:800px){
 body[data-energy-tool] header{height:auto;min-height:52px;gap:10px;flex-wrap:wrap;padding:10px 16px}
 body[data-energy-tool] header>div{min-width:0;max-width:100%;flex-wrap:wrap}
 body[data-energy-tool] .header-tools{gap:8px 12px!important}
 body[data-energy-tool] header :is(.header-title,.header-badge){display:none}
 body[data-energy-tool] .tool-heading{gap:14px}
 .tool-heading-art{width:116px;height:76px}
 body[data-energy-tool] :is(.card-title-row,.chart-head,.section-head){flex-wrap:wrap;gap:10px}
 body[data-energy-tool] :is(.ctrl-bar,.filter-bar){gap:12px;flex-wrap:wrap}
 body[data-energy-tool] :is(.seg,.seg-toggle,.seg-control){max-width:100%;flex-wrap:wrap}
 body[data-energy-tool] :is(.filter-group,.filter-group select){max-width:100%}
}
@media(max-width:600px){
 body[data-energy-tool] .tool-heading{align-items:flex-start;gap:12px}
 .tool-heading-art{width:84px;height:62px;border-radius:10px}
 body[data-energy-tool] .tool-heading h1{font-size:clamp(1.4rem,5.6vw,1.8rem);line-height:1.25}
 body[data-energy-tool] :is(.seg-btn,.sector-tab,.mode-btn,.prov-btn,.basis-btn,.theme-btn,.card-select,.csv-btn,.dl-btn,.export-btn,.download-btn){min-height:40px}
 body[data-energy-tool] .theme-btn{min-width:38px;padding:8px}
 body[data-energy-tool] .header-tools{flex:1 1 100%;justify-content:space-between}
 body[data-energy-tool] .header-tools .header-links{flex:1 1 140px;gap:4px 10px}
 body[data-energy-tool] .header-tools .theme-toggle{margin-left:0;flex:none}
 body[data-energy-tool] .header-tools .sibling-link{font-size:11px}
 body[data-energy-tool] .sector-tabs{max-width:100%;overflow-x:auto;scrollbar-width:thin;flex:none}
 body[data-energy-tool] .sector-tab{flex:none}
 body[data-energy-tool] :is(.data-tbl,.city-tbl,.scorecard) :is(th,td){padding:8px 10px}
 body[data-energy-tool] .chart-grid{grid-template-columns:minmax(0,1fr)}
 body[data-energy-tool="permits"] .method-grid{grid-template-columns:minmax(0,1fr)}
 body[data-energy-tool="permits"] #quality-body :is(table,tbody,tr,td){display:block;width:auto!important;white-space:normal}
 body[data-energy-tool="permits"] #quality-body td{overflow-wrap:break-word;text-align:left}
 body[data-energy-tool="permits"] #quality-body tr{margin-bottom:12px}
 body[data-energy-tool="heatpump"] .verdict-pill{white-space:normal;max-width:100%;box-sizing:border-box}
 body[data-energy-tool="heatpump"] .ctrl-fields.ctrl-fields-6{grid-template-columns:repeat(2,minmax(0,1fr))}
 body[data-energy-tool="heatpump"] .ctrl label{white-space:normal;overflow:visible;min-height:38px;align-items:center;flex-wrap:wrap;line-height:1.4}
 body[data-energy-tool="heatpump"] .ctrl .info-btn{flex:none}
 body[data-energy-tool="heatpump"] .ctrl-hint{white-space:normal}
 body[data-energy-tool="heatpump"] :is(.ctrl select,.ctrl input[type=number]){min-height:40px}
}
@media(max-width:420px){
 body[data-energy-tool="construction"] .stats-grid,
 body[data-energy-tool="permits"] .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body[data-energy-tool="heatpump"] .ctrl-fields.ctrl-fields-6,
 body[data-energy-tool="heatpump"] .ctrl-fields.ctrl-fields-4,
 body[data-energy-tool="heatpump"] .ctrl-fields.ctrl-fields-ghg{grid-template-columns:minmax(0,1fr)}
 body[data-energy-tool="heatpump"] .ctrl label{min-height:26px}
}
@media(prefers-reduced-motion:reduce){
 body[data-energy-tool] *,body[data-energy-tool] *::before,body[data-energy-tool] *::after{scroll-behavior:auto!important;transition:none!important}
}
/* Map controls are independent of the dashboard chrome. */
body[data-energy-tool="geothermal"] .panel{background:rgba(255,255,255,.98);box-shadow:0 2px 12px #0b254526}
body[data-energy-tool="geothermal"] #title{box-sizing:border-box;max-width:min(440px,calc(100vw - 70px))}
body[data-energy-tool="geothermal"] .map-title-art{float:right;width:90px;height:45px;object-fit:contain;margin:0 0 5px 10px}
.geo-panel-toggle{display:none}
@media(max-width:640px){
 body[data-energy-tool="geothermal"] #title{left:54px;right:10px;max-width:none;padding:10px 12px}
 body[data-energy-tool="geothermal"] #title h1{font-size:15px;line-height:1.3}
 body[data-energy-tool="geothermal"] #title p{font-size:11px;line-height:1.4}
 body[data-energy-tool="geothermal"] .map-title-art{width:70px;height:37px;margin-left:6px}
 body[data-energy-tool="geothermal"] #segsel{box-sizing:border-box;left:54px;right:10px;max-width:none;max-height:42vh;overflow:auto;padding:0}
 body[data-energy-tool="geothermal"] #legend{box-sizing:border-box;left:10px;right:10px;bottom:74px;max-width:none;max-height:48vh;overflow:auto;padding:0}
 body[data-energy-tool="geothermal"] #assumptions{box-sizing:border-box;left:10px;right:10px;bottom:26px;max-width:none;max-height:52vh;padding:0}
 body[data-energy-tool="geothermal"] #asmHead{padding:12px}
 body[data-energy-tool="geothermal"] #asmBody{padding:0 12px 12px;margin:0}
 body[data-energy-tool="geothermal"] .geo-panel-toggle{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:42px;padding:10px 12px;background:white;border:0;font:600 13px/1.5 system-ui;color:#0b2545;text-align:left;cursor:pointer}
 body[data-energy-tool="geothermal"] .geo-panel-toggle::after{content:'+';font-size:18px}
 body[data-energy-tool="geothermal"] .geo-panel-toggle[aria-expanded=true]::after{content:'−'}
 body[data-energy-tool="geothermal"] .geo-panel-content{display:none;padding:0 12px 12px}
 body[data-energy-tool="geothermal"] .geo-panel-open .geo-panel-content{display:block}
 body[data-energy-tool="geothermal"] #segsel label{min-height:38px;align-items:center;line-height:1.4}
 body[data-energy-tool="geothermal"] :is(#asmReset,#asmTable input){min-height:36px}
 body[data-energy-tool="geothermal"] .leaflet-control-layers{max-width:calc(100vw - 25px)}
 body[data-energy-tool="geothermal"] .leaflet-control-layers-expanded{max-height:45vh;overflow-y:auto}
}
