/* VS Code "Dark+" inspired workbench — 4 switchable themes, set via [data-theme] on <html> (see public/js/theme.js) */
:root, :root[data-theme="dark"] {
  --bg: #1e1e1e; --sidebar: #252526; --activity: #333333; --tabs: #252526; --tab: #2d2d2d;
  --border: #3c3c3c; --text: #cccccc; --muted: #8b8b8b; --hover: #2a2d2e; --select: #37373d;
  --accent: #007acc; --status: #007acc; --danger: #f14c4c; --input: #3c3c3c; --focus: #007fd4;
  --warn: #cca700; --badge-html: #e37933; --badge-css: #519aba; --badge-js: #cbcb41;
  --callout-warn-bg: #3a2f0d; --callout-warn-border: #6b5116; --callout-warn-text: #e6d9a8;
  --callout-info-bg: #0d2a3a; --callout-info-border: #1a4a63; --callout-info-text: #a8d4e6;
}
:root[data-theme="light"] {
  --bg: #ffffff; --sidebar: #f3f3f3; --activity: #ececec; --tabs: #f3f3f3; --tab: #ffffff;
  --border: #e0e0e0; --text: #292929; --muted: #6e6e6e; --hover: #e8e8e8; --select: #d6e4f7;
  --accent: #005fb8; --status: #005fb8; --danger: #cd3131; --input: #eeeeee; --focus: #005fb8;
  --warn: #9a6700; --badge-html: #c1440e; --badge-css: #0f6674; --badge-js: #8a7a00;
  --callout-warn-bg: #fdf3d9; --callout-warn-border: #e3c66b; --callout-warn-text: #5c4813;
  --callout-info-bg: #e6f2fb; --callout-info-border: #a9d0ee; --callout-info-text: #0d3a54;
}
:root[data-theme="solarized-dark"] {
  --bg: #002b36; --sidebar: #073642; --activity: #073642; --tabs: #073642; --tab: #00252e;
  --border: #0a4552; --text: #93a1a1; --muted: #657b83; --hover: #0a4552; --select: #0a4a58;
  --accent: #268bd2; --status: #268bd2; --danger: #dc322f; --input: #073642; --focus: #2aa198;
  --warn: #b58900; --badge-html: #cb4b16; --badge-css: #2aa198; --badge-js: #b58900;
  --callout-warn-bg: #3a2f0d; --callout-warn-border: #6b5116; --callout-warn-text: #e6d9a8;
  --callout-info-bg: #0d2a3a; --callout-info-border: #1a4a63; --callout-info-text: #a8d4e6;
}
:root[data-theme="solarized-light"] {
  --bg: #fdf6e3; --sidebar: #eee8d5; --activity: #eee8d5; --tabs: #eee8d5; --tab: #fdf6e3;
  --border: #d3cbb7; --text: #657b83; --muted: #93a1a1; --hover: #e8e2cf; --select: #ded6bf;
  --accent: #268bd2; --status: #268bd2; --danger: #dc322f; --input: #eee8d5; --focus: #2aa198;
  --warn: #b58900; --badge-html: #cb4b16; --badge-css: #2aa198; --badge-js: #b58900;
  --callout-warn-bg: #f3e7c3; --callout-warn-border: #cfb35c; --callout-warn-text: #4d3f0f;
  --callout-info-bg: #dbe9ee; --callout-info-border: #96bcc9; --callout-info-text: #12333d;
}
*, *::before, *::after { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; overflow: hidden; }
body { font: 13px/1.4 -apple-system, "Segoe UI", system-ui, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 400; }
kbd { background: var(--input); border-radius: 3px; padding: 1px 6px; font-size: 12px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(121,121,121,.4); }
::-webkit-scrollbar-thumb:hover { background: rgba(121,121,121,.7); }
body.dragging { user-select: none; cursor: col-resize; }
body.dragging iframe { pointer-events: none; }
.icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.4em; margin: 4px 0 8px; }

/* A themed note/callout box (e.g. "wallet created", "no key? submit for review") — the background is tuned
   per-theme (see the --callout-* variables above), unlike a hardcoded color, so its text stays readable
   whichever of the 4 themes is active instead of just the dark one this was originally designed for. */
.callout { padding: 8px 10px; margin: 2px 0 8px; border-radius: 2px; border: 1px solid; }
.callout.warn { background: var(--callout-warn-bg); border-color: var(--callout-warn-border); color: var(--callout-warn-text); }
.callout.info { background: var(--callout-info-bg); border-color: var(--callout-info-border); color: var(--callout-info-text); }

