/* =====================================================================
   app.css - tema gelap ala aplikasi CAD (mengikuti gambar contoh):
   title bar, toolbar berikon 3D, panel info melayang, sakelar tampilan,
   bilah status simulasi, dok kode/serial/osiloskop.
   ===================================================================== */
@font-face { font-family: 'Inter'; src: url('../vendor/fonts/inter-latin-wght.woff2') format('woff2'); font-weight: 100 900; font-display: block; }
@font-face { font-family: 'JetBrains Mono'; src: url('../vendor/fonts/jetbrains-mono-400.woff2') format('woff2'); font-weight: 400; }
@font-face { font-family: 'JetBrains Mono'; src: url('../vendor/fonts/jetbrains-mono-600.woff2') format('woff2'); font-weight: 600 700; }

:root {
  --bg0: #1c1e21;
  --bg1: #222428;
  --bg2: #2a2d32;
  --bg3: #33363c;
  --bg4: #3d4148;
  --line: #3b3f45;
  --line2: #4a4f57;
  --text: #dfe3e8;
  --text2: #a9afb8;
  --text3: #7d838c;
  --accent: #1e88e5;
  --accent2: #3da5ff;
  --ok: #3ccf6e;
  --warn: #f5a524;
  --bad: #e5484d;
  --close: #c42b2b;
  --mono: 'JetBrains Mono', Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg0); color: var(--text); font: 13px/1.4 Inter, 'Segoe UI', Arial, sans-serif; overflow: hidden; user-select: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: var(--accent2); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #454a52; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

#app { display: grid; grid-template-rows: 34px auto 1fr auto 28px; height: 100vh; }

/* ------------------------------------------------------------ title bar */
#titlebar { display: flex; align-items: center; background: #1b1d20; -webkit-app-region: drag; border-bottom: 1px solid #111315; position: relative; }
#titlebar .logo { width: 42px; height: 34px; display: grid; place-items: center; }
#titlebar .logo svg { width: 22px; height: 22px; }
#titlebar .tb-btn, #titlebar .win-btn { -webkit-app-region: no-drag; border: 0; background: transparent; height: 34px; width: 36px; display: grid; place-items: center; color: #c9ced5; cursor: pointer; }
#titlebar .tb-btn:hover { background: #2c2f34; }
#titlebar .tb-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
#titlebar .tb-btn svg, #titlebar .win-btn svg { width: 17px; height: 17px; }
#titlebar .menu-btn { -webkit-app-region: no-drag; border: 0; background: transparent; height: 26px; padding: 0 10px; margin-left: 6px; border-radius: 5px; color: #c9ced5; cursor: pointer; font-weight: 600; font-size: 12px; }
#titlebar .menu-btn:hover { background: #2c2f34; }
#titlebar .title { position: absolute; left: 50%; transform: translateX(-50%); color: #e3e6ea; font-size: 13px; pointer-events: none; white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
/* tab dokumen (seperti Fusion 360) */
#titlebar .doc-tabs { -webkit-app-region: no-drag; display: flex; align-items: flex-end; gap: 2px; margin-left: 12px; height: 34px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
#titlebar .doc-tab { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 9px; min-width: 64px; max-width: 220px; flex: 0 1 220px; border-radius: 7px 7px 0 0; background: #24272b; color: #a9b0b8; font-size: 12px; cursor: pointer; border: 1px solid #2c3035; border-bottom: 0; user-select: none; }
#titlebar .doc-tab:hover { background: #2a2d32; color: #d7dbe0; }
#titlebar .doc-tab.on { background: #30343a; color: #f0f2f5; box-shadow: inset 0 2px 0 var(--accent); }
#titlebar .doc-tab .dt-ic { width: 14px; height: 14px; flex: none; display: grid; place-items: center; opacity: 0.85; }
#titlebar .doc-tab .dt-ic svg { width: 14px; height: 14px; }
#titlebar .doc-tab .dt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
#titlebar .doc-tab .dt-x { border: 0; background: transparent; color: inherit; width: 18px; height: 18px; flex: none; border-radius: 4px; font-size: 15px; line-height: 16px; padding: 0; cursor: pointer; opacity: 0.55; }
#titlebar .doc-tab .dt-x:hover { background: #4a4f56; opacity: 1; }
#titlebar .dt-add { -webkit-app-region: no-drag; border: 0; background: transparent; color: #c9ced5; width: 26px; height: 26px; flex: none; border-radius: 6px; font-size: 18px; line-height: 24px; padding: 0; cursor: pointer; align-self: center; margin-left: 2px; }
#titlebar .dt-add:hover { background: #2c2f34; }
#titlebar .spacer { flex: 1; }
#titlebar .win-btn { width: 46px; }
#titlebar .win-btn:hover { background: #2f3237; }
#titlebar .win-btn.close:hover { background: #c42b2b; color: #fff; }

