/* ==========================================================================
   Opsi A — halaman Digital Twin di dalam shell aplikasi utama (audit 2026-10-24).
   Komponen .iw-* memakai token warna aplikasi (--u-*) agar terang/gelap dan
   tipografinya sama dengan halaman lain. Dasar dari .iw-body diterapkan ke .iw-embed.
   ========================================================================== */
body.ri-unified .iw-embed {
    --iw-bg: var(--u-bg);
    --iw-surface: var(--u-surface);
    --iw-surface-2: var(--u-bg);
    --iw-surface-3: var(--u-soft);
    --iw-border: var(--u-line);
    --iw-border-strong: var(--u-line);
    --iw-text: var(--u-text);
    --iw-text-2: var(--u-text);
    --iw-muted: var(--u-muted);
    --iw-primary: var(--u-primary-ink);
    --iw-primary-bg: var(--u-primary);
    --iw-primary-hover: var(--u-primary-ink);
    --iw-primary-soft: var(--u-soft);
    --iw-success: var(--u-success);
    --iw-success-soft: var(--u-success-bg);
    --iw-warning: var(--u-warning);
    --iw-warning-soft: var(--u-warning-bg);
    --iw-danger: var(--u-danger);
    --iw-danger-soft: var(--u-danger-bg);
    --iw-radius: var(--u-radius);
    --iw-shadow: var(--u-shadow);
}
html[data-bs-theme="dark"] body.ri-unified .iw-embed { --iw-primary: #9cc0ff; }

.iw-embed { display: flex; flex-direction: column; gap: 16px; color: var(--iw-text); font-family: var(--iw-font); font-size: 14px; line-height: 1.45; min-width: 0; }
.iw-embed *, .iw-embed *::before, .iw-embed *::after { box-sizing: border-box; }
/* Spesifisitas rendah (:where) agar setara aturan dasar .iw-body lama: kanvas twin, grafik, dan replay
   yang punya aturan ukuran sendiri (mis. .iw-live-canvas svg) tetap menang. */
.iw-embed :where(svg:not(.icon)) { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.iw-embed :where(a:not(.iw-button):not(.ri-u-subnav-item):not(.ri-u-btn)) { color: var(--iw-primary); }
.iw-embed :where(:focus-visible) { outline: none; box-shadow: var(--iw-focus); border-radius: 6px; }
.iw-embed .iw-main { padding: 0; min-width: 0; }
.iw-embed .iw-page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; color: var(--u-text, var(--iw-text)); }
.iw-embed .iw-page-head p { font-size: 13.5px; max-width: 820px; }
.iw-embed .iw-breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--iw-muted); }
.iw-embed .iw-breadcrumb a { text-decoration: none; }
.iw-embed .iw-card { background: var(--iw-surface); border: 1px solid var(--iw-border); border-radius: var(--iw-radius); box-shadow: var(--iw-shadow); }
.iw-embed .iw-table th { background: var(--iw-surface-2); }
.iw-embed-aside { max-width: 420px; }
/* Editor builder memakai tinggi layar penuh di shell lama; di dalam aplikasi cukup tinggi konten. */
.iw-embed [data-b-root], .iw-embed .iw-builder { min-height: 640px; }
@media (max-width: 900px) {
    .iw-embed .iw-page-head h1 { font-size: 21px; }
}
/* Ikon font dasbor ([data-icon]::before) tidak boleh menimpa ikon part twin yang memakai atribut yang sama. */
.iw-embed [data-icon]::before, .iw-embed [data-icon]::after { content: none !important; display: none !important; }

/* Model Digital Twin: alur 4 langkah + form manual sekunder. */
.iw-embed .iw-twin-howto { padding: 14px 16px; }
.iw-embed .iw-howto { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.iw-embed .iw-howto li { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.iw-embed .iw-howto b { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--u-soft); color: var(--u-primary-ink, #1b4fc0); font-size: 12px; font-weight: 800; }
.iw-embed .iw-howto span { display: grid; gap: 2px; min-width: 0; }
.iw-embed .iw-howto strong { font-size: 13px; color: var(--u-text); }
.iw-embed .iw-howto small { font-size: 12px; color: var(--u-muted); }
.iw-embed details.iw-create-more > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; }
.iw-embed details.iw-create-more > summary::-webkit-details-marker { display: none; }
.iw-embed details.iw-create-more > summary h2::before { content: "▸ "; color: var(--u-muted); }
.iw-embed details.iw-create-more[open] > summary h2::before { content: "▾ "; }
.iw-embed details.iw-create-more:not([open]) > summary { border-bottom: 0; }
@media (max-width: 900px) { .iw-embed .iw-howto { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .iw-embed .iw-howto { grid-template-columns: 1fr; } }

/* Padanan aturan ".iw-body …" (shell lama) untuk shell aplikasi — kanvas twin, builder, kelas, dan pustaka komponen. */
.iw-embed .iw-builder-svg { stroke: none; fill: none; stroke-width: 1; position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; touch-action: none; user-select: none; }
.iw-embed .iw-st-art { width: 100%; height: 110px; stroke: none; fill: none; }
.iw-embed .iw-live-canvas svg, .iw-embed .iw-mini-twin svg { width: 100%; height: 100%; stroke: none; fill: none; stroke-width: 1; }
.iw-embed .cl-illo, .iw-embed .cl-sym { width: auto; height: auto; stroke: none; fill: none; }
.iw-embed .cl-thumb .cl-illo { width: 120px; height: 80px; }
.iw-embed .cl-photo .cl-illo { width: 220px; height: 150px; }
.iw-embed .cl-sym { width: 100%; height: auto; }
/* Jarak antarkartu konsisten dengan halaman aplikasi lain. */
.iw-embed .iw-main > * + * { margin-top: 16px; }

/* Halaman publik (tamu) yang memakai layout iotwin.layouts.public, mis. Library Komponen. */
.iw-public-main { width: 100%; max-width: 1440px; margin: 0 auto; padding: 18px clamp(16px, 3vw, 32px) 40px; }
.iw-public-main .iw-embed { min-height: 0; }
