:root {
  --bg: #f5f7fa; --surface: #ffffff; --surface-2: #eef2f7; --text: #102a43; --muted: #627d98; --border: #d9e2ec;
  --primary: #243b53; --primary-text: #ffffff; --accent: #f0b429; --link: #2f6fb3;
  --ok: #2f8a4d; --ok-bg: #e3f9e5; --warn: #b7791f; --warn-bg: #fffbea; --bad: #c53030; --bad-bg: #ffe3e3; --info-bg: #e6f0ff;
  --radius: 10px; --shadow: 0 10px 30px rgba(16, 42, 67, .14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1722; --surface: #17212e; --surface-2: #1f2b3a; --text: #e4ecf5; --muted: #93a7bd; --border: #2b394a;
    --primary: #f0b429; --primary-text: #102a43; --link: #7cb4f5;
    --ok: #68d391; --ok-bg: #173a26; --warn: #f6c453; --warn-bg: #3a2f12; --bad: #fc8181; --bad-bg: #3d1b1b; --info-bg: #182c47;
    --shadow: 0 10px 30px rgba(0,0,0,.5); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 17px; margin: 0 0 8px; } h3 { font-size: 14px; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); } .error { color: var(--bad); min-height: 1em; } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; width: min(380px, 100%); box-shadow: var(--shadow); display: grid; gap: 12px; }
.login-card label { display: grid; gap: 6px; }

/* shell */
.shell { display: flex; min-height: 100%; }
.nav { width: 232px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .brand { font-weight: 700; font-size: 15px; padding: 4px 10px 12px; display: flex; gap: 8px; align-items: center; }
.nav .brand i { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 10px 4px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 7px; color: var(--text); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary); color: var(--primary-text); }
.nav a .count { font-size: 11px; background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 0 7px; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.search-wrap { position: relative; flex: 1; max-width: 560px; }
.search-wrap input { width: 100%; }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; padding: 6px; z-index: 20; }
.search-results .grp { font-size: 11px; color: var(--muted); padding: 6px 8px 2px; text-transform: uppercase; }
.search-results a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--text); }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.view { padding: 20px; max-width: 1400px; width: 100%; outline: none; }
.view-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.view-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.only-mobile { display: none; }

/* controls */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0; }
textarea { min-height: 70px; resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.btn { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 12px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.icon { padding: 6px 10px; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 12px; background: var(--info-bg); color: var(--text); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

/* badges */
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--text); white-space: nowrap; text-transform: capitalize; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); }

/* cards & stats */
.grid { display: grid; gap: 12px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; }
.stat .v { font-size: 22px; font-weight: 650; } .stat .l { color: var(--muted); font-size: 12px; }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; cursor: default; white-space: nowrap; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--text); }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
table.edit td { padding: 4px; } table.edit input, table.edit select { width: 100%; padding: 4px 6px; }

/* kanban */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.col { flex: 0 0 250px; background: var(--surface-2); border-radius: var(--radius); padding: 8px; }
.col h4 { margin: 2px 4px 8px; font-size: 12px; display: flex; justify-content: space-between; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px; margin-bottom: 8px; cursor: pointer; }
.tile:hover { border-color: var(--link); } .tile .t { font-weight: 600; } .tile .s { font-size: 12px; color: var(--muted); }

