
    :root {
      color-scheme: light;
      --brand-900:#102a9b; --brand-800:#1737b5; --brand-700:#224bd4; --brand-600:#3166e8;
      --brand-500:#3b82f6; --brand-400:#63a4ff; --brand-300:#93c3ff; --brand-100:#e8f1ff;
      --bg:#eef3fb; --viewport:#e9eff8; --scene-viewport:#eef3fb; --scene-grid:#d8e0ed; --surface-1:#ffffff; --surface-2:#f7f9fd; --surface-3:#eef3fb;
      --surface-4:#e5ebf5; --border:#d8e0ed; --border-strong:#bcc9db; --text:#172033; --muted:#68758a;
      --muted-2:#8a97aa; --accent:var(--brand-600); --accent-2:var(--brand-800); --accent-soft:#eaf1ff;
      --success:#1aa56b; --warning:#d68a00; --danger:#d94255; --shadow:0 16px 45px rgba(41,61,96,.16);
      --topbar-h:58px; --rail-w:60px; --left-panel-w:350px; --right-panel-w:390px; --tool-h:64px;
      --radius:13px; --radius-sm:9px; --font:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    }
    html[data-theme="dark"] {
      color-scheme: dark;
      --bg:#0f141b; --viewport:#0b1017; --scene-viewport:#eef3fb; --scene-grid:#d8e0ed; --surface-1:#151b24; --surface-2:#1b2330; --surface-3:#222c3a;
      --surface-4:#2a3545; --border:rgba(255,255,255,.095); --border-strong:rgba(255,255,255,.16);
      --text:#ecf2f8; --muted:#93a2b5; --muted-2:#69788c; --accent:#63b3ff; --accent-2:#8fd3ff;
      --accent-soft:rgba(99,179,255,.13); --success:#55d69e; --warning:#f2c66d; --danger:#ff7d8a;
      --shadow:0 18px 55px rgba(0,0,0,.34);
    }
    *{box-sizing:border-box} html,body{width:100%;height:100%;margin:0;overflow:hidden}
    body{font-family:var(--font);color:var(--text);background:var(--bg);font-size:13px;user-select:none}
    button,input,select{font:inherit;color:inherit} button{cursor:pointer} svg{display:block}
    .app{width:100%;height:100%;display:grid;grid-template-rows:var(--topbar-h) 1fr;background:var(--bg)}
    .topbar{display:flex;align-items:center;gap:10px;padding:0 12px;background:var(--surface-1);border-bottom:1px solid var(--border);box-shadow:0 2px 12px rgba(42,58,89,.08);z-index:70}
    html[data-theme="dark"] .topbar{background:linear-gradient(180deg,#18202b,#141b24);box-shadow:0 2px 12px rgba(0,0,0,.22)}
    .brand{display:flex;align-items:center;gap:10px;min-width:236px}.logo-shell{height:40px;width:132px;border-radius:9px;display:flex;align-items:center;padding:5px 8px;background:rgba(255,255,255,.94);border:1px solid rgba(28,68,185,.10)}
    .logo-shell img{width:100%;height:100%;object-fit:contain}.brand-title{font-size:14px;font-weight:760;white-space:nowrap;color:var(--brand-800)}
    html[data-theme="dark"] .brand-title{color:var(--text)}
    .project-card{height:40px;min-width:270px;max-width:430px;display:flex;align-items:center;gap:10px;padding:0 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}
    .project-card .project-main{min-width:0}.project-name{font-weight:720;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.project-meta{color:var(--muted);font-size:10px;margin-top:2px}.project-card .project-icon{color:var(--accent)}
    .top-spacer{flex:1}.top-actions{display:flex;align-items:center;gap:7px}.divider{width:1px;height:28px;background:var(--border);margin:0 2px}
    .btn{height:34px;padding:0 11px;border:1px solid var(--border);border-radius:9px;display:inline-flex;align-items:center;justify-content:center;gap:7px;background:var(--surface-2);transition:.15s ease;white-space:nowrap}
    .btn:hover{background:var(--surface-3);border-color:var(--border-strong)}.btn.primary{background:var(--accent);color:white;border-color:transparent;font-weight:700}.btn.primary:hover{background:var(--accent-2)}
    .btn.icon-only{width:34px;padding:0}.btn.ghost{border-color:transparent;background:transparent}.btn.ghost:hover{background:var(--surface-3)}.btn.active{border-color:color-mix(in srgb,var(--accent) 55%,transparent);background:var(--accent-soft);color:var(--accent-2)}
    .workspace{min-height:0;display:grid;grid-template-columns:var(--rail-w) auto 1fr auto;position:relative}.rail{width:var(--rail-w);background:var(--surface-1);border-right:1px solid var(--border);display:flex;flex-direction:column;align-items:center;padding:8px 0;z-index:35}
    .rail-group{display:flex;flex-direction:column;gap:4px;width:100%;align-items:center}.rail-bottom{margin-top:auto}.rail-btn{width:43px;height:43px;border:0;border-radius:10px;display:grid;place-items:center;background:transparent;color:var(--muted);position:relative;transition:.15s}
    .rail-btn:hover{background:var(--surface-3);color:var(--text)}.rail-btn.active{color:var(--accent-2);background:var(--accent-soft)}.rail-btn.active:before{content:"";position:absolute;left:-8px;width:3px;height:23px;border-radius:0 4px 4px 0;background:var(--accent)}.rail-btn.panel-open{color:var(--accent-2);background:color-mix(in srgb,var(--accent-soft) 78%,transparent)}.rail-btn.panel-open:after{content:"";position:absolute;right:5px;bottom:5px;width:6px;height:6px;border-radius:50%;background:var(--success);box-shadow:0 0 0 2px var(--surface-1)}
    .left-panel{width:var(--left-panel-w);min-width:260px;max-width:520px;background:var(--surface-1);border-right:1px solid var(--border);display:flex;flex-direction:column;min-height:0;position:relative;z-index:30}.left-panel.collapsed{display:none}
    .panel-header{height:57px;display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--border);background:var(--surface-1)}.panel-headings{min-width:0;flex:1}.panel-title{font-size:14px;font-weight:760}.panel-subtitle{font-size:10px;color:var(--muted);margin-top:3px}
    .panel-body{min-height:0;overflow:auto;padding:12px}.left-page{display:none}.left-page.active{display:block}.resize-handle{position:absolute;top:0;right:-4px;width:8px;height:100%;cursor:col-resize;z-index:10}
    .viewport{min-width:0;min-height:0;position:relative;overflow:hidden;background:var(--scene-viewport)}.viewport:before{content:"";position:absolute;inset:0;background-image:linear-gradient(var(--scene-grid) 1px,transparent 1px),linear-gradient(90deg,var(--scene-grid) 1px,transparent 1px);background-size:42px 42px;opacity:.35;mask-image:linear-gradient(to bottom,transparent,black 18%,black 76%,transparent)}
    .viewport:after{content:"";position:absolute;inset:0;background:radial-gradient(circle at 50% 45%,transparent 0 10%,color-mix(in srgb,var(--scene-viewport) 55%,transparent) 58%,var(--scene-viewport) 100%);pointer-events:none}
    .empty-scene{position:absolute;inset:0;display:grid;place-items:center;text-align:center;z-index:2;pointer-events:none}.empty-mark{width:96px;height:96px;border-radius:24px;display:grid;place-items:center;color:var(--accent);background:color-mix(in srgb,var(--surface-1) 82%,transparent);border:1px solid var(--border);box-shadow:var(--shadow)}.empty-scene h2{margin:16px 0 5px;font-size:17px}.empty-scene p{margin:0;color:var(--muted);max-width:430px;line-height:1.5}
    .viewcube{position:absolute;right:18px;top:18px;width:80px;height:80px;z-index:8;display:grid;place-items:center}.cube-face{width:54px;height:54px;border:1px solid var(--border-strong);background:var(--surface-1);transform:rotate(30deg) skewY(-8deg);border-radius:7px;box-shadow:0 10px 24px rgba(0,0,0,.12);display:grid;place-items:center;color:var(--accent);font-weight:800}.cube-face span{transform:skewY(8deg) rotate(-30deg);font-size:10px}
    .viewport-chips{position:absolute;top:18px;left:18px;display:flex;gap:7px;z-index:8}.chip{height:30px;padding:0 9px;border-radius:8px;display:flex;align-items:center;gap:6px;background:color-mix(in srgb,var(--surface-1) 88%,transparent);border:1px solid var(--border);color:var(--muted);backdrop-filter:blur(10px)}
    .tool-status{position:absolute;bottom:82px;left:50%;transform:translateX(-50%);height:34px;padding:0 12px;border-radius:9px;display:none;align-items:center;gap:8px;background:var(--surface-1);border:1px solid var(--border);box-shadow:var(--shadow);z-index:11}.tool-status.show{display:flex}.tool-status strong{color:var(--accent-2)}
    .bottom-toolbar{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);height:var(--tool-h);display:flex;align-items:center;gap:4px;padding:6px;border-radius:14px;background:color-mix(in srgb,var(--surface-1) 94%,transparent);border:1px solid var(--border);box-shadow:var(--shadow);z-index:12;backdrop-filter:blur(14px)}
    .tool-btn{width:52px;height:50px;border:0;border-radius:10px;background:transparent;color:var(--muted);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:9px;transition:.15s}.tool-btn:hover{background:var(--surface-3);color:var(--text)}.tool-btn.active{background:var(--accent-soft);color:var(--accent-2)}.tool-sep{width:1px;height:38px;background:var(--border);margin:0 3px}
    .where-popover{position:absolute;bottom:88px;right:18px;width:310px;border-radius:13px;background:var(--surface-1);border:1px solid var(--border);box-shadow:var(--shadow);z-index:25;display:none;overflow:hidden}.where-popover.show{display:block}.popover-header{height:44px;display:flex;align-items:center;padding:0 12px;border-bottom:1px solid var(--border);font-weight:750}.popover-header .spacer{flex:1}.popover-body{padding:12px}.where-grid{display:grid;grid-template-columns:105px 1fr;gap:8px;font-size:12px}.where-grid .label{color:var(--muted)}.model-badges{display:flex;flex-wrap:wrap;gap:5px;margin-top:10px}.model-badge{padding:5px 7px;border-radius:7px;background:var(--surface-3);border:1px solid var(--border);font-size:10px}
    .inspector{width:var(--right-panel-w);min-width:310px;max-width:620px;background:var(--surface-1);border-left:1px solid var(--border);display:flex;flex-direction:column;min-height:0;position:relative;z-index:31}.inspector.collapsed{display:none}.inspector .resize-handle{left:-4px;right:auto}.inspector-tabs{display:flex;gap:2px;padding:8px 10px 0;border-bottom:1px solid var(--border);background:var(--surface-1)}
    .inspector-tab{height:35px;padding:0 11px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);display:flex;align-items:center;gap:6px}.inspector-tab:hover{color:var(--text)}.inspector-tab.active{color:var(--accent-2);border-bottom-color:var(--accent);font-weight:700}.inspector-body{min-height:0;overflow:auto;padding:12px}.inspector-pane{display:none}.inspector-pane.active{display:block}
    .section-label{display:flex;align-items:center;justify-content:space-between;margin:13px 0 7px;color:var(--muted);font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.08em}.section-label:first-child{margin-top:0}.card{border:1px solid var(--border);border-radius:11px;background:var(--surface-2);overflow:hidden}.card+.card{margin-top:8px}.kv{display:grid;grid-template-columns:115px 1fr;gap:8px;padding:8px 10px;border-bottom:1px solid var(--border)}.kv:last-child{border-bottom:0}.kv .k{color:var(--muted)}.kv .v{font-weight:620;min-width:0;word-break:break-word}.pill{display:inline-flex;align-items:center;gap:5px;padding:4px 7px;border-radius:999px;background:var(--accent-soft);color:var(--accent-2);font-size:10px;font-weight:720}.pill.success{background:color-mix(in srgb,var(--success) 13%,transparent);color:var(--success)}.pill.warning{background:color-mix(in srgb,var(--warning) 13%,transparent);color:var(--warning)}
    .selection-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.selection-actions .btn{padding:0 7px;font-size:11px}.selection-list{margin-top:10px;display:flex;flex-direction:column;gap:6px}.selection-item{display:flex;align-items:center;gap:8px;padding:8px;border-radius:9px;background:var(--surface-2);border:1px solid var(--border)}.selection-color{width:9px;height:9px;border-radius:3px;background:var(--brand-500)}
    .clash-summary{display:flex;align-items:center;justify-content:space-between;padding:10px;border-radius:10px;background:var(--accent-soft);border:1px solid color-mix(in srgb,var(--accent) 25%,var(--border));margin-bottom:9px}.clash-summary strong{font-size:18px;color:var(--accent-2)}.clash-card{border:1px solid var(--border);border-radius:11px;background:var(--surface-2);overflow:hidden;margin-bottom:8px}.clash-head{display:flex;align-items:center;padding:9px 10px;border-bottom:1px solid var(--border)}.clash-name{font-weight:760}.clash-index{width:24px;height:24px;display:grid;place-items:center;border-radius:7px;background:var(--accent-soft);color:var(--accent-2);font-weight:800;margin-right:8px}.clash-body{padding:8px 10px;display:grid;grid-template-columns:92px 1fr;gap:6px 8px;font-size:11px}.clash-body .k{color:var(--muted)}.copy-id{display:inline-flex;align-items:center;gap:4px;color:var(--accent-2);cursor:pointer;font-weight:650}.copy-id:hover{text-decoration:underline}
    .search{height:34px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);display:flex;align-items:center;gap:7px;padding:0 9px;margin-bottom:9px;color:var(--muted)}.search input{border:0;outline:0;background:transparent;min-width:0;flex:1}.mini-toolbar{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.mini-toolbar .btn{height:31px;padding:0 8px;font-size:11px}
    .model-section{border:1px solid var(--border);border-radius:11px;background:var(--surface-2);overflow:hidden;margin-bottom:8px}.model-section-head{display:grid;grid-template-columns:26px 22px minmax(0,1fr) 30px 18px;align-items:center;gap:5px;padding:8px 8px;border-bottom:1px solid var(--border)}.model-section.collapsed .model-section-body{display:none}.model-section.collapsed .model-section-head{border-bottom:0}.section-name{font-weight:760;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.count{font-size:9px;color:var(--muted);margin-top:2px}.status-dot{width:8px;height:8px;border-radius:50%;background:var(--success);box-shadow:0 0 0 3px color-mix(in srgb,var(--success) 14%,transparent)}.status-dot.off{background:var(--danger);box-shadow:0 0 0 3px color-mix(in srgb,var(--danger) 14%,transparent)}
    .icon-btn{width:28px;height:28px;border:1px solid transparent;border-radius:7px;background:transparent;display:grid;place-items:center;color:var(--muted)}.icon-btn:hover{background:var(--surface-3);border-color:var(--border);color:var(--text)}.icon-btn.off{color:var(--danger);background:color-mix(in srgb,var(--danger) 10%,transparent)}
    .model-row{display:grid;grid-template-columns:22px 20px minmax(0,1fr) 30px 30px;align-items:center;gap:5px;padding:7px 8px 7px 14px;border-bottom:1px solid var(--border)}.model-row:last-child{border-bottom:0}.model-row.hidden-row{opacity:.48}.model-title{min-width:0}.model-title .name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px}.model-title .meta{font-size:9px;color:var(--muted);margin-top:2px}.download-img{width:15px;height:15px;object-fit:contain;opacity:.75}html[data-theme="dark"] .download-img{filter:invert(1)}
    .folder-actions{display:flex;gap:5px}.folder{border:1px solid var(--border);border-radius:11px;background:var(--surface-2);overflow:hidden;margin-bottom:8px}.folder.drag-over{outline:2px solid var(--accent)}.folder-head{display:grid;grid-template-columns:24px 1fr auto;align-items:center;gap:6px;padding:8px 9px;border-bottom:1px solid var(--border);cursor:grab}.folder-title{font-weight:760}.folder-body{padding:5px;min-height:42px}.view-item{display:grid;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:6px;padding:7px;border-radius:8px;cursor:grab}.view-item:hover{background:var(--surface-3)}.view-item .meta{font-size:9px;color:var(--muted)}.view-open{min-width:0;text-align:left}.view-actions{display:flex;align-items:center;gap:3px}.view-actions .icon-btn{width:28px;height:28px;padding:0}.drag-handle{color:var(--muted-2)}.loose-views{margin-top:12px}.drop-hint{border:1px dashed var(--border-strong);border-radius:9px;padding:10px;text-align:center;color:var(--muted);font-size:10px}
    .section-plane{border:1px solid var(--border);border-radius:11px;background:var(--surface-2);padding:9px;margin-bottom:8px}.section-plane-head{display:grid;grid-template-columns:22px 1fr auto;align-items:center;gap:7px}.section-plane-title{font-weight:760}.plane-actions{display:flex;gap:4px}.elevation-box{display:flex;align-items:center;gap:7px;margin-top:9px;padding:7px 8px;border-radius:8px;background:var(--surface-1);border:1px solid var(--border)}.elevation-symbol{width:20px;height:20px;display:grid;place-items:center;border-radius:6px;background:var(--accent-soft);color:var(--accent-2)}.elevation-box input{width:92px;border:0;outline:0;background:transparent;font-weight:720}.boundary-row{display:grid;grid-template-columns:28px 1fr auto;align-items:center;gap:7px;padding:9px;border:1px solid var(--border);border-radius:11px;background:var(--surface-2)}
    .level-row,.filter-row,.compare-row{display:flex;align-items:center;gap:8px;padding:8px 9px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);margin-bottom:6px}.level-row .main,.filter-row .main,.compare-row .main{flex:1;min-width:0}.level-row .title,.filter-row .title{font-weight:700}.level-row .meta,.filter-row .meta,.compare-row .meta{font-size:9px;color:var(--muted);margin-top:2px}.toggle{width:35px;height:20px;border-radius:999px;background:var(--surface-4);border:1px solid var(--border);padding:2px;transition:.15s}.toggle:before{content:"";display:block;width:14px;height:14px;border-radius:50%;background:var(--muted);transition:.15s}.toggle.on{background:var(--accent);border-color:var(--accent)}.toggle.on:before{transform:translateX(15px);background:white}
    .placeholder{padding:18px;border:1px dashed var(--border-strong);border-radius:11px;text-align:center;color:var(--muted);line-height:1.55}.placeholder strong{display:block;color:var(--text);margin-bottom:4px}
    .overlay{position:fixed;inset:0;background:rgba(7,13,24,.38);z-index:100;display:none;align-items:flex-start;justify-content:flex-end}.overlay.show{display:flex}.settings-drawer{height:100%;width:410px;background:var(--surface-1);border-left:1px solid var(--border);box-shadow:var(--shadow);display:flex;flex-direction:column}.drawer-header{height:58px;display:flex;align-items:center;padding:0 14px;border-bottom:1px solid var(--border);font-size:15px;font-weight:760}.drawer-header .spacer{flex:1}.drawer-body{padding:14px;overflow:auto}.settings-section{margin-bottom:18px}.settings-section h3{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:0 0 8px}.theme-choice{display:grid;grid-template-columns:1fr 1fr;gap:8px}.theme-card{height:76px;border:1px solid var(--border);border-radius:11px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;gap:8px}.theme-card.active{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft);color:var(--accent-2)}.setting-row{display:flex;align-items:center;gap:9px;padding:9px 0;border-bottom:1px solid var(--border)}.setting-row:last-child{border-bottom:0}.setting-row .main{flex:1}.setting-row .title{font-weight:690}.setting-row .meta{font-size:10px;color:var(--muted);margin-top:2px}.perf-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}.perf-stat{padding:10px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}.perf-stat .value{font-size:18px;font-weight:780;color:var(--accent-2)}.perf-stat .label{font-size:9px;color:var(--muted);margin-top:3px}.select{height:32px;border:1px solid var(--border);border-radius:8px;background:var(--surface-2);padding:0 8px}
    .toast{position:fixed;left:50%;bottom:92px;transform:translate(-50%,20px);opacity:0;padding:9px 12px;border-radius:9px;background:var(--surface-1);border:1px solid var(--border);box-shadow:var(--shadow);z-index:200;transition:.18s}.toast.show{opacity:1;transform:translate(-50%,0)}
    .modal-overlay{position:fixed;inset:0;background:rgba(8,14,24,.5);display:none;align-items:center;justify-content:center;z-index:110}.modal-overlay.show{display:flex}.modal{width:460px;max-width:calc(100vw - 30px);background:var(--surface-1);border:1px solid var(--border);border-radius:15px;box-shadow:var(--shadow);overflow:hidden}.modal-head{height:52px;display:flex;align-items:center;padding:0 14px;border-bottom:1px solid var(--border);font-weight:760}.modal-head .spacer{flex:1}.modal-body{padding:14px}.share-link{padding:10px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);font-family:ui-monospace,monospace;font-size:11px;word-break:break-all}.modal-foot{padding:12px 14px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:7px}
    .hidden{display:none!important}.clash-only{display:none}.clash-mode .clash-only{display:flex}.badge-number{min-width:18px;height:18px;padding:0 5px;border-radius:999px;display:grid;place-items:center;background:var(--danger);color:white;font-size:9px;font-weight:800}
    @media(max-width:1180px){:root{--left-panel-w:310px;--right-panel-w:350px}.brand{min-width:170px}.brand-title{display:none}.logo-shell{width:122px}.project-card{min-width:220px}.tool-btn{width:47px}}
    @media(max-width:900px){.workspace{grid-template-columns:var(--rail-w) 1fr}.left-panel,.inspector{position:absolute;top:0;bottom:0;box-shadow:var(--shadow)}.left-panel{left:var(--rail-w)}.inspector{right:0}.viewport{grid-column:2}.project-card{display:none}.top-actions .btn span.label{display:none}.bottom-toolbar{max-width:calc(100vw - 82px);overflow-x:auto;left:calc(50% + 30px)}}

    .display-style-btn{position:relative}.style-swatch{display:block;width:15px;height:15px;border-radius:5px;background:color-mix(in srgb,var(--swatch) calc(var(--swatch-alpha,1)*100%),transparent);border:1px solid color-mix(in srgb,var(--swatch) 72%,var(--border-strong));box-shadow:inset 0 0 0 1px color-mix(in srgb,white 26%,transparent)}.style-swatch.large{width:24px;height:24px;border-radius:7px;flex:0 0 auto}.display-style-btn:after{content:"";position:absolute;right:3px;bottom:3px;width:5px;height:5px;border-radius:50%;background:conic-gradient(#ef4444,#f59e0b,#22c55e,#3b82f6,#8b5cf6,#ef4444);border:1px solid var(--surface-1)}
    .model-style-popover{position:fixed;width:290px;display:none;background:var(--surface-1);border:1px solid var(--border);border-radius:13px;box-shadow:var(--shadow);z-index:180;overflow:hidden}.model-style-popover.show{display:block}.style-popover-heading{display:flex;flex-direction:column;min-width:0}.style-popover-heading strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:170px}.style-popover-heading span{font-size:9px;color:var(--muted);margin-top:2px}.style-popover-body{padding:12px}.style-field{display:grid;grid-template-columns:90px 1fr;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--border);font-size:11px}.style-field:last-of-type{border-bottom:0}.color-control,.opacity-control{display:flex;align-items:center;gap:8px}.color-control input{width:34px;height:28px;border:0;background:transparent;padding:0;cursor:pointer}.color-control code{font-size:10px;color:var(--muted)}.opacity-control input{min-width:0;flex:1;accent-color:var(--accent)}.opacity-control strong{width:38px;text-align:right;font-size:10px}.style-popover-note{margin-top:9px;padding:8px;border-radius:8px;background:var(--surface-3);color:var(--muted);font-size:9px;line-height:1.45}

