/* مصمم المساحات 3D — تنسيق الميزة.
 *
 * يعيد استخدام رموز :root من style.css ونظام الـshell من dashboard.css بلا
 * تعديل أيٍّ منهما. البادئة id- خاصة بهذه الميزة، ولا تتقاطع مع cd- الخاصة
 * بمصمم الستائر — فلا يمكن لتنسيق أحدهما أن يؤثّر في الآخر.
 */

/* ═══ حالات المنع ═══ */
.id-no-access {
  margin: 40px auto;
  max-width: 520px;
  padding: 26px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.9;
}
.id-no-access.hidden { display: none; }

/* ═══ شارة نوع المشروع في الهيدر ═══ */
.id-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-mid, var(--accent));
  font-size: 12.5px;
  font-weight: 700;
}
.id-mode-badge.hidden { display: none; }

/* ═══ 1) شاشة اختيار نوع المشروع ═══ */
.id-picker { padding: 32px 28px 44px; }
.id-picker.hidden { display: none; }

.id-picker-head { text-align: center; margin-bottom: 30px; }
.id-picker-title {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.id-picker-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}

.id-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.id-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 22px 20px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.id-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.id-card:focus-within { border-color: var(--accent); }

.id-card-icon {
  width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-mid, var(--accent));
}
.id-card-icon svg { width: 34px; height: 34px; display: block; }

.id-card-name {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text);
}
.id-card-desc {
  margin: 0 0 18px;
  font-size: 12.8px;
  line-height: 1.85;
  color: var(--muted);
  flex: 1;
}
.id-card-btn {
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.id-card-btn:hover { background: var(--accent-mid, var(--accent-strong)); }

/* ═══ 2) مساحة العمل ═══ */
.id-workspace { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); min-height: 0; }
.id-workspace.hidden { display: none; }

/* شريط المراحل — المعطَّل معطَّل بصرياً بوضوح، لا يوهم بأنه يعمل */
.id-steps {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}
.id-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.id-step.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-mid, var(--accent)); }
.id-step.disabled { opacity: .5; cursor: not-allowed; }
.id-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--panel-3);
  font-size: 11px;
}
.id-step.active .id-step-num { background: var(--accent); color: #fff; }
.id-step-soon {
  margin-inline-start: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.id-workspace-body {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

/* ── لوحة التحكم ── */
.id-panel {
  overflow-y: auto;
  padding: 20px 18px 30px;
  border-inline-end: 1px solid var(--border);
  background: var(--panel);
}
.id-group { margin-bottom: 26px; }
.id-group-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--text); }
.id-group-hint { margin: 0 0 12px; font-size: 12px; color: var(--muted); line-height: 1.7; }

.id-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.id-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.id-field.hidden { display: none; }
.id-field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.id-field input[type="number"],
.id-field input[type="text"],
.id-field select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.id-field input:focus, .id-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.id-field-hint { font-size: 11px; color: var(--muted); }
.id-field-error { font-size: 11.5px; color: var(--error); font-weight: 600; min-height: 0; }

.id-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.9;
}
.id-summary b { color: var(--text); font-variant-numeric: tabular-nums; }

.id-color-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.id-color-field { display: flex; flex-direction: column; gap: 5px; }
.id-color-field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.id-color-field input[type="color"] {
  width: 100%; height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  cursor: pointer;
}

