/* ============================================================
   MIGESTI OS -- Estimating Workspace CSS
   Phase 52 -- Full Estimating UI
   NOTE: estimating.html uses inline styles + IDs, not these
   BEM classes. This file is retained for estimating_projects.html
   and future Phase 52+ migration. Classes like .est-drawing__*,
   .est-bom, .est-model__* are not currently wired in the HTML.
   ============================================================ */

/* ── Layout: Full Viewport 4-Panel ──────────────────────── */

.est-workspace {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary, #0A1628);
  color: var(--text-primary, #FFFFFF);
  font-family: var(--font-primary, 'Inter', sans-serif);
}

/* ── Header Bar (FIX 7) ────────────────────────────────── */

.est-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 48px;
  min-height: 48px;
  background: var(--bg-secondary, #0D1B2A);
  border-bottom: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
  overflow: hidden;
}

.est-topbar__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-gold, #D4A843);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.est-topbar__project {
  font-size: 0.75rem;
  color: var(--text-secondary, #B0BEC5);
}

.est-topbar__controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.est-topbar__info {
  font-size: 0.7rem;
  color: var(--text-secondary, #B0BEC5);
  white-space: nowrap;
}

.est-topbar__label {
  font-size: 0.65rem;
  color: var(--text-muted, #607D8B);
  display: flex;
  align-items: center;
  gap: 4px;
}

.est-topbar__sep {
  width: 1px;
  height: 24px;
  background: var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
}

.est-topbar__btn {
  padding: 4px 10px;
  background: var(--surface-hover);
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 4px;
  color: var(--text-secondary, #B0BEC5);
  font-size: 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}

.est-topbar__btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.est-topbar__btn--sm {
  padding: 3px 6px;
  font-size: 0.65rem;
  min-width: 24px;
  text-align: center;
}

.est-topbar__btn--accent {
  background: var(--accent-blue, #00B4D8);
  color: var(--btn-text, #000);
  border-color: transparent;
  font-weight: 600;
}

.est-topbar__btn--accent:hover {
  opacity: 0.9;
}

.est-topbar__badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}

.est-topbar__badge--green {
  background: rgba(0, 204, 68, 0.15);
  color: #00CC44;
  border: 1px solid rgba(0, 204, 68, 0.3);
}

.est-topbar__badge--yellow {
  background: rgba(255, 193, 7, 0.15);
  color: #FFC107;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.est-topbar select,
.est-topbar input {
  background: var(--bg-input, rgba(10, 22, 40, 0.9));
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 4px;
  color: var(--text-primary, #FFF);
  padding: 4px 8px;
  font-size: 0.7rem;
  font-family: inherit;
}

.est-topbar select:focus,
.est-topbar input:focus {
  border-color: var(--accent-blue, #00B4D8);
  outline: none;
}

/* Export dropdown */

.est-export-dropdown {
  position: relative;
}

.est-export-dropdown__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-secondary, #0D1B2A);
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 6px;
  padding: 4px 0;
  z-index: 100;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.est-export-dropdown__item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text-secondary, #B0BEC5);
  font-size: 0.7rem;
  text-align: left;
  cursor: pointer;
}

.est-export-dropdown__item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ── Main Row: Symbol Palette + Drawing + 3D ────────────── */

.est-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Symbol Palette (Left Panel) ────────────────────────── */

.est-palette {
  width: 240px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #0D1B2A);
  border-right: 1px solid var(--border-subtle, #2A2A3E);
  overflow: hidden;
}

.est-palette__search {
  padding: 8px;
  flex-shrink: 0;
}

.est-palette__search input {
  width: 100%;
  background: var(--bg-input, rgba(10, 22, 40, 0.9));
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 4px;
  color: var(--text-primary, #FFF);
  padding: 6px 8px;
  font-size: 0.75rem;
  font-family: inherit;
}

.est-palette__search input:focus {
  border-color: var(--accent-blue, #00B4D8);
  outline: none;
}

.est-palette__list {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px 8px;
}

/* Family accordion */

.est-family {
  margin-bottom: 1px;
}

.est-family__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  user-select: none;
}

.est-family__header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.est-family__swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.est-family__name {
  flex: 1;
}

.est-family__count {
  font-size: 0.6rem;
  color: var(--text-muted, #607D8B);
  background: var(--surface-hover);
  padding: 1px 5px;
  border-radius: 8px;
}

.est-family__arrow {
  font-size: 0.5rem;
  color: var(--text-muted, #607D8B);
  transition: transform 0.15s;
}

.est-family--open .est-family__arrow {
  transform: rotate(90deg);
}

.est-family__items {
  display: none;
  padding-left: 8px;
}

.est-family--open .est-family__items {
  display: block;
}

/* Subcategory (nested inside family) */

.est-subcategory {
  margin-bottom: 1px;
}

.est-subcategory__header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px 5px 12px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-secondary, #B0BEC5);
  user-select: none;
}

.est-subcategory__header:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #FFF);
}

.est-subcategory__bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.7;
}

.est-subcategory__name {
  flex: 1;
}

.est-subcategory__count {
  font-size: 0.55rem;
  color: var(--text-muted, #607D8B);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 4px;
  border-radius: 6px;
}

.est-subcategory__arrow {
  font-size: 0.45rem;
  color: var(--text-muted, #607D8B);
  transition: transform 0.15s;
}

.est-subcategory--open .est-subcategory__arrow {
  transform: rotate(90deg);
}

.est-subcategory__items {
  display: none;
  padding-left: 10px;
}

.est-subcategory--open .est-subcategory__items {
  display: block;
}

/* Symbol items */

.est-symbol {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 0.68rem;
  color: var(--text-secondary, #B0BEC5);
  border-left: 3px solid transparent;
  transition: background 0.1s, opacity 0.15s, border-color 0.1s;
}

.est-symbol:hover {
  background: var(--surface-hover);
  color: var(--text-primary, #FFF);
}

.est-symbol__icon {
  flex-shrink: 0;
  line-height: 0;
}

.est-symbol__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.est-symbol__labor {
  margin-left: auto;
  font-size: 0.58rem;
  color: var(--text-muted, #607D8B);
  flex-shrink: 0;
}

/* Selected state */

.est-symbol--selected {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-left-color: currentColor;
}

.est-symbol--selected .est-symbol__label {
  font-weight: 600;
}

.est-symbol--dimmed {
  opacity: 0.45;
}

/* ── Conduit Section ────────────────────────────────────── */

.est-conduit {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
}

.est-conduit__title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted, #607D8B);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.est-conduit__row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.est-conduit__row select {
  flex: 1;
  background: var(--bg-input, rgba(10, 22, 40, 0.9));
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 4px;
  color: var(--text-primary, #FFF);
  padding: 4px 6px;
  font-size: 0.7rem;
  font-family: inherit;
}

.est-conduit__btn {
  width: 100%;
  padding: 6px;
  background: var(--accent-blue, #00B4D8);
  color: var(--btn-text, #000);
  border: none;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.est-conduit__btn:hover {
  opacity: 0.9;
}

/* ── Tools Section ──────────────────────────────────────── */

.est-tools {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
}

.est-tools__btn {
  display: block;
  width: 100%;
  padding: 5px 8px;
  margin-bottom: 4px;
  background: transparent;
  color: var(--text-secondary, #B0BEC5);
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  text-align: left;
}

.est-tools__btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #FFF);
}

/* ── Drawing Viewer (Center Panel) ──────────────────────── */

.est-drawing {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--bg-primary);
  overflow: hidden;
}

.est-drawing__container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  cursor: crosshair;
}

.est-drawing__transform {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.est-drawing__transform canvas {
  display: block;
}

.est-drawing__transform svg {
  position: absolute;
  top: 0;
  left: 0;
}

/* ── 3D Model Panel (Right) ─────────────────────────────── */

.est-model {
  width: 380px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #0D1B2A);
  border-left: 1px solid var(--border-subtle, #2A2A3E);
  overflow: hidden;
}

.est-model__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #B0BEC5);
}

.est-model__canvas {
  flex: 1;
  min-height: 0;
}

.est-model__controls {
  padding: 8px;
  border-top: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
}

.est-model__controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary, #B0BEC5);
  cursor: pointer;
}

.est-model__controls input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent-blue, #00B4D8);
}

.est-model__row {
  display: flex;
  gap: 6px;
}

.est-model__btn {
  padding: 4px 8px;
  background: var(--surface-hover);
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 3px;
  color: var(--text-secondary, #B0BEC5);
  font-size: 0.65rem;
  cursor: pointer;
}

.est-model__btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #FFF);
}

/* ── Bottom Row: BOM + Chat ─────────────────────────────── */

.est-bottom {
  display: flex;
  border-top: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
}

/* ── Live BOM Panel (Resizable) ─────────────────────────── */

.est-bom {
  flex: 1;
  height: 220px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #0D1B2A);
  border-right: 1px solid var(--border-subtle, #2A2A3E);
  overflow: hidden;
  position: relative;
}

/* Drag resize handle */

.est-bom__resize {
  height: 6px;
  background: var(--border-subtle, #2A2A3E);
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}

.est-bom__resize:hover {
  background: var(--surface-hover);
}

.est-bom__resize-dots {
  width: 24px;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    #555 0px, #555 2px,
    transparent 2px, transparent 5px
  );
  border-radius: 1px;
}

/* BOM Header Bar */

.est-bom__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  border-bottom: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
  gap: 6px;
}

.est-bom__header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.est-bom__header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.est-bom__title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary, #B0BEC5);
  white-space: nowrap;
  margin-right: 4px;
}

.est-bom__hbtn {
  padding: 2px 6px;
  background: var(--surface-hover);
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 3px;
  color: var(--text-secondary, #B0BEC5);
  font-size: 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.est-bom__hbtn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.est-bom__hbtn--accent {
  background: rgba(0,180,216,0.15);
  border-color: rgba(0,180,216,0.3);
  color: var(--accent-blue, #00B4D8);
}

.est-bom__hbtn--accent:hover {
  background: rgba(0,180,216,0.25);
}

.est-bom__search {
  width: 120px;
  background: var(--bg-input, rgba(10,22,40,0.9));
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 3px;
  color: var(--text-primary, #FFF);
  padding: 2px 6px;
  font-size: 0.6rem;
  font-family: inherit;
}

.est-bom__search:focus {
  border-color: var(--accent-blue, #00B4D8);
  outline: none;
}

.est-bom__filter {
  background: var(--bg-input, rgba(10,22,40,0.9));
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 3px;
  color: var(--text-primary, #FFF);
  padding: 2px 4px;
  font-size: 0.6rem;
  font-family: inherit;
}

/* BOM Table */

.est-bom__table-wrap {
  flex: 1;
  overflow: auto;
}

.est-bom table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
}

.est-bom th {
  position: sticky;
  top: 0;
  background: var(--bg-tertiary, #111F33);
  padding: 3px 6px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted, #607D8B);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  z-index: 2;
}

.est-bom__th--narrow {
  width: 28px;
  max-width: 28px;
  text-align: center;
}

.est-bom td {
  padding: 2px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary, #B0BEC5);
  white-space: nowrap;
}

.est-bom tr:hover td {
  background: rgba(255,255,255,0.03);
}

/* Editable cell */

.est-bom__cell--editable {
  cursor: pointer;
  position: relative;
}

.est-bom__cell--editable:hover {
  background: rgba(0,180,216,0.08);
  outline: 1px dashed rgba(0,180,216,0.3);
}

.est-bom__cell--calc {
  color: var(--text-muted);
  font-style: italic;
  cursor: default;
  background: rgba(0,0,0,0.08);
  user-select: none;
}

.est-bom__cell--calc:hover {
  background: rgba(0,0,0,0.08);
  outline: none;
}

.est-bom__th--calc {
  color: #666 !important;
  background: rgba(0,0,0,0.12) !important;
}

@keyframes est-bom-pulse {
  0% { background: rgba(0,0,0,0.08); }
  50% { background: rgba(0,180,216,0.12); }
  100% { background: rgba(0,0,0,0.08); }
}

.est-bom__cell--calc-pulse {
  animation: est-bom-pulse 0.4s ease;
}

.est-bom__cell--overridden {
  color: #FFA726;
}

.est-bom__edit-input {
  width: 100%;
  background: var(--bg-input, rgba(10,22,40,0.9));
  border: 1px solid var(--accent-blue, #00B4D8);
  border-radius: 2px;
  color: var(--text-primary);
  padding: 1px 4px;
  font-size: 0.68rem;
  font-family: inherit;
  outline: none;
}

/* Reset button */

.est-bom__reset {
  display: inline-block;
  background: none;
  border: none;
  color: #FFA726;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 2px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.15s;
}

.est-bom__cell--overridden:hover .est-bom__reset {
  opacity: 1;
}

/* Override row tint */

.est-bom__row--override td {
  background: rgba(42,31,10,0.4);
}

/* Override warn icon */

.est-bom__warn {
  color: #FFA726;
  font-size: 0.7rem;
  cursor: help;
}

/* Badges */

.est-bom__badge {
  font-size: 0.55rem;
  padding: 0 3px;
  border-radius: 2px;
  font-weight: 600;
}

.est-bom__badge--manual {
  background: rgba(0,180,216,0.15);
  color: var(--accent-blue, #00B4D8);
}

.est-bom__badge--allow {
  background: rgba(156,39,176,0.15);
  color: #CE93D8;
}

/* Drag handle */

.est-bom__drag {
  width: 20px;
  text-align: center;
  cursor: grab;
  color: var(--text-muted, #607D8B);
}

.est-bom__grip {
  font-size: 0.8rem;
  letter-spacing: -1px;
}

/* Override column */

.est-bom__override-col {
  width: 28px;
  text-align: center;
}

/* Remove button */

.est-bom__remove-col {
  width: 24px;
  text-align: center;
}

.est-bom__remove-btn {
  display: none;
  background: none;
  border: none;
  color: #EF5350;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 2px;
}

tr:hover .est-bom__remove-btn {
  display: inline;
}

/* Detailed Totals Breakdown */

.est-bom__totals-detail {
  display: flex;
  gap: 12px;
  padding: 4px 12px;
  border-top: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
  overflow-x: auto;
  font-size: 0.62rem;
}

.est-bom__totals-section {
  flex: 1;
  min-width: 140px;
}

.est-bom__totals-title {
  font-weight: 700;
  color: var(--text-muted, #607D8B);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.58rem;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 2px;
}

.est-bom__totals-row {
  display: flex;
  justify-content: space-between;
  padding: 1px 0;
  color: var(--text-secondary, #B0BEC5);
}

.est-bom__totals-row--bold {
  font-weight: 700;
  color: var(--text-primary, #FFF);
}

.est-bom__totals-edit {
  color: var(--accent-blue, #00B4D8);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.est-bom__totals-edit:hover {
  color: var(--text-primary);
}

.est-bom__totals-grand {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold, #D4A843);
  text-align: center;
  padding: 4px;
  background: rgba(212,168,67,0.08);
  border-radius: 4px;
  margin-top: 4px;
}

/* Summary Totals Row (always visible) */

.est-bom__totals {
  padding: 4px 12px;
  border-top: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
}

.est-bom__grand {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold, #D4A843);
}

.est-bom__actions {
  display: flex;
  gap: 6px;
}

/* BOM Expanded / Fullscreen states */

.est-bom--expanded {
  height: 50vh !important;
}

.est-bom--fullscreen {
  height: 60vh !important;
}

/* ── EMET Chat Panel ────────────────────────────────────── */

.est-chat {
  width: 380px;
  min-width: 380px;
  height: 180px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #0D1B2A);
  overflow: hidden;
}

.est-chat__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
}

.est-chat__presence {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green, #00E676);
  animation: est-pulse 2s infinite;
}

.est-chat__presence--online {
  background: var(--accent-green, #00E676);
}

.est-chat__presence--thinking {
  background: var(--accent-orange, #FF9800);
}

@keyframes est-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.est-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px;
}

.est-chat__msg {
  margin-bottom: 6px;
  font-size: 0.7rem;
  line-height: 1.4;
}

.est-chat__msg--emet {
  color: var(--accent-blue, #00B4D8);
}

.est-chat__msg--user {
  color: var(--text-primary, #FFF);
  text-align: right;
}

.est-chat__msg--alert {
  color: var(--accent-orange, #FF9800);
  border-left: 2px solid var(--accent-orange, #FF9800);
  padding-left: 8px;
}

.est-chat__input-row {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-top: 1px solid var(--border-subtle, #2A2A3E);
  flex-shrink: 0;
}

.est-chat__input {
  flex: 1;
  background: var(--bg-input, rgba(10, 22, 40, 0.9));
  border: 1px solid var(--border-subtle, #2A2A3E);
  border-radius: 4px;
  color: var(--text-primary, #FFF);
  padding: 5px 8px;
  font-size: 0.7rem;
  font-family: inherit;
}

.est-chat__send {
  padding: 5px 12px;
  background: var(--accent-blue, #00B4D8);
  color: var(--btn-text, #000);
  border: none;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── Responsive: Collapse 3D panel below 1200px ─────────── */

@media (max-width: 1200px) {
  .est-model {
    display: none;
  }
  .est-model--visible {
    display: flex;
    position: fixed;
    top: 48px;
    right: 0;
    bottom: 0;
    z-index: 200;
  }
  .est-chat {
    width: 100%;
    min-width: 0;
  }
}

/* ── Setup Flow ──────────────────────────────────────────── */

.est-setup {
  max-width: 800px;
  margin: 40px auto;
  padding: 32px 40px;
  font-family: 'Inter', var(--font-primary, sans-serif);
}

.est-setup__header {
  margin-bottom: 24px;
}

.est-setup__header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-gold, #D4A843);
  margin: 8px 0 4px;
}

.est-setup__header p {
  font-size: 0.85rem;
  color: var(--text-secondary, #B0BEC5);
  margin: 0;
}

/* Step indicators */
.est-setup__steps {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(212,168,67,0.15);
}

.est-setup__step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-muted, #607D8B);
  background: rgba(255,255,255,0.03);
  transition: all 0.2s;
}

.est-setup__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-hover);
  font-size: 0.7rem;
  font-weight: 600;
}

.est-setup__step-label {
  font-weight: 500;
}

.est-setup__step--active {
  color: var(--accent-gold, #D4A843);
  background: rgba(212,168,67,0.1);
}

.est-setup__step--active .est-setup__step-num {
  background: var(--accent-gold, #D4A843);
  color: var(--btn-text, #000);
}

.est-setup__step--done {
  color: #00E676;
  background: rgba(0,230,118,0.08);
}

.est-setup__step--done .est-setup__step-num {
  background: rgba(0,230,118,0.2);
  color: #00E676;
}

/* Panels */
.est-setup__panel {
  background: rgba(8,10,30,0.6);
  border: 1px solid rgba(212,168,67,0.12);
  border-radius: 10px;
  padding: 28px 32px;
}

.est-setup h2 {
  font-size: 1.2rem;
  color: var(--accent-gold, #D4A843);
  margin-bottom: 16px;
}

/* Fields */
.est-setup__field {
  margin-bottom: 16px;
}

.est-setup__field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-gold, #D4A843);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.est-setup__field input,
.est-setup__field select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: 6px;
  color: var(--text-primary, #FFF);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.est-setup__field input:focus,
.est-setup__field select:focus {
  outline: none;
  border-color: var(--accent-gold, #D4A843);
  box-shadow: 0 0 0 2px rgba(212,168,67,0.15);
}

.est-setup__field input::placeholder {
  color: rgba(255,255,255,0.25);
}

/* Two-column row */
.est-setup__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Error state */
.est-setup__field input.est-field--error {
  border-color: #EF5350;
  box-shadow: 0 0 0 2px rgba(239,83,80,0.15);
}

/* Dropzone */
.est-setup__dropzone {
  border: 2px dashed rgba(212,168,67,0.25);
  border-radius: 8px;
  padding: 36px;
  text-align: center;
  color: var(--text-muted, #607D8B);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.est-setup__dropzone:hover,
.est-setup__dropzone--active {
  border-color: var(--accent-gold, #D4A843);
  color: var(--accent-gold, #D4A843);
  background: rgba(212,168,67,0.04);
}

/* File list */
.est-setup__file-list {
  margin-top: 10px;
}

.est-setup__file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary, #B0BEC5);
}

.est-setup__file-remove {
  background: rgba(239,83,80,0.15);
  color: #EF5350;
  border: none;
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 0.7rem;
}

.est-setup__file-remove:hover {
  background: rgba(239,83,80,0.3);
}

/* Navigation buttons */
.est-setup__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}

.est-setup__btn {
  display: inline-block;
  padding: 12px 28px;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary, #B0BEC5);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.est-setup__btn:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary);
}

.est-setup__btn--next {
  background: var(--accent-gold, #D4A843);
  color: var(--btn-text, #000);
  border: none;
  margin-left: auto;
}

.est-setup__btn--next:hover {
  opacity: 0.9;
  box-shadow: 0 0 16px rgba(212,168,67,0.3);
}

.est-setup__btn--back {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted, #607D8B);
}

.est-setup__btn--back:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.2);
}

.est-setup__btn--create {
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, #D4A843, #B8922E);
  color: var(--btn-text, #000);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(212,168,67,0.3);
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.est-setup__btn--create:hover {
  box-shadow: 0 0 32px rgba(212,168,67,0.5);
  transform: translateY(-1px);
}

.est-setup__btn--create:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.est-setup__emet {
  background: rgba(0, 180, 216, 0.08);
  border-left: 3px solid var(--accent-blue, #00B4D8);
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--accent-blue, #00B4D8);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════ */
/*  Phase 56 — Drawing Toolbar                                */
/* ═══════════════════════════════════════════════════════════ */

.est-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 34px;
}

.est-toolbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s, color 0.1s;
}

.est-toolbar__btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.est-toolbar__btn--active {
  background: rgba(0,180,216,0.2);
  color: var(--accent-cyan, #00B4D8);
  border-color: rgba(0,180,216,0.3);
}

.est-toolbar__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.est-toolbar__btn--layer {
  font-size: 11px;
  padding: 0 5px;
}

.est-toolbar__icon {
  font-size: 14px;
  line-height: 1;
}

.est-toolbar__sep {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.12);
  margin: 0 4px;
}

.est-toolbar__dropdown {
  position: relative;
  display: inline-block;
}

.est-toolbar__dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5000;
  background: var(--dropdown-bg);
  border: 1px solid rgba(100,100,200,0.3);
  border-radius: 4px;
  min-width: 180px;
  padding: 4px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.est-toolbar__dropdown-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}

.est-toolbar__dropdown-item:hover {
  background: rgba(255,255,255,0.08);
}

/* ═══════════════════════════════════════════════════════════ */
/*  Phase 56 — BOM View Mode Tabs                             */
/* ═══════════════════════════════════════════════════════════ */

.est-bom__view-tabs {
  display: flex;
  gap: 2px;
  margin-left: 12px;
}

.est-bom__view-tab {
  padding: 3px 10px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  font-size: 11px;
  transition: background 0.1s;
}

.est-bom__view-tab:hover {
  background: rgba(255,255,255,0.05);
}

.est-bom__view-tab--active {
  background: rgba(0,180,216,0.15);
  color: var(--accent-cyan, #00B4D8);
  border-color: rgba(0,180,216,0.2);
}

.est-bom__system-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.est-bom__system-divider {
  background: rgba(255,255,255,0.03);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.est-bom__system-divider:hover {
  background: var(--surface-hover);
}

/*  Phase 57 — Panel Resize Handles                            */

.est-resize-handle {
  flex-shrink: 0;
  background: var(--border-subtle, #2A2A3E);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s;
}

.est-resize-handle:hover,
.est-resize-handle:active {
  background: var(--accent-blue, #6C63FF);
}

.est-resize-handle--vertical {
  width: 6px;
  cursor: col-resize;
}

.est-resize-handle--horizontal {
  height: 6px;
  cursor: row-resize;
}

.est-resize-handle__dots {
  display: flex;
  gap: 2px;
}

.est-resize-handle--vertical .est-resize-handle__dots {
  flex-direction: column;
}

.est-resize-handle__dots::before,
.est-resize-handle__dots::after,
.est-resize-handle__dots {
  content: '';
}

.est-resize-handle__dots::before {
  content: '\u2022\u2022\u2022';
  color: rgba(255,255,255,0.3);
  font-size: 6px;
  letter-spacing: 1px;
}

.est-resize-handle:hover .est-resize-handle__dots::before {
  color: rgba(255,255,255,0.8);
}

.est-panel--collapsed {
  overflow: hidden;
}

.est-panel--collapsed .est-palette__list,
.est-panel--collapsed .est-palette__search,
.est-panel--collapsed .est-conduit,
.est-panel--collapsed .est-tools {
  display: none;
}

/* ══════════════════════════════════════════════════════════ */
/*  Phase 58 — Assembly Display, System Tabs, Matrix View   */
/* ══════════════════════════════════════════════════════════ */

/* ── System Tabs ──────────────────────────────────────── */
.est-bom__tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 2px 8px;
  background: var(--surface-secondary);
  border-bottom: 1px solid rgba(100,100,200,0.15);
  scrollbar-width: thin;
}
.est-bom__tab {
  padding: 4px 10px;
  font-size: 11px;
  white-space: nowrap;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.est-bom__tab:hover { color: var(--text-primary); }
.est-bom__tab--active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-cyan, #00E5FF);
}
.est-bom__tab--zero { opacity: 0.4; }

/* ── Assembly child rows ─────────────────────────────── */
.est-bom__row--child {
  background: var(--bg-secondary);
  font-size: 12px;
}
.est-bom__row--child td { padding: 3px 6px; }
.est-bom__child-arrow { color: #666; margin-right: 4px; }
.est-bom__expand-arrow {
  cursor: pointer;
  font-size: 10px;
  color: var(--text-muted);
  margin-right: 4px;
}
.est-bom__expand-arrow:hover { color: var(--text-primary); }

/* ── Assembly badge ──────────────────────────────────── */
.est-bom__asm-badge {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(108,99,255,0.2);
  color: var(--accent-blue, #6C63FF);
  margin-left: 6px;
  vertical-align: middle;
}

/* ── No-spec warning ─────────────────────────────────── */
.est-bom__nec-warn {
  color: var(--accent-orange, #FFAA00);
  font-size: 11px;
  cursor: help;
}

/* ── Matrix table ────────────────────────────────────── */
.est-bom__matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.est-bom__matrix-table th,
.est-bom__matrix-table td {
  padding: 4px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(100,100,200,0.1);
}
.est-bom__matrix-table th {
  font-size: 11px;
  color: #AAA;
  font-weight: 600;
}
.est-bom__matrix-total td {
  border-top: 2px solid rgba(100,100,200,0.3);
  font-weight: 700;
}

/* ── System divider row ──────────────────────────────── */
.est-bom__system-divider {
  background: var(--surface-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #CCC;
}
.est-bom__system-divider td { padding: 6px 8px; }
