/* Meridian Prefab: configurator layout, controls, summary. Tokens from site.css.
   Desktop: options | 3D stage | summary. Below 1100px: stage on top, options below, summary last (the phone quote bar shows the range). */
.cfg-section{padding-block:72px 88px;border-top:1px solid var(--line)}
.cfg{display:grid;grid-template-columns:330px minmax(0,1fr) 300px;height:min(820px,calc(100vh - 110px));min-height:660px;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--surface)}
.cfg-controls{border-right:1px solid var(--line);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.cfg-stage{position:relative;display:flex;flex-direction:column;min-width:0;background:var(--viewer-bg)}
#viewer{position:relative;flex:1;min-height:0;cursor:grab;touch-action:none;color:var(--ink-2);display:block}
#viewer:active{cursor:grabbing}
#viewer canvas{display:block;width:100%!important;height:100%!important}
.cfg-bar{position:absolute;left:12px;right:12px;top:12px;display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;pointer-events:none;z-index:2}
.seg{display:flex;background:var(--surface);border:1px solid var(--line);border-radius:8px;overflow:hidden;pointer-events:auto;max-width:100%}
.seg button{border:0;background:transparent;color:var(--ink-2);font:600 13px/1 var(--font-body);min-height:38px;padding:0 12px;cursor:pointer;white-space:nowrap}
.seg button+button{border-left:1px solid var(--line)}
.seg button[aria-pressed="true"]{background:var(--ink);color:var(--surface)}
.seg button:hover{color:var(--ink)}
.seg button[aria-pressed="true"]:hover{color:var(--surface)}
.cfg-actions{display:flex;gap:8px;flex-wrap:wrap;padding:12px;border-top:1px solid var(--line);background:var(--surface)}
.cfg-actions .btn{font-size:14px;padding:8px 14px}
.ai-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center;padding:10px 12px;border-top:1px solid var(--line);background:var(--surface)}
.ai-row form{display:flex;gap:8px;flex:1 1 320px;min-width:0}
.ai-row input{flex:1;min-width:0;min-height:44px;border:1px solid color-mix(in srgb,var(--ink) 25%,transparent);border-radius:8px;padding:0 12px;background:var(--bg);color:var(--ink);font:16px var(--font-body)}
.ai-row .btn{font-size:14px;padding:8px 14px;white-space:nowrap}
.ideas{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.ideas span{font:600 11.5px/1 var(--font-body);letter-spacing:.1em;text-transform:uppercase;color:var(--ink-2);margin-right:2px}
.ideas button{border:1px solid var(--line);background:transparent;color:var(--ink);border-radius:999px;min-height:36px;padding:0 12px;font:500 13px var(--font-body);cursor:pointer}
.ideas button:hover{border-color:var(--ink-2)}

/* Control groups */
.cg{border-bottom:1px solid var(--line)}
.cg>summary{list-style:none;cursor:pointer;min-height:52px;padding:0 18px;font:700 15px/1.2 var(--font-display);display:flex;justify-content:space-between;align-items:center}
.cg>summary::-webkit-details-marker,.cg-adv>summary::-webkit-details-marker{display:none}
.cg>summary::after{content:"";width:8px;height:8px;border-right:2px solid var(--ink-2);border-bottom:2px solid var(--ink-2);transform:rotate(45deg);transition:transform .2s}
.cg[open]>summary::after{transform:rotate(-135deg)}
.cg-body{padding:2px 18px 18px;display:grid;gap:16px}
.cf[hidden]{display:none}
.cf label,.cf-l{display:flex;justify-content:space-between;gap:10px;font-size:14px;font-weight:600;margin-bottom:6px}
.cf output,.cf-l small{font-variant-numeric:tabular-nums;color:var(--ink-2);font-weight:600}
.cf select{width:100%;min-height:42px;border:1px solid color-mix(in srgb,var(--ink) 25%,transparent);border-radius:8px;padding:0 10px;background:var(--bg);color:var(--ink);font:15px var(--font-body)}
.cf select:disabled{opacity:.6;cursor:not-allowed}
.cf input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:32px;background:transparent;margin:0;cursor:pointer}
.cf input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:var(--line)}
.cf input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:22px;margin-top:-9px;border-radius:50%;background:var(--surface);border:2px solid var(--accent)}
.cf input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--line)}
.cf input[type=range]::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:var(--surface);border:2px solid var(--accent)}
.cf input[type=range]:focus-visible{outline:2px solid var(--steel);outline-offset:2px;border-radius:4px}
.cf-bool label{justify-content:flex-start;align-items:center;gap:10px;margin:0;font-weight:500;cursor:pointer;min-height:40px}
.cf-bool input{width:20px;height:20px;accent-color:var(--accent);margin:0}
.cf-head{font:700 12px/1 var(--font-body);letter-spacing:.12em;text-transform:uppercase;color:var(--ink-2);padding-top:12px;border-top:1px dashed var(--line);margin:0}
.cf-note{font-size:13.5px;color:var(--ink-2);line-height:1.5}
.cg-adv>summary{cursor:pointer;font-size:14px;font-weight:600;color:var(--steel);list-style:none;min-height:40px;display:flex;align-items:center}
.cg-adv[open]>summary{margin-bottom:6px}
.cg-adv{display:grid;gap:16px}
.swatches{display:flex;gap:8px;flex-wrap:wrap}
.swatches button{width:36px;height:36px;border-radius:7px;border:1px solid rgba(0,0,0,.2);background:var(--sw);cursor:pointer;padding:0}
.swatches button[aria-checked="true"]{outline:2px solid var(--ink);outline-offset:2px}
.doors{display:grid;gap:8px;margin-bottom:8px}
.door{position:relative;display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:8px 40px 8px 8px;border:1px solid var(--line);border-radius:8px;background:var(--bg);font-size:13px}
.door select{padding:0 6px;min-height:38px;font-size:14px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink);min-width:0}
.door label{display:flex;justify-content:flex-start;align-items:center;gap:6px;margin:0;font-weight:500;color:var(--ink-2)}
.door input[type=number]{width:100%;min-width:0;min-height:38px;padding:0 6px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink);font:14px var(--font-body)}
.door .d-c input{accent-color:var(--accent);width:18px;height:18px}
.d-x{position:absolute;right:2px;top:2px;width:36px;height:36px;border:0;background:none;color:var(--ink-2);font-size:22px;line-height:1;cursor:pointer;padding:0;border-radius:6px}
.d-x:hover{color:var(--err)}
#door-add{border:1px dashed color-mix(in srgb,var(--ink) 35%,transparent)}