/* الحوائط */
.id-wall-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.id-wall-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.id-wall-chip:hover { border-color: var(--border-2); }
.id-wall-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-mid, var(--accent)); }
.id-wall-count {
  min-width: 19px; padding: 1px 6px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.id-wall-chip.active .id-wall-count { background: var(--accent); color: #fff; }

.id-actions { display: flex; gap: 8px; margin-bottom: 6px; }
.id-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.id-btn-ghost {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
}
.id-btn-ghost:hover { border-color: var(--accent); color: var(--accent-mid, var(--accent)); }

.id-openings { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.id-opening-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  text-align: start;
  transition: border-color .15s, background .15s;
}
.id-opening-row:hover { border-color: var(--border-2); }
.id-opening-row.active { border-color: var(--accent); background: var(--accent-soft); }
.id-opening-kind {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.id-opening-row.active .id-opening-kind { background: var(--accent); color: #fff; }
.id-opening-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-opening-size { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.id-openings-empty { font-size: 12px; color: var(--muted); padding: 10px 2px; }

.id-opening-props {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-2);
}
.id-opening-props.hidden { display: none; }
.id-props-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.id-props-head .id-group-title { margin: 0; }
.id-icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.id-icon-btn:hover { border-color: var(--border-2); }
.id-icon-danger:hover { border-color: var(--error); color: var(--error); }

/* ═══ التراجع/الإعادة ═══ */
.id-history-bar { display: flex; gap: 8px; margin-bottom: 18px; }
.id-histbtn { flex: 1; }
.id-histbtn:disabled { opacity: .45; cursor: not-allowed; }
.id-histbtn:disabled:hover { border-color: var(--border); color: var(--text-2); }

/* ═══ العناصر الإنشائية ═══ */
.id-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.id-actions-grid .id-btn { flex: none; }

.id-props-tools { display: flex; gap: 6px; }

.id-measure {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
}
.id-measure-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--muted);
}
.id-measure-row + .id-measure-row { border-top: 1px dashed var(--border); }
.id-measure-row b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ═══ مكتبة المنتجات ═══ */
.id-catalog { display: flex; flex-direction: column; gap: 8px; }
.id-catalog-soon {
  padding: 14px 13px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: 12.5px; font-weight: 600; line-height: 1.85;
}
.id-cat-group { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.id-cat-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px;
  border: 0;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit; font-size: 12.8px; font-weight: 700;
  cursor: pointer;
  text-align: start;
}
.id-cat-head:hover { background: var(--panel-3); }
.id-cat-count {
  min-width: 20px; padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel-3); color: var(--muted);
  font-size: 11px; font-weight: 700; text-align: center;
}
.id-cat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 8px;
}
.id-cat-group.collapsed .id-cat-grid { display: none; }

/* مكتبة الإكسسوارات: نفس بطاقة المنتج بحدٍّ جانبي يميّز الطبقة المشتركة
   عن مكتبة النمط — تمييزٌ بصري واحد لا نظام بطاقات ثانٍ. */
