/* Floor plan styles: furniture (left), the plan and the 3D view (centre) with quantities under them, the AI assistant
   (right) – Properties in a window of its own. */
#main { display: flex; flex-direction: row; flex: 1; min-width: 0; min-height: 0; background: var(--panel); }
#pl-left, #pl-side { min-height: 0; }
.pl-pane { display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid var(--line); }
.pl-pane.grow { flex: 1; border-bottom: 0; }
#pl-assist-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; border-bottom: 0; }
#pl-props { flex: 1; min-height: 0; overflow: auto; padding: 0 0 12px; }
.pf-btn-wide { width: 100%; justify-content: center; }

/* the furniture library */
#pl-lib { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pl-lib-search { margin: 6px 8px; height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs); }
.pl-lib-search:focus { outline: none; border-color: var(--prog); box-shadow: 0 0 0 2px var(--prog-soft); }
.pl-lib-list { flex: 1; min-height: 0; overflow: auto; padding: 0 6px 10px; }
.pl-lib-cat { margin: 10px 4px 4px; }
.pl-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px; }
.pl-li { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 3px 5px; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--text); font: inherit; cursor: grab; min-width: 0; }
.pl-li:hover { background: var(--hover); }
.pl-li.on { border-color: var(--prog); background: var(--prog-soft); }
.pl-li-ic { width: 46px; height: 40px; display: flex; align-items: center; justify-content: center; }
.pl-li-ic svg { max-width: 46px; max-height: 40px; width: 100%; height: 100%; }
.pl-li-name { font-size: var(--fs-xs); line-height: 1.2; text-align: center; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pl-lib-none { margin: 10px 6px; font-size: var(--fs-m); color: var(--muted); }

/* the centre: floors, the plan and the 3D view, quantities */
#pl-center { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
#pl-views { flex: 1; min-height: 0; display: flex; flex-direction: row; }
#pl-stage { /* content – the plan's paper (the drawing keeps its own colours, light or dark) */ position: relative; flex: 1; min-width: 0; min-height: 160px; overflow: hidden; background: #f7f8fa; outline: none; user-select: none; -webkit-user-select: none; touch-action: none; }
#pl-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--prog); }
#pl-stage[data-tool='wall'], #pl-stage[data-tool='rect'], #pl-stage[data-tool='dim'], #pl-stage[data-tool='stairs'], #pl-stage[data-tool='zone'] { cursor: crosshair; }
#pl-stage[data-tool='door'], #pl-stage[data-tool='window'], #pl-stage[data-tool='room'], #pl-stage[data-tool='note'] { cursor: copy; }
#pl-stage[data-tool='hand'] { cursor: grab; }
.pl-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pl-svg text { user-select: none; pointer-events: none; }
.pl-typed { position: absolute; z-index: 4; padding: 3px 8px; border-radius: var(--radius-s); background: var(--sel); color: var(--surface); font: 600 var(--fs-m) var(--font-mono); pointer-events: none; box-shadow: var(--shadow); }
#pl-3d { /* content – as the 3D scene's own background */ position: relative; flex: 1; min-width: 0; min-height: 160px; border-left: 1px solid var(--line); background: #dfe3e8; overflow: hidden; }
#pl-views[data-layout='3d'] #pl-stage { display: none; }
#pl-views[data-layout='3d'] #pl-3d { border-left: 0; }

/* quantities */
#pl-qty { height: 260px; min-height: 120px; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--surface); }
.pl-qty-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: var(--fs); flex-wrap: wrap; }
.pl-qty-head .grow { flex: 1; }
.pl-qty-set { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-s); color: var(--text-2); }
.pl-qty-set input { width: 52px; height: 24px; padding: 0 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font: inherit; }
.pl-qty-btn { width: 28px; height: 26px; padding: 0; border: 0; border-radius: var(--radius-s); background: none; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pl-qty-btn:hover { background: var(--hover); color: var(--text); }
.pl-qty-btn .material-symbols-outlined { font-size: var(--ic); }
.pl-qty-body { flex: 1; min-height: 0; overflow: auto; display: flex; gap: 18px; padding: 8px 12px 12px; align-items: flex-start; }
.pl-qty-box { flex: 0 0 auto; }
.pl-qty-title { margin: 2px 0 4px; }
.pl-qty-t { border-collapse: collapse; font-size: var(--fs-m); }
.pl-qty-t th { text-align: left; font-weight: 500; color: var(--muted); padding: 3px 12px 3px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pl-qty-t td { padding: 3px 12px 3px 0; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.pl-qty-t tr.link { cursor: pointer; }
.pl-qty-t tr.link:hover td { background: var(--prog-soft); }
.pl-qty-t tr.foot td { font-weight: 600; border-bottom: 0; }
.pl-swatch-row { display: inline-flex; align-items: center; gap: 6px; }
.pl-swatch { /* content – a paint's or a floor's own colour */ width: 12px; height: 12px; border-radius: var(--radius-xs); border: 1px solid rgba(0, 0, 0, 0.18); display: inline-block; }

/* floors */
#pl-floors { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--line); background: var(--surface); overflow-x: auto; }

/* the 3D view */
.pl-3d-canvas { position: absolute; inset: 0; display: block; outline: none; touch-action: none; }
#pl-3d:focus { outline: none; }
#pl-3d:focus-visible { box-shadow: inset 0 0 0 2px var(--prog); }
.pl-3d-bar { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--vp-bar); color: var(--vp-text); box-shadow: var(--shadow); flex-wrap: wrap; max-width: calc(100% - 16px); }
.pl-3d-btn { width: 30px; height: 28px; padding: 0; border: 0; border-radius: var(--radius-s); background: none; color: var(--vp-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pl-3d-btn:hover { background: var(--vp-ctl-hover); }
.pl-3d-btn.on { background: var(--prog-soft); color: var(--prog-strong); }
.pl-3d-btn:disabled { opacity: .45; cursor: default; }
.pl-3d-btn .material-symbols-outlined { font-size: var(--ic); }
.pl-3d-sep { width: 1px; height: 18px; margin: 0 3px; background: var(--line); }
.pl-3d-sel { height: 26px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-s); padding: 0 4px; }
.pl-3d-sun { display: inline-flex; align-items: center; gap: 3px; margin: 0 4px; color: var(--warn); }
.pl-3d-sun .material-symbols-outlined { font-size: var(--ic); }
.pl-3d-sun input { width: 72px; accent-color: var(--warn); }
.pl-3d-hint { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 4px 10px; border-radius: var(--radius-s); background: var(--toast); color: var(--toast-text); font-size: var(--fs-s); pointer-events: none; white-space: nowrap; }
.pl-3d-err { padding: 16px; font-size: var(--fs); color: var(--muted); }

/* painting */
.pl-brush { display: flex; flex-direction: column; gap: 4px; }
.pl-sw-title { margin-top: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.pl-sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 4px; }
.pl-sw { /* content – a paint's or a floor's own colour */ width: 100%; aspect-ratio: 1; min-width: 22px; padding: 0; border: 1px solid rgba(0, 0, 0, 0.14); border-radius: var(--radius-s); cursor: pointer; }
.pl-sw:hover { transform: scale(1.08); }
.pl-sw.on { outline: 2px solid var(--prog); outline-offset: 1px; }
#pl-stage[data-tool='paint'] { cursor: cell; }
.pl-floor { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-s); background: none; color: var(--text-2); font: inherit; font-size: var(--fs-m); cursor: pointer; white-space: nowrap; }
.pl-floor:hover { background: var(--hover); color: var(--text); }
.pl-floor.on { background: var(--prog-soft); border-color: var(--prog); color: var(--prog-strong); font-weight: 600; }
.pl-floor-ic .material-symbols-outlined { font-size: var(--ic-s); }
.pl-floor-add { width: 28px; height: 26px; padding: 0; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); background: none; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pl-floor-add:hover { border-color: var(--prog); color: var(--prog-strong); }
.pl-floor-add .material-symbols-outlined { font-size: var(--ic); }
#pl-stage[data-tool='calibrate'], #pl-stage[data-tool='straightenPic'] { cursor: crosshair; }
#pl-stage[data-tool='movePic'] { cursor: move; }

/* narrow windows: the plan alone (no 3D beside it), the quantities lower, the furniture smaller */
@media (max-width: 800px) {
  #pl-views[data-layout='split'] #pl-3d { display: none; }
  #pl-qty { height: 200px; }
  .pl-lib-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
  .pl-qty-body { flex-direction: column; gap: 10px; }
}
@media (max-width: 520px) {
  .pl-3d-bar { left: 4px; top: 4px; }
  .pl-3d-hint { white-space: normal; max-width: calc(100% - 16px); text-align: center; }
}

/* a measurement's length typed (plan/exact.js): the box over it, and which side moves */
.pl-dimedit { position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--pop-shadow); }
.inp.pl-dimedit-in { width: 150px; font-variant-numeric: tabular-nums; text-align: center; font-weight: 600; }
.pl-dimedit-row { display: flex; align-items: center; gap: 6px; }
.pl-dimedit-l { font-size: 11.5px; color: var(--text-2); }
.pl-dimedit-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.pl-dimedit-b { border: 0; background: var(--surface); color: var(--text-2); font: inherit; font-size: 11.5px; padding: 2px 8px; cursor: pointer; }
.pl-dimedit-b + .pl-dimedit-b { border-left: 1px solid var(--line); }
.pl-dimedit-b:hover { background: var(--hover); color: var(--text); }
.pl-dimedit-b.on { background: var(--prog-soft); color: var(--prog-strong); font-weight: 600; }

/* a piece dragged from the list (plan/library.js dragFrom): its name by the pointer until it's over the plan */
body.pl-dragging, body.pl-dragging * { cursor: grabbing !important; user-select: none; }
.pl-dragchip { position: fixed; z-index: 70; pointer-events: none; padding: 3px 8px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--pop-shadow); font-size: 12px; color: var(--text); white-space: nowrap; }
