.dw-root {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  color: #0f172a;
}

.theme-dark .dw-root {
  color: #f8fafc;
}

/* Single Compact Card Shell */
.dw-card-shell {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.theme-dark .dw-card-shell {
  background: #1e293b;
  border-color: #334155;
}

.dw-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1rem;
}

.theme-dark .dw-top-bar {
  border-bottom-color: #334155;
}

.dw-header-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #d97706;
}

.theme-dark .dw-header-title {
  color: #f59e0b;
}

/* Two Section Layout Inside Single Card */
.dw-card-content {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .dw-card-content {
    grid-template-columns: 1fr;
  }
}

.dw-form-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 1.25rem;
  border-right: 1px solid #e2e8f0;
}

.theme-dark .dw-form-column {
  border-right-color: #334155;
}

@media (max-width: 860px) {
  .dw-form-column {
    padding-right: 0;
    border-right: none;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
  }
  .theme-dark .dw-form-column {
    border-bottom-color: #334155;
  }
}

.dw-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dw-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0f172a;
}

.theme-dark .dw-label {
  color: #f8fafc;
}

.dw-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.theme-dark .dw-input-wrap {
  border-color: #475569;
  background: #0f172a;
}

.dw-input-wrap input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
}

.theme-dark .dw-input-wrap input {
  color: #f8fafc;
}

.dw-unit-badge {
  padding: 0.5rem 0.75rem;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 700;
  font-size: 0.75rem;
}

.theme-dark .dw-unit-badge {
  background: #334155;
  color: #94a3b8;
}

.dw-segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.theme-dark .dw-segmented-control {
  background: #0f172a;
}

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

.dw-chip-btn {
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.theme-dark .dw-chip-btn {
  color: #94a3b8;
}

.dw-chip-btn.dw-active {
  background: #fff;
  border-color: #d97706;
  color: #d97706;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.theme-dark .dw-chip-btn.dw-active {
  background: #1e293b;
  border-color: #f59e0b;
  color: #f59e0b;
}

.dw-view-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* CAD Technical Elevation Viewport */
.dw-cad-viewport {
  background: #f8fafc;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.theme-dark .dw-cad-viewport {
  background: #0f172a;
  border-color: #334155;
}

.dw-cad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}

.dw-cad-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.theme-dark .dw-cad-title {
  color: #38bdf8;
}

.dw-cad-canvas {
  width: 100%;
  height: 200px;
  position: relative;
  border: 1px solid #cbd5e1;
  background: #fff;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 0.5rem;
}

.theme-dark .dw-cad-canvas {
  border-color: rgba(56, 189, 248, 0.2);
  background: rgba(15, 23, 42, 0.8);
}

.dw-cad-frame {
  width: 100%;
  height: 100%;
  position: relative;
  border-top: 6px solid #64748b;
  border-bottom: 6px solid #64748b;
}

.theme-dark .dw-cad-frame {
  border-top-color: #94a3b8;
  border-bottom-color: #94a3b8;
}

.dw-cad-studs-layer {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
}

.dw-cad-stud-element {
  width: 4px;
  height: 100%;
  background: #94a3b8;
}

.theme-dark .dw-cad-stud-element {
  background: #38bdf8;
}

.dw-cad-boards-overlay {
  position: absolute;
  inset: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  opacity: 0.9;
}

.dw-cad-board-panel {
  border: 1px dashed #d97706;
  background: #fef3c7;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #78350f;
}

.theme-dark .dw-cad-board-panel {
  border-color: #f59e0b;
  color: #0f172a;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
}

.dw-cad-dimension-tag {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  background: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.theme-dark .dw-cad-dimension-tag {
  color: #38bdf8;
  background: #0f172a;
  border-color: #334155;
}

.dw-summary-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.theme-dark .dw-summary-strip {
  background: #0f172a;
  border-color: #334155;
}

.dw-summary-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dw-summary-box .lbl {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.theme-dark .dw-summary-box .lbl {
  color: #94a3b8;
}

.dw-summary-box .val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #d97706;
}

.theme-dark .dw-summary-box .val {
  color: #f59e0b;
}

/* Material Output Grid */
.dw-material-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
}

.dw-mat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.theme-dark .dw-mat-card {
  background: #0f172a;
  border-color: #334155;
}

.dw-mat-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: #d97706;
  line-height: 1;
}

.theme-dark .dw-mat-num {
  color: #f59e0b;
}

.dw-mat-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
}

.theme-dark .dw-mat-title {
  color: #f8fafc;
}

.dw-mat-sub {
  font-size: 0.65rem;
  color: #64748b;
}

.theme-dark .dw-mat-sub {
  color: #94a3b8;
}
