/* Responsive layout and touch controls. Desktop retains the original layout. */
.nav-toggle,.export-mobile,.mobile-swipe-hint{display:none}
.skip-link{position:fixed;top:8px;left:8px;z-index:100;transform:translateY(-160%);background:#fff;padding:12px 18px;border-radius:6px}
.skip-link:focus{transform:none}
.main-shell,main,.field,.sim-layout>*,.grid2>*,.grid-main>*,.metrics>*,.guide-panel{min-width:0}
.table-wrap{max-width:100%;overscroll-behavior-x:contain}
.source-images figure{margin:0;min-width:0}
.mobile-kpi-values{display:flex;justify-content:space-between;gap:12px;width:100%}
.mobile-pane-switch{display:none}
@media screen and (max-width:1100px){
  .grid-main,.grid2{grid-template-columns:repeat(2,minmax(0,1fr))}
  .panel-title{flex-wrap:wrap}
  .metric .value{font-size:clamp(20px,2.5vw,28px);white-space:normal;overflow-wrap:anywhere}
  .image-hero .hero-copy{width:70%}
}
@media screen and (max-width:800px){
  :root{--mobile-header:72px}
  html{scroll-padding-top:calc(var(--mobile-header) + 12px)}
  .sidebar{position:sticky;top:0;z-index:20;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:12px max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left));min-height:var(--mobile-header);gap:0 12px}
  .sidebar .brand{min-height:48px;font-size:13px}
  .brand-sub{font-size:9px}
  .nav-toggle{display:inline-flex;align-items:center;gap:9px;border:1px solid #67836f;border-radius:7px;background:#224b3c;color:#f3f6e9;padding:10px 12px;min-height:44px;font-size:13px}
  .nav-toggle span{font-size:19px}
  .sidebar nav{display:none;flex:0 0 100%;margin-top:12px;max-height:calc(100dvh - 100px);overflow:auto;gap:6px}
  .mobile-menu-open .sidebar nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .sidebar nav a{white-space:normal;min-height:48px;padding:12px;font-size:13px;line-height:1.4}
  .sidebar .workspace-label,.sidebar .side-bottom{display:none}
  .main-shell{margin-left:0}
  .topbar{padding:10px 16px;min-height:64px}
  .top-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .top-actions #save-status{display:none}
  .export-mobile{display:inline}.export-desktop{display:none}
  main{padding:24px 16px 36px}
  h1{font-size:clamp(28px,5vw,36px);letter-spacing:-1px;line-height:1.15}
  .page-head p{font-size:14px;line-height:1.65}
  .page-head{margin-bottom:24px}
  .button{font-size:13px;min-height:44px;padding:12px 14px;display:inline-flex;align-items:center;justify-content:center;line-height:1.4;text-align:center}
  .panel{padding:20px;margin-bottom:16px}.panel-title{gap:10px;align-items:flex-start}
  .panel-title h2{font-size:18px}.badge{white-space:normal;line-height:1.4;font-size:10px}
  .small,.notice,.chart-note,.cash-caption{font-size:13px;line-height:1.65}
  .row{font-size:13px;align-items:flex-start;gap:12px}.row>span{flex:1;min-width:0}.row strong{max-width:60%;overflow-wrap:anywhere}
  .fields{gap:24px}.field label{font-size:14px;line-height:1.5;margin-bottom:8px}.field small{font-size:12px;line-height:1.5;color:#68775d}
  .field input:not([type=range]),.field textarea{font-size:16px;min-height:48px;padding:12px}
  .field input[type=range]{height:44px;background:linear-gradient(to right,#537e59 0 var(--range-fill,50%),#e1e8d8 var(--range-fill,50%) 100%) center / 100% 6px no-repeat;touch-action:pan-y}
  .field input[type=range]::-webkit-slider-thumb{width:26px;height:26px;border-width:4px}
  .field input[type=range]::-moz-range-thumb{width:20px;height:20px;border-width:4px}
  .range-line{margin-top:2px}.range-labels{font-size:11px;margin-top:0}
  .control-panel{padding:20px}.control-panel .field{padding-bottom:18px}
  .control-panel h3{font-size:18px}.control-panel .field input[type=number]{padding:12px}
  .explorer-layout,.sim-layout{grid-template-columns:minmax(0,1fr)}
  .mobile-kpi{display:block;position:sticky;top:var(--mobile-header);scroll-margin-top:0;padding:10px 12px 12px;border-radius:10px;z-index:9;margin-bottom:18px}
  .mobile-kpi-values{gap:8px}.mobile-kpi-values>span{flex:1;min-width:0;font-size:10px}.mobile-kpi strong{font-size:clamp(15px,4.3vw,20px);overflow-wrap:anywhere}
  .mobile-pane-switch{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;background:#0e2c23;border-radius:7px;padding:4px;margin-bottom:12px}
  .mobile-pane-switch button{min-height:44px;padding:9px 6px;border:0;border-radius:5px;background:transparent;color:#d7e5c9;font-size:13px;font-weight:600}
  .mobile-pane-switch button[aria-pressed=true]{background:#deebbd;color:#173d30}
  [data-mobile-pane=results]>.control-panel,[data-mobile-pane=controls]>.explorer-results{display:none}
  .lab-toolbar{align-items:stretch;flex-direction:column;gap:14px;padding:18px}
  .lab-toolbar p,.lab-toolbar h3{font-size:13px}.lab-toolbar h3{font-size:16px}
  .lab-toolbar .pill-list>*{flex:1}.lab-toolbar .pill-list{width:100%}
  .example-heading h2{font-size:24px}.example-heading p{font-size:14px}.example-heading{flex-direction:column;align-items:flex-start}
  .example-heading>.badge{display:none}.example-heading .button{width:100%}
  .example-grid{display:flex;overflow-x:auto;align-items:flex-start;gap:12px;padding:4px 3px 14px;scroll-snap-type:x proximity;scroll-padding-inline:3px;overscroll-behavior-x:contain}
  .example-card{flex:0 0 min(84%,340px);scroll-snap-align:start;padding:20px;min-height:390px}
  .example-card h3{font-size:19px}.example-description{font-size:13px;min-height:64px}
  .example-numbers{grid-template-columns:1fr 1fr;gap:10px}.example-numbers span,.example-budget{font-size:11px}
  .example-numbers strong{font-size:23px}.example-budget strong{white-space:nowrap}
  .example-card>.button{min-height:48px;font-size:14px}.example-details summary{min-height:44px;padding:13px 0;font-size:12px}
  .example-details p,.example-details .row{font-size:12px}.example-footnote{font-size:12px}
  .mobile-swipe-hint{display:block;font-size:12px;color:#5f7359;margin:0 0 10px}
  .guide-steps{gap:8px;scroll-snap-type:x proximity;padding-bottom:8px}.guide-step{min-height:72px;min-width:125px;scroll-snap-align:start;font-size:12px}.guide-step strong{font-size:14px}
  .guide-panel{padding:20px}.guide-panel h2{font-size:24px}.guide-panel .fields{gap:24px}.guide-caption{font-size:13px}.guide-bottom{gap:10px}.guide-bottom>*{flex:1}
  details summary{min-height:52px;font-size:14px;padding:18px}.floor .button{padding:10px 12px}
  .table-wrap{font-size:12px;-webkit-overflow-scrolling:touch}.table-wrap:before{content:'Desliza la tabla para ver más columnas →';display:block;position:sticky;left:0;padding:12px;font-size:11px;color:#65755d;background:#f2f5ec;white-space:normal;width:100%;box-sizing:border-box}
  th,td{font-size:12px;padding:12px}th:first-child,td:first-child{position:sticky;left:0;background:#f6f8ef;z-index:1;box-shadow:1px 0 #e0e7d7}
  .check{min-height:48px;gap:14px;padding:18px 0}.check input{width:23px;height:23px;flex-basis:23px}.check strong{font-size:14px}.check small{font-size:13px}
  .source strong{font-size:15px}.source p{font-size:13px}.source{padding:20px 0;overflow-wrap:anywhere}.formula{font-size:12px;overflow-wrap:anywhere}
  .step h3{font-size:15px}.step p,.track-item p,.product-banner p{font-size:13px}.pill{font-size:12px}
  .snapshot-card h3{font-size:15px}.snapshot-card p{font-size:13px}.snapshot-card .pill-list>*{flex:1}
  .chart-key,.legend{font-size:12px;gap:12px;flex-wrap:wrap}.donut-legend div{font-size:12px;line-height:1.5}.donut-legend span{min-width:0}
  .toast{left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));max-width:none;font-size:13px;padding:14px 16px;line-height:1.5;pointer-events:none}
  footer{padding:20px 16px calc(20px + env(safe-area-inset-bottom));font-size:11px;flex-wrap:wrap}
}
@media screen and (max-width:600px){
  .grid-main,.grid2,.explorer-results .grid2,.snapshot-grid{grid-template-columns:minmax(0,1fr)}
  .fields,.floor .fields,.control-panel .fields{grid-template-columns:minmax(0,1fr)}
  .metrics,.explorer-results .metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .metric{padding:15px 12px}.metric .value,.explorer-results .metric .value{font-size:clamp(21px,5.5vw,28px);letter-spacing:-.6px;white-space:normal}
  .metric-label{font-size:12px;line-height:1.45;margin-bottom:12px}.metric small{font-size:11px;line-height:1.5}
  .example-card{flex-basis:88%}.example-numbers strong{font-size:22px}.example-description{min-height:0}
  .image-hero{min-height:390px}.image-hero img{height:390px;object-position:60% center}.image-hero .hero-copy{width:100%;padding:24px 20px 36px}.image-hero .hero-copy h2{font-size:28px}.image-hero .hero-copy p{font-size:14px;max-width:300px}.image-hero .hero-note{font-size:8px;max-width:95%;text-align:right}
  .product-banner>div{padding:22px}.product-banner img{height:210px}.source-images figcaption{font-size:12px}
  .flow-diagram{grid-template-columns:1fr}.flow-arrow{transform:rotate(90deg)}.flow-stage{padding:20px;min-height:0}.flow-stage strong{font-size:18px;display:inline-block;margin:0 8px}.flow-stage p{font-size:13px;margin-top:12px}
  .live-chart text{font-size:12px}.live-chart{min-height:190px}.donut-layout{grid-template-columns:130px minmax(0,1fr);gap:12px}.donut-chart{min-height:0}
  .scenario-bar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.scenario-bar .button{width:100%}
  .toolbar{align-items:stretch}.toolbar>.button{flex:1}.toolbar>.badge{max-width:100%;overflow-wrap:anywhere}
  .track{grid-template-columns:1fr}.guide-panel .metrics{grid-template-columns:1fr}.guide-panel .metric .value{font-size:26px}
}
@media screen and (max-width:360px){
  main{padding-left:12px;padding-right:12px}.panel{padding:16px}.example-card{flex-basis:94%;padding:16px}.example-numbers strong{font-size:20px}
  .donut-layout{grid-template-columns:minmax(0,1fr)}.donut-chart{max-width:180px}.donut-legend div{margin:8px 0}
  .sidebar nav{grid-template-columns:1fr!important}.guide-bottom{flex-wrap:wrap}.mobile-pane-switch button{font-size:12px}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}*{transition:none!important}}
@media print{.nav-toggle,.mobile-swipe-hint,.mobile-pane-switch,.skip-link{display:none!important}.export-mobile{display:none}}