/* ------------------------------------------------------------ toolbar */
#toolbar { display: flex; align-items: stretch; background: linear-gradient(#2e3136, #2a2d31); border-bottom: 1px solid #16181a; height: 92px; padding: 0 6px; overflow-x: auto; overflow-y: hidden; }
.tgroup { display: flex; flex-direction: column; align-items: center; padding: 6px 8px 4px; position: relative; flex-shrink: 0; }
.tgroup + .tgroup::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 1px; background: #40444a; }
.tgroup .items { display: flex; gap: 4px; align-items: center; height: 62px; }
.tgroup .glabel { font-size: 10.5px; letter-spacing: 0.06em; color: #9da3ab; font-weight: 600; display: flex; align-items: center; gap: 4px; cursor: default; white-space: nowrap; height: 18px; }
.tgroup .glabel.menu { cursor: pointer; border-radius: 4px; padding: 0 5px; }
.tgroup .glabel.menu:hover { background: #3a3e44; color: #e3e6ea; }
.tgroup .glabel .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.titem { width: 58px; height: 58px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; position: relative; border: 1px solid transparent; background: transparent; padding: 0; }
.titem:hover { background: #3a3e44; border-color: #4a4f57; }
.titem.active { background: #2b4560; border-color: #3d7ac0; }
.titem img { width: 54px; height: 54px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.titem.tool { width: 34px; height: 30px; }
#toolbar.compact .titem:not(.tool) { width: 48px; height: 48px; }
#toolbar.compact .titem img { width: 44px; height: 44px; }
#toolbar.compact .tgroup { padding: 6px 5px 4px; }
.titem.tool svg { width: 20px; height: 20px; color: #e5e8ec; }
.tools-grid { display: grid; grid-template-columns: 34px 34px; gap: 2px; }

/* menu tarik-turun komponen */
.part-menu { position: fixed; z-index: 60; background: #26292d; border: 1px solid #44484f; border-radius: 8px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); padding: 8px; max-height: calc(100vh - 160px); overflow-y: auto; width: 456px; }
.part-menu h4 { margin: 8px 6px 4px; font-size: 10.5px; letter-spacing: 0.08em; color: #8f959e; text-transform: uppercase; font-weight: 700; }
.part-menu .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.part-menu .pm-item { border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; padding: 4px 2px 5px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.part-menu .pm-item:hover { background: #343840; border-color: #4a4f57; }
.part-menu .pm-item img { width: 64px; height: 56px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.part-menu .pm-item span { font-size: 10.5px; color: #cfd4da; text-align: center; line-height: 1.15; max-width: 98px; }
.part-menu .search { width: 100%; background: #1c1e21; border: 1px solid #3f444b; border-radius: 6px; padding: 7px 10px; outline: none; margin-bottom: 4px; }

/* ------------------------------------------------------------ stage */
#stage { position: relative; overflow: hidden; min-height: 0; }
#viewport { position: absolute; inset: 0; }
#viewport canvas { display: block; outline: none; }

.panel { position: absolute; background: #26282c; border: 1px solid #3a3d42; border-radius: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; }
#leftPanel { left: 10px; top: 10px; width: 322px; max-height: calc(100% - 20px); z-index: 10; }
#leftPanel.hidden { display: none; }
#leftPanel.collapsed .pbody { display: none; }
.phead { display: flex; align-items: center; gap: 6px; padding: 0 0 0 10px; height: 30px; background: #1f2124; border-bottom: 1px solid #36393e; border-radius: 4px 4px 0 0; flex-shrink: 0; }
.phead .ptitle { flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }   /* v1.2.20: nama panjang dibungkus, tidak terpotong */
.phead button { width: 26px; height: 26px; border: 0; background: transparent; cursor: pointer; color: #c9ced5; display: grid; place-items: center; border-radius: 3px; }
.phead button:hover { background: #34373c; }
.phead button.x { background: var(--close); color: #fff; margin-right: 2px; width: 24px; height: 24px; }
.phead button.x:hover { background: #db3a3a; }
.pbody { overflow-y: auto; padding: 10px; }
.pbody p { margin: 8px 0; color: #d1d5db; font-size: 12.5px; line-height: 1.5; }
.pbody b { color: #fff; }
.preview { position: relative; height: 150px; border-radius: 3px; display: grid; place-items: center; margin-bottom: 6px; background: radial-gradient(ellipse at 50% 60%, #34383e, #26282c 70%); }
.preview img { max-width: 100%; max-height: 150px; object-fit: contain; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.5)); }
.btn { border: 1px solid #4a4f57; background: #33373d; color: #e3e6ea; border-radius: 4px; padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: #3b4047; }
.btn.primary { background: var(--accent); border-color: #2a95f0; color: #fff; }
.btn.primary:hover { background: #2a95f0; }
.btn.danger { background: #4a2326; border-color: #7a3337; }
.btn.danger:hover { background: #5c2a2e; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }
.add-btn { position: absolute; right: 2px; top: 2px; padding: 7px 22px; font-size: 13px; }
.sect { margin-top: 12px; }
.sect h5 { margin: 0 0 6px; font-size: 10.5px; letter-spacing: 0.08em; color: #8f959e; text-transform: uppercase; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.kv { display: grid; grid-template-columns: 44% 56%; gap: 0; font-size: 12px; border-top: 1px solid #33363b; }
.kv > div { padding: 4px 4px; border-bottom: 1px solid #33363b; }
.kv > div:nth-child(odd) { color: #9ea4ad; }
.kv > div:nth-child(even) { color: #e8ebef; font-variant-numeric: tabular-nums; }
.ds-list { display: flex; flex-direction: column; gap: 5px; }
.ds-link { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 4px; background: #2e3237; border: 1px solid #40454c; color: #e3e6ea; text-decoration: none; cursor: pointer; font-size: 12px; }
.ds-link:hover { background: #363b42; border-color: #4f78a8; }
.ds-link svg { width: 16px; height: 16px; color: #ff6b5b; flex-shrink: 0; }
.ds-link .sub { color: #8f959e; font-size: 11px; }
.prop { display: grid; grid-template-columns: 38% 62%; align-items: center; gap: 6px; margin: 6px 0; }
.prop label { color: #aab0b8; font-size: 12px; }
.prop input[type=text], .prop select, .prop input[type=number] { width: 100%; background: #1c1e21; border: 1px solid #3f444b; border-radius: 4px; padding: 5px 7px; outline: none; font-size: 12.5px; }
.prop input:focus, .prop select:focus { border-color: var(--accent); }
.prop .range { display: flex; align-items: center; gap: 6px; }
.prop .range input[type=range] { flex: 1; accent-color: var(--accent); }
.prop .range .val { min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; color: #e3e6ea; }
.prop .presets { grid-column: 2; display: flex; flex-wrap: wrap; gap: 3px; }
.prop .presets button { border: 1px solid #3f444b; background: #2a2d31; border-radius: 3px; font-size: 10.5px; padding: 1px 5px; cursor: pointer; color: #c6cbd2; }
.prop .presets button:hover { background: #3a3e44; }
.switch { position: relative; width: 34px; height: 18px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #444950; border-radius: 9px; cursor: pointer; transition: 0.15s; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { left: 18px; }
.readings .kv > div:nth-child(even) { color: #9fe3ff; font-family: var(--mono); font-size: 11.5px; }
.damage { margin-top: 10px; padding: 9px 10px; border-radius: 4px; background: #3a1d1f; border: 1px solid #7a3337; color: #ffb4b0; font-size: 12px; }
.damage b { color: #ffd2cf; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pinout { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 11px; font-family: var(--mono); color: #c9ced5; }
.colors { display: flex; flex-wrap: wrap; gap: 5px; }
.colors button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #2a2d31; cursor: pointer; }
.colors button.on { border-color: #fff; }

/* sakelar tampilan (kanan) */
#viewTools { position: absolute; right: 12px; top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; z-index: 9; }
#viewTools .row { display: flex; gap: 6px; }
#viewTools .row button { width: 30px; height: 30px; border: 0; background: transparent; color: #c9ced5; cursor: pointer; border-radius: 4px; display: grid; place-items: center; }
#viewTools .row button:hover { background: rgba(255, 255, 255, 0.08); }
#viewTools .row button svg { width: 20px; height: 20px; }
#gizmo { width: 74px; height: 74px; cursor: pointer; }
#viewToggles { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; padding: 8px 10px; background: rgba(30, 32, 36, 0.82); border: 1px solid #3a3d42; border-radius: 6px; backdrop-filter: blur(4px); white-space: nowrap; }
.vt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: #dfe3e8; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.vt input { appearance: none; width: 17px; height: 17px; border-radius: 3px; background: rgba(60, 64, 70, 0.9); border: 1px solid #50555c; margin: 0; cursor: pointer; display: grid; place-items: center; }
.vt input:checked { background: var(--accent); border-color: #3da5ff; }
.vt input:checked::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }

#legend { position: absolute; right: 14px; bottom: 14px; background: rgba(30, 32, 36, 0.92); border: 1px solid #3a3d42; border-radius: 4px; padding: 8px 10px; font-size: 11px; z-index: 8; display: none; }
#legend .bar { width: 160px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, #2959f2, #1accda, #59e640, #ffcc1a, #ff3826); margin: 5px 0 2px; }
#legend .ends { display: flex; justify-content: space-between; color: #b8bec6; font-family: var(--mono); }
#legendCur { position: absolute; right: 14px; bottom: 14px; background: rgba(30, 32, 36, 0.92); border: 1px solid #3a3d42; border-radius: 4px; padding: 8px 10px; font-size: 11px; z-index: 8; display: none; }
#legendCur .bar { width: 200px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, #fff24d, #ff8a1a, #ff2e38); margin: 5px 0 2px; }
#legendCur .ends { display: flex; justify-content: space-between; color: #b8bec6; font-family: var(--mono); }

#tooltip { position: absolute; pointer-events: none; z-index: 40; background: rgba(24, 26, 29, 0.95); border: 1px solid #454a51; border-radius: 4px; padding: 6px 9px; font-size: 12px; min-width: 150px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); display: none; }
#tooltip .tt-title { font-weight: 700; margin-bottom: 3px; color: #fff; }
#tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; color: #aeb4bc; }
#tooltip .tt-row b { color: #9fe3ff; font-family: var(--mono); font-weight: 600; }
#tooltip .tt-hint { margin-top: 4px; color: #7fb6ea; font-size: 11px; }

#hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgba(24, 26, 29, 0.9); border: 1px solid #3f444b; padding: 6px 12px; border-radius: 16px; font-size: 12px; color: #d1d5db; z-index: 9; display: none; white-space: nowrap; }
#hint kbd { background: #3a3e45; border: 1px solid #50555d; border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; font-family: var(--mono); font-size: 11px; color: #fff; }

#toasts { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 50; pointer-events: none; }
.toast { background: #2a2d32; border: 1px solid #4a4f57; border-left: 4px solid var(--accent); border-radius: 5px; padding: 8px 12px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); max-width: 560px; pointer-events: auto; animation: tin 0.18s ease-out; }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast.ok { border-left-color: var(--ok); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

.ctx-menu { position: fixed; z-index: 70; background: #26292d; border: 1px solid #44484f; border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); padding: 4px; min-width: 190px; }
.ctx-menu button { display: flex; width: 100%; border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 4px; cursor: pointer; font-size: 12.5px; gap: 10px; align-items: center; }
.ctx-menu button:hover { background: #3a3e44; }
.ctx-menu button .k { margin-left: auto; color: #8f959e; font-size: 11px; }
.ctx-menu hr { border: 0; border-top: 1px solid #3a3d42; margin: 4px 2px; }

/* ------------------------------------------------------------ dok bawah */
#dock { background: #1f2124; border-top: 1px solid #111315; display: flex; flex-direction: column; height: 280px; min-height: 120px; position: relative; overflow: hidden; }
#dock.collapsed { height: 31px !important; min-height: 31px; }
#dock .resizer { position: absolute; top: -3px; left: 0; right: 0; height: 6px; cursor: ns-resize; z-index: 5; }
.dtabs { display: flex; align-items: center; height: 30px; background: #1b1d20; border-bottom: 1px solid #2c2f34; padding-left: 4px; gap: 2px; flex-shrink: 0; }
.dtab { border: 0; background: transparent; height: 30px; padding: 0 14px; cursor: pointer; color: #9da3ab; font-weight: 600; font-size: 12px; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px; }
.dtab.on { color: #fff; border-bottom-color: var(--accent); background: #24272b; }
.dtab .badge { background: var(--bad); color: #fff; border-radius: 8px; font-size: 10px; padding: 0 5px; }
.dtabs .spacer { flex: 1; }
.dtabs .dctl { border: 0; background: transparent; color: #aab0b8; height: 30px; padding: 0 10px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.dtabs .dctl:hover { color: #fff; }
.dbody { flex: 1; min-height: 0; display: none; }
.dbody.on { display: flex; }
.code-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.code-bar { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: #24272b; border-bottom: 1px solid #2f3237; flex-shrink: 0; }
.code-bar select { background: #1c1e21; border: 1px solid #3f444b; border-radius: 4px; padding: 4px 6px; font-size: 12px; }
.code-bar .status { margin-left: auto; font-size: 12px; color: #9da3ab; display: flex; align-items: center; gap: 6px; }
.code-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: #666; }
.code-bar .dot.running { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.code-bar .dot.error { background: var(--bad); }
.code-bar .dot.ready { background: var(--accent2); }
.CodeMirror { flex: 1; height: auto !important; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.cm-host { flex: 1; min-height: 0; display: flex; }
.cm-host .CodeMirror { height: 100% !important; width: 100%; }
.CodeMirror .err-line { background: rgba(229, 72, 77, 0.18); }
/* v1.2.11: kemunculan kata yang sama (seperti VS Code / Arduino IDE 2) */
.CodeMirror .cm-same-word { background: rgba(120, 170, 255, 0.22); outline: 1px solid rgba(140, 185, 255, 0.55); border-radius: 2px; font-weight: 700; text-shadow: 0 0 0.6px currentColor; }
.code-bar .match-info { font-size: 11.5px; color: #8fb4ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; font-family: 'JetBrains Mono', monospace; }
body.light .CodeMirror .cm-same-word { background: rgba(40, 110, 230, 0.16); outline-color: rgba(40, 110, 230, 0.45); }
body.light .code-bar .match-info { color: #2a62c9; }
.serial { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.serial pre { flex: 1; margin: 0; padding: 8px 10px; overflow-y: auto; font-family: var(--mono); font-size: 12.5px; color: #d6dbe1; white-space: pre-wrap; word-break: break-all; user-select: text; background: #17191b; }
.serial pre .err { color: #ff8a84; }
.serial pre .warn { color: #f5c26b; }
.serial pre .sys { color: #7fb6ea; }
.serial .sin { display: flex; gap: 6px; padding: 5px 8px; background: #24272b; border-top: 1px solid #2f3237; }
.serial .sin input { flex: 1; background: #1c1e21; border: 1px solid #3f444b; border-radius: 4px; padding: 5px 8px; outline: none; font-family: var(--mono); font-size: 12.5px; }
.serial .sin select { background: #1c1e21; border: 1px solid #3f444b; border-radius: 4px; padding: 4px; font-size: 12px; }
.scope-view { flex: 1; display: flex; gap: 10px; padding: 8px; min-width: 0; }
.scope-view canvas { flex: 1; min-width: 0; height: 100%; border-radius: 4px; background: #05080b; }
.scope-side { width: 210px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.log-view { flex: 1; overflow-y: auto; padding: 6px 10px; font-size: 12.5px; user-select: text; }
.log-view .ev { padding: 4px 0; border-bottom: 1px solid #2a2d31; display: flex; gap: 8px; }
.log-view .ev .t { color: #7d838c; font-family: var(--mono); font-size: 11px; min-width: 64px; }
.log-view .ev.bad { color: #ffb4b0; }
.log-view .ev.warn { color: #f5c26b; }
.empty { color: #7d838c; padding: 16px; font-size: 12.5px; }

/* ------------------------------------------------------------ status bar */
#statusbar { display: flex; align-items: center; background: #1b1d20; border-top: 1px solid #111315; padding: 0 8px; gap: 2px; font-size: 12px; color: #c4c9d0; }
#statusbar .sb-btn { border: 0; background: transparent; width: 28px; height: 26px; display: grid; place-items: center; cursor: pointer; color: #c9ced5; border-radius: 3px; }
#statusbar .sb-btn:hover { background: #2c2f34; }
#statusbar .sb-btn svg { width: 16px; height: 16px; }
#statusbar .play svg { color: #3ccf6e; }
#statusbar .sb-item { padding: 0 8px; white-space: nowrap; }
#statusbar .sb-item.click { cursor: pointer; border-radius: 3px; }
#statusbar .sb-item.click:hover { background: #2c2f34; }
#statusbar .spacer { flex: 1; }
#statusbar .msg { color: #9da3ab; overflow: hidden; text-overflow: ellipsis; }
#statusbar .msg.bad { color: #ff8a84; }

/* ------------------------------------------------------------ dialog */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 80; display: grid; place-items: center; }
.modal { background: #26292d; border: 1px solid #44484f; border-radius: 8px; width: 560px; max-width: calc(100vw - 40px); max-height: calc(100vh - 80px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.modal .mh { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid #3a3d42; font-weight: 700; font-size: 14px; }
.modal .mh .x { margin-left: auto; border: 0; background: transparent; cursor: pointer; color: #aaa; font-size: 18px; }
.modal .mb { padding: 14px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }   /* v1.2.20: isi panjang (Bantuan) bisa digulir, tidak keluar layar */
.modal .mf { padding: 10px 14px; border-top: 1px solid #3a3d42; display: flex; justify-content: flex-end; gap: 8px; }
/* galeri contoh (v1.2.16) */
.modal.ex-modal { width: 1080px; height: calc(100vh - 80px); }
.ex-wrap { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.ex-top { display: flex; align-items: center; gap: 10px; }
.ex-search { flex: 1; background: #1e2024; border: 1px solid #3f444b; border-radius: 6px; color: #e6e8eb; padding: 8px 10px; font-size: 13px; outline: none; }
.ex-search:focus { border-color: var(--accent); }
.ex-count { color: #8b929b; font-size: 12px; white-space: nowrap; }
.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-chip { border: 1px solid #44484f; background: #2b2e33; color: #c9ced4; border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; }
.ex-chip:hover { border-color: #5d636c; }
.ex-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; }
.ex-card { border: 1px solid #3f444b; border-radius: 9px; cursor: pointer; background: #2b2e33; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s; }
.ex-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35); }
.ex-thumb { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1b1e22, #2c3138); overflow: hidden; }
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s; }
.ex-card:hover .ex-thumb img { transform: scale(1.05); }
.ex-noimg { width: 100%; height: 100%; display: grid; place-items: center; font-size: 42px; opacity: 0.6; }
.ex-cat { position: absolute; left: 8px; top: 8px; color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.ex-open { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 6px; opacity: 0; transition: opacity 0.15s; }
.ex-card:hover .ex-open { opacity: 1; }
.ex-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.ex-body b { font-size: 13px; line-height: 1.3; }
.ex-desc { color: #9da3ab; font-size: 11.5px; line-height: 1.42; }   /* v1.2.20: deskripsi tampil utuh (dulu dipotong 3 baris) */
.ex-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 3px; }
.ex-tag { font-size: 10.5px; color: #c9ced4; background: #363a41; border-radius: 4px; padding: 2px 6px; }
.ex-empty { color: #8b929b; grid-column: 1 / -1; text-align: center; padding: 30px 0; }
.splash { position: fixed; inset: 0; z-index: 100; background: #1c1e21; display: grid; place-items: center; transition: opacity 0.35s; }
.splash .box { text-align: center; }
.splash .box svg { width: 64px; height: 64px; }
.splash h1 { font-size: 22px; margin: 10px 0 2px; letter-spacing: 0.02em; }
.splash p { color: #8f959e; margin: 0 0 16px; }
.splash .bar { width: 240px; height: 4px; background: #33363b; border-radius: 2px; overflow: hidden; margin: 0 auto; }
.splash .bar div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* ---- menu penempatan ✥ ⟳ ✗ ✓ di atas komponen */
.place-gizmo { position: absolute; z-index: 12; display: none; gap: 4px; transform: translate(-50%, -100%); padding: 4px; background: rgba(22, 25, 29, 0.92); border: 1px solid #4a5059; border-radius: 20px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
.place-gizmo.pending { border-color: #ffc53d; }
.place-gizmo button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid #555b63; background: #2c3036; color: #e8ecf0; font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.place-gizmo button:hover { background: #3a4048; }
.place-gizmo .g-move { cursor: move; font-size: 18px; }
.place-gizmo .g-ok { background: #1f8f45; border-color: #2fbf5a; color: #fff; font-weight: 800; }
.place-gizmo .g-ok:hover { background: #26a853; }
.place-gizmo .g-no { background: #9b2a26; border-color: #d33b30; color: #fff; font-weight: 800; }
.place-gizmo .g-no:hover { background: #b8322c; }
.place-gizmo .g-del { font-size: 14px; }
.drag-ghost { position: fixed; width: 64px; height: 64px; pointer-events: none; z-index: 100; transform: translate(-50%, -50%); opacity: 0.85; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
.seg { display: flex; gap: 0; border: 1px solid #454a51; border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; padding: 6px 8px; background: #26292e; color: #c9ced5; border: 0; border-right: 1px solid #3a3e44; cursor: pointer; font-size: 12px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: #2f62c8; color: #fff; }
.colors button.auto { background: conic-gradient(#d33b30 0 33%, #1c1c1e 0 66%, #2f62c8 0); color: #fff; font-size: 10px; font-weight: 800; }

@media (max-width: 1000px) { #titlebar .title { display: none; } }

#statusbar .fps { font-family: var(--mono); color: #7fd59a; margin-left: 10px; }
#statusbar .fps.mid { color: #f0c43a; }
#statusbar .fps.low { color: #ff6b5f; }

/* =====================================================================
   tema TERANG (Pengaturan → Tema tampilan → Terang): body.light
   ===================================================================== */
body.light {
  --bg0: #eef0f3; --bg1: #f6f7f9; --bg2: #ffffff; --bg3: #e9ecf0; --bg4: #dde1e6;
  --line: #d5d9df; --line2: #c3c8cf; --text: #1f2328; --text2: #4b525b; --text3: #6b727c;
  color-scheme: light;
}
body.light ::-webkit-scrollbar-thumb { background: #c2c7ce; background-clip: content-box; border: 2px solid transparent; }
body.light #titlebar { background: #e7e9ec; border-bottom-color: #cfd3d8; }
body.light #titlebar .tb-btn, body.light #titlebar .win-btn, body.light #titlebar .menu-btn { color: #3a4048; }
body.light #titlebar .tb-btn:hover, body.light #titlebar .menu-btn:hover, body.light #titlebar .win-btn:hover { background: #d6dade; }
body.light #titlebar .win-btn.close:hover { background: #c42b2b; color: #fff; }
body.light #titlebar .title { color: #23272c; }
body.light #titlebar .doc-tab { background: #dcdfe3; color: #4b515a; border-color: #cbd0d5; }
body.light #titlebar .doc-tab:hover { background: #e6e8eb; color: #262a30; }
body.light #titlebar .doc-tab.on { background: #f7f8fa; color: #1d2126; }
body.light #titlebar .doc-tab .dt-x:hover, body.light #titlebar .dt-add:hover { background: #cfd3d8; }
body.light #titlebar .dt-add { color: #3a4048; }
body.light #toolbar { background: linear-gradient(#f8f9fa, #eceef1); border-bottom-color: #cfd3d8; }
body.light .tgroup + .tgroup::before { background: #d3d7dc; }
body.light .tgroup .glabel { color: #5b626b; }
body.light .tgroup .glabel.menu:hover { background: #e0e4e9; color: #1f2328; }
body.light .titem:hover { background: #e3e7ec; border-color: #c9ced5; }
body.light .titem.active { background: #d6e6f8; border-color: #6aa5e8; }
body.light .titem img, body.light .part-menu .pm-item img { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22)); }
body.light .titem.tool svg { color: #2c3238; }
body.light .part-menu, body.light .ctx-menu { background: #ffffff; border-color: #cfd3d8; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16); }
body.light .part-menu h4, body.light .sect h5 { color: #6b727c; }
body.light .part-menu .pm-item:hover, body.light .ctx-menu button:hover { background: #eef2f6; border-color: #cfd6de; }
body.light .part-menu .pm-item span { color: #2b3036; }
body.light .part-menu .search { background: #f4f5f7; border-color: #cfd3d8; }
body.light .ctx-menu button .k { color: #6b727c; }
body.light .ctx-menu hr { border-top-color: #e3e6ea; }
body.light .panel { background: #ffffff; border-color: #d3d7dc; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14); }
body.light .phead { background: #f0f2f5; border-bottom-color: #dde1e6; }
body.light .phead button { color: #3a4048; }
body.light .phead button:hover { background: #e2e6ea; }
body.light .phead button.x { background: var(--close); color: #fff; }
body.light .pbody p { color: #33393f; }
body.light .pbody b { color: #111418; }
body.light .preview { background: radial-gradient(ellipse at 50% 60%, #ffffff, #e9ecf0 70%); }
body.light .preview img { filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.22)); }
body.light .btn { border-color: #c6cbd2; background: #f3f5f7; color: #1f2328; }
body.light .btn:hover { background: #e7eaee; }
body.light .btn.primary { background: var(--accent); border-color: #2a95f0; color: #fff; }
body.light .btn.primary:hover { background: #2a95f0; }
body.light .btn.danger { background: #fde8e8; border-color: #e7a3a5; color: #9b1c1f; }
body.light .kv, body.light .kv > div { border-color: #e3e6ea; }
body.light .kv > div:nth-child(odd) { color: #5b626b; }
body.light .kv > div:nth-child(even) { color: #1f2328; }
body.light .readings .kv > div:nth-child(even) { color: #0b6aa8; }
body.light .ds-link { background: #f5f7f9; border-color: #d5dae0; color: #1f2328; }
body.light .ds-link:hover { background: #eaf2fb; border-color: #8fb5e0; }
body.light .ds-link .sub { color: #6b727c; }
body.light .prop label { color: #4b525b; }
body.light .prop input[type=text], body.light .prop select, body.light .prop input[type=number] { background: #ffffff; border-color: #c9ced5; }
body.light .prop .range .val { color: #1f2328; }
body.light .prop .presets button { background: #f3f5f7; border-color: #cfd3d8; color: #3a4048; }
body.light .prop .presets button:hover { background: #e5e9ee; }
body.light .switch span { background: #c3c8cf; }
body.light .switch input:checked + span { background: var(--accent); }
body.light .damage { background: #fdecec; border-color: #e7a3a5; color: #9b1c1f; }
body.light .damage b { color: #7a1012; }
body.light .pinout { color: #3a4048; }
body.light .colors button { border-color: #e3e6ea; }
body.light .colors button.on { border-color: #1f2328; }
body.light #viewTools .row button { color: #2c3238; }
body.light #viewTools .row button:hover { background: rgba(0, 0, 0, 0.06); }
body.light .vt { color: #1f2328; text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9); }
body.light #viewToggles { background: rgba(255, 255, 255, 0.86); border-color: #d0d4da; }
body.light .vt input { background: rgba(255, 255, 255, 0.95); border-color: #b9bfc7; }
body.light .vt input:checked { background: var(--accent); border-color: #3da5ff; }
body.light #legend, body.light #legendCur { background: rgba(255, 255, 255, 0.95); border-color: #d3d7dc; }
body.light #legend .ends, body.light #legendCur .ends { color: #4b525b; }
body.light #tooltip { background: rgba(255, 255, 255, 0.97); border-color: #cfd3d8; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); }
body.light #tooltip .tt-title { color: #111418; }
body.light #tooltip .tt-row { color: #4b525b; }
body.light #tooltip .tt-row b { color: #0b6aa8; }
body.light #tooltip .tt-hint { color: #2f6db5; }
body.light #hint { background: rgba(255, 255, 255, 0.95); border-color: #cfd3d8; color: #33393f; }
body.light #hint kbd { background: #eef0f3; border-color: #c3c8cf; color: #1f2328; }
body.light .toast { background: #ffffff; border-color: #d3d7dc; color: #1f2328; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); }
body.light #dock { background: #f6f7f9; border-top-color: #cfd3d8; }
body.light .dtabs { background: #eceef1; border-bottom-color: #d5d9df; }
body.light .dtab { color: #5b626b; }
body.light .dtab.on { color: #111418; background: #ffffff; }
body.light .dtabs .dctl { color: #4b525b; }
body.light .dtabs .dctl:hover { color: #111418; }
body.light .code-bar, body.light .serial .sin { background: #eef0f3; border-color: #d5d9df; }
body.light .code-bar select, body.light .serial .sin input, body.light .serial .sin select { background: #ffffff; border-color: #c9ced5; }
body.light .code-bar .status { color: #5b626b; }
body.light .serial pre { background: #ffffff; color: #1f2328; }
body.light .serial pre .err, body.light .log-view .ev.bad { color: #c0262d; }
body.light .serial pre .warn, body.light .log-view .ev.warn { color: #9a5d00; }
body.light .serial pre .sys { color: #2f6db5; }
body.light .log-view .ev { border-bottom-color: #e6e9ed; }
body.light .empty { color: #6b727c; }
body.light #statusbar { background: #e7e9ec; border-top-color: #cfd3d8; color: #2c3238; }
body.light #statusbar .sb-btn { color: #2c3238; }
body.light #statusbar .sb-btn:hover, body.light #statusbar .sb-item.click:hover { background: #d6dade; }
body.light #statusbar .play svg { color: #1d9a4a; }
body.light #statusbar .msg { color: #5b626b; }
body.light #statusbar .msg.bad { color: #c0262d; }
body.light #statusbar .fps { color: #1d8a45; }
body.light #statusbar .fps.mid { color: #a67c00; }
body.light #statusbar .fps.low { color: #c0262d; }
body.light .modal-bg { background: rgba(20, 24, 30, 0.25); }
body.light .modal { background: #ffffff; border-color: #cfd3d8; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18); }
body.light .modal .mh { border-bottom-color: #e3e6ea; }
body.light .modal .mh .x { color: #555b63; }
body.light .modal .mf { border-top-color: #e3e6ea; }
body.light .ex-card { background: #f6f7f9; border-color: #d5d9df; }
body.light .ex-card:hover { background: #ffffff; border-color: var(--accent); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12); }
body.light .ex-desc { color: #5b626b; }
body.light .ex-tag { background: #e6e9ed; color: #3a4048; }
body.light .ex-search { background: #ffffff; border-color: #cfd3d8; color: #1f2328; }
body.light .ex-chip { background: #f3f4f6; border-color: #d5d9df; color: #3a4048; }
body.light .ex-chip.on { color: #fff; background: var(--accent); border-color: var(--accent); }
body.light .splash { background: #eef0f3; }
body.light .splash p { color: #6b727c; }
body.light .splash .bar { background: #d5d9df; }
body.light .place-gizmo { background: rgba(255, 255, 255, 0.95); border-color: #c3c8cf; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); }
body.light .place-gizmo button:not(.g-ok):not(.g-no) { background: #f3f5f7; border-color: #c3c8cf; color: #1f2328; }
body.light .place-gizmo button:not(.g-ok):not(.g-no):hover { background: #e5e9ee; }
body.light .seg { border-color: #c3c8cf; }
body.light .seg button { background: #f3f5f7; color: #2c3238; border-right-color: #d5d9df; }
body.light .seg button.on { background: #2f62c8; color: #fff; }

/* ---- Pengaturan: grafis & cek hardware */
.modal h4.set-h { margin: 14px 0 6px; font-size: 10.5px; letter-spacing: 0.08em; color: var(--text3); text-transform: uppercase; font-weight: 700; }
.modal h4.set-h:first-child { margin-top: 0; }
.modal .set-note { color: var(--text3); font-size: 11.5px; margin: 2px 0 6px; line-height: 1.45; }
.hw .kv { margin-bottom: 4px; }
.hw .tag { display: inline-block; border-radius: 9px; padding: 0 7px; font-size: 10.5px; font-weight: 700; margin-left: 4px; }
.hw .tag.use { background: #1e88e5; color: #fff; }
.hw .tag.ok { background: #1f8f45; color: #fff; }
.hw .tag.bad { background: #b8322c; color: #fff; }
.hw .hw-warn { margin: 12px 0 6px; padding: 8px 10px; border-radius: 4px; background: rgba(245, 165, 36, 0.14); border: 1px solid rgba(245, 165, 36, 0.5); font-size: 12px; }

/* ---------- layar masuk / lisensi ---------- */
#licGate { position: fixed; inset: 0; z-index: 9000; display: none; align-items: center; justify-content: center; background: rgba(10, 12, 15, 0.72); backdrop-filter: blur(4px); }
#licGate.show { display: flex; }
#licGate .lic-box { width: min(380px, 90vw); padding: 28px 26px 22px; border-radius: 10px; background: var(--bg1); border: 1px solid var(--line2); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); text-align: center; color: var(--text); }
#licGate .lic-title { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
#licGate .lic-msg { font-size: 13px; line-height: 1.5; color: var(--text2); margin-bottom: 18px; overflow-wrap: anywhere; }
#licGate .lic-btn { width: 100%; padding: 10px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; cursor: pointer; }
#licGate .lic-btn:disabled { opacity: 0.55; cursor: default; }
#licGate .lic-alt { margin-top: 10px; background: none; border: 0; color: var(--text3); font-size: 12px; cursor: pointer; text-decoration: underline; }
#licGate .lic-plans { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
#licGate .lic-plans:empty { display: none; }
#licGate .lic-plan { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: baseline; gap: 2px 10px; padding: 11px 14px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg2, rgba(255, 255, 255, 0.04)); color: var(--text); text-align: left; cursor: pointer; }
#licGate .lic-plan:hover:not(:disabled) { border-color: var(--accent); }
#licGate .lic-plan:disabled { opacity: 0.55; cursor: default; }
#licGate .lic-plan-name { font-size: 14px; font-weight: 600; }
#licGate .lic-plan-price { font-size: 14px; font-weight: 600; color: var(--accent); }
#licGate .lic-plan-days { grid-column: 1 / -1; font-size: 12px; color: var(--text3); }
.acct { min-width: min(420px, 80vw); font-size: 13px; }
.acct-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line2); }
.acct-row .k { color: var(--text3); }
.acct-row .v { text-align: right; overflow-wrap: anywhere; }
.acct-plans { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.acct-plans:empty { display: none; }
.acct-sub { color: var(--text2); margin-bottom: 2px; }
.acct-plan { text-align: left; }
/* panduan GPU (versi web) */
.gpu-guide { max-width: 560px; font-size: 13px; line-height: 1.55; }
.gpu-guide p { margin: 6px 0; color: var(--text2); }
.gpu-guide p b, .gpu-guide code { color: var(--text); }
.gpu-guide a { color: var(--accent2); }
.gpu-guide .gg-now { padding: 8px 10px; border-radius: 6px; background: var(--bg2); color: var(--text); }
.gpu-guide .gg-addr { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px; }
.gpu-guide .gg-addr code { flex: 1; padding: 6px 10px; border-radius: 5px; background: var(--bg0); border: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; user-select: all; }
.toast a { color: inherit; text-decoration: underline; pointer-events: auto; }

/* ===================================================== editor ladder PLC (ui/ladderEditor.js) */
.lad-bar .lad-brand { font-size: 11.5px; color: #8fb4ff; white-space: nowrap; }
.lad-main { flex: 1; min-height: 0; display: flex; }
.lad-left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lad-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 8px; background: #212327; border-bottom: 1px solid #2f3237; flex-shrink: 0; }
.lad-pal { display: flex; gap: 2px; flex-wrap: wrap; }
.lad-pal .lp { height: 30px; min-width: 36px; padding: 0 5px; border: 1px solid #3a3e45; background: #2a2d32; color: #d6dae0; border-radius: 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.lad-pal .lp:hover { background: #343840; border-color: #56606c; }
.lad-pal .lp.coilb { color: #ffd38a; }
.lad-pal .lp.dim { opacity: 0.45; }
.lad-pal .lp .lsym { width: 28px; height: 15px; }
.lad-pal .lsym path { stroke: currentColor; stroke-width: 1.8; fill: none; }
.lad-pal .lsym rect.bg { fill: #2a2d32; stroke: none; }
.lad-pal .lsym text { fill: currentColor; font-family: var(--mono); font-weight: 700; }
.lad-bar .btn { white-space: nowrap; }
.lad-bar select { max-width: 260px; }
.lad-pal .lpn { font-size: 8.5px; color: #9da3ab; margin-top: 1px; white-space: nowrap; }
.lad-pal .lpt { font-size: 11px; font-weight: 700; white-space: nowrap; }
.lad-ops { display: flex; gap: 4px; margin-left: auto; }
.lad-rungs { flex: 1; min-height: 0; overflow: auto; padding: 6px 10px 20px; background: #17191c; outline: none; }
.lad-rungs:focus .lc.sel { outline-color: #3da5ff; }
.lad-rung { margin-bottom: 6px; }
.lad-rh { display: flex; align-items: center; gap: 8px; height: 20px; }
.lad-rh .num { font-family: var(--mono); font-size: 11px; color: #7d838c; width: 30px; }
.lad-rung.cur .lad-rh .num { color: #3da5ff; }
.lad-note { flex: 1; background: transparent; border: 0; color: #7fbf8f; font-size: 11.5px; font-style: italic; padding: 0; outline: none; }
.lad-note:focus { border-bottom: 1px solid #3b3f45; }
.lad-body { margin-left: 30px; }
.lad-grid { display: grid; grid-auto-rows: 56px; border-left: 3px solid #8b929b; border-right: 3px solid #8b929b; }
.lc { position: relative; color: #c9ced6; cursor: pointer; outline: 1px dashed transparent; outline-offset: -2px; user-select: none; }
.lc:hover { outline-color: #3b3f45; }
.lc.sel { outline: 2px solid #2b6db0; }
.lc.err { background: rgba(229, 72, 77, 0.18); }
.lc .lsym { position: absolute; left: 0; right: 0; top: 18px; width: 100%; height: 22px; overflow: visible; }
.lc .lsym path { stroke: currentColor; stroke-width: 1.6; fill: none; vector-effect: non-scaling-stroke; }
.lc .lsym rect.bg { fill: #17191c; stroke: none; }
.lc .lsym text { fill: currentColor; stroke: none; font-family: var(--mono); font-weight: 700; }
.lc .addr { position: absolute; top: 2px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 11px; color: #e8ecf1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc .sym { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 9.5px; color: #8fd3a2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc .val { position: absolute; bottom: 12px; right: 3px; font-family: var(--mono); font-size: 9.5px; color: #ffd38a; }
.lc .hint { position: absolute; top: 20px; left: 0; right: 0; text-align: center; color: #4a4f57; font-family: var(--mono); font-size: 12px; }
/* kawat mendatar penuh dari tepi ke tepi sel; simbol (latar = warna kanvas) menutupi bagian tengahnya */
.lc.wired::before { content: ''; position: absolute; left: 0; right: 0; top: 28.2px; border-top: 1.6px solid currentColor; }
.lc .lsym, .lc .lbox { z-index: 1; }
.lc .lbox { background: #17191c; }
.lc .lbox { position: absolute; left: 6px; right: 4px; top: 17px; height: 24px; border: 1.6px solid currentColor; border-radius: 2px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10.5px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.lc .lbox.cmp { right: 6px; }
.lc .lbox.cmp::after { content: ''; position: absolute; }
.lc .vl { position: absolute; left: -1.5px; width: 0; border-left: 2px solid #c9ced6; }
.lc .vl.down { top: 29px; bottom: 0; }
.lc .vl.up { top: 0; height: 29px; }
.lc.on { color: #3ccf6e; }
.lc.on .lsym rect.bg { fill: #1b3526; }
.lc.on .lbox { background: #1b3526; }
.lc .vl.on { border-color: #3ccf6e; }
.lad-end { margin-left: 30px; border-left: 3px solid #8b929b; border-right: 3px solid #8b929b; height: 26px; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; }
.lad-end span { font-family: var(--mono); font-size: 11px; color: #9da3ab; border: 1.5px solid #9da3ab; padding: 0 8px; }
.lad-side { width: 240px; flex-shrink: 0; border-left: 1px solid #2f3237; background: #1f2124; padding: 8px 10px; overflow: auto; font-size: 12px; color: #c9ced6; }
.lad-where { color: #7d838c; font-size: 11px; margin-bottom: 4px; }
.lad-ins { font-family: var(--mono); font-weight: 700; color: #ffd38a; margin-bottom: 6px; }
.lad-f { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 6px; margin: 4px 0; }
.lad-f span { color: #9da3ab; font-size: 11.5px; }
.lad-f input, .lad-f select { min-width: 0; background: #17191c; border: 1px solid #3f444b; border-radius: 4px; padding: 4px 6px; font-size: 12px; color: #e8ecf1; }
.lad-f input.lad-addr { font-family: var(--mono); font-weight: 700; }
.lad-f input.bad { border-color: var(--bad); }
.lad-note2 { color: #7d838c; font-size: 11px; margin: -2px 0 4px 94px; }
.lad-hint { color: #8a9099; line-height: 1.45; }
.lad-errs { margin-top: 8px; padding: 6px; border: 1px solid rgba(229, 72, 77, 0.5); border-radius: 4px; background: rgba(229, 72, 77, 0.08); color: #ffb3b5; }
.lad-errs div { cursor: pointer; margin-top: 2px; }
.lad-warns { margin-top: 6px; color: #f5c46a; font-size: 11px; }
.lad-legend { margin-top: 10px; padding-top: 8px; border-top: 1px solid #2f3237; color: #8a9099; font-size: 11px; line-height: 1.55; }
.lad-legend b { color: #c9ced6; }
.lad-bar .btn.lad-run { color: #7ee08f; border-color: #2f6b3a; }
.lad-bar .btn.lad-run.stop { color: #ffb35a; border-color: #7a5420; }
