/* Container Planner Pro - Modern Architectural CAD Styling */
:root {
  --bg-primary: #1e222b;
  --bg-secondary: #282c37;
  --bg-tertiary: #323846;
  --bg-surface: #20242e;
  --bg-canvas: #f8fafc;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #3b4252;
  --border-light: #4c566a;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --danger: #ef4444;
  --cad-blue: #0284c7;
  --cad-grid-major: rgba(148, 163, 184, 0.25);
  --cad-grid-minor: rgba(148, 163, 184, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --header-height: 52px;
  --sidebar-width: 320px;
  --inspector-width: 300px;
  --footer-height: 28px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  font-size: 13px;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Header Navbar */
header.app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
  z-index: 100;
  overflow-x: auto;
  overflow-y: hidden;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  color: #fff;
  white-space: nowrap;
}

.brand-logo-img {
  height: 32px;
  max-width: 90px;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 2px 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.1;
}

.mobile-toggle-btn {
  display: none;
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.mobile-toggle-btn:hover {
  background: var(--accent-blue);
  color: #ffffff;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.project-title-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  max-width: 220px;
  transition: all 0.15s ease;
}
.project-title-input:hover {
  border-color: var(--border-light);
  background: var(--bg-secondary);
}
.project-title-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: var(--bg-secondary);
}

.header-center-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.divider-v {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.header-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.header-btn.active {
  background: var(--accent-blue);
  color: #fff;
}

.header-btn.primary {
  background: var(--accent-blue);
  color: #fff;
}
.header-btn.primary:hover {
  background: var(--accent-blue-hover);
}

.header-btn.success {
  background: var(--accent-emerald);
  color: #fff;
}
.header-btn.success:hover {
  opacity: 0.9;
}

.header-btn svg {
  width: 15px;
  height: 15px;
}

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

/* App Main Layout */
.app-body {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Left Sidebar - Component Palette */
aside.left-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width 0.2s ease;
}

aside.left-sidebar.collapsed {
  width: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.sidebar-tab {
  flex: 1;
  min-width: 60px;
  padding: 10px 4px;
  text-align: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.sidebar-tab svg {
  width: 16px;
  height: 16px;
}

.sidebar-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: var(--bg-surface);
}

.sidebar-search-box {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap svg {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.search-input-wrap input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px 6px 30px;
  color: var(--text-primary);
  font-size: 12px;
}
.search-input-wrap input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.palette-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.palette-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.palette-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: grab;
  transition: all 0.15s ease;
  position: relative;
}

.palette-item:hover {
  border-color: var(--accent-blue);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.palette-item:active {
  cursor: grabbing;
}

.palette-item-icon {
  width: 48px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.palette-item-icon svg {
  max-width: 100%;
  max-height: 100%;
}

.palette-item-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.palette-item-dim {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Drawing Tools in Sidebar */
.draw-tool-button {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}

.draw-tool-button:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
}

.draw-tool-button.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.draw-tool-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.draw-tool-button.active .draw-tool-icon {
  background: var(--accent-blue);
  color: #fff;
}

/* Canvas Area */
main.canvas-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  background-image: 
    radial-gradient(rgba(0, 0, 0, 0.09) 1px, transparent 1px),
    radial-gradient(rgba(0, 0, 0, 0.03) 1px, #ffffff 1px);
  background-size: 40px 40px, 10px 10px;
  background-position: 0 0, 0 0;
}

canvas#cadCanvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  touch-action: none;
}

/* Floating Canvas Controls */
.floating-overlay {
  position: absolute;
  z-index: 40;
  pointer-events: none;
}
.floating-overlay > * {
  pointer-events: auto;
}

.canvas-floating-top {
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(32, 36, 46, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.floating-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  transition: all 0.15s;
}
.floating-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.floating-btn.active {
  background: var(--accent-blue);
  color: #fff;
}
.floating-btn svg {
  width: 14px;
  height: 14px;
}

.canvas-floating-bottom-right {
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-widget {
  background: rgba(32, 36, 46, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nav-widget-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.nav-widget-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.nav-widget-btn + .nav-widget-btn {
  border-top: 1px solid var(--border-color);
}
.nav-widget-btn svg {
  width: 16px;
  height: 16px;
}

/* Floating Layers Widget (Button with On-Click & On-Hover Popover Dialog) */
.canvas-layers-widget {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 45;
}

.layers-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 34, 43, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.layers-trigger-btn:hover,
.canvas-layers-widget.open .layers-trigger-btn {
  background: var(--bg-secondary);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2), var(--shadow-md);
}

.layers-trigger-btn svg {
  color: var(--accent-cyan);
}

.layers-trigger-btn .chevron-icon {
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.canvas-layers-widget.open .layers-trigger-btn .chevron-icon {
  transform: rotate(180deg);
}

/* Popover Dialog Box */
.layers-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 220px;
  background: rgba(28, 32, 42, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

/* Open on hover OR when .open class is active (on click) */
.canvas-layers-widget:hover .layers-popover,
.canvas-layers-widget.open .layers-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.layers-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.layers-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.layers-close-btn:hover {
  color: #fff;
  background: var(--bg-tertiary);
}

.layers-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.layer-item:hover {
  background: var(--bg-tertiary);
}

.layer-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.layer-icon-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.layer-checkbox {
  cursor: pointer;
  accent-color: var(--accent-blue);
  width: 15px;
  height: 15px;
}

/* Right Sidebar - Properties Inspector */
aside.right-inspector {
  width: var(--inspector-width);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.inspector-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inspector-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.inspector-content {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inspector-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.property-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.property-row:last-child {
  margin-bottom: 0;
}

.property-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.property-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 12px;
  width: 120px;
  text-align: right;
  transition: border-color 0.15s;
}
.property-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.property-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 12px;
  width: 140px;
  cursor: pointer;
}
.property-select:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.property-color {
  width: 32px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.btn-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.btn-secondary {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: var(--border-light);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #f87171;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* Bottom Status Bar */
footer.app-footer {
  height: var(--footer-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-secondary);
  z-index: 50;
}

.footer-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

/* Modal Dialogs */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(15px);
  transition: transform 0.2s ease;
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}
.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-secondary);
}

/* Templates Grid in Modal */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.template-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.template-preview-box {
  width: 100%;
  height: 110px;
  background: #0f172a;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.template-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid var(--accent-blue);
  color: #93c5fd;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.template-info h4 {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.template-info p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Modal Tabs */
.modal-tabs-header {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px 0;
  gap: 8px;
}

.modal-tab-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-bottom: none;
  color: var(--text-secondary);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all 0.15s ease;
  flex: 1;
}

.modal-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-color: var(--accent-cyan);
}

.modal-tab-btn.active {
  color: #fff;
  background: var(--bg-surface);
  border-color: var(--accent-cyan);
  border-bottom: 3px solid var(--accent-cyan);
  box-shadow: 0 -2px 10px rgba(6, 182, 212, 0.2);
}

.modal-tab-content {
  display: none;
}
.modal-tab-content.active {
  display: block;
}

/* Saved Plans Grid & Cards */
.saved-plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.saved-plan-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s ease;
}
.saved-plan-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-tertiary);
}

.saved-plan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.saved-plan-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.saved-plan-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.saved-plan-spec {
  display: inline-block;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: monospace;
}

.saved-plan-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.btn-sm {
  padding: 5px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.15s;
}
.btn-sm:hover {
  background: var(--border-light);
}
.btn-sm.primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}
.btn-sm.primary:hover {
  background: var(--accent-blue-hover);
}
.btn-sm.copy {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: #34d399;
}
.btn-sm.copy:hover {
  background: var(--accent-emerald);
  color: #fff;
}
.btn-sm.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.btn-sm.danger:hover {
  background: var(--danger);
  color: #fff;
}

/* Blank Plan Preset Cards */
.blank-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.blank-preset-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.blank-preset-card:hover, .blank-preset-card.selected {
  border-color: var(--accent-cyan);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}

.blank-preset-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.blank-preset-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Floating Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent-emerald);
  color: #fff;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ========================================================
   RESPONSIVE DESIGN & MOBILE DRAWER OVERLAYS
   ======================================================== */

.drawer-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.drawer-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.drawer-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: var(--footer-height);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-drawer-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Tablet & Mobile Screens (<= 1024px) */
@media (max-width: 1024px) {
  :root {
    --header-height: 50px;
    --footer-height: 26px;
  }

  .mobile-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .drawer-mobile-header {
    display: flex;
  }

  .drawer-close-btn {
    display: inline-flex;
  }

  /* Left Sidebar as Off-Canvas Drawer */
  aside.left-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    width: 320px;
    max-width: 88vw;
    z-index: 200;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.7);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  aside.left-sidebar.drawer-open {
    transform: translateX(0);
  }

  /* Right Inspector as Off-Canvas Drawer */
  aside.right-inspector {
    position: fixed;
    top: var(--header-height);
    bottom: var(--footer-height);
    right: 0;
    width: 330px;
    max-width: 88vw;
    z-index: 200;
    transform: translateX(100%);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.7);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  aside.right-inspector.drawer-open {
    transform: translateX(0);
  }

  /* Compact Header Tools */
  .header-center-tools {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 50vw;
  }

  .project-title-input {
    max-width: 130px;
    font-size: 11px;
  }
}

/* Mobile Handheld Screens (<= 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 48px;
    --footer-height: 24px;
  }

  header.app-header {
    padding: 0 8px;
  }

  .brand-logo-img {
    height: 28px;
    max-width: 70px;
  }

  .brand-title {
    font-size: 11px;
  }

  .project-title-input {
    display: none;
  }

  .brand-section .divider-v {
    display: none;
  }

  /* Hide verbose text labels in toolbar buttons on small screens, keep icons */
  .header-btn span:not(.brand-title) {
    display: none;
  }

  .mobile-toggle-btn span.btn-text {
    display: inline;
    font-size: 10px;
  }

  .header-btn {
    padding: 6px 8px;
  }

  .header-center-tools {
    max-width: 42vw;
    padding: 2px;
    gap: 4px;
  }

  .header-actions {
    gap: 4px;
  }

  /* Floating controls adjustment */
  .floating-layers-controls {
    top: 8px;
    left: 8px;
  }

  .floating-zoom-controls {
    bottom: 8px;
    right: 8px;
  }

  /* Status Bar Compact */
  #statusCoords {
    display: none;
  }

  footer.app-footer {
    padding: 0 8px;
    font-size: 10px;
  }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
  .brand-title-wrap {
    display: none;
  }

  .brand-logo-img {
    height: 26px;
    max-width: 60px;
  }

  .header-center-tools {
    max-width: 36vw;
  }

  .modal-dialog {
    max-width: 95vw !important;
    max-height: 90vh;
    margin: 10px;
  }

  .blank-preset-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ============================================================
   LAYOUT PREVIEW THUMBNAILS (Saved Plans & Template Dialogs)
   ============================================================ */