#id-accessories-catalog { display: flex; flex-direction: column; gap: 8px; }
.id-prod-accessory { border-inline-start: 2px solid var(--accent, #2f9e6b); }

.id-prod {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-2);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.id-prod:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.id-prod-icon { color: var(--accent-mid, var(--accent)); }
.id-prod-icon svg { width: 34px; height: 30px; display: block; }
.id-prod-name { font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.4; }
.id-prod-dim { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.id-subhead {
  margin: 14px 0 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px; font-weight: 700; color: var(--text);
}
.id-check {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer;
}
.id-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ═══ الأجسام ═══ */
.id-warn-line {
  font-size: 11.5px;
  color: var(--warn);
  font-weight: 600;
  line-height: 1.7;
  margin: 4px 0;
}
.id-align-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.id-align-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.id-align-btns { display: flex; gap: 5px; }
.id-btn-xs { padding: 5px 9px; font-size: 11.5px; flex: none; }

.id-measure-warn {
  margin-top: 8px; padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11.5px; font-weight: 600; line-height: 1.75;
}

.id-note {
  margin-top: 4px;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.9;
  font-weight: 500;
}
.id-note strong { font-weight: 800; }

/* ── العارض ── */
.id-viewer { position: relative; min-height: 0; background: #1b1e24; overflow: hidden; }
.id-viewer-host { position: absolute; inset: 0; }
.id-viewer-host canvas.id-viewer-canvas {
  display: block; width: 100%; height: 100%; cursor: grab; touch-action: none;
}
.id-viewer-host canvas.id-viewer-canvas:active { cursor: grabbing; }

.id-viewer-tools {
  position: absolute; top: 12px; inset-inline-end: 12px;
  display: flex; flex-direction: column; gap: 7px; z-index: 4;
}
.id-tool {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-sm);
  background: rgba(24,27,33,.82);
  color: #e6edf3;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.id-tool:hover { background: rgba(24,27,33,.95); border-color: rgba(255,255,255,.3); }
.id-tool.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.id-tool svg { width: 17px; height: 17px; display: block; }

.id-viewer-views {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 4px;
  border-radius: 999px;
  background: rgba(24,27,33,.82);
  border: 1px solid rgba(255,255,255,.14);
  z-index: 4;
}
.id-view {
  padding: 6px 13px;
  border: 0; border-radius: 999px;
  background: none;
  color: #c9d1d9;
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.id-view:hover { background: rgba(255,255,255,.1); color: #fff; }
.id-view.active { background: var(--accent); color: #fff; }

.id-viewer-badge {
  position: absolute; top: 12px; inset-inline-start: 12px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: rgba(24,27,33,.82);
  border: 1px solid rgba(255,255,255,.14);
  color: #e6edf3;
  font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  z-index: 4;
}

/* خطوط القياس — طبقة HTML فوق الـcanvas، يحرّكها Room3DCore */
.id-guides { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.id-guide-line {
  position: absolute;
  border-top: 1.5px solid rgba(255,255,255,.85);
  transform-origin: 0 0;
  height: 0;
}
.id-guide-line.id-guide-minor { border-top-style: dotted; border-top-color: rgba(255,255,255,.6); }
.id-guide-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(17,19,24,.88);
  color: #fff;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.id-guide-label.id-guide-label-minor { font-size: 10.5px; font-weight: 600; background: rgba(17,19,24,.72); }
.id-guide-leader {
  position: absolute;
  border-top: 1px dashed rgba(255,255,255,.45);
  transform-origin: 0 0;
  height: 0;
}

.id-viewer-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(17,19,24,.9);
  text-align: center;
  z-index: 6;
}
.id-viewer-overlay.hidden { display: none; }
.id-viewer-msg { color: #e6edf3; font-size: 13px; font-weight: 600; line-height: 1.75; max-width: 360px; }

/* ═══ التنبيهات ═══ */
.id-toast-wrap {
  position: fixed; bottom: 22px; inset-inline-start: 22px;
  display: flex; flex-direction: column; gap: 8px; z-index: 90;
}
.id-toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--panel);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: id-toast-in .22s ease;
}
@keyframes id-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ═══ استجابة الشاشات ═══ */
@media (max-width: 1100px) {
  .id-workspace-body { grid-template-columns: 300px 1fr; }
}
@media (max-width: 900px) {
  .id-workspace { height: auto; }
  .id-workspace-body { grid-template-columns: 1fr; }
  .id-panel { border-inline-end: 0; border-bottom: 1px solid var(--border); max-height: none; }
  .id-viewer { height: 60vh; min-height: 340px; }
  .id-picker { padding: 22px 16px 34px; }
  .id-picker-title { font-size: 21px; }
}

/* ═══════════ طبقة التفاعل المباشر (المرحلة 6) ═══════════
   شريط الأدوات على يسار العارض، ولوحة القياس الحيّ أعلاه. */
.id-itools {
  position: absolute; top: 12px; inset-inline-start: 12px;
  display: flex; flex-direction: column; gap: 6px; z-index: 5;
  padding: 5px; border-radius: 12px;
  background: rgba(24,27,33,.82);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
}
.id-itool {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: #cfd8e3; cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.id-itool:hover { background: rgba(255,255,255,.10); color: #fff; }
.id-itool.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.id-itool svg { width: 17px; height: 17px; display: block; }
.id-itool-sep { height: 1px; margin: 3px 2px; background: rgba(255,255,255,.16); }
.id-itool-act { color: #9fb0c4; }

.id-ihud {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: none; z-index: 5; min-width: 190px; max-width: 340px;
  padding: 9px 12px; border-radius: 11px;
  background: rgba(24,27,33,.9);
  border: 1px solid rgba(255,255,255,.14);
  color: #e6edf3; font-size: 12px; line-height: 1.7;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.id-ihud.on { display: block; }
.id-ih-num {
  font-size: 21px; font-weight: 700; letter-spacing: .5px;
  color: #fff; text-align: center; margin-bottom: 3px;
}
.id-ih-num span { font-size: 12px; font-weight: 500; color: #9fb0c4; }
.id-ih-axis { text-align: center; font-weight: 600; margin-bottom: 3px; }
.id-ih-axis[data-axis="x"] { color: #f87171; }
.id-ih-axis[data-axis="y"] { color: #4ade80; }
.id-ih-axis[data-axis="z"] { color: #60a5fa; }
.id-ih-measure { text-align: center; font-size: 16px; font-weight: 700; color: #38bdf8; }
.id-ih-hint { text-align: center; color: #9fb0c4; }
.id-ih-bad { color: #fca5a5; text-align: center; margin-top: 2px; }
.id-ih-multi { text-align: center; color: #9fb0c4; margin-top: 3px; }
.id-ih-rows { margin-top: 4px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 4px; }
.id-ih-row { display: flex; justify-content: space-between; gap: 14px; }
.id-ih-row span { color: #9fb0c4; }
.id-ih-row b { font-weight: 600; }

@media (max-width: 720px) {
  .id-itools { flex-direction: row; top: auto; bottom: 58px; inset-inline-start: 50%; transform: translateX(50%); }
  .id-ihud { max-width: 88%; font-size: 11px; }
}

/* ═══════════════════════════════════════════════════════════════════
   المرحلة 7 — الحفظ ودورة حياة المشروع
   ═══════════════════════════════════════════════════════════════════ */

/* ── شريط الحفظ في الهيدر ── */
.id-savebar {
  display: flex; align-items: center; gap: 8px;
  padding-inline-end: 6px;
}
.id-savebar.hidden { display: none; }

.id-title-input {
  width: 220px; max-width: 34vw;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600;
}
.id-title-input:focus { outline: none; border-color: var(--accent); }

.id-ref {
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.id-ref.hidden { display: none; }

/* مؤشّر الحفظ نصّ صريح لا نقطة صامتة: «غير محفوظ» تحذير حقيقي يستحق أن
   يُقرأ، لا زخرفة. الرمزان من نظام التصميم نفسه (--warn/--accent-strong)
   فيتبعان الثيم الفاتح والداكن بلا قيم مكتوبة يدوياً. */
.id-dirty { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.id-dirty-on  { color: var(--warn); }
.id-dirty-off { color: var(--accent-strong); }

.id-save-btn { flex: none; padding: 7px 18px; }

.id-btn-primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}
.id-btn-primary:hover { filter: brightness(1.06); }
.id-btn-primary:disabled { opacity: .6; cursor: default; filter: none; }

.id-btn-danger {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
}
.id-btn-danger:hover { border-color: var(--error); color: var(--error); }

/* ── شاشة «تصاميمي» ── */
.id-designs { padding: 28px 28px 44px; }
.id-designs.hidden { display: none; }

.id-designs-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; text-align: start; margin-bottom: 20px; flex-wrap: wrap;
}
.id-designs-actions { display: flex; gap: 8px; flex: none; }
.id-designs-actions .id-btn { flex: none; padding: 8px 16px; }
.id-designs-actions .id-btn.on { border-color: var(--accent); color: var(--accent-mid, var(--accent)); }

.id-designs-filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.id-designs-filters.hidden { display: none; }
.id-designs-search, .id-designs-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit; font-size: 13px;
}
.id-designs-search { flex: 1; min-width: 200px; }
.id-designs-search:focus, .id-designs-select:focus { outline: none; border-color: var(--accent); }

.id-designs-list { display: flex; flex-direction: column; gap: 8px; }
.id-designs-empty {
  padding: 40px 20px; text-align: center;
  color: var(--text-2); font-size: 14px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}

.id-design-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color .15s;
}
.id-design-row:hover { border-color: var(--accent); }
.id-design-main { min-width: 0; }
.id-design-title {
  font-size: 14.5px; font-weight: 700; color: var(--text);
  margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.id-design-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-2);
}
.id-design-meta .id-design-ref {
  font-weight: 700; letter-spacing: .3px;
  color: var(--accent-mid, var(--accent));
  font-variant-numeric: tabular-nums;
}
.id-design-warn { color: var(--warn); font-weight: 600; }
.id-design-actions { display: flex; gap: 8px; flex: none; }
.id-design-actions .id-btn { flex: none; padding: 7px 16px; }

@media (max-width: 720px) {
  .id-designs { padding: 20px 14px 34px; }
  .id-design-row { flex-direction: column; align-items: stretch; }
  .id-design-actions { justify-content: flex-end; }
  .id-title-input { width: 130px; }
  .id-savebar { gap: 6px; }
}

/* ═══════════════════════════════════════════════════════════════════
   المرحلة 8 — الدواليب والتحرير الداخلي
   ═══════════════════════════════════════════════════════════════════ */

/* بطاقة نوع جاهز (Preset) — أبرز قليلاً من بطاقة منتج عادية لأنها نقطة
   البداية في نمط الدواليب. */
.id-prod-preset { border-color: var(--accent); }
.id-prod-preset:hover { background: var(--accent-soft); }

/* لوحة الوحدة تخفت داخل وضع التحرير الداخلي بدل أن تختفي: يبقى السياق
   مرئياً، ولا تتنافس لوحتان على الانتباه. */
.id-dimmed { opacity: .45; pointer-events: none; }

.id-internal.hidden { display: none; }
.id-internal .id-props-head { margin-bottom: 10px; }

/* مسار التنقّل فوق العارض — يجيب دائماً عن «أين أنا الآن؟» */
.id-internal-bar {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 14px;
  border-radius: 999px;
  background: rgba(24,27,33,.9);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
  z-index: 6;
}
.id-internal-bar.hidden { display: none; }
.id-internal-crumb {
  font-size: 12.5px; font-weight: 700; color: #e6edf3; white-space: nowrap;
}
.id-internal-bar .id-btn { flex: none; padding: 5px 12px; font-size: 11.5px; }

/* شبكة أزرار إضافة الأجزاء الداخلية */
.id-parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 7px;
  margin: 10px 0;
}
.id-part-add {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text-2);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.id-part-add:hover { border-color: var(--accent); color: var(--accent-mid, var(--accent)); background: var(--accent-soft); }
.id-part-icon { display: block; width: 24px; height: 24px; }
.id-part-icon svg { width: 100%; height: 100%; display: block; }
.id-part-name { font-size: 11px; font-weight: 600; text-align: center; line-height: 1.4; }

@media (max-width: 720px) {
  .id-internal-bar { top: 8px; inset-inline-start: 8px; padding: 5px 8px 5px 10px; }
  .id-internal-crumb { font-size: 11px; }
  .id-parts-grid { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }
}

/* ═══════════════════════════════════════════════════════════════════
   المرحلة 10 — مسار العمل والتنقّل بين المراحل
   ═══════════════════════════════════════════════════════════════════ */

/* الشريط يبنيه interior-workflow.js كأزرار حقيقية — نفس لغة التصميم
   السابقة، بلا وسم «قريباً» ولا حالة معطَّلة. */
.id-steps .id-step {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.id-steps .id-step:hover { border-color: var(--accent); color: var(--accent-mid, var(--accent)); }
.id-steps .id-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.id-step-label { white-space: nowrap; }

/* المرحلة المنجزة: تلميح هادئ لا يزاحم المرحلة النشطة */
.id-steps .id-step.done {
  border-color: var(--accent-soft);
  color: var(--accent-mid, var(--accent));
}
.id-steps .id-step.done .id-step-num {
  background: var(--accent-soft);
  color: var(--accent-mid, var(--accent));
}

/* ترويسة المرحلة: أين المستخدم وماذا يفعل هنا */
.id-step-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}
.id-step-title { margin: 0 0 2px; font-size: 15px; font-weight: 700; color: var(--text); }
.id-step-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.id-step-counter {
  flex: none;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* إخفاء أقسام اللوحة التي لا تخصّ المرحلة الحالية. صنف مستقل عن .hidden
   كي لا يتصادم مع إظهار/إخفاء المنتج نفسه للوحات الخصائص. */
.id-step-hidden { display: none !important; }

/* شريط التنقّل السفلي */
.id-stepnav {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}
.id-stepnav-spacer { flex: 1; }
.id-stepnav .id-btn { flex: none; padding: 9px 24px; }
.id-stepnav .id-btn.hidden { display: none; }

/* المعاينة: يتمدّد العارض وتنكمش اللوحة، بلا أي إعادة بناء للمشهد */
.id-workspace.id-preview .id-workspace-body { grid-template-columns: 260px 1fr; }
.id-workspace.id-preview .id-itools { display: none; }

/* لوحة المعاينة والإظهار (المرحلة 14 — Stage 5) */
.id-render-panel { display: flex; flex-direction: column; gap: 4px; }
.id-render-modes { display: flex; gap: 6px; margin-bottom: 14px; }
.id-render-mode { flex: 1; padding: 8px 4px; font-size: 12.5px; }
.id-render-mode.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.id-render-panel input[type="range"] {
  width: 100%; accent-color: var(--accent); cursor: pointer;
}
#id-render-capture { margin-top: 10px; }
#id-render-status { min-height: 18px; margin-top: 8px; }

/* ملخّص التصميم */
.id-sum-block { margin-bottom: 16px; }
.id-sum-head {
  font-size: 12px; font-weight: 700; color: var(--muted);
  letter-spacing: .3px; margin-bottom: 6px;
}
.id-sum-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12.5px;
}
.id-sum-row:last-child { border-bottom: 0; }
.id-sum-row span { color: var(--text-2); }
.id-sum-row b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.id-sum-empty { padding: 10px 0; color: var(--muted); font-size: 12.5px; }

.id-sum-status {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 700;
}
.id-sum-status.dirty { background: var(--warn-soft); color: var(--warn); }
.id-sum-status.saved { background: var(--accent-soft); color: var(--accent-strong); }

@media (max-width: 720px) {
  .id-step-head { padding: 9px 14px; flex-direction: column; align-items: flex-start; gap: 6px; }
  .id-step-counter { align-self: flex-end; }
  .id-stepnav { padding: 9px 14px; }
  .id-stepnav .id-btn { padding: 9px 16px; }
  .id-workspace.id-preview .id-workspace-body { grid-template-columns: 1fr; }
}

/* نمط مشروع لم يُنفَّذ بعد — يُعلَن صراحةً بدل أن يُفتح فارغاً */
.id-card-soon { opacity: .62; cursor: not-allowed; position: relative; }
.id-card-soon:hover { border-color: var(--border); box-shadow: var(--shadow-card); transform: none; }
.id-card-soon .id-card-btn { background: var(--panel-3); color: var(--muted); cursor: not-allowed; }
.id-card-soon .id-card-btn:hover { background: var(--panel-3); }
.id-card-soon-badge {
  position: absolute; top: 12px; inset-inline-end: 12px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--panel-3); color: var(--muted);
  font-size: 10.5px; font-weight: 700;
}

/* ── المرحلة 11: لوحة المجموعات ────────────────────────────────────────
   انتماءٌ منطقي بين أجسام مستقلة. الصف يعرض المجموعة وأفعالها الثلاثة،
   ويُبرَز حين تكون كل أعضائها محدَّدة. */
.id-assembly-actions { margin-bottom: 8px; }
.id-assembly-actions .id-btn { width: 100%; }
.id-assembly-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 7px 9px; margin-bottom: 6px;
  border: 1px solid var(--id-border, #e2ddd4); border-radius: 8px;
  background: var(--id-surface, #fff);
}
.id-assembly-row.active {
  border-color: var(--id-accent, #b08d57);
  box-shadow: inset 0 0 0 1px var(--id-accent, #b08d57);
}
.id-assembly-name { font-size: 12.5px; font-weight: 600; }
.id-assembly-tools { display: flex; gap: 4px; flex-shrink: 0; }
.id-assembly-tools .id-btn { padding: 2px 7px; font-size: 11px; }
.id-btn-danger { color: #b3261e; }
.id-assembly-actions { display: flex; flex-direction: column; gap: 4px; }
.id-assembly-nudge { display: flex; gap: 3px; margin: -2px 0 8px; justify-content: center; }
.id-assembly-nudge .id-btn { padding: 2px 8px; font-size: 12px; line-height: 1.2; }


/* ── مكتبة الموديلات الحقيقية (Generic 3D Asset Library V1) ── */
.id-asset-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.id-asset-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.id-asset-cat {
  border: 1px solid var(--id-border, #d8d2c8); background: transparent; border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer; color: inherit;
}
.id-asset-cat[aria-pressed="true"] { background: var(--id-accent, #7a6a55); color: #fff; border-color: transparent; }
.id-asset-cat .id-asset-cat-n { opacity: .65; margin-inline-start: 5px; font-size: 11px; }
/* الصورة المصغّرة: كانت بلا قاعدةٍ إطلاقاً فتُرسَم بمقاسها الطبيعي (512 بكسل)
 * فتتضخّم البطاقة إلى ~526×571 ويصير عمودان يملآن اللوحة. تُقيَّد هنا بنسبةٍ
 * مربّعة وارتفاعٍ ثابت مع contain كي لا يُقصّ الأصل ولا تُشوَّه نسبته. */
.id-prod-thumb {
  width: 100%; height: 84px; object-fit: contain; display: block;
  border-radius: var(--radius-sm, 6px);
  background: var(--id-thumb-bg, rgba(0, 0, 0, .035));
}
/* شبكةٌ متجاوبة للمكتبة وحدها — المكتبة البارامترية تبقى على عمودَيها */
#id-asset-catalog .id-cat-grid {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
/* ارتفاعٌ محكوم بتمريرٍ داخلي كي لا تدفع المكتبة بقية اللوحة خارج الشاشة */
#id-asset-catalog { max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; }
.id-prod-asset { position: relative; }
.id-prod-asset .id-prod-name { font-size: 12px; line-height: 1.3; text-align: center; }
.id-prod-asset .id-prod-dim { font-size: 10px; opacity: .6; }
.id-prod-asset .id-asset-badge {
  position: absolute; inset-inline-end: 4px; inset-block-start: 4px;
  font-size: 9px; padding: 1px 5px; border-radius: 4px;
  background: var(--id-accent, #7a6a55); color: #fff; letter-spacing: .3px;
}
.id-prod-asset.is-loading { opacity: .6; pointer-events: none; }
.id-prod-asset.is-error { border-color: #c0392b; }
.id-asset-empty { font-size: 12px; opacity: .7; padding: 8px 2px; }
