  .btn3d { transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease; }
  .btn3d:hover:not(:disabled) { transform: translateY(-1px); }
  .btn3d:active:not(:disabled) { transform: translateY(0); }
  .btn3d:disabled { opacity: .38; cursor: not-allowed; }

  /* Draw 页绝不允许任何子元素制造横向滚动。 */
  html, body { width: 100%; max-width: 100%; overflow-x: hidden !important; }
  body { min-width: 0; }
  body.submit-modal-open { overflow: hidden !important; }
  .draw-main, .designer-workspace, .property-panel, .canvas-panel, .budget-panel,
  #canvas-wrapper, #segment-list, .segment-card { min-width: 0 !important; max-width: 100%; }
  #canvas-wrapper > .canvas-container { max-width: 100% !important; }
  #canvas-wrapper { background: #edf7e8 !important; --canvas-tools-top:8px; --canvas-tools-edge:8px; --canvas-tools-height:36px; container-type:inline-size; }
  #canvas-wrapper > .canvas-container { background: transparent !important; position: relative !important; z-index: 2; }
  #canvas-wrapper > .canvas-container canvas { background: transparent !important; }

  /* The quote form is a page-level modal. It must stay above the 2D toolbar,
     the 3D renderer and the sticky site header, regardless of their local
     stacking contexts. */
  #submit-modal {
    z-index: 1000 !important;
    isolation: isolate;
  }
  #submit-modal > [role="document"] {
    position: relative;
    z-index: 1;
  }

  /* Hide obsolete fields even if an older HTML template is served with this stylesheet. */
  #property-panel .param-deco,
  #property-panel [data-i18n="decoLabel"],
  #fence-deco-container, #fence-deco-mobile { display: none !important; }

  /* Shared-cost is a normal fifth fence parameter, not a promotional/callout card. */
  .param-shared-cost { min-width: 0; }
  .shared-cost-heading {
    display: block;
    margin: 0 0 .25rem;
    color: #334155;
    font-size: .75rem;
    font-weight: 800;
    line-height: 1.2;
  }
  .shared-cost-control {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    min-width: 0;
    min-height: 58px;
    padding: .62rem .72rem;
    border: 1px solid #e2e8f0;
    border-radius: .8rem;
    background: #fff;
    color: #334155;
    box-sizing: border-box;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
  }
  .shared-cost-control:hover { border-color: #94a3b8; background: #f8fafc; }
  .shared-cost-control:focus-within { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,.14); }
  .shared-cost-control:has(.shared-cost-checkbox:checked) { border-color: #34d399; background: #ecfdf5; }
  .shared-cost-checkbox {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-content: center;
    flex: 0 0 auto;
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    border: 2px solid #cbd5e1;
    border-radius: .35rem;
    background: #fff;
    cursor: pointer;
  }
  .shared-cost-checkbox::before {
    content: "";
    width: .48rem;
    height: .28rem;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform .12s ease;
  }
  .shared-cost-checkbox:checked { border-color: #059669; background: #059669; }
  .shared-cost-checkbox:checked::before { transform: rotate(-45deg) scale(1); }
  .shared-cost-copy { display: block; min-width: 0; flex: 1 1 auto; }
  .shared-cost-option { display: block; color: #334155; font-size: .72rem; font-weight: 800; line-height: 1.25; }
  .shared-cost-help { display: block; margin-top: .12rem; color: #64748b; font-size: .62rem; line-height: 1.35; }

  html[data-theme="dark"] .shared-cost-heading { color: #edf7f8; }
  html[data-theme="dark"] .shared-cost-control {
    background: #102630;
    border-color: #365560;
    color: #edf7f8;
  }
  html[data-theme="dark"] .shared-cost-control:hover { background: #15313b; border-color: #4b7180; }
  html[data-theme="dark"] .shared-cost-control:has(.shared-cost-checkbox:checked) {
    background: rgba(5, 150, 105, .16);
    border-color: #34d399;
  }
  html[data-theme="dark"] .shared-cost-checkbox { background: #0b1f27 !important; border-color: #66808a !important; }
  html[data-theme="dark"] .shared-cost-checkbox:checked { background: #059669 !important; border-color: #34d399 !important; }
  html[data-theme="dark"] .shared-cost-option { color: #edf7f8; }
  html[data-theme="dark"] .shared-cost-help { color: #aac1c9; }

html[data-theme="dark"] .material-overview-disclaimer { color: #8fa7b2 !important; }

  .canvas-view-controls {
    position: absolute;
    right: var(--canvas-tools-edge);
    top: var(--canvas-tools-top);
    z-index: 72;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: auto;
  }
  .canvas-history-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 9999px;
    border: 1px solid rgba(148,163,184,.45);
    background: rgba(255,255,255,.96);
    color: #334155;
    box-shadow: 0 4px 12px rgba(15,23,42,.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: 900 20px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .canvas-history-btn:hover:not(:disabled) { background: #f8fafc; transform: translateY(-1px); }
  .canvas-history-btn:active:not(:disabled) { transform: translateY(0) scale(.96); }
  .canvas-history-btn:disabled { opacity: .34; cursor: default; box-shadow: none; }
  .canvas-clear-btn:not(:disabled) {
    color: #b45309;
    background: rgba(255, 251, 235, .97);
    border-color: rgba(217, 119, 6, .34);
  }
  .canvas-clear-btn:hover:not(:disabled) { background: #fef3c7; }

  .canvas-3d-toggle {
    position: static;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 9999px;
    border: 2px solid rgba(255,255,255,.96);
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(15,118,110,.30), 0 2px 5px rgba(15,23,42,.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font: 900 11px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
  }
  .canvas-3d-toggle:hover { transform: translateY(-1px); filter: brightness(1.04); }
  .canvas-3d-toggle:active { transform: translateY(0) scale(.97); }
  .canvas-3d-toggle.active { background: linear-gradient(180deg, #334155 0%, #1e293b 100%) !important; border-color: rgba(255,255,255,.96) !important; color: #fff !important; }

  .draw-toggle-btn {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 34;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 9999px;
    border: 1px solid rgba(5,150,105,.38);
    background: rgba(255,255,255,.95);
    color: #475569;
    box-shadow: 0 3px 10px rgba(15,23,42,.10);
    font: 800 10px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .draw-toggle-btn.active {
    border-color: rgba(5,150,105,.55);
    background: rgba(236,253,245,.96);
    color: #047857;
  }
  #canvas-wrapper.drawing-disabled > .canvas-container,
  #canvas-wrapper.drawing-disabled > .canvas-container .upper-canvas,
  #canvas-wrapper.drawing-disabled > .canvas-container .lower-canvas {
    cursor: default;
    touch-action: pan-y pinch-zoom !important;
  }
  .draw-toggle-btn:not(.active) {
    border-color: rgba(100,116,139,.35);
    background: rgba(248,250,252,.96);
    color: #64748b;
  }

  .canvas-house-marker {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    z-index: 12;
    display: grid;
    place-items: center;
    pointer-events: none;
    user-select: none;
    border: 1px solid rgba(148,163,184,.42);
    border-radius: 9999px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 5px 14px rgba(15,23,42,.12);
  }
  .canvas-house-marker.hidden,
  .in-3d .canvas-house-marker { display: none !important; }
  .canvas-house-star {
    display: block;
    color: #f59e0b;
    font: 900 18px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-shadow: 0 1px 0 rgba(255,255,255,.95), 0 2px 4px rgba(146,64,14,.18);
  }
  /* Retired in v520; keep cached mixed-version markup from exposing the old house toggle. */
  .house-toggle-btn { display: none !important; }

  .gate-plan-marker {
    position: absolute;
    z-index: 25;
    pointer-events: none;
    transform-origin: center;
    width: 42px;
    height: 18px;
    border: 2px solid var(--gate-color, #475569);
    border-radius: 4px;
    background: rgba(255,255,255,.18);
    box-shadow: 0 2px 7px rgba(15,23,42,.12);
  }
  .gate-plan-marker::before {
    content: '';
    position: absolute;
    left: 4px;
    bottom: 3px;
    width: calc(100% - 8px);
    height: 2px;
    background: var(--gate-color, #475569);
    transform: rotate(-22deg);
    transform-origin: center;
    border-radius: 9999px;
    opacity: .9;
  }
  .gate-plan-marker.double::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 2px;
    bottom: 2px;
    width: 2px;
    transform: translateX(-50%);
    background: var(--gate-color, #475569);
    border-radius: 9999px;
    opacity: .95;
  }
  .three-preview {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: none;
    overflow: hidden;
    background: linear-gradient(180deg, #65bff3 0%, #b9e5fb 56%, #5b8f4d 57%, #39733d 100%);
    touch-action: none;
  }
  .three-preview.active { display: block; }
  .in-3d #draw-toggle-btn, .in-3d #house-toggle-btn { display:none; }
  .in-3d #length-popup { z-index:75; max-width:calc(100% - 12px); }
  .three-preview canvas { display: block; width: 100% !important; height: 100% !important; }
  .three-side-gate-position {
    position:absolute; top:4px; left:4px; z-index:5; width:min(286px,calc(100% - 8px));
    display:grid; gap:5px; padding:8px 9px; border:1px solid rgba(148,163,184,.45);
    border-radius:14px; background:rgba(255,255,255,.94); color:#0f172a;
    box-shadow:0 5px 18px rgba(15,23,42,.18); backdrop-filter:blur(8px);
  }
  .three-side-gate-position[hidden] { display:none !important; }
  .three-side-gate-position__top,
  .three-side-gate-position__row { display:flex; align-items:center; gap:8px; min-width:0; }
  .three-side-gate-position__top strong { font-size:11px; font-weight:900; white-space:nowrap; }
  .three-side-gate-position__row > span { min-width:54px; font-size:10px; font-weight:800; color:#64748b; white-space:nowrap; }
  .three-side-gate-position__row input[type="range"] { flex:1; min-width:90px; accent-color:#0f766e; touch-action:manipulation; }
  .three-side-gate-position__row output { width:38px; text-align:right; color:#0f766e; font-size:11px; font-weight:950; font-variant-numeric:tabular-nums; }
  @media (max-width:560px) {
    .three-side-gate-position { top:4px; left:4px; width:min(286px,calc(100% - 8px)); }
  }
  .three-preview-hud {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: calc(100% - 20px);
    padding: 6px 9px;
    border-radius: 9999px;
    background: rgba(15,23,42,.76);
    color: #fff;
    backdrop-filter: blur(8px);
    box-shadow: 0 5px 16px rgba(15,23,42,.18);
    font: 700 10px/1.15 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    pointer-events: none;
  }
  .view-mode-btn.active {
    background: #0f766e !important;
    border-color: #0f766e !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(15,118,110,.22);
  }
  .segment-card { overflow: hidden; overflow-wrap: anywhere; }

  .selection-delete-btn {
    position: static;
    z-index: auto;
    min-height: 29px;
    height: 29px;
    width: auto;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid rgba(190, 18, 60, .35);
    background: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%);
    color: #fff;
    box-shadow: none;
    font: 900 10px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
  }
  .selection-delete-btn:hover { background: linear-gradient(180deg, #e11d48 0%, #be123c 100%); transform: translateY(-1px); }
  .selection-delete-btn:active { transform: translateY(0) scale(.97); }
  .selection-delete-btn.hidden { display: none !important; }


  /* Fence quick actions are one contextual toolbar, not four unrelated floating pills. */
  .fence-action-toolbar {
    position: absolute;
    z-index: 39;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    width: max-content;
    max-width: calc(100% - 12px);
    padding: 3px;
    border: 1px solid rgba(148,163,184,.32);
    border-radius: 13px;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    box-shadow: 0 5px 16px rgba(15,23,42,.12);
    user-select: none;
  }
  .fence-action-toolbar.hidden { display: none !important; }
  .fence-action-toolbar .insert-gate-btn,
  .fence-action-toolbar .mirror-fence-btn,
  .fence-action-toolbar .selection-delete-btn {
    position: static !important;
    min-height: 29px;
    height: 29px;
    padding: 0 8px;
    border-width: 1px;
    border-radius: 10px;
    box-shadow: none;
    font-size: 10px;
    line-height: 1;
  }
  .fence-action-toolbar .mirror-fence-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .fence-action-toolbar.dense .insert-gate-btn,
  .fence-action-toolbar.dense .mirror-fence-btn,
  .fence-action-toolbar.dense .selection-delete-btn { padding-left: 7px; padding-right: 7px; }
  .insert-gate-btn {
    position: absolute;
    z-index: 39;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 9999px;
    border: 2px solid rgba(255,255,255,.96);
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 5px 16px rgba(5,150,105,.28), 0 2px 5px rgba(15,23,42,.16);
    font: 800 11px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
  }
  .insert-gate-btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
  .insert-gate-btn:active { transform: translateY(0) scale(.97); }
  .insert-gate-btn.hidden { display: none !important; }
  .mirror-fence-btn {
    position: absolute;
    z-index: 31;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 9999px;
    border: 1.5px solid rgba(124,58,237,.45);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,243,255,.96));
    color: #6d28d9;
    box-shadow: 0 3px 10px rgba(109,40,217,.15), 0 1px 3px rgba(15,23,42,.10);
    font: 900 10px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    white-space: nowrap;
  }
  .mirror-fence-btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
  .mirror-fence-btn:active { transform: translateY(0) scale(.97); }
  .mirror-fence-btn.hidden { display: none !important; }
  .side-gate-btn {
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
    box-shadow: 0 5px 16px rgba(2,132,199,.25), 0 2px 5px rgba(15,23,42,.15);
  }
  .drive-gate-btn {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 5px 16px rgba(217,119,6,.24), 0 2px 5px rgba(15,23,42,.15);
  }

  .drawing-length-label {
    position: absolute;
    z-index: 35;
    pointer-events: none;
    transform: translate(-50%, -100%);
    min-width: 58px;
    padding: 5px 9px;
    border-radius: 10px;
    background: rgba(15, 23, 42, .92);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .2);
    box-shadow: 0 5px 16px rgba(15, 23, 42, .24);
    font: 800 12px/1.1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-align: center;
    white-space: nowrap;
    user-select: none;
  }
  .drawing-length-label.hidden { display: none !important; }

  .smart-guide-layer {
    position: absolute;
    inset: 0;
    z-index: 23;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
  }
  .smart-guide-layer line {
    stroke: #a855f7;
    stroke-width: 1.6;
    stroke-dasharray: 6 4;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 1px 1px rgba(255,255,255,.9));
  }
  .smart-guide-layer circle {
    fill: #a855f7;
    stroke: #fff;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
  }
  .smart-guide-layer text {
    fill: #7e22ce;
    stroke: rgba(255,255,255,.96);
    stroke-width: 4px;
    paint-order: stroke fill;
    font: 800 11px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-anchor: middle;
    dominant-baseline: central;
  }
  .smart-guide-layer .smart-closure-ring {
    fill: rgba(16, 185, 129, .18);
    stroke: #059669;
    stroke-width: 2.5;
    stroke-dasharray: none;
    vector-effect: non-scaling-stroke;
  }
  .smart-guide-layer .smart-closure-text {
    fill: #047857;
    stroke: rgba(255,255,255,.98);
  }

  .fence-dimension-layer {
    position: absolute;
    inset: 0;
    z-index: 24;
    pointer-events: none;
    overflow: hidden;
    isolation: isolate;
  }
  .fence-dimension-leader-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    display: block;
    z-index: 1;
  }
  .fence-dimension-leader {
    fill: none;
    stroke: rgba(51, 65, 85, .82);
    stroke-width: 1.55;
    stroke-dasharray: 5 4;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 1px 0 rgba(255,255,255,.9));
  }
  .fence-dimension-label {
    position: absolute;
    z-index: 3;
    transform: translate(-50%, -50%);
    min-width: 52px;
    padding: 3px 7px;
    border-radius: 9999px;
    border: 1px solid rgba(148, 163, 184, .55);
    background: rgba(255, 255, 255, .92);
    color: #334155;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .10);
    font: 800 10px/1.15 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    pointer-events: auto;
    cursor: pointer;
    touch-action: none;
  }
  .fence-dimension-label.dragging { cursor: grabbing; box-shadow: 0 4px 14px rgba(15, 23, 42, .18); }
  .fence-dimension-label:active { transform: translate(-50%, -50%) scale(.96); }

  .admin-editor-bar { flex: 0 0 auto; }
  .admin-materials { min-width: 0; container-type: inline-size; }
  .material-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
  .material-stat { border: 1px solid #e2e8f0; border-radius: .75rem; background: #fff; padding: .7rem .8rem; }
  .material-stat span { display: block; color: #64748b; font-size: .72rem; }
  .material-stat strong { display: block; color: #0f172a; font-size: 1.1rem; margin-top: .12rem; }
  .material-group { border: 1px solid #e2e8f0; border-radius: .9rem; overflow: hidden; background: #fff; margin-top: .75rem; }
  .material-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
  .material-group-head h3 { margin: 0; font-size: .9rem; font-weight: 900; }
  .material-group-head p { margin: .15rem 0 0; color: #64748b; font-size: .72rem; }
  .material-group-head > strong { color: #047857; white-space: nowrap; }
  .material-table-wrap { overflow-x: auto; }
  .material-table { width: 100%; border-collapse: collapse; min-width: 650px; font-size: .76rem; }
  .material-table th, .material-table td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid #f1f5f9; }
  .material-table th { color: #64748b; background: #fff; white-space: nowrap; }
  .material-table th:nth-last-child(-n+3), .material-table td:nth-last-child(-n+3) { text-align: right; white-space: nowrap; }
  .material-warnings { margin-top: .75rem; padding: .8rem 1rem; border: 1px solid #fbbf24; border-radius: .75rem; background: #fffbeb; color: #92400e; font-size: .76rem; }
  .material-warnings ul { margin: .35rem 0 0; padding-left: 1.2rem; }
  .material-empty { padding: 2rem; text-align: center; color: #64748b; }

  .style-card.selected {
    border-color: #059669;
    background-color: #ecfdf5;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.25);
  }

  .ruler-corner { width: 24px; height: 24px; background: #f8fafc; border: 1px solid #e2e8f0; }
  .ruler-top { height: 24px; background: #f8fafc; border-bottom: 1px solid #cbd5e1; }
  .ruler-left { width: 24px; background: #f8fafc; border-right: 1px solid #cbd5e1; }
  .ruler-right { width: 24px; background: #f8fafc; border-left: 1px solid #cbd5e1; }
  .ruler-bottom { height: 24px; background: #f8fafc; border-top: 1px solid #cbd5e1; }

  .segment-card.active-segment {
    border-color: #059669 !important;
    background-color: #f0fdf4 !important;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.3) !important;
  }

  .custom-scrollbar { scrollbar-width: thin; scrollbar-color: #cbd5e1 #f1f5f9; }
  .custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
  .custom-scrollbar::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 8px; }
  .custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
  .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

  /* 关键：预算内容永远不能反向撑大 grid/flex 容器。 */
  .designer-workspace { min-width: 0; }
  .designer-workspace > * { min-width: 0; min-height: 0; }
  .budget-panel {
    min-height: 0 !important;
    max-height: 100%;
    overflow: hidden !important;
    contain: size layout paint;
  }
  .budget-list-scroll {
    min-height: 0 !important;
    max-height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  /* Admin project quote lives in a viewport-level collapsible layer instead of
     consuming the materials inspector. Closed state behaves like a compact coupon chip. */
  .admin-proposal-panel {
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 10px));
    z-index: 940;
    box-sizing: border-box;
    margin: 0;
  }
  .admin-proposal-panel:not([open]) {
    width: max-content;
    max-width: calc(100vw - 32px);
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .admin-proposal-panel[open] {
    width: min(410px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    border: 1px solid color-mix(in srgb,#22d3ee 45%,var(--bm-line,#a5f3fc));
    border-radius: 18px;
    background: var(--bm-surface,#ecfeff);
    color: var(--bm-text,#0f172a);
    box-shadow: 0 22px 58px rgba(15,23,42,.28), 0 5px 16px rgba(15,23,42,.16);
  }
  .admin-proposal-summary {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .admin-proposal-panel:not([open]) .admin-proposal-summary {
    min-height: 50px;
    padding: 7px 10px 7px 7px;
    border: 1px solid rgba(103,232,249,.45);
    border-radius: 16px;
    background: linear-gradient(135deg,#0b5f59 0%,#0f766e 58%,#0c6c64 100%);
    color: #fff;
    box-shadow: 0 13px 31px rgba(7,43,48,.23), 0 3px 10px rgba(7,43,48,.14);
  }
  .admin-proposal-panel[open] .admin-proposal-summary {
    padding: .75rem .8rem;
    border-bottom: 1px solid color-mix(in srgb,#22d3ee 45%,var(--bm-line,#a5f3fc));
    background: #0f766e;
    color: #fff;
  }
  .admin-proposal-summary::-webkit-details-marker { display: none; }
  .admin-proposal-summary::marker { content: ''; }
  .admin-proposal-summary:focus-visible { outline: 3px solid rgba(6,182,212,.25); outline-offset: 2px; border-radius: 16px; }
  .admin-proposal-launcher-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(165,243,252,.3);
    border-radius: 12px;
    background: rgba(255,255,255,.10);
    color: #cffafe;
    font: 950 18px/1 ui-monospace,SFMono-Regular,Menlo,monospace;
  }
  .admin-proposal-panel[open] .admin-proposal-launcher-icon { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
  .admin-proposal-title { min-width: 0; font-size: .78rem; font-weight: 950; white-space: nowrap; }
  .admin-proposal-chevron {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    margin-left: auto;
    border: 1px solid rgba(165,243,252,.45);
    border-radius: 9999px;
    background: rgba(255,255,255,.10);
    color: #ecfeff;
    font: 900 1.25rem/1 ui-sans-serif,system-ui,sans-serif;
    transition: transform .15s ease, background-color .15s ease;
  }
  .admin-proposal-panel[open] .admin-proposal-chevron { transform: rotate(90deg); }
  .admin-proposal-content {
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .8rem;
  }
  @media (max-width: 760px) {
    .admin-proposal-panel { right: max(10px, env(safe-area-inset-right, 0px)); bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 6px)); }
    .admin-proposal-panel[open] { left: max(10px, env(safe-area-inset-left, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); width: auto; max-height: calc(100dvh - 20px); }
    .admin-proposal-content { max-height: calc(100dvh - 82px); }
  }

  @media (min-width: 1024px) {
    .designer-workspace {
      /* JS subtracts the measured header/toolbar height from the visible screen. */
      grid-template-columns: minmax(180px, 216px) minmax(0, 1fr) minmax(220px, 264px);
      height: var(--drawing-panel-height, calc(100svh - 150px));
      max-height: none;
      grid-template-rows: minmax(0, 1fr);
      overflow: hidden;
    }
    .designer-workspace > * { grid-column: auto; height: 100%; max-height: 100%; overflow: hidden; }
    .canvas-panel { min-height: 0; }
    .budget-panel { height: 100%; overflow-y: auto !important; }
    .budget-panel > .flex-1 { flex-shrink: 0; min-height: 220px; }
    .admin-budget-panel > .flex-1 { min-height: 360px; }
  }

  /* 手机：严格单列、无横向滚动；5 个参数压缩成 2 行，为画布释放更多垂直空间。 */
  @media (max-width: 1023px) {
    .draw-main {
      width: 100% !important;
      max-width: 100vw !important;
      padding: .35rem .45rem .6rem !important;
      overflow-x: hidden !important;
    }
    .designer-workspace {
      width: 100% !important;
      max-width: 100% !important;
      display: flex !important;
      flex-direction: column;
      flex: none;
      height: auto;
      gap: .45rem !important;
      overflow: visible;
    }
    .property-panel {
      order: 1;
      width: 100% !important;
      height: auto !important;
      flex: none;
      padding: .5rem !important;
      overflow: hidden !important;
      border-radius: .9rem !important;
    }
    .canvas-panel {
      order: 2;
      width: 100% !important;
      /* Initial visible space; same-width mobile browser chrome changes keep it stable. */
      flex: none;
      height: var(--drawing-panel-height, calc(100svh - 260px)) !important;
      min-height: 0 !important;
      max-height: var(--drawing-panel-height, calc(100svh - 260px)) !important;
      border-radius: .9rem !important;
      padding: .4rem !important;
      overflow: hidden !important;
    }
    .budget-panel {
      order: 3;
      width: 100% !important;
      flex: none;
      height: 300px !important;
      min-height: 300px !important;
      max-height: 300px !important;
      border-radius: .9rem !important;
      padding: .65rem !important;
      overflow: hidden !important;
    }
    .property-heading { display: none; }

    /* 两行等分布局：第一行 Material / Height / Color 各 1/3；第二行 Style / Shared Cost 各 1/2。 */
    #style-fieldset {
      display: grid !important;
      grid-template-columns: repeat(12, minmax(0, 1fr));
      grid-auto-flow: row;
      gap: .3rem .32rem !important;
      overflow: hidden !important;
      padding: 0 !important;
    }
    #style-fieldset > * { margin-top: 0 !important; }
    .param-type { grid-column: span 4; }
    .param-pair { display: contents; }
    .param-pair > .param-block:first-child { grid-column: span 4; }
    .param-pair > .param-block:last-child { grid-column: span 4; }
    .param-style { grid-column: span 6; }
    .param-shared-cost { grid-column: span 6; min-width: 0; }
    .param-block { min-width: 0; }
    .param-block label {
      display: block;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 9px !important;
      margin-bottom: 2px !important;
      line-height: 1.15;
    }
    .param-block select {
      width: 100%;
      max-width: 100%;
      min-width: 0;
      min-height: 30px;
      height: 30px;
      padding: .18rem 1.35rem .18rem .42rem !important;
      font-size: 10px !important;
      border-radius: .58rem !important;
      text-overflow: ellipsis;
    }
    .shared-cost-heading {
      max-width: 100%;
      margin: 0 0 2px !important;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 9px !important;
      line-height: 1.15;
    }
    .param-shared-cost .shared-cost-control {
      display: flex !important;
      align-items: center !important;
      gap: .42rem !important;
      width: 100%;
      max-width: 100%;
      min-height: 30px;
      height: 30px;
      margin: 0 !important;
      padding: .2rem .45rem !important;
      overflow: hidden !important;
      white-space: normal !important;
      border-radius: .58rem !important;
      text-overflow: clip !important;
    }
    .param-shared-cost .shared-cost-checkbox { width: 16px; height: 16px; border-radius: .3rem; }
    .param-shared-cost .shared-cost-option {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 10px !important;
      line-height: 1.1;
    }
    .param-shared-cost .shared-cost-help { display: none !important; }
    .param-shared-cost .shared-cost-copy { min-width: 0; }
    .desktop-option-cards { display: none !important; }
    .mobile-option-select { display: block !important; }
    .canvas-hint { font-size: 9px !important; line-height: 1.2; min-width: 0; }
    #canvas-wrapper { --canvas-tools-top:6px; --canvas-tools-edge:6px; --canvas-tools-height:30px; }
    .canvas-view-controls { gap: 3px; }
    .canvas-history-btn { width: 30px; min-width: 30px; height: 30px; font-size: 18px; }
    #view3d-btn { min-height: 30px; height: 30px; padding: 0 8px !important; font-size: 9px; }
    #view3d-label { display: inline !important; font-size: 9px; white-space: nowrap; }
    #segment-list { flex: 1 1 0%; min-height: 0 !important; max-height: none !important; overflow-x: hidden !important; }
    /* 手机端浮层必须让位给长度标签和拖动区域：视觉按钮压到 28–30px，并通过空隙/位置避让保持可点。 */
    .draw-toggle-btn { left: 6px; top: 6px; min-height: 28px; height: 28px; padding: 0 7px; font-size: 9px; }
    .house-toggle-btn { top: 40px; }
    .selection-delete-btn { min-height: 30px; height: 30px; width: auto; padding: 0 7px; font-size: 9.5px; border-width: 1px; }
    .insert-gate-btn { min-height: 28px; height: 28px; padding: 0 7px; font-size: 9px; border-width: 1.5px; box-shadow: 0 2px 7px rgba(5,150,105,.17), 0 1px 2px rgba(15,23,42,.10); }
    .fence-action-toolbar { gap: 3px; padding: 3px; border-radius: 11px; }
    .fence-action-toolbar .insert-gate-btn, .fence-action-toolbar .mirror-fence-btn, .fence-action-toolbar .selection-delete-btn { min-height: 30px; height: 30px; padding: 0 7px; font-size: 9.5px; border-width: 1px; box-shadow: none; }
    .side-gate-btn { box-shadow: 0 3px 10px rgba(2,132,199,.18), 0 1px 3px rgba(15,23,42,.10); }
    .mirror-fence-btn { min-height: 28px; height: 28px; padding: 0 8px; font-size: 9px; border-width: 1.5px; }
    .house-toggle-btn { min-height: 28px; height: 28px; padding: 0 7px; font-size: 9px; }
    .fence-dimension-label { min-width: 42px; padding: 3px 5px; font-size: 9px; }
    .material-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .material-stat:first-child { grid-column: span 2; }
    #length-popup { max-width: calc(100% - 12px); padding: .5rem !important; gap: .35rem !important; }
    #popup-len-input { width: 4.5rem !important; min-height: 36px; font-size: 16px !important; }

    /* 共享 header 在 draw 页手机端只保留公司入口 + 语言切换，防止右侧动作按钮撑出屏幕。 */
    #site-header header.navbar {
      width: 100% !important;
      max-width: 100vw !important;
      min-width: 0 !important;
      padding-left: .5rem !important;
      padding-right: .5rem !important;
      gap: .2rem !important;
      overflow: hidden !important;
    }
    #site-header header.navbar > .flex-1 {
      flex: 1 1 0% !important;
      min-width: 0 !important;
      margin-right: .2rem !important;
      overflow: hidden !important;
    }
    #site-header header.navbar > .flex-none {
      flex: 0 0 auto !important;
      min-width: 0 !important;
      gap: .2rem !important;
    }
    #site-header header.navbar > .flex-none > a { display: none !important; }
    #site-header header.navbar .join { flex-wrap: nowrap !important; }
    #site-header header.navbar .join .btn {
      min-height: 1.7rem !important;
      height: 1.7rem !important;
      padding-left: .38rem !important;
      padding-right: .38rem !important;
      font-size: 10px !important;
    }
  }

  /* Short landscape screens put parameters beside the canvas, not above it. */
  @media (min-width: 640px) and (max-width: 1023px) and (orientation: landscape) and (max-height: 550px) {
    .designer-workspace {
      display: grid !important;
      grid-template-columns: 190px minmax(0, 1fr);
      grid-template-rows: var(--drawing-panel-height, calc(100svh - 150px)) 300px;
    }
    .property-panel { height: 100% !important; min-height: 0 !important; }
    #style-fieldset { display: block !important; overflow-y: auto !important; }
    #style-fieldset > * { margin-bottom: .4rem; }
    .param-pair { display: grid; grid-template-columns: 1fr 1fr; }
    .param-pair > .param-block { grid-column: auto !important; }
    .budget-panel { grid-column: 1 / -1; }
  }

  /* Use actual canvas width: desktop sidebars can also leave a narrow viewport. */
  @container (max-width:420px) {
    .in-3d .canvas-view-controls { gap:3px; align-items:flex-start; }
    .in-3d .canvas-history-btn { width:28px; min-width:28px; height:30px; font-size:17px; }
    .in-3d #view3d-btn { width:36px; min-height:30px; height:30px; padding:0 !important; gap:0; font-size:0; }
    .in-3d #view3d-label { display:none !important; }
    .in-3d #view3d-btn::after { content:'2D'; font-size:11px; }
  }
  @media print {
    #site-header, .admin-editor-bar, .draw-main, .admin-material-actions, body > footer { display: none !important; }
    body { background: #fff !important; }
    .admin-materials { width: 100% !important; margin: 0 !important; border: 0 !important; box-shadow: none !important; }
    .material-group { break-inside: avoid; }
  }


  @media (max-width: 380px) {
    .draw-main { padding-left: .3rem !important; padding-right: .3rem !important; }
    #site-header header.navbar .join .btn { padding-left: .3rem !important; padding-right: .3rem !important; font-size: 9px !important; }
  }

  @media (min-width: 1024px) {
    .mobile-option-select { display: none !important; }
  }

/* v18: 删除动作并入上下文工具条，只保留红色 × 图标，减少手机横向占用。 */
.fence-action-toolbar .selection-delete-btn {
  width: 34px !important;
  min-width: 34px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  font-size: 20px !important;
  line-height: 1 !important;
}
@media (max-width: 767px) {
  .fence-action-toolbar .selection-delete-btn {
    width: 30px !important;
    min-width: 30px !important;
    font-size: 18px !important;
  }
}

/* v264 live planned-material editor: formula material is primary; inventory Product is optional. */
#materials-card{background:var(--bm-surface,#fff)!important;border-color:var(--bm-line,#e2e8f0)!important;color:var(--bm-text,#0f172a)}#materials-card>div:first-child{border-color:var(--bm-line,#e2e8f0)!important}.admin-material-heading{min-width:0;flex:1 1 360px}.quote-material-editor{display:grid;gap:10px}.quote-material-editor__toolbar{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:0 2px 4px;font-size:.75rem}.quote-material-cost-summary{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 18px;margin-top:3px}.quote-material-cost-summary__metric{display:flex;align-items:baseline;gap:6px;min-width:0}.quote-material-cost-summary span{font-size:.6rem;font-weight:850;color:var(--bm-text-soft,#64748b)}.quote-material-cost-summary strong{font-size:.82rem;color:var(--bm-text,#0f172a);white-space:nowrap}.quote-material-editor__notice{margin:0;padding:9px 11px;border:1px solid #fde68a;border-radius:11px;background:#fffbeb;color:#92400e;font-size:.68rem;line-height:1.5}.quote-material-row{display:grid;grid-template-columns:minmax(180px,1.15fr) minmax(130px,.78fr) minmax(200px,1.28fr) minmax(70px,.42fr) minmax(82px,.48fr) minmax(104px,auto);grid-template-areas:"material type product auto plan actions";gap:6px;align-items:start;padding:10px;border:1px solid var(--bm-line,#e2e8f0);border-radius:14px;background:var(--bm-surface,#fff);transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease}.quote-material-row.has-costs{grid-template-columns:minmax(180px,1.05fr) minmax(120px,.68fr) minmax(170px,1.05fr) minmax(68px,.38fr) minmax(78px,.42fr) minmax(78px,.44fr) minmax(78px,.44fr) minmax(104px,auto);grid-template-areas:"material type product auto plan cost subtotal actions"}.quote-material-row__material{grid-area:material}.quote-material-row__type{grid-area:type}.quote-material-row__product{grid-area:product}.quote-material-row__auto{grid-area:auto}.quote-material-row__plan{grid-area:plan}.quote-material-row__cost{grid-area:cost}.quote-material-row__subtotal{grid-area:subtotal}.quote-material-row__actions{grid-area:actions}.quote-material-row.is-adjusted{background:var(--bm-surface-soft,#f8fafc)}.quote-material-row.is-segment-active{border-color:#10b981;background:#ecfdf5;box-shadow:0 0 0 3px rgba(16,185,129,.14)}.quote-material-row label,.quote-material-readonly,.quote-material-smart-field{display:grid;gap:4px;min-width:0}.quote-material-row label>span,.quote-material-readonly>span,.quote-material-smart-field>span{font-size:.58rem;font-weight:800;color:var(--bm-text-soft,#64748b)}.quote-material-row select,.quote-material-row input{width:100%;min-width:0;height:38px;border:1px solid var(--bm-line,#cbd5e1);border-radius:10px;background:var(--bm-surface,#fff);padding:0 9px;font-size:.72rem;font-weight:700;color:var(--bm-text,#0f172a)}.quote-material-readonly strong{display:flex;align-items:center;min-height:38px;font-size:.7rem;overflow-wrap:anywhere}.quote-material-row__material{align-self:start;display:grid;gap:3px;min-width:0}.quote-material-row__eyebrow{font-size:.58rem;font-weight:900;color:#0f766e}.quote-material-row__material>strong{font-size:.76rem;color:var(--bm-text,#0f172a);overflow-wrap:anywhere}.quote-material-row__material>small{font-size:.56rem;line-height:1.45;color:var(--bm-text-soft,#64748b);overflow-wrap:anywhere}.quote-material-row__spec{font-weight:700;color:var(--bm-text-soft,#334155)!important}.quote-material-row__segments{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}.quote-material-row__segments span{display:inline-flex;align-items:center;min-height:22px;padding:2px 7px;border:1px solid #a7f3d0;border-radius:999px;background:#f0fdf4;color:#047857;font-size:.55rem;font-weight:900;white-space:nowrap}.quote-material-row.is-segment-active .quote-material-row__segments span{background:#dcfce7;border-color:#6ee7b7}.quote-material-row__actions{display:flex;gap:5px;align-items:center;justify-content:flex-end}.quote-material-row__actions button{min-height:36px;padding:0 8px;border:1px solid var(--bm-line,#cbd5e1);border-radius:10px;background:var(--bm-surface,#fff);font-size:.62rem;font-weight:800;white-space:nowrap}.quote-material-row__actions button:first-child{border-color:#0f766e;color:#0f766e}.quote-material-row--draft{border-style:dashed;background:var(--bm-surface-soft,#f8fafc)}.quote-material-row--draft:focus-within{border-color:#0f766e;box-shadow:0 0 0 3px rgba(15,118,110,.10)}.quote-material-smart{min-width:0}.quote-material-smart .contractor-smart-menu{z-index:120}
@container (max-width:900px){.quote-material-row{grid-template-columns:minmax(130px,.78fr) minmax(200px,1.25fr) minmax(70px,.4fr) minmax(82px,.46fr) minmax(104px,auto);grid-template-areas:"material material material material material" "type product auto plan actions"}.quote-material-row.has-costs{grid-template-columns:minmax(120px,.7fr) minmax(170px,1.05fr) minmax(68px,.38fr) minmax(78px,.42fr) minmax(78px,.44fr) minmax(78px,.44fr) minmax(104px,auto);grid-template-areas:"material material material material material material material" "type product auto plan cost subtotal actions"}.quote-material-row__material{padding-bottom:6px;border-bottom:1px solid var(--bm-line,#eef2f7)}.quote-material-row__material .quote-material-breakdown{display:flex;flex-wrap:wrap;gap:4px 10px;margin:2px 0}.quote-material-row__material .quote-material-breakdown__line{display:inline-flex;justify-content:flex-start;gap:6px;padding:2px 0}.quote-material-row__material .quote-material-breakdown__note{flex-basis:100%}}
@media(max-width:760px){.quote-material-cost-summary{gap:3px 12px}.quote-material-row,.quote-material-row.has-costs{grid-template-columns:1fr 1fr;gap:9px;padding:11px;grid-template-areas:"material material" "type type" "product product" "auto plan" "actions actions"}.quote-material-row.has-costs{grid-template-areas:"material material" "type type" "product product" "auto plan" "cost subtotal" "actions actions"}.quote-material-row__material{padding-bottom:0;border-bottom:0}.quote-material-row select,.quote-material-row input{font-size:16px}.quote-material-row__actions{justify-content:stretch}.quote-material-row__actions button{flex:1}.admin-material-actions{width:100%;display:grid!important;grid-template-columns:1fr 1fr}.admin-material-actions button{min-width:0;padding-left:7px!important;padding-right:7px!important}}

.quote-material-row__basis{font-size:.65rem;line-height:1.55;color:#475569;overflow-wrap:anywhere}.quote-material-row__basis summary{cursor:pointer;color:#0f766e;padding:5px 0}.quote-material-row__basis p{margin:5px 0}.quote-material-row__basis a{color:#0f766e;text-decoration:underline}
.quote-material-config{display:grid;gap:9px;padding:11px 12px;border:1px solid #f59e0b;border-radius:13px;background:#fffbeb;color:#78350f}.quote-material-config__title{font-size:.72rem;font-weight:950}.quote-material-config__section{display:grid;grid-template-columns:minmax(180px,.9fr) minmax(220px,1.6fr) auto;gap:10px;align-items:center;padding-top:8px;border-top:1px solid #fde68a}.quote-material-config__section>div:first-child{display:grid;gap:2px}.quote-material-config__section>div:first-child strong{font-size:.66rem}.quote-material-config__section>div:first-child small{font-size:.58rem;line-height:1.45;color:#92400e}.quote-material-config__formula-list{display:grid;gap:6px}.quote-material-config__formula-list>div{display:grid;gap:2px}.quote-material-config__formula-list>div>strong{font-size:.62rem}.quote-material-config__section>a{display:inline-flex;align-items:center;justify-content:center;min-height:32px;padding:0 10px;border:1px solid #d97706;border-radius:9px;background:#fff;color:#92400e;font-size:.6rem;font-weight:900;text-decoration:none;white-space:nowrap}.quote-material-row.has-config-missing{border-color:#f59e0b}.quote-material-field--missing>span b{color:#b45309}.quote-material-field--missing select,.quote-material-field--missing .contractor-smart-control input{border-color:#f59e0b;background:#fffbeb}.quote-material-config .quote-material-row__segments{margin-top:3px}.quote-material-config .quote-material-row__segments span{border-color:#fcd34d;background:#fff7ed;color:#9a3412}
@media(max-width:760px){.quote-material-config__section{grid-template-columns:1fr}.quote-material-config__section>a{width:100%}}

/* v266: one collapsed summary per material; editable source rows stay inside. */
.quote-material-group{min-width:0;border:1px solid var(--bm-line,#e2e8f0);border-radius:14px;background:var(--bm-surface,#fff);color:var(--bm-text,#0f172a);overflow:hidden}.quote-material-group[open]{overflow:visible}
.quote-material-group__summary{display:grid;grid-template-columns:34px minmax(160px,1fr) minmax(105px,.32fr) minmax(105px,.32fr);gap:12px;align-items:center;padding:13px 15px;cursor:pointer;list-style:none}
.quote-material-group.has-costs>.quote-material-group__summary{grid-template-columns:34px minmax(160px,1fr) minmax(105px,.32fr) minmax(105px,.32fr) minmax(80px,.25fr)}.quote-material-group__summary::-webkit-details-marker{display:none}
.quote-material-group__summary:focus-visible{outline:3px solid #10b981;outline-offset:-3px}
.quote-material-group__toggle{display:grid;place-items:center;width:32px;height:32px;border:1px solid #99d5ca;border-radius:9px;color:#0f766e;font-size:21px}
.quote-material-group__toggle>span:last-child{display:none}
.quote-material-group[open]>.quote-material-group__summary .quote-material-group__toggle>span:first-child{display:none}
.quote-material-group[open]>.quote-material-group__summary .quote-material-group__toggle>span:last-child{display:inline}
.quote-material-group__name,.quote-material-group__metric{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}
.quote-material-group__name>strong{font-size:.85rem;color:var(--bm-text,#0f172a)}
.quote-material-group__name>small,.quote-material-group__metric>small{font-size:.65rem;color:var(--bm-text-soft,#64748b)}
.quote-material-group__metric>strong{font-size:.78rem;color:var(--bm-text,#0f172a)}
.quote-material-group__details{display:grid;gap:8px;padding:10px;border-top:1px solid var(--bm-line,#e2e8f0);background:var(--bm-surface-soft,#f8fafc)}
.quote-material-group.is-segment-active{border-color:#10b981;box-shadow:0 0 0 2px rgba(16,185,129,.12)}
.quote-material-group.is-segment-active>.quote-material-group__summary{background:#ecfdf5}
.quote-material-breakdown{display:grid;gap:4px;margin:5px 0}
.quote-material-breakdown__line{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:4px 6px;border-radius:7px;font-size:.7rem}
.quote-material-breakdown__line>strong{white-space:nowrap}
.quote-material-breakdown__line small,.quote-material-breakdown__note{display:block;font-size:.62rem;line-height:1.5;color:#64748b}
.quote-material-breakdown__line.is-segment-active{background:#d1fae5}
@media(max-width:760px){.quote-material-group__summary,.quote-material-group.has-costs>.quote-material-group__summary{grid-template-columns:32px 1fr 1fr 1fr;gap:10px;padding:11px}.quote-material-group__name{grid-column:2/-1}.quote-material-group__metric:nth-child(3){grid-column:2}.quote-material-group__details{padding:6px}.quote-material-group__name>strong{font-size:.9rem}}

/* Keep the quote action within reach while viewing the finished garden. */
.three-scene-quote { position:absolute; left:50%; bottom:48px; transform:translateX(-50%); z-index:45; max-width:calc(100% - 32px); padding:10px 18px; border:1px solid #ffffff80; border-radius:24px; background:#176c53; color:#fff; font:700 12px/1.3 system-ui,sans-serif; white-space:nowrap; box-shadow:0 4px 16px #193d3830; cursor:pointer; }
.three-scene-quote:hover { background:#11563f; }
.three-scene-quote:focus-visible { outline:3px solid #eacc7b; outline-offset:3px; }


/* v549: fullscreen keeps the same 2D/3D controls while maximizing touch area. */
.canvas-panel.bm-view-fullscreen {
  padding-top: max(.35rem, env(safe-area-inset-top));
  padding-right: max(.35rem, env(safe-area-inset-right));
  padding-bottom: max(.35rem, env(safe-area-inset-bottom));
  padding-left: max(.35rem, env(safe-area-inset-left));
  background: var(--surface, #fff);
}
.canvas-panel.bm-view-fullscreen > :first-child { border-radius: 14px; }
.canvas-fullscreen-btn[aria-pressed="true"] { background:#0f766e; color:#fff; border-color:#0f766e; }