.saved-plan-thumb-wrap {
  width: 100%;
  height: 115px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.saved-plan-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  display: block;
}

.template-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  display: block;
}

/* ============================================================
   FLOATING CANVAS PILLS (Undo/Redo bottom-left & Quick tools right)
   ============================================================ */
.canvas-floating-pill {
  position: absolute;
  z-index: 35;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
}

.canvas-pill-bottom-left {
  bottom: 24px;
  left: 20px;
  padding: 4px 6px;
  gap: 2px;
}

.canvas-pill-right {
  display: none !important;
}

.canvas-pill-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.canvas-pill-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent-cyan);
}

.canvas-pill-btn:active {
  transform: scale(0.92);
}

.canvas-pill-btn svg {
  width: 18px;
  height: 18px;
}

.canvas-pill-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 2px;
}

.pill-badge-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
}

/* ============================================================
   MOBILE BOTTOM SHEET (Matching Phone Screenshots)
   ============================================================ */
.mobile-bottom-sheet {
  display: none;
}

@media (max-width: 1024px) {
  /* On tablets and mobile screens, enable bottom sheet */
  .mobile-bottom-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.75);
    z-index: 60;
    height: 72vh;
    max-height: 78vh;
    transform: translateY(calc(100% - 56px));
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    touch-action: none;
  }

  .mobile-bottom-sheet.collapsed {
    transform: translateY(calc(100% - 56px));
  }

  .mobile-bottom-sheet.half-open {
    transform: translateY(calc(100% - 320px));
  }

  .mobile-bottom-sheet.expanded {
    transform: translateY(0);
  }

  .mobile-sheet-drag-handle {
    padding: 10px 0 6px 0;
    display: flex;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    user-select: none;
  }

  .mobile-sheet-drag-handle:active {
    cursor: grabbing;
  }

  .mobile-sheet-drag-pill {
    width: 44px;
    height: 5px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    transition: background 0.15s, transform 0.15s;
  }

  .mobile-sheet-drag-handle:active .mobile-sheet-drag-pill,
  .mobile-sheet-drag-handle:hover .mobile-sheet-drag-pill {
    background: #38bdf8;
    transform: scaleX(1.15);
  }

  .mobile-sheet-tabs-bar {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 4px;
    background: rgba(15, 23, 42, 0.98);
    touch-action: none;
    user-select: none;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .mobile-sheet-tabs-bar::-webkit-scrollbar {
    display: none;
  }

  .mobile-sheet-tab-btn {
    flex: 1;
    min-width: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
  }

  .mobile-sheet-tab-btn.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
  }

  .mobile-sheet-tab-btn svg {
    width: 17px;
    height: 17px;
  }

  .mobile-sheet-panes {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 24px 12px;
  }

  .mobile-sheet-pane {
    display: none;
  }

  .mobile-sheet-pane.active {
    display: block;
  }

  .mobile-pane-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .mobile-list-item:active {
    background: rgba(56, 189, 248, 0.15);
    border-color: #38bdf8;
    transform: scale(0.99);
  }

  .mobile-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
  }

  .mobile-item-sub {
    font-size: 10px;
    color: #94a3b8;
  }

  .mobile-item-chevron {
    font-size: 18px;
    color: #64748b;
  }

  .mobile-item-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
  }

  .mobile-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }

  .mobile-sheet-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    gap: 5px;
    transition: all 0.15s ease;
  }

  .mobile-sheet-card:active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    transform: scale(0.98);
  }

  .mobile-sheet-card-title {
    font-size: 11px;
    font-weight: 600;
    color: #f1f5f9;
  }

  .mobile-sheet-card-sub {
    font-size: 9px;
    color: #94a3b8;
  }

  /* Mobile Properties Drawer Box Styling */
  .mobile-properties-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 24px;
  }

  .mobile-prop-card {
    background: rgba(30, 41, 59, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-prop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .mobile-prop-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mobile-prop-badge {
    font-size: 10px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.3);
  }

  .mobile-prop-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mobile-prop-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .mobile-prop-label {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }

  .mobile-prop-input,
  .mobile-prop-select {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 10px;
    width: 100%;
    outline: none;
    box-sizing: border-box;
  }

  .mobile-prop-input:focus,
  .mobile-prop-select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
  }

  .mobile-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .mobile-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    padding: 8px 4px;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .mobile-action-btn:active {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    transform: scale(0.97);
  }

  .mobile-action-btn.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
  }

  .mobile-action-btn.btn-danger:active {
    background: rgba(239, 68, 68, 0.3);
  }

  /* Adjust floating pills on mobile so they sit cleanly above the bottom drawer */
  .canvas-pill-bottom-left {
    bottom: 110px;
    left: 14px;
    z-index: 35;
  }

  .floating-overlay.canvas-floating-bottom-right {
    bottom: 110px;
    right: 14px;
    z-index: 35;
  }

}

