/* ════════════════════════════════════════════════════
   P3D — PLANTA 3D / SOMA-ID MODULE
   Friendly Dark Theme for woodworking professionals
   ════════════════════════════════════════════════════ */

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette — warm dark tones */
  --bg:            #0C0E13;
  --bg-surface:    #12151C;
  --bg-card:       #1A1E27;
  --bg-elevated:   #222730;
  --border:        rgba(0, 229, 204, 0.08);
  --border-strong: rgba(0, 229, 204, 0.18);
  --accent:        #00E5CC;
  --accent-dim:    rgba(0, 229, 204, 0.12);
  --accent-hover:  #00FFE0;
  --accent-glow:   rgba(0, 229, 204, 0.05);
  --text:          #D1D5DB;
  --text-secondary:#8B95A5;
  --text-muted:    #4B5563;
  --red:           #F85149;
  --orange:        #F59E0B;
  --blue:          #60A5FA;
  --green:         #34D399;
  --white:         #F9FAFB;

  /* Layout */
  --header-h:      52px;
  --toolbar-w:     72px;
  --panel-w:       280px;
  --statusbar-h:   30px;
  --radius:        6px;
  --radius-lg:     10px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ════════════════════════════════════════
   HEADER / TOP NAV
   ════════════════════════════════════════ */
#header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
  position: relative;
}

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

.nav-icon-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 7px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
}

.nav-icon-btn:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-glow);
}

.logo-mark {
  font-family: 'Space Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  padding: 3px 8px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  line-height: 1;
  user-select: none;
}

.logo-text {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
  padding: 0 16px;
}

.plan-name {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}

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

.nav-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 6px;
}

.header-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}

.header-btn:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-glow);
}

.header-btn.active {
  color: var(--accent);
  border-color: var(--border-strong);
  background: var(--accent-dim);
}

.header-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.header-btn:disabled:hover {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

/* Primary action button (Save) */
.header-btn--primary {
  background: var(--accent-dim);
  border-color: var(--border-strong);
  color: var(--accent);
}

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

.zoom-indicator {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  user-select: none;
  min-width: 48px;
  text-align: center;
}

/* Legacy compat */
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-glow);
}

.icon-btn.active {
  color: var(--accent);
  border-color: var(--border-strong);
  background: var(--accent-dim);
}

/* ════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════ */
#main {
  display: flex;
  height: calc(100vh - var(--header-h) - var(--statusbar-h));
  position: relative;
}

/* ════════════════════════════════════════
   LEFT TOOL STRIP
   ════════════════════════════════════════ */
.tool-strip {
  width: var(--toolbar-w);
  min-width: var(--toolbar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
}

.tool-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 6px 10px;
  gap: 2px;
}

.tool-section + .tool-section {
  border-top: 1px solid var(--border);
  margin-top: 2px;
  padding-top: 8px;
}

.tool-section-label {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  user-select: none;
}

.tool-btn {
  width: 58px;
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  position: relative;
  flex-shrink: 0;
  padding: 4px 2px;
}

.tool-btn:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-glow);
}

.tool-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--border-strong);
}

.tool-btn.active::after {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.tool-btn svg {
  flex-shrink: 0;
}

.tool-label {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 54px;
}

.tool-sep {
  width: 32px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Legacy compat for JS .tool-icon spans */
.tool-icon {
  display: none;
}

/* ════════════════════════════════════════
   PLANS SIDEBAR (overlay)
   ════════════════════════════════════════ */
#sidebar {
  position: absolute;
  left: var(--toolbar-w);
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 50;
  transform: translateX(-110%);
  transition: transform 0.25s var(--ease);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}

#sidebar.open {
  transform: translateX(0);
}

.sidebar-header, .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h2, .panel-header h2 {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.small-btn {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  padding: 5px 12px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  display: flex;
  align-items: center;
  gap: 5px;
}

.small-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.panel-close-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
}

.panel-close-btn:hover {
  color: var(--red);
  border-color: rgba(248, 81, 73, 0.2);
  background: rgba(248, 81, 73, 0.08);
}

#plan-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

#plan-list li {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s var(--ease);
}

#plan-list li:hover {
  background: var(--accent-glow);
}

#plan-list li.active {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
}

#plan-list li.active .plan-item-name {
  color: var(--accent);
}

#plan-list li .plan-item-name {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

#plan-list li .plan-item-delete {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

#plan-list li:hover .plan-item-delete {
  opacity: 0.7;
}

#plan-list li:hover .plan-item-delete:hover {
  opacity: 1;
}

/* ════════════════════════════════════════
   CANVAS CONTAINER
   ════════════════════════════════════════ */
#canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  background-image: radial-gradient(circle, rgba(0, 229, 204, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}

#three-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#editor-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 2;
}

#editor-canvas.active {
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(12, 14, 19, 0.92);
  z-index: 5;
  gap: 16px;
}

.overlay.hidden {
  display: none;
}

