/* =========================================================================
   TableEngine floor plan builder
   ========================================================================= */
.tf-wrap-builder { height: calc(100vh - 32px); display: flex; flex-direction: column; }
.tableengine-admin.toplevel_page_tableengine #wpbody-content, .tableengine-admin #wpbody-content:has(.tf-wrap-builder) { padding-bottom: 0; }
#tableengine-builder { flex: 1; min-height: 0; display: flex; }
/* The loading placeholder fills the area so the spinner sits in its centre. */
#tableengine-builder > .tf-loading { flex: 1; align-self: stretch; min-height: 0; }
.tfb { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tf-save-state { font-size: 12px; font-weight: 600; color: var(--tf-muted); display: inline-flex; align-items: center; gap: 6px; }
.tf-save-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #a3a3a3; }
.tf-save-state.is-dirty { color: var(--tf-amber); }
.tf-save-state.is-dirty::before { background: var(--tf-amber); box-shadow: 0 0 0 3px #fef3c7; }
.tf-save-state.is-clean::before { background: var(--tf-green); }

/* Rooms */
.tfb-rooms { display: flex; align-items: flex-end; gap: 4px; padding: 10px 16px 0; background: #fff; border-bottom: 1px solid var(--tf-border); overflow-x: auto; }
.tfb-room {
	display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid transparent; border-bottom: 0;
	border-radius: 10px 10px 0 0; background: transparent; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--tf-text-2);
	position: relative; top: 1px; white-space: nowrap;
}
.tfb-room:hover { background: var(--tf-surface-2); color: var(--tf-text); }
.tfb-room.is-active { background: var(--tf-bg); border-color: var(--tf-border); color: var(--tf-text); }
.tfb-room em { font-style: normal; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: #f4f4f5; color: var(--tf-muted); }
.tfb-room-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tf-green); opacity: .7; }
.tfb-room-dot.is-dirty { background: var(--tf-amber); opacity: 1; }
.tfb-room.is-hidden .tfb-room-dot { background: #a3a3a3; }
.tfb-room-add { display: inline-flex; align-items: center; gap: 4px; height: 32px; margin-bottom: 4px; padding: 0 10px; border: 1px dashed var(--tf-border-strong); border-radius: 8px; background: transparent; color: var(--tf-text-2); font-weight: 600; font-size: 12px; cursor: pointer; white-space: nowrap; }
.tfb-room-add:hover { border-color: var(--tf-primary); color: var(--tf-primary); background: var(--tf-primary-50); }
.tfb-room-add .dashicons { font-size: 16px; width: 16px; height: 16px; }

.tfb-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr) 300px; }
@media (max-width: 1200px) { .tfb-main { grid-template-columns: 170px minmax(0, 1fr) 270px; } }
@media (max-width: 960px) {
	.tf-wrap-builder { height: auto; }
	.tfb-main { grid-template-columns: 1fr; }
	.tfb-palette { max-height: 220px; }
	.tfb-stage { height: 70vh; }
}

