:root {
  color-scheme: light;
  --ink: #11131f;
  --muted: #5b6270;
  --panel: #f4f1ec;
  --accent: #c65b2b;
  --accent-dark: #8e3b1b;
  --backdrop: radial-gradient(circle at top, #fef7ea 0%, #f4dcc8 45%, #e9c3a9 100%);
  --border: #e3d7cb;
  --shadow: 0 20px 45px rgba(20, 12, 6, 0.18);
  --status-idle: #4caf50;
  --status-reserved: #ff9800;
  --status-sold: #f44336;
  --corridor: #b0bec5;
  --restricted: #78909c;
  --entrance: #26a69a;
  --grid-line: #d7cec4;
  --grid-bg: #faf6f0;
  --elevator: #5c6bc0;
  --escalator: #7e57c2;
  font-family: "PP Neue Montreal", "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--backdrop);
  color: var(--ink);
  min-height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.hidden { display: none !important; }

/* --- Topbar --- */
.topbar {
  --topbar-control-h: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.expo-name-input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: white;
  color: var(--ink);
  width: 180px;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.floor-tabs {
  display: flex;
  gap: 4px;
}

.floor-tab {
  height: var(--topbar-control-h);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.floor-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tab-close {
  margin-left: 6px;
  font-size: 14px;
  opacity: 0.6;
  cursor: pointer;
}

.tab-close:hover { opacity: 1; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-right .btn-sm,
.topbar-right .btn-accent,
.topbar-right .mode-btn,
.topbar-left .file-switch-btn {
  height: var(--topbar-control-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}

.topbar-right .mode-toggle .mode-btn {
  border-radius: 0;
}

.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.mode-toggle .mode-btn + .mode-btn {
  border-left: 1px solid var(--border);
}

.mode-btn {
  padding: 6px 14px;
  border: none;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.mode-btn.active {
  background: var(--ink);
  color: white;
}

.btn-accent {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.btn-accent:hover { background: var(--accent-dark); }

.btn-icon {
  width: 32px;
  height: var(--topbar-control-h);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { background: var(--panel); }

/* --- Stage layout --- */
.stage {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--border);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 2px 0;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.shortcut-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

.muted { color: var(--muted); font-size: 13px; }

/* --- Floor size row --- */
.floor-size-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.floor-size-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.floor-size-row input {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: white;
}

.btn-sm {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 12px;
}

.btn-sm:hover { background: var(--panel); }

.btn-danger {
  background: var(--status-sold);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  margin-top: 6px;
}

/* --- Toolbar --- */
.toolbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 16px;
}

.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  line-height: 1;
}

.tool-icon-mouse svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tool-btn.active .tool-icon-mouse {
  filter: brightness(1.15);
}

.tool-btn small { font-size: 10px; color: var(--muted); }

.tool-btn.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.tool-btn.active small { color: rgba(255,255,255,0.7); }

/* --- Template options --- */
.template-options {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tpl-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 12px;
}

.tpl-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* --- Booth card --- */
.booth-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.booth-intent-box {
  border: 1px solid #e8ddd2;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
}

.booth-intent-box.is-active {
  border-color: #b9dfbe;
  background: #f4fbf5;
}

.booth-intent-box.is-cancelled {
  border-color: #e7d4c5;
  background: #fbf5f1;
}

.booth-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.booth-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.booth-list-row strong {
  min-width: 52px;
}

.sold-booth-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.sold-booth-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(244, 67, 54, 0.08);
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sold-booth-item strong {
  font-size: 12px;
  color: var(--ink);
}

.sold-booth-item span {
  font-size: 11px;
  color: var(--muted);
}

.sold-booth-item:hover {
  background: rgba(244, 67, 54, 0.14);
}

#open-booth-manager {
  width: 100%;
}

.booth-manager-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding: 2px 4px 8px 2px;
}

.booth-manager-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.booth-filter-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.booth-floor-filter {
  width: 220px;
}

.booth-search-input {
  flex: 1;
  min-width: 220px;
}

.booth-manager-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  min-height: 0;
  flex: 1;
}

.booth-nav-list {
  border: 1px solid #e8ddd2;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.booth-nav-item {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  font-size: 12px;
  text-align: left;
  padding: 6px 10px;
  cursor: pointer;
}

.booth-nav-item:hover {
  background: #f7f2ec;
}

.booth-nav-item.is-active {
  border-color: #c65b2b;
  background: #fbe7d8;
  color: #8e3b1b;
  font-weight: 700;
}

.booth-manager-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.booth-manager-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.booth-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.booth-manager-card {
  border: 1px solid #e8ddd2;
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #fff 0%, #fdfaf6 100%);
  box-shadow: 0 6px 18px rgba(43, 31, 18, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.booth-manager-card.is-active {
  border-color: #d28a5f;
  box-shadow: 0 10px 24px rgba(198, 91, 43, 0.18);
  background: linear-gradient(180deg, #fff8f2 0%, #fff 100%);
}

.booth-manager-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.booth-jump-btn {
  min-width: 90px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}

.booth-jump-btn:hover {
  background: #f7f2ec;
}

.booth-manager-fields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(250px, 1fr));
  gap: 12px 14px;
}

.booth-manager-input {
  width: 100%;
  min-height: 36px;
  font-size: 14px;
}

.booth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.booth-field span {
  font-size: 12px;
  color: #575c68;
  font-weight: 600;
}

.booth-field-wide {
  grid-column: 1 / -1;
}

.booth-delete-btn {
  border-color: #f2b9b9;
  color: #b42626;
  background: #fff7f7;
  min-width: 64px;
}

.drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.34);
}

.booth-drawer {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(900px, 94vw);
  background: #f8f5f0;
  box-shadow: -12px 0 28px rgba(0,0,0,0.18);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.booth-drawer .export-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8f5f0;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8ddd2;
}

.booth-drawer .booth-input {
  width: 100%;
  border-radius: 10px;
  padding: 8px 10px;
}

.booth-status-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.booth-status-chip.is-reserved {
  color: #8a4e00;
  background: #ffe8c2;
}

.booth-status-chip.is-sold {
  color: #8f2323;
  background: #ffd9d9;
}

.booth-input {
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  width: 90px;
  background: white;
}

.status-idle { color: var(--status-idle); font-weight: 600; }
.status-reserved { color: var(--status-reserved); font-weight: 600; }
.status-sold { color: var(--status-sold); font-weight: 600; }
.status-led-screen { color: #607d8b; font-weight: 600; }
.status-elevator { color: var(--elevator); font-weight: 600; }
.status-escalator { color: var(--escalator); font-weight: 600; }

.selected-booth-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff3e8;
  border: 1px solid #f0c8ad;
  color: var(--accent-dark);
  font-size: 14px;
  letter-spacing: 0.02em;
}

/* --- Work area --- */
.work-area {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.5);
}

.canvas-action-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(23, 17, 12, 0.12);
}

.canvas-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-action-more {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(23, 17, 12, 0.14);
  min-width: 120px;
}

.canvas-action-more.hidden {
  display: none;
}

.canvas-action-more-toggle {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.grid-tips-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 6px 16px;
  font-size: 12px;
  color: #6b5e54;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
}

.tenant-legend {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(23, 17, 12, 0.12);
  font-size: 13px;
}

.tenant-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #2d313a;
}