.overlay p {
  font-family: 'Space Mono', monospace;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   WELCOME SCREEN
   ════════════════════════════════════════ */
.welcome-overlay {
  background: var(--bg);
  z-index: 6;
}

.welcome-card {
  max-width: 560px;
  width: 100%;
  padding: 0 24px;
  animation: welcomeFadeIn 0.4s var(--ease);
}

@keyframes welcomeFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-logo {
  text-align: center;
  margin-bottom: 36px;
}

.welcome-logo-icon {
  font-family: 'Space Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  display: inline-block;
  padding: 8px 16px;
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.welcome-title {
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
}

.welcome-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.welcome-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: left;
}

.welcome-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  transform: translateX(4px);
}

.welcome-btn--primary {
  background: var(--accent-dim);
  border-color: var(--border-strong);
}

.welcome-btn--primary:hover {
  background: rgba(0, 229, 204, 0.18);
  border-color: var(--accent);
}

.welcome-btn svg {
  flex-shrink: 0;
  color: var(--accent);
}

.welcome-btn-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.welcome-btn-text strong {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
}

.welcome-btn-text small {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Tutorial link */
.welcome-tutorial-link {
  text-align: center;
  margin-bottom: 24px;
}

.welcome-tutorial-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: all 0.15s var(--ease);
}

.welcome-tutorial-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.welcome-tutorial-btn svg {
  color: var(--text-muted);
  transition: color 0.15s;
}

.welcome-tutorial-btn:hover svg {
  color: var(--accent);
}

/* Templates */
.welcome-templates {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.welcome-section-title {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-align: center;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 8px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.template-card:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
}

.template-icon {
  color: var(--text-secondary);
  transition: color 0.15s;
}

.template-card:hover .template-icon {
  color: var(--accent);
}

.template-card span {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

/* ════════════════════════════════════════
   RIGHT PANELS
   ════════════════════════════════════════ */
.right-panels {
  width: var(--panel-w);
  min-width: var(--panel-w);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

/* Annotations Panel */
#annotations-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

#annotations-list {
  flex: 1;
  overflow-y: auto;
}

.annotation-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.annotation-item:hover {
  background: var(--accent-glow);
}

.annotation-item .ann-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.annotation-item .ann-type {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.annotation-item .ann-type.note { color: var(--orange); }
.annotation-item .ann-type.measurement { color: var(--blue); }

.annotation-item .ann-delete {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
}

.annotation-item:hover .ann-delete {
  opacity: 0.7;
}

.annotation-item:hover .ann-delete:hover {
  opacity: 1;
}

.annotation-item .ann-text {
  font-size: 12px;
  color: var(--text);
}

.annotation-item .ann-value {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
}

/* Properties Panel */
#properties-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  max-height: 50%;
}

#properties-panel.hidden {
  display: none;
}

#properties-content {
  padding: 12px 14px;
  flex: 1;
  overflow-y: auto;
}

.prop-group {
  margin-bottom: 12px;
}

.prop-group label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.prop-group input,
.prop-group select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.prop-group input:focus,
.prop-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.prop-group p {
  font-size: 12px;
}

/* Furniture Panel */
#furniture-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  flex: 1;
  min-height: 0;
}

#furniture-panel.hidden {
  display: none;
}

#furniture-search-box {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#furniture-search {
  width: 100%;
  padding: 7px 10px 7px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

#furniture-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

#furniture-search::placeholder {
  color: var(--text-muted);
}

#furniture-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.furn-cat-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  transition: all 0.15s var(--ease);
}

.furn-cat-btn:hover {
  color: var(--accent);
  border-color: var(--border-strong);
  background: var(--accent-glow);
}

.furn-cat-btn.active {
  color: var(--accent);
  border-color: var(--border-strong);
  background: var(--accent-dim);
}

#furniture-items {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 10px 12px;
  align-content: start;
}

.furn-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.furn-item:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.furn-item canvas {
  width: 44px;
  height: 44px;
}