/* Touch Drag Avatar / Ghost Preview for Mobile Drag & Drop */
.touch-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: touchGhostPop 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes touchGhostPop {
  0% { transform: translate(-50%, -100%) scale(0.7); opacity: 0; }
  100% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}

.touch-drag-ghost-badge {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #0284c7;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), 0 0 14px rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.touch-drag-ghost-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px #0284c7;
}

/* Print Styles for Authentic Architectural Sheet Printouts */
#printSheetContainer {
  display: none !important;
  visibility: hidden !important;
  position: fixed !important;
  top: -99999px !important;
  left: -99999px !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -9999 !important;
}

@media print {
  @page {
    size: landscape;
    margin: 0;
  }
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    overflow: hidden !important;
    width: 100vw !important;
    height: 100vh !important;
  }

  /* Completely hide every application shell, UI, canvas, mobile drawer, toolbar */
  header, aside, main, footer, nav,
  header.app-header,
  .app-header,
  .app-body,
  aside.left-sidebar,
  .left-sidebar,
  aside.right-inspector,
  .right-inspector,
  main.canvas-viewport,
  .canvas-viewport,
  canvas,
  canvas#cadCanvas,
  #cadCanvas,
  footer.app-status-bar,
  .app-status-bar,
  footer.app-footer,
  .app-footer,
  .floating-overlay,
  .canvas-floating-pill,
  #canvasUndoRedoPill,
  .canvas-layers-dropdown,
  .canvas-layers-widget,
  .toast-notification,
  .modal-backdrop,
  .modal,
  .sheet-details-modal,
  .mobile-bottom-sheet,
  #mobileBottomSheet,
  .mobile-sheet-tabs-bar,
  .mobile-bottom-nav,
  .mobile-sheet-pull-handle,
  .mobile-handle-bar,
  .mobile-drawer-backdrop,
  #mobileDrawerBackdrop,
  .mobile-quick-actions-bar,
  .floating-selection-toolbar,
  #floatingSelectionToolbar,
  .active-tool-banner,
  #activeToolBanner,
  .touch-drag-ghost-badge,
  .touch-drag-ghost-pin {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    top: -99999px !important;
    left: -99999px !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  body * {
    visibility: hidden !important;
  }

  #printSheetContainer,
  #printSheetContainer * {
    visibility: visible !important;
  }

  /* Display ONLY the high-res 300+ DPI architectural drawing sheet */
  #printSheetContainer {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    box-sizing: border-box !important;
    padding: 4mm !important;
    margin: 0 !important;
    background: #ffffff !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 2147483647 !important;
    opacity: 1 !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
  }
  #printSheetImage {
    display: block !important;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    box-shadow: none !important;
  }
}