/* drawer & modal */
.backdrop { position: fixed; inset: 0; background: rgba(16, 42, 67, .35); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); z-index: 31; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.drawer-head { padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.drawer-head .titles { flex: 1; min-width: 0; } .drawer-head h2 { margin: 0; word-break: break-word; }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 -18px 14px; padding: 0 18px; overflow-x: auto; background: var(--surface); }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font: inherit; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.modal-backdrop { display: grid; place-items: center; padding: 16px; z-index: 40; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: min(620px, 100%); max-height: 90vh; overflow-y: auto; padding: 20px; }
.form { display: grid; gap: 10px; } .form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); } .form label.check { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; }
.form .buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
dl.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; margin: 0 0 12px; }
dl.facts dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; } dl.facts dd { margin: 2px 0 0; word-break: break-word; }
.section-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.timeline { list-style: none; margin: 0; padding: 0; } .timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--border); margin-left: 4px; }
.timeline .when { font-size: 11px; color: var(--muted); }
.checklist li { list-style: none; } .checklist li::before { content: "○ "; } .checklist li.ok::before { content: "● "; color: var(--ok); }
.toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--primary); color: var(--primary-text); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; }
.toast.bad { background: var(--bad); color: #fff; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.totals div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; } .totals b { display: block; font-size: 16px; }
.gantt { display: grid; gap: 4px; } .gantt .bar-row { display: grid; grid-template-columns: 200px 1fr; gap: 8px; align-items: center; }
.gantt .track { position: relative; height: 18px; background: var(--surface-2); border-radius: 4px; }
.gantt .bar { position: absolute; top: 0; bottom: 0; background: var(--link); border-radius: 4px; } .gantt .bar.done { background: var(--ok); } .gantt .bar.late { background: var(--bad); }
.canvas-wrap { position: relative; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); max-height: 70vh; }
.canvas-wrap svg { display: block; }