.tenant-chip {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.tenant-chip-rented { background: #f25f4c; }
.tenant-chip-available { background: #4caf50; }

.tenant-sales-wrap {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 12;
}

.tenant-booth-wrap {
  position: absolute;
  top: 70px;
  left: 14px;
  z-index: 12;
}

.tenant-booth-card {
  min-width: 250px;
  border: 1px solid #d9dfe7;
  border-radius: 12px;
  background: rgba(248, 251, 255, 0.94);
  box-shadow: 0 8px 20px rgba(18, 35, 52, 0.12);
  padding: 10px 12px;
}

.tenant-booth-title {
  font-size: 13px;
  color: #27425e;
  font-weight: 700;
  margin-bottom: 6px;
}

.tenant-booth-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #2d313a;
}

.tenant-sales-card {
  min-width: 260px;
  border: 1px solid #efcfb8;
  border-radius: 12px;
  background: rgba(255, 248, 241, 0.94);
  box-shadow: 0 8px 20px rgba(52, 31, 14, 0.12);
  padding: 10px 12px;
}

.tenant-sales-title {
  font-size: 13px;
  color: #8e3b1b;
  font-weight: 700;
  margin-bottom: 6px;
}

.tenant-sales-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #2d313a;
}

.tenant-sales-body a {
  color: #8e3b1b;
  text-decoration: none;
}

.tenant-sales-body a:hover {
  text-decoration: underline;
}

.tenant-interest-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e4c9b6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tenant-interest-title {
  font-size: 12px;
  font-weight: 700;
  color: #8e3b1b;
}

.tenant-interest-input {
  width: 100%;
  border-radius: 8px;
  min-height: 34px;
}

.tenant-interest-btn {
  align-self: flex-start;
}

.tenant-interest-state {
  border: 1px solid #edd9c8;
  border-radius: 8px;
  background: #fffaf5;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: #3b404a;
}

.tenant-interest-state small {
  color: #7b8190;
}

.tenant-share-selected {
  display: none;
}

.tenant-share-selected.has-content {
  display: block;
  border: 1px solid #e8ddd2;
  border-radius: 10px;
  background: #fffaf5;
  padding: 10px;
}

.tenant-selected-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tenant-selected-title {
  font-size: 12px;
  font-weight: 700;
  color: #8e3b1b;
}

.tenant-selected-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: #2d313a;
}

