/* ── Reset & variables ── */
*{box-sizing:border-box;margin:0;padding:0}
:root{
  --bg-body:#111827;
  --bg-surface:#161e2e;
  --bg-panel:#1a2235;
  --bg-elevated:#1e293b;
  --bg-input:#0d1117;
  --bg-inset:#0f172a;
  --canvas-bg:#0d1117;
  --bg-hover:#1a2640;
  --bg-active:#1a2f4e;
  --bg-accent-subtle:#0d1e3a;
  --bg-accent-strong:#1d3461;
  --bg-accent-active:#1a2a4a;
  --text:#e2e8f0;
  --text-bright:#f1f5f9;
  --text-light:#cbd5e1;
  --text-secondary:#94a3b8;
  --text-muted:#64748b;
  --text-dim:#475569;
  --text-faint:#1e3050;
  --border:#263345;
  --border-light:#1a2535;
  --border-strong:#334155;
  --border-subtle:#1e2d42;
  --border-card:#2d3d52;
  --border-accent:#2d4a6e;
  --accent:#4f8ef7;
  --accent-light:#60a5fa;
  --accent-bright:#7dd3fc;
  --accent-muted:#93c5fd;
  --accent-dark:#2563eb;
  --overlay-bg:rgba(0,0,0,.55);
  --overlay-heavy:rgba(0,0,0,.82);
  --shadow:0 24px 64px rgba(0,0,0,.7);
  --shadow-lg:0 24px 80px rgba(0,0,0,.95);
  --shadow-sm:0 8px 24px rgba(0,0,0,.55);
  --shadow-card:0 4px 24px rgba(0,0,0,.6);
  --hdr-bg:transparent;
  --hdr-border:rgba(0,0,0,.35);
  --edit-bg:rgba(0,0,0,.3);
  --edit-color:rgba(255,255,255,.5);
  --edit-hover-bg:rgba(0,0,0,.55);
  --edit-hover-color:#fff;
  --row-hover:rgba(255,255,255,.03);
  --row-border:rgba(255,255,255,.06);
  --danger:#f87171;
  --danger-dark:#dc2626;
  --danger-light:#fca5a5;
  --danger-bg:#1f0a0a;
  --danger-border:#7f1d1d;
  --danger-hover-bg:#2a1520;
  --success:#22c55e;
  --success-light:#4ade80;
  --success-border:#1a4a2a;
  --success-bg:#0f2d1a;
  --success-bg-hover:#14532d;
  --warn:#fbbf24;
  --warn-light:#fde68a;
  --warn-dark:#f59e0b;
  --warn-bg:#451a03;
  --warn-border:#92400e;
  --purple:#a78bfa;
  --purple-light:#c4b5fd;
  --purple-accent:#7c3aed;
  --purple-border:#4f3fa0;
  --purple-border-light:#4a1d7c;
  --purple-bg:#2e1065;
  --toast-bg:#0d1e3a;--toast-border:#1d3461;--toast-text:#93c5fd;
  --toast-err-bg:#1f0a0a;--toast-err-border:#7f1d1d;--toast-err-text:#f87171;
  --stroke-secondary:#94a3b8;--stroke-muted:#64748b;--fill-label:#94a3b8;
  --node-bg:#0d1117;--node-border:#1a2535;--node-text:#fff;--node-sub:#64748b;
  --node-sel-bg:#1d3461;--node-sel-text:#7dd3fc;--node-sel-stroke:#4f8ef7;
  --hint-text:#64748b;--hint-warn:#fbbf24;--hint-danger:#f87171;--hint-ok:#4ade80;
  --seg-temp:#4f8ef7;--seg-ghost-bg:#0f172a;--seg-empty:#334155;--seg-outline:#94a3b8;--seg-dark:#3d3d3d;--seg-dark-junc:#4a4a4a;
  --temp-sensor:#c084fc;
  --aw-danger-bg:#450a0a;--aw-danger-text:#fca5a5;--aw-danger-border:#7f1d1d;
  --aw-over-bg:#0c1a3a;--aw-over-text:#93c5fd;--aw-over-border:#1e3a5f;
  --badge-over-bg:#0c2a4a;--badge-over-text:#93c5fd;--badge-over-border:#3b82f6;
  --sum-ok-bg:#052e16;--sum-ok-text:#22c55e;
  --sum-warn-bg:#451a03;--sum-warn-text:#fbbf24;
  --sum-danger-bg:#450a0a;--sum-danger-text:#f87171;
  --sum-info-bg:#0c1a3a;--sum-info-text:#93c5fd;
  /* ── z-index scale (preserves legacy numeric values) ── */
  --z-base:1;
  --z-card-badges:2;
  --z-chrome:10;
  --z-card-ui:20;
  --z-toolbar:30;
  --z-picker:50;
  --z-modal-bg:200;
  --z-ac-overlay:250;
  --z-toast:300;
  --z-chat:400;
  --z-hint:900;
  --z-menu:1000;
  --z-ctx:1001;
  --z-popup:2000;
  --z-qa-popup:9000;
  --z-help:9999
}
html[data-theme="light"]{
  --bg-body:#e8ecf1;
  --bg-surface:#fff;
  --bg-panel:#f8f9fa;
  --bg-elevated:#f1f5f9;
  --bg-input:#fff;
  --bg-inset:#fff;
  --canvas-bg:#f5f7fa;
  --bg-hover:#f1f5f9;
  --bg-active:#eff6ff;
  --bg-accent-subtle:#eff6ff;
  --bg-accent-strong:#dbeafe;
  --bg-accent-active:#dbeafe;
  --text:#1e293b;
  --text-bright:#0f172a;
  --text-light:#334155;
  --text-secondary:#475569;
  --text-muted:#9ca3af;
  --text-dim:#6b7280;
  --text-faint:#9ca3af;
  --border:#d1d5db;
  --border-light:#e5e7eb;
  --border-strong:#9ca3af;
  --border-subtle:#e5e7eb;
  --border-card:#d1d5db;
  --border-accent:#93c5fd;
  --accent:#2563eb;
  --accent-light:#2563eb;
  --accent-bright:#1d4ed8;
  --accent-muted:#3b82f6;
  --accent-dark:#1d4ed8;
  --overlay-bg:rgba(0,0,0,.25);
  --overlay-heavy:rgba(0,0,0,.25);
  --shadow:0 24px 64px rgba(0,0,0,.12);
  --shadow-lg:0 24px 80px rgba(0,0,0,.15);
  --shadow-sm:0 8px 24px rgba(0,0,0,.12);
  --shadow-card:0 2px 8px rgba(0,0,0,.08);
  --hdr-bg:#edf0f5;
  --hdr-border:rgba(0,0,0,.1);
  --edit-bg:rgba(0,0,0,.08);
  --edit-color:rgba(0,0,0,.4);
  --edit-hover-bg:rgba(0,0,0,.15);
  --edit-hover-color:rgba(0,0,0,.7);
  --row-hover:rgba(0,0,0,.03);
  --row-border:rgba(0,0,0,.06);
  --danger:#f87171;
  --danger-dark:#dc2626;
  --danger-light:#fca5a5;
  --danger-bg:#fef2f2;
  --danger-border:#fca5a5;
  --danger-hover-bg:#fef2f2;
  --success:#16a34a;
  --success-light:#16a34a;
  --success-border:#bbf7d0;
  --success-bg:#f0fdf4;
  --success-bg-hover:#dcfce7;
  --warn:#d97706;
  --warn-light:#92400e;
  --warn-dark:#d97706;
  --warn-bg:#fffbeb;
  --warn-border:#fcd34d;
  --purple:#7c3aed;
  --purple-light:#6d28d9;
  --purple-accent:#7c3aed;
  --purple-border:#c4b5fd;
  --purple-border-light:#ddd6fe;
  --purple-bg:#f5f3ff;
  --toast-bg:#e0e7ff;--toast-border:#93c5fd;--toast-text:#1e40af;
  --toast-err-bg:#fee2e2;--toast-err-border:#fca5a5;--toast-err-text:#b91c1c;
  --stroke-secondary:#7a8a9e;--stroke-muted:#556070;--fill-label:#3d4d5c;
  --node-bg:#dce2ea;--node-border:#b0bac6;--node-text:#1e293b;--node-sub:#556070;
  --node-sel-bg:#dbeafe;--node-sel-text:#1d4ed8;--node-sel-stroke:#2563eb;
  --hint-text:#6b7280;--hint-warn:#d97706;--hint-danger:#dc2626;--hint-ok:#16a34a;
  --seg-temp:#2563eb;--seg-ghost-bg:#fff;--seg-empty:#7d8a98;--seg-outline:#8a95a4;--seg-dark:#1a1a1a;--seg-dark-junc:#2d2d2d;
  --temp-sensor:#9333ea;
  --aw-danger-bg:#fef2f2;--aw-danger-text:#b91c1c;--aw-danger-border:#fca5a5;
  --aw-over-bg:#eff6ff;--aw-over-text:#1d4ed8;--aw-over-border:#93c5fd;
  --badge-over-bg:#eff6ff;--badge-over-text:#1d4ed8;--badge-over-border:#2563eb;
  --sum-ok-bg:#f0fdf4;--sum-ok-text:#16a34a;
  --sum-warn-bg:#fffbeb;--sum-warn-text:#d97706;
  --sum-danger-bg:#fef2f2;--sum-danger-text:#dc2626;
  --sum-info-bg:#eff6ff;--sum-info-text:#1d4ed8
}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
     background:var(--bg-body);color:var(--text);height:100vh;display:flex;overflow:hidden;font-size:13px}