/* ========================================================
   ACTIVE TOOL BANNER (Floating Indicator with 1-Tap Cancel)
   ======================================================== */
.active-tool-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid #38bdf8;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 30px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 12px rgba(56, 189, 248, 0.25);
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 120;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: toolBannerFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toolBannerFadeIn {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.active-tool-banner.show {
  display: flex !important;
}

.active-tool-banner-text {
  font-size: 11px;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
}

.active-tool-cancel-btn {
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.active-tool-cancel-btn:hover,
.active-tool-cancel-btn:active {
  background: #dc2626;
  transform: scale(1.05);
}

/* ============================================================
   FLOATING SELECTION TOOLBAR (Matching User Image)
   Settings/Properties, Duplicate, Flip V, Flip H, Delete
   ============================================================ */
.floating-selection-toolbar {
  position: absolute;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 3px;
  background: #ffffff;
  border-radius: 8px;
  padding: 3px 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -100%);
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  animation: fstFadeIn 0.12s ease-out;
}

@keyframes fstFadeIn {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

.fst-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  padding: 0;
  color: #334155;
  transition: all 0.12s ease;
}

.fst-btn svg {
  width: 14px !important;
  height: 14px !important;
}

.fst-btn:hover {
  background: #f1f5f9;
  transform: scale(1.06);
}

.fst-btn:active {
  background: #e2e8f0;
  transform: scale(0.94);
}

.fst-btn.fst-danger {
  color: #ef4444;
}

.fst-btn.fst-danger:hover {
  background: #fee2e2;
  transform: scale(1.06);
}

.fst-btn.fst-danger:active {
  background: #fecaca;
  transform: scale(0.94);
}

@media (max-width: 768px) {
  .floating-selection-toolbar {
    gap: 2px;
    padding: 2px 4px;
    border-radius: 7px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  }
  .fst-btn {
    width: 25px;
    height: 25px;
  }
  .fst-btn svg {
    width: 13px !important;
    height: 13px !important;
  }
}

/* ============================================================
   MOBILE DRAWER: 1-CLICK ARMED & SMOOTH SCROLLING
   ============================================================ */
.mobile-sheet-panes,
.mobile-sheet-pane,
.mobile-sheet-grid,
.mobile-pane-group {
  touch-action: pan-y !important;
}

.mobile-sheet-card,
.mobile-list-item {
  touch-action: pan-y !important;
}

.mobile-sheet-card.drawer-item-armed,
.mobile-list-item.drawer-item-armed {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.18) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.45) !important;
  transform: scale(1.02);
}

