:root {
  --bg-0: #0b0d0f;
  --bg-1: #111417;
  --bg-2: #171b1f;
  --bg-3: #1d2227;
  --bg-4: #242a30;
  --bg-5: #2b3239;
  --line: #30373e;
  --line-strong: #444e57;
  --text-1: #eef2f5;
  --text-2: #c6cdd3;
  --text-3: #8e9aa4;
  --muted: #69747d;
  --cyan: #55b9ff;
  --cyan-2: #228ed8;
  --blue: #5f9bff;
  --green: #5ee39c;
  --green-2: #2cb66f;
  --amber: #f0b55d;
  --orange: #e99243;
  --red: #ef6b6b;
  --magenta: #e86acb;
  --violet: #9d82ff;
  --shadow: 0 18px 42px rgba(0, 0, 0, .45);
  --radius: 7px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ui: Inter, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", Arial, sans-serif;
  --domain-rail-width: 182px;
  --project-pane-width: 286px;
  --inspector-pane-width: 318px;
  --drawer-height: clamp(156px, 20vh, 210px);
}


/* Ensure inactive overlays do not cover and blur the workspace. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #050607; color: var(--text-1); font-family: var(--ui); font-size: 13px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 1px solid var(--cyan); outline-offset: 1px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #414950; border: 2px solid transparent; background-clip: content-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #55616b; border: 2px solid transparent; background-clip: content-box; }

.app-shell { width: 100vw; height: 100vh; display: grid; grid-template-rows: auto 1fr 24px; background: var(--bg-1); }
.window-frame { background: linear-gradient(#20252a, #171b1f); border-bottom: 1px solid #050607; box-shadow: 0 3px 10px rgba(0,0,0,.3); z-index: 20; }
.os-titlebar { height: 35px; display: flex; align-items: center; justify-content: space-between; padding-left: 10px; background: linear-gradient(90deg, #e9eef1, #fbfcfd 50%, #edf1f4); color: #22282d; border-bottom: 1px solid #9ba4ab; user-select: none; }
.brand-compact { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(145deg, #60dcff, #3a75ff 50%, #db4dc0); padding: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.22); }
.brand-mark span { display: block; width: 100%; height: 100%; border-radius: 4px; background: #fff; position: relative; }
.brand-mark span::after { content: ""; position: absolute; width: 5px; height: 10px; border-radius: 4px; left: 4px; top: 2px; background: linear-gradient(#fa4ac4, #477cff); }
.brand-title { font-weight: 700; letter-spacing: .1px; }
.brand-subtitle { color: #59626a; font-size: 12px; border-left: 1px solid #b6bdc2; padding-left: 8px; }
.window-actions { display: flex; height: 100%; }
.window-actions button { width: 46px; border: 0; border-left: 1px solid rgba(0,0,0,.04); border-radius: 0; color: #363d43; background: transparent; }
.window-actions button:hover { background: rgba(0,0,0,.08); }
.window-actions .danger-hover:hover { background: #d63b35; color: #fff; }

.menu-bar { height: 29px; display: flex; align-items: stretch; background: #171b1f; border-bottom: 1px solid #0b0d0f; padding-left: 4px; user-select: none; }
.menu-root { border: 0; background: transparent; color: var(--text-2); min-width: 46px; padding: 0 10px; text-align: left; }
.menu-root:hover, .menu-root.active { color: #fff; background: #2b3136; }

.command-bar { min-height: 50px; display: grid; grid-template-columns: auto minmax(260px, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 8px; background: linear-gradient(#2d3338, #252a2f); border-bottom: 1px solid #111; }
.command-group { display: flex; align-items: center; gap: 4px; min-width: 0; }
.context-actions { justify-content: center; }
.utility-actions { justify-content: flex-end; }
.command-button, .icon-button { border: 1px solid #3c454d; background: linear-gradient(#353c42, #2b3136); color: var(--text-2); border-radius: 4px; height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; cursor: default; user-select: none; box-shadow: inset 0 1px rgba(255,255,255,.035); position: relative; }
.command-button:hover, .icon-button:hover { background: linear-gradient(#404950, #333a40); border-color: #53606b; color: #fff; }
.command-button:active, .icon-button:active { transform: translateY(1px); background: #242a2f; }
.command-button.accent { border-color: #2e7eb3; background: linear-gradient(#268fcf, #1471ac); color: white; }
.command-button.accent:hover { background: linear-gradient(#35a7ee, #1884c7); }
.command-button.success { border-color: #327d59; }
.command-button.success .cmd-icon { color: var(--green); }
.command-button.danger .cmd-icon { color: var(--red); }
.command-button.danger { padding-inline: 8px; }
.icon-button { width: 32px; padding: 0; }
.icon-button.ghost { background: transparent; border: 0; }
.icon-button.tiny { width: 26px; height: 25px; border-color: transparent; background: transparent; padding: 0; }
.icon-button.tiny:hover { border-color: #3e474f; background: #2a3035; }
.cmd-icon { font-size: 15px; line-height: 1; }
.toolbar-divider { width: 1px; height: 28px; background: #151719; border-right: 1px solid #454c52; margin: 0 3px; }
.site-selector { display: flex; align-items: center; gap: 7px; height: 32px; background: #22272b; border: 1px solid #3a4249; border-radius: 4px; padding-left: 9px; color: var(--text-3); white-space: nowrap; }
.site-selector select { color: var(--text-1); background: #2d343a; border: 0; border-left: 1px solid #3c444a; height: 30px; min-width: 110px; padding: 0 24px 0 8px; }
.connection-chip, .metric-chip { display: inline-flex; align-items: center; gap: 6px; height: 27px; padding: 0 8px; border: 1px solid #3b434a; background: #22272b; border-radius: 4px; color: var(--text-3); font-size: 12px; }
.connection-chip.online { border-color: rgba(94,227,156,.32); color: #bcefd1; background: rgba(42,126,81,.15); }
.badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 9px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 9px; font-weight: 700; border: 2px solid #262c31; }

.breadcrumb-row { height: 31px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; background: #20252a; border-top: 1px solid rgba(255,255,255,.025); color: var(--text-3); }
.breadcrumbs { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.crumb { color: var(--text-3); }
.crumb.current { color: var(--text-1); }
.crumb-sep { margin: 0 6px; color: #5b666f; }
.context-summary { display: flex; gap: 5px; }
.metric-chip { height: 23px; border-color: transparent; background: #191d20; }
.metric-chip b { color: var(--text-2); font-weight: 600; }

.workspace {
  min-height: 0;
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns:
    var(--domain-rail-width)
    var(--project-pane-effective, var(--project-pane-width))
    minmax(0, 1fr)
    var(--inspector-pane-effective, var(--inspector-pane-width));
  overflow: hidden;
  background: var(--bg-0);
  transition: grid-template-columns .16s ease;
}
.domain-rail {
  min-width: 0;
  background: linear-gradient(90deg, #111416, #171b1e);
  border-right: 1px solid #333a40;
  padding: 10px 8px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
.domain-block { margin-bottom: 12px; padding-bottom: 2px; }
.domain-title {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--domain-color);
  color: var(--domain-color);
  background: linear-gradient(90deg, rgba(255,255,255,.02), rgba(255,255,255,.10), rgba(255,255,255,.02));
  border-radius: 8px;
  padding: 10px 7px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .65px;
  text-align: center;
  text-shadow: 0 0 8px currentColor;
  box-shadow: inset 0 0 12px rgba(255,255,255,.06), 0 0 7px color-mix(in srgb, var(--domain-color) 36%, transparent);
}
.domain-title.active { background: color-mix(in srgb, var(--domain-color) 14%, #1b2023); box-shadow: inset 0 0 18px color-mix(in srgb, var(--domain-color) 25%, transparent), 0 0 10px color-mix(in srgb, var(--domain-color) 40%, transparent); }
.domain-links { display: grid; gap: 3px; padding: 8px 1px 0; }
.domain-link {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 7px 8px;
  border-radius: 5px;
  text-align: left;
  font-size: 12px;
  line-height: 1.25;
}
.domain-link > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-link:hover, .domain-link.active { background: rgba(255,255,255,.065); color: #fff; }
.domain-link.active { box-shadow: inset 3px 0 var(--domain-color); background: color-mix(in srgb, var(--domain-color) 10%, #20262a); }
.domain-link .folder-icon { width: 20px; color: var(--domain-color); font-size: 16px; text-align: center; }

.project-pane, .inspector-pane { min-width: 0; position: relative; background: var(--bg-2); border-right: 1px solid #343b42; display: flex; flex-direction: column; overflow: hidden; }
.inspector-pane { border-right: 0; border-left: 1px solid #343b42; }
.pane-header { min-height: 48px; border-bottom: 1px solid #30363b; padding: 8px; display: flex; align-items: center; justify-content: space-between; background: #1b2024; }
.pane-header.compact { min-height: 52px; }
.eyebrow { color: #78858f; font-size: 10px; letter-spacing: .9px; margin-bottom: 3px; }
.pane-actions { display: flex; }
.tree-filter-wrap { margin: 8px; height: 32px; border: 1px solid #343c43; background: #111518; border-radius: 4px; display: flex; align-items: center; gap: 5px; padding: 0 7px; color: #68747d; }
.tree-filter-wrap input { min-width: 0; width: 100%; height: 100%; border: 0; background: transparent; color: var(--text-2); outline: none; }
.project-tree { flex: 1; min-height: 0; overflow: auto; padding: 2px 7px 15px; scrollbar-gutter: stable; }
.tree-node { user-select: none; }
.tree-row { min-height: 27px; display: flex; align-items: center; gap: 5px; border-radius: 3px; padding-right: 5px; color: var(--text-2); white-space: nowrap; }
.tree-row:hover { background: #242a2f; }
.tree-row.selected { background: linear-gradient(90deg, #126ea5, #145f8b); color: #fff; }
.tree-toggle { flex: 0 0 15px; width: 15px; text-align: center; color: #72808a; }
.tree-icon { flex: 0 0 17px; width: 17px; text-align: center; color: var(--node-color, var(--cyan)); }
.tree-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tree-badge { flex: 0 0 auto; font-size: 10px; color: #77848d; }
.tree-children.collapsed { display: none; }
.project-pane-footer { height: 28px; border-top: 1px solid #33393e; display: flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--text-3); font-size: 11px; background: #181c20; }

.editor-area { min-width: 0; min-height: 0; display: grid; grid-template-rows: 34px 38px minmax(0, 1fr) var(--drawer-height); background: #0e1113; }
.tab-strip { display: flex; align-items: end; gap: 1px; padding: 0 5px; background: #161a1d; border-bottom: 1px solid #333a40; overflow-x: auto; overflow-y: hidden; }
.editor-tab { flex: 0 0 auto; height: 31px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid transparent; border-bottom: 0; background: transparent; color: #8e9aa3; border-radius: 5px 5px 0 0; max-width: 220px; }
.editor-tab:hover { background: #22282d; color: #cdd3d8; }
.editor-tab.active { background: #21272c; border-color: #39444d; color: #fff; box-shadow: inset 0 2px var(--cyan); }
.editor-tab .tab-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.editor-tab .dirty { color: var(--amber); }
.editor-tab .close-tab { border: 0; background: transparent; color: #76828b; padding: 0; width: 16px; height: 16px; border-radius: 3px; }
.editor-tab .close-tab:hover { background: #384048; color: #fff; }
.editor-toolbar { min-width: 0; display: flex; align-items: center; gap: 5px; padding: 4px 7px; border-bottom: 1px solid #333a40; background: #20252a; overflow-x: auto; }
.tool-btn { height: 28px; min-width: 28px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--text-2); padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.tool-btn:hover, .tool-btn.active { background: #323940; border-color: #46515a; color: #fff; }
.tool-btn.primary { background: #176e9f; border-color: #2d8dc3; color: white; }
.tool-sep { width: 1px; height: 23px; background: #111; border-right: 1px solid #444; margin: 0 2px; }
.editor-canvas { min-width: 0; min-height: 0; overflow: auto; background: #0d1012; position: relative; }
.editor-canvas::before { content: ""; pointer-events: none; position: absolute; inset: 0; background: radial-gradient(circle at 50% 10%, rgba(76,123,151,.06), transparent 45%); }

.bottom-drawer { min-height: 0; border-top: 1px solid #3c454d; background: #14181b; display: grid; grid-template-rows: 32px 1fr; }
.drawer-tabs { display: flex; align-items: center; gap: 1px; padding: 0 6px; border-bottom: 1px solid #30373d; background: #1c2125; }
.drawer-tab { height: 31px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #89959e; padding: 0 9px; }
.drawer-tab:hover { color: #d2d7db; }
.drawer-tab.active { color: #fff; border-bottom-color: var(--cyan); }
.drawer-spacer { flex: 1; }
.drawer-content { min-height: 0; overflow: auto; }
.console-list { font-family: var(--mono); font-size: 11px; padding: 7px 8px; }
.log-row { display: grid; grid-template-columns: 108px 58px 70px 1fr; gap: 8px; line-height: 21px; white-space: nowrap; }
.log-row:hover { background: rgba(255,255,255,.025); }
.log-time { color: #63717b; }
.log-level.info { color: #67aef0; }
.log-level.success { color: var(--green); }
.log-level.warn { color: var(--amber); }
.log-level.error { color: var(--red); }
.log-source { color: #7d8992; }
.log-message { color: #bcc4ca; overflow: hidden; text-overflow: ellipsis; }

.inspector-tabs { height: 35px; display: flex; align-items: stretch; border-bottom: 1px solid #373f46; background: #1c2125; padding-left: 3px; }
.inspector-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: #89959e; padding: 0 8px; font-size: 12px; }
.inspector-tab:hover { color: #d4d9dd; }
.inspector-tab.active { color: #fff; border-bottom-color: var(--cyan); }
.align-right { margin-left: auto; align-self: center; margin-right: 3px; }
.inspector-content { flex: 1; min-height: 0; overflow: auto; padding: 7px; }
.property-section { border: 1px solid #343c43; border-radius: 5px; background: #181d21; margin-bottom: 7px; overflow: hidden; }
.property-title { min-height: 31px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; background: #20262b; border-bottom: 1px solid #343c43; color: #d9dee2; font-weight: 600; }
.property-grid { display: grid; grid-template-columns: 42% 58%; }
.property-key, .property-value { min-height: 29px; padding: 6px 7px; border-bottom: 1px solid #272e33; }
.property-key { color: #8f9ba4; border-right: 1px solid #2a3137; }
.property-value { color: #d0d6da; overflow: hidden; text-overflow: ellipsis; }
.property-value input, .property-value select { width: 100%; border: 1px solid #384149; border-radius: 3px; background: #111518; color: #e8ecef; height: 24px; padding: 0 6px; }
.help-card { border-left: 2px solid var(--cyan); background: #1a2024; padding: 9px; margin-bottom: 8px; color: #bfc7cc; line-height: 1.5; }
.help-card h4 { color: #fff; margin: 0 0 5px; }
.formula-box { border: 1px solid #3e4850; background: #0f1316; padding: 8px; font-family: var(--mono); color: #d9e4ec; border-radius: 3px; }
.issue-card { border: 1px solid #3c4349; background: #1a1e22; border-left: 3px solid var(--red); padding: 8px; margin-bottom: 7px; border-radius: 3px; }
.issue-card.warning { border-left-color: var(--amber); }
.issue-title { font-weight: 600; color: #e5eaee; margin-bottom: 4px; }
.issue-meta { color: #87939c; font-size: 11px; }

.status-bar { display: flex; align-items: center; justify-content: space-between; background: #155e87; color: #e9f6ff; font-size: 11px; overflow: hidden; }
.status-left, .status-right { display: flex; align-items: center; height: 100%; }
.status-item { height: 100%; display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: inherit; padding: 0 8px; white-space: nowrap; }
button.status-item:hover { background: rgba(255,255,255,.10); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #6e7a83; box-shadow: 0 0 5px currentColor; display: inline-block; }
.status-dot.success { background: var(--green); color: var(--green); }
.status-dot.warning { background: var(--amber); color: var(--amber); }
.status-dot.error { background: var(--red); color: var(--red); }

.count { min-width: 17px; height: 17px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 10px; margin-left: 3px; background: #333b41; color: #bbc3c9; }
.count.danger { background: rgba(239,107,107,.2); color: #ff9494; }
.count.warning { background: rgba(240,181,93,.18); color: #f7c878; }
.count.neutral { background: rgba(95,155,255,.16); color: #8eb8ff; }

/* Menus */
.menu-layer { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.popup-menu { position: fixed; width: 250px; background: #20252a; border: 1px solid #4a555f; border-radius: 4px; box-shadow: var(--shadow); padding: 4px; pointer-events: auto; color: #dde2e6; }
.popup-menu.submenu { z-index: 2; }
.menu-item { min-height: 29px; display: grid; grid-template-columns: 24px 1fr auto 14px; align-items: center; gap: 4px; padding: 0 6px; border-radius: 3px; position: relative; }
.menu-item:hover, .menu-item.focused { background: #176d9f; color: #fff; }
.menu-item.disabled { color: #616d75; pointer-events: none; }
.menu-item .menu-icon { text-align: center; color: #91a0aa; }
.menu-item:hover .menu-icon { color: #fff; }
.menu-item .shortcut { color: #7f8b94; font-size: 11px; }
.menu-item:hover .shortcut { color: #dceaf3; }
.menu-arrow { text-align: center; }
.menu-separator { height: 1px; background: #394149; margin: 4px 3px; }

/* Modal + palette */
.modal-layer, .command-palette-layer { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.62); backdrop-filter: blur(2px); display: grid; place-items: center; }
.modal-window { width: min(680px, calc(100vw - 40px)); max-height: calc(100vh - 48px); background: #1a1f23; border: 1px solid #55616b; border-radius: 7px; box-shadow: 0 26px 70px rgba(0,0,0,.65); overflow: hidden; }
.modal-window.small { width: min(440px, calc(100vw - 40px)); }
.modal-window.large { width: min(980px, calc(100vw - 40px)); }
.modal-header { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; background: linear-gradient(#2b3238, #242a2f); border-bottom: 1px solid #414a52; }
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 14px; max-height: calc(100vh - 150px); overflow: auto; }
.modal-footer { min-height: 52px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 13px; background: #171b1f; border-top: 1px solid #333b42; }
.form-grid { display: grid; grid-template-columns: 150px 1fr; gap: 11px 12px; align-items: center; }
.form-grid label { color: #9aa6af; }
.form-control { width: 100%; height: 33px; border: 1px solid #414b54; border-radius: 4px; background: #111518; color: #edf1f4; padding: 0 9px; }
textarea.form-control { min-height: 88px; padding: 8px; resize: vertical; }
.field-help { grid-column: 2; color: #71808a; font-size: 11px; margin-top: -6px; }
.option-row { display: flex; gap: 9px; align-items: center; color: #aeb7be; }
.modal-tabs { display: flex; gap: 1px; border-bottom: 1px solid #3a434b; margin-bottom: 12px; }
.modal-tab { border: 0; background: transparent; color: #8e9aa4; padding: 9px 12px; border-bottom: 2px solid transparent; }
.modal-tab.active { color: #fff; border-bottom-color: var(--cyan); }
.palette { width: min(720px, calc(100vw - 40px)); background: #1b2024; border: 1px solid #5b6873; border-radius: 7px; box-shadow: var(--shadow); overflow: hidden; align-self: start; margin-top: 12vh; }
.palette-input { height: 48px; width: 100%; border: 0; border-bottom: 1px solid #414a52; background: #111518; color: #fff; padding: 0 16px; font-size: 15px; outline: none; }
.palette-results { max-height: 390px; overflow: auto; padding: 5px; }
.palette-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; align-items: center; min-height: 42px; border-radius: 4px; padding: 0 9px; }
.palette-item:hover, .palette-item.selected { background: #176d9f; }
.palette-title { color: #e6eaed; }
.palette-sub { color: #7f8b94; font-size: 11px; }
.palette-item:hover .palette-sub, .palette-item.selected .palette-sub { color: #d3e4ee; }

.toast-layer { position: fixed; right: 12px; bottom: 36px; z-index: 300; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 310px; max-width: 430px; background: #20262b; border: 1px solid #47525b; border-left: 3px solid var(--cyan); border-radius: 5px; padding: 10px 12px; box-shadow: 0 14px 34px rgba(0,0,0,.42); animation: toast-in .18s ease-out; }
.toast.success { border-left-color: var(--green); }
.toast.warning { border-left-color: var(--amber); }
.toast.error { border-left-color: var(--red); }
.toast-title { font-weight: 700; margin-bottom: 3px; }
.toast-message { color: #9faab2; font-size: 12px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* Shared content */
.view { min-height: 100%; position: relative; z-index: 1; }
.view-padding { padding: 13px; }
.view-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 13px 14px 10px; border-bottom: 1px solid #2f363c; background: linear-gradient(#151a1e, #111518); }
.view-title-group h1 { font-size: 18px; margin: 0 0 4px; font-weight: 600; }
.view-title-group p { color: #87939c; margin: 0; font-size: 12px; }
.view-actions { display: flex; gap: 6px; }
.panel-grid { display: grid; gap: 10px; }
.panel-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel-card { border: 1px solid #333b42; background: #171c20; border-radius: 6px; overflow: hidden; }
.panel-card-header { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; background: #1f252a; border-bottom: 1px solid #333b42; }
.panel-card-header h3 { font-size: 13px; margin: 0; }
.panel-card-body { padding: 10px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.kpi { border: 1px solid #344049; background: linear-gradient(145deg, #1b2126, #14181b); border-radius: 6px; padding: 11px; }
.kpi .label { color: #84919a; font-size: 11px; }
.kpi .value { font-size: 23px; margin: 5px 0 2px; font-weight: 600; }
.kpi .trend { font-size: 11px; color: #76838c; }
.kpi .trend.positive { color: var(--green); }
.kpi .trend.warning { color: var(--amber); }

.data-table-wrap { border: 1px solid #333c43; border-radius: 5px; overflow: auto; background: #121619; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
.data-table th { position: sticky; top: 0; z-index: 2; background: #252b30; color: #9aa6ae; text-align: left; padding: 8px 9px; border-bottom: 1px solid #424b53; font-weight: 600; }
.data-table td { padding: 7px 9px; border-bottom: 1px solid #272e33; color: #c7ced3; }
.data-table tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
.data-table tbody tr:hover { background: #20282e; }
.data-table tbody tr.selected { background: #135f8b; }
.data-table input, .data-table select { width: 100%; min-width: 70px; height: 25px; border: 1px solid #414a52; background: #101417; color: #e6ebee; border-radius: 3px; padding: 0 5px; }
.cell-status { display: inline-flex; align-items: center; gap: 5px; }
.tag { display: inline-flex; align-items: center; height: 21px; padding: 0 7px; border-radius: 10px; background: #2a3238; color: #aeb8bf; font-size: 10px; border: 1px solid #39434b; }
.tag.success { color: #8de9b5; border-color: #2c7d53; background: rgba(44,125,83,.15); }
.tag.warning { color: #f1c36f; border-color: #785e2d; background: rgba(120,94,45,.14); }
.tag.danger { color: #ff9292; border-color: #7c3a3a; background: rgba(124,58,58,.14); }
.tag.info { color: #8fc8f0; border-color: #376f94; background: rgba(55,111,148,.14); }
.empty-state { height: 100%; min-height: 240px; display: grid; place-items: center; text-align: center; color: #71808a; }
.empty-state-icon { font-size: 36px; color: #53616b; margin-bottom: 8px; }
.empty-state h3 { color: #b8c1c7; margin: 0 0 6px; font-weight: 500; }
.empty-state p { margin: 0; max-width: 440px; }

/* Start page */
.start-page { height: 100%; min-height: 540px; display: grid; grid-template-columns: minmax(560px, 1fr) 360px; background: radial-gradient(circle at 30% 20%, #172831, #0e1113 42%, #090b0d); }
.start-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.start-brand { display: flex; align-items: center; gap: 18px; margin-bottom: 34px; }
.start-logo { width: 72px; height: 72px; border-radius: 18px; background: linear-gradient(145deg, #62dbff, #4475ff 45%, #f057c4); padding: 10px; box-shadow: 0 0 40px rgba(71,150,255,.25); }
.start-logo::before { content: ""; display: block; width: 100%; height: 100%; border-radius: 12px; background: #f8fbfd; }
.start-brand h1 { margin: 0; font-size: 31px; font-weight: 500; }
.start-brand p { margin: 6px 0 0; letter-spacing: 1.8px; color: #7d8992; font-size: 11px; }
.start-actions { display: grid; grid-template-columns: repeat(3, 150px); gap: 12px; }
.start-action { height: 118px; border: 1px solid #3c464e; border-radius: 9px; background: linear-gradient(145deg, #242b31, #171c20); color: #d2d8dc; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; box-shadow: inset 0 1px rgba(255,255,255,.04); }
.start-action:hover { border-color: #55707f; background: linear-gradient(145deg, #2b343b, #1a2024); color: #fff; transform: translateY(-1px); }
.start-action.primary { border-color: #247cae; background: linear-gradient(145deg, #1f7fb5, #135f8d); }
.start-action .big-icon { font-size: 28px; }
.start-side { border-left: 1px solid #293138; background: rgba(15,18,21,.76); padding: 30px 25px; overflow: auto; }
.start-section { margin-bottom: 25px; }
.start-section h3 { margin: 0 0 10px; font-size: 12px; color: #87949d; text-transform: uppercase; letter-spacing: .8px; }
.recent-project { width: 100%; min-height: 61px; border: 1px solid transparent; background: transparent; border-radius: 5px; display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; text-align: left; padding: 7px; color: #cbd2d7; }
.recent-project:hover { background: #1e252a; border-color: #323c43; }
.recent-project .path { color: #6f7d86; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-project .time { color: #68757e; font-size: 10px; }
.quick-link { display: flex; align-items: center; gap: 8px; color: #7ebee8; padding: 6px 0; }

/* Graph / waveform */
.waveform-layout { height: 100%; display: grid; grid-template-rows: minmax(260px, 55%) minmax(220px, 45%); }
.waveform-panel { min-height: 0; border-bottom: 1px solid #3a4249; background: #101416; padding: 9px; }
.waveform-canvas { width: 100%; height: 100%; min-height: 240px; display: block; background: #11161a; border: 1px solid #39434a; }
.config-split { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.config-form, .code-preview { overflow: auto; padding: 10px; }
.config-form { border-right: 1px solid #394149; }
.code-preview pre { margin: 0; font-family: var(--mono); color: #c4d8c7; line-height: 1.55; font-size: 12px; }
.search-box { height: 30px; display: flex; align-items: center; gap: 6px; border: 1px solid #3b454d; background: #111518; border-radius: 4px; padding: 0 8px; color: #71808a; margin-bottom: 8px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: #e9edef; }
.form-row { display: grid; grid-template-columns: 145px 1fr auto; gap: 8px; min-height: 33px; align-items: center; border-bottom: 1px solid #2a3136; padding: 4px 0; }
.form-row label { color: #9ca7af; }
.form-row input, .form-row select { min-width: 0; height: 27px; border: 1px solid #414b53; background: #121619; color: #edf1f3; border-radius: 3px; padding: 0 7px; }
.form-row .unit { color: #84919a; }
.form-group-title { margin: 7px 0 3px; font-weight: 600; color: #d8dde1; }

.node-canvas { position: relative; min-height: 580px; background-color: #101416; background-image: linear-gradient(#20282e 1px, transparent 1px), linear-gradient(90deg, #20282e 1px, transparent 1px); background-size: 20px 20px; overflow: auto; }
.node-layer { position: relative; min-width: 1050px; min-height: 720px; }
.node-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.node-card { position: absolute; width: 170px; min-height: 105px; border: 1px solid #46525b; background: linear-gradient(#242b30, #191e22); border-radius: 7px; box-shadow: 0 7px 18px rgba(0,0,0,.35); }
.node-card.success { border-color: #3d9c66; box-shadow: 0 0 14px rgba(78,190,119,.12); }
.node-card.warning { border-color: #a8742f; }
.node-card.error { border-color: #a54949; }
.node-head { height: 32px; display: flex; align-items: center; gap: 7px; padding: 0 9px; border-bottom: 1px solid #353e45; font-weight: 600; }
.node-body { padding: 7px 9px; color: #89969f; font-size: 11px; }
.node-port { display: flex; justify-content: space-between; line-height: 20px; }
.node-status { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.canvas-controls { position: sticky; left: 10px; bottom: 10px; width: fit-content; display: flex; background: #232a30; border: 1px solid #444f58; border-radius: 4px; overflow: hidden; z-index: 2; }
.canvas-controls button { width: 32px; height: 30px; border: 0; border-right: 1px solid #3b444c; background: transparent; color: #b8c1c7; }
.canvas-controls button:hover { background: #354049; }

.pin-map-shell { min-height: 560px; display: grid; grid-template-columns: 190px 1fr 220px; gap: 8px; padding: 9px; }
.pin-list, .net-list { border: 1px solid #354048; background: #14191c; border-radius: 5px; overflow: auto; }
.pin-list h4, .net-list h4 { margin: 0; height: 34px; display: flex; align-items: center; padding: 0 9px; background: #20262b; border-bottom: 1px solid #364048; }
.pin-item { min-height: 28px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; border-bottom: 1px solid #242b30; color: #aeb8be; }
.pin-item:hover { background: #20272c; }
.pin-item.selected { background: #176d9f; color: #fff; }
.pin-stage { min-height: 500px; border: 1px solid #364149; background-color: #0f1316; background-image: radial-gradient(#2a343b 1px, transparent 1px); background-size: 15px 15px; position: relative; overflow: hidden; }
.dut-package { width: 240px; height: 310px; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 2px solid #3c99d2; background: rgba(26,70,98,.20); box-shadow: 0 0 30px rgba(54,152,214,.15); display: grid; place-items: center; color: #78bfea; }
.dut-package::before, .dut-package::after { content: ""; position: absolute; inset: 18px; border: 1px solid #386981; }
.dut-package::after { inset: 45px; }
.package-pin { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 7px var(--green); }

.instrument-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 9px; }
.instrument-card { border: 1px solid #354049; background: #171c20; border-radius: 6px; padding: 10px; }
.instrument-card:hover { border-color: #4e5e69; background: #1c2227; }
.instrument-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.instrument-name { font-weight: 600; }
.instrument-meta { color: #7f8b94; font-size: 11px; line-height: 1.5; }
.slot-visual { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin-top: 10px; }
.slot-cell { height: 30px; border: 1px solid #3a444c; background: #111518; display: grid; place-items: center; color: #6e7a83; font-size: 9px; }
.slot-cell.used { background: rgba(48,130,84,.20); border-color: #347f57; color: #8ad9aa; }

.result-bar { height: 9px; border-radius: 5px; background: #30383e; overflow: hidden; }
.result-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #2899d8, #58d49a); }
.progress-line { height: 5px; background: #30383e; border-radius: 4px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--cyan); }

.about-brand { display: flex; gap: 15px; align-items: center; padding: 12px; border: 1px solid #374149; background: #151a1e; border-radius: 6px; }
.about-logo { width: 62px; height: 62px; border-radius: 15px; background: linear-gradient(145deg, #62dbff, #4475ff 45%, #f057c4); }
.about-meta h2 { margin: 0 0 4px; }
.about-meta p { margin: 0; color: #87949d; }

.hidden { display: none !important; }
.app-shell.project-collapsed,
.app-shell.auto-project-collapsed { --project-pane-effective: 0px; }
.app-shell.inspector-collapsed,
.app-shell.auto-inspector-collapsed { --inspector-pane-effective: 0px; }
.app-shell.project-collapsed #projectPane,
.app-shell.auto-project-collapsed #projectPane,
.app-shell.inspector-collapsed #inspectorPane,
.app-shell.auto-inspector-collapsed #inspectorPane { border: 0; visibility: hidden; pointer-events: none; }
.app-shell.bottom-collapsed .editor-area { grid-template-rows: 34px 38px minmax(0, 1fr) 32px; }
.app-shell.bottom-collapsed .drawer-content { display: none; }

.pane-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9px;
  z-index: 18;
  cursor: col-resize;
  touch-action: none;
}
.pane-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: transparent;
  transition: background .12s, box-shadow .12s;
}
.pane-resize-handle:hover::after,
body.is-resizing .pane-resize-handle::after { background: var(--cyan); box-shadow: 0 0 7px rgba(85,185,255,.75); }
.project-resizer { left: calc(var(--domain-rail-width) + var(--project-pane-effective, var(--project-pane-width)) - 5px); }
.inspector-resizer { right: calc(var(--inspector-pane-effective, var(--inspector-pane-width)) - 5px); }
.app-shell.project-collapsed .project-resizer,
.app-shell.auto-project-collapsed .project-resizer,
.app-shell.inspector-collapsed .inspector-resizer,
.app-shell.auto-inspector-collapsed .inspector-resizer { display: none; }
body.is-resizing { cursor: col-resize !important; user-select: none !important; }
body.is-resizing * { cursor: col-resize !important; }

.pane-reopen {
  position: absolute;
  top: 10px;
  z-index: 22;
  width: 27px;
  height: 32px;
  display: none;
  place-items: center;
  border: 1px solid #46525b;
  border-radius: 4px;
  background: linear-gradient(#31383e, #242a2f);
  color: #dce3e8;
  box-shadow: 0 5px 16px rgba(0,0,0,.35);
}
.pane-reopen:hover { border-color: #62b8ef; color: #fff; }
.project-reopen { left: calc(var(--domain-rail-width) + 5px); }
.inspector-reopen { right: 5px; }
.app-shell.project-collapsed .project-reopen,
.app-shell.auto-project-collapsed .project-reopen,
.app-shell.inspector-collapsed .inspector-reopen,
.app-shell.auto-inspector-collapsed .inspector-reopen { display: grid; }

@media (max-width: 1550px) {
  :root {
    --domain-rail-width: 176px;
    --project-pane-width: 268px;
    --inspector-pane-width: 290px;
  }
}

@media (max-width: 1370px) {
  :root {
    --domain-rail-width: 170px;
    --project-pane-width: 246px;
    --inspector-pane-width: 270px;
  }
  .command-bar { grid-template-columns: auto minmax(200px, 1fr) auto; }
  .utility-actions { display: none; }
  .domain-title { min-height: 48px; font-size: 14px; }
  .domain-link { padding-inline: 7px; font-size: 11.5px; }
  .start-page { grid-template-columns: minmax(0, 1fr) 320px; }
  .start-actions { grid-template-columns: repeat(3, minmax(112px, 130px)); }
}

@media (max-width: 1180px) {
  :root {
    --domain-rail-width: 170px;
    --project-pane-width: 250px;
    --inspector-pane-width: 286px;
  }
  .command-bar { grid-template-columns: auto minmax(170px, 1fr) auto; }
  .command-button { padding-inline: 8px; }
  .context-summary .metric-chip:nth-child(2) { display: none; }
  .panel-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-toolbar .tool-btn > span:last-child,
  .editor-toolbar > span:last-child { display: none; }
  .tool-btn { padding-inline: 6px; }
  .start-side { padding-inline: 18px; }
}

@media (max-width: 980px) {
  :root {
    --domain-rail-width: 170px;
    --project-pane-width: 246px;
  }
  .command-bar { grid-template-columns: auto minmax(135px, 1fr) auto; gap: 5px; }
  .command-bar .primary-actions .command-button,
  .command-bar .run-actions .command-button { width: 34px; padding: 0; }
  .command-bar .primary-actions .command-button > span:not(.cmd-icon),
  .command-bar .run-actions .command-button > span:not(.cmd-icon) { display: none; }
  .site-selector > span, .connection-chip { display: none; }
  .site-selector { padding-left: 0; }
  .site-selector select { min-width: 92px; border-left: 0; }
  .context-summary .metric-chip:nth-child(1) { display: none; }
  .view-header { flex-wrap: wrap; gap: 10px; }
  .view-actions { max-width: 100%; overflow-x: auto; }
  .panel-grid.cols-2, .panel-grid.cols-3 { grid-template-columns: 1fr; }
  .pin-map-shell { grid-template-columns: 160px minmax(430px, 1fr) 190px; }
  .status-right .status-item:nth-child(-n+4) { display: none; }
}

@media (max-width: 820px) {
  :root {
    --domain-rail-width: 162px;
    --project-pane-width: 254px;
  }
  .brand-subtitle { display: none; }
  .menu-root { min-width: 42px; padding-inline: 8px; }
  .command-bar { grid-template-columns: auto 1fr auto; }
  .context-actions { min-width: 0; }
  .context-summary { display: none; }
  .breadcrumb-row { padding-right: 4px; }
  .domain-rail { padding-inline: 6px; }
  .domain-title { font-size: 13px; letter-spacing: .35px; }
  .domain-link { grid-template-columns: 18px minmax(0,1fr); gap: 5px; padding-inline: 6px; }
  .start-page { grid-template-columns: 1fr; }
  .start-side { display: none; }
  .start-main { padding: 28px 22px; }
  .start-actions { grid-template-columns: repeat(3, minmax(96px, 1fr)); }
  .drawer-tab { padding-inline: 6px; font-size: 11px; }
  .drawer-tab:nth-of-type(n+4) { display: none; }
}

@media (max-width: 560px) {
  :root { --domain-rail-width: 150px; }
  .os-titlebar { height: 32px; }
  .brand-title { font-size: 12px; }
  .window-actions button { width: 38px; }
  .menu-root { min-width: 39px; padding-inline: 6px; font-size: 12px; }
  .command-bar { padding-inline: 5px; }
  .context-actions .icon-button { display: none; }
  .domain-link { font-size: 11px; }
  .start-actions { grid-template-columns: 1fr; }
  .status-left .status-item:nth-child(n+2) { display: none; }
}