.furn-item .furn-item-name {
  font-size: 10px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.furn-item .furn-item-dims {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
}

/* ════════════════════════════════════════
   COLOR & MATERIAL PICKERS
   ════════════════════════════════════════ */
.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.color-swatch:hover {
  border-color: var(--accent);
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--bg-surface), 0 0 8px var(--accent-dim);
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.material-option {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  cursor: pointer;
  text-align: center;
  font-size: 10px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.material-option:hover {
  border-color: var(--accent);
}

.material-option.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.material-option .mat-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  margin-bottom: 4px;
}

/* ════════════════════════════════════════
   STATUS BAR
   ════════════════════════════════════════ */
#status-bar {
  height: var(--statusbar-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 10;
}

.tool-status {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.status-tag {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  opacity: 0.5;
}

.status-sep {
  color: var(--text-muted);
  font-size: 10px;
}

.status-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* ════════════════════════════════════════
   ONBOARDING TOUR
   ════════════════════════════════════════ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.onboarding-overlay.hidden {
  display: none;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.onboarding-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  z-index: 1;
  animation: welcomeFadeIn 0.3s var(--ease);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.onboarding-progress {
  margin-bottom: 20px;
  display: flex;
  gap: 6px;
}

.onboarding-step-dot {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}

.onboarding-step-dot.active {
  background: var(--accent);
}

.onboarding-step-dot.done {
  background: rgba(0, 229, 204, 0.4);
}

.onboarding-body {
  margin-bottom: 24px;
}

.onboarding-title {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
}

.onboarding-text {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.onboarding-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.onboarding-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.15s;
}

.onboarding-skip:hover {
  color: var(--text-secondary);
}

.onboarding-next {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.onboarding-next:hover {
  background: var(--accent-hover);
}

/* ════════════════════════════════════════
   HELP MODAL
   ════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: welcomeFadeIn 0.25s var(--ease);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.modal-close:hover {
  color: var(--red);
  background: rgba(248, 81, 73, 0.1);
}

.modal-body {
  padding: 16px 20px 20px;
}

.shortcut-group {
  margin-bottom: 18px;
}

.shortcut-group:last-child {
  margin-bottom: 0;
}

.shortcut-group h4 {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 5px 0;
}

.shortcut-row kbd {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 8px;
  min-width: 32px;
  text-align: center;
  color: var(--accent);
}

.shortcut-row span {
  font-size: 12px;
  color: var(--text);
}

.modal-tutorial-link {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.modal-tutorial-link a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s;
}

.modal-tutorial-link a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ════════════════════════════════════════
   EMPTY STATES
   ════════════════════════════════════════ */
.empty-state {
  padding: 28px 14px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  color: var(--text-muted);
  font-size: 12px;
}

.empty-icon {
  opacity: 0.4;
}

/* ════════════════════════════════════════
   UTILITY
   ════════════════════════════════════════ */
.hidden {
  display: none !important;
}

/* ════════════════════════════════════════
   TOOLTIPS (enhanced)
   ════════════════════════════════════════ */
.tool-btn[title]:hover::before {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 220px;
  white-space: normal;
  line-height: 1.4;
}

/* ════════════════════════════════════════
   MOBILE
   ════════════════════════════════════════ */
.mobile-only {
  display: none;
}

.btn-text {
  /* visible on desktop, hidden on small screens */
}

@media (max-width: 900px) {
  .logo-text {
    display: none;
  }

  .btn-text {
    display: none;
  }

  .nav-center {
    padding: 0 8px;
  }

  .plan-name {
    max-width: 120px;
  }

  .tool-label {
    display: none;
  }

  .tool-btn {
    width: 42px;
    height: 42px;
  }

  :root {
    --toolbar-w: 52px;
  }

  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --toolbar-w: 48px;
    --panel-w: 260px;
  }

  .mobile-only {
    display: inline-flex;
  }

  .logo-text {
    display: none;
  }

  .btn-text {
    display: none;
  }

  .tool-label {
    display: none;
  }

  .tool-btn {
    width: 38px;
    height: 38px;
  }

  .tool-btn[title]:hover::before {
    display: none;
  }

  /* Plans sidebar - slide from left */
  #sidebar {
    left: 0;
    width: 240px;
    z-index: 55;
  }

  /* Right panels - slide from right */
  .right-panels {
    position: fixed;
    right: 0;
    top: var(--header-h);
    bottom: var(--statusbar-h);
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.25s var(--ease);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  }

  /* Annotations panel */
  #annotations-panel {
    position: fixed;
    right: 0;
    top: var(--header-h);
    bottom: var(--statusbar-h);
    width: var(--panel-w);
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.25s var(--ease);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  }

  #annotations-panel.open {
    transform: translateX(0);
  }

  /* Furniture & Properties panels on mobile */
  #furniture-panel:not(.hidden),
  #properties-panel:not(.hidden) {
    position: fixed;
    right: 0;
    top: var(--header-h);
    bottom: var(--statusbar-h);
    width: var(--panel-w);
    z-index: 55;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    border-left: 1px solid var(--border);
    background: var(--bg-surface);
  }

  .plan-name {
    max-width: 80px;
    font-size: 11px;
  }

  /* Welcome adjustments */
  .welcome-actions {
    gap: 8px;
  }

  .welcome-btn {
    padding: 12px 16px;
  }

  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  :root {
    --toolbar-w: 44px;
    --header-h: 48px;
  }

  .logo-mark {
    font-size: 13px;
    padding: 2px 6px;
  }

  .nav-sep {
    display: none;
  }

  .header-btn {
    padding: 4px 6px;
    font-size: 11px;
  }

  .welcome-title {
    font-size: 20px;
  }

  .welcome-subtitle {
    font-size: 12px;
  }

  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .template-card {
    padding: 12px 6px 10px;
  }

  .onboarding-card {
    padding: 20px;
  }
}

/* ════════════════════════════════════════
   SCROLLBAR
   ════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 204, 0.2) transparent;
}

/* ════════════════════════════════════════
   FOCUS STYLES
   ════════════════════════════════════════ */
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}