/* Summary */
.cfg-summary{border-left:1px solid var(--line);overflow-y:auto;padding:20px 20px 24px;display:flex;flex-direction:column}
.sum-range{padding-bottom:18px;border-bottom:1px solid var(--line)}
.sum-l{font:600 12px/1.3 var(--font-body);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2)}
.sum-price{font:800 25px/1.15 var(--font-display);margin-top:8px;font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.sum-sub{font-size:13.5px;color:var(--ink-2);margin-top:4px}
.sum-quote{width:100%;margin-top:14px}
.kpis{margin:16px 0 0;display:grid;grid-template-columns:1fr 1fr;gap:14px 12px}
.kpis dt{font:600 11px/1.2 var(--font-body);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2)}
.kpis dd{margin:3px 0 0;font-weight:650;font-variant-numeric:tabular-nums;font-size:15px}
.kpis dd small{display:block;font-weight:500;font-size:12px;color:var(--ink-2)}
.kpis.pv{border-top:1px solid var(--line);padding-top:14px}
.sum-break{margin-top:18px;border-top:1px solid var(--line);padding-top:4px;font-size:14px}
.sum-break summary{cursor:pointer;font-weight:600;min-height:40px;display:flex;align-items:center}
.shares{list-style:none;margin:4px 0 0;padding:0;display:grid;gap:8px}
.shares li{display:grid;grid-template-columns:1fr auto;gap:2px 8px;font-size:13px}
.shares b{font-variant-numeric:tabular-nums}
.shares i{grid-column:1/-1;height:3px;background:var(--ink-2);border-radius:2px;opacity:.6}
.sum-cmp{display:inline-block;margin-top:14px;font-size:14px;font-weight:600;color:var(--steel)}
.sum-note{margin-top:auto;padding-top:16px;font-size:12.5px;color:var(--ink-2);line-height:1.5}

@media (max-width:1240px){.cfg{grid-template-columns:300px minmax(0,1fr) 270px}}
@media (max-width:1100px){
  .cfg{display:flex;flex-direction:column;height:auto;min-height:0}
  .cfg-stage{order:1}
  .cfg-controls{order:2;border-right:0;border-top:1px solid var(--line);overflow:visible}
  .cfg-summary{order:3;border-left:0;border-top:1px solid var(--line);overflow:visible}
  #viewer{flex:none;height:min(62vh,560px);min-height:340px}
}
@media (max-width:760px){
  .cfg-section{padding-block:48px 56px}
  .cfg-section>.wrap{padding-left:0;padding-right:0}
  .cfg-section .head{padding:0 16px}
  .cfg{border-radius:0;border-left:0;border-right:0}
  #viewer{height:56vh;min-height:300px;max-height:480px}
  .cfg-bar{position:static;padding:8px 12px;background:var(--surface);border-bottom:1px solid var(--line);flex-direction:column;align-items:stretch}
  .cfg-stage[data-mode="draw"] .cfg-bar{display:none}
  .seg{overflow-x:auto;scrollbar-width:none}
  .seg button{flex:1 0 auto;min-height:44px;font-size:14px}
  .stage-head{flex-wrap:wrap}
  .stage-head .tabs button{min-height:44px;font-size:14.5px}
  .head-acts .btn{min-height:44px}
  .lang-switch button{height:44px}
  .ai-row form{flex-basis:100%}
  .ai-row .btn{min-height:48px}
  .ideas{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;width:100%;padding-bottom:2px}
  .ideas button{min-height:44px;white-space:nowrap;flex:none;font-size:14px}
  .cfg-actions{display:grid;grid-template-columns:1fr 1fr}
  .cfg-actions .btn{min-height:48px;font-size:14.5px}
  .cfg-actions #act-quote{grid-column:1/-1}
  .cg>summary{min-height:56px;font-size:16px}
  .cf label,.cf-l{font-size:15px}
  .cf select{min-height:48px;font-size:16px}
  .cf input[type=range]{height:44px}
  .cf input[type=range]::-webkit-slider-thumb{width:28px;height:28px;margin-top:-12px}
  .cf input[type=range]::-moz-range-thumb{width:24px;height:24px}
  .cf-bool label{min-height:48px;font-size:15.5px}
  .cf-bool input{width:24px;height:24px}
  .swatches button{width:44px;height:44px}
  .door{grid-template-columns:1fr;padding:10px 48px 10px 10px;font-size:14px}
  .door select,.door input[type=number]{min-height:44px;font-size:16px}
  .door label{display:grid;grid-template-columns:90px 1fr}
  .door .d-c{display:flex}
  .d-x{width:44px;height:44px}
  #door-add{min-height:48px;width:100%}
  .cg-adv>summary{min-height:48px}
  .cfg-summary{padding:20px 16px}
  .sum-quote{min-height:52px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}
