/* Foundry workbench drawing system.
 *
 * Foundry colors describe objects in a technical visualization, not
 * ordinary app decoration: a glass cell's tint means "glazing", a stroke is
 * a real frame member. Those meanings live here as semantic tokens; each
 * theme decides what the token resolves to. Template markup carries only
 * structural/semantic classes — never hex values.
 *
 * Structural classes (.foundry-*) are page-scoped and consumed by
 * static/js/foundry/render.js. This sheet is served directly (like
 * theme.css); changes here need no Tailwind rebuild.
 */

:root,
:root[data-theme="classic"] {
    --foundry-canvas-background: #eef2f3;
    --foundry-glass-fill: #dbeafe;
    --foundry-glass-assigned-fill: #67e8f9;
    --foundry-glass-edge: #93c5fd;
    --foundry-stick-fill: #e2e8f0;
    --foundry-stick-edge: #94a3b8;
    --foundry-stick-selected-fill: #fecdd3;
    --foundry-divider-stroke: #0e7490;
    --foundry-selection-stroke: #e11d48;
    --foundry-preview-stroke: #0891b2;
    --foundry-preview-fill: rgba(8, 145, 178, 0.15);
    --foundry-dimension-text: #334155;
    --foundry-dimension-label: #1e293b;
    --foundry-dimension-active: #be123c;
    --foundry-dimension-line: #94a3b8;
    --foundry-dimension-extension: #cbd5e1;
    --foundry-dimension-halo: #ffffff;
    --foundry-smart-guide-stroke: #0284c7;
    --foundry-smart-guide-text: #0369a1;
    --foundry-hardware-fill: #bfc3c5;
    --foundry-door-glass-fill: #bed3d5;
    --foundry-door-edge: #45534c;
    --foundry-hinge-key: #c58730;
    --foundry-lock-key: #c64a40;
    --foundry-pull-key: #3988b9;
    --foundry-closer-key: #239d79;
}

