/* Krula Party Room Layout Planner — Architectural Theme (Mosdos Krula Navy + Gold) */
:root {
  --navy: #1C1A4A;
  --navy-dark: #131135;
  --navy-soft: #2B2866;
  --gold: #C9A24A;
  --gold-bright: #DFBA63;
  --gold-soft: #F8F2E2;
  --gold-border: #E2CFA0;
  --ink: #1F2233;
  --muted: #5C627A;
  --line: #DCD9CE;
  --surface: #FFFFFF;
  --panel-bg: #F9F8F4;
  --canvas-bg: #EAE7DF;
  --paper: #FCFBF7;
  --danger: #C53030;
  --danger-bg: #FFF5F5;
  --success: #1E7A4C;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(28, 26, 74, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.hidden { display: none !important; }
.print-only { display: none; }
.mobile-only { display: none !important; }

/* TOP HEADER */
.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, #24215C 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 3px solid var(--gold);
  flex-shrink: 0;
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-logo {
  height: 36px; width: auto; object-fit: contain;
  background: transparent;
  border-radius: 4px; padding: 0; flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.28));
}
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--gold-bright); letter-spacing: 0.02em; white-space: nowrap; }

.topbar-room {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.room-select-wrap { display: flex; align-items: center; gap: 6px; }
.room-select {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  max-width: 240px;
  cursor: pointer;
}
.room-select option { color: var(--ink); background: #fff; }
.room-select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.dim-inputs {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 7px;
  padding: 3px 8px;
}
.dim-field { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gold-bright); font-weight: 600; }
.dim-field input {
  width: 48px;
  background: rgba(255,255,255,0.95);
  color: var(--navy);
  border: none;
  border-radius: 5px;
  padding: 3px 5px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.dim-field .unit { font-size: 11px; color: rgba(255,255,255,0.8); font-weight: 500; }
.dim-x { color: rgba(255,255,255,0.7); font-size: 12px; }

.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.btn-nav, .btn-gold, .btn-ghost-light, .icon-btn {
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.14s, transform 0.08s;
  white-space: nowrap;
}
.btn-nav {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.24);
}
.btn-nav:hover { background: rgba(255,255,255,0.22); }
.btn-gold {
  background: var(--gold);
  color: var(--navy-dark);
  border: 1px solid var(--gold-bright);
  font-weight: 700;
}
.btn-gold:hover { background: var(--gold-bright); }
.btn-ghost-light {
  background: transparent;
  color: var(--gold-bright);
  border: 1px solid rgba(201, 162, 74, 0.55);
}
.btn-ghost-light:hover { background: rgba(201, 162, 74, 0.18); }
.btn-xs { padding: 5px 8px; font-size: 12px; }
.count-badge {
  background: var(--gold);
  color: var(--navy-dark);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.icon-btn {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  padding: 6px 9px;
}

/* LIVE SUMMARY BAR */
.summary-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 7px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  z-index: 20;
}

.summary-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.metric-pill {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 8px;
  flex-shrink: 0;
}
.metric-seats {
  background: var(--navy);
  color: #fff;
}
.metric-seats .metric-val { font-size: 19px; font-weight: 800; color: var(--gold-bright); line-height: 1; }
.metric-seats .metric-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.9; }

.metric-tables {
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  color: var(--navy);
}
.metric-tables .metric-val { font-size: 18px; font-weight: 800; line-height: 1; }
.metric-tables .metric-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }

.metric-info { min-width: 0; flex: 1; }
.metric-room-line {
  font-size: 12.5px; color: var(--ink);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.metric-room-line .dot { color: #B4B0A4; }
.autofit-hint { color: var(--muted); font-weight: 500; }
.metric-checklist {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.overlap-pill {
  background: #FFF3E0;
  color: #B45309;
  border: 1px solid #F6C382;
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.canvas-controls {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap;
}
.ctrl-group {
  display: inline-flex; align-items: center;
  background: #F4F3EE;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.ctrl-lbl { font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 5px; }
.ctrl-select {
  border: none; background: transparent; font-size: 12px; font-weight: 600;
  color: var(--ink); padding: 3px 4px; cursor: pointer;
}
.ctrl-btn {
  border: none; background: transparent; color: var(--navy);
  font-size: 14px; font-weight: 700; padding: 4px 8px; border-radius: 5px;
  cursor: pointer; line-height: 1.1;
}
.ctrl-btn:hover:not(:disabled) { background: #E5E2D8; }
.ctrl-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ctrl-btn-text { font-size: 12px; }
.zoom-readout { font-size: 11.5px; font-weight: 700; color: var(--ink); min-width: 38px; text-align: center; }
.ctrl-btn-danger {
  border: 1px solid #ECCACA; background: #FFF8F8; color: var(--danger);
  font-size: 12px; padding: 5px 9px;
}
.ctrl-btn-danger:hover { background: #FDEAEA; }

/* ACTIVE SAVED LAYOUT STRIP */
.active-layout-strip {
  background: var(--gold-soft);
  border-bottom: 1px solid var(--gold-border);
  padding: 5px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--navy); flex-shrink: 0;
}
.active-layout-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.active-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }
.active-meta { color: var(--muted); }
.unsaved-tag {
  background: #FFF3CD; color: #8A5A00; border: 1px solid #F0D078;
  border-radius: 99px; padding: 1px 8px; font-size: 11px; font-weight: 700;
}
.link-btn {
  background: none; border: none; color: var(--navy); font-weight: 700; font-size: 12px;
  text-decoration: underline; cursor: pointer; padding: 0;
}

/* MAIN 3-COLUMN WORKSPACE */
.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* LEFT PALETTE */
.palette {
  width: 248px;
  flex-shrink: 0;
  background: var(--panel-bg);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.palette-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.palette-sec-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sec-hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 11px; }

.autofill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.autofill-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.14s, background 0.14s, transform 0.08s;
}
.autofill-btn:hover { border-color: var(--navy); background: #F5F6FB; }
.autofill-btn:active { transform: scale(0.98); }
.af-title { font-size: 12px; font-weight: 700; color: var(--navy); }
.af-sub { font-size: 10.5px; color: var(--muted); }
.autofill-featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #FDF9EE 0%, #F7EED4 100%);
  border-color: var(--gold);
}
.autofill-featured:hover { background: #F6E9C5; border-color: var(--navy); }

.palette-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pal-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 7px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.08s;
}
.pal-item:hover { border-color: var(--gold); box-shadow: 0 2px 6px rgba(28,26,74,0.08); }
.pal-item:active { cursor: grabbing; transform: scale(0.98); }
.pal-wide {
  grid-column: 1 / -1;
  flex-direction: row;
  text-align: left;
  padding: 8px 10px;
  gap: 10px;
}
.pal-info { display: flex; flex-direction: column; gap: 1px; }
.pal-name { font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.pal-dim { font-size: 10.5px; color: var(--muted); }

/* Palette mini icons */
.pal-ico { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico-round { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--navy); background: #fff; box-shadow: 0 0 0 3px #E8ECF4; margin: 2px; }
.ico-round.lg { width: 26px; height: 26px; }
.ico-rect { width: 28px; height: 14px; border-radius: 3px; border: 2px solid var(--navy); background: #fff; margin: 4px 0; }
.ico-rect.lg { width: 34px; }
.ico-head { width: 34px; height: 14px; border-radius: 3px; border: 2px solid var(--gold); background: var(--gold-soft); }
.ico-chair { width: 14px; height: 14px; border-radius: 3px; border: 2px solid var(--navy); border-top-width: 4px; background: #E8ECF4; margin: 4px 0; }
.ico-row { width: 30px; height: 10px; border-radius: 2px; background: repeating-linear-gradient(90deg, #3B4268 0 4px, transparent 4px 6px); margin: 5px 0; }
.ico-row.lg { width: 36px; }
.ico-mechitza { width: 34px; height: 6px; border-top: 3px dashed #B88B2E; border-bottom: 1px solid #B88B2E; }
.ico-stage { width: 28px; height: 16px; border-radius: 3px; background: #E6E2F0; border: 2px solid var(--navy); }
.ico-dance { width: 22px; height: 22px; border-radius: 3px; border: 1.5px solid var(--gold); background: repeating-conic-gradient(#F5ECD8 0% 25%, #E7D8B6 0% 50%) 50% / 10px 10px; }
.ico-buffet { width: 28px; height: 14px; border-radius: 3px; background: #EEF5F0; border: 2px solid #2F6B4F; }
.ico-bar { width: 26px; height: 14px; border-radius: 3px; background: #EAF0F8; border: 2px solid #2B548C; }
.ico-door { width: 20px; height: 16px; border-left: 2.5px solid var(--navy); border-bottom: 2px dashed var(--gold); border-bottom-right-radius: 16px; }
.ico-pillar { width: 16px; height: 16px; background: var(--navy); border-radius: 2px; }
.ico-zone { width: 28px; height: 22px; border-radius: 5px; border: 1.5px dashed var(--navy); font-size: 12px; font-weight: 800; color: var(--navy); background: #fff; }

/* CENTER CANVAS STAGE */
.canvas-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas-bg);
  position: relative;
}

.canvas-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  touch-action: pan-x pan-y;
}

.canvas-sheet {
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(28, 26, 74, 0.12), 0 1px 3px rgba(28, 26, 74, 0.08);
  padding: 8px;
  display: inline-block;
  flex-shrink: 0;
}

.floor-svg {
  display: block;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.floor-item { cursor: grab; }
.floor-item:active { cursor: grabbing; }
.floor-item.selected .sel-ring { display: block; }
.sel-ring { display: none; }

/* RIGHT INSPECTOR */
.inspector {
  width: 248px;
  flex-shrink: 0;
  background: var(--panel-bg);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 14px 12px;
}

.inspector-empty {
  text-align: center;
  padding: 28px 10px;
  color: var(--muted);
}
.insp-empty-ico { font-size: 30px; margin-bottom: 8px; }
.inspector-empty h3 { margin: 0 0 6px; font-size: 14px; color: var(--navy); }
.inspector-empty p { margin: 0 0 16px; font-size: 12.5px; line-height: 1.45; }
.insp-tips {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink);
}

.inspector-body { display: flex; flex-direction: column; gap: 13px; }
.insp-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.insp-type-badge {
  font-size: 13.5px; font-weight: 800; color: var(--navy);
}
.insp-dim-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.icon-btn-dark {
  background: #ECEAE2; border: none; color: var(--ink);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-weight: 700;
}
.icon-btn-dark:hover { background: #DEDBD0; }

.insp-field { display: flex; flex-direction: column; gap: 5px; }
.insp-field > label {
  font-size: 11.5px; font-weight: 700; color: var(--navy);
  display: flex; justify-content: space-between; align-items: center;
}
.field-hint { font-weight: 500; color: var(--muted); font-size: 11px; }
.insp-field input[type="text"],
.insp-field input[type="number"],
.insp-field select {
  width: 100%;
  border: 1px solid #CFCBC0;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}
.insp-field input:focus, .insp-field select:focus {
  outline: 2px solid var(--gold);
  border-color: var(--navy);
}

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper input { text-align: center; font-weight: 700; }
.step-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1px solid #CFCBC0; background: #fff; color: var(--navy);
  border-radius: 7px; font-size: 18px; font-weight: 700; cursor: pointer;
}
.step-btn:hover { background: var(--gold-soft); border-color: var(--gold); }

.rot-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.rot-btn {
  border: 1px solid #CFCBC0; background: #fff; color: var(--navy);
  border-radius: 6px; padding: 6px 2px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.rot-btn:hover { background: var(--gold-soft); border-color: var(--gold); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; }
.mini-field input { padding: 6px 7px !important; font-size: 12.5px !important; }

.insp-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding-top: 8px; border-top: 1px solid var(--line);
}

/* SHARED BUTTONS */
.btn-primary, .btn-secondary, .btn-danger, .btn-wa {
  border-radius: 7px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-soft); }
.btn-secondary { background: #fff; color: var(--navy); border-color: #CFCBC0; }
.btn-secondary:hover { background: #F2F0E8; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #F2B8B5; }
.btn-danger:hover { background: #FDE2E2; }
.btn-wa { background: #1B873F; color: #fff; width: 100%; }
.btn-wa:hover { background: #157033; }

/* MODALS */
.modal {
  position: fixed; inset: 0;
  background: rgba(19, 17, 53, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-card {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
  border-top: 4px solid var(--gold);
}
.modal-wide { max-width: 640px; }
.modal-sm { max-width: 380px; }
.modal-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.modal-close {
  background: #F2F1EC; border: none; width: 28px; height: 28px;
  border-radius: 7px; cursor: pointer; font-weight: 700; color: var(--ink);
}
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 75vh; overflow-y: auto; }
.modal-desc { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; flex-wrap: wrap; }

.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12px; font-weight: 700; color: var(--navy); }
.form-field input, .form-field textarea {
  border: 1px solid #CFCBC0; border-radius: 7px; padding: 8px 10px;
  font-size: 13.5px; font-family: var(--font); color: var(--ink);
}
.form-field input:focus, .form-field textarea:focus { outline: 2px solid var(--gold); border-color: var(--navy); }
.readonly-pill {
  background: var(--gold-soft); border: 1px solid var(--gold-border);
  border-radius: 7px; padding: 8px 10px; font-size: 12.5px; font-weight: 700; color: var(--navy);
}

.share-url-row { display: flex; gap: 8px; }
.share-url-row input {
  flex: 1; border: 1px solid #CFCBC0; border-radius: 7px; padding: 8px 10px;
  font-size: 13px; background: #F8F8F5; color: var(--ink);
}

/* SAVED LIST */
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-empty {
  text-align: center; padding: 28px 12px; color: var(--muted); font-size: 13.5px;
}
.saved-row {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #FCFBF9;
}
.saved-row:hover { border-color: var(--gold); }
.saved-info { min-width: 0; flex: 1; }
.saved-name { font-size: 14px; font-weight: 700; color: var(--navy); }
.saved-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.saved-btns { display: flex; gap: 6px; flex-shrink: 0; }
.saved-btns button { padding: 6px 10px; font-size: 12px; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-dark);
  color: #fff;
  border: 1px solid var(--gold);
  padding: 9px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  z-index: 200;
  max-width: 92vw;
  text-align: center;
}

/* DRAWER BACKDROP */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(19, 17, 53, 0.45); z-index: 40;
}

/* =========================================================
   V3 UPGRADES: PIN LOGIN GATE, SHARED VIEW, ROOM EDIT BAR,
   CHAIR MODES, SMART TABLE JOIN, 4-TAB SETTINGS MODAL
   ========================================================= */

.btn-settings {
  background: rgba(201, 162, 74, 0.2);
  border-color: rgba(201, 162, 74, 0.55);
  color: #FFF4D4;
}
.btn-settings:hover { background: rgba(201, 162, 74, 0.34); }
.btn-signout { padding: 6px 9px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-xs-full { width: 100%; padding: 6px 10px; font-size: 12px; justify-content: center; }

/* PIN LOGIN GATE */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: radial-gradient(circle at 30% 20%, #262362 0%, #131136 65%, #0D0B26 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}
.login-gate.hidden { display: none !important; }
.login-card {
  width: 100%;
  max-width: 380px;
  background: #FFFFFF;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(201, 162, 74, 0.45);
}
.login-brand {
  background: linear-gradient(135deg, #1C1A4A 0%, #272466 100%);
  color: #fff;
  text-align: center;
  padding: 24px 20px 20px;
  border-bottom: 3px solid var(--gold);
}
.login-logo {
  height: 54px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  margin: 0 auto 10px;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}
.login-org {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
  margin-bottom: 4px;
}
.login-brand h1 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
}
.login-sub {
  margin: 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}
.login-form {
  padding: 18px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pin-input {
  width: 100%;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.35em;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--navy);
  background: #FAF9F6;
}
.pin-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 74, 0.22);
}
.pin-error {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}
.btn-login-submit {
  width: 100%;
  padding: 11px 16px;
  font-size: 14.5px;
  justify-content: center;
}
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 20px 20px;
}
.kp-btn {
  padding: 12px 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  background: #F4F5F8;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s, transform 0.06s;
}
.kp-btn:hover { background: #E9EBF3; }
.kp-btn:active { transform: scale(0.96); background: #DDE1EE; }
.kp-fn { font-size: 13px; color: var(--muted); background: #FAF9F6; }

/* READ-ONLY SHARED VIEW BANNER */
.shared-banner {
  background: linear-gradient(135deg, var(--navy) 0%, #262362 100%);
  color: #fff;
  padding: 10px 16px;
  border-bottom: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.shared-banner-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.shared-logo { height: 36px; width: auto; object-fit: contain; flex-shrink: 0; }
.shared-title { font-size: 15.5px; font-weight: 700; line-height: 1.2; }
.shared-sub { font-size: 12px; color: var(--gold-bright); margin-top: 2px; }
.shared-banner-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.shared-badge {
  background: rgba(201, 162, 74, 0.22);
  color: var(--gold-bright);
  border: 1px solid rgba(201, 162, 74, 0.5);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.readonly-mode #mainTopbar,
body.readonly-mode #roomEditBar,
body.readonly-mode #activeLayoutStrip,
body.readonly-mode #palettePanel,
body.readonly-mode #inspectorPanel,
body.readonly-mode .canvas-controls {
  display: none !important;
}

/* ROOM BLUEPRINT EDIT MODE BANNER */
.room-edit-bar {
  background: linear-gradient(90deg, #27225E 0%, #1C1A4A 100%);
  color: #fff;
  border-bottom: 2px solid var(--gold);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.reb-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.reb-badge {
  background: var(--gold);
  color: var(--navy-dark);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 5px;
}
.reb-sqft { color: var(--gold-bright); font-weight: 700; }
.reb-hint { color: rgba(255,255,255,0.82); font-size: 12px; }
.reb-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-reb {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-reb:hover { background: rgba(255,255,255,0.24); }
.btn-reb-ghost { background: transparent; border-color: rgba(255,255,255,0.2); }

/* SUMMARY BAR ENHANCEMENTS */
.shape-tag, .cols-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}
.shape-tag { background: #EDE9FE; color: #4C1D95; }
.cols-tag { background: #E2E8F0; color: #334155; }
.ctrl-btn-toggle {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #F4F5F8;
  color: var(--muted);
}
.ctrl-btn-toggle.active {
  background: #FFF9E6;
  border-color: var(--gold);
  color: var(--navy);
}
.active-strip-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }

/* PALETTE SECTIONS (v3 class names) */
.palette-section {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
}
.palette-sec-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
  margin-bottom: 8px;
}
.sec-hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 10.5px; margin-left: 4px; }
.sec-link {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
}
.sec-link:hover { background: #F1F2F8; color: var(--gold); }

/* RIGHT INSPECTOR ENHANCEMENTS */
.insp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.insp-type {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold);
}
.insp-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 2px;
}
.insp-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.insp-box {
  background: #FAF9F5;
  border: 1px solid #E5DFD0;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}
.insp-box-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.insp-join-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.35;
}
.insp-join-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.insp-join-btns button { flex: 1 1 auto; justify-content: center; }

/* Chair mode pills */
.chair-mode-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.chair-mode-pills.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.chair-mode-pill {
  padding: 6px 6px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}
.chair-mode-pill:hover { border-color: var(--navy); }
.chair-mode-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.chair-stepper-row {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.step-btn {
  padding: 7px 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.step-btn:hover { background: #F1F2F7; }
.step-btn-add {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.step-btn-add:hover { background: #2B2868; }
.step-input {
  width: 100%;
  text-align: center;
  padding: 6px 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.perside-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #DFD8C8;
}
.perside-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.perside-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.perside-cell {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}
.perside-cell span { color: var(--muted); font-weight: 600; }
.mini-step { display: inline-flex; align-items: center; gap: 4px; }
.mini-step button {
  width: 22px; height: 22px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #F4F5F8;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.mini-step button:hover { background: #E6E8F0; }
.mini-step strong { min-width: 16px; text-align: center; font-size: 12px; color: var(--navy); }

.seg-btns {
  display: flex;
  gap: 4px;
  background: #F1F2F7;
  padding: 3px;
  border-radius: 8px;
}
.seg-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.seg-btn.active {
  background: var(--navy);
  color: #fff;
}

/* =========================================================
   4-TAB SETTINGS MODAL
   ========================================================= */
.modal-lg { max-width: 680px; width: 96%; }
.modal-xl {
  max-width: 1000px;
  width: 96%;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  background: #F6F5F0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.stab-btn {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.stab-btn:hover { color: var(--navy); }
.stab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
  background: #fff;
  border-radius: 8px 8px 0 0;
}
.settings-body {
  overflow-y: auto;
  padding: 16px 18px 18px;
  flex: 1;
  min-height: 0;
}
.stab-pane.hidden { display: none !important; }

/* Settings Tab 1: Rooms & Difficult Shapes */
.rooms-split {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
.rooms-sidebar {
  background: #F8F7F3;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.rooms-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--navy);
}
.st-room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.st-room-item {
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.st-room-item:hover { border-color: var(--gold); }
.st-room-item.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.st-ri-name { font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.st-ri-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 11px;
  margin-top: 3px;
  opacity: 0.82;
}
.st-ri-tag {
  background: rgba(201, 162, 74, 0.2);
  color: var(--navy);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}
.st-room-item.active .st-ri-tag {
  background: rgba(201, 162, 74, 0.3);
  color: var(--gold-bright);
}

.rooms-editor { min-width: 0; }
.re-top-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.re-top-row .form-field { flex: 1 1 220px; margin-bottom: 0; }
.re-top-btns { display: flex; gap: 6px; flex-wrap: wrap; }

.re-dims-preview-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 14px;
  margin-bottom: 14px;
  align-items: start;
}
.ftin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.ftin-group {
  background: #FAF9F5;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.ftin-lbl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 5px;
}
.ftin-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ftin-inputs input {
  width: 60px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}
.ftin-inputs span { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-right: 4px; }

.shape-mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.sm-card {
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.sm-card:hover { border-color: var(--gold); }
.sm-card.active {
  background: #FFF9EA;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,162,74,0.22);
}
.sm-ico { font-size: 16px; line-height: 1; }

.re-preview-col {
  background: #F8F9FC;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.mini-bp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}
.bp-sqft-badge {
  background: var(--navy);
  color: var(--gold-bright);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
}
.mini-bp-svg {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #E2E6F0;
}

.sub-box {
  background: #FAF9F6;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 12px;
}
.sub-box-accent {
  background: #F7F6FC;
  border-color: #D2D5E8;
}
.sub-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.sub-box-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--navy);
}
.sub-box-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 8px;
  line-height: 1.4;
}

.poly-preset-row, .preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.btn-chip {
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.btn-chip:hover { border-color: var(--gold); background: #FFFBF0; }
.btn-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.compact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compact-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 6px 4px;
}
.compact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}
.cr-idx {
  font-weight: 800;
  color: var(--navy);
  min-width: 22px;
  font-size: 11.5px;
}
.cr-name {
  flex: 1 1 110px;
  min-width: 80px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
}
.cr-mini {
  width: 58px;
  padding: 4px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  text-align: center;
}
.cr-sel, .mini-select {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11.5px;
  background: #fff;
  color: var(--navy);
  font-weight: 600;
}
.btn-icon-del {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #FECACA;
  background: #FEF2F2;
  color: #B91C1C;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-icon-del:hover { background: #FEE2E2; }

.st-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.st-status-hint { font-size: 12px; color: var(--muted); }

/* Settings Tab 2: Tables & Chairs Catalog */
.cat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cat-subtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cat-subbtn {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #F4F5F8;
  color: var(--navy);
  cursor: pointer;
}
.cat-subbtn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.cat-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.cat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: opacity 0.15s;
}
.cat-card.cat-hidden { opacity: 0.58; background: #F8F8FA; }
.cat-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.cat-vis {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.cat-name-inp {
  flex: 1 1 160px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}
.cat-row-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.cat-row-fields label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--ink);
}
.cat-row-fields input[type="number"] {
  width: 64px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}
.cat-sel {
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: var(--navy);
  font-weight: 600;
}
.cat-dim-hint { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cat-color { width: 32px; height: 26px; border: 1px solid var(--border); border-radius: 5px; cursor: pointer; padding: 1px; }

/* Settings Tab 3: Spacing & Prefs */
.prefs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  margin-top: 6px;
}

/* Settings Tab 4: Security / PINs */
.sec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.sec-form { display: flex; flex-direction: column; gap: 10px; }
.sec-add-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.sec-add-row input, .sec-add-row select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
}
.sec-add-row input { flex: 1 1 110px; min-width: 90px; }

.share-quick-row {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* SVG interactive cursors & join highlight */
.svg-bp-handle { cursor: grab; }
.svg-bp-handle:active { cursor: grabbing; }
.svg-bp-add { cursor: pointer; }
.svg-bp-item { cursor: grab; }
.svg-bp-item:active { cursor: grabbing; }

/* =========================================================
   RESPONSIVE: TABLET & MOBILE (ZERO HORIZONTAL OVERFLOW)
   ========================================================= */
@media (max-width: 1020px) {
  .mobile-only { display: inline-flex !important; }
  .palette-head.mobile-only { display: flex !important; }
  .palette {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 292px;
    max-width: 88vw;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .palette.open { transform: translateX(0); }

  .inspector {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    max-height: 54dvh;
    border-left: none;
    border-top: 3px solid var(--gold);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 26px rgba(0,0,0,0.18);
    z-index: 35;
    transform: translateY(105%);
    transition: transform 0.2s ease;
  }
  .inspector.has-selection { transform: translateY(0); }
  .inspector-empty { display: none; }

  .rooms-split { grid-template-columns: 1fr; }
  .re-dims-preview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  html, body { max-width: 100vw; overflow-x: hidden; }
  .topbar {
    flex-wrap: wrap;
    padding: 7px 10px;
    gap: 6px;
  }
  .brand-sub { display: none; }
  .brand-logo { height: 28px; }
  .brand-title { font-size: 13.5px; }
  .topbar-room {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .room-select-wrap { flex: 1 1 0; min-width: 0; }
  .room-select { width: 100%; max-width: none; font-size: 12px; padding: 5px 6px; }
  .dim-inputs { padding: 2px 5px; gap: 3px; }
  .dim-field input { width: 38px; font-size: 11.5px; padding: 2px 3px; }
  .topbar-actions { gap: 4px; flex-wrap: wrap; }
  .btn-nav, .btn-gold { padding: 5px 7px; font-size: 11.5px; }
  .btn-print { display: inline-flex; font-size: 11px; padding: 5px 7px; }
  .summary-bar { padding: 6px 10px; gap: 6px; flex-wrap: wrap; }
  .summary-metrics { width: 100%; flex-wrap: wrap; gap: 6px; }
  .metric-seats .metric-val, .metric-tables .metric-val { font-size: 16px; }
  .metric-pill { padding: 4px 8px; }
  .autofit-hint, .autofit-dot { display: none; }
  .canvas-controls { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 5px; }
  .canvas-viewport { padding: 8px; }
  .saved-row { flex-direction: column; align-items: stretch; }
  .saved-btns { justify-content: flex-end; }
  .modal-card, .modal-xl, .modal-lg { width: 98%; max-width: 100%; border-radius: 12px; }
  .settings-body { padding: 12px; }
  .ftin-grid, .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .shape-mode-cards { grid-template-columns: 1fr; }
  .reb-hint { display: none; }
}

/* =========================================================
   PRINT / PDF 1-PAGE ARCHITECTURAL SHEET
   ========================================================= */
@page {
  size: landscape;
  margin: 0.35in;
}

@media print {
  html, body {
    height: auto !important;
    background: #fff !important;
    overflow: visible !important;
    display: block !important;
  }
  .no-print, .sel-ring, .svg-bp-overlay { display: none !important; }
  .print-only { display: block !important; }

  .workspace, .canvas-stage, .canvas-viewport, .canvas-sheet {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    height: auto !important;
    width: 100% !important;
  }

  .print-header {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 2.5px solid #1C1A4A;
    padding-bottom: 8px;
    margin-bottom: 10px;
  }
  .print-brand { display: flex; align-items: center; gap: 10px; }
  .print-logo {
    height: 44px;
    width: auto;
    background: #1C1A4A !important;
    padding: 5px 10px;
    border-radius: 7px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-org { font-size: 9pt; font-weight: 800; letter-spacing: 0.08em; color: #C9A24A; }
  .print-title { margin: 1px 0 2px; font-size: 16pt; color: #1C1A4A; }
  .print-sub { font-size: 10pt; color: #4A5068; }
  .print-meta-box {
    text-align: right;
    font-size: 9.5pt;
    line-height: 1.45;
    color: #1F2233;
    max-width: 42%;
  }

  .floor-svg {
    width: 100% !important;
    height: auto !important;
    max-height: 5.2in !important;
    margin: 0 auto !important;
  }

  .print-footer {
    margin-top: 10px;
    page-break-inside: avoid;
  }
  .print-checklist-box {
    border: 1.5px solid #1C1A4A;
    border-radius: 6px;
    padding: 7px 12px;
    background: #FCFBF7 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-checklist-title {
    font-size: 8.5pt;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #1C1A4A;
    margin-bottom: 5px;
  }
  .print-checklist-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 9.5pt;
    color: #1F2233;
  }
  .print-footnote {
    display: flex;
    justify-content: space-between;
    font-size: 8pt;
    color: #6B7088;
    margin-top: 5px;
  }
}

