/* ============================================================
   QWorks Reinforced Concrete Design — model 3D (ui/rc3d.js), salinan gaya model 3D
   Earth Retaining Design / Frame Design agar semua modul seragam.
   Panel kaca grafit di atas kanvas WebGL; aksen kuning survei untuk pilihan aktif.
   Prefiks kelas: v3-
   ============================================================ */
.v3-root { position: absolute; inset: 0; overflow: hidden; font-family: var(--font, "IBM Plex Sans", system-ui, sans-serif); color: var(--graphite-ink, #C3CDCF); font-size: 12px; line-height: 1.35; -webkit-user-select: none; user-select: none; }
.v3-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; cursor: grab; }
.v3-canvas:active { cursor: grabbing; }
.v3-panel { background: rgba(20, 29, 34, .80); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid rgba(195, 205, 207, .13); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); }
.v3-root button { font: inherit; color: inherit; }

/* ---- bilah alat kiri atas ----------------------------------- */
.v3-tl { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: max-content; max-width: calc(100% - 330px); z-index: 2; }
.v3-seg { display: inline-flex; padding: 3px; gap: 2px; }
.v3-seg button { appearance: none; border: 0; background: transparent; color: var(--graphite-ink, #C3CDCF); font-size: 12px; font-weight: 500; line-height: 1; padding: 6px 10px; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.v3-seg button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.v3-seg button.on { background: var(--accent, #E5A50A); color: var(--graphite, #1F2A30); font-weight: 600; }
.v3-seg button:focus-visible, .v3-tog:focus-visible, .v3-ib:focus-visible, .v3-card-btn:focus-visible, .v3-sel:focus-visible { outline: 2px solid var(--accent, #E5A50A); outline-offset: 1px; }
.v3-ctx { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; flex-wrap: nowrap; }
.v3-sel { appearance: none; -webkit-appearance: none; background: #162026 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23AEBBBF' stroke-width='1.4' fill='none'/%3E%3C/svg%3E") no-repeat right 8px center; color: #E6ECEE; border: 1px solid rgba(195, 205, 207, .2); border-radius: 5px; font: inherit; font-size: 12px; padding: 5px 26px 5px 8px; max-width: 260px; width: auto; cursor: pointer; font-variant-numeric: tabular-nums; }
.v3-sel option { background: #1F2A30; color: #E6ECEE; }
/* transparansi beton (mode Struktur) — tetap tampil di layar sempit */
.v3-trans { display: inline-flex; align-items: center; gap: 7px; color: #AEBBBF; font-size: 11.5px; white-space: nowrap; padding: 0 4px; }
.v3-trans input { width: 116px; accent-color: var(--accent, #E5A50A); margin: 0; cursor: pointer; }
.v3-trans input:disabled { opacity: .4; cursor: default; }
.v3-trans output { min-width: 34px; text-align: right; color: #E6ECEE; font-weight: 600; font-variant-numeric: tabular-nums; }
.v3-narrow .v3-trans input { width: 92px; }
.v3-narrow .v3-trans span { display: none; }
.v3-amp { display: inline-flex; align-items: center; gap: 6px; color: #AEBBBF; font-size: 11.5px; }
.v3-amp input { width: 76px; accent-color: var(--accent, #E5A50A); margin: 0; }
.v3-amp output { min-width: 32px; color: #E6ECEE; font-variant-numeric: tabular-nums; }
.v3-ib { appearance: none; width: 28px; height: 26px; display: inline-grid; place-items: center; border: 1px solid rgba(195, 205, 207, .2); border-radius: 5px; background: #162026; cursor: pointer; color: #E6ECEE; padding: 0; }
.v3-ib svg { width: 13px; height: 13px; }
.v3-ib:hover { border-color: rgba(229, 165, 10, .7); }
.v3-ib.on { color: var(--accent, #E5A50A); }
.v3-muted { color: #8A979B; }

/* ---- kanan atas: arah pandang, lapisan, kartu ---------------- */
.v3-tr { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 2; max-width: calc(100% - 300px); }
.v3-trow { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 6px; }
.v3-togs { display: inline-flex; gap: 2px; padding: 3px; }
.v3-tog { appearance: none; border: 0; background: transparent; color: #AEBBBF; font-size: 11.5px; padding: 5px 8px; border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.v3-tog i { width: 10px; height: 10px; border-radius: 2px; border: 1.4px solid currentColor; display: inline-block; box-sizing: border-box; }
.v3-tog.on { color: #E6ECEE; }
.v3-tog.on i { background: var(--accent, #E5A50A); border-color: var(--accent, #E5A50A); }
.v3-tog:hover { background: rgba(255, 255, 255, .07); }

.v3-card { width: 262px; padding: 10px 12px 11px; color: #DCE4E6; pointer-events: auto; }
.v3-card-h { display: flex; align-items: flex-start; gap: 8px; }
.v3-card-t { flex: 1; font-size: 13px; font-weight: 600; color: #fff; line-height: 1.3; }
.v3-x { appearance: none; border: 0; background: transparent; width: 22px; height: 22px; margin: -3px -5px 0 0; padding: 4px; border-radius: 4px; cursor: pointer; color: #8A979B; flex: none; }
.v3-x svg { width: 14px; height: 14px; display: block; }
.v3-x:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.v3-card-m { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12px; color: #AEBBBF; font-variant-numeric: tabular-nums; }
.v3-card-m b { color: var(--accent, #E5A50A); font-weight: 600; font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; }
.v3-card-r { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.v3-badge { flex: none; min-width: 44px; text-align: center; padding: 3px 7px; border-radius: 5px; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; color: #fff; }
.v3-badge.ok { background: var(--ok, #2E8B57); } .v3-badge.warn { background: var(--warn, #C98A0B); } .v3-badge.bad { background: var(--bad, #C2412D); }
.v3-gov { font-size: 11.5px; color: #C3CDCF; line-height: 1.3; }
.v3-card-d { margin-top: 7px; font-size: 11.5px; color: #AEBBBF; } .v3-card-d b { color: #E4F2FF; font-variant-numeric: tabular-nums; }
.v3-card-btn { appearance: none; margin-top: 10px; width: 100%; border: 0; border-radius: 6px; background: var(--accent, #E5A50A); color: var(--graphite, #1F2A30) !important; font-weight: 600; font-size: 12.5px; padding: 7px 10px; cursor: pointer; }
.v3-card-btn:hover { background: var(--accent-hover, #D19608); }

/* ---- legenda kiri bawah --------------------------------------- */
.v3-legend { position: absolute; left: 10px; bottom: 10px; padding: 8px 11px 9px; min-width: 210px; max-width: min(360px, calc(100% - 120px)); z-index: 2; font-variant-numeric: tabular-nums; }
.v3-legend:empty { display: none; }
.v3-lg-t { font-size: 12px; font-weight: 600; color: #F1F4F5; }
.v3-lg-s { font-size: 11px; color: #8FA0A5; margin-top: 5px; }
.v3-lg-v { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; font-size: 11.5px; color: #AEBBBF; flex-wrap: wrap; }
.v3-lg-v b { color: #fff; font-size: 13px; font-weight: 600; }
.v3-lg-v i { font-style: normal; font-size: 11px; color: #8FA0A5; }
.v3-ramp { height: 8px; border-radius: 2px; margin-top: 7px; }
.v3-ramp-ax { position: relative; height: 14px; font-size: 10.5px; color: #9FB0B5; }
.v3-ramp-ax span { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.v3-ramp-ax span:first-child { transform: none; }
.v3-ramp-ax span:last-child { transform: translateX(-100%); }
.v3-bins, .v3-keys { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; font-size: 11.5px; color: #C3CDCF; }
.v3-bins span, .v3-keys span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.v3-bins b, .v3-keys b { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.v3-bins b.ok, .v3-keys b.ok { background: var(--ok, #2E8B57); } .v3-bins b.warn { background: var(--accent, #E5A50A); } .v3-bins b.bad, .v3-keys b.bad { background: var(--bad, #C2412D); }
.v3-keys b.dot { border-radius: 50%; } .v3-keys b.dot.ok { background: #46C285; } .v3-keys b.dot.bad { background: #E2553F; } .v3-keys b.dot.gov { background: #F2B51C; }
.v3-bins em, .v3-keys em { font-style: normal; color: #fff; font-weight: 600; }
.v3-parts { display: grid; gap: 3px; margin-top: 6px; font-size: 11px; color: #C3CDCF; }
.v3-parts span { display: grid; grid-template-columns: 20px 1fr 44px; align-items: center; gap: 6px; text-align: right; }
.v3-parts em { font-style: normal; color: #8FA0A5; text-align: left; }
.v3-parts s { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; text-decoration: none; }
.v3-parts s i { display: block; height: 100%; background: #78B3E6; border-radius: 3px; }

/* ---- petunjuk & tooltip --------------------------------------- */
.v3-hint { position: absolute; right: 80px; bottom: 12px; font-size: 10.5px; color: rgba(195, 205, 207, .5); pointer-events: none; white-space: nowrap; z-index: 1; }
.v3-tip { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3; background: rgba(12, 18, 21, .94); color: #E6ECEE; font-size: 11.5px; padding: 5px 8px; border-radius: 5px; white-space: nowrap; border: 1px solid rgba(195, 205, 207, .14); font-variant-numeric: tabular-nums; }
.v3-tip b { color: var(--accent, #E5A50A); font-weight: 600; }
.v3-tip .ok { color: #5BBF8A; font-weight: 600; } .v3-tip .warn { color: #F0B93A; font-weight: 600; } .v3-tip .bad { color: #F07A64; font-weight: 600; }

/* ---- ringkas & sempit ----------------------------------------- */
.v3-compact .v3-tl, .v3-compact .v3-togs, .v3-compact .v3-hint { display: none; }
.v3-compact .v3-legend { padding: 6px 9px; min-width: 0; }
.v3-compact .v3-lg-s { display: none; }
.v3-compact .v3-bins { margin-top: 0; }
.v3-compact .v3-lg-t { font-weight: 500; font-size: 11.5px; }
.v3-narrow .v3-hint, .v3-narrow .v3-lg-s, .v3-narrow .v3-parts, .v3-narrow .v3-ramp, .v3-narrow .v3-ramp-ax { display: none; }
.v3-narrow .v3-legend { min-width: 0; }
.v3-narrow .v3-tl { max-width: calc(100% - 20px); }
.v3-narrow .v3-ctx { flex-wrap: wrap; }
.v3-narrow .v3-tr { top: auto; bottom: 10px; right: 10px; max-width: calc(100% - 20px); }
.v3-compact .v3-tr { max-width: calc(100% - 20px); }
.v3-narrow .v3-tr .v3-card { position: absolute; bottom: calc(100% + 6px); right: 0; }
.v3-narrow .v3-togs { display: none; }
.v3-narrow .v3-legend { bottom: 52px; }
.v3-narrow .v3-seg button { padding: 6px 8px; }

/* ---- permukaan P–M -------------------------------------------- */
.v3-pm-head { position: absolute; top: 10px; left: 10px; padding: 8px 11px 9px; max-width: calc(100% - 20px); z-index: 2; }
.v3-pm .v3-hint { right: 12px; }

/* ---- cadangan tanpa WebGL & kosong ----------------------------- */
.v3-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #F7F9F8; padding: 10px; }
.v3-fallback .v3-svg { width: 100%; height: 100%; max-height: 100%; }
.v3-note { position: absolute; top: 10px; left: 10px; font-size: 12px; color: var(--ink-2, #4A5552); background: rgba(255, 255, 255, .92); border: 1px solid var(--line, #DDE2DF); border-radius: 6px; padding: 5px 9px; }
.v3-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: #AEBBBF; font-size: 13px; }
.v3-svg { width: 100%; height: auto; display: block; }
.v3-svg text { font-variant-numeric: tabular-nums; }

@media print {
  .v3-root .v3-tl, .v3-root .v3-tr, .v3-root .v3-hint, .v3-root .v3-tip { display: none !important; }
  .v3-note { display: none; }
  .v3-fallback { background: none; }
}

/* ---- wadah, layar penuh (sama dengan modul lain) ---------------- */
.viewer-host { position: relative; width: 100%; height: 520px; overflow: hidden; background: #1F2A30; border-radius: 0 0 var(--r, 12px) var(--r, 12px); }
.card.flush > .card-b { padding: 0; }
.v3-bars { margin-top: 4px; gap: 3px 10px; font-family: var(--mono, ui-monospace, monospace); font-size: 11px; }
.v3-bars b { height: 4px; width: 12px; border-radius: 1px; }
@media (max-width: 720px) { .viewer-host { height: 480px; } }
.v3-narrow .v3-amp { display: none; }
.v3-narrow .v3-bars { display: none; }
/* layar penuh */
.v3-fsw { padding: 3px; }
.v3-fsw .v3-fsb { display: inline-grid; place-items: center; padding: 5px 7px; }
.v3-fsw .v3-fsb svg { width: 15px; height: 15px; display: block; }
.v3-fs-only { display: none; }
.v3-isfs .v3-fs-only { display: inline; }
.viewer-host:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.viewer-host:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; }
.viewer-host.v3-fs { position: fixed; inset: 0; z-index: 2000; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
html.v3-fs-lock, html.v3-fs-lock body { overflow: hidden; }
.v3-isfs .v3-legend { max-width: min(420px, calc(100% - 120px)); }
@media print { .viewer-host { display: none; } }

/* ---- tambahan Reinforced Concrete Design ------------------------ */
.v3-cl { font-style: normal; color: #8FA0A5; font-size: 10.5px; margin-left: 4px; white-space: nowrap; }
.v3-lg-sub { margin-top: 2px; }
.v3-lg-v b.ok { color: #5BBF8A; } .v3-lg-v b.warn { color: #F0B93A; } .v3-lg-v b.bad { color: #F07A64; }
.v3-bars span em { font-style: normal; color: #fff; font-weight: 600; }
.v3-pm .v3-tr { top: 10px; right: 10px; }
.viewer-host.pm-host { height: 440px; }
@media (max-width: 720px) { .viewer-host.pm-host { height: 400px; } }
.v3-cap { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.card.flush .v3-cap-note { padding: 8px 14px 12px; margin: 0; }
