/* RM Micro — RM Manifold brand: navy #2a3853, mid-blue #234699, red #b11f33, grays #97999b / #c8c9c7, black #101820. Roboto only. */
:root {
  --navy: #2a3853; --navy-2: #1f2a40; --navy-3: #344566; --blue: #234699; --blue-2: #2f57b8; --blue-soft: #e8edf8;
  --red: #b11f33; --red-soft: #fbe9ec; --gray: #97999b; --gray-2: #c8c9c7; --gray-3: #e6e7e5; --gray-4: #f3f4f2; --black: #101820; --white: #fff;
  --green: #1f8a4c; --green-soft: #e4f4ea; --amber: #b7791f; --amber-soft: #fdf3e1;
  --bg: #f4f5f7; --panel: #ffffff; --line: #e1e3e6; --text: #101820; --muted: #6b6e72;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,32,.06), 0 4px 14px rgba(16,24,32,.06); --shadow-lg: 0 18px 50px rgba(16,24,32,.22);
  --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --top: 52px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Roboto, system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 900; color: var(--navy); letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; font-weight: 700; } h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
code, kbd, .mono { font-family: var(--mono); font-size: 12.5px; }
kbd { background: var(--gray-4); border: 1px solid var(--gray-3); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; } .bold { font-weight: 700; } .right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--white); color: var(--text); font: 500 13.5px Roboto, sans-serif; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; user-select: none; }
.btn:hover { background: var(--gray-4); border-color: var(--gray-2); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: var(--blue-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; } .btn.danger:hover { background: #c82640; }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: rgba(16,24,32,.06); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; } .btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 5px; }
.btn.icon { width: 34px; padding: 0; } .btn.sm.icon { width: 28px; }
.btn .ic { width: 16px; height: 16px; flex: none; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; } .btn.green:hover { background: #24a058; }
.btn.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  font: 400 14px Roboto, sans-serif; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 6px; height: 34px; padding: 0 10px; width: 100%; transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35,70,153,.15); }
input.sm, select.sm { height: 28px; font-size: 13px; padding: 0 8px; }
input.mono { font-family: var(--mono); font-size: 13px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--gray-2); border-radius: 22px; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--green); } .switch input:checked + span::after { transform: translateX(16px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; } .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 800px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

/* ---------- cards, tables, badges */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-b { padding: 16px 18px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--gray-4); position: sticky; top: 0; z-index: 1; }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--gray-3); vertical-align: middle; }
table.t tr:hover td { background: #fafbfc; }
table.t td.c, table.t th.c { text-align: center; }
table.t input, table.t select { height: 30px; font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; font-weight: 500; background: var(--gray-3); color: var(--black); white-space: nowrap; }
.badge.blue { background: var(--blue-soft); color: var(--blue); } .badge.red { background: var(--red-soft); color: var(--red); } .badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); } .badge.navy { background: var(--navy); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-2); display: inline-block; flex: none; }
.dot.on { background: #2ecc71; box-shadow: 0 0 0 3px rgba(46,204,113,.25); } .dot.err { background: var(--red); box-shadow: 0 0 0 3px rgba(177,31,51,.2); } .dot.warn { background: #f0a020; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: var(--gray-2); margin-bottom: 10px; }
.callout { border-left: 3px solid var(--blue); background: var(--blue-soft); padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: 13.5px; line-height: 1.5; }
.callout.warn { border-color: var(--amber); background: var(--amber-soft); } .callout.danger { border-color: var(--red); background: var(--red-soft); }

/* ---------- top bar */
.topbar { height: var(--top); background: var(--navy); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; position: relative; z-index: 20; }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: linear-gradient(90deg, var(--red) 0 120px, var(--blue) 120px 100%); }
.topbar .logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.topbar .logo img { height: 26px; display: block; }
.topbar .logo .app { font-weight: 900; font-size: 16px; letter-spacing: .02em; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.25); }
.topbar .logo .app em { font-style: normal; color: #ff6b7f; }
.topbar nav { display: flex; gap: 2px; margin-left: 8px; }
.topbar nav a { color: #c9d2e3; padding: 7px 12px; border-radius: 6px; font-weight: 500; font-size: 13.5px; }
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.topbar .btn.ghost { color: #dfe5f0; } .topbar .btn.ghost:hover { background: rgba(255,255,255,.1); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; cursor: pointer; border: 2px solid rgba(255,255,255,.25); }
.menu { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; z-index: 100; color: var(--text); }
.menu a, .menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 5px; color: var(--text); background: none; border: 0; font: 400 13.5px Roboto, sans-serif; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--gray-4); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .sub { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); }
.pill-count { background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 9px; padding: 1px 6px; margin-left: 4px; }

/* ---------- pages */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-h p { margin: 4px 0 0; color: var(--muted); }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.proj { padding: 18px; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.proj:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(16,24,32,.12); border-color: var(--gray-2); }
.proj::before { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 40px; transform: rotate(30deg); background: repeating-linear-gradient(90deg, var(--gray-3) 0 10px, transparent 10px 16px, var(--red-soft) 16px 26px, transparent 26px 32px); opacity: .9; }
.proj h3 { font-size: 16px; color: var(--navy); padding-right: 40px; }
.proj p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj .meta { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.proj.new { border: 2px dashed var(--gray-2); box-shadow: none; align-items: center; justify-content: center; color: var(--blue); font-weight: 500; background: transparent; }
.proj.new::before { display: none; } .proj.new:hover { border-color: var(--blue); background: var(--blue-soft); }

/* ---------- login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--navy); position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art::before { content: ''; position: absolute; right: -120px; top: -60px; width: 560px; height: 260px; transform: rotate(-30deg);
  background: repeating-linear-gradient(90deg, rgba(200,201,199,.22) 0 34px, transparent 34px 52px, rgba(177,31,51,.85) 52px 86px, transparent 86px 104px, rgba(255,255,255,.12) 104px 138px, transparent 138px 156px); }
.auth-art img { height: 46px; position: relative; }
.auth-art h1 { color: #fff; font-size: 40px; line-height: 1.08; max-width: 460px; position: relative; }
.auth-art h1 em { font-style: normal; color: #ff7586; }
.auth-art p { color: #c9d2e3; max-width: 440px; font-size: 15px; line-height: 1.55; position: relative; }
.auth-art .chips { display: flex; gap: 8px; flex-wrap: wrap; position: relative; }
.auth-art .chips span { border: 1px solid rgba(255,255,255,.25); padding: 5px 12px; border-radius: 16px; font-size: 12.5px; color: #dfe5f0; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px; background: #fff; }
.auth-form form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.auth-form h2 { font-size: 24px; }
.auth-err { color: var(--red); font-size: 13px; min-height: 18px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { min-height: 220px; padding: 28px; } .auth-art h1 { font-size: 28px; } }

/* ---------- workspace */
.ws { height: calc(100vh - var(--top)); display: grid; grid-template-columns: var(--tree-w, 248px) 1fr var(--side-w, 0px); grid-template-rows: auto 1fr var(--bottom-h, 190px); grid-template-areas: "tool tool tool" "tree main side" "tree bottom side"; }
.ws-tool { grid-area: tool; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); min-height: 50px; }
.ws-tool .pname { font-weight: 900; color: var(--navy); font-size: 16px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-tool .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.ws-tree { grid-area: tree; background: #fff; border-right: 1px solid var(--line); overflow: auto; padding: 8px 0 20px; }
.ws-main { grid-area: main; position: relative; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; min-width: 0; }
.ws-side { grid-area: side; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.ws-bottom { grid-area: bottom; background: #fff; border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tree-sec { padding: 10px 14px 4px; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tree-item { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 18px; cursor: pointer; color: var(--text); font-size: 13.5px; position: relative; user-select: none; }
.tree-item:hover { background: var(--gray-4); text-decoration: none; }
.tree-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
.tree-item.active::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--blue); border-radius: 0 3px 3px 0; }
.tree-item .ic { width: 16px; height: 16px; flex: none; color: var(--muted); }
.tree-item.active .ic { color: var(--blue); }
.tree-item .lang { font-size: 9.5px; font-weight: 700; padding: 1px 4px; border-radius: 3px; background: var(--gray-3); color: var(--muted); letter-spacing: .04em; }
.tree-item .lang.fbd { background: #e9e2f7; color: #5b3fa0; } .tree-item .lang.st { background: var(--blue-soft); color: var(--blue); }
.tree-item .x { margin-left: auto; opacity: 0; } .tree-item:hover .x { opacity: 1; }
.tree-item.err .name { color: var(--red); } .tree-item.off .name { color: var(--gray); text-decoration: line-through; }
.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #fff; align-items: flex-end; min-height: 38px; }
.tab { padding: 9px 12px; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 500; user-select: none; }
.tab:hover { color: var(--text); } .tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab .n { background: var(--gray-3); border-radius: 8px; font-size: 11px; padding: 0 6px; color: var(--muted); } .tab .n.red { background: var(--red); color: #fff; } .tab .n.amber { background: #f0a020; color: #fff; }
.panel-body { flex: 1; overflow: auto; min-height: 0; }
.msg { display: flex; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--gray-3); font-size: 13px; cursor: pointer; align-items: baseline; }
.msg:hover { background: var(--gray-4); }
.msg .where { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.msg.err .ico { color: var(--red); } .msg.warn .ico { color: var(--amber); } .msg.ok .ico { color: var(--green); }
.console { font-family: var(--mono); font-size: 12.5px; padding: 8px 14px; white-space: pre-wrap; word-break: break-all; line-height: 1.5; color: #2b3340; }
.console .l-err { color: var(--red); } .console .l-ok { color: var(--green); } .console .l-info { color: var(--blue); } .console .l-dim { color: var(--gray); }
.resizer-h { height: 5px; cursor: row-resize; background: transparent; margin-top: -3px; position: relative; z-index: 5; }
.resizer-h:hover, .resizer-v:hover { background: rgba(35,70,153,.25); }
.resizer-v { width: 5px; cursor: col-resize; position: absolute; top: 0; bottom: 0; z-index: 5; }
.status-strip { display: flex; align-items: center; gap: 14px; padding: 0 12px; height: 26px; font-size: 12px; color: var(--muted); background: var(--gray-4); border-top: 1px solid var(--line); }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 14px; font-size: 12px; font-weight: 700; }
.mode-pill.sim { background: #e9e2f7; color: #5b3fa0; } .mode-pill.dev { background: var(--green-soft); color: var(--green); } .mode-pill.fault { background: var(--red); color: #fff; } .mode-pill.off { background: var(--gray-3); color: var(--muted); }

/* config pages */
.cfg { padding: 22px 26px 60px; overflow: auto; height: 100%; }
.cfg-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cfg-h p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.cfg section { margin-bottom: 18px; }
.pin { font-family: var(--mono); font-size: 12px; background: var(--gray-4); border: 1px solid var(--gray-3); padding: 1px 6px; border-radius: 4px; }

/* ST editor */
.editor-host { flex: 1; min-height: 0; position: relative; }
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--line); min-height: 42px; }
.editor-bar .t { font-weight: 700; color: var(--navy); }
.st-fallback { width: 100%; height: 100%; border: 0; border-radius: 0; font-family: var(--mono); font-size: 13.5px; padding: 12px; resize: none; }
.cell-live { font-family: var(--mono); font-weight: 500; }
.cell-live.t { color: var(--green); } .cell-live.f { color: var(--gray); }
.watch-row.forced td { background: #fff7e0 !important; }

/* FBD */
.fbd-wrap { flex: 1; display: grid; grid-template-columns: 210px 1fr; min-height: 0; }
.fbd-palette { background: #fff; border-right: 1px solid var(--line); overflow: auto; padding: 8px 0 30px; }
.fbd-palette input { margin: 4px 10px 8px; width: calc(100% - 20px); height: 30px; font-size: 13px; }
.pal-group { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; color: var(--muted); text-transform: uppercase; padding: 10px 12px 4px; }
.pal-item { margin: 2px 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 12.5px; font-weight: 500; cursor: grab; background: #fff; display: flex; align-items: center; gap: 6px; user-select: none; }
.pal-item:hover { border-color: var(--blue); background: var(--blue-soft); }
.pal-item .k { font-size: 9.5px; font-weight: 700; padding: 1px 4px; border-radius: 3px; background: var(--navy); color: #fff; }
.pal-item .k.op { background: var(--blue); } .pal-item .k.fn { background: #5b3fa0; } .pal-item .k.io { background: var(--green); } .pal-item .k.net { background: var(--red); }
.pal-item .d { margin-left: auto; color: var(--gray); font-weight: 400; font-size: 11px; }
.fbd-canvas { position: relative; overflow: hidden; background-color: #fbfcfd; background-image: radial-gradient(circle, #d6d9de 1px, transparent 1px); background-size: 20px 20px; cursor: default; }
.fbd-canvas > svg { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; }
.fbd-canvas.panning { cursor: grabbing; }
.fbd-hud { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 3; }
.fbd-hud .btn { box-shadow: var(--shadow); }
.fbd-props { position: absolute; top: 12px; right: 12px; width: 280px; z-index: 4; max-height: calc(100% - 70px); overflow: auto; }
.fbd-props .card-b { display: flex; flex-direction: column; gap: 10px; }
.blk rect.body { fill: #fff; stroke: #8a9099; stroke-width: 1.2; }
.blk.sel rect.body { stroke: var(--blue); stroke-width: 2.2; filter: drop-shadow(0 0 6px rgba(35,70,153,.35)); }
.blk.err rect.body { stroke: var(--red); stroke-width: 2; }
.blk rect.head { fill: var(--navy); } .blk.op rect.head { fill: var(--blue); } .blk.fn rect.head { fill: #5b3fa0; } .blk.net rect.head { fill: var(--red); }
.blk text { font-family: Roboto, sans-serif; font-size: 11px; fill: var(--black); }
.blk text.title { fill: #fff; font-weight: 700; font-size: 11.5px; } .blk text.inst { font-weight: 700; font-size: 11.5px; fill: var(--navy); }
.blk text.pin { font-size: 10.5px; fill: #444b55; } .blk text.param { font-size: 10px; fill: var(--blue); font-family: var(--mono); }
.blk text.order { font-size: 9.5px; fill: #fff; font-weight: 700; }
.blk circle.order { fill: var(--gray); }
.blk .pt { fill: #fff; stroke: #6b717a; stroke-width: 1.2; cursor: crosshair; }
.blk .pt:hover { fill: var(--blue); stroke: var(--blue); }
.blk .pt.neg { fill: #fff; stroke: var(--red); stroke-width: 1.5; }
.blk.io rect.body { fill: #f1f8f4; stroke: #74b08a; } .blk.io.out rect.body { fill: #fdf2f4; stroke: #d47d8a; } .blk.const rect.body { fill: #f6f3fb; stroke: #9e8ccc; }
.blk text.io { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.blk text.live { font-family: var(--mono); font-size: 10.5px; font-weight: 700; }
.wire { fill: none; stroke: #59606b; stroke-width: 1.6; }
.wire.sel { stroke: var(--blue); stroke-width: 2.6; } .wire.on { stroke: #22b35c; stroke-width: 2.4; } .wire.temp { stroke: var(--blue); stroke-dasharray: 5 4; }
.wire-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.live-tag rect { fill: #101820; opacity: .82; } .live-tag text { fill: #fff; font-family: var(--mono); font-size: 10px; }
.live-tag.t rect { fill: #1f8a4c; opacity: 1; } .live-tag.f rect { fill: #6b717a; }
.sel-box { fill: rgba(35,70,153,.08); stroke: var(--blue); stroke-dasharray: 4 3; }

/* side panel: AI + watch */
.ai-msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.ai-m { max-width: 100%; font-size: 13.5px; line-height: 1.55; }
.ai-m.user { align-self: flex-end; background: var(--blue); color: #fff; padding: 8px 12px; border-radius: 12px 12px 2px 12px; max-width: 88%; white-space: pre-wrap; }
.ai-m.bot { color: var(--text); }
.ai-m.bot p { margin: 0 0 8px; } .ai-m.bot ul, .ai-m.bot ol { margin: 0 0 8px; padding-left: 20px; } .ai-m.bot h1, .ai-m.bot h2, .ai-m.bot h3 { font-size: 14px; margin: 10px 0 6px; }
.ai-m.bot pre { background: #0f1724; color: #e6edf6; border-radius: 6px; padding: 10px 12px; overflow: auto; font-size: 12px; margin: 6px 0 4px; position: relative; }
.ai-m.bot code { background: var(--gray-4); padding: 0 4px; border-radius: 3px; } .ai-m.bot pre code { background: none; padding: 0; }
.ai-m .code-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.ai-input { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.ai-input textarea { min-height: 64px; max-height: 200px; font-size: 13.5px; }
.ai-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-chips .btn { height: 26px; font-size: 12px; border-radius: 13px; }
.typing span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--gray); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* simulator I/O panel */
.io-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 10px 12px; }
.io-tile { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.io-tile .nm { font-weight: 700; font-size: 13px; color: var(--navy); display: flex; align-items: center; gap: 6px; }
.io-tile .kind { font-size: 10.5px; color: var(--muted); }
.lamp { width: 16px; height: 16px; border-radius: 50%; background: #d9dbde; border: 2px solid #c4c7cb; flex: none; }
.lamp.on { background: #2ecc71; border-color: #1f8a4c; box-shadow: 0 0 10px rgba(46,204,113,.8); }
.bar { height: 8px; background: var(--gray-3); border-radius: 4px; overflow: hidden; } .bar > div { height: 100%; background: var(--blue); }
.io-tile input[type=range] { width: 100%; accent-color: var(--blue); }
.push { height: 30px; border-radius: 6px; border: 1px solid var(--line); background: linear-gradient(#fff, #f0f1f2); font-weight: 500; cursor: pointer; font-size: 12.5px; }
.push.down { background: var(--green); color: #fff; border-color: var(--green); }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,32,.45); display: grid; place-items: center; z-index: 200; padding: 20px; animation: fade .12s; }
.modal { background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .14s; }
.modal.wide { max-width: 860px; } .modal.xwide { max-width: 1100px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-b { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 300; align-items: center; }
.toast { background: var(--black); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 560px; display: flex; gap: 10px; align-items: center; animation: pop .15s; }
.toast.err { background: var(--red); } .toast.ok { background: var(--green); }

/* progress */
.progress { height: 6px; background: var(--gray-3); border-radius: 3px; overflow: hidden; } .progress > div { height: 100%; background: var(--blue); transition: width .2s; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spinner.dark { border-color: rgba(16,24,32,.15); border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }

/* manual */
.manual { display: grid; grid-template-columns: 240px 1fr; gap: 28px; }
.manual nav { position: sticky; top: 20px; align-self: start; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 100px); overflow: auto; }
.manual nav a { padding: 6px 10px; border-radius: 5px; color: var(--text); font-size: 13.5px; }
.manual nav a:hover { background: var(--gray-3); text-decoration: none; } .manual nav a.sub { padding-left: 22px; font-size: 12.5px; color: var(--muted); }
.manual article { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 30px 38px 60px; line-height: 1.65; font-size: 14.5px; }
.manual article h2 { font-size: 22px; margin: 34px 0 10px; padding-top: 14px; border-top: 1px solid var(--gray-3); } .manual article h2:first-child { margin-top: 0; border: 0; padding: 0; }
.manual article h3 { font-size: 16px; margin: 22px 0 8px; color: var(--navy); }
.manual article pre { background: #0f1724; color: #e6edf6; padding: 12px 14px; border-radius: 8px; overflow: auto; font-size: 12.5px; line-height: 1.5; }
.manual article table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13.5px; } .manual article th, .manual article td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; } .manual article th { background: var(--gray-4); }
.manual article ol li, .manual article ul li { margin-bottom: 4px; }
.manual .step { display: flex; gap: 14px; margin: 14px 0; } .manual .step .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 13px; }
@media (max-width: 900px) { .manual { grid-template-columns: 1fr; } .manual nav { position: static; } }
@media print { .topbar, .manual nav { display: none; } .manual { display: block; } .manual article { border: 0; padding: 0; } }

/* suggestions */
.sg-item { padding: 14px 16px; border-bottom: 1px solid var(--gray-3); cursor: pointer; display: flex; gap: 12px; }
.sg-item:hover { background: var(--gray-4); } .sg-item.active { background: var(--blue-soft); }
.drop { border: 2px dashed var(--gray-2); border-radius: 8px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.drop.over { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--gray-4); border: 1px solid var(--line); border-radius: 14px; padding: 3px 4px 3px 10px; font-size: 12px; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #cfd3d8; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; } ::-webkit-scrollbar-thumb:hover { background-color: #b3b8bf; }
/* Monaco inline live values */
.live-true { color: #1f8a4c !important; font-weight: 700; font-family: var(--mono); background: #e4f4ea; border-radius: 3px; }
.live-false { color: #6b717a !important; font-family: var(--mono); background: #f0f1f2; border-radius: 3px; }
.live-num { color: #234699 !important; font-family: var(--mono); font-weight: 500; background: #e8edf8; border-radius: 3px; }
svg.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.empty svg.ic { width: 46px; height: 46px; }
.editor-host > .fbd-wrap { flex: 1; min-height: 0; }
.auth-art img { align-self: flex-start; width: auto; }