/* ===== P6 production integration ===== */
body { overflow: hidden; }
.app-shell { width:100%; height:100%; display:grid; grid-template-rows:var(--topbar-h) 1fr; background:var(--bg); }
.workspace { min-height:0; }
.viewer { position:absolute; inset:0; width:100%; height:100%; display:block; background:var(--scene-viewport); z-index:1; }
.viewport:before,.viewport:after { pointer-events:none; z-index:0; }
.viewport-chips,.bottom-toolbar,.tool-status,.where-popover { z-index:12; }
.left-panel,.inspector,.rail,.topbar { user-select:none; }
.panel-body { scrollbar-width:thin; }
.full { width:100%; }
.spacer { flex:1; }
.toolbar-row,.filter-actions,.two-cols,.section-create-toolbar,.page-actions { display:flex; gap:7px; align-items:center; margin-bottom:9px; }
.two-cols > * { flex:1; min-width:0; }
.field-label { display:block; margin:10px 0 4px; font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.field { width:100%; height:34px; border:1px solid var(--border); border-radius:9px; padding:0 9px; background:var(--surface-2); outline:none; }
.field:focus,.select:focus { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft); }
.select.full { width:100%; margin-bottom:9px; }
.model-color-toolbar { display:grid; grid-template-columns:1fr 1fr 36px; gap:6px; margin-bottom:10px; }
.model-tree { display:flex; flex-direction:column; gap:8px; }
.legacy-jobs { margin-top:12px; border-top:1px solid var(--border); padding-top:8px; }
.legacy-jobs > summary { cursor:pointer; color:var(--muted); font-size:11px; }
.model-section { border:1px solid var(--border); border-radius:11px; background:var(--surface-2); overflow:hidden; }
.model-section-head { display:grid; grid-template-columns:26px 22px minmax(0,1fr) 30px 30px; align-items:center; gap:5px; padding:8px; border-bottom:1px solid var(--border); }
.model-section.collapsed .model-section-body { display:none; }
.model-section.collapsed .model-section-head { border-bottom:0; }
.model-row { display:grid; grid-template-columns:22px 20px minmax(0,1fr) 30px 30px; align-items:center; gap:5px; padding:7px 8px 7px 14px; border-bottom:1px solid var(--border); background:transparent; }
.model-row:last-child { border-bottom:0; }
.model-row.hidden-row { opacity:.48; }
.section-name,.model-title .name { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }
.section-name { font-weight:760; }
.model-title .name { font-size:11px; }
.model-title .meta,.count { font-size:9px; color:var(--muted); margin-top:2px; }
.status-dot { width:8px; height:8px; border-radius:50%; background:var(--success); box-shadow:0 0 0 3px color-mix(in srgb,var(--success) 14%,transparent); }
.status-dot.off { background:var(--danger); box-shadow:0 0 0 3px color-mix(in srgb,var(--danger) 14%,transparent); }
.display-style-btn { position:relative; }
.style-swatch { display:block; width:15px; height:15px; border-radius:5px; background:color-mix(in srgb,var(--swatch,#6b7d96) calc(var(--swatch-alpha,1)*100%),transparent); border:1px solid color-mix(in srgb,var(--swatch,#6b7d96) 72%,var(--border-strong)); }
.display-style-btn:after { content:""; position:absolute; right:3px; bottom:3px; width:5px; height:5px; border-radius:50%; background:conic-gradient(#ef4444,#f59e0b,#22c55e,#3b82f6,#8b5cf6,#ef4444); border:1px solid var(--surface-1); }
.section-create-toolbar > span { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.section-list { display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.section-row { border:1px solid var(--border); border-radius:11px; padding:9px; background:var(--surface-2); }
.boundary-row { margin-top:10px; }
.inspector-head { height:45px; display:flex; align-items:center; padding:0 12px; border-bottom:1px solid var(--border); }
.inspector-page { display:none; min-height:100%; }
.inspector-page.active { display:block; }
.inspector-body { min-height:0; overflow:auto; flex:1; padding:10px; }
.inspector-tab.clash-only { display:none; }
body.clash-mode .inspector-tab.clash-only { display:flex; }
.badge-number.neutral { background:var(--surface-4); color:var(--text); }
.props-panel-shell { display:flex; flex-direction:column; min-height:0; background:transparent; }
.props-panel-shell[style*="display: none"] { display:flex !important; }
.props-sub { padding:9px 10px; border:1px solid var(--border); border-radius:10px 10px 0 0; background:var(--surface-2); }
.props-body { border:1px solid var(--border); border-top:0; border-radius:0 0 10px 10px; overflow:auto; background:var(--surface-1); }
.props-group { border-bottom:1px solid var(--border); }
.props-group > summary { color:var(--text); }
.props-row .pr-val { color:var(--text); }
.selection-actions { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; margin-bottom:8px; }
.selection-actions .btn { min-width:0; padding:0 7px; font-size:11px; }
.section-label { display:flex; align-items:center; margin:12px 0 7px; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.selection-list { display:flex; flex-direction:column; gap:6px; }
.selection-item { display:flex; align-items:center; gap:8px; padding:8px; border:1px solid var(--border); border-radius:9px; background:var(--surface-2); }
.selection-color { width:10px; height:10px; border-radius:3px; background:var(--accent); }
.clash-panel { display:flex; flex-direction:column; min-height:0; font-size:12px; }
.clash-panel .cl-head { display:flex; align-items:center; gap:8px; padding:7px 2px 10px; border-bottom:1px solid var(--border); }
.clash-panel .cl-title { flex:1; font-weight:760; }
.clash-panel .cl-reset { height:28px; border:1px solid var(--border); border-radius:7px; background:var(--surface-2); color:var(--muted); }
.clash-panel .cl-list { overflow:auto; padding-top:7px; display:flex; flex-direction:column; gap:7px; }
.clash-panel .cl-item { border:1px solid var(--border); border-radius:10px; background:var(--surface-2); overflow:hidden; }
.clash-panel .cl-row { display:grid; grid-template-columns:14px minmax(0,1fr) auto; align-items:center; gap:8px; padding:9px; cursor:pointer; }
.clash-panel .cl-item.active .cl-row { background:var(--accent-soft); }
.clash-panel .cl-sw { width:12px; height:12px; border-radius:3px; }
.clash-panel .cl-name { font-weight:720; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.clash-panel .cl-cnt { color:var(--muted); }
.clash-panel .cl-els { display:none; padding:0 9px 9px; }
.clash-panel .cl-item.open .cl-els { display:block; }
.clash-detail-grid { display:grid; grid-template-columns:88px minmax(0,1fr); gap:5px 8px; font-size:10px; }
.clash-detail-grid .label { color:var(--muted); }
.clash-copy-id { border:0; background:transparent; padding:0; color:var(--accent-2); text-align:left; cursor:pointer; }
.settings-overlay { position:fixed; inset:0; background:rgba(7,13,24,.38); z-index:100; display:none; justify-content:flex-end; }
.settings-overlay.show { display:flex; }
.setting-action { width:100%; min-height:44px; display:flex; align-items:center; justify-content:space-between; border:0; border-bottom:1px solid var(--border); background:transparent; }
.setting-action:hover { color:var(--accent-2); }
.model-style-popover { position:fixed; width:290px; display:none; background:var(--surface-1); border:1px solid var(--border); border-radius:13px; box-shadow:var(--shadow); z-index:180; overflow:hidden; }
.model-style-popover.show { display:block; }
.perf-hud { display:none; position:fixed; right:12px; bottom:82px; z-index:58; max-width:min(92vw,620px); margin:0; padding:10px 12px; border-radius:10px; background:rgba(15,23,42,.9); color:#dbeafe; box-shadow:0 8px 28px rgba(15,23,42,.35); font:600 11px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace; white-space:pre-wrap; pointer-events:none; }
.tool-pointer-ring { position:fixed; left:0; top:0; width:18px; height:18px; border:2px solid var(--accent); border-radius:50%; pointer-events:none; z-index:2147483000; display:block; opacity:0; visibility:hidden; box-shadow:0 0 0 2px rgba(255,255,255,.72),0 2px 9px rgba(0,0,0,.28); transform:translate3d(-100px,-100px,0) translate(-50%,-50%); will-change:transform; contain:layout style paint; transition:opacity .06s linear; }
.tool-pointer-ring.active { opacity:1; visibility:visible; }
.tool-pointer-ring.measure { border-color:#f97316; background:rgba(249,115,22,.16); }
.tool-pointer-ring.elevation { border-color:#16a34a; background:rgba(22,163,74,.16); }
.tool-pointer-ring.annotation { border-color:#dc2626; background:rgba(220,38,38,.16); }
.tool-pointer-ring.stale { opacity:.55; }
.delete-badge-layer { z-index:50; }
#viewBoxBtn { display:grid; }
#viewBoxEyeBtn { display:grid !important; }
#levelLegend:empty,#diffPanel:empty,#paramLegend:empty { display:none; }
@media(max-width:900px){
  .brand-title{display:none}.logo-shell{width:116px}.topbar{padding:0 7px}.top-actions .label{display:none}
  .left-panel{left:var(--rail-w)}.inspector{right:0}.bottom-toolbar{left:calc(50% + 26px)}
}
.tool-btn.active-tool,.tool-btn.on { background:var(--accent-soft); color:var(--accent-2); }
.btn.active-tool { border-color:var(--accent); color:var(--accent-2); background:var(--accent-soft); }
.section-plane .sec-axis { margin-top:4px; height:28px; width:145px; padding:0 7px; }
.elevation-box strong { margin-left:auto; color:var(--accent-2); }
canvas.viewer { width:100%; height:100%; max-width:none; max-height:none; touch-action:none; }
.props-sub,.props-body,.props-group>summary,.props-row .pr-name,.props-row .pr-val,.props-empty { color:var(--text); }
.props-row .pr-name,.props-empty,.props-sub .props-cat { color:var(--muted); }


/* ===== P7 UX cleanup ===== */
:root { --topbar-h:0px; }
.app-shell { grid-template-rows:1fr; }
.workspace { height:100%; grid-template-columns:var(--rail-w) auto minmax(0,1fr) auto; }
.rail { grid-column:1; grid-row:1; }
.left-panel { grid-column:2; grid-row:1; }
.viewport { grid-column:3; grid-row:1; }
.inspector { grid-column:4; grid-row:1; }
.app-shell button,.settings-overlay button,.model-style-popover button { margin:0; }
button > [data-icon],.btn > [data-icon],.tool-btn > [data-icon],.rail-btn > [data-icon],.inspector-tab > [data-icon] { display:inline-grid; place-items:center; flex:0 0 auto; line-height:0; }
button > [data-icon] svg,.btn > [data-icon] svg,.tool-btn > [data-icon] svg,.rail-btn > [data-icon] svg,.inspector-tab > [data-icon] svg { margin:0; }
.btn,.icon-btn,.tool-btn,.rail-btn,.inspector-tab,.theme-card,.setting-action { align-items:center; justify-content:center; }
.rail-bottom { gap:5px; }
#settingsBtn { margin-top:2px; }

.model-project-summary { min-height:52px; display:flex; align-items:center; gap:10px; margin-bottom:10px; padding:9px 10px; border:1px solid var(--border); border-radius:11px; background:var(--surface-2); }
.model-project-icon { width:28px; height:28px; display:grid; place-items:center; color:var(--accent-2); border-radius:8px; background:var(--accent-soft); flex:0 0 auto; }
.model-project-main { min-width:0; }
.model-project-summary .project-name { font-size:12px; }
.model-project-summary .project-meta { font-size:9px; }

.model-section-head { grid-template-columns:26px 28px 18px minmax(0,1fr) 30px; padding:8px 7px 8px 5px; }
.model-row { grid-template-columns:28px 18px minmax(0,1fr) 30px 30px; padding:7px 7px 7px 5px; }
.model-section-head > .icon-btn,.model-row > .icon-btn { justify-self:center; align-self:center; }
.section-toggle,.section-visibility { place-items:center; }
.section-toggle { font-size:17px; line-height:1; }

.view-open { width:100%; min-width:0; margin:0; padding:4px 6px; border:0; border-radius:7px; background:transparent; color:var(--text); display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:2px; text-align:left; font-size:11px; }
.view-open:hover { background:var(--surface-3); color:var(--text); }
.view-open strong { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.view-item .drag-handle { display:grid; place-items:center; align-self:stretch; }
html[data-theme="light"] .view-item,.view-item { color:var(--text); }
.view-item .meta:empty { display:none; }
.folder-actions .icon-btn,.section-plane .icon-btn,.boundary-row .icon-btn { display:grid; place-items:center; padding:0; }
.section-plane-head { grid-template-columns:28px minmax(0,1fr) auto; }
.section-plane .sec-eye { justify-self:start; }
.plane-actions { align-items:center; }

.datum-eye { width:30px; height:30px; flex:0 0 auto; }
.datum-eye.off { color:var(--muted-2); background:transparent; }
.datum-eye:not(.off) { color:var(--accent-2); background:var(--accent-soft); }

.left-page[data-page="filters"].active { display:flex; flex-direction:column; gap:8px; }
.left-page[data-page="filters"] > * { margin:0; }
.left-page[data-page="filters"] .field-label { margin-top:5px; }
.left-page[data-page="filters"] .filter-actions,.left-page[data-page="filters"] .two-cols { min-height:34px; }
.left-page[data-page="filters"] .param-info:empty,.left-page[data-page="filters"] .param-legend:empty { display:none; }

.props-sub:empty { display:none; }
.props-sub:empty + .props-body { border-top:1px solid var(--border); border-radius:10px; }
.selection-actions { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
.selection-actions .btn { width:100%; min-width:0; min-height:36px; height:auto; padding:6px 7px; white-space:normal; line-height:1.15; }
.selection-actions .btn > [data-icon] { min-width:17px; }

.bottom-toolbar { height:auto; min-height:var(--tool-h); max-width:calc(100% - 28px); overflow-x:auto; overflow-y:hidden; scrollbar-width:none; }
.bottom-toolbar::-webkit-scrollbar { display:none; }
.tool-btn { width:58px; min-width:58px; height:50px; padding:3px 4px; border:1px solid transparent; margin:0; color:var(--muted); line-height:1.05; text-align:center; }
.tool-btn.wide { width:82px; min-width:82px; }
.bottom-toolbar .tool-btn.active,.bottom-toolbar .tool-btn.active-tool,.bottom-toolbar .tool-btn.on { background:var(--accent-soft)!important; color:var(--accent-2)!important; border-color:color-mix(in srgb,var(--accent) 42%,var(--border))!important; }
.tool-btn:hover { border-color:var(--border); }

.theme-choice { grid-template-columns:1fr 1fr; gap:8px; }
.theme-card { height:48px; padding:0 12px; }
.setting-action { min-height:42px; padding:0 12px; text-align:left; }
.setting-action > span { flex:1; text-align:left; }
.setting-action > strong { flex:0 0 auto; min-width:74px; text-align:right; }

.fp-hint { bottom:calc(14px + var(--tool-h) + 10px); max-width:min(760px,calc(100vw - 24px)); padding:6px 10px; border-radius:8px; font-size:10.5px; line-height:1.35; }
.fp-hint-row + .fp-hint-row { margin-top:3px; }
.fp-hint .hk { padding:0 4px; font-size:10px; }

@media(max-width:900px) {
  .workspace { grid-template-columns:var(--rail-w) minmax(0,1fr); }
  .viewport { grid-column:2; }
  .left-panel,.inspector { grid-column:auto; }
  .bottom-toolbar { left:calc(50% + 30px); max-width:calc(100vw - 82px); }
}

[hidden] { display:none !important; }
/* ===== P12.1 CSP/list hotfix ===== */
/* The model tree must grow naturally inside the panel scroll container.
   Explicitly disable flex shrinking so expanded sections cannot collapse over
   following sections when the panel is short or the browser zoom is changed. */
.model-tree {
  display:block;
  min-height:0;
}
.model-tree > .model-section {
  display:block;
  position:relative;
  width:100%;
  min-height:min-content;
  height:auto;
  flex:0 0 auto;
  margin:0 0 8px;
  overflow:hidden;
  contain:layout paint;
}
.model-tree > .model-section:last-child { margin-bottom:0; }
.model-section-head {
  position:relative;
  min-height:48px;
}
.model-section-body {
  display:block;
  position:relative;
  width:100%;
  height:auto;
  min-height:0;
  overflow:visible;
}
.model-section.collapsed .model-section-body { display:none; }
.model-section-body > .model-row {
  position:relative;
  width:100%;
  min-height:48px;
  height:auto;
  flex:0 0 auto;
}


/* ===== P13/P14: full-height model tree ===== */
.left-panel > .panel-body {
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.left-panel .left-page {
  min-height:0;
}
.left-panel .left-page.active {
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
}
.left-panel .left-page[data-page="models"].active {
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.left-page[data-page="models"] .model-project-summary,
.left-page[data-page="models"] .model-color-toolbar,
.left-page[data-page="models"] .legacy-jobs {
  flex:0 0 auto;
}
#loadedModels.model-tree {
  flex:1 1 auto;
  min-height:0;
  max-height:none !important;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding-right:4px;
}

/* ===== TZ 2.1 / Viewer UIUX Patch 01 ===== */
:root {
  --rail-w:96px;
  --left-panel-w:370px;
  --right-panel-w:470px;
  --tool-h:70px;
}
body { font-size:14px; }
.workspace { grid-template-columns:var(--rail-w) auto minmax(0,1fr) auto; }
.rail { width:var(--rail-w); padding:8px 5px; overflow:hidden; }
.rail-group { gap:5px; }
.rail-btn {
  width:84px; height:56px; padding:5px 4px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:4px; border-radius:11px;
  font-size:10.5px; font-weight:680; line-height:1.05; text-align:center;
}
.rail-btn > [data-icon] { width:22px; height:22px; }
.rail-btn > [data-icon] svg { width:19px; height:19px; }
.rail-label { display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rail-btn.active:before { left:-5px; height:30px; }
.rail-btn.panel-open:after { display:none; }

.left-panel { min-width:280px; }
.panel-header { min-height:62px; height:62px; padding:0 12px 0 14px; }
.panel-title { font-size:15px; }
.panel-subtitle { font-size:11.5px; line-height:1.25; }
.desktop-panel-close { display:grid; flex:0 0 auto; width:32px; height:32px; }
.panel-body { padding:12px; }
.left-page.active { padding-top:2px; }
.left-page[data-page="models"] .model-project-summary { margin-top:0; }

.panel-reopen {
  position:absolute; top:50%; z-index:34; display:none; width:42px; min-width:42px; height:86px;
  padding:6px 3px; border:1px solid var(--border); background:color-mix(in srgb,var(--surface-1) 96%,transparent);
  color:var(--muted); box-shadow:var(--shadow); align-items:center; justify-content:center;
  flex-direction:column; gap:5px; font-size:9px; font-weight:700; line-height:1;
  transform:translateY(-50%); backdrop-filter:blur(12px);
}
.panel-reopen.show { display:flex; }
.panel-reopen:hover { color:var(--accent-2); background:var(--accent-soft); }
.panel-reopen-left { left:var(--rail-w); border-left:0; border-radius:0 12px 12px 0; }
.panel-reopen-right { right:0; border-right:0; border-radius:12px 0 0 12px; }
.panel-reopen > [data-icon] { display:grid; place-items:center; }
.panel-reopen > span:last-child { writing-mode:vertical-rl; transform:rotate(180deg); letter-spacing:.04em; }

/* The model toolbar is work-conserving too: controls wrap instead of escaping the panel. */
.model-color-toolbar { display:flex; flex-wrap:wrap; gap:6px; align-items:stretch; }
.model-color-toolbar .btn:not(.icon-only) { flex:1 1 145px; min-width:0; height:auto; min-height:36px; padding:6px 8px; white-space:normal; line-height:1.15; }
.model-color-toolbar .btn.icon-only { flex:0 0 36px; }
.left-panel .btn,.inspector .btn { min-width:0; max-width:100%; overflow-wrap:anywhere; }
.model-title .name { font-size:12.5px; }
.model-title .meta { font-size:11px; line-height:1.25; }
.model-project-summary .project-name { font-size:13px; }
.model-project-summary .project-meta { font-size:11px; }
.count,.section-name .count { font-size:10.5px; }

.section-block + .section-block { margin-top:16px; padding-top:14px; border-top:1px solid var(--border); }
.section-block-title { margin:0 0 9px; color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.datums-block .select { margin-bottom:8px; }
.datums-block #byLevelsBtn { margin-top:8px; }

/* Inspector uses the same side-tab language as the left navigation. */
.inspector { flex-direction:row; min-width:370px; }
.inspector-content { min-width:0; min-height:0; flex:1 1 auto; display:flex; flex-direction:column; }
.inspector-tabs {
  flex:0 0 104px; width:104px; min-width:104px; display:flex; flex-direction:column; gap:5px;
  padding:9px 6px; border:0; border-right:1px solid var(--border); background:var(--surface-1);
}
.inspector-tab {
  position:relative; width:100%; min-width:0; height:58px; padding:6px 4px; border:0; border-radius:11px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  color:var(--muted); background:transparent; font-size:10.5px; line-height:1.05; text-align:center;
}
.inspector-tab:hover { background:var(--surface-3); }
.inspector-tab.active { color:var(--accent-2); border:0; background:var(--accent-soft); font-weight:750; }
.inspector-tab.active:before { content:""; position:absolute; left:-6px; width:3px; height:30px; border-radius:0 4px 4px 0; background:var(--accent); }
.inspector-tab > [data-icon] svg { width:19px; height:19px; }
.inspector-tab .badge-number { position:absolute; top:4px; right:5px; }
.inspector-head { flex:0 0 54px; height:54px; font-size:15px; }
.inspector-body { font-size:13px; }
.inspector-tab.clash-only { display:none; }
body.clash-mode .inspector-tab.clash-only { display:flex; }

/* Minimum readable typography. */
.field,.select,.btn,.icon-btn,.tool-btn,.setting-action { font-size:12.5px; }
.props-row,.props-empty,.props-sub,.selection-item,.clash-panel { font-size:12px; }
.section-label,.field-label,.section-create-toolbar > span { font-size:11px; }
.bottom-toolbar { min-height:var(--tool-h); padding:7px; }
.tool-btn { width:66px; min-width:66px; height:56px; padding:4px 5px; font-size:12px; line-height:1.1; }
.tool-btn.wide { width:98px; min-width:98px; }
.tool-status { min-height:38px; height:auto; padding:7px 12px; font-size:13px; line-height:1.25; }

/* Keep every glyph optically centered in its box. */
button > [data-icon],.btn > [data-icon],.tool-btn > [data-icon],.rail-btn > [data-icon],.inspector-tab > [data-icon] {
  position:relative; top:0; align-self:center; justify-self:center; transform:none; line-height:0;
}
button > [data-icon] svg,.btn > [data-icon] svg,.tool-btn > [data-icon] svg,.rail-btn > [data-icon] svg,.inspector-tab > [data-icon] svg {
  display:block; margin:auto; transform:none;
}

.view-cube-canvas {
  position:absolute; right:16px; top:16px; z-index:10; width:144px; height:144px;
  border-radius:14px; background:transparent; cursor:pointer; touch-action:none;
  filter:drop-shadow(0 8px 18px rgba(15,23,42,.18));
}

@media (max-width:1100px) and (min-width:821px) {
  :root { --rail-w:84px; --left-panel-w:330px; --right-panel-w:420px; }
  .rail-btn { width:72px; font-size:9.5px; }
  .inspector-tabs { flex-basis:92px; width:92px; min-width:92px; }
}

@media (max-width:820px) {
  .desktop-panel-close,.panel-reopen,.view-cube-canvas { display:none !important; }
}

/* Narrow-panel resilience for every action row. */
.section-create-toolbar,.page-actions,.filter-actions,.two-cols,.toolbar-row { flex-wrap:wrap; min-width:0; }
.section-create-toolbar .btn,.page-actions .btn,.filter-actions .btn,.toolbar-row .btn { min-width:0; max-width:100%; }
.section-create-toolbar #alignSectionBtn { flex:1 1 110px; }
.two-cols > * { flex:1 1 130px; }
.boundary-row,.level-row,.model-row,.model-section-head { min-width:0; }
.boundary-row > div,.level-row .main,.model-title,.section-name { min-width:0; }
.model-color-toolbar .reset-style-btn { flex:1 1 170px; }


/* ===== TZ 2.1 / Viewer P16.1 Patch 02 ===== */
:root { --rail-w:68px; }
.rail { width:var(--rail-w); padding-left:4px; padding-right:4px; }
.rail-btn {
  width:58px; padding-left:3px; padding-right:3px; font-size:9.25px;
}
.rail-label {
  display:-webkit-box; max-width:100%; white-space:normal; line-height:1.05;
  -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; text-overflow:ellipsis;
}
/* Right inspector tabs mirror the left rail and live on the outer right edge. */
.inspector-content { order:1; }
.inspector-tabs {
  order:2; flex-basis:74px; width:74px; min-width:74px;
  border-right:0; border-left:1px solid var(--border);
}
.inspector-tab { font-size:9.25px; padding-left:3px; padding-right:3px; }
.inspector-tab > span:not([data-icon]):not(.badge-number) {
  display:-webkit-box; max-width:100%; line-height:1.05;
  -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; text-overflow:ellipsis;
}
.inspector-tab.active:before {
  left:auto; right:-6px; border-radius:4px 0 0 4px;
}

.diff-version-grid {
  display:grid; grid-template-columns:auto minmax(0,1fr); gap:6px 7px; align-items:center; margin:6px 0 8px;
}
.diff-version-grid label { color:var(--muted); font-size:11px; }
.diff-version-grid select { min-width:0; width:100%; height:34px; border:1px solid var(--border); border-radius:7px; background:var(--surface-1); color:var(--text); font-size:12px; }
.diff-status-filter { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; margin:0 0 7px; }
.diff-status-filter button { min-width:0; min-height:34px; padding:4px 5px; border:1px solid var(--border); border-radius:7px; background:var(--surface-1); color:var(--muted); font-size:10.5px; line-height:1.1; }
.diff-status-filter button:hover { background:var(--surface-3); color:var(--text); }
.diff-status-filter button.active { border-color:color-mix(in srgb,var(--accent) 48%,var(--border)); background:var(--accent-soft); color:var(--accent-2); font-weight:750; }
.diff-note { margin:3px 0 6px; color:var(--muted); font-size:10px; line-height:1.3; }
.diff-summary { display:flex; flex-wrap:wrap; gap:5px 9px; margin:6px 0; font-size:11.5px; }
.diff-summary .created,.diff-cat-count.created { color:#238653; }
.diff-summary .modified,.diff-cat-count.modified { color:#9a6a00; }
.diff-summary .removed,.diff-cat-count.removed { color:#c53030; }
.diff-category-list { max-height:250px; overflow:auto; margin-top:3px; padding-right:2px; }
.diff-cat-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto auto; align-items:center; gap:3px; margin-bottom:3px; padding:2px; border-radius:7px; }
.diff-cat-row.active { background:var(--accent-soft); }
.diff-cat-row button { margin:0; border:0; background:transparent; }
.diff-cat-name { min-width:0; padding:5px; overflow:hidden; color:var(--text); text-align:left; text-overflow:ellipsis; white-space:nowrap; }
.diff-cat-name:hover:not(:disabled) { color:var(--accent-2); }
.diff-cat-count { min-width:34px; padding:5px 4px; border-radius:6px!important; text-align:center; font-size:10.5px; font-weight:700; }
button.diff-cat-count:hover:not(:disabled) { background:var(--surface-3); }
.diff-cat-row button:disabled { opacity:.38; cursor:default; }
.diff-reset-scope { width:100%; min-height:34px; margin-top:5px; border:1px solid var(--border); border-radius:7px; background:var(--surface-1); color:var(--text); font-size:11px; }
.diff-reset-scope:hover { background:var(--surface-3); }

@media (max-width:1100px) and (min-width:821px) {
  :root { --rail-w:60px; }
  .rail-btn { width:50px; font-size:8.5px; }
  .inspector-tabs { flex-basis:64px; width:64px; min-width:64px; }
  .inspector-tab { font-size:8.5px; }
}

/* ===== TZ 2.1 / Viewer P16.2 Patch 03 ===== */
.diff-progress-card {
  margin:8px 0; padding:9px 10px; border:1px solid var(--border); border-radius:9px;
  background:var(--surface-2); box-shadow:0 3px 10px rgba(15,23,42,.05);
}
.diff-progress-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; }
.diff-progress-title { min-width:0; color:var(--text); font-size:11.5px; font-weight:750; }
.diff-progress-count { flex:0 0 auto; color:var(--muted); font-size:10.5px; font-variant-numeric:tabular-nums; }
.diff-progress-track { height:6px; overflow:hidden; border-radius:999px; background:var(--surface-4); }
.diff-progress-bar { height:100%; min-width:3%; border-radius:inherit; background:var(--accent); transition:width .18s ease; }
.diff-progress-detail { margin-top:5px; color:var(--muted); font-size:10px; line-height:1.3; }
.diff-progress-spinner {
  display:inline-block; width:12px; height:12px; margin-right:6px; vertical-align:-2px;
  border:2px solid color-mix(in srgb,var(--accent) 24%,transparent); border-top-color:var(--accent); border-radius:50%;
  animation:viewer-spin .75s linear infinite;
}
@keyframes viewer-spin { to { transform:rotate(360deg); } }
.diff-warning { margin:6px 0; padding:7px 8px; border:1px solid #e7b96a; border-radius:7px; background:#fff7e8; color:#7a4a00; font-size:10px; line-height:1.3; }
html[data-theme="dark"] .diff-warning { background:#322510; color:#ffd48a; }
.diff-empty-categories { margin:8px 0; color:var(--muted); font-size:10.5px; line-height:1.35; }

.compact-filter-block,.compound-filter-block { margin-bottom:10px; }
.compound-filter-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.compound-filter-title-row .section-block-title { margin-bottom:2px; }
.compound-filter-hint { color:var(--muted); font-size:10px; line-height:1.3; }
.icon-btn.compact { flex:0 0 30px; width:30px; height:30px; min-width:30px; padding:0; font-size:18px; line-height:1; }
.compound-filter-groups { display:flex; flex-direction:column; gap:7px; margin-top:8px; }
.compound-or-separator {
  display:flex; align-items:center; gap:7px; color:var(--accent-2); font-size:9.5px; font-weight:800; letter-spacing:.08em;
}
.compound-or-separator:before,.compound-or-separator:after { content:""; flex:1; height:1px; background:var(--border); }
.compound-filter-group { padding:7px; border:1px solid var(--border); border-radius:9px; background:var(--surface-1); }
.compound-group-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; }
.compound-group-name { color:var(--text); font-size:10.5px; font-weight:750; }
.compound-group-remove,.compound-condition-remove {
  width:25px; height:25px; min-width:25px; padding:0; border:0; border-radius:6px; background:transparent; color:var(--muted); font-size:16px;
}
.compound-group-remove:hover,.compound-condition-remove:hover { background:var(--surface-3); color:var(--danger,#c53030); }
.compound-condition-list { display:flex; flex-direction:column; gap:6px; }
.compound-condition {
  display:grid; grid-template-columns:54px minmax(0,1fr) 25px; grid-template-areas:
    "negate param remove"
    "mode value remove";
  gap:5px; padding:6px; border:1px solid color-mix(in srgb,var(--border) 82%,transparent); border-radius:7px; background:var(--surface-2);
}
.compound-negate { grid-area:negate; }
.compound-param { grid-area:param; }
.compound-mode { grid-area:mode; }
.compound-value { grid-area:value; }
.compound-condition-remove { grid-area:remove; align-self:center; }
.compound-condition .field,.compound-condition .select { width:100%; min-width:0; height:31px; font-size:10.5px; }
.compound-add-condition { width:100%; min-height:30px; margin-top:6px; border:1px dashed var(--border); border-radius:7px; background:transparent; color:var(--accent-2); font-size:10.5px; }
.compound-add-condition:hover { background:var(--accent-soft); }
.compound-filter-result-row { display:grid; grid-template-columns:1fr auto; gap:6px 8px; align-items:end; margin-top:8px; }
.compound-filter-result-row > .field-label { grid-column:1 / -1; margin-bottom:-2px; }
.compound-color-wrap { display:flex; align-items:center; gap:5px; color:var(--muted); font-size:10px; }
.compound-color-wrap input[type="color"] { width:36px; height:34px; padding:2px; border:1px solid var(--border); border-radius:7px; background:var(--surface-1); }
.compound-filter-actions .btn { flex:1 1 110px; }
.param-info.compound-busy:before {
  content:""; display:inline-block; width:11px; height:11px; margin-right:6px; vertical-align:-1px;
  border:2px solid color-mix(in srgb,var(--accent) 24%,transparent); border-top-color:var(--accent); border-radius:50%; animation:viewer-spin .75s linear infinite;
}

/* ===== TZ 2.1 / Viewer P16.3 Patch 04 ===== */
/* Compact, low-emphasis reopen handles: arrow only, no vertical labels. */
.panel-reopen {
  width:30px; height:52px; min-width:30px; padding:0; gap:0;
  justify-content:center; opacity:.4; border-color:color-mix(in srgb,var(--border) 70%,transparent);
  background:color-mix(in srgb,var(--surface-1) 82%,transparent); backdrop-filter:blur(4px);
  transition:opacity .15s ease,background .15s ease,color .15s ease;
}
.panel-reopen:hover,.panel-reopen:focus-visible { opacity:.9; background:var(--surface-1); }
.panel-reopen-left { left:var(--rail-w); border-radius:0 9px 9px 0; }
.panel-reopen-right { right:0; border-radius:9px 0 0 9px; }
.panel-reopen > [data-icon] { width:18px; height:18px; display:grid; place-items:center; }
.panel-reopen > span:last-child { writing-mode:initial; transform:none; letter-spacing:normal; }

/* Filter typography and spacing follow the 12 px service-wide minimum. */
.left-page[data-page="filters"],
.left-page[data-page="filters"] .field,
.left-page[data-page="filters"] .select,
.left-page[data-page="filters"] .btn,
.left-page[data-page="filters"] button,
.left-page[data-page="filters"] .field-label,
.left-page[data-page="filters"] .compound-filter-hint,
.left-page[data-page="filters"] .param-info,
.left-page[data-page="filters"] .section-block-title,
.left-page[data-page="filters"] .compound-group-name,
.left-page[data-page="filters"] .compound-rule-name,
.left-page[data-page="filters"] .compound-or-separator,
.left-page[data-page="filters"] .compound-color-wrap,
.left-page[data-page="filters"] .legend-row,
.left-page[data-page="filters"] .legend-cnt { font-size:12px; }
.left-page[data-page="filters"] .field,
.left-page[data-page="filters"] .select { min-height:34px; }
.left-page[data-page="filters"] .filter-actions { gap:8px; margin-top:9px; }
.compound-filter-rules { display:flex; flex-direction:column; gap:12px; margin-top:10px; }
.compound-rule {
  padding:9px; border:1px solid var(--border); border-radius:10px; background:var(--surface-1);
  box-shadow:0 2px 8px rgba(15,23,42,.035);
}
.compound-rule-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.compound-rule-name { color:var(--text); font-weight:800; }
.compound-rule-head-actions { display:flex; align-items:center; gap:6px; }
.compound-rule-add-group {
  min-height:28px; padding:4px 8px; border:1px solid var(--border); border-radius:7px;
  background:var(--surface-2); color:var(--accent-2); font-weight:700;
}
.compound-rule-remove {
  width:28px; height:28px; min-width:28px; padding:0; border:0; border-radius:7px;
  background:transparent; color:var(--muted); font-size:18px;
}
.compound-rule-remove:hover { background:var(--surface-3); color:var(--danger,#c53030); }
.compound-filter-groups { display:flex; flex-direction:column; gap:8px; }
.compound-filter-group { padding:8px; }
.compound-group-head { margin-bottom:7px; }
.compound-condition-list { gap:8px; }
.compound-condition {
  grid-template-columns:96px minmax(0,1fr) 28px;
  grid-template-areas:"negate param remove" "mode value remove";
  gap:7px; padding:7px;
}
.compound-condition .field,.compound-condition .select { height:34px; min-height:34px; font-size:12px; }
.compound-mode { min-width:96px; padding-left:8px; padding-right:24px; }
.compound-negate { min-width:96px; }
.compound-condition-remove { width:28px; height:28px; min-width:28px; }
.compound-add-condition { min-height:34px; margin-top:8px; font-size:12px; }
.compound-rule-action-row {
  display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px 9px; align-items:end;
  margin-top:9px; padding-top:9px; border-top:1px solid var(--border);
}
.compound-rule-action-row > .field-label { grid-column:1 / -1; margin:0; }
.compound-rule-action { width:100%; }
.compound-rule-color { min-height:34px; }
.compound-rule-color input[type="color"] { width:38px; height:34px; }
.compound-filter-actions { margin-top:12px; }
.compound-filter-actions .btn { flex:1 1 130px; min-height:36px; }
.compound-filter-title-row { gap:10px; }
.compound-filter-hint { line-height:1.4; }
.quantity-analytics-results { display:flex; flex-direction:column; gap:12px; margin-top:10px; min-width:0; }
.quantity-kpis { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.quantity-kpi { min-width:0; padding:8px 9px; border:1px solid var(--border); border-radius:9px; background:var(--surface-1); }
.quantity-kpi .label { color:var(--muted); font-size:11px; }
.quantity-kpi .value { margin-top:2px; color:var(--text); font-size:14px; font-weight:800; overflow:hidden; text-overflow:ellipsis; }
.quantity-table-wrap { min-width:0; overflow:auto; border:1px solid var(--border); border-radius:9px; background:var(--surface-1); }
.quantity-table-title { padding:7px 8px; border-bottom:1px solid var(--border); color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.quantity-table { width:100%; border-collapse:collapse; font-size:11px; font-variant-numeric:tabular-nums; }
.quantity-table th,.quantity-table td { padding:6px 7px; border-bottom:1px solid color-mix(in srgb,var(--border) 70%,transparent); text-align:right; white-space:nowrap; }
.quantity-table th:first-child,.quantity-table td:first-child { max-width:180px; text-align:left; overflow:hidden; text-overflow:ellipsis; }
.quantity-table tr:last-child td { border-bottom:0; }
.quantity-table th { position:sticky; top:0; background:var(--surface-2); color:var(--muted); font-weight:700; }
.quantity-analytics-note { color:var(--muted); font-size:11px; line-height:1.4; }

@media (max-width:700px) {
  .compound-condition { grid-template-columns:92px minmax(0,1fr) 28px; }
  .compound-mode,.compound-negate { min-width:92px; }
}

/* ===== TZ 2.1 / Viewer P16.4 Patch 05 ===== */
/* Bottom toolbar adapts to the actual viewport width between opened panels. */
.viewport { container-type:inline-size; }
.bottom-toolbar { max-width:calc(100% - 20px); justify-content:center; }
.bottom-toolbar.toolbar-compact { padding:5px; gap:2px; border-radius:12px; }
.bottom-toolbar.toolbar-compact .tool-btn { width:54px; min-width:54px; height:50px; padding:3px; font-size:10px; }
.bottom-toolbar.toolbar-compact .tool-btn.wide { width:76px; min-width:76px; }
.bottom-toolbar.toolbar-compact .tool-sep { margin:0 1px; height:34px; }
.bottom-toolbar.toolbar-two-row {
  width:min(720px,calc(100% - 16px)); max-width:calc(100% - 16px); flex-wrap:wrap;
  overflow:visible; row-gap:3px; padding:5px 6px;
}
.bottom-toolbar.toolbar-two-row .tool-sep { display:none; }
.bottom-toolbar.toolbar-two-row .tool-btn { width:52px; min-width:52px; height:46px; font-size:9.5px; }
.bottom-toolbar.toolbar-two-row .tool-btn.wide { width:72px; min-width:72px; }
.bottom-toolbar.toolbar-micro { width:min(570px,calc(100% - 12px)); }
.bottom-toolbar.toolbar-micro .tool-btn { width:45px; min-width:45px; height:43px; padding:2px; font-size:8.5px; }
.bottom-toolbar.toolbar-micro .tool-btn.wide { width:64px; min-width:64px; }
.bottom-toolbar.toolbar-micro .tool-btn [data-icon] svg { width:16px; height:16px; }
.bottom-toolbar .tool-btn:disabled { opacity:.38; cursor:default; }

/* Comparison categories consume all remaining panel height. */
.left-page[data-page="compare"].active { display:flex; flex-direction:column; min-height:0; overflow:hidden; }
#diffPanel { flex:1 1 auto; min-height:0; flex-direction:column; overflow:hidden; }
#diffPanel .diff-category-list { max-height:none; flex:1 1 auto; min-height:120px; overflow:auto; padding-bottom:6px; }

/* Model-scoped compound filters. */
.compound-rule-scope { margin:0 0 9px; border:1px solid var(--border); border-radius:8px; background:var(--surface-2); }
.compound-rule-scope > summary { min-height:34px; padding:7px 9px; cursor:pointer; color:var(--text); font-size:12px; font-weight:700; }
.compound-rule-scope > summary::marker { color:var(--accent-2); }
.compound-rule-scope-tree {
  max-height:260px; overflow-y:auto; overflow-x:hidden; scrollbar-gutter:stable;
  padding:0 8px 8px;
}
.compound-scope-all-row,
.compound-scope-model-row {
  display:grid; grid-template-columns:16px minmax(0,1fr); align-items:start; column-gap:7px;
  min-width:0; min-height:28px; margin:0; padding:5px 4px; border-radius:6px;
}
.compound-scope-all-row:hover,.compound-scope-section-row:hover,.compound-scope-model-row:hover { background:var(--surface-3); }
.compound-scope-section { margin-top:4px; border-top:1px solid var(--border); padding-top:4px; min-width:0; }
.compound-scope-section-row {
  display:grid; grid-template-columns:18px minmax(0,1fr); align-items:center; gap:4px;
  min-width:0; min-height:30px; margin:0; padding:4px 3px; border-radius:6px;
}
.compound-scope-section-toggle {
  display:grid; place-items:center; width:18px; min-width:18px; height:18px;
  margin:0; padding:0; border:0; border-radius:4px; background:transparent;
  color:var(--accent-2); line-height:1;
}
.compound-scope-section-toggle:hover { background:var(--accent-soft); }
.compound-scope-section-toggle span { display:block; font-size:18px; transform:rotate(0deg); transition:transform .14s ease; }
.compound-scope-section.is-expanded .compound-scope-section-toggle span { transform:rotate(90deg); }
.compound-scope-section-select {
  display:grid; grid-template-columns:16px minmax(0,1fr) auto; align-items:center; column-gap:7px;
  min-width:0; margin:0; padding:0; font-size:11px; font-weight:750; cursor:pointer;
}
.compound-scope-section-name,
.compound-scope-all-row > span,
.compound-scope-model-name {
  min-width:0; overflow-wrap:break-word; word-break:normal; white-space:normal;
}
.compound-scope-section-count {
  min-width:32px; margin:0; color:var(--muted-2); font-size:9px; font-weight:650;
  text-align:right; white-space:nowrap;
}
.compound-scope-models { min-width:0; padding:2px 0 3px 22px; }
.compound-scope-models[hidden] { display:none !important; }
.compound-scope-model-row { color:var(--text); font-size:11px; }
.compound-scope-model-row.disabled { color:var(--muted-2); }
.compound-scope-model-row small {
  grid-column:2; min-width:0; margin:1px 0 0; color:var(--muted-2);
  font-size:9px; line-height:1.25; text-align:left; overflow-wrap:break-word; word-break:normal;
}
.compound-scope-all-row input[type="checkbox"],
.compound-scope-section-select input[type="checkbox"],
.compound-scope-model-row input[type="checkbox"] {
  width:14px; min-width:14px; max-width:14px; height:14px; margin:2px 0 0; padding:0;
  border-radius:3px; accent-color:var(--accent); justify-self:start;
}
.compound-scope-summary { color:var(--accent-2); }
.compound-scope-empty { padding:9px 4px; color:var(--muted); font-size:11px; }

.clash-alias-note { margin-top:2px; color:var(--muted); font-size:9.5px; }
.viewport .tool-status { bottom:calc(14px + var(--toolbar-actual-h,64px) + 8px); }

/* ===== TZ 2.1 / Viewer P16.5 Patch 06 ===== */
/* Compact desktop hotkey strip follows the viewport and always stays above
   the tool status card when it is visible. Inline positioning is calculated
   by federated-viewer.js because the viewport shifts with opened side panels. */
.fp-hint {
  z-index:14; width:max-content; min-height:30px; box-sizing:border-box;
  padding:5px 9px; border-radius:9px; font-size:10.5px; line-height:1.25;
  background:color-mix(in srgb,var(--surface-inverse,#0f172a) 88%,transparent);
}
.fp-hint.active { display:flex !important; align-items:center; justify-content:center; }
.fp-hint-row { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:3px 6px; }
.fp-hint-row + .fp-hint-row { margin-top:0; }
.fp-hint .hk { margin:0; padding:1px 4px; font-size:10px; line-height:1.2; }
@media (max-width:760px) { .fp-hint { display:none !important; } }


/* ===== TZ 2.1 / Viewer P16.6 Patch 07: compact expandable filter scope tree ===== */


/* ===== TZ 2.1 / Viewer P16.7 Patch 08: stable multi-filter document flow =====
   The filters page used a column flex layout. With several compound rules,
   native select controls could be painted outside shrunken flex boxes, which
   visually duplicated controls and made the scrollbar range incomplete.
   Keep the page and every rule in natural document flow; the page is the only
   vertical scroll owner. */
.left-page[data-page="filters"].active {
  display:block;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding-bottom:10px;
}
.left-page[data-page="filters"] > .section-block {
  display:block;
  position:relative;
  width:100%;
  height:auto;
  min-height:0;
  flex:none;
}
.compound-filter-rules {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-auto-rows:max-content;
  align-content:start;
  gap:12px;
  width:100%;
  height:auto;
  min-height:0;
  overflow:visible;
}
.compound-filter-rules > .compound-rule {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-auto-rows:max-content;
  align-content:start;
  position:relative;
  width:100%;
  height:auto;
  min-height:0;
  margin:0;
  overflow:visible;
  flex:none;
}
.compound-rule > *,
.compound-filter-groups,
.compound-filter-group,
.compound-condition-list,
.compound-rule-action-row {
  min-width:0;
  max-width:100%;
}
.compound-filter-groups {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-auto-rows:max-content;
  align-content:start;
  gap:8px;
  width:100%;
  height:auto;
  overflow:visible;
}
.compound-filter-group,
.compound-condition-list,
.compound-condition,
.compound-add-condition,
.compound-rule-action-row {
  position:relative;
  height:auto;
  flex:none;
}

/* ===== TZ 2.1 / Viewer P16.8 Patch 09: stable comparison action height =====
   The comparison page is a column flex container. Once the result panel gains
   enough content, the default flex-shrink on the action button reduced its
   height below the standard 34 px. Keep the action outside flex distribution
   so its dimensions stay identical before, during and after calculation. */
.left-page[data-page="compare"].active > #diffBtn {
  flex:0 0 34px;
  width:100%;
  height:34px;
  min-height:34px;
  max-height:34px;
  align-self:stretch;
}

/* ===== P17.6 Patch22: Volume Schedule Core ===== */
.left-panel.volume-mode { width:min(520px,42vw); }
.volume-schedule-block { display:flex; flex-direction:column; gap:10px; min-width:0; }
.quantity-kind-switch { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.quantity-kind-switch .btn { min-height:36px; }
.volume-core-hint,.volume-floor-note { color:var(--muted); font-size:11px; line-height:1.45; }
.volume-floor-note { margin-top:7px; padding:7px 8px; border-radius:8px; background:var(--surface-2); border:1px solid var(--border); }
.volume-config { border:1px solid var(--border); border-radius:10px; background:var(--surface-1); overflow:hidden; }
.volume-config > summary { cursor:pointer; list-style:none; padding:9px 10px; font-size:12px; font-weight:800; display:flex; align-items:center; gap:8px; }
.volume-config > summary::-webkit-details-marker { display:none; }
.volume-config > summary::before { content:'›'; color:var(--muted); transform:rotate(0deg); transition:transform .12s ease; font-size:16px; line-height:1; }
.volume-config[open] > summary::before { transform:rotate(90deg); }
.volume-summary-note { margin-left:auto; color:var(--muted); font-size:10px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.volume-scope-tree,.volume-grouping-list,.volume-measure-list { padding:0 9px 9px; display:flex; flex-direction:column; gap:5px; min-width:0; }
.volume-scope-section { border-top:1px solid color-mix(in srgb,var(--border) 70%,transparent); padding-top:6px; }
.volume-scope-section:first-child { border-top:0; padding-top:0; }
.volume-scope-head,.volume-scope-model,.volume-config-row,.volume-measure-row { min-height:28px; display:flex; align-items:center; gap:7px; min-width:0; font-size:11px; }
.volume-scope-model { padding-left:22px; color:var(--text); }
.volume-scope-head { font-weight:700; }
.volume-scope-head span,.volume-scope-model span,.volume-config-row .volume-config-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.volume-config-row { padding:4px 5px; border:1px solid transparent; border-radius:7px; }
.volume-config-row.enabled { background:var(--surface-2); border-color:var(--border); }
.volume-config-order { margin-left:auto; display:flex; gap:3px; }
.volume-order-btn { width:25px; height:25px; min-width:25px; border:1px solid var(--border); border-radius:6px; background:var(--surface-1); color:var(--text); cursor:pointer; }
.volume-order-btn:disabled { opacity:.35; cursor:default; }
.volume-measure-row .volume-measure-unit { margin-left:auto; color:var(--muted); font-size:10px; }
.volume-run-actions .btn { width:100%; }
.volume-selection-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
.volume-selection-toolbar .btn { min-height:30px; padding:5px 8px; font-size:11px; }
.volume-selected-summary { margin-left:auto; color:var(--muted); font-size:10px; font-variant-numeric:tabular-nums; }
.volume-schedule-results { min-width:0; border:1px solid var(--border); border-radius:10px; overflow:auto; background:var(--surface-1); max-height:min(58vh,680px); }
.volume-result-header,.volume-result-row { display:grid; align-items:center; min-width:max-content; }
.volume-result-header { position:sticky; top:0; z-index:3; background:var(--surface-2); border-bottom:1px solid var(--border); color:var(--muted); font-size:10px; font-weight:800; }
.volume-result-row { min-height:30px; border-bottom:1px solid color-mix(in srgb,var(--border) 65%,transparent); font-size:11px; font-variant-numeric:tabular-nums; }
.volume-result-row:last-child { border-bottom:0; }
.volume-result-cell { padding:6px 7px; text-align:right; white-space:nowrap; }
.volume-result-cell.name { position:sticky; left:0; z-index:1; background:var(--surface-1); text-align:left; min-width:225px; max-width:320px; display:flex; align-items:center; gap:5px; }
.volume-result-header .volume-result-cell.name { z-index:4; background:var(--surface-2); }
.volume-result-row.parent > .volume-result-cell.name { font-weight:750; }
.volume-tree-indent { display:inline-block; width:calc(var(--depth,0) * 14px); flex:0 0 auto; }
.volume-tree-toggle { width:18px; min-width:18px; height:18px; border:0; background:transparent; color:var(--muted); cursor:pointer; padding:0; font-size:14px; }
.volume-tree-toggle.leaf { visibility:hidden; }
.volume-tree-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.volume-coverage { display:block; margin-top:1px; color:var(--muted); font-size:9px; }
.volume-coverage.warn { color:#b97816; font-weight:700; }
.volume-empty { padding:18px 12px; color:var(--muted); font-size:11px; text-align:center; }
@media(max-width:900px){ .left-panel.volume-mode { width:min(520px,calc(100vw - var(--rail-w))); } }

/* ===== P17.6 Patch22 HF01: compact Volume Schedule workspace ===== */
.left-panel.volume-mode {
  width:clamp(540px,46vw,680px);
  max-width:680px;
}
.left-page[data-page="quantities"].active {
  display:flex;
  flex-direction:column;
  min-height:0;
  height:100%;
  overflow:hidden;
  padding-top:0;
}
.left-page[data-page="quantities"] > .volume-schedule-block {
  flex:1 1 auto;
  min-height:0;
  height:100%;
  margin:0;
  padding:0;
}
.volume-schedule-block {
  display:flex;
  flex-direction:column;
  gap:7px;
  overflow:hidden;
  min-width:0;
}
.volume-schedule-head {
  flex:0 0 auto;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
}
.quantity-kind-switch {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  min-width:0;
}
.quantity-kind-switch .btn,
.volume-run-line .btn,
.volume-selection-toolbar .btn,
.volume-order-btn,
.volume-scope-toggle {
  margin:0 !important;
}
.quantity-kind-switch .btn {
  min-height:32px;
  height:32px;
  padding:5px 10px;
  font-size:12px;
  border-radius:8px;
}
.volume-engine-badge {
  display:inline-flex;
  align-items:center;
  height:24px;
  padding:0 7px;
  border:1px solid var(--border);
  border-radius:999px;
  background:var(--surface-2);
  color:var(--muted);
  font-size:9px;
  font-weight:750;
  letter-spacing:.03em;
  white-space:nowrap;
}
.volume-config-stack {
  flex:0 1 auto;
  display:flex;
  flex-direction:column;
  gap:5px;
  min-height:0;
  max-height:min(43vh,430px);
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-width:thin;
  overscroll-behavior:contain;
}
.volume-config {
  flex:0 0 auto;
  margin:0 !important;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface-1);
  overflow:hidden;
}
.volume-config > summary {
  cursor:pointer;
  list-style:none;
  min-height:32px;
  padding:6px 8px;
  display:flex;
  align-items:center;
  gap:7px;
  font-size:11px;
  font-weight:760;
  user-select:none;
}
.volume-config > summary::-webkit-details-marker { display:none; }
.volume-config > summary::before {
  content:'›';
  flex:0 0 auto;
  width:12px;
  color:var(--muted);
  font-size:15px;
  line-height:1;
  transform:none;
}
.volume-config[open] > summary::before { content:'⌄'; transform:none; }
.volume-config-title { flex:0 0 auto; }
.volume-summary-note {
  margin-left:auto;
  min-width:0;
  max-width:72%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--muted);
  font-size:10px;
  font-weight:500;
  text-align:right;
}

/* Reset legacy styles.css leakage inside Volume Schedule. */
.left-page[data-page="quantities"] label {
  margin:0 !important;
}
.left-page[data-page="quantities"] input[type="checkbox"] {
  width:14px !important;
  min-width:14px !important;
  height:14px !important;
  padding:0 !important;
  margin:0 !important;
  border-radius:3px;
  flex:0 0 14px;
}
.left-page[data-page="quantities"] button {
  max-width:100%;
}

.volume-scope-tree,
.volume-grouping-list,
.volume-measure-list {
  min-width:0;
  padding:3px 7px 7px;
}
.volume-scope-tree {
  display:flex;
  flex-direction:column;
  gap:2px;
  max-height:230px;
  overflow:auto;
  scrollbar-width:thin;
}
.volume-scope-section {
  margin:0;
  padding:0;
  border-top:1px solid color-mix(in srgb,var(--border) 65%,transparent);
}
.volume-scope-section:first-child { border-top:0; }
.volume-scope-head {
  min-height:27px;
  display:grid;
  grid-template-columns:18px 14px minmax(0,1fr) auto;
  align-items:center;
  gap:5px;
  padding:2px 3px;
  font-size:10.5px;
  font-weight:720;
}
.volume-scope-toggle {
  width:18px;
  min-width:18px;
  height:18px;
  padding:0 !important;
  border:0;
  border-radius:4px;
  background:transparent;
  color:var(--muted);
  font-size:14px;
  line-height:18px;
  cursor:pointer;
}
.volume-scope-toggle:hover { background:var(--surface-2); color:var(--text); }
.volume-scope-title,
.volume-scope-model span {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.volume-scope-count {
  min-width:20px;
  padding:1px 5px;
  border-radius:999px;
  background:var(--surface-2);
  color:var(--muted);
  font-size:9px;
  font-weight:650;
  text-align:center;
}
.volume-scope-models {
  padding:0 3px 4px 37px;
}
.volume-scope-models[hidden] { display:none !important; }
.volume-scope-model {
  min-height:24px;
  padding:2px 3px;
  display:grid;
  grid-template-columns:14px minmax(0,1fr);
  align-items:center;
  gap:6px;
  color:var(--text);
  font-size:10.5px;
}
.volume-scope-model:hover { background:var(--surface-2); border-radius:5px; }

.volume-grouping-list {
  display:flex;
  flex-direction:column;
  gap:2px;
}
.volume-config-row {
  min-height:27px;
  display:grid;
  grid-template-columns:14px minmax(0,1fr) auto;
  align-items:center;
  gap:6px;
  margin:0;
  padding:2px 4px;
  border:1px solid transparent;
  border-radius:6px;
  font-size:10.5px;
}
.volume-config-row.enabled {
  background:var(--surface-2);
  border-color:color-mix(in srgb,var(--border) 75%,transparent);
}
.volume-config-label {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.volume-config-order {
  display:flex;
  gap:2px;
}
.volume-order-btn {
  width:21px;
  min-width:21px;
  height:21px;
  padding:0 !important;
  border:1px solid var(--border);
  border-radius:5px;
  background:var(--surface-1);
  color:var(--text);
  font-size:10px;
  cursor:pointer;
}
.volume-order-btn:disabled { opacity:.28; cursor:default; }
.volume-floor-note {
  margin:0 7px 7px;
  padding:5px 7px;
  border:1px solid var(--border);
  border-radius:6px;
  background:var(--surface-2);
  color:var(--muted);
  font-size:9.5px;
  line-height:1.35;
}
.volume-floor-note[hidden] { display:none !important; }

.volume-measure-list {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:4px;
}
.volume-measure-row {
  min-height:28px;
  display:grid;
  grid-template-columns:14px minmax(0,1fr) auto;
  align-items:center;
  gap:6px;
  padding:3px 6px;
  border:1px solid var(--border);
  border-radius:6px;
  background:var(--surface-1);
  font-size:10.5px;
}
.volume-measure-unit {
  margin:0 !important;
  color:var(--muted);
  font-size:9px;
}

.volume-run-line {
  flex:0 0 auto;
  min-width:0;
  display:grid;
  grid-template-columns:132px minmax(0,1fr);
  align-items:center;
  gap:8px;
}
.volume-run-line > .btn {
  width:132px;
  min-height:32px;
  height:32px;
  padding:5px 10px;
  font-size:11px;
}
.volume-run-info {
  min-width:0;
  margin:0 !important;
  padding:0 !important;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:10px;
  color:var(--muted);
}
.volume-run-info:empty::before {
  content:'Настройте область и нажмите «Рассчитать»';
  color:var(--muted);
}

.volume-results-shell {
  flex:1 1 auto;
  min-height:150px;
  min-width:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface-1);
}
.volume-selection-toolbar {
  flex:0 0 auto;
  min-height:34px;
  display:flex;
  align-items:center;
  gap:5px;
  padding:4px 6px;
  border-bottom:1px solid var(--border);
  background:var(--surface-2);
}
.volume-selection-toolbar[hidden] { display:none !important; }
.volume-selection-toolbar .btn {
  min-height:25px;
  height:25px;
  padding:3px 7px;
  font-size:9.5px;
  border-radius:6px;
}
.volume-selected-summary {
  margin-left:auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--muted);
  font-size:9.5px;
  font-variant-numeric:tabular-nums;
}
.volume-schedule-results {
  flex:1 1 auto;
  min-height:0;
  min-width:0;
  max-height:none;
  overflow:auto;
  border:0;
  border-radius:0;
  background:var(--surface-1);
  scrollbar-width:thin;
  scrollbar-gutter:stable;
}
.volume-result-header,
.volume-result-row {
  min-width:max-content;
}
.volume-result-header {
  position:sticky;
  top:0;
  z-index:3;
  min-height:27px;
  background:var(--surface-2);
  border-bottom:1px solid var(--border);
  color:var(--muted);
  font-size:9px;
  font-weight:800;
}
.volume-result-row {
  min-height:27px;
  border-bottom:1px solid color-mix(in srgb,var(--border) 62%,transparent);
  font-size:10.5px;
  font-variant-numeric:tabular-nums;
}
.volume-result-cell {
  padding:4px 6px;
  text-align:right;
  white-space:nowrap;
}
.volume-result-cell.name {
  position:sticky;
  left:0;
  z-index:1;
  min-width:188px;
  max-width:280px;
  display:flex;
  align-items:center;
  gap:4px;
  padding-left:5px;
  background:var(--surface-1);
  text-align:left;
}
.volume-result-header .volume-result-cell.name {
  z-index:4;
  background:var(--surface-2);
}
.volume-tree-indent { width:calc(var(--depth,0) * 11px); }
.volume-tree-toggle {
  width:16px;
  min-width:16px;
  height:16px;
  padding:0 !important;
  margin:0 !important;
  font-size:12px;
}
.volume-tree-label { min-width:0; }
.volume-coverage {
  margin-top:0;
  font-size:8px;
  line-height:1.1;
}
.volume-empty { padding:14px 10px; font-size:10px; }

@media(max-width:1100px) {
  .left-panel.volume-mode { width:min(600px,calc(100vw - var(--rail-w) - 20px)); max-width:600px; }
}
@media(max-width:900px) {
  .left-panel.volume-mode { width:calc(100vw - var(--rail-w)); max-width:none; }
  .volume-config-stack { max-height:40vh; }
}

/* P17.6 P24 unified quantity tree */
.volume-unified-title { min-width:0; display:flex; flex-direction:column; gap:1px; }
.volume-unified-title strong { font-size:12px; line-height:1.2; }
.volume-unified-title span { color:var(--muted); font-size:9.5px; line-height:1.2; }
.volume-config-label small { color:var(--muted); font-size:9px; font-weight:500; }
.volume-config-row.pinned .volume-config-order { min-width:0; }
.volume-search-wrap {
  flex:1 1 190px; min-width:150px; height:27px; display:flex; align-items:center; gap:5px;
  padding:0 7px; border:1px solid var(--border); border-radius:6px; background:var(--surface-1);
}
.volume-search-wrap [data-icon] { flex:0 0 auto; width:13px; height:13px; color:var(--muted); }
.left-page[data-page="quantities"] .volume-search-wrap input[type="search"] {
  width:100% !important; min-width:0 !important; height:24px !important; margin:0 !important; padding:0 !important;
  border:0 !important; outline:0 !important; box-shadow:none !important; background:transparent !important; color:var(--text); font-size:10.5px;
}
.volume-result-cell.actions { display:flex; align-items:center; justify-content:center; gap:3px; padding-left:3px; padding-right:3px; }
.volume-row-action {
  width:auto !important; min-width:48px !important; height:21px !important; min-height:21px !important; margin:0 !important;
  padding:2px 5px !important; border:1px solid var(--border); border-radius:5px; background:var(--surface-1); color:var(--text);
  font-size:8.5px !important; font-weight:650; cursor:pointer;
}
.volume-row-action:hover { background:var(--surface-2); border-color:var(--accent); }
.volume-result-row.material > .volume-result-cell.name { color:color-mix(in srgb,var(--text) 84%,var(--muted)); font-weight:600; }
.volume-result-row.paint > .volume-result-cell.name { font-style:italic; }
.volume-result-cell.muted { color:var(--muted); }
.volume-check-spacer { width:14px; min-width:14px; height:14px; display:inline-block; }
.volume-tree-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media(max-width:900px) {
  .volume-selection-toolbar { flex-wrap:wrap; }
  .volume-search-wrap { flex-basis:100%; }
}

/* ===== P17.6 P24 HF01: stable Volume Schedule vertical layout ===== */
.left-page[data-page="quantities"].active {
  overflow:hidden !important;
  overflow-anchor:none;
}
.left-page[data-page="quantities"] > .volume-schedule-block {
  flex:1 1 0 !important;
  min-height:0 !important;
  height:auto !important;
  overflow:hidden !important;
}
.volume-schedule-head,
.volume-config-stack,
.volume-run-line {
  flex-shrink:0 !important;
}
.volume-config-stack {
  flex:0 0 auto !important;
}
.volume-results-shell {
  flex:1 1 0 !important;
  min-height:150px;
  height:auto !important;
  overflow:hidden !important;
}
.volume-schedule-results {
  flex:1 1 0 !important;
  min-height:0 !important;
  height:0;
  overflow:auto !important;
  overflow-anchor:none;
  overscroll-behavior:contain;
}

/* ===== P17.7 Patch25: Volume Schedule Completion ===== */
.volume-selection-edit-actions {
  display:flex; align-items:center; gap:5px; flex:0 0 auto;
}
.volume-selection-edit-actions[hidden] { display:none !important; }
.volume-selection-toolbar > #quantityEditSelection,
.volume-selection-toolbar > #quantityExportExcel,
.volume-selection-toolbar > #quantityQualityToggle { flex:0 0 auto; }
.volume-selection-toolbar > #quantityQualityToggle.active {
  border-color:var(--accent); background:color-mix(in srgb,var(--accent) 10%,var(--surface-1));
}
.volume-result-row.export-selected > .volume-result-cell {
  background:color-mix(in srgb,#63aee8 15%,var(--surface-1));
}
.volume-result-row.export-selected > .volume-result-cell.name {
  background:color-mix(in srgb,#63aee8 18%,var(--surface-1));
}
.volume-result-row.export-partial > .volume-result-cell {
  background:color-mix(in srgb,#63aee8 6%,var(--surface-1));
}
.volume-result-row.export-partial > .volume-result-cell.name {
  background:color-mix(in srgb,#63aee8 9%,var(--surface-1));
  box-shadow:inset 3px 0 0 color-mix(in srgb,#3f93d2 72%,transparent);
}
.volume-result-row input[data-volume-check] {
  width:14px !important; min-width:14px !important; height:14px !important; margin:0 !important; padding:0 !important; flex:0 0 14px;
}
.volume-quality-panel {
  flex:0 1 min(34vh,330px); min-height:110px; max-height:min(34vh,330px); overflow:hidden;
  border:1px solid var(--border); border-radius:9px; background:var(--surface-1); display:flex; flex-direction:column;
}
.volume-quality-panel[hidden] { display:none !important; }
.volume-quality-head {
  flex:0 0 auto; display:flex; align-items:flex-start; gap:8px; padding:8px 9px 6px; border-bottom:1px solid var(--border); background:var(--surface-2);
}
.volume-quality-head > div { min-width:0; display:flex; flex-direction:column; gap:2px; }
.volume-quality-head strong { font-size:11px; }
.volume-quality-head span { color:var(--muted); font-size:9px; line-height:1.3; }
.volume-quality-close { margin-left:auto; width:22px !important; min-width:22px !important; height:22px !important; padding:0 !important; border:0; background:transparent; color:var(--muted); font-size:17px; cursor:pointer; }
.volume-quality-summary { flex:0 0 auto; padding:5px 9px; color:var(--muted); font-size:9.5px; border-bottom:1px solid var(--border); font-variant-numeric:tabular-nums; }
.volume-quality-table { min-height:0; overflow:auto; overscroll-behavior:contain; }
.volume-quality-row {
  display:grid; grid-template-columns:minmax(230px,1fr) 55px 54px 54px 54px; align-items:center; min-width:460px;
  min-height:27px; border-bottom:1px solid color-mix(in srgb,var(--border) 62%,transparent); font-size:9.5px; font-variant-numeric:tabular-nums;
}
.volume-quality-row > span { padding:4px 6px; text-align:right; white-space:nowrap; }
.volume-quality-row > span:first-child { text-align:left; min-width:0; overflow:hidden; }
.volume-quality-row > span:first-child b { display:block; overflow:hidden; text-overflow:ellipsis; font-size:9.5px; }
.volume-quality-row > span:first-child small { display:block; color:var(--muted); overflow:hidden; text-overflow:ellipsis; }
.volume-quality-row.header { position:sticky; top:0; z-index:2; background:var(--surface-2); color:var(--muted); font-weight:750; }
.volume-quality-pct { display:inline-flex; justify-content:flex-end; min-width:34px; }
.volume-quality-pct.ok { color:color-mix(in srgb,#318a57 78%,var(--text)); }
.volume-quality-pct.warn { color:#b97816; font-weight:750; }
@media(max-width:900px) {
  .volume-selection-edit-actions { width:100%; }
  .volume-quality-panel { max-height:36vh; }
}

/* ===== P17.7 Patch26: Volume Version Diff + uniform export highlighting ===== */
.volume-result-row.export-selected {
  --volume-export-row-bg: color-mix(in srgb,#63aee8 16%,var(--surface-1));
  background:var(--volume-export-row-bg);
}
.volume-result-row.export-selected > .volume-result-cell {
  background:transparent;
}
.volume-result-row.export-selected > .volume-result-cell.name {
  background:var(--volume-export-row-bg);
}
.volume-result-row.export-selected .volume-row-action {
  background:color-mix(in srgb,#63aee8 8%,var(--surface-1));
}
.volume-result-row.export-partial {
  --volume-export-row-bg: color-mix(in srgb,#63aee8 7%,var(--surface-1));
  background:var(--volume-export-row-bg);
}
.volume-result-row.export-partial > .volume-result-cell {
  background:transparent;
}
.volume-result-row.export-partial > .volume-result-cell.name {
  background:var(--volume-export-row-bg);
  box-shadow:inset 3px 0 0 color-mix(in srgb,#3f93d2 72%,transparent);
}
.volume-result-row.export-partial .volume-row-action {
  background:color-mix(in srgb,#63aee8 4%,var(--surface-1));
}
.volume-selection-toolbar > #quantityDiffToggle.active {
  border-color:var(--accent);
  background:color-mix(in srgb,var(--accent) 10%,var(--surface-1));
}
.volume-diff-panel {
  flex:1 1 0;
  min-height:0;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:9px;
  background:var(--surface-1);
  display:flex;
  flex-direction:column;
}
.volume-diff-panel[hidden] { display:none !important; }
.volume-diff-head {
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:6px;
  padding:7px 8px;
  border-bottom:1px solid var(--border);
  background:var(--surface-2);
}
.volume-diff-title {
  min-width:150px;
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  gap:1px;
}
.volume-diff-title strong { font-size:10.5px; line-height:1.2; }
.volume-diff-title span { color:var(--muted); font-size:8.5px; line-height:1.25; }
.volume-diff-select {
  flex:0 1 235px;
  min-width:150px;
  max-width:280px;
  height:27px;
  margin:0 !important;
  padding:3px 24px 3px 7px !important;
  border:1px solid var(--border);
  border-radius:6px;
  background:var(--surface-1);
  color:var(--text);
  font-size:9px;
}
.volume-diff-info {
  flex:0 0 auto;
  min-height:24px;
  padding:5px 8px;
  border-bottom:1px solid var(--border);
  color:var(--muted);
  font-size:9px;
  line-height:1.35;
  font-variant-numeric:tabular-nums;
}
.volume-diff-results {
  flex:1 1 0;
  min-height:0;
  overflow:auto;
  scrollbar-width:thin;
  scrollbar-gutter:stable;
  overscroll-behavior:contain;
}
.volume-diff-grid {
  display:grid;
  align-items:center;
  min-width:max-content;
}
.volume-diff-results .volume-result-header {
  position:sticky;
  top:0;
  z-index:3;
}
.volume-diff-results .volume-result-cell.name {
  position:sticky;
  left:0;
  z-index:1;
  background:var(--surface-1);
}
.volume-diff-results .volume-result-header .volume-result-cell.name {
  z-index:4;
  background:var(--surface-2);
}
.volume-diff-value { font-weight:700; }
.volume-diff-value.positive { color:#19734a; }
.volume-diff-value.negative { color:#b13b35; }
.volume-diff-value.zero { color:var(--muted); font-weight:500; }
.volume-diff-coverage {
  margin-left:3px;
  color:#b7791f;
  font-size:8px;
  vertical-align:top;
}
@media(max-width:900px) {
  .volume-diff-head { flex-wrap:wrap; }
  .volume-diff-title { flex-basis:100%; }
  .volume-diff-select { flex:1 1 180px; max-width:none; }
}

/* ===== P17.7 Patch27: strict Volume grid columns + interactive resize ===== */
.volume-schedule-results .volume-grid-aligned {
  grid-template-columns:var(--volume-grid-template);
}
.volume-diff-results .volume-diff-grid {
  grid-template-columns:var(--volume-diff-grid-template);
}
.volume-schedule-results .volume-result-header,
.volume-schedule-results .volume-result-row,
.volume-diff-results .volume-result-header,
.volume-diff-results .volume-result-row {
  width:max-content;
  min-width:100%;
  box-sizing:border-box;
}
.volume-schedule-results .volume-result-cell,
.volume-diff-results .volume-result-cell {
  min-width:0;
  box-sizing:border-box;
}
.volume-schedule-results .volume-result-cell.name,
.volume-diff-results .volume-result-cell.name {
  min-width:0;
  max-width:none;
  width:auto;
  overflow:hidden;
}
.volume-result-header > .volume-result-cell {
  position:relative;
}
.volume-result-header > .volume-result-cell.name {
  position:sticky;
}
.volume-header-label {
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.volume-result-header .volume-result-cell.actions .volume-header-label {
  width:100%;
  text-align:center;
}
.volume-col-resizer {
  position:absolute;
  top:0;
  right:-4px;
  bottom:0;
  width:8px;
  z-index:12;
  cursor:col-resize;
  touch-action:none;
  user-select:none;
}
.volume-col-resizer::after {
  content:'';
  position:absolute;
  top:4px;
  bottom:4px;
  left:3px;
  width:1px;
  background:transparent;
}
.volume-col-resizer:hover::after,
.volume-col-resizer.dragging::after {
  background:var(--accent);
}
body.volume-column-resizing,
body.volume-column-resizing * {
  cursor:col-resize !important;
  user-select:none !important;
}

/* ===== P17.8 Patch28: Filter Engine v2 ===== */
.saved-filter-panel {
  display:flex; flex-direction:column; gap:6px; margin-top:9px; padding:8px;
  border:1px solid var(--border); border-radius:9px; background:var(--surface-2);
}
.saved-filter-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:6px; align-items:center; }
.saved-filter-row .field,.saved-filter-row .select { min-width:0; width:100%; }
.saved-filter-row .btn { min-height:34px; white-space:nowrap; }
.saved-filter-info { min-height:0; color:var(--muted); font-size:10.5px; line-height:1.35; }
.saved-filter-info:empty { display:none; }
.saved-filter-info.error { color:var(--danger,#c53030); }
.compound-condition {
  grid-template-columns:112px minmax(0,1fr) 28px;
  grid-template-areas:
    "negate param remove"
    "mode value remove"
    "meta value2 remove";
}
.compound-param-meta {
  grid-area:meta; min-width:0; align-self:center; color:var(--muted); font-size:10px; line-height:1.2;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.compound-value2 { grid-area:value2; }
.compound-value2[hidden] { display:none !important; }
.compound-mode { min-width:112px; }
.compound-condition[data-operator="exists"] .compound-value,
.compound-condition[data-operator="not_exists"] .compound-value { opacity:.55; }
.compound-condition.operator-invalid { border-color:color-mix(in srgb,var(--danger,#c53030) 55%,var(--border)); }
.compound-condition.operator-invalid .compound-param-meta { color:var(--danger,#c53030); }
.compound-unit-note {
  margin-top:6px; padding:6px 7px; border-radius:7px; background:var(--surface-2); color:var(--muted); font-size:10.5px; line-height:1.35;
}
@media (max-width:700px) {
  .saved-filter-row { grid-template-columns:minmax(0,1fr) auto; }
  .saved-filter-row .btn:last-child { grid-column:auto; }
  .compound-condition { grid-template-columns:104px minmax(0,1fr) 28px; }
  .compound-mode,.compound-negate { min-width:104px; }
}

/* ===== P17.8 Patch29: Saved Sets / Views 2.0 ===== */
.saved2-tabs{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:3px;background:var(--surface-3);border:1px solid var(--border);border-radius:10px;margin-bottom:9px}
.saved2-tab{height:31px;border:0;border-radius:7px;background:transparent;color:var(--muted);font-weight:700}.saved2-tab.active{background:var(--surface-1);color:var(--accent-2);box-shadow:0 1px 3px rgba(15,23,42,.08)}
.saved2-pane{display:none}.saved2-pane.active{display:block}.saved2-actions{margin-bottom:7px}.saved2-toolbar{display:grid;grid-template-columns:minmax(0,1fr) 104px;gap:6px;margin-bottom:8px}.saved2-toolbar .field,.saved2-toolbar .select{height:32px;min-width:0}
.saved2-hint{margin:0 0 8px;padding:8px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);font-size:9px;line-height:1.45;color:var(--muted)}
.view-item.saved2-card{grid-template-columns:22px minmax(0,1fr) auto;align-items:start;border:1px solid transparent}.view-item.saved2-card:hover{border-color:var(--border)}
.view-item.saved2-default{box-shadow:inset 3px 0 0 var(--accent);background:color-mix(in srgb,var(--accent-soft) 58%,transparent)}
.view-open.saved2-main{display:flex;flex-direction:column;gap:3px;padding:1px 0;overflow:hidden;background:transparent;border:0;color:inherit}.saved2-title-row{display:flex;align-items:center;gap:5px;min-width:0}.saved2-title-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.saved2-badge{flex:0 0 auto;padding:2px 5px;border-radius:999px;font-size:8px;font-weight:700;border:1px solid var(--border);background:var(--surface-2);color:var(--muted)}.saved2-badge.shared{background:var(--accent-soft);color:var(--accent-2);border-color:color-mix(in srgb,var(--accent) 26%,var(--border))}
.saved2-desc{font-size:9px;color:var(--muted);line-height:1.35;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.saved2-tags{display:flex;flex-wrap:wrap;gap:3px}.saved2-tag{font-size:8px;padding:1px 4px;border-radius:5px;background:var(--surface-3);color:var(--muted)}
.saved2-set-actions{display:flex;gap:4px;margin-top:4px}.saved2-set-actions .btn{height:27px;padding:0 7px;font-size:9px}.saved2-card .view-actions{align-self:center}.saved2-card .view-actions .icon-btn[disabled]{opacity:.35;cursor:default}
.saved-artifact-overlay{position:fixed;inset:0;z-index:260;background:rgba(8,15,28,.38);backdrop-filter:blur(3px);display:grid;place-items:center;padding:18px}.saved-artifact-overlay[hidden]{display:none}.saved-artifact-card{width:min(520px,94vw);max-height:90vh;overflow:hidden;border:1px solid var(--border);border-radius:14px;background:var(--surface-1);box-shadow:0 26px 70px rgba(15,23,42,.28);display:flex;flex-direction:column}.saved-artifact-head{height:48px;display:flex;align-items:center;padding:0 12px 0 15px;border-bottom:1px solid var(--border);font-size:14px}.saved-artifact-head strong{flex:1}.saved-artifact-body{padding:13px 15px;overflow:auto}.saved-artifact-textarea{width:100%;resize:vertical;min-height:72px;border:1px solid var(--border);border-radius:9px;padding:8px 9px;background:var(--surface-2);outline:none;font:inherit;color:inherit}.saved-artifact-textarea:focus{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft)}.saved-artifact-check{display:flex;align-items:center;gap:7px;margin-top:12px;padding:8px;border-radius:9px;background:var(--surface-2);font-size:10px}.saved-artifact-check input{width:auto;margin:0;accent-color:var(--accent)}.saved-artifact-info{min-height:18px;margin-top:8px;font-size:10px;color:var(--muted)}.saved-artifact-info.error{color:var(--danger)}.saved-artifact-foot{display:flex;justify-content:flex-end;gap:7px;padding:10px 15px;border-top:1px solid var(--border);background:var(--surface-2)}