@media (max-width: 860px) {
  .nav { position: fixed; left: 0; top: 0; z-index: 35; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .nav.open { transform: none; }
  .only-mobile { display: inline-block; }
  .view { padding: 14px 16px; }
  .topbar { padding: 8px 16px; }
  .topbar-right .pill { display: none; }
  .gantt .bar-row { grid-template-columns: 110px 1fr; }
}
@media print { .nav, .topbar, .drawer, .backdrop { display: none !important; } }
.drawer-body .card { margin-bottom: 10px; }
.view-head + .grid, .grid + .table-wrap { margin-bottom: 12px; }
.grid.cols-4 { margin-bottom: 12px; }
.drawer.wide { width: min(1280px, 100%); }
table.edit { min-width: 1450px; }
table.edit td:first-child input { min-width: 240px; }
table.edit td input[type=number] { min-width: 70px; }
table.edit td select { min-width: 110px; }

/* ---------- field media & mobile-first pieces (shared by /app and /portal) ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; aspect-ratio: 4 / 3; padding: 0; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); text-align: left; }
.photo .flag { position: absolute; top: 6px; left: 6px; }
.photo.selected { outline: 3px solid var(--accent); }
.big-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 18px; font-size: 16px; font-weight: 600; border-radius: 14px; border: 0; background: var(--primary); color: var(--primary-text); cursor: pointer; width: 100%; }
.big-btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.capture-bar { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 0; background: var(--bg); z-index: 5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; min-height: 36px; }
.chip.on { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.uploads { display: grid; gap: 6px; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; grid-column: 1 / -1; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.viewer { position: relative; max-width: 100%; }
.viewer img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: var(--radius); }
.viewer svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.portal-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.portal-main { max-width: 900px; margin: 0 auto; padding: 16px; }
.portal-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.portal-tabs a { padding: 12px 14px; white-space: nowrap; color: var(--muted); border-bottom: 2px solid transparent; }
.portal-tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.list { display: grid; gap: 10px; }
.list .card { display: grid; gap: 4px; }
.money-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); }
@media (max-width: 640px) { .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; } .photo .meta { display: none; } .btn { min-height: 40px; } }

/* ---------- Ask Mya ---------- */
.mya-fab { position: fixed; right: 18px; bottom: 18px; z-index: 40; border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 700; background: var(--accent); color: #102a43; box-shadow: var(--shadow); cursor: pointer; }
.mya-panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(440px, 100vw); z-index: 45; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; padding: 0 14px 14px; gap: 8px; }
.mya-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.mya-msg { padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; max-width: 92%; }
.mya-msg.you { align-self: flex-end; background: var(--primary); color: var(--primary-text); }
.mya-msg.mya { align-self: flex-start; background: var(--surface-2); }
.mya-msg.error { align-self: center; color: var(--bad); background: var(--bad-bg); }
.mya-form textarea { width: 100%; resize: vertical; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
@media (max-width: 640px) { .mya-fab { right: 12px; bottom: 12px; } }
.prewrap { white-space: pre-wrap; margin: 0 0 8px; }
.neg { color: var(--bad); font-weight: 600; }
.stat .v.bad { color: var(--bad); } .stat .v.warn { color: var(--warn); } .stat .v.ok { color: var(--ok); }

/* ---------- floor planner ---------- */
.plan-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.plan-toolbar .spacer { flex: 1; }
.plan-body { display: grid; grid-template-columns: 250px minmax(0, 1fr) 260px; gap: 10px; height: calc(100vh - 290px); min-height: 460px; }
.plan-side, .plan-inspector { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; overflow-y: auto; }
.plan-inspector h3:first-child, .plan-side h3:first-child { margin-top: 0; }
.plan-stage { display: grid; gap: 10px; min-height: 0; }
.plan-stage.split { grid-template-columns: 1fr 1fr; } .plan-stage.\32 d, .plan-stage.\33 d { grid-template-columns: 1fr; }
.plan-stage.\32 d .plan-3d { display: none; } .plan-stage.\33 d .plan-2d { display: none; }
.plan-2d, .plan-3d { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 0; }
.plan-3d canvas { width: 100%; height: 100%; display: block; }
.plan-svg { width: 100%; height: 100%; display: block; background: #fbfcfd; touch-action: none; outline: none; cursor: default; }
.plan-svg[data-tool="wall"], .plan-svg[data-tool="rect"], .plan-svg[data-tool="poly"], .plan-svg[data-tool="measure"], .plan-svg[data-tool="object"], .plan-svg[data-tool="door"], .plan-svg[data-tool="window"], .plan-svg[data-tool="opening"] { cursor: crosshair; }
.plan-svg .grid { stroke: #eef1f4; stroke-width: 0.02; } .plan-svg .grid.major { stroke: #dde3e9; stroke-width: 0.04; }
.plan-svg .room { fill: #f4ead8; fill-opacity: 0.55; stroke: #c9b79c; stroke-width: 0.04; }
.plan-svg .room.sel { fill: #f0b429; fill-opacity: 0.25; stroke: #f0b429; stroke-width: 0.08; }
.plan-svg .room.preview { fill: #f0b429; fill-opacity: 0.15; stroke: #b7791f; stroke-dasharray: 0.3 0.2; stroke-width: 0.06; }
.plan-svg .wall { stroke: #48535e; stroke-linecap: square; } .plan-svg .wall.ext { stroke: #243b53; } .plan-svg .wall.sel { stroke: #f0b429; } .plan-svg .wall.preview { stroke: #b7791f; opacity: 0.7; }
.plan-svg .ghost-wall { stroke: #9aa5b1; opacity: 0.25; }
.plan-svg .opening { stroke: #fbfcfd; } .plan-svg .opening.window { stroke: #9fc7dd; } .plan-svg .opening.sel { stroke: #f0b429; }
.plan-svg .door-leaf { stroke: #8a6d4e; stroke-width: 0.06; } .plan-svg .door-swing { fill: none; stroke: #8a6d4e; stroke-width: 0.03; stroke-dasharray: 0.15 0.1; }
.plan-svg .obj { stroke: #334e68; stroke-width: 0.03; fill-opacity: 0.85; } .plan-svg .obj.sel { stroke: #f0b429; stroke-width: 0.08; }
.plan-svg .obj.rug { fill-opacity: 0.35; }
.plan-svg text { font-family: system-ui, sans-serif; text-anchor: middle; dominant-baseline: middle; pointer-events: none; user-select: none; }
.plan-svg .room-label { font-weight: 700; fill: #334e68; } .plan-svg .room-area { fill: #627d98; } .plan-svg .obj-label { fill: #102a43; }
.plan-svg .dim { fill: #486581; } .plan-svg .dim.live { fill: #b7791f; font-weight: 700; }
.plan-svg .measure { stroke: #c53030; stroke-width: 0.05; stroke-dasharray: 0.2 0.1; }
.plan-svg .handle { fill: #fff; stroke: #f0b429; stroke-width: 0.06; cursor: grab; } .plan-svg .handle.rotate { fill: #f0b429; }
.plan-catalog input[type="search"] { width: 100%; margin-bottom: 8px; }
.plan-catalog .chips { margin-bottom: 8px; } .plan-catalog .chip { padding: 4px 8px; min-height: 28px; font-size: 12px; }
.cat-grid { display: grid; gap: 4px; }
.cat-item { display: grid; grid-template-columns: 18px 1fr; grid-template-rows: auto auto; column-gap: 8px; text-align: left; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.cat-item .swatch { grid-row: span 2; width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.2); align-self: center; }
.cat-item.on { border-color: var(--accent); background: var(--warn-bg); }
.plan-status { margin-top: 6px; }
.plan-inspector .form label { display: grid; gap: 2px; font-size: 12px; } .plan-inspector .form input, .plan-inspector .form select { width: 100%; }
@media (max-width: 1100px) { .plan-body { grid-template-columns: 1fr; height: auto; } .plan-stage { height: 70vh; } .plan-stage.split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } .plan-side, .plan-inspector { max-height: 320px; } }

/* ---------- roof editor, library, boards ---------- */
.roof-editor { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 10px; height: 64vh; }
.roof-svg { width: 100%; height: 100%; display: block; background: #fbfcfd; touch-action: none; cursor: crosshair; }
.roof-svg .grid { stroke: #e3e8ee; stroke-width: 0.05; }
.roof-svg .facet { fill: #9aa5b1; fill-opacity: 0.35; stroke: #334e68; stroke-width: 0.12; } .roof-svg .facet.sel { fill: #f0b429; fill-opacity: 0.35; }
.roof-svg .facet.preview { fill: #f0b429; fill-opacity: 0.15; stroke-dasharray: 0.6 0.3; }
.roof-svg .eave-mark { stroke: #102a43; stroke-width: 0.45; opacity: 0.5; pointer-events: none; }
.roof-svg .facet-label { font: 600 1px system-ui, sans-serif; text-anchor: middle; dominant-baseline: middle; fill: #102a43; pointer-events: none; }
.roof-svg .pen { fill: #c53030; }
.roof-3d { width: 100%; min-height: 380px; border-radius: var(--radius); overflow: hidden; }
input.narrow { width: 70px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.prod-card { display: grid; gap: 4px; text-align: left; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.prod-card img, .prod-card .prod-swatch { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--surface-2); display: block; }
.prod-card:hover { border-color: var(--accent); } .prod-name { font-weight: 600; }
.mini-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); vertical-align: middle; }
.board-wrap { overflow: auto; max-height: 68vh; background: var(--surface-2); border-radius: var(--radius); padding: 12px; }
.board-canvas { position: relative; box-shadow: var(--shadow); margin: 0 auto; overflow: hidden; }
.board-canvas.preview { margin: 0; }
.board-el { position: absolute; box-sizing: border-box; user-select: none; touch-action: none; }
.board-el.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.board-el img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.board-el.product { background: #fff; border-radius: 6px; overflow: hidden; display: grid; grid-template-rows: 1fr auto; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.board-el.product img, .board-el.product .el-swatch { height: 100%; }
.board-el .el-text { width: 100%; height: 100%; overflow: hidden; white-space: pre-wrap; line-height: 1.15; }
.board-el.note { background: #fff7c2; padding: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.board-el.swatch { display: grid; grid-template-rows: 1fr auto; background: #fff; padding: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.board-el .el-swatch { width: 100%; height: 100%; border-radius: 4px; }
.board-el .el-caption { font-size: 11px; color: #334e68; padding: 4px 2px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.board-el.ellipse { border-radius: 50%; } .board-el.rect { border-radius: 4px; }
.board-el .el-arrow { width: 100%; height: 100%; }
.board-el .resize, .board-el .rot { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; }
.board-el .resize { right: -8px; bottom: -8px; cursor: nwse-resize; } .board-el .rot { left: calc(50% - 6px); top: -22px; border-radius: 50%; cursor: grab; }
@media (max-width: 900px) { .roof-editor { grid-template-columns: 1fr; height: auto; } .roof-editor .plan-2d { height: 55vh; } }