.drawer-item-armed .mobile-sheet-card-sub::after {
  content: " • READY (Tap to add)";
  color: #10b981;
  font-weight: 700;
}

.drawer-item-armed .mobile-item-sub::after {
  content: " • READY TO DRAG OR TAP TO ADD";
  color: #10b981;
  font-weight: 700;
}

/* ============================================================
   ARCHITECTURAL SHEET DETAILS & SPECIFICATIONS MODAL
   ============================================================ */
.sheet-tabs-bar {
  display: flex;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 12px;
  gap: 6px;
  overflow-x: auto;
}

.sheet-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.sheet-tab-btn:hover {
  color: var(--text-primary);
}

.sheet-tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: rgba(2, 132, 199, 0.08);
}

.modal-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.legend-edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.legend-icon-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 135px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   MOBILE QUICK MENU & RESPONSIVE TILES
   ============================================================ */
.mobile-menu-btn {
  display: none !important;
}

@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: inline-flex !important;
    background: rgba(56, 189, 248, 0.14) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
  }
}

.mobile-menu-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.mobile-menu-tile:hover,
.mobile-menu-tile:active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.mqm-icon {
  font-size: 18px;
  margin-bottom: 4px;
}

.mqm-label {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.mqm-sub {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Mobile Touch Optimization & Horizontal Scroll Smoothness */
@media (max-width: 768px) {
  .header-actions {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 50vw;
  }
  .header-actions::-webkit-scrollbar {
    display: none;
  }
}



