:root {
  color-scheme: dark;
  --bg-0: #0d0f14;
  --bg-1: #11131a;
  --bg-2: #171a23;
  --bg-3: #1d202b;
  --bg-4: #262a36;
  --bg-hover: #2d3240;
  --line: #303543;
  --line-strong: #41485a;
  --text: #f3f5fb;
  --text-2: #c6cbd8;
  --muted: #858c9e;
  --accent: #8d70ff;
  --accent-2: #62dce0;
  --accent-soft: rgba(141, 112, 255, .18);
  --selection: #6c8cff;
  --danger: #ff697b;
  --warning: #ffbd4a;
  --success: #4ed19f;
  --page-shadow: 0 15px 46px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .4);
  --toolbar-width: 48px;
  --left-panel-width: 194px;
  --right-panel-width: 306px;
  --titlebar-height: 44px;
  --controlbar-height: 42px;
  --statusbar-height: 30px;
  --radius: 7px;
  --font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg-0); color: var(--text); font: 12px/1.4 var(--font-ui); user-select: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }

.app-shell {
  width: 100%; height: 100%; display: grid;
  grid-template-rows: var(--titlebar-height) var(--controlbar-height) minmax(0, 1fr) var(--statusbar-height);
  background: var(--bg-1);
}

.titlebar {
  position: relative; z-index: 50; display: grid;
  grid-template-columns: auto auto minmax(160px, 1fr) auto;
  align-items: center; gap: 16px; height: var(--titlebar-height); padding: 0 10px;
  background: linear-gradient(#171a22, #12141b); border-bottom: 1px solid #06070a;
}
.brand { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.brand-mark { width: 25px; height: 25px; }
.brand-name { font-size: 13px; font-weight: 760; letter-spacing: .01em; }
.brand-edition { padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.menubar { display: flex; height: 100%; align-items: center; }
.menu-trigger { height: 28px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); cursor: default; }
.menu-trigger:hover, .menu-trigger.open { background: var(--bg-hover); color: var(--text); }
.document-title-wrap { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; }
.document-title { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: transparent; color: var(--text-2); font-weight: 600; }
.document-title:hover { color: var(--text); }
.dirty-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--text-2); opacity: 0; transition: opacity .15s; }
.dirty-indicator.visible { opacity: .9; }
.title-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }

.button, .icon-button, .status-button, .zoom-value, .preflight-status, .constraint-button {
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg-3); color: var(--text-2); cursor: pointer;
}
.button { min-height: 28px; padding: 4px 11px; font-weight: 650; }
.button:hover, .icon-button:hover, .status-button:hover, .zoom-value:hover, .preflight-status:hover, .constraint-button:hover { background: var(--bg-hover); color: var(--text); border-color: var(--line-strong); }
.button:active, .icon-button:active, .status-button:active { transform: translateY(1px); }
.button-primary { border-color: transparent; color: #101117; background: linear-gradient(135deg, #a88cff, #65d8df); box-shadow: 0 4px 13px rgba(105, 129, 255, .2); }
.button-primary:hover { border-color: transparent; color: #08090c; filter: brightness(1.06); }
.button-quiet { background: var(--bg-2); }
.button.small { min-height: 24px; padding: 2px 8px; font-size: 11px; }
.icon-button { width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; }
.icon-button svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.icon-button.small { width: 25px; height: 25px; border-color: transparent; background: transparent; }
.icon-button.tiny { width: 20px; height: 20px; border-color: transparent; background: transparent; font-size: 14px; }
.icon-button.danger:hover { color: var(--danger); }
.icon-button:disabled, .button:disabled, .constraint-button:disabled { opacity: .35; cursor: default; transform: none; }

.controlbar {
  position: relative; z-index: 40; display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 54px;
  background: var(--bg-2); border-bottom: 1px solid #090b10; box-shadow: 0 1px 0 var(--line) inset;
  overflow: hidden;
}
.control-group { display: flex; align-items: center; gap: 7px; }
.selection-summary { min-width: 132px; max-width: 170px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.selection-summary span:last-child { overflow: hidden; text-overflow: ellipsis; }
.selection-type-icon { width: 18px; color: var(--text-2); font-size: 14px; text-align: center; }
.control-divider { width: 1px; height: 24px; background: var(--line); margin: 0 2px; }
.control-spacer, .spacer { flex: 1; }
.compact-field { height: 27px; display: flex; align-items: center; gap: 5px; padding: 0 5px 0 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg-1); color: var(--muted); }
.compact-field:focus-within { border-color: var(--accent); }
.compact-field input { width: 53px; height: 24px; border: 0; padding: 0; background: transparent; color: var(--text); outline: none; }
.compact-field-wide input { width: 42px; }
.compact-field input:disabled { color: var(--muted); }
.constraint-button { width: 25px; height: 27px; padding: 0; border-color: transparent; background: transparent; }
.constraint-button[aria-pressed="true"] { color: var(--accent-2); background: rgba(98, 220, 224, .1); }

.editor-grid { min-height: 0; display: grid; grid-template-columns: var(--toolbar-width) var(--left-panel-width) minmax(0, 1fr) var(--right-panel-width); overflow: hidden; }
.editor-grid.left-collapsed { grid-template-columns: var(--toolbar-width) 0 minmax(0, 1fr) var(--right-panel-width); }
.editor-grid.right-collapsed { grid-template-columns: var(--toolbar-width) var(--left-panel-width) minmax(0, 1fr) 0; }
.editor-grid.left-collapsed.right-collapsed { grid-template-columns: var(--toolbar-width) 0 minmax(0, 1fr) 0; }

.toolbar {
  position: relative; z-index: 30; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 5px;
  background: #151821; border-right: 1px solid #080a0f;
}
.tool { position: relative; width: 36px; height: 34px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #aeb4c3; cursor: pointer; }
.tool svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tool[data-tool="select"] svg, .tool[data-tool="direct"] svg, .tool[data-tool="text"] svg { fill: currentColor; stroke: none; }
.tool:hover { background: var(--bg-hover); color: var(--text); }
.tool.active { background: var(--accent-soft); color: #b7a5ff; border-color: rgba(141,112,255,.55); box-shadow: 0 0 0 1px rgba(141,112,255,.08) inset; }
.tool kbd { position: absolute; right: 2px; bottom: 0; color: var(--muted); font: 7px var(--font-ui); opacity: 0; }
.tool:hover kbd { opacity: .8; }
.tool-separator { width: 28px; height: 1px; margin: 4px 0; background: var(--line); }
.tool-spacer { flex: 1; }
.fill-stroke-widget { position: relative; width: 39px; height: 43px; margin-bottom: 4px; }
.colour-chip { position: absolute; width: 23px; height: 23px; border-radius: 3px; box-shadow: 0 0 0 1px #090a0e, 0 0 0 2px #7e8494; cursor: pointer; }
.stroke-chip { top: 2px; left: 11px; background: #111; }
.fill-chip { top: 12px; left: 2px; background: white; }
.swap-colours, .default-colours { position: absolute; width: 14px; height: 14px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.swap-colours { right: 0; top: 17px; }
.default-colours { right: 0; bottom: 0; }

.sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-2); overflow: hidden; }
.left-sidebar { border-right: 1px solid #080a0f; }
.right-sidebar { border-left: 1px solid #080a0f; }
.editor-grid.left-collapsed .left-sidebar, .editor-grid.right-collapsed .right-sidebar { visibility: hidden; }
.panel-heading-row { height: 36px; display: flex; align-items: center; padding: 0 8px 0 11px; border-bottom: 1px solid var(--line); }
.panel-title { font-weight: 750; letter-spacing: .02em; }
.panel-heading-actions { margin-left: auto; display: flex; gap: 2px; }
.sidebar-footer { min-height: 31px; display: flex; align-items: center; padding: 2px 6px; border-top: 1px solid var(--line); }
.page-list { flex: 1; min-height: 0; overflow: auto; padding: 9px 7px 20px; scrollbar-color: #4a5060 transparent; scrollbar-width: thin; }
.page-item { position: relative; display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 5px; align-items: start; padding: 7px 5px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); cursor: default; }
.page-item:hover { background: rgba(255,255,255,.035); }
.page-item.selected { background: var(--accent-soft); border-color: rgba(141,112,255,.42); color: var(--text); }
.page-number { padding-top: 3px; text-align: center; font-size: 10px; font-weight: 700; }
.page-thumb-wrap { display: grid; place-items: center; min-height: 100px; }
.page-thumb { max-width: 112px; max-height: 136px; background: white; box-shadow: 0 2px 7px rgba(0,0,0,.45); }
.page-name { grid-column: 2; padding-top: 3px; text-align: center; color: var(--text-2); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.workspace { min-width: 0; min-height: 0; position: relative; background: #30343e; outline: none; overflow: hidden; }
.workspace-scroller { position: absolute; inset: 0; overflow: auto; scrollbar-color: #5a6070 #2b2f38; scrollbar-width: thin; }
.pasteboard { position: relative; min-width: 100%; min-height: 100%; padding: 70px 90px 160px; }
.page-stage { width: max-content; min-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 52px; }
.page-shell { position: relative; flex: none; }
.page-label { position: absolute; left: 0; top: -24px; color: #aeb4c1; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.page-bleed { position: absolute; pointer-events: none; border: 1px solid rgba(255, 71, 91, .85); }
.page-canvas { position: relative; overflow: hidden; background: #fff; color: #111; box-shadow: var(--page-shadow); transform-origin: 0 0; isolation: isolate; }
.page-canvas.grid-visible { background-image: linear-gradient(to right, rgba(60,100,255,.10) 1px, transparent 1px), linear-gradient(to bottom, rgba(60,100,255,.10) 1px, transparent 1px); }
.page-margin { position: absolute; pointer-events: none; border: 1px solid rgba(206, 75, 255, .55); }
.page-column-guide { position: absolute; top: 0; bottom: 0; border-left: 1px solid rgba(206,75,255,.35); pointer-events: none; }
.page-canvas.preview .page-margin, .page-canvas.preview .page-column-guide, .page-shell.preview .page-bleed, .page-canvas.preview .layout-object.selected::after, .page-canvas.preview .resize-handle { display: none !important; }
.page-canvas.preview .layout-object { cursor: default !important; }

.layout-object { position: absolute; transform-origin: 50% 50%; touch-action: none; cursor: move; }
.layout-object.locked { cursor: not-allowed; }
.layout-object.hidden-object { display: none; }
.layout-object.selected { z-index: var(--object-z); }
.layout-object.selected::after { content: ""; position: absolute; inset: -1px; border: 1px solid var(--selection); pointer-events: none; z-index: 1000; }
.layout-object.primary-selected::after { border-width: 1.5px; }
.layout-object-inner { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.layout-object.text-object .layout-object-inner { white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; pointer-events: auto; cursor: text; outline: none; }
.layout-object.text-object .layout-object-inner[contenteditable="true"] { overflow: auto; cursor: text; background: rgba(255,255,255,.06); caret-color: #2d65ff; }
.layout-object.image-object .layout-object-inner { display: grid; place-items: center; background: repeating-conic-gradient(#e7e7e7 0 25%, #f5f5f5 0 50%) 50%/14px 14px; }
.layout-object.image-object img { display: block; width: 100%; height: 100%; pointer-events: none; }
.layout-object.line-object .layout-object-inner { overflow: visible; }
.layout-object.placeholder-object .layout-object-inner::before { content: "Image"; color: #777; font: 10px var(--font-ui); }
.layout-object.overset::before { content: "+"; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; display: grid; place-items: center; z-index: 12; background: white; color: #df364b; border: 1px solid #df364b; font: 700 10px/1 var(--font-ui); }
.resize-handle { position: absolute; width: 8px; height: 8px; border: 1px solid #315fe5; background: white; z-index: 1002; pointer-events: auto; }
.resize-handle.nw { left: -4px; top: -4px; cursor: nwse-resize; }
.resize-handle.n { left: calc(50% - 4px); top: -4px; cursor: ns-resize; }
.resize-handle.ne { right: -4px; top: -4px; cursor: nesw-resize; }
.resize-handle.e { right: -4px; top: calc(50% - 4px); cursor: ew-resize; }
.resize-handle.se { right: -4px; bottom: -4px; cursor: nwse-resize; }
.resize-handle.s { left: calc(50% - 4px); bottom: -4px; cursor: ns-resize; }
.resize-handle.sw { left: -4px; bottom: -4px; cursor: nesw-resize; }
.resize-handle.w { left: -4px; top: calc(50% - 4px); cursor: ew-resize; }
.rotation-handle { position: absolute; width: 10px; height: 10px; left: calc(50% - 5px); top: -24px; border: 1px solid #315fe5; background: white; border-radius: 50%; cursor: grab; z-index: 1002; }
.rotation-handle::after { content:""; position:absolute; left:4px; top:9px; width:1px; height:13px; background:#315fe5; }
.marquee { position: absolute; border: 1px solid var(--selection); background: rgba(81, 121, 255, .12); pointer-events: none; z-index: 9999; }
.smart-guide { position: absolute; z-index: 100; pointer-events: none; background: #ff4bd8; box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
.smart-guide-x { width: 1px; top: 0; bottom: 0; }
.smart-guide-y { height: 1px; left: 0; right: 0; }
.ime-input { position: fixed; left: -10000px; top: -10000px; width: 1px; height: 1px; opacity: 0; }
.workspace.hand-mode .page-canvas, .workspace.hand-mode .layout-object { cursor: grab; }
.workspace.hand-mode.dragging .page-canvas, .workspace.hand-mode.dragging .layout-object { cursor: grabbing; }
.workspace.zoom-mode .page-canvas { cursor: zoom-in; }

.panel-tabs { min-height: 36px; display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.panel-tab { position: relative; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 0 3px; font-size: 10.5px; cursor: pointer; }
.panel-tab:hover { color: var(--text); background: rgba(255,255,255,.025); }
.panel-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.badge { display: inline-grid; place-items: center; min-width: 15px; height: 15px; margin-left: 2px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: white; font-size: 9px; }
.panel-content { flex: 1; min-height: 0; display: none; overflow: auto; scrollbar-width: thin; scrollbar-color: #4a5060 transparent; }
.panel-content.active { display: block; }
.empty-state { padding: 42px 24px; text-align: center; color: var(--muted); }
.empty-state-icon { margin-bottom: 11px; color: var(--line-strong); font-size: 36px; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--text-2); }
.empty-state p { margin: 0 0 16px; font-size: 11px; }
.panel-toolbar { min-height: 34px; display: flex; align-items: center; gap: 5px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.panel-section { border-bottom: 1px solid var(--line); }
.section-heading { min-height: 32px; display: flex; align-items: center; padding: 0 9px 0 11px; color: var(--text-2); font-weight: 700; }
.section-heading button { margin-left: auto; }

.property-section { border-bottom: 1px solid var(--line); }
.property-section-title { min-height: 31px; display: flex; align-items: center; padding: 0 10px; color: var(--text-2); font-weight: 730; cursor: default; }
.property-section-body { padding: 7px 9px 10px; }
.property-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.property-grid.one-column { grid-template-columns: 1fr; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 10px; }
.field > span:first-child { padding-left: 1px; }
.field input, .field select, .field textarea, .inline-field input, .inline-field select {
  width: 100%; min-width: 0; height: 28px; border: 1px solid var(--line); border-radius: 5px; padding: 4px 7px; background: var(--bg-1); color: var(--text); outline: none;
}
.field textarea { height: 88px; resize: vertical; line-height: 1.45; user-select: text; }
.field input:focus, .field select:focus, .field textarea:focus, .inline-field input:focus, .inline-field select:focus { border-color: var(--accent); }
.field input[type="color"] { padding: 2px; }
.field input[type="range"] { padding: 0; border: 0; accent-color: var(--accent); }
.inline-field { display: flex; align-items: center; gap: 7px; min-height: 30px; }
.inline-field > label, .inline-field > span { color: var(--muted); }
.inline-field input[type="checkbox"] { width: auto; height: auto; accent-color: var(--accent); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 6px; }
.segmented button { min-height: 24px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button.active { color: var(--text); background: var(--bg-hover); box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.property-actions { display: flex; flex-wrap: wrap; gap: 5px; }

.layer-list { padding: 4px 0 20px; }
.layer-group { border-bottom: 1px solid var(--line); }
.layer-header { height: 31px; display: grid; grid-template-columns: 24px 24px minmax(0,1fr) 24px; align-items: center; padding: 0 5px; background: rgba(255,255,255,.018); color: var(--text-2); font-weight: 700; }
.layer-object { height: 29px; display: grid; grid-template-columns: 24px 24px minmax(0,1fr) 24px; align-items: center; padding: 0 5px 0 16px; color: var(--text-2); border-left: 2px solid transparent; cursor: default; }
.layer-object:hover { background: rgba(255,255,255,.035); }
.layer-object.selected { background: var(--accent-soft); border-left-color: var(--accent); color: var(--text); }
.layer-icon-button { width: 22px; height: 22px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.layer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-type { color: var(--muted); text-align: center; font-size: 10px; }

.style-list { padding: 1px 0 7px; }
.style-item { min-height: 29px; display: flex; align-items: center; gap: 7px; padding: 0 11px; color: var(--text-2); cursor: default; }
.style-item:hover { background: rgba(255,255,255,.035); }
.style-item.active { background: var(--accent-soft); color: var(--text); }
.style-preview { width: 20px; color: var(--muted); font-family: Georgia, serif; font-size: 16px; }
.swatch-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 9px 10px 14px; }
.swatch { position: relative; aspect-ratio: 1; border: 2px solid var(--bg-2); border-radius: 5px; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch:hover { box-shadow: 0 0 0 2px var(--text-2); }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); }
.swatch[title="None"]::after { content:""; position:absolute; left:0; right:0; top:50%; height:2px; background:#ff3d55; transform:rotate(-45deg); }

.preflight-summary { display: flex; align-items: center; gap: 10px; min-height: 65px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.preflight-summary strong { display: block; color: var(--text-2); }
.preflight-summary div div { color: var(--muted); font-size: 10px; }
.status-lamp { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px rgba(255,255,255,.05); }
.status-lamp.ok { background: var(--success); }
.status-lamp.warning { background: var(--warning); }
.status-lamp.error { background: var(--danger); }
.toggle-label { display: flex; align-items: center; gap: 5px; margin-left: auto; color: var(--muted); }
.toggle-label input { accent-color: var(--accent); }
.issue-list { padding: 5px 0 20px; }
.issue { display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 6px; padding: 8px 11px; border-bottom: 1px solid rgba(255,255,255,.035); cursor: pointer; }
.issue:hover { background: rgba(255,255,255,.035); }
.issue-icon { padding-top: 1px; font-weight: 800; }
.issue.error .issue-icon { color: var(--danger); }
.issue.warning .issue-icon { color: var(--warning); }
.issue-title { color: var(--text-2); font-weight: 650; }
.issue-detail { color: var(--muted); font-size: 10px; }
.issue-empty { padding: 30px 20px; text-align: center; color: var(--muted); }

.statusbar { position: relative; z-index: 45; display: flex; align-items: center; gap: 4px; min-width: 0; padding: 0 5px; background: #12141b; border-top: 1px solid #080a0f; color: var(--muted); }
.status-button, .zoom-value, .preflight-status { height: 23px; border-color: transparent; background: transparent; border-radius: 4px; padding: 0 6px; }
.status-message { min-width: 0; max-width: 360px; padding-left: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preflight-status { display: flex; align-items: center; gap: 6px; }
.status-divider { width: 1px; height: 17px; background: var(--line); margin: 0 3px; }
.page-number-field { height: 22px; display: flex; align-items: center; gap: 4px; }
.page-number-field input { width: 36px; height: 21px; border: 1px solid var(--line); border-radius: 4px; padding: 0 3px; background: var(--bg-1); color: var(--text-2); text-align: center; }
.zoom-slider { width: 90px; height: 16px; accent-color: var(--accent); }
.zoom-value { width: 47px; padding: 0 3px; }
.fit-button { font-size: 10px; }

.menu-layer { position: fixed; inset: 0; z-index: 1000; }
.context-menu { position: absolute; min-width: 224px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(28,31,41,.98); box-shadow: 0 16px 45px rgba(0,0,0,.5); backdrop-filter: blur(18px); }
.menu-item { width: 100%; height: 28px; display: grid; grid-template-columns: 20px minmax(0,1fr) auto; gap: 6px; align-items: center; border: 0; border-radius: 4px; padding: 0 7px; background: transparent; color: var(--text-2); text-align: left; cursor: default; }
.menu-item:hover:not(:disabled) { background: var(--accent); color: white; }
.menu-item:disabled { color: #5d6270; }
.menu-item .shortcut { color: inherit; opacity: .65; font-size: 10px; }
.menu-separator { height: 1px; margin: 4px 5px; background: var(--line); }
.menu-subtitle { padding: 5px 9px 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.dialog-layer { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 25px; background: rgba(3,4,7,.64); backdrop-filter: blur(4px); }
.dialog { width: min(560px, calc(100vw - 35px)); max-height: calc(100vh - 50px); display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 11px; background: #1b1e27; box-shadow: 0 25px 85px rgba(0,0,0,.62); overflow: hidden; }
.dialog.wide { width: min(760px, calc(100vw - 35px)); }
.dialog-header { min-height: 52px; display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 15px; }
.dialog-close { margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.dialog-close:hover { background: var(--bg-hover); color: var(--text); }
.dialog-body { min-height: 0; overflow: auto; padding: 17px 18px; user-select: text; }
.dialog-footer { min-height: 54px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 9px 18px; border-top: 1px solid var(--line); }
.dialog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.dialog-grid.three { grid-template-columns: repeat(3, 1fr); }
.dialog-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.dialog-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.dialog-section h3 { margin: 0 0 10px; color: var(--text-2); font-size: 12px; }
.dialog-note { color: var(--muted); font-size: 10px; }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.preset-card { min-height: 74px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2); color: var(--text-2); cursor: pointer; }
.preset-card:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.preset-card.active { border-color: var(--accent); background: var(--accent-soft); }
.preset-shape { border: 1px solid currentColor; opacity: .7; }
.export-option { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2); cursor: pointer; }
.export-option + .export-option { margin-top: 7px; }
.export-option:hover { border-color: var(--line-strong); }
.export-option.active { border-color: var(--accent); background: var(--accent-soft); }
.export-option input { margin-top: 3px; accent-color: var(--accent); }
.export-option strong { display: block; color: var(--text-2); }
.export-option span { color: var(--muted); font-size: 10px; }
.about-logo { display: flex; align-items: center; gap: 15px; margin-bottom: 16px; }
.about-logo img { width: 52px; height: 52px; }
.about-logo h2 { margin: 0 0 2px; font-size: 19px; }
.about-logo p { margin: 0; color: var(--muted); }
.shortcut-table { width: 100%; border-collapse: collapse; }
.shortcut-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.shortcut-table td:last-child { text-align: right; }
kbd.key { display: inline-block; min-width: 22px; padding: 2px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--bg-1); color: var(--text-2); font: 10px var(--font-ui); text-align: center; }
.progress { height: 6px; overflow: hidden; border-radius: 4px; background: var(--bg-0); }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .15s; }

.toast-region { position: fixed; right: 15px; bottom: 43px; z-index: 1500; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; pointer-events: none; }
.toast { min-width: 220px; max-width: 420px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(28,31,41,.96); color: var(--text-2); box-shadow: 0 10px 35px rgba(0,0,0,.42); animation: toast-in .18s ease-out; }
.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.error { border-left: 3px solid var(--danger); }
.toast strong { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

body.dragging, body.dragging * { user-select: none !important; }
body.text-editing, body.text-editing * { user-select: text; }

@media (max-width: 1050px) {
  :root { --left-panel-width: 160px; --right-panel-width: 270px; }
  .menubar { display: none; }
  .titlebar { grid-template-columns: auto minmax(120px, 1fr) auto; }
  .controlbar .compact-field-wide, .controlbar .control-divider:nth-of-type(2) { display: none; }
}
@media (max-width: 760px) {
  :root { --left-panel-width: 0px; --right-panel-width: 260px; }
  .left-sidebar { visibility: hidden; }
  .editor-grid { grid-template-columns: var(--toolbar-width) 0 minmax(0,1fr) var(--right-panel-width); }
  .selection-summary, .controlbar > .control-divider:first-of-type, #quickX, #quickY { display: none; }
  .controlbar { padding-left: 53px; }
}
.dialog > form { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.dialog > form > .dialog-body { flex: 1; }
.group-object > .layout-object-inner { overflow: visible; }