/* ── Lucide icons ── */
svg.lucide{display:inline-block;vertical-align:-2px;flex-shrink:0;pointer-events:none}
.tbtn svg.lucide{width:13px;height:13px}
#sb-toggle svg.lucide{width:17px;height:17px;vertical-align:-3px}
#sb-head h2 svg.lucide{width:13px;height:13px;vertical-align:-1px}
#btn-new-proj svg.lucide,.sb-btn svg.lucide{width:12px;height:12px;vertical-align:-1px}
.ac-close svg.lucide{width:14px;height:14px;vertical-align:-2px}
.ac-head svg.lucide,.audit-head svg.lucide{width:13px;height:13px;vertical-align:-2px}
.ac-foot svg.lucide,.mbtn svg.lucide{width:12px;height:12px;vertical-align:-1px}
.hdr-edit svg.lucide{width:11px;height:11px;vertical-align:-1px}
.lib-item-actions svg.lucide{width:12px;height:12px}
.proj-actions svg.lucide{width:11px;height:11px}
.ac-rm-conn svg.lucide{width:11px;height:11px;vertical-align:-1px}
.flry-info-toggle svg.lucide{width:13px;height:13px;vertical-align:-2px}

/* ── toast ── */
#toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);
       background:var(--toast-bg);color:var(--toast-text);padding:8px 18px;border-radius:8px;
       font-size:12px;opacity:0;transition:opacity .25s;pointer-events:none;
       z-index:var(--z-toast);border:1px solid var(--toast-border);white-space:nowrap;
       box-shadow:0 4px 20px rgba(0,0,0,.6)}