.tenant-share-history {
  border: 1px solid #e8ddd2;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.tenant-share-history-list {
  margin-top: 8px;
  max-height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tenant-history-item {
  border: 1px solid #ece4db;
  border-radius: 8px;
  background: #fffaf6;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tenant-history-item strong {
  font-size: 12px;
  color: #20242d;
}

.tenant-history-item span {
  font-size: 11px;
  color: #5d6371;
}

.tenant-history-item small {
  font-size: 10px;
  color: #8b909b;
}

body.tenant-view .panel {
  display: none;
}

body.tenant-view .stage {
  grid-template-columns: 1fr;
}

body.tenant-view #add-floor-btn,
body.tenant-view .tab-close,
body.tenant-view .canvas-action-bar,
body.tenant-view .viewport-controls {
  display: none !important;
}

body.tenant-view .expo-name-input {
  pointer-events: none;
  background: #f7f2ec;
}

.grid-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#scene3d {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Export overlay --- */
.export-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.export-modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}

.export-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
}

.export-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
}

.export-preview {
  background: var(--panel);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  overflow: auto;
  max-height: 50vh;
  white-space: pre-wrap;
  word-break: break-all;
}

.floor-delete-modal {
  width: min(520px, 92vw);
}

.tenant-share-modal {
  width: min(560px, 92vw);
}

.auth-modal {
  width: min(560px, 92vw);
}

.file-list-modal {
  width: min(620px, 92vw);
}

.file-switch-btn {
  height: var(--topbar-control-h) !important;
  min-height: var(--topbar-control-h) !important;
  width: var(--topbar-control-h);
  min-width: var(--topbar-control-h);
  padding: 0 !important;
  border-radius: 8px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dcc5ae;
  background: linear-gradient(180deg, #fffaf4 0%, #f7ede2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
  line-height: 1;
  font-size: 14px;
  font-weight: 700;
}

.file-switch-btn:hover {
  border-color: #cb9a72;
  background: linear-gradient(180deg, #fff6ee 0%, #f6e7d8 100%);
}

.file-switch-btn:active {
  transform: translateY(1px);
}

.file-switch-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-block;
}

.file-switch-icon i {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1.5px solid #8f6c4c;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.9);
}

.file-switch-icon i:first-child {
  left: 0;
  top: 4px;
}

.file-switch-icon i:last-child {
  right: 0;
  top: 0;
}

.expo-name-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.expo-name-input.is-name-editing {
  cursor: text;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(198, 91, 43, 0.12);
}

.file-list-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 56vh;
  overflow-y: auto;
}

.file-list-toolbar {
  display: flex;
  justify-content: flex-end;
}

.file-list-item {
  border: 1px solid #e8ddd2;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-list-item.is-current {
  border-color: #d28a5f;
  background: #fff8f1;
}

.file-list-main {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.file-list-main:disabled {
  cursor: default;
}

.file-list-main strong {
  font-size: 14px;
  color: #1f2530;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.file-list-main small {
  font-size: 12px;
  color: #66707f;
}

.file-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.auth-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.auth-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #3a3f49;
}

.auth-divider {
  height: 1px;
  background: var(--border);
}

.floor-delete-body {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.floor-delete-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}

.floor-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.snapshot-modal {
  width: min(640px, 92vw);
}

.snapshot-preview {
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8f5f0;
}

.snapshot-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.snapshot-label {
  font-size: 12px;
  color: var(--muted);
  min-width: 64px;
}

.snapshot-input {
  width: 100%;
  border-radius: 8px;
  padding: 7px 10px;
}

/* --- Version list --- */
.version-list {
  max-height: 50vh;
  overflow-y: auto;
}

.version-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.version-item:last-child { border-bottom: none; }

.version-preview {
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.version-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0ebe4;
  font-size: 10px;
  color: var(--muted);
}

.version-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.version-info strong { font-size: 13px; }
.version-info small { font-size: 11px; color: var(--muted); }

.version-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.version-restore {
  background: var(--accent) !important;
  color: white !important;
  border: none !important;
}

.version-delete {
  color: var(--status-sold);
  font-size: 16px;
}

/* --- Viewport Controls --- */
.viewport-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  user-select: none;
}