/* Palette */
.tfb-palette { overflow-y: auto; padding: 14px 12px; background: #fff; border-right: 1px solid var(--tf-border); }
.tfb-pal-section + .tfb-pal-section { margin-top: 18px; }
.tfb-pal-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--tf-muted); margin: 0 4px 8px; }
.tfb-pal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.tfb-pal-item {
	display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 7px; border-radius: 10px;
	border: 1px solid var(--tf-border); background: var(--tf-surface-2); cursor: grab; font-size: 11px; font-weight: 600; color: var(--tf-text-2);
	transition: border-color .15s, background .15s, transform .1s, box-shadow .15s;
}
.tfb-pal-item:hover { border-color: var(--tf-primary); background: #fff; color: var(--tf-text); box-shadow: var(--tf-shadow); transform: translateY(-1px); }
.tfb-pal-item:active { cursor: grabbing; }
.tfb-pal-item:focus-visible { outline: none; box-shadow: var(--tf-ring); }
.tfb-pal-svg { width: 44px; height: 44px; overflow: visible; }
.tfb-pal-svg .tf-t-top { fill: #fff; stroke: #b8afa4; stroke-width: 2; }
.tfb-pal-svg .tf-chair { fill: #ddd5ca; }
.tfb-pal-svg .tf-bench { fill: #c9b8a4; }

/* Stage */
.tfb-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--tf-bg); }
.tfb-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
.tfb-tgroup { display: flex; align-items: center; gap: 2px; padding: 3px; background: #fff; border: 1px solid var(--tf-border); border-radius: 10px; box-shadow: var(--tf-shadow-sm); }
.tfb-tgroup.is-disabled { opacity: .45; pointer-events: none; }
.tfb-tbtn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--tf-text-2); cursor: pointer; transition: background .12s, color .12s; }
.tfb-tbtn:hover:not(:disabled) { background: var(--tf-surface-2); color: var(--tf-text); }
.tfb-tbtn:disabled { opacity: .35; cursor: default; }
.tfb-tbtn.is-on { background: var(--tf-primary-50); color: var(--tf-primary); }
.tfb-tbtn.is-danger:hover { background: var(--tf-red-50); color: var(--tf-red); }
.tfb-tbtn .dashicons { font-size: 17px; width: 17px; height: 17px; }
.tfb-zoom-label { min-width: 54px; height: 30px; border: 0; background: transparent; font-weight: 700; font-size: 12px; color: var(--tf-text-2); cursor: pointer; border-radius: 7px; font-variant-numeric: tabular-nums; }
.tfb-zoom-label:hover { background: var(--tf-surface-2); }
.tfb-tspacer { flex: 1; }
.tfb-preview { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 12px; text-decoration: none; color: var(--tf-text-2); }
.tfb-preview:hover { color: var(--tf-primary); }
.tfb-preview .dashicons { font-size: 15px; width: 15px; height: 15px; }

.tfb-canvas-wrap { position: relative; flex: 1; min-height: 0; margin: 0 14px; border-radius: 16px; overflow: hidden; background: #ebe6df; background-image: radial-gradient(#d9d2c8 1px, transparent 1px); background-size: 18px 18px; box-shadow: inset 0 0 0 1px var(--tf-border); }
.tfb-canvas-wrap.is-drop { box-shadow: inset 0 0 0 2px var(--tf-primary); }
.tfb-svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; outline: none; cursor: default; }
.tfb-svg.is-pan-ready { cursor: grab; }
.tfb-svg.is-panning { cursor: grabbing; }
.tfb-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 5px 12px; border-radius: 999px; background: rgba(28, 25, 23, .72); color: #fff; font-size: 11px; font-weight: 500; pointer-events: none; white-space: nowrap; opacity: .85; }
@media (max-width: 960px) { .tfb-hint { display: none; } }
.tfb-status { display: flex; gap: 16px; align-items: center; padding: 8px 18px 12px; font-size: 12px; color: var(--tf-text-2); flex-wrap: wrap; }
.tfb-status strong { color: var(--tf-text); }
.tfb-status-sel { color: var(--tf-primary); font-weight: 600; }
.tfb-status-units { margin-left: auto; color: var(--tf-muted); }

/* Canvas element styles */
.tfb-svg .tf-floor { fill: #f6f1ea; stroke: #e2d9cd; stroke-width: 1.5; }
.tfb-svg .tf-t, .tfb-svg .tf-d { cursor: move; }
.tfb-svg .tf-t-top { fill: #fff; stroke: #b8afa4; stroke-width: 1.6; transition: stroke .12s; }
.tfb-svg .tf-chair { fill: #ddd5ca; stroke: #cfc5b8; stroke-width: 1; }
.tfb-svg .tf-bench { fill: #c9b8a4; stroke: #b5a28c; stroke-width: 1; }
.tfb-svg .tf-t-label { fill: #3b322a; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; pointer-events: none; }
.tfb-svg .tf-t-seats { fill: #8a7f73; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; pointer-events: none; }
.tfb-svg .tf-d-label, .tfb-svg .tf-d-area-label { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; pointer-events: none; }
.tfb-svg .tf-d-area-label { font-weight: 700; letter-spacing: .08em; }
.tfb-svg .tf-t:hover .tf-t-top { stroke: var(--tf-primary); }
.tfb-svg .tf-t.is-selected .tf-t-top { stroke: var(--tf-primary); stroke-width: 2.4; }
.tfb-svg .tf-d:hover { opacity: .88; }
.tfb-sel-box { fill: none; stroke: var(--tf-primary); stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.tfb-handle { fill: #fff; stroke: var(--tf-primary); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.tfb-handle:hover { fill: var(--tf-primary-100); }
.tfb-rot { cursor: grab; }
.tfb-rot-line { stroke: var(--tf-primary); stroke-width: 1.2; pointer-events: none; }
.tfb-marquee { fill: rgba(194, 65, 12, .07); stroke: var(--tf-primary); stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.tfb-guide { stroke: #ec4899; stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; }
.tfb-angle { fill: var(--tf-primary); font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 4px; }

/* Properties */
.tfb-props { overflow-y: auto; background: #fff; border-left: 1px solid var(--tf-border); }
.tfb-props-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--tf-border); background: linear-gradient(180deg, var(--tf-surface-2), #fff); }
.tfb-props-kicker { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--tf-primary); }
.tfb-props-title { font-size: 17px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tfb-group { padding: 14px 18px; border-bottom: 1px solid #f1ede8; display: flex; flex-direction: column; gap: 12px; }
.tfb-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--tf-muted); display: flex; align-items: center; gap: 6px; }
.tfb-unit { text-transform: none; letter-spacing: 0; font-weight: 500; padding: 1px 6px; border-radius: 5px; background: var(--tf-surface-2); }
.tfb-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tfb-field-label { font-size: 12px; font-weight: 600; color: var(--tf-text-2); }
.tfb-field-hint { font-size: 11.5px; color: var(--tf-muted); line-height: 1.4; }
.tfb-input { width: 100%; min-height: 34px !important; }
.tfb-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tfb-check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.tfb-seg { display: flex; padding: 3px; gap: 2px; border-radius: 9px; background: #f1ede8; }
.tfb-seg-wrap { display: grid; grid-template-columns: repeat(3, 1fr); }
.tfb-seg button { flex: 1; min-width: 44px; border: 0; background: transparent; padding: 6px 4px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 11.5px; color: var(--tf-text-2); }
.tfb-seg button:hover { color: var(--tf-text); }
.tfb-seg button.is-on { background: #fff; color: var(--tf-primary); box-shadow: var(--tf-shadow-sm); }
.tfb-color-row { display: flex; align-items: center; gap: 8px; }
.tfb-color { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--tf-border-strong); border-radius: 8px; background: #fff; cursor: pointer; }
.tfb-rot-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.tfb-actions { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.tfb-actions .dashicons { font-size: 14px; width: 14px; height: 14px; }
.tfb-align { display: flex; flex-wrap: wrap; gap: 4px; }
.tfb-align .tfb-tbtn { border: 1px solid var(--tf-border); }
.tfb-sections { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tfb-sections li { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.tfb-muted { color: var(--tf-muted); font-weight: 500; font-size: 12px; }
.tfb-shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0; font-size: 12px; align-items: center; }
.tfb-shortcuts dd { margin: 0; color: var(--tf-text-2); }
