/* R27 rentals – site drawing (SVG canvas, shapes, parts, handles, zoom / pan, unit panel) and the tenant statement (slice SR). Prefix: sdw- */
.sdw-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.sdw-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sdw-board { min-width: 0; }
.sdw-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.sdw-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.sdw-zoom { display: flex; gap: 4px; }
.sdw-ico { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; margin-inline-end: 6px; vertical-align: -1px; }
.sdw-ico-rect { width: 16px; height: 10px; }
.sdw-ico-circle { border-radius: 50%; }
.sdw-stage { position: relative; height: min(68vh, 720px); min-height: 320px; background: var(--ground); overflow: hidden; }
.sdw-svg { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.sdw-svg:active { cursor: grabbing; }
.sdw-stage.editing .sdw-shape { cursor: move; }
.sdw-canvas { fill: var(--surface); stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sdw-plan { opacity: .45; pointer-events: none; }
.sdw-gridfill { pointer-events: none; }
.sdw-gridline { fill: none; stroke: var(--row-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sdw-free-bg { fill: var(--surface); }
.sdw-free-line { stroke: var(--border); stroke-width: 3; }

/* parts: colour by the unit's state */
.sdw-part { stroke: var(--surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: pointer; transition: filter .12s; }
.sdw-part:hover { filter: brightness(.94); }
.sdw-part.picked { stroke: var(--text); stroke-width: 3; }
.sdw-st-vacant { fill: var(--gray-bg); }
.sdw-st-rented { fill: color-mix(in srgb, var(--green-fg) 32%, var(--surface)); }
.sdw-st-expiring { fill: color-mix(in srgb, var(--amber-fg) 34%, var(--surface)); }
.sdw-st-overdue { fill: color-mix(in srgb, var(--red-fg) 36%, var(--surface)); }
.sdw-st-reserved { fill: color-mix(in srgb, var(--blue-fg) 30%, var(--surface)); }
.sdw-st-maintenance { fill: color-mix(in srgb, #7a4fb5 30%, var(--surface)); }
.sdw-outline { fill: none; stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.sdw-shape.selected .sdw-outline { stroke-width: 3; }
.sdw-label { fill: var(--text); font-family: var(--mono, monospace); font-weight: 600; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.sdw-title { fill: var(--muted); font-size: 14px; font-weight: 600; pointer-events: none; }
.sdw-lbl { pointer-events: none; }

/* selection and handles (edit mode) */
.sdw-selbox { fill: none; stroke: var(--primary); stroke-width: 1; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.sdw-handle { fill: var(--surface); stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.sdw-h-nw, .sdw-h-se { cursor: nwse-resize; } .sdw-h-ne, .sdw-h-sw { cursor: nesw-resize; }
.sdw-h-n, .sdw-h-s { cursor: ns-resize; } .sdw-h-e, .sdw-h-w { cursor: ew-resize; }
.sdw-ghost rect, .sdw-ghost circle { fill: color-mix(in srgb, var(--primary) 12%, transparent); stroke: var(--primary); stroke-width: 2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.sdw-ghost text { fill: var(--primary); font-size: 13px; font-family: var(--mono, monospace); pointer-events: none; }

/* legend */
.sdw-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.sdw-key { display: inline-flex; align-items: center; gap: 6px; }
.sdw-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); display: inline-block; }
.sdw-swatch.sdw-st-vacant { background: var(--gray-bg); }
.sdw-swatch.sdw-st-rented { background: color-mix(in srgb, var(--green-fg) 32%, var(--surface)); }
.sdw-swatch.sdw-st-expiring { background: color-mix(in srgb, var(--amber-fg) 34%, var(--surface)); }
.sdw-swatch.sdw-st-overdue { background: color-mix(in srgb, var(--red-fg) 36%, var(--surface)); }
.sdw-swatch.sdw-st-reserved { background: color-mix(in srgb, var(--blue-fg) 30%, var(--surface)); }
.sdw-swatch.sdw-st-maintenance { background: color-mix(in srgb, #7a4fb5 30%, var(--surface)); }
.sdw-swatch.sdw-st-free { background: repeating-linear-gradient(45deg, var(--surface) 0 3px, var(--border) 3px 5px); }

/* side panel */
.sdw-parts { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.sdw-part-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 90px; gap: 6px; align-items: center; padding: 4px; border-radius: var(--radius-sm); }
.sdw-part-row.picked { background: var(--green-bg); }
.sdw-part-row select, .sdw-part-row input { min-width: 0; }
.sdw-part-no { font-family: var(--mono, monospace); font-weight: 600; text-align: center; color: var(--muted); }
.sdw-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
.sdw-dl dt { color: var(--muted); } .sdw-dl dd { margin: 0; }
.sdw-danger { color: var(--danger); }

/* tenant statement */
.sdw-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sdw-kpis .fact { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sdw-kpis .fact span { font-size: 12px; color: var(--muted); }
.sdw-kpis .fact strong { font-size: 18px; }
.sdw-kpis .fact.sdw-due { border-color: var(--amber-fg); }
.sdw-kpis .fact.sdw-owe { border-color: var(--blue-fg); }

@media (max-width: 1100px) {
    .sdw-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .sdw-stage { height: 56vh; }
    .sdw-kpis { grid-template-columns: minmax(0, 1fr); }
    .sdw-part-row { grid-template-columns: 24px minmax(0, 1fr); }
    .sdw-part-row input { grid-column: 2; }
}
@media print {
    .sdw-toolbar, .sdw-side { display: none; }
    .sdw-layout { display: block; }
    .sdw-stage { height: auto; aspect-ratio: 3 / 2; }
}