:root[data-theme="dark"] {
    --foundry-canvas-background: var(--theme-surface-subtle);
    --foundry-glass-fill: #d6e9f5;
    --foundry-glass-assigned-fill: #c9e4f2;
    --foundry-stick-fill: #475569;
    --foundry-stick-edge: #64748b;
    --foundry-stick-selected-fill: #9f1239;
    --foundry-dimension-text: #e2e8f0;
    --foundry-dimension-label: #f8fafc;
    --foundry-dimension-active: #fb7185;
    --foundry-dimension-line: #64748b;
    --foundry-dimension-extension: #475569;
    --foundry-dimension-halo: var(--foundry-canvas-background, #0a1418);
    --foundry-smart-guide-stroke: #38bdf8;
    --foundry-smart-guide-text: #7dd3fc;
}

/* Drawing sheet */
#foundry-canvas-region { background-color: var(--foundry-canvas-background); }
#foundry-canvas { touch-action: none; }

/* Door Studio layout adapted from the glazing portal; shared BMS form controls. */
.foundry-door-dialog { width: min(1220px, 100%); max-height: calc(100dvh - 2rem); }
.foundry-door-editor { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); color: var(--theme-foreground); }
.foundry-door-heading, .foundry-door-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.5rem; background: var(--theme-surface-raised); }
.foundry-door-heading { border-bottom: 1px solid var(--theme-border); }
.foundry-door-heading h2 { margin-top: .3rem; font-size: 1.3rem; font-weight: 700; }
.foundry-door-heading p:not(.foundry-door-kicker) { margin-top: .3rem; font-size: .85rem; opacity: .7; }
.foundry-door-kicker { color: var(--theme-primary); font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.foundry-door-editor-body { display: grid; grid-template-columns: minmax(320px, 410px) minmax(0, 1fr); gap: 1.5rem; overflow-y: auto; padding: 1.5rem; background: var(--theme-surface-subtle); }
.foundry-door-fields { display: flex; flex-direction: column; gap: .8rem; }
.foundry-door-section > summary { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; cursor: pointer; font-size: .85rem; font-weight: 700; list-style: none; }
.foundry-door-section > summary::-webkit-details-marker { display: none; }
.foundry-door-section > summary span { color: var(--theme-primary); font-size: .65rem; letter-spacing: .05em; }
.foundry-door-section > summary::after { content: '+'; margin-left: auto; opacity: .6; }
.foundry-door-section[open] > summary::after { content: '−'; }
.foundry-door-section[open] > summary { border-bottom: 1px solid var(--theme-border); }
.foundry-door-section-body { display: flex; flex-direction: column; gap: .9rem; padding: 1rem; }
.foundry-door-section-body label { font-size: .75rem; }
.foundry-door-section-body input, .foundry-door-section-body select { min-width: 0; }
.foundry-door-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.foundry-door-more > summary { cursor: pointer; font-size: .75rem; opacity: .75; }
.foundry-door-more .foundry-door-section-body { padding: 1rem 0 0; }
.foundry-door-preview-column { position: sticky; top: 0; align-self: start; min-width: 0; max-height: calc(100dvh - 290px); overflow-y: auto; }
.foundry-door-preview-heading { display: flex; align-items: center; justify-content: space-between; padding: 1rem; }
.foundry-door-live { border-radius: 999px; padding: .25rem .65rem; background: var(--theme-success-surface); color: var(--theme-success-foreground); font-size: .7rem; font-weight: 600; }
.foundry-door-preview-heading .foundry-door-kicker, .foundry-door-reference > .foundry-door-kicker { color: var(--theme-foreground); }
.foundry-door-preview-column nav { flex-wrap: wrap; padding: 0 1rem; }
.foundry-door-reference { padding: 1rem; }
.foundry-door-reference-intro, .foundry-door-reference-note { margin: .6rem 0 1rem; font-size: .75rem; line-height: 1.6; opacity: .75; }
.foundry-door-reference figure { margin-top: 1rem; }
/* A light drawing sheet preserves contrast in the supplied profile artwork. */
.foundry-door-reference-paper { padding: 1.5rem; background: #f3f6f4; border: 1px solid var(--theme-border); border-radius: .5rem; }
.foundry-door-reference-paper img { display: block; width: 100%; height: 260px; object-fit: contain; }
.foundry-door-reference figcaption { margin-top: .8rem; font-size: .8rem; }
.foundry-door-reference figcaption p { margin-top: .5rem; font-size: .7rem; line-height: 1.6; overflow-wrap: anywhere; opacity: .7; }
.foundry-door-reference-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: .8rem; }
.foundry-door-reference-metrics dt { font-size: .65rem; opacity: .7; }
.foundry-door-reference-metrics dd { margin-top: .2rem; font-size: .8rem; font-weight: 600; }
.foundry-door-reference-layout { display: block; width: 100%; height: 410px; object-fit: contain; background: #f3f6f4; border: 1px solid var(--theme-border); border-radius: .5rem; }
.foundry-door-stage { padding: .6rem; background: var(--foundry-canvas-background); }
.foundry-door-stage svg { display: block; width: 100%; max-height: 460px; }
.foundry-door-model-canvas { width: 100%; height: 420px; }
.foundry-door-model-canvas canvas { display: block; width: 100%; height: 100%; touch-action: none; border-radius: .4rem; }
.foundry-door-model-canvas canvas:focus-visible { outline: 2px solid var(--theme-primary); outline-offset: 2px; }
.foundry-door-model-controls { display: flex; gap: .4rem; }
.foundry-door-model-help { margin-top: .4rem; font-size: .7rem; opacity: .7; }
.foundry-door-sections { padding: 1rem; }
.foundry-door-sections > p { margin-bottom: .75rem; font-size: .75rem; line-height: 1.6; }
.foundry-door-section-study { margin: 1rem 0; }
.foundry-door-section-study svg { display: block; width: 100%; background: #f3f6f4; border-radius: .4rem; }
.foundry-door-section-study figcaption { margin-top: .5rem; font-size: .72rem; line-height: 1.6; }
.door-plan-threshold { fill: #aeb7ba; fill-opacity: .25; stroke: var(--foundry-stick-edge); stroke-width: .5; }
.foundry-door-section-marker { cursor: pointer; pointer-events: all; }
.foundry-door-section-marker circle { fill: #fff; stroke: #0e7490; stroke-width: 1.5; }
.foundry-door-section-marker text { fill: #0e7490; font-size: 9px; font-weight: 700; pointer-events: none; }
.foundry-door-section-marker:hover circle, .foundry-door-section-marker.selected circle, .foundry-door-section-marker:focus circle { fill: #cffafe; stroke-width: 2.5; }
.foundry-door-section-marker:focus { outline: none; }
.foundry-door-stage .foundry-door-opening { stroke-width: 1; vector-effect: non-scaling-stroke; }
.foundry-door-stage .foundry-door-rail { stroke-width: .6; vector-effect: non-scaling-stroke; }
.foundry-door-stage .foundry-door-swing, .foundry-door-stage .foundry-door-swing-double { stroke-width: .7; vector-effect: non-scaling-stroke; }
.foundry-door-stage .door-preview-label { fill: var(--foundry-dimension-text); font-size: 12px; text-anchor: middle; }
.foundry-door-stage .door-plan-wall { stroke: var(--foundry-stick-edge); stroke-width: 12; }
.foundry-door-stage .door-plan-leaf { fill: var(--door-metal-color, var(--foundry-stick-fill)); stroke: var(--foundry-dimension-text); stroke-width: 1; }
.foundry-door-stage .door-plan-glazing { fill: none; stroke: var(--foundry-glass-edge); stroke-width: 2; }
.foundry-door-stage .door-plan-closed { stroke: var(--foundry-stick-edge); stroke-width: 2; stroke-dasharray: 5 4; }
.foundry-door-stage .door-plan-arc { fill: none; stroke: var(--foundry-stick-edge); stroke-width: 1.5; stroke-dasharray: 5 4; }
.foundry-door-stage .door-plan-pivot { fill: var(--foundry-dimension-text); }
.foundry-door-review { padding: 1rem; }
.foundry-door-preview-metrics { display: flex; gap: 2.5rem; }
.foundry-door-preview-metrics span, .foundry-door-preview-metrics strong { display: block; }
.foundry-door-preview-metrics span { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; opacity: .65; }
.foundry-door-preview-metrics strong { margin-top: .2rem; font-size: 1.05rem; }
.foundry-door-review p { margin-top: .75rem; font-size: .75rem; line-height: 1.6; opacity: .7; }
.foundry-door-caption { padding: .8rem 1rem; border-top: 1px solid var(--theme-border); font-size: .7rem; opacity: .65; }
.foundry-door-preview-empty { display: flex; min-height: 330px; flex-direction: column; justify-content: center; gap: .7rem; padding: 2rem; text-align: center; font-size: .85rem; }
.foundry-door-hardware-images { display: flex; flex-wrap: wrap; gap: .5rem; }
.foundry-door-hardware-images figure { width: 84px; font-size: .65rem; }
.foundry-door-hardware-images img { width: 84px; height: 64px; object-fit: contain; }
.foundry-door-finish-summary, .foundry-door-hardware-key { display: flex; flex-wrap: wrap; gap: .4rem; }
.foundry-door-finish-chip::before { content: ''; display: inline-block; flex: 0 0 15px; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--theme-border); background: var(--door-swatch-color); }
.foundry-door-finish-summary, .foundry-door-hardware-key { margin-top: .8rem; }
.foundry-door-finish-chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .7rem; }
.foundry-door-hardware-key button { max-width: 100%; border-left-width: 3px; text-align: left; }
.foundry-door-hardware-key [data-hardware-key="hinging"] { border-left-color: var(--foundry-hinge-key); }
.foundry-door-hardware-key [data-hardware-key="locking"] { border-left-color: var(--foundry-lock-key); }
.foundry-door-hardware-key [data-hardware-key="pull"] { border-left-color: var(--foundry-pull-key); }
.foundry-door-hardware-key [data-hardware-key="closer"] { border-left-color: var(--foundry-closer-key); }
.foundry-door-footer { border-top: 1px solid var(--theme-border); }
.foundry-door-footer > span { font-size: .75rem; opacity: .65; }
.foundry-door-footer > div { display: flex; gap: .6rem; }
@media (max-width: 800px) {
    .foundry-door-editor-body { grid-template-columns: minmax(0, 1fr); padding: .8rem; gap: 1rem; }
    .foundry-door-preview-column { position: static; grid-row: 1; max-height: none; overflow: visible; }
    .foundry-door-stage svg { max-height: 290px; }
    .foundry-door-heading, .foundry-door-footer { padding: 1rem; }
    .foundry-door-heading h2 { font-size: 1.05rem; }
    .foundry-door-footer > span { display: none; }
    .foundry-door-footer { justify-content: flex-end; }
}

/* Physical sticks (real scaled face width) and glass daylight openings.
 * Divider lines are editing geometry only: transparent until hover/selection. */
.foundry-stick { fill: var(--foundry-stick-fill); stroke: var(--foundry-stick-edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
.foundry-stick.selected { fill: var(--foundry-stick-selected-fill); stroke: var(--foundry-selection-stroke); }
.foundry-stick-preview { fill: var(--foundry-preview-fill); stroke: var(--foundry-preview-stroke); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.foundry-stick-hit { fill: transparent; cursor: pointer; }
.foundry-corner-handle { cursor: nwse-resize; }
.foundry-bottom-handle { cursor: ns-resize; }
.foundry-corner-marker { fill: #ffffff; stroke: #2563eb; stroke-width: 2; }
.foundry-notch-preview { fill: rgba(37, 99, 235, 0.12); stroke: #2563eb; stroke-width: 1.5; stroke-dasharray: 5 3; pointer-events: none; }
.foundry-arch-head { fill: none; stroke: var(--foundry-stick-fill); pointer-events: stroke; cursor: pointer; }
.foundry-arch-head.selected { stroke: var(--foundry-stick-selected-fill); }
.foundry-lite { fill: var(--foundry-glass-fill); fill-opacity: 0.55; stroke: var(--foundry-glass-edge); stroke-width: 1; vector-effect: non-scaling-stroke; cursor: pointer; }
.foundry-lite.assigned { fill: var(--foundry-glass-assigned-fill); }
.foundry-lite.selected { stroke: var(--foundry-selection-stroke); stroke-width: 2; }
.foundry-divider { cursor: ew-resize; stroke: transparent; stroke-width: 5; vector-effect: non-scaling-stroke; }
.foundry-divider[data-axis="horizontal"] { cursor: ns-resize; }
.foundry-divider:hover, .foundry-divider.selected { stroke: var(--foundry-selection-stroke); stroke-width: 2; }

/* Tool previews */
.foundry-preview { stroke: var(--foundry-preview-stroke); stroke-dasharray: 8 6; stroke-width: 4; opacity: 0.55; pointer-events: none; }
.foundry-door-preview { fill: var(--foundry-preview-fill); stroke: var(--foundry-preview-stroke); stroke-dasharray: 6 4; stroke-width: 2; pointer-events: none; }

/* Dimension annotations. The halo knocks out the drawing beneath glyph text. */
.foundry-dimension { fill: var(--foundry-dimension-text); font-family: Manrope, sans-serif; font-size: 13px; font-weight: 600; text-anchor: middle; paint-order: stroke; pointer-events: none; stroke: var(--foundry-dimension-halo); stroke-width: 3px; stroke-linejoin: round; }
.foundry-dimension-line { fill: none; pointer-events: none; stroke: var(--foundry-dimension-line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.foundry-dimension-extension { fill: none; pointer-events: none; stroke: var(--foundry-dimension-extension); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.foundry-dimension-label { fill: var(--foundry-dimension-label); font-family: Manrope, sans-serif; font-size: 11px; font-weight: 700; pointer-events: none; text-anchor: middle; paint-order: stroke; stroke: var(--foundry-dimension-halo); stroke-width: 2.5px; stroke-linejoin: round; }
.foundry-dimension-label.active { fill: var(--foundry-dimension-active); }
.foundry-daylight-label { fill: var(--foundry-dimension-label); font-family: Manrope, sans-serif; font-size: 11px; font-weight: 600; text-anchor: middle; dominant-baseline: middle; pointer-events: none; paint-order: stroke; stroke: var(--foundry-dimension-halo); stroke-width: 2.5px; stroke-linejoin: round; }

/* Smart snapping visual guides */
.foundry-smart-guide {
    fill: none;
    pointer-events: none;
    stroke: var(--foundry-smart-guide-stroke, #0284c7);
    stroke-width: 1.5;
    stroke-dasharray: 5 3;
    vector-effect: non-scaling-stroke;
}
.foundry-smart-guide-label {
    fill: var(--foundry-smart-guide-text, #0369a1);
    font-family: Manrope, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    paint-order: stroke;
    stroke: var(--foundry-dimension-halo, #ffffff);
    stroke-width: 4px;
    stroke-linejoin: round;
}

/* Snap control and crosshair */
.foundry-snap-vertical {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 0.5rem;
    height: 6.5rem;
    accent-color: var(--foundry-divider-stroke);
    cursor: pointer;
}
.foundry-zoom-horizontal {
    width: 6.5rem;
    height: 0.5rem;
    accent-color: var(--foundry-divider-stroke);
    cursor: pointer;
}
#foundry-canvas-wrap.foundry-crosshair-cursor,
#foundry-canvas-wrap.foundry-crosshair-cursor #foundry-canvas {
    cursor: url("../icons/cs2.svg") 12 12, crosshair;
}
.foundry-workbench-active #loading-overlay { display: none !important; }

@media (max-width: 1023px) {
    #foundry-left-panel, #foundry-right-panel { max-height: 18rem; overflow-y: auto; }
    #foundry-canvas-wrap { min-height: 30rem; }
}

.foundry-joint { cursor: pointer; outline: none; }
.foundry-joint-marker { fill: var(--foundry-preview-stroke); opacity: 0.25; pointer-events: none; }
.foundry-joint-hit { fill: transparent; pointer-events: all; }
.foundry-joint:hover .foundry-joint-marker,
.foundry-joint:focus .foundry-joint-marker,
.foundry-joint.selected .foundry-joint-marker { opacity: 1; stroke: white; stroke-width: 1.5; }

.foundry-reference-thumbnail {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    z-index: 20;
    display: block;
    width: 116px;
    padding: 0.375rem;
    border-radius: 0.75rem;
    background: var(--theme-surface-raised, rgba(255, 255, 255, 0.95));
    border: 1px solid var(--theme-border, rgba(226, 232, 240, 0.8));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                padding 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    overflow: hidden;
}
.foundry-reference-thumbnail[hidden] { display: none; }
.foundry-reference-thumbnail:hover,
.foundry-reference-thumbnail:focus-within {
    width: 232px;
    padding: 0.625rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.foundry-reference-image-wrap {
    position: relative;
    width: 100%;
    height: 76px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--theme-border, rgba(226, 232, 240, 0.6));
    background: var(--theme-surface-subtle, #f8fafc);
    cursor: pointer;
    transition: height 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.foundry-reference-thumbnail:hover .foundry-reference-image-wrap,
.foundry-reference-thumbnail:focus-within .foundry-reference-image-wrap {
    height: 120px;
}
.foundry-reference-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.foundry-reference-viewer { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.foundry-overlay-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #06b6d4;
    box-shadow: 0 0 0 1.5px white;
    transition: opacity 0.15s ease;
}
.foundry-reference-thumbnail:hover .foundry-overlay-badge,
.foundry-reference-thumbnail:focus-within .foundry-overlay-badge {
    opacity: 0;
}
.foundry-reference-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, max-height 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.foundry-reference-thumbnail:hover .foundry-reference-header,
.foundry-reference-thumbnail:focus-within .foundry-reference-header {
    opacity: 1;
    max-height: 28px;
    pointer-events: auto;
    margin-bottom: 0.375rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--theme-border, rgba(226, 232, 240, 0.6));
}
.foundry-reference-controls {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, max-height 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.foundry-reference-thumbnail:hover .foundry-reference-controls,
.foundry-reference-thumbnail:focus-within .foundry-reference-controls {
    opacity: 1;
    max-height: 220px;
    pointer-events: auto;
    margin-top: 0.5rem;
}
.foundry-reference-overlay { user-select: none; -webkit-user-select: none; }
.foundry-reference-overlay.aligning { cursor: grab; }
.foundry-reference-overlay.aligning:active { cursor: grabbing; }
.foundry-overlay-bounds { fill: none; stroke: #0284c7; stroke-width: 1.5; stroke-dasharray: 6 4; pointer-events: none; }
.foundry-modal-pin { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 20; }
.foundry-calibration-dialog {
    width: 96vw;
    width: calc(100vw - 2rem);
    max-width: 2200px;
    height: 88vh;
    height: calc(100dvh - 3.5rem);
    max-height: 90vh;
}
@media (min-width: 1536px) {
    .foundry-calibration-dialog {
        width: 95vw;
        max-width: 2400px;
    }
}

.foundry-door { pointer-events: none; }
.foundry-door-ghost { opacity: 0.5; }
.foundry-door rect, .foundry-door polyline { vector-effect: non-scaling-stroke; }
.foundry-door-opening { fill: none; stroke: var(--foundry-stick-edge); stroke-width: 1; }
.foundry-door-glass { fill: var(--foundry-door-glass-fill); stroke: var(--foundry-door-edge); stroke-width: .6; }
.foundry-door-rail, .foundry-door-frame-context, .foundry-door-panel { fill: var(--door-metal-color, var(--foundry-stick-fill)); stroke: var(--foundry-door-edge); stroke-width: .6; }
.foundry-door-glazing-bead { fill: none; stroke: var(--foundry-door-edge); stroke-width: .5; opacity: .6; }
.foundry-door-leaf-outline { fill: none; stroke: var(--foundry-door-edge); stroke-width: .8; }
.foundry-door-threshold-band { fill: var(--door-hardware-color, var(--foundry-hardware-fill)); stroke: var(--foundry-stick-edge); stroke-width: .6; }
.foundry-door-hardware > * { fill: var(--door-hardware-color, var(--foundry-hardware-fill)); stroke: var(--foundry-dimension-label); stroke-width: .8; vector-effect: non-scaling-stroke; }
.foundry-door-hardware line, .foundry-door-hardware path { stroke: var(--door-hardware-color, var(--foundry-dimension-label)); stroke-width: 1.8; fill: none; stroke-linecap: round; }
.foundry-door-hinge-continuous > *, .foundry-door-hinge-butt > *, .foundry-door-hinge-pivot > * { fill: var(--door-hinge-color, var(--door-hardware-color, var(--foundry-hardware-fill))); }
.foundry-door-hardware .foundry-door-hardware-detail { fill: none; stroke: var(--foundry-dimension-label); stroke-width: .55; }
.foundry-door-swing, .foundry-door-swing-double { fill: none; stroke: var(--foundry-door-edge); stroke-width: .7; stroke-dasharray: 3 3; opacity: .6; }

.foundry-space-panning,
.foundry-space-panning * {
    cursor: grab !important;
}
.foundry-panning,
.foundry-panning * {
    cursor: grabbing !important;
}

.foundry-canvas-dock {
    background: var(--theme-surface-raised, rgba(255, 255, 255, 0.92));
    border: 1px solid var(--theme-border, rgba(226, 232, 240, 0.9));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    user-select: none;
}
.foundry-canvas-dock.hidden {
    display: none;
}
.foundry-door-hinge { fill: none; stroke: var(--foundry-stick-edge); stroke-width: 2; }
.foundry-door-meeting, .foundry-door-threshold { fill: none; stroke: var(--foundry-door-edge); stroke-width: .7; }

/* AI origin persists through human edits and undo/redo; selection stays purple. */
.foundry-stick.foundry-ai { fill: #a855f7; stroke: #7e22ce; }
.foundry-stick.foundry-ai.selected { fill: #c084fc; stroke: #6b21a8; }
.foundry-ai-preview { stroke: #9333ea; stroke-width: 5; opacity: .65; cursor: pointer; pointer-events: stroke; }
.foundry-ai-uncertain { stroke-dasharray: 5 4; }
.foundry-ai-preview:focus { outline: none; stroke: #6b21a8; stroke-width: 8; }

/* Fixed-position tooltip for icon buttons: escapes the frames panel's
   overflow-y scroll container, which clips anything absolutely positioned. */
.foundry-tooltip {
    position: fixed;
    z-index: 60;
    pointer-events: none;
    background: var(--theme-foreground, #212529);
    color: var(--theme-background, #f8f9fa);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Read-only frame views (static/js/foundry/elevation-view.js): the editor's
 * drawing on any page, plus evaluated placement markers and review marks. */
.foundry-elevation { display: block; width: 100%; height: auto; max-height: 70vh; background: var(--foundry-canvas-background); border-radius: .5rem; }
.foundry-elevation .foundry-lite, .foundry-elevation .foundry-stick-hit { cursor: default; }
.foundry-elevation [data-host] { cursor: pointer; }
.foundry-lite.door { fill: var(--foundry-hardware-fill); fill-opacity: .35; }
.foundry-door-pair { stroke: var(--foundry-stick-edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
.foundry-marker { stroke: var(--foundry-smart-guide-stroke); fill: none; opacity: .9; }
.foundry-marker-band { stroke-width: 7; stroke-linecap: round; opacity: .55; }
.foundry-marker-outline { stroke-width: 4; }
.foundry-marker-tick { stroke-width: 2.5; }
.foundry-marker-dot { fill: var(--foundry-smart-guide-stroke); stroke: none; }
.foundry-mark { fill-opacity: .26; stroke-width: 1; vector-effect: non-scaling-stroke; }
.foundry-mark.unconfirmed { fill-opacity: .10; }
