.sim-model { width: auto; min-width: 150px; padding: 6px 10px; }
.chip#copChip { color: var(--good); font-weight: 700; }
.sim-workspace { display: grid; grid-template-columns: 290px 1fr; height: calc(100vh - 50px); overflow: hidden; }
.sim-controls { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px; }
.sim-main { overflow-y: auto; padding: 14px 18px; }
.sim-stage { background: #0c1424; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.sim-stage svg { width: 100%; height: auto; display: block; }
.ctrl { margin-bottom: 14px; }
.ctrl label.lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.ctrl label.lbl b { color: var(--accent); font-variant-numeric: tabular-nums; }
.ctrl input[type=range] { width: 100%; accent-color: var(--accent); }
.ctrl .seg { display: flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; }
.ctrl .seg button { flex: 1; background: var(--bg2); color: var(--muted); border: none; padding: 7px; font-size: 12px; cursor: pointer; border-right: 1px solid var(--line); }
.ctrl .seg button:last-child { border-right: none; }
.ctrl .seg button.on { background: var(--accent2); color: #04141f; font-weight: 600; }
.sim-section { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 16px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sim-perf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; }
.pcard .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.pcard .n { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 2px; }
.pcard .n small { font-size: 12px; color: var(--muted); font-weight: 400; }
.pcard.hot .n { color: var(--bad); } .pcard.cold .n { color: var(--cold, #7fd4ff); } .pcard.good .n { color: var(--good); }
.flow { stroke-dasharray: 7 6; animation: flowdash 1s linear infinite; }
@keyframes flowdash { to { stroke-dashoffset: -13; } }
.fanrot { transform-origin: center; animation: fspin 1.4s linear infinite; }
@keyframes fspin { to { transform: rotate(360deg); } }
.pulldown-panel { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.pulldown-panel h3 { font-size: 15px; margin: 0 0 10px; color: var(--accent); }
.pd-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.pd-controls .field { margin: 0; }
.pd-controls input, .pd-controls select { width: 110px; }
.pd-chart { background: #0c1424; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; }
.sensor { font: 700 11px Arial, sans-serif; }
.sensor-tag { font: 700 8px Arial, sans-serif; fill: var(--muted); }
/* scenario toolbar + compare */
.sim-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.sim-name { width: 240px; padding: 7px 10px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 7px; color: var(--text); font-size: 13px; }
.sc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sc-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.sc-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.sc-table td.num, .sc-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sc-table tbody tr:hover { background: rgba(127, 212, 255, .04); }
.sc-table.cmp td.ml { color: var(--muted); }
.sc-table.cmp td.num.best { color: var(--good); font-weight: 700; }
.sc-compare { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; }
.sc-compare h4 { margin: 0 0 8px; color: var(--accent); font-size: 14px; }
.ctrl.varspec { font-size: 11px; color: var(--muted); margin: -8px 0 12px; line-height: 1.4; }
.ctrl.varspec b { color: var(--accent); }

/* ---- tabs ---- */
.sim-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sim-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: 9px 16px; font-size: 13.5px; cursor: pointer; }
.sim-tab:hover { color: var(--text); }
.sim-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.sim-pane { display: none; }
.sim-pane.on { display: block; }

/* ---- electrical single-line ---- */
.elec-head { display: flex; align-items: baseline; gap: 12px; }
.elec-head h3 { margin: 0; color: var(--accent); font-size: 16px; }
.elec-h4 { color: var(--accent); font-size: 14px; margin: 18px 0 10px; }
.sld-wrap { background: #0c1424; border: 1px solid var(--line); border-radius: 10px; padding: 8px; overflow-x: auto; }
.sld { min-width: 880px; height: auto; display: block; }
.eflow { stroke-dasharray: 8 7; animation: eflowdash 1s linear infinite; }
@keyframes eflowdash { to { stroke-dashoffset: -15; } }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.dev-card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; }
.dev-card.incomer { border-color: #36b3ff55; } .dev-card.control { border-color: #38d39f55; }
.dc-tag { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--accent2); }
.dc-name { font-size: 13px; font-weight: 600; color: var(--text); margin: 2px 0 8px; }
.dc-load { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dc-bar { flex: 1; height: 6px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.dc-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #36d3ff, #ff8c42); }
.dc-amp { font-size: 12px; font-weight: 700; color: #36d3ff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dc-amp small { color: var(--muted); font-weight: 400; }
.dc-row { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; padding: 2px 0; border-top: 1px solid var(--line); }
.dc-row span { color: var(--muted); } .dc-row b { color: var(--text); text-align: right; font-weight: 600; }
.dc-row small { color: var(--muted); font-weight: 400; }

/* ---- PLC ---- */
.plc-head { display: flex; align-items: center; justify-content: space-between; }
.plc-head h3 { margin: 0; color: var(--accent); font-size: 15px; }
.plc-mode { border: 1.5px solid; border-radius: 7px; padding: 5px 16px; font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.alarm-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.alarm-bar.ok { color: var(--good); }
.alarm { padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.alarm.trip { background: rgba(255,107,107,.15); color: var(--bad); border: 1px solid var(--bad); }
.alarm.warn { background: rgba(255,187,77,.13); color: var(--warn, #ffbb4d); border: 1px solid #ffbb4d66; }
.hmi { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.hmi-scr { background: #06210f; border: 2px solid #1c5a36; border-radius: 6px; padding: 8px 14px; font-family: 'Courier New', monospace; color: #46f08a; font-size: 13px; line-height: 1.5; min-width: 280px; }
.io-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.io-card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.io-card h5 { margin: 0 0 8px; color: var(--accent2); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.io-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.io-tbl td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.io-tbl td.io-a { color: var(--muted); font-family: 'Courier New', monospace; font-size: 10.5px; white-space: nowrap; }
.io-tbl td.io-v { text-align: right; font-weight: 600; color: var(--text); white-space: nowrap; }
.io-tbl td.io-v.num { color: #36d3ff; font-variant-numeric: tabular-nums; }
.io-tbl td.io-v.bad { color: var(--bad); }
.io-tbl td.io-v small { color: var(--muted); font-weight: 400; }
.io-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.loop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.loop-card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.loop-card h5 { margin: 0 0 6px; color: var(--accent); font-size: 12.5px; }
.loop-card .kv { display: flex; justify-content: space-between; font-size: 11.5px; padding: 2px 0; }
.loop-card .kv .k { color: var(--muted); } .loop-card .kv .v { color: var(--text); font-weight: 600; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.plc-code { background: #0a1322; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-family: 'Courier New', monospace; font-size: 11.5px; line-height: 1.5; color: #b8c7e0; max-height: 460px; overflow: auto; white-space: pre; margin-top: 10px; }