.vc-zoom-row {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.vc-zoom-label {
  font-size: 12px;
  font-weight: 600;
  min-width: 44px;
  text-align: center;
  color: var(--ink);
}

.vc-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

.vc-btn:hover { background: var(--panel); }
.vc-btn:active { background: var(--border); }

.vc-pan-grid {
  display: grid;
  grid-template-columns: 30px 30px 30px;
  grid-template-rows: 30px 30px;
  gap: 2px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  justify-items: center;
}

.vc-view-presets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.vc-view-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.vc-view-row {
  display: grid;
  grid-template-columns: 1fr 24px 32px;
  gap: 4px;
}

.vc-view-load,
.vc-view-save,
.vc-view-remove {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.vc-view-load:hover,
.vc-view-save:hover,
.vc-view-remove:hover {
  background: var(--panel);
}

.vc-view-load.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: #fff6ef;
}

.vc-view-action {
  opacity: 0.58;
  font-size: 11px;
  font-weight: 500;
  border-style: dashed;
}

.vc-view-action:hover {
  opacity: 0.95;
}

.vc-view-remove.is-pending {
  opacity: 1;
  color: #b42727;
  border-color: #f2b9b9;
  background: #fff4f4;
  border-style: solid;
}

.vc-view-load:disabled,
.vc-view-save:disabled,
.vc-view-remove:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  background: rgba(17, 19, 31, 0.88);
  color: #fff;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  pointer-events: none;
  opacity: 1;
}

.vc-pan-up    { grid-column: 2; grid-row: 1; }
.vc-pan-left  { grid-column: 1; grid-row: 2; }
.vc-pan-reset { grid-column: 2; grid-row: 2; }
.vc-pan-right { grid-column: 3; grid-row: 2; }
.vc-pan-down  { grid-column: 2; grid-row: 3; }

.vc-pan-grid {
  grid-template-rows: 30px 30px 30px;
}

/* --- Utility classes --- */
.mobile-only { display: none !important; }
.desktop-only { display: initial; }

/* --- Panel drawer backdrop --- */
.panel-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.panel-drawer-backdrop.open { display: block; }

/* --- Collapsible canvas action bar (mobile) --- */
.canvas-action-toggle {
  display: none;
}
.canvas-action-buttons.collapsed {
  display: flex;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  /* Utility overrides */
  .mobile-only { display: initial !important; }
  .desktop-only { display: none !important; }

  /* Topbar: 2-row layout */
  .topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
  }
  .topbar-left { order: 1; flex: 0 0 auto; gap: 8px; }
  .topbar-right { order: 2; flex: 0 0 auto; margin-left: auto; }
  .topbar-center {
    order: 3;
    flex: 1 1 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 2px 0;
  }
  .topbar-center::-webkit-scrollbar { display: none; }
  .expo-name-input { width: 100px; font-size: 13px; padding: 4px 6px; }
  .floor-tab { white-space: nowrap; min-height: 36px; font-size: 13px; }

  /* Hamburger button */
  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    border-radius: 8px;
    color: var(--ink);
  }
  .hamburger-btn:active { background: var(--border); }

  /* Left panel: drawer */
  .stage { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    max-height: 100%;
    z-index: 1000;
    border-right: 1px solid var(--border);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }
  .panel.drawer-open {
    display: flex;
    transform: translateX(0);
  }

  /* Canvas full-screen */
  .work-area { height: 100%; }

  /* Collapsible action bar */
  .canvas-action-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255,255,255,0.92);
    font-size: 20px;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
  }
  .canvas-action-toggle:active { background: var(--border); }
  .canvas-action-bar {
    top: 60px;
    right: 10px;
    flex-direction: column;
    gap: 6px;
  }
  .canvas-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .canvas-action-buttons.collapsed { display: none; }

  /* Touch-friendly targets */
  .btn-sm, .btn-icon, .btn-accent, .mode-btn, .tpl-btn,
  .tool-btn, .floor-tab, .tab-close {
    min-height: 44px;
    min-width: 44px;
  }
  .tool-btn { padding: 8px 10px; font-size: 13px; }

  /* Hide keyboard hints and tips bar */
  .grid-tips-bar { display: none !important; }
  .shortcut-hint { display: none !important; }

  /* Booth drawer full-width */
  .booth-drawer { width: 100vw; padding: 16px; }
  .booth-manager-fields { grid-template-columns: 1fr; }
  .booth-field-wide { grid-column: auto; }
  .booth-manager-layout { grid-template-columns: 1fr; }
  .booth-nav-list { max-height: 160px; }
  .booth-manager-filter-row { flex-direction: column; align-items: flex-start; }
  .booth-floor-filter { width: 100%; }
  .booth-search-input { width: 100%; min-width: 0; }
}