/* Buttons & fields (auth + dialogs) */
.btn { border: 1px solid transparent; background: var(--input); color: var(--text); padding: 6px 14px; border-radius: 2px; }
.btn:hover { filter: brightness(1.2); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea { width: 100%; padding: 6px 8px; border: 1px solid transparent; background: var(--input); border-radius: 2px; outline: none; font: inherit; }
/* .field input's width:100% is meant for text/select/textarea fields, but as a descendant selector it also
   catches any <input type="checkbox"> nested inside a .field (or .field-classed form) anywhere in the DOM tree
   below it, stretching a normally tiny checkbox to fill the row and shoving its label far to the right. */
input[type="checkbox"] { width: auto; padding: 0; background: none; border: 0; border-radius: 0; accent-color: var(--accent); }
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); }
.link { color: #3794ff; background: none; border: 0; padding: 0; text-align: left; }
.link:hover { text-decoration: underline; }

/* Auth */
.auth { display: grid; place-items: center; height: 100%; }
.auth form { width: 340px; background: var(--sidebar); padding: 28px; border: 1px solid var(--border); }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth p { margin: 0 0 18px; }
.auth .btn { width: 100%; margin-top: 4px; }
.auth .switch { text-align: center; margin-top: 14px; }

/* Workbench */
.workbench { display: flex; flex-direction: column; height: 100%; }
.main-row { flex: 1; display: flex; min-height: 0; }
.activity-bar { width: 48px; background: var(--activity); display: flex; flex-direction: column; flex: none; }
.activity-bar .grow { flex: 1; }
.activity { height: 48px; border: 0; border-left: 2px solid transparent; background: none; color: var(--muted); display: grid; place-items: center; }
.activity .icon, .activity svg { width: 24px; height: 24px; }
.activity:hover { color: var(--text); }
.activity.on { color: var(--text); border-left-color: var(--text); }
.sidebar { width: 260px; background: var(--sidebar); display: flex; flex-direction: column; flex: none; min-width: 0; }
.preview { width: 40%; background: var(--bg); display: flex; flex-direction: column; flex: none; min-width: 0; }
.docs-pane { width: 380px; }
.props-pane { width: 340px; }
.props-pane .ve-panel { flex: 1; min-height: 0; max-height: none; border-top: 0; padding: 10px 12px; }
.splitter { width: 4px; margin: 0 -2px; z-index: 2; cursor: col-resize; flex: none; background: transparent; }
.splitter:hover, body.dragging .splitter { background: var(--focus); }
.side-title { height: 35px; padding: 0 8px 0 20px; display: flex; align-items: center; justify-content: space-between; font-size: 11px; letter-spacing: .04em; color: var(--muted); flex: none; white-space: nowrap; overflow: hidden; }
.side-title .title { overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; gap: 2px; }
.act { background: none; border: 0; padding: 3px; color: var(--muted); border-radius: 4px; display: grid; place-items: center; }
.act:hover { background: rgba(90,93,94,.31); }
.preview-bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--border); flex: none; overflow: hidden; }
.segmented { display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; flex: none; }
.seg-btn { background: none; border: 0; padding: 2px 10px; color: var(--muted); }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--accent); color: #fff; }
.device-select { min-width: 0; flex: 1; max-width: 220px; background: var(--input); border: 1px solid transparent; padding: 2px 4px; border-radius: 2px; }
.live-btn { display: flex; align-items: center; gap: 5px; background: none; border: 1px solid var(--border); border-radius: 3px; padding: 1px 8px; color: var(--muted); flex: none; }
.live-btn .led { width: 7px; height: 7px; border-radius: 50%; background: #666; }
.live-btn.on { color: var(--text); }
.live-btn.on .led { background: #3fb950; box-shadow: 0 0 5px #3fb950; }
.console { flex: none; border-top: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; max-height: 35%; }
.console-head { display: flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 11px; letter-spacing: .04em; color: var(--muted); cursor: pointer; user-select: none; }
.console-head .act { margin-left: auto; }
.console-head .count { color: var(--muted); }
.console-head .count.bad { color: var(--danger); }
.console .chev { transform: rotate(90deg); }
.console.collapsed .chev { transform: none; }
.console.collapsed .console-list { display: none; }
.console-list { overflow: auto; min-height: 60px; max-height: 180px; font: 12px/1.5 Menlo, Consolas, monospace; }
.log { padding: 1px 10px; border-top: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }
.log.warn { color: var(--warn); background: rgba(204,167,0,.08); }
.log.error { color: var(--danger); background: rgba(241,76,76,.1); }
.readout { margin-left: auto; font-size: 11px; white-space: nowrap; }
.stage { flex: 1; min-height: 0; overflow: hidden; position: relative; background: #fff; }
.stage > .device-screen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; background: #fff; }
.stage.mobile { background: #181818; }
.stage.mobile > .device-screen { border-radius: 28px; box-shadow: 0 0 0 10px #050505, 0 0 0 11px #444, 0 8px 30px rgba(0,0,0,.6); overflow: hidden; }
.device-screen iframe { display: block; border: 0; width: 100%; height: 100%; background: #fff; }

/* Explorer tree */
.tree-scroll { flex: 1; overflow: auto; }
.tree-scroll.drop-root { box-shadow: inset 0 0 0 1px var(--focus); background: rgba(0,127,212,.06); }
.tree { min-height: 100%; padding-bottom: 40px; }
.row { display: flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; cursor: pointer; white-space: nowrap; user-select: none; }
.row:hover { background: var(--hover); }
.row.active { background: var(--select); color: var(--text); }
.row.drop { outline: 1px dashed var(--focus); outline-offset: -1px; background: rgba(0,127,212,.15); }
.row .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.row.hint { color: var(--muted); cursor: default; white-space: normal; height: auto; padding: 8px 20px; }
.row.hint:hover { background: none; }
.chev { transition: transform .1s; }
.chev.open { transform: rotate(90deg); }
.chev-space { width: 16px; flex: none; }
.kind { color: var(--muted); }
.row-btn { display: none; background: none; border: 0; padding: 2px; border-radius: 3px; }
.row:hover .row-btn { display: grid; }
.row-btn:hover { background: rgba(90,93,94,.5); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #d7ba7d; flex: none; }
.badge { flex: none; width: 18px; text-align: center; font: 700 9px/1 Consolas, monospace; }
.badge.html { color: var(--badge-html); }
.badge.css { color: var(--badge-css); }
.badge.js { color: var(--badge-js); }

/* Tabs */
.editor-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tab-row { display: flex; background: var(--tabs); height: 35px; flex: none; }
.tabs { flex: 1; display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 12px; background: var(--tab); color: var(--muted); border-right: 1px solid var(--tabs); cursor: pointer; white-space: nowrap; flex: none; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--bg); color: var(--text); box-shadow: inset 0 1px 0 var(--accent); }
.tab .proj { color: var(--muted); font-size: 11px; }
.tab-close { width: 20px; height: 20px; border: 0; background: none; border-radius: 4px; display: grid; place-items: center; color: inherit; }
.tab-close:hover { background: rgba(90,93,94,.5); }
.tab-close .o { display: none; font-size: 11px; }
.tab-close .x { opacity: 0; }
.tab.active .tab-close .x, .tab:hover .tab-close .x { opacity: 1; }
.tab-close.dirty .x { display: none; }
.tab-close.dirty .o { display: block; }
.tab-close.dirty:hover .x { display: grid; opacity: 1; }
.tab-close.dirty:hover .o { display: none; }
.tab-actions { display: flex; align-items: center; gap: 2px; padding: 0 8px; }

/* Editor & welcome */
.editor-host { flex: 1; position: relative; min-height: 0; }
.welcome { display: none; height: 100%; flex-direction: column; align-items: flex-start; justify-content: center; padding: 0 12%; gap: 10px; }
.editor-host.empty .welcome { display: flex; }
.welcome h1 { font-size: 32px; font-weight: 300; color: var(--text); }
.welcome .lead { color: var(--muted); font-size: 15px; line-height: 1.55; max-width: 620px; margin: 6px 0 4px; }
.welcome-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 18px 0 4px; max-width: 780px; }
.welcome-features .feature h3 { font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.welcome-features .feature p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0; }
@media (max-width: 900px) { .welcome-features { grid-template-columns: 1fr; max-width: 420px; } }
.welcome .links { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 24px; font-size: 14px; }
.keys td { padding: 4px 24px 4px 0; color: var(--muted); }

/* Status bar */
.statusbar { height: 22px; background: var(--status); color: #fff; display: flex; justify-content: space-between; font-size: 12px; flex: none; }
.seg-group { display: flex; }
.seg { padding: 0 10px; display: flex; align-items: center; white-space: nowrap; }
.btn-seg { background: none; border: 0; height: 100%; }
.btn-seg:hover { background: rgba(255,255,255,.18); }

/* Context menu, dialog, toast */
.ctx { position: fixed; z-index: 50; min-width: 200px; background: var(--sidebar); border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,.6); padding: 4px 0; }
.ctx .item { padding: 4px 24px; cursor: pointer; }
.ctx .item:hover { background: var(--select); color: var(--text); }
.ctx .item.danger { color: var(--danger); }
.ctx .sep { height: 1px; background: var(--border); margin: 4px 0; }
dialog { border: 1px solid var(--border); background: var(--sidebar); color: var(--text); padding: 20px; width: 380px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: 0 4px 24px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin-bottom: 14px; font-size: 14px; }
dialog .row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; height: auto; padding: 0; cursor: default; }
dialog .row:hover { background: none; }
/* .row's own :hover background is meant for the file tree's clickable rows — anywhere .row is reused as a plain
   flex wrapper for a group of buttons (search bars, "Copy/Delete" pairs, etc.) that background bleeds across
   the whole row instead of staying on the button actually being hovered. Same fix as dialog .row above, for the
   other place that pattern shows up: a full-page view rather than a <dialog>. */
.storage-page .row:hover, .reg-page .row:hover { background: none; }

/* Send-to-node progress: a small always-on-top dialog nested over the fullscreen send dialog, so what's
   happening is impossible to miss even though it sits over another <dialog> rather than the page itself. */
dialog.progress-modal { width: 280px; padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; outline: none; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.progress-text { font-size: 13px; color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; bottom: 32px; right: 16px; background: var(--sidebar); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 10px 16px; opacity: 0; transform: translateY(10px); transition: .2s; z-index: 60; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
#toast.bad { border-left-color: var(--danger); }

@media (max-width: 800px) { .preview, .splitter { display: none !important; } .sidebar { width: 200px; } }

/* ---- Registry ---- */
.pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.small { font-size: 12px; }
.upd { flex: none; color: #3fb950; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { background: var(--input); border: 0; border-radius: 10px; padding: 1px 8px; font-size: 11px; color: var(--text); }
button.chip:hover { filter: brightness(1.2); }
.chip.on { background: var(--accent); color: #fff; }
.reg-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; }
.reg-controls { display: flex; gap: 6px; padding: 6px 8px; }
.reg-search { flex: 1; min-width: 0; background: var(--input); border: 1px solid transparent; border-radius: 2px; padding: 3px 6px; outline: none; }
.reg-search:focus { border-color: var(--focus); }
.tagbar { padding: 0 8px; }
.reg-list { display: flex; flex-direction: column; }
.reg-card { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.reg-card:hover { background: var(--hover); }
.reg-card.active { background: var(--select); }
.reg-card .top { display: flex; justify-content: space-between; gap: 8px; }
.reg-card .desc { margin-top: 3px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reg-panel > .btn { margin: 8px; }
.reg-page { display: none; position: absolute; inset: 0; z-index: 5; background: var(--bg); overflow: auto; }
.reg-page.open { display: block; }
.reg-msg { padding: 40px; text-align: center; color: var(--muted); }
.reg-detail { padding: 20px 28px; display: flex; flex-direction: column; min-height: 100%; }
.reg-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.reg-head h1 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
.reg-head p { margin: 8px 0 0; max-width: 640px; }
.reg-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.btn.danger { color: var(--danger); }
.reg-body { display: flex; gap: 24px; margin-top: 20px; flex: 1; min-height: 360px; }
.reg-info { width: 260px; flex: none; }
.reg-info h3 { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.reg-file { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.reg-ver { padding: 4px 0; }
.reg-preview { flex: 1; display: flex; flex-direction: column; border: 1px solid var(--border); min-width: 0; }
.reg-stage { flex: 1; background: #fff; display: flex; justify-content: center; min-height: 320px; }
.reg-stage iframe { border: 0; width: 100%; height: 100%; background: #fff; }
.reg-stage.mobile { background: #181818; padding: 16px 0; }
.reg-stage.mobile iframe { width: 390px; max-width: 100%; border-radius: 22px; box-shadow: 0 0 0 8px #050505, 0 0 0 9px #444; }
dialog.wide { width: 460px; }
.radio { display: block; margin-bottom: 8px; }
.radio input { margin-right: 6px; }
.checklist { max-height: 160px; overflow: auto; border: 1px solid var(--border); padding: 4px 8px; }
.checklist label { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.field select { color: inherit; }

/* Public explore page */
.explore { display: flex; flex-direction: column; height: 100%; }
.explore-bar { display: flex; align-items: center; padding: 8px 16px; background: var(--activity); gap: 12px; }
.explore-bar .brand { padding: 0; font-size: 18px; }
.explore-bar .grow { flex: 1; }
.explore-body { flex: 1; display: flex; min-height: 0; }
.explore-side { width: 340px; background: var(--sidebar); display: flex; flex-direction: column; flex: none; }
.explore-page { flex: 1; overflow: auto; min-width: 0; }
@media (max-width: 800px) { .reg-body { flex-direction: column; } .reg-info { width: auto; } .explore-side { width: 200px; } }

.act.txt { display: flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 12px; }

/* ---- Monaco host, console links, assistant ---- */
.monaco-host { position: absolute; inset: 0; }
.editor-host.empty .monaco-host { display: none; }
.log { display: flex; gap: 8px; align-items: baseline; }
.log .msg { flex: 1; min-width: 0; }
.log .src { background: none; border: 0; padding: 0; color: #3794ff; font: inherit; cursor: pointer; white-space: nowrap; }
.log .src:hover { text-decoration: underline; }
.log .src.fix { color: #c586c0; display: none; }
body.assistant-on .log .src.fix { display: inline; }
/* AI Assistant: a docked column like .preview/.docs-pane (see workbench.js, which owns showing/hiding it),
   not a floating widget. */
.assistant-pane { width: 380px; }
.a-head { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.a-head b { flex: none; }
.a-head .muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-msgs { flex: 1; min-height: 0; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.a-intro { padding: 8px; }
.a-msg { padding: 8px 10px; border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
.a-msg.user { background: var(--select); align-self: flex-end; max-width: 90%; }
.a-msg.assistant { background: var(--tab); }
.a-msg.thinking { color: var(--muted); font-style: italic; }
.a-msg.error { color: var(--danger); }
.a-msg p { margin: 0 0 8px; }
.a-code pre { margin: 6px 0; padding: 8px; background: var(--bg); border: 1px solid var(--border); overflow: auto; max-height: 240px; font: 12px/1.5 Menlo, Consolas, monospace; white-space: pre; }
.a-code-file { font: 11.5px Menlo, Consolas, monospace; color: var(--muted); margin-top: 4px; }
.a-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.a-note { flex: none; padding: 4px 10px; }
.a-form { flex: none; display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }
.a-input { flex: 1; resize: none; background: var(--input); border: 1px solid transparent; color: inherit; padding: 6px 8px; font: inherit; outline: none; }
.a-input:focus { border-color: var(--focus); }

/* AI Assistant: history (a list/detail swap in the same slot .a-msgs occupies, same idea as the docs panel). */
.a-history { flex: 1; min-height: 0; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.a-history-back { align-self: flex-start; background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; }
.a-history-back:hover { color: var(--text); }
.a-history-list { display: flex; flex-direction: column; gap: 6px; }
.a-history-item { display: flex; align-items: stretch; gap: 4px; }
.a-history-open { flex: 1; min-width: 0; text-align: left; background: var(--input); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; cursor: pointer; color: var(--text); }
.a-history-item.on .a-history-open { border-color: var(--accent); }
.a-history-open:hover { background: var(--hover); }
.a-history-title { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-history-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.a-history-del { flex: none; background: none; border: 1px solid transparent; color: var(--muted); border-radius: 6px; width: 28px; cursor: pointer; }
.a-history-del:hover { color: var(--danger); border-color: var(--border); }

/* Agentic panel (tool-calling UI) */
.agentic-pane { width: 420px; }
.ag-body { flex: 1; min-height: 0; overflow: auto; padding: 10px; }
.agentic-pane .row:hover { background: none; }
.ag-head { margin: 10px 0 6px; font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.ag-answer { margin: 0; padding: 8px; background: var(--bg); border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; min-height: 60px; }
.ag-visual { margin-top: 8px; border: 1px solid var(--border); background: #fff; }
.ag-frame { display: block; width: 100%; height: 360px; border: 0; }
.ag-trace { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ag-step { border: 1px solid var(--border); border-radius: 4px; background: var(--tab); }
.ag-step > summary { cursor: pointer; list-style: none; padding: 7px 8px; }
.ag-step > summary::-webkit-details-marker { display: none; }
.ag-step-head { font-size: 12.5px; }
.ag-step-body { margin: 0; padding: 8px; border-top: 1px solid var(--border); background: var(--bg); overflow: auto; max-height: 220px; font: 12px/1.5 Menlo, Consolas, monospace; white-space: pre; }

/* ---- Publishing ---- */
.site-dot { flex: none; color: #3fb950; display: inline-flex; }
.site-dot .icon { width: 13px; height: 13px; }
a.seg { color: inherit; text-decoration: none; gap: 4px; }
a.seg:hover { background: rgba(255,255,255,.18); }
.site-seg .icon { width: 13px; height: 13px; }

/* ---- Custom domains ---- */
dialog.xl { width: 720px; max-height: 88vh; overflow: auto; }

/* ---- Full-screen modal ("Send to Node…") — a dialog with too much in it to fit a bounded box comfortably; a
   sticky header (title + close) and footer (status + primary action) bracket a scrollable, sectioned middle. ---- */
dialog.fullscreen { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; overflow: hidden; }
dialog.fullscreen > .modal-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.modal-shell > form, .modal-shell > .modal-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.modal-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 28px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close { flex: none; background: none; border: 0; color: var(--muted); width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; font-size: 16px; line-height: 1; }
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 28px; }
.modal-body .inner { max-width: 680px; margin: 0 auto; }
.modal-foot { flex: none; display: flex; align-items: center; gap: 14px; padding: 14px 28px; border-top: 1px solid var(--border); }
.modal-foot .grow { flex: 1; min-width: 0; }
.form-section { margin: 0 0 32px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 4px; }
.form-section-desc { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.form-row2 { display: flex; gap: 10px; }
.icon-pick { display: flex; align-items: center; gap: 10px; }
.icon-prev { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--tab); border: 1px solid var(--border); flex: none; }
.icon-prev.empty { display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.shot-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.shot-thumb { position: relative; width: 100px; height: 66px; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); flex: none; }
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-thumb button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; line-height: 1; font-size: 12px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; }
.shot-thumb button:hover { background: rgba(0,0,0,.85); }
.shot-grid > button.btn.small { align-self: center; }
.hidden { display: none !important; }
.dom-add { display: flex; gap: 8px; margin: 10px 0 4px; }
.dom-add input { flex: 1; background: var(--input); border: 1px solid transparent; color: inherit; padding: 6px 8px; outline: none; }
.dom-add input:focus { border-color: var(--focus); }
.dom-card { border: 1px solid var(--border); padding: 10px 12px; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.dom-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dom-head .grow { flex: 1; }
.dom-records { width: 100%; border-collapse: collapse; font-size: 12px; }
.dom-records th { text-align: left; color: var(--muted); font-weight: 400; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.dom-records td { padding: 6px; vertical-align: top; border-bottom: 1px solid var(--border); }
.dom-records code { font: 12px Menlo, Consolas, monospace; }
.dom-records .val { word-break: break-all; }
.ok { color: #3fb950; }

/* ---- Visual editor panel ---- */
.ve-panel { flex: none; border-top: 1px solid var(--border); background: var(--bg); max-height: 48%; overflow: auto; padding: 8px 10px; }
.ve-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.ve-head .grow { flex: 1; }
.ve-title { font: 12px Menlo, Consolas, monospace; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-hint { font-size: 12px; padding: 4px 0; }
.ve-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.ve-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ve-field.wide { grid-column: 1 / -1; }
/* Attributes / Styles sections: one row per property, chips for quick adds, a searchable picker */
.ve-rows { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }
.ve-rows:empty { display: none; }
.ve-prop-row { display: grid; grid-template-columns: minmax(70px, 36%) minmax(0, 1fr) 22px; gap: 6px; align-items: center; }
.ve-prop-name { font: 11.5px Menlo, Consolas, monospace; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-val input { width: 100%; min-width: 0; background: var(--input); border: 1px solid transparent; color: inherit; padding: 3px 6px; outline: none; }
.ve-val input:focus { border-color: var(--focus); }
.ve-bool { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ve-x { background: none; border: 0; color: var(--muted); font-size: 15px; line-height: 1; padding: 0; }
.ve-x:hover { color: var(--danger); }
.ve-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.ve-chips:empty { display: none; }
.ve-chip { background: var(--input); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; font-size: 11px; color: var(--text); }
.ve-chip:hover { border-color: var(--accent); }
.ve-pick { grid-column: 1 / -1; position: relative; }
.ve-pick-input { width: 100%; background: var(--input); border: 1px dashed var(--border); color: inherit; padding: 4px 6px; outline: none; }
.ve-pick-input:focus { border-style: solid; border-color: var(--focus); }
.ve-pick-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 240px; overflow: auto; background: var(--sidebar); border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.ve-pick-group { padding: 6px 8px 2px; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ve-pick-item { display: flex; gap: 8px; align-items: baseline; padding: 3px 8px; cursor: pointer; }
.ve-pick-item.on, .ve-pick-item:hover { background: var(--select); }
.ve-pick-name { font: 12px Menlo, Consolas, monospace; white-space: nowrap; }
.ve-pick-desc { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-section { grid-column: 1 / -1; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.ve-section > .ve-field:first-of-type { grid-column: 1 / -1; }
.ve-section-title { grid-column: 1 / -1; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ve-flow-box { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.ve-flow-box .wide, .ve-flow-box .ve-hint { grid-column: 1 / -1; }
.ve-field > span:first-child { font-size: 11px; color: var(--muted); }
.ve-field input[type=text], .ve-field select { width: 100%; min-width: 0; background: var(--input); border: 1px solid transparent; color: inherit; padding: 3px 6px; outline: none; }
.ve-field input:focus, .ve-field select:focus { border-color: var(--focus); }
.ve-color { display: flex; gap: 6px; }
.ve-color input[type=text] { flex: 1; }
.ve-swatch { width: 28px; height: 24px; padding: 0; border: 1px solid var(--border); background: none; cursor: pointer; flex: none; }
.ve-align { display: flex; gap: 2px; }
.ve-align .btn.on { background: var(--accent); }

/* App performance */
dialog.perf-dialog { width: 780px; max-height: 90vh; overflow: auto; }
.perf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.perf-head h3 { margin: 0; }
.perf-head select { background: var(--input); color: inherit; border: 0; padding: 5px 8px; }
.perf-nodes { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.perf-node { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--bg); border: 1px solid var(--border); padding: 10px 12px; color: inherit; }
.perf-node:hover { background: var(--hover); }
.perf-mini { text-align: right; color: var(--muted); }
.perf-dot { width: 9px; height: 9px; border-radius: 50%; background: #666; flex: none; }
.perf-dot.on { background: #3fb950; }
.perf-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 10px 0; }
.perf-tile { background: var(--bg); border: 1px solid var(--border); padding: 10px 12px; }
.perf-value { font-size: 20px; }
.perf-label { color: var(--muted); font-size: 12px; }
.perf-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.perf-cap { margin: 14px 0 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.perf-chart { width: 100%; height: auto; background: var(--bg); border: 1px solid var(--border); }
.perf-table { width: 100%; border-collapse: collapse; }
.perf-table th { text-align: left; color: var(--muted); font-weight: 400; font-size: 12px; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.perf-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.perf-row { display: flex; gap: 6px; align-items: stretch; }
.perf-row .perf-node { flex: 1; min-width: 0; }

/* Beezifi Storage */
.storage-page { display: none; position: absolute; inset: 0; z-index: 5; background: var(--bg); overflow: auto; padding: 20px 28px; }
.storage-page.open { display: block; }
.storage-buckets { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.storage-bucket-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; background: var(--bg); border: 1px solid var(--border); padding: 8px 12px; color: inherit; }
.storage-bucket-row:hover { background: var(--hover); }
.storage-flag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 10px; font-size: 10.5px; background: var(--callout-warn-bg); color: var(--callout-warn-text); border: 1px solid var(--callout-warn-border); }
.storage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 12px 0; }
.storage-card { background: var(--bg); border: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.storage-thumb { width: 100%; height: 100px; object-fit: cover; background: var(--input); border: 1px solid var(--border); }
.storage-thumb.broken { opacity: .3; }
.storage-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-url { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }

/* ---- Theme picker ---- */
.theme-swatches { display: flex; gap: 10px; margin: 4px 0 2px; }
.theme-swatch { width: 56px; text-align: center; background: none; border: 0; padding: 0; color: var(--muted); font-size: 11px; }
.theme-swatch .sw { width: 56px; height: 40px; border-radius: 6px; border: 2px solid var(--border); display: flex; overflow: hidden; margin-bottom: 6px; }
.theme-swatch.on .sw { border-color: var(--accent); }
.theme-swatch.on { color: var(--text); }
.theme-swatch .sw i { flex: 1; }

/* ---------- in-editor documentation panel ---------- */
.doc-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px; }
.doc-search { width: 100%; box-sizing: border-box; margin-bottom: 14px; padding: 7px 10px; background: var(--input); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 12.5px; }
.doc-search:focus { outline: none; border-color: var(--accent); }
.doc-topics { display: flex; flex-direction: column; gap: 8px; }
.doc-topic { text-align: left; background: var(--input); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; cursor: pointer; color: var(--text); transition: border-color .12s ease, background .12s ease; }
.doc-topic:hover { border-color: var(--accent); background: var(--hover); }
.doc-topic-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.doc-topic-blurb { font-size: 12px; color: var(--muted); line-height: 1.4; }
.doc-back { display: block; background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; margin-bottom: 16px; }
.doc-back:hover { color: var(--text); }
.doc-article h2 { font-size: 16px; margin: 0 0 14px; }
.doc-article h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 22px 0 8px; }
.doc-lead { font-size: 13px; line-height: 1.55; margin: 0 0 14px; }
.doc-article p { font-size: 12.5px; line-height: 1.6; margin: 0 0 12px; }
.doc-more { font-size: 12px; margin-top: 4px; }
.doc-more a { color: var(--accent); text-decoration: none; }
.doc-more a:hover { text-decoration: underline; }
.doc-article code { font: 11.5px Menlo, Consolas, monospace; background: var(--input); padding: 1px 4px; border-radius: 3px; }
.doc-code { position: relative; margin: 0 0 14px; padding: 10px 34px 10px 12px; background: var(--input); border: 1px solid var(--border); border-radius: 6px; overflow-x: auto; }
.doc-code code { display: block; font: 12px/1.55 Menlo, Consolas, monospace; background: none; padding: 0; white-space: pre; }
.doc-copy { position: absolute; top: 6px; right: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); font-size: 10.5px; padding: 2px 7px; border-radius: 4px; cursor: pointer; opacity: 0; transition: opacity .12s ease; }
.doc-code:hover .doc-copy { opacity: 1; }
.doc-copy:hover { color: var(--text); border-color: var(--accent); }
.doc-ref { width: 100%; border-collapse: collapse; margin: 0 0 14px; }
.doc-ref td { font-size: 12px; line-height: 1.5; padding: 6px 0; border-top: 1px solid var(--border); vertical-align: top; }
.doc-ref tr:first-child td { border-top: 0; }
.doc-ref td:first-child { width: 42%; padding-right: 12px; font-weight: 500; }

/* ---------- Design projects (public/js/design.js): a Visio-style canvas over the editor ---------- */
.kind.design { color: var(--accent); }
.design-page { display: none; position: absolute; inset: 0; z-index: 5; background: var(--bg); }
.design-page.open { display: flex; }
.dz { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.dz-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; min-height: 35px; border-bottom: 1px solid var(--border); background: var(--tabs); flex-wrap: wrap; }
.dz-title { display: flex; align-items: center; gap: 6px; margin-right: 10px; font-weight: 600; max-width: 240px; min-width: 0; }
.dz-title .icon { color: var(--accent); }
.dz-title-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dz-btn { display: inline-flex; align-items: center; gap: 5px; background: none; border: 1px solid transparent; border-radius: 3px; padding: 3px 6px; color: var(--text); }
.dz-btn:hover:not(:disabled) { background: var(--hover); }
.dz-btn.on { background: var(--select); border-color: var(--accent); }
.dz-btn:disabled { opacity: .35; cursor: default; }
.dz-zoom { min-width: 50px; justify-content: center; font-variant-numeric: tabular-nums; }
.dz-tb-label { color: var(--muted); font-size: 12px; margin: 0 4px 0 2px; }
.dz-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }
.dz-grow { flex: 1; }
.dz-save { margin: 0 4px 0 6px; padding: 4px 14px; }
.dz-body { display: flex; flex: 1; min-height: 0; }

.dz-palette { width: 200px; flex: none; overflow-y: auto; border-right: 1px solid var(--border); background: var(--sidebar); padding-bottom: 12px; }
.dz-pal-head { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 6px; }
.dz-pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 8px; }
.dz-pal-item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px 7px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; cursor: grab; font-size: 11px; line-height: 1.2; text-align: center; color: var(--text); user-select: none; }
.dz-pal-item:hover { border-color: var(--accent); }
.dz-pal-item:active { cursor: grabbing; }
.dz-pal-item svg { width: 36px; height: 28px; overflow: visible; color: var(--muted); }
.dz-pal-hint { color: var(--muted); font-size: 11.5px; margin: 12px 12px 0; }

.dz-canvas { position: relative; flex: 1; min-width: 0; overflow: hidden; outline: none; background: var(--bg); }
.dz-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; touch-action: none; }
.dz-svg [data-role="node"] { cursor: move; }
.dz-svg [data-role="edge"] { cursor: pointer; }
.dz-svg [data-role="port"], .dz-svg [data-role="end"] { cursor: crosshair; }
.dz-svg [data-role="bend"] { cursor: move; }
.dz-canvas.panning, .dz-canvas.panning * { cursor: grab !important; }
/* Design maps: live network status (noc.js) */
.dz-btn.on { background: var(--accent); color: #fff; }
.dz-noc { position: absolute; top: 10px; right: 10px; width: 300px; max-height: calc(100% - 20px); overflow-y: auto; z-index: 5;
  background: var(--sidebar); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); padding: 10px; font-size: 12.5px; }
.dz-noc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dz-noc-head b { flex: 1; font-size: 13px; }
.dz-noc-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.dz-noc-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.dz-noc-pill i, .dz-noc-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.dz-noc-when { margin-bottom: 8px; }
.dz-noc-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.dz-noc-row { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 5px; cursor: pointer; }
.dz-noc-row:hover { background: var(--border); }
.dz-noc-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-noc-row .d { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.dz-noc details { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 6px; }
.dz-noc summary { cursor: pointer; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.dz-noc-set .dz-field { display: block; margin-bottom: 8px; }
.dz-noc-set .dz-field span { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.dz-noc-ev { padding: 2px 0; line-height: 1.4; }
.dz-code-dlg { width: min(820px, 94vw); }
.dz-code-out { max-height: 60vh; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
  font: 12px/1.5 Menlo, Consolas, monospace; white-space: pre; margin: 0 0 12px; }
.dz-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 16px; }
.dz-empty > div { max-width: 360px; text-align: center; color: var(--muted); pointer-events: auto; background: var(--sidebar); border: 1px dashed var(--border); border-radius: 10px; padding: 18px 20px; line-height: 1.5; }
.dz-inline { position: absolute; z-index: 2; resize: none; border: 1px solid var(--accent); background: var(--bg); color: var(--text); font-family: inherit; line-height: 1.25; padding: 6px; outline: none; border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,.35); }

.dz-props { width: 260px; flex: none; overflow-y: auto; border-left: 1px solid var(--border); background: var(--sidebar); padding: 12px; }
.dz-props h4 { margin: 0 0 12px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.dz-conn { margin: -4px 0 12px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.dz-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.dz-field > span { font-size: 11.5px; color: var(--muted); }
.dz-input { width: 100%; min-width: 0; background: var(--input); border: 1px solid transparent; border-radius: 2px; padding: 4px 6px; color: var(--text); font: inherit; outline: none; }
.dz-input:focus { border-color: var(--focus); }
textarea.dz-input { resize: vertical; min-height: 46px; line-height: 1.4; }
.dz-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.dz-seg { display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.dz-seg button { flex: 1; min-width: 0; background: none; border: 0; padding: 4px 2px; color: var(--text); font-size: 12px; }
.dz-seg button + button { border-left: 1px solid var(--border); }
.dz-seg button:hover { background: var(--hover); }
.dz-seg button.on { background: var(--accent); color: #fff; }
.dz-color-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.dz-color { width: 28px; height: 22px; padding: 0; border: 1px solid var(--border); background: none; border-radius: 3px; cursor: pointer; }
.dz-swatch { width: 15px; height: 15px; border-radius: 50%; border: 1px solid rgba(127,127,127,.4); padding: 0; }
.dz-swatch:hover { transform: scale(1.2); }
.dz-mini { background: none; border: 0; color: var(--accent); font-size: 11.5px; padding: 0 0 0 2px; }
.dz-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dz-actions .btn, .dz-align .btn { padding: 4px 10px; font-size: 12px; }
.dz-align { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dz-check { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.dz-tips { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--border); list-style: none; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dz-tips li { margin-bottom: 7px; }
/* Database (ER) diagrams: the table column editor and the SQL import dialog */
.dz-pal-action { cursor: pointer; font: inherit; font-size: 11px; justify-content: center; }
.dz-pal-action .icon { width: 28px; height: 28px; color: var(--accent); }
.dz-pal-action .icon svg { width: 20px; height: 20px; }
.dz-cols { display: flex; flex-direction: column; gap: 6px; }
.dz-col { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 5px; display: flex; flex-direction: column; gap: 5px; }
.dz-col-main { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.dz-col-flags { display: flex; gap: 3px; align-items: center; }
.dz-flag { font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); background: none; color: var(--muted); }
.dz-flag:hover { color: var(--text); }
.dz-flag.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.dz-flag.pk.on { background: #b07d12; border-color: #b07d12; }
.dz-icon-btn { background: none; border: 0; color: var(--muted); padding: 0 4px; font-size: 13px; line-height: 1; }
.dz-icon-btn:hover:not(:disabled) { color: var(--text); }
.dz-icon-btn.danger:hover { color: var(--danger); }
.dz-icon-btn:disabled { opacity: .3; cursor: default; }
.dz-add-col { margin-top: 6px; padding: 4px 10px; font-size: 12px; align-self: flex-start; }
dialog.dz-sql-dialog { width: 680px; }
.dz-sql { min-height: 300px; resize: vertical; font: 12px/1.5 Menlo, Consolas, monospace; white-space: pre; tab-size: 2; }
/* Flow projects: Run/Stop, the Output panel under the canvas, block code dialog, run results in the panel */
.dz-run { display: inline-flex; align-items: center; gap: 5px; padding: 3px 12px; margin-right: 4px; }
.dz-run.primary { background: #238636; }
.dz-center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dz-center .dz-canvas { flex: 1; min-height: 0; }
.dz-output { height: 230px; flex: none; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--sidebar); }
.dz-output.collapsed { height: 30px; }
.dz-output.collapsed .dz-out-list { display: none; }
.dz-out-head { display: flex; align-items: center; gap: 6px; height: 30px; flex: none; padding: 0 8px; cursor: pointer; font-size: 11px; letter-spacing: .06em; color: var(--muted); user-select: none; }
.dz-out-head .chev { transform: rotate(90deg); transition: transform .1s; }
.dz-output.collapsed .dz-out-head .chev { transform: none; }
.dz-out-status { letter-spacing: 0; text-transform: none; font-size: 12px; margin-left: 6px; color: var(--text); }
.dz-out-list { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.dz-out-entry { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 3px; background: var(--bg); padding: 6px 10px; }
.dz-out-entry.display, .dz-out-entry.table { border-left-color: #db61a2; }
.dz-out-entry.log { border-left-color: var(--muted); }
.dz-out-entry.error { border-left-color: var(--danger); }
.dz-out-entry.error .dz-out-text { color: var(--danger); }
.dz-out-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; font-size: 11.5px; }
.dz-out-block { background: none; border: 0; padding: 0; color: var(--accent); font-size: 11.5px; }
.dz-out-block:hover { text-decoration: underline; }
.dz-out-title { font-weight: 600; color: var(--text); }
.dz-out-text { margin: 0; font: 12px/1.45 Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
.dz-out-big { font-size: 20px; font-variant-numeric: tabular-nums; }
.dz-out-table { overflow: auto; max-height: 280px; }
.dz-out-table table { border-collapse: collapse; font-size: 12px; }
.dz-out-table th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); padding: 3px 12px 3px 0; position: sticky; top: 0; background: var(--bg); }
.dz-out-table td { border-bottom: 1px solid var(--border); padding: 3px 12px 3px 0; font-variant-numeric: tabular-nums; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
dialog.dz-code-dialog { width: 860px; max-width: 95vw; }
.dz-code-host { height: 380px; border: 1px solid var(--border); margin-top: 4px; }
.dz-code-host .dz-sql { height: 100%; min-height: 0; border: 0; }
.dz-component-dialog { display: flex; flex-direction: column; width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden; background: var(--bg); color: var(--text); }
.dz-component-dialog::backdrop { background: var(--bg); }
.dz-component-header, .dz-component-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.dz-component-header h3 { margin: 0 0 3px; }
.dz-component-header p { margin: 0; }
.dz-component-close { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; }
.dz-component-close:hover { background: var(--surface); }
.dz-component-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); flex: 1 1 auto; min-height: 0; gap: 0; margin: 0; overflow: hidden; }
.dz-component-code, .dz-component-preview-pane { min-width: 0; min-height: 0; padding: 16px 20px; overflow: auto; }
.dz-component-code { border-right: 1px solid var(--border); background: var(--surface); }
.dz-component-pane-title { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.dz-component-code .dz-field { height: calc(50% - 18px); min-height: 150px; }
.dz-component-code .dz-field > span { color: var(--text); font-weight: 600; }
.dz-component-editor-host { flex: 1; min-height: 0; height: 100%; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; background: #111827; }
.dz-component-editor-host textarea { width: 100%; height: 100%; min-height: 0; resize: none; border: 0; background: #111827; color: #e5e7eb; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.dz-component-preview-pane { background: #eef1f5; }
.dz-component-preview { min-height: calc(100% - 32px); overflow: auto; padding: 28px; border: 1px solid var(--border); background: #fff; color: #1f2933; border-radius: 6px; outline: none; }
.dz-component-preview:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.dz-component-preview .dz-placeholder { display: inline-block; padding: 1px 4px; border-radius: 3px; background: #fff3cd; color: #745b00; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.dz-component-footer { flex: 0 0 auto; justify-content: flex-end; border-top: 1px solid var(--border); border-bottom: 0; }
@media (max-width: 720px) { .dz-component-editor { grid-template-columns: 1fr; overflow: auto; height: auto; } .dz-component-code { border-right: 0; border-bottom: 1px solid var(--border); } .dz-component-code .dz-field { height: 240px; } .dz-component-preview-pane { min-height: 420px; } }
.dz-mono { font: 12px/1.45 Menlo, Consolas, monospace; white-space: pre; }
.dz-swatch-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.dz-run-result { font-size: 12px; padding: 6px 8px; border-radius: 3px; background: var(--bg); border: 1px solid var(--border); overflow-wrap: anywhere; }
.dz-run-result.done { border-color: #2ea043; }
.dz-run-result.error { border-color: var(--danger); color: var(--danger); }
.dz-run-values { margin-top: 4px; color: var(--text); font: 11.5px/1.5 Menlo, Consolas, monospace; }
.dz-out-entry.reply { border-left-color: #e3b341; }
/* Publish Service for a flow: "Use it in your app" */
.dz-usage { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
.dz-usage h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.dz-usage code { font: 11.5px Menlo, Consolas, monospace; background: var(--input); padding: 1px 4px; border-radius: 3px; user-select: all; }
.dz-usage input { flex: 1; background: var(--input); border: 1px solid transparent; border-radius: 2px; padding: 5px 8px; color: var(--text); outline: none; }
.dz-usage input:focus { border-color: var(--focus); }
.dz-usage-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; }
.dz-usage-row .btn { padding: 2px 10px; font-size: 12px; }
.dz-snippet { margin: 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 3px; font: 11.5px/1.5 Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow: auto; }
/* Robot projects: the simulator column, the emergency STOP, live output */
.dz-center-row { flex: 1; min-width: 0; display: flex; }
.dz-sim-split { width: 5px; flex: none; cursor: col-resize; background: var(--border); }
.dz-sim-split:hover { background: var(--focus); }
.dz-sim { width: 420px; flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--sidebar); overflow-y: auto; }
.dz-sim-title { font-size: 11px; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 0; }
.sim { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 12px; }
.sim-head { display: flex; gap: 6px; }
.sim-head select { flex: 1; min-width: 0; background: var(--input); color: var(--text); border: 1px solid transparent; padding: 3px 6px; }
.sim-head select + select { flex: none; width: 64px; }
.sim-head .btn { padding: 3px 10px; }
.sim-canvas { width: 100%; display: block; border-radius: 4px; border: 1px solid var(--border); touch-action: none; cursor: default; }
.sim-cam { position: relative; align-self: flex-start; }
.sim-cam canvas { display: block; width: 192px; height: 144px; border-radius: 4px; border: 1px solid var(--border); image-rendering: auto; }
.sim-cam span { position: absolute; left: 6px; top: 4px; font-size: 10px; color: #fff; background: rgba(0, 0, 0, .45); padding: 0 5px; border-radius: 3px; }
.dz-out-img { display: block; max-width: 100%; border-radius: 4px; border: 1px solid var(--border); }
.sim-readout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; font-size: 12px; }
.sim-readout div { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--border); padding: 2px 0; }
.sim-readout span { color: var(--muted); }
.sim-readout b { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sim-readout div { min-width: 0; }
.sim-readout span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-hint { font-size: 11.5px; color: var(--muted); }
.dz-run.dz-estop { background: #8b1d1d; color: #fff; font-weight: 700; letter-spacing: .04em; }
.dz-run.dz-estop.armed { background: #d32f2f; box-shadow: 0 0 0 2px rgba(211, 47, 47, .35); }
.dz-target { display: flex; align-items: center; gap: 6px; margin-right: 6px; font-size: 12px; color: var(--muted); }
.dz-target select { width: auto; max-width: 180px; padding: 3px 6px; }
.dz-robots { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.dz-robot { border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.dz-robot.on { border-color: var(--accent); }
.dz-robot .btn { padding: 2px 8px; font-size: 11.5px; }
.dz-props h4 + .dz-robots, .dz-props h4 { margin-top: 14px; }
.dz-out-count { margin-left: auto; color: var(--danger); font-variant-numeric: tabular-nums; }
/* Robot projects: Behavior / Hardware tabs and the Hardware view */
.dz-tabs { display: flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; margin-right: 8px; }
.dz-tab { background: none; border: 0; padding: 4px 12px; color: var(--muted); }
.dz-tab + .dz-tab { border-left: 1px solid var(--border); }
.dz-tab.on { background: var(--accent); color: #fff; }
.hw { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px minmax(0, 1fr) 320px; }
.hw h4 { margin: 14px 0 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.hw-left, .hw-right { overflow-y: auto; padding: 0 12px 16px; background: var(--sidebar); }
.hw-left { border-right: 1px solid var(--border); }
.hw-right { border-left: 1px solid var(--border); }
.hw-center { overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hw-small { padding: 3px 10px; font-size: 12px; }
.hw-parts { display: flex; flex-direction: column; gap: 2px; }
.hw-part-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.hw-part-row:hover { background: var(--hover); }
.hw-part-row.on { background: var(--select); }
.hw-dot-c { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.hw-part-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-part-type { color: var(--muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-badge { font-size: 10.5px; font-weight: 700; border-radius: 8px; padding: 0 6px; color: #fff; }
.hw-badge.err { background: var(--danger); }
.hw-badge.warn { background: #b07d12; }
.hw-lib { margin-bottom: 8px; }
.hw-kits { display: flex; flex-direction: column; gap: 4px; }
.hw-kit { text-align: left; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.hw-kit:hover { border-color: var(--accent); }
.hw-kit.on { border-color: var(--accent); background: var(--select); }
.hw-kit b { font-weight: 600; font-size: 12px; }
.hw-kit span { font-size: 11px; color: var(--muted); line-height: 1.35; }
.dz-kit-pick { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; text-align: left; }
.dz-kit-pick span { font-size: 12px; color: var(--muted); }
.dz-kit-pick select { flex: 1; }
.dz-examples { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 6px; }
.dz-examples .btn { font-size: 12px; padding: 5px 10px; }
.hw-lib-group { font-size: 11px; color: var(--muted); margin: 6px 0 4px; }
.hw-lib-item { display: block; width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; margin-bottom: 4px; color: var(--text); font-size: 12px; }
.hw-lib-item:hover { border-color: var(--accent); }
.hw-issues { display: flex; flex-direction: column; gap: 4px; }
.hw-issue { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 4px; font-size: 12.5px; background: var(--sidebar); border-left: 3px solid var(--border); cursor: pointer; }
.hw-issue.error { border-left-color: var(--danger); }
.hw-issue.warning { border-left-color: #d29922; }
.hw-issue.info { border-left-color: var(--accent); }
.hw-issue.ok { border-left-color: #3fb950; cursor: default; }
.hw-issue-icon { font-weight: 700; width: 12px; text-align: center; flex: none; }
.hw-issue.error .hw-issue-icon { color: var(--danger); }
.hw-issue.warning .hw-issue-icon { color: #d29922; }
.hw-issue.ok .hw-issue-icon { color: #3fb950; }
.hw-diagram { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px; overflow: auto; }
.hw-svg { display: block; font: 12px -apple-system, "Segoe UI", system-ui, sans-serif; }
.hw-board { fill: var(--sidebar); stroke: var(--border); }
.hw-board-title, .hw-part-title { fill: var(--text); font-weight: 600; }
.hw-pin { fill: var(--text); font: 11.5px Menlo, Consolas, monospace; }
.hw-muted { fill: var(--muted); font-size: 11px; }
.hw-missing { fill: var(--danger); font-size: 11px; }
.hw-dot { fill: var(--muted); }
.hw-part-box { fill: var(--sidebar); stroke-width: 1.5; }
.hw-part.on .hw-part-box { stroke-width: 3; }
.hw-wire { fill: none; stroke-width: 2; opacity: .85; }
.hw-usb { stroke: var(--muted); stroke-width: 4; stroke-linecap: round; fill: none; }
.hw-usb-label { fill: var(--muted); font-size: 11px; }
.hw-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0 0 8px; }
.hw-board-name { font-weight: 600; margin: 10px 0 4px; }
.hw-pin-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.hw-pin-table td { padding: 2px 6px 2px 0; border-bottom: 1px solid var(--border); color: var(--muted); }
.hw-pin-table td:first-child { font-family: Menlo, Consolas, monospace; color: var(--text); white-space: nowrap; }
.hw-pin-table tr.used td:last-child { color: var(--text); }
option.hw-weak { color: #888; }
.sim-parts { display: flex; flex-direction: column; gap: 4px; }
.sim-parts-title { font-size: 11px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin-top: 4px; }
.sim-part { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sim-part span { flex: 1; color: var(--muted); }
.sim-part b { font-weight: 500; min-width: 54px; text-align: right; font-variant-numeric: tabular-nums; }
.sim-part .btn { padding: 2px 10px; font-size: 12px; }
.sim-part .btn.on { background: var(--accent); color: #fff; }
.sim-part input[type=range] { width: 120px; }
.sim-part.wide { flex-wrap: wrap; }
.sim-part.wide input[type=range] { width: 90px; }
@media (max-width: 1100px) { .dz-props { width: 220px; } .dz-palette { width: 150px; } .dz-pal-grid { grid-template-columns: 1fr; } }

/* Templates page (template-wizard.js templateGallery) */
.tpl-page { display: none; position: absolute; inset: 0; z-index: 6; background: var(--bg); overflow: auto; padding: 24px 28px 48px; }
.tpl-page.open { display: block; }
.tpl-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.tpl-head h1 { font-size: 24px; margin-bottom: 4px; }
.tpl-head p { max-width: 720px; margin: 0; }
.tpl-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 18px 0 14px; }
.tpl-search { flex: 0 1 320px; padding: 7px 10px; background: var(--input); border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.tpl-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-chip { border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 99px; padding: 4px 12px; cursor: pointer; font: inherit; }
.tpl-chip span { margin-left: 6px; color: var(--muted); font-size: 11px; }
.tpl-chip.on { background: var(--select); border-color: var(--accent); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tpl-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--sidebar); color: var(--text); cursor: pointer; font: inherit; }
.tpl-card:hover { background: var(--hover); }
.tpl-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tpl-card strong { font-size: 15px; }
.tpl-sum { color: var(--muted); flex: 1; }
.tpl-meta { color: var(--muted); font-size: 12px; }
.tpl-cat { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; }
.tpl-detail:not(:empty) { margin-top: 20px; padding: 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--sidebar); }
.tpl-detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.tpl-detail-head h2 { font-size: 20px; margin: 2px 0 6px; }
.tpl-detail-head p { margin: 0 0 4px; max-width: 760px; }
.tpl-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 16px; }
.tpl-cols h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.tpl-cols ul { margin: 0; padding-left: 18px; line-height: 1.7; }

/* AI Assistant: flow plan cards (assistant.js flowCard) */
.a-flow p, .a-flow ul, .a-flow ol { margin: 6px 10px; }
.a-flow-blocks { padding-left: 22px; line-height: 1.6; }
.a-flow-private { color: var(--danger); font-size: 11px; font-weight: 600; }

/* Export for iOS / Android (js/mobile-export.js) */
dialog.mx-dialog { width: 600px; }
.mx-intro { margin: -6px 0 14px; font-size: 12px; }
.mx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.mx-grid .field { margin-bottom: 10px; }
.mx-grid .field input[type=color] { height: 30px; padding: 2px; }
.mx-hint { display: block; margin-top: 3px; font-size: 11px; line-height: 1.35; }
.mx-iconrow { display: flex; gap: 16px; align-items: center; margin: 6px 0 10px; }
.mx-icon { width: 80px; height: 80px; flex: none; }
.mx-radio { display: flex; gap: 6px; align-items: center; margin: 4px 0; font-size: 12px; }
.mx-iconrow .btn { margin-top: 6px; }
.mx-notes { margin: 6px 0 0 18px; font-size: 12px; line-height: 1.5; }
.mx-status { min-height: 1.4em; margin-top: 8px; font-size: 12px; }
.mx-status.bad { color: var(--danger); }
@media (max-width: 560px) { .mx-grid { grid-template-columns: 1fr; } }
