:root {
  color-scheme: dark;
  --font-ui: Inter, "Segoe UI", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --chrome: #1d1d1d;
  --toolbar: #242424;
  --panel: #242424;
  --panel-2: #2a2a2a;
  --field: #1b1b1b;
  --hover: #363636;
  --selection: #414141;
  --stroke: #393939;
  --stroke-strong: #4a4a4a;
  --workspace: #151515;
  --ruler: #202020;
  --ruler-mark: #5a5a5a;
  --ruler-text: #aaaaaa;
  --text: #f2f2f2;
  --muted: #b1b1b1;
  --subtle: #a0a0a0;
  --accent: #dedede;
  --accent-fill: #545454;
  --accent-hover: #636363;
  --accent-soft: #414141;
  --accent-border: #6c6c6c;
  --positive: #72d3a6;
  --negative: #ffa5ae;
  --checker-a: #eeeeee;
  --checker-b: #c8c8c8;
  --rail-width: 56px;
  --inspector-width: 292px;
  --ruler-size: 24px;
  --radius: 6px;
  font-size: 14px;
}

:root[data-theme="light"],
body[data-theme="light"],
body.theme-light {
  color-scheme: light;
  --chrome: #ffffff;
  --toolbar: #f5f5f5;
  --panel: #ffffff;
  --panel-2: #f4f4f4;
  --field: #ffffff;
  --hover: #eaeaea;
  --selection: #e7effb;
  --stroke: #dedede;
  --stroke-strong: #bfbfbf;
  --workspace: #e6e6e6;
  --ruler: #f4f4f4;
  --ruler-mark: #a1a1a1;
  --ruler-text: #505050;
  --text: #222222;
  --muted: #565656;
  --subtle: #686868;
  --accent: #1d54b5;
  --accent-fill: #2463c7;
  --accent-hover: #1b51aa;
  --accent-soft: #e8effb;
  --accent-border: #a0b8dd;
  --positive: #18784c;
  --negative: #a33e52;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--chrome);
  color: var(--text);
  font: 400 1rem/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

button,
select,
input,
textarea {
  color: inherit;
  font: inherit;
}

button {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: default;
  opacity: .46;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input,
select,
textarea {
  min-width: 0;
}

input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  accent-color: var(--accent-fill);
}

input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0;
}

input[type="range"] {
  appearance: none;
  height: 4px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--stroke-strong);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

input[type="number"],
input[type="text"],
input[type="search"],
input[type="url"],
input[type="email"],
input:not([type]),
select,
textarea {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 0 8px;
  background: var(--field);
  color: var(--text);
}

input[type="number"] {
  appearance: textfield;
  font-variant-numeric: tabular-nums;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

input[type="color"] {
  width: 34px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  background: var(--field);
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 3px; }

select {
  appearance: none;
  padding-right: 25px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%23797979' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 7px center;
  background-repeat: no-repeat;
  background-size: 12px;
}

textarea {
  min-height: 64px;
  padding: 7px 8px;
  resize: vertical;
}

svg { flex-shrink: 0; vertical-align: middle; }
.symbols { position: absolute; width: 0; height: 0; pointer-events: none; }
.ui-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1, h2, h3, p { margin: 0; }

* {
  scrollbar-color: var(--stroke-strong) transparent;
  scrollbar-width: thin;
}

.topbar {
  z-index: 4;
  display: flex;
  flex: 0 0 58px;
  min-width: 0;
  align-items: center;
  gap: 13px;
  padding: 0 16px 0 14px;
  border-bottom: 1px solid var(--stroke);
  background: var(--chrome);
}

.brand-group,
.brand,
.top-actions,
.menubar {
  display: flex;
  min-width: 0;
  align-items: center;
}

.brand-group {
  flex: 0 0 auto;
  gap: 13px;
  padding-right: 11px;
  border-right: 1px solid var(--stroke);
}

.brand {
  gap: 9px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.035em;
  white-space: nowrap;
}

.brand > img {
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.brand > span { padding-right: 1px; }
.home-button { margin-left: 1px; }

.menubar {
  flex: 1;
  gap: 1px;
  align-self: stretch;
  overflow: auto hidden;
  scrollbar-width: none;
}

.menubar::-webkit-scrollbar,
.context::-webkit-scrollbar,
.tabs::-webkit-scrollbar { display: none; }

.menu-button,
.menubar > button {
  flex: 0 0 auto;
  border-radius: var(--radius);
  padding: 7px clamp(5px, .63vw, 10px);
  color: var(--muted);
  font-size: .93rem;
  white-space: nowrap;
}

.menu-button:hover,
.menubar > button:hover,
.menu-button[aria-expanded="true"],
.menubar > button[aria-expanded="true"] {
  background: var(--hover);
  color: var(--text);
}

.top-actions { flex: 0 0 auto; gap: 8px; }
.top-actions-divider {
  width: 1px;
  height: 25px;
  margin: 0 2px;
  background: var(--stroke);
}

.button,
.btn,
.app-button {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
}

.button:hover:not(:disabled),
.btn:hover:not(:disabled),
.app-button:hover:not(:disabled) { background: var(--hover); }

.button .ui-icon,
.btn .ui-icon { width: 15px; height: 15px; }

.button-primary,
.btn-primary,
.app-primary,
button.primary {
  border-color: transparent;
  background: var(--accent-fill);
  color: #fff;
}

.button-primary:hover:not(:disabled),
.btn-primary:hover:not(:disabled),
.app-primary:hover:not(:disabled),
button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
}

.button-danger,
.btn-danger { color: var(--negative); }

.share-button { background: transparent; }
.export-button { padding-inline: 11px; }

.icon-button,
.app-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--muted);
  vertical-align: middle;
}

.icon-button:hover:not(:disabled),
.app-icon:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.icon-button[aria-pressed="true"]:not(:disabled),
.icon-button[aria-expanded="true"]:not(:disabled),
.icon-button.is-active:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

.profile-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--stroke-strong);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.profile-button .ui-icon { width: 16px; height: 16px; }

.editor-view {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-rows: 43px minmax(0, 1fr) 35px;
}

.contextbar {
  z-index: 3;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding-inline: 10px 12px;
  border-bottom: 1px solid var(--stroke);
  background: var(--toolbar);
}

.history-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  padding-right: 10px;
  border-right: 1px solid var(--stroke-strong);
}

.history-actions .ui-icon { width: 16px; height: 16px; }

.context {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%;
  align-items: center;
  gap: 10px;
  overflow: auto hidden;
  white-space: nowrap;
  scrollbar-width: none;
}

.context > * { flex-shrink: 0; }
.context > span { color: var(--muted); font-size: .89rem; }
.context > span b { color: var(--text); font-weight: 600; }
.context .context-tool { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.context-tool svg { color: var(--accent); }
.context .context-unit { color: var(--subtle); }

.context-title,
.context-name,
.context > strong {
  color: var(--text);
  font-size: .91rem;
  font-weight: 650;
}

.context-divider {
  align-self: stretch;
  width: 1px;
  min-width: 1px;
  margin-block: 10px;
  background: var(--stroke-strong);
}

.context-field,
.context > label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .88rem;
}

.context-field input:not([type="checkbox"]):not([type="range"]),
.context-field select,
.context > label input:not([type="checkbox"]):not([type="range"]),
.context > label select,
.context > input:not([type="checkbox"]):not([type="range"]),
.context > select {
  height: 27px;
  font-size: .88rem;
}

.context-field input[type="number"],
.context input[type="number"] { width: 57px; }

.context-field input[type="range"],
.context input[type="range"] { width: 66px; }

.context-button {
  display: inline-flex;
  min-width: 27px;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius);
  padding-inline: 6px;
  color: var(--muted);
  font-size: .9rem;
}

.context-button:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.context-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.editing-frame {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: var(--rail-width) minmax(0, 1fr) var(--panel-width, var(--inspector-width));
}

.editing-frame:has(#inspector[hidden]),
.editing-frame.panels-hidden,
.editor-view.panels-hidden .editing-frame,
.editor-view.without-inspector .editing-frame { grid-template-columns: var(--rail-width) minmax(0, 1fr); }

.editor-view.without-inspector .inspector { display: none; }

.toolrail {
  z-index: 2;
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  overflow: auto;
  padding: 9px 5px 10px;
  border-right: 1px solid var(--stroke);
  background: var(--toolbar);
  scrollbar-width: none;
}

.toolrail::-webkit-scrollbar { display: none; }

.tool-group {
  position: relative;
  flex: 0 0 auto;
  width: 37px;
}

.tool-button,
.toolrail > button[data-tool] {
  display: grid;
  position: relative;
  flex: 0 0 auto;
  width: 37px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
}

.tool-button > svg { width: 19px; height: 19px; }
.tool-button:hover:not(:disabled),
.toolrail > button[data-tool]:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.tool-button.is-active,
.tool-button.active,
.tool-button[aria-pressed="true"],
.toolrail > button[data-tool][aria-pressed="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.tool-expand {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  width: 12px;
  height: 12px;
  place-items: end;
  padding: 0 3px 3px 0;
  border-radius: 2px;
  color: var(--subtle);
}

.tool-expand:not(:has(svg))::after {
  width: 0;
  height: 0;
  border-width: 0 0 4px 4px;
  border-style: solid;
  border-color: transparent transparent currentColor transparent;
  content: "";
}

.tool-expand svg { width: 9px; height: 9px; }
.tool-expand:hover { background: var(--accent-soft); color: var(--accent); }

.tool-separator,
.tool-divider {
  flex: 0 0 auto;
  width: 26px;
  height: 1px;
  margin-block: 3px;
  border: 0;
  background: var(--stroke-strong);
}

.tool-colors,
.tool-swatches,
.color-tools {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  width: 39px;
  min-height: 53px;
  align-items: flex-end;
  justify-content: center;
  margin-top: auto;
  padding-top: 6px;
}

.tool-colors .layer-color { position: absolute; }
.tool-colors .color-background { right: 2px; top: 17px; }
.tool-colors .color-foreground { z-index: 1; left: 3px; top: 10px; }
.tool-colors .color-swap { position: absolute; top: -2px; right: -4px; }
.tool-colors .color-default { position: absolute; bottom: -8px; left: -5px; }
.tool-colors .color-swap svg, .tool-colors .color-default svg { width: 11px; height: 11px; }

.tool-colors input[type="color"],
.tool-swatches input[type="color"],
.color-tools input[type="color"] { width: 26px; height: 23px; }

.tool-colors .icon-button,
.tool-swatches .icon-button,
.color-tools .icon-button { width: 20px; height: 20px; }

.swatch-group {
  position: relative;
  width: 36px;
  height: 34px;
}

.swatch-group input[type="color"] {
  position: absolute;
  width: 25px;
  height: 25px;
}

.swatch-group input[type="color"]:first-child { z-index: 1; top: 0; left: 0; }
.swatch-group input[type="color"]:nth-child(2) { right: 0; bottom: 0; }

.workspace {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 43px minmax(0, 1fr);
  background: var(--workspace);
}

.tabstrip {
  display: flex;
  min-width: 0;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid var(--stroke);
  background: var(--chrome);
}

.tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: stretch;
  gap: 3px;
  padding-left: 6px;
  overflow: auto hidden;
  scrollbar-width: none;
}

.project-tab,
.document-tab,
.tab,
.tab-item {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  max-width: 216px;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  padding: 0 7px 0 11px;
  color: var(--muted);
  font-size: .92rem;
  text-align: left;
  white-space: nowrap;
}

.project-tab:hover,
.document-tab:hover,
.tab:hover,
.tab-item:hover { background: var(--hover); color: var(--text); }

:is(.project-tab, .document-tab, .tab, .tab-item):is(.is-active, .active, [aria-selected="true"], [aria-current="true"]) {
  border-color: var(--stroke);
  border-top-color: var(--accent-fill);
  border-bottom-color: transparent;
  background: var(--panel-2);
  color: var(--text);
}

:is(.project-tab, .document-tab, .tab, .tab-item) > svg { color: var(--accent); }
.tab-name,
.tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-label {
  display: flex;
  min-height: 100%;
  align-items: center;
  gap: 6px;
}
.tab-label > svg { color: var(--accent); }
.tab-label > span { overflow: hidden; text-overflow: ellipsis; }
.tab-add { display: grid; width: 29px; height: 29px; place-items: center; border-radius: var(--radius); color: var(--muted); }
.tab-add:hover { background: var(--hover); color: var(--text); }

.tab-close {
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  border-radius: 4px;
  color: var(--subtle);
}

.tab-close:hover { background: var(--stroke); color: var(--text); }
.tab-add,
.new-tab,
.tabs > .icon-button { align-self: center; }

.tab-dirty,
.tab-unsaved {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.workspace-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  padding-inline: 5px 8px;
  border-left: 1px solid var(--stroke);
}

.workspace-actions .icon-button { width: 29px; height: 29px; }
.workspace-actions .ui-icon { width: 16px; height: 16px; }

.workspace-body {
  position: relative;
  min-width: 0;
  min-height: 0;
  isolation: isolate;
}

.viewport {
  position: absolute;
  inset: var(--ruler-size) 0 0 var(--ruler-size);
  overflow: auto;
  overscroll-behavior: contain;
}

.workspace-body:has(.ruler-x[hidden]) .viewport,
.workspace-body.rulers-hidden .viewport,
.editor-view.rulers-hidden .viewport,
.editor-view.without-rulers .viewport { top: 0; }

.workspace-body:has(.ruler-y[hidden]) .viewport,
.workspace-body.rulers-hidden .viewport,
.editor-view.rulers-hidden .viewport,
.editor-view.without-rulers .viewport { left: 0; }

.ruler-origin,
.ruler {
  position: absolute;
  z-index: 1;
  display: block;
  background: var(--ruler);
  pointer-events: none;
}

.ruler-origin {
  top: 0;
  left: 0;
  display: grid;
  width: var(--ruler-size);
  height: var(--ruler-size);
  place-items: center;
  border-right: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
  color: var(--subtle);
  font: 10px var(--font-mono);
}

.ruler-x {
  top: 0;
  left: var(--ruler-size);
  width: calc(100% - var(--ruler-size));
  height: var(--ruler-size);
  border-bottom: 1px solid var(--stroke);
}

.ruler-y {
  top: var(--ruler-size);
  left: 0;
  width: var(--ruler-size);
  height: calc(100% - var(--ruler-size));
  border-right: 1px solid var(--stroke);
}

.workspace-body:has(.ruler-x[hidden]) .ruler-origin,
.workspace-body.rulers-hidden :is(.ruler-origin, .ruler),
.editor-view.rulers-hidden :is(.ruler-origin, .ruler),
.editor-view.without-rulers :is(.ruler-origin, .ruler) { display: none; }

.center {
  display: flex;
  min-width: 100%;
  width: max-content;
  min-height: 100%;
  height: max-content;
  padding: 29px;
}

.stage {
  position: relative;
  flex: 0 0 auto;
  width: min(744px, 66vw);
  aspect-ratio: 3 / 2;
  margin: auto;
  background-color: var(--checker-a);
  background-image: conic-gradient(var(--checker-b) 25%, var(--checker-a) 0 50%, var(--checker-b) 0 75%, var(--checker-a) 0);
  background-size: var(--checker-size, 22px) var(--checker-size, 22px);
  box-shadow: 0 0 0 1px #0004, 0 5px 16px #0003;
  isolation: isolate;
  touch-action: none;
  user-select: none;
}

.stage.transparency-hidden,
.stage[data-transparency="false"] { background: #fff; }
.stage > canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.art { pointer-events: none; }
.overlay { touch-action: none; }
.viewport[data-tool="hand"] .overlay { cursor: grab; }
.viewport[data-tool="hand"] .overlay:active { cursor: grabbing; }
.viewport[data-tool="zoom"] .overlay { cursor: zoom-in; }
.viewport[data-tool="text"] .overlay { cursor: text; }
.viewport:not([data-tool="move"], [data-tool="hand"], [data-tool="zoom"], [data-tool="text"]) .overlay { cursor: crosshair; }
.viewport[data-tool="move"] .overlay { cursor: default; }

.inspector {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--stroke);
  background: var(--panel);
}

.panel-resize {
  position: absolute;
  z-index: 3;
  inset: 0 auto 0 -3px;
  width: 6px;
  cursor: ew-resize;
  touch-action: none;
}

.panel-resize:hover { background: color-mix(in srgb, var(--accent-fill) 60%, transparent); }

.properties {
  flex: 0 1 auto;
  max-height: 57%;
  min-height: 0;
  overflow: auto;
  border-bottom: 1px solid var(--stroke);
}

.panel-section {
  display: grid;
  gap: 11px;
  padding: 13px 14px 14px;
}

.panel-section + .panel-section { border-top: 1px solid var(--stroke); }

.panel-header,
.panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: .97rem;
  font-weight: 650;
}

.panel-header {
  flex: 0 0 auto;
  min-height: 41px;
  padding: 10px 13px 8px;
}

.panel-header > svg,
.panel-heading > svg { width: 16px; height: 16px; color: var(--accent); }
.panel-header > h2,
.panel-heading > :is(h2, h3) { font: inherit; }
.panel-header .icon-button,
.panel-heading .icon-button { width: 24px; height: 24px; margin-left: auto; }

.property-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 10px;
  color: var(--muted);
  font-size: .87rem;
}

.property-identity > :is(span, strong) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.property-identity > svg { color: var(--accent); }
.property-identity > div { flex: 1; min-width: 0; }
.property-identity small { display: block; margin-left: 1px; color: var(--subtle); }
.property-identity input.property-layer-name {
  width: 100%;
  min-height: 22px;
  border-color: transparent;
  padding: 0;
  background: transparent;
  font-weight: 600;
}
.property-identity input.property-layer-name:hover,
.property-identity input.property-layer-name:focus { border-color: var(--stroke); background: var(--field); }
.property-note { color: var(--subtle); font-size: .86rem; }
.properties > .property-note { padding: 0 14px 13px; }
.property-editable { min-width: 0; margin: 0; border: 0; padding: 0; }
.property-editable > .panel-section:first-child { padding-top: 7px; }
.panel-section > h3.panel-heading { font-size: .88rem; color: var(--muted); }
.property-text { display: grid; }
.property-text textarea { min-height: 45px; }
.property-checks,
.property-check { display: flex; align-items: center; gap: 8px; }
.property-checks { gap: 12px; }

.field-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.property-field,
.field {
  display: flex;
  min-width: 0;
  min-height: 29px;
  align-items: center;
  gap: 4px;
  font-size: .88rem;
}

.field-grid > :is(.field, .property-field):has(.field-prefix) {
  gap: 4px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding-inline: 7px;
  background: var(--field);
}

.field-grid > :is(.field, .property-field):has(.field-prefix) > input {
  height: 26px;
  border: 0;
  padding: 0;
  background: transparent;
}

.field-grid .field-unit { color: var(--subtle); font-size: .79rem; }

.field-grid .field-prefix {
  flex: 0 0 auto;
  min-width: 13px;
  color: var(--subtle);
  font-size: .83rem;
  font-weight: 600;
}

.field-grid :is(input:not([type="checkbox"]):not([type="color"]), select, textarea),
.property-field :is(input:not([type="checkbox"]):not([type="color"]), select, textarea) {
  width: 100%;
}
.property-field > :is(select, input[type="text"], input[type="number"]) { min-height: 29px; }
.property-field > span:not(.field-prefix) { color: var(--muted); }
.property-field > :is(select, input[type="range"]) { flex: 1; }
.full-width { grid-column: 1 / -1; }

.layer-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.layer-controls {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
  padding: 0 12px 9px;
  border-bottom: 1px solid var(--stroke);
  color: var(--muted);
  font-size: .88rem;
}

.layer-controls > select,
.layer-controls .layer-control-row > select { width: 100%; min-height: 28px; }

.layer-control-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.layer-control-row > :is(label, span) { white-space: nowrap; }
.layer-blend { flex: 1; min-width: 0; }
.layer-blend > select { width: 100%; height: 28px; }
.layer-opacity input[type="number"] { width: 33px; padding: 0 4px; }
.layer-opacity > span:last-child { color: var(--subtle); }
.layer-control-row input[type="range"] { flex: 1; min-width: 28px; }
.layer-control-row input[type="number"] { width: 45px; height: 25px; }
.layer-control-row output { flex: 0 0 auto; min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }

.layers {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 5px 6px;
}

.layer-row {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 3px 7px;
  text-align: left;
}

.layer-row:hover { background: var(--hover); }
.layer-row:is(.is-selected, .selected, .active, [aria-selected="true"]) {
  border-color: var(--accent-border);
  background: var(--selection);
}

.layer-row :is(.layer-eye, .layer-indicator) {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 24px;
  place-items: center;
  border-radius: 4px;
  color: var(--subtle);
}

.layer-row :is(.layer-eye, .layer-indicator):hover { background: var(--hover); color: var(--text); }
.layer-row svg { pointer-events: none; }
.layer-row .layer-eye[aria-pressed="true"] { background: transparent; color: var(--muted); }
.layer-row .layer-eye[aria-pressed="true"]:hover { background: var(--hover); color: var(--text); }
.layer-row .layer-indicator:not(.is-locked):not(:hover) { color: var(--subtle); opacity: .62; }
.layer-row .layer-indicator.is-locked { color: var(--accent); }

.layer-thumb {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 32px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: 4px;
  background: conic-gradient(var(--checker-b) 25%, var(--checker-a) 0 50%, var(--checker-b) 0 75%, var(--checker-a) 0) 0 0 / 10px 10px;
  color: #353535;
}

.layer-thumb > :is(img, canvas) { width: 100%; height: 100%; object-fit: contain; }
.layer-thumb > svg { width: 15px; height: 15px; }
.layer-main { display: flex; flex: 1; min-width: 0; align-items: center; gap: 7px; }
.layer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: .9rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-name:hover { color: var(--accent); }
.layer-name input,
input.layer-name { width: 100%; min-height: 24px; padding-inline: 4px; }
.layer-row.is-hidden .layer-name { color: var(--subtle); }
.layer-empty { padding: 12px 8px; color: var(--subtle); font-size: .92rem; }

.layer-actions {
  display: flex;
  flex: 0 0 auto;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 4px 7px;
  border-top: 1px solid var(--stroke);
}

.layer-actions > :is(button, .layer-action) {
  display: grid;
  width: 30px;
  height: 29px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--muted);
}

.layer-actions > :is(button, .layer-action):hover:not(:disabled) { background: var(--hover); color: var(--text); }
.layer-actions > :is(button, .layer-action) > svg { width: 16px; height: 16px; }

.statusbar,
.status-left,
.zoom-controls {
  display: flex;
  min-width: 0;
  align-items: center;
}

.statusbar {
  z-index: 3;
  justify-content: space-between;
  gap: 9px;
  padding-inline: 13px 9px;
  border-top: 1px solid var(--stroke);
  background: var(--chrome);
  color: var(--muted);
  font-size: .86rem;
}

.status-left { gap: 10px; overflow: hidden; white-space: nowrap; }
.status-document { overflow: hidden; text-overflow: ellipsis; }
.status-divider { flex: 0 0 1px; width: 1px; height: 15px; background: var(--stroke-strong); }

.status-save { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.status-save::before {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  content: "";
}

.status-save:is([data-status="pending"], [data-status="saving"], [data-status="loading"])::before { background: var(--accent); }
.status-save:is([data-status="error"], [data-status="offline"])::before { background: var(--negative); }
.status-save[data-status="neutral"]::before { background: var(--subtle); }

.zoom-controls { flex-shrink: 0; gap: 5px; }
.zoom-controls .icon-button { width: 25px; height: 25px; }
.zoom-controls .ui-icon { width: 15px; height: 15px; }
.zoom-controls > input { width: clamp(55px, 8vw, 111px); }

.zoom-value {
  flex: 0 0 43px;
  border-radius: var(--radius);
  padding: 3px;
  color: var(--text);
  font: 500 .85rem/1.3 var(--font-mono);
  text-align: center;
}
.zoom-value:hover { background: var(--hover); }

.popup {
  position: fixed;
  z-index: 70;
  min-width: 185px;
  max-width: min(355px, calc(100vw - 16px));
  max-height: calc(100vh - 20px);
  overflow: auto;
  border: 1px solid var(--stroke-strong);
  border-radius: 8px;
  padding: 5px;
  background: var(--panel-2);
  box-shadow: 0 8px 24px #0005;
  color: var(--text);
}

.menu-item,
.popup > button,
.popup [role="menuitem"] {
  display: flex;
  width: 100%;
  min-height: 31px;
  align-items: center;
  gap: 8px;
  border-radius: 4px;
  padding: 5px 8px;
  text-align: left;
  white-space: nowrap;
}

.menu-item:hover:not(:disabled),
.popup > button:hover:not(:disabled),
.popup [role="menuitem"]:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--text);
}

.menu-item-icon { display: grid; flex: 0 0 17px; place-items: center; color: var(--muted); }

.menu-shortcut {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 12px;
  color: var(--subtle);
  font: .82rem var(--font-mono);
}

.menu-separator {
  height: 1px;
  margin: 5px 4px;
  border: 0;
  background: var(--stroke);
}

.modal {
  width: min(530px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--stroke-strong);
  border-radius: 12px;
  padding: 0;
  background: var(--panel);
  box-shadow: 0 18px 55px #0006;
  color: var(--text);
}

.modal::backdrop { background: #0c0c0ca6; }
.modal-content { min-width: 0; padding: 19px; }
.modal-content h2 { font-size: 1.37rem; font-weight: 650; letter-spacing: -.025em; }
.modal-content h3 { font-size: 1.03rem; }
.modal-content p:not(:first-child) { margin-top: 8px; color: var(--muted); }
.modal-content :is(form, .dialog-form, .modal-form) { display: grid; gap: 13px; }
.modal-content :is(header, .dialog-header, .modal-header) { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-content :is(footer, .dialog-actions, .modal-actions) { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 9px; border-top: 1px solid var(--stroke); }
.modal-content label:not(:has(input[type="checkbox"])) { display: grid; min-width: 0; gap: 5px; }
.modal-content label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 7px; }
.modal-content :is(label, .form-hint) { color: var(--muted); font-size: .94rem; }
.modal-content :is(input:not([type="checkbox"]):not([type="color"]):not([type="range"]), select) { min-height: 34px; }
.modal-content :is(input:not([type="checkbox"]):not([type="range"]), select, textarea) { width: 100%; }
.modal-content :is(img, canvas) { max-width: 100%; height: auto; }
.modal-content .field-grid { gap: 11px; }
.modal:has(.dialog-wide) { width: min(745px, calc(100vw - 28px)); }
.dialog-body,
.export-fields { display: grid; gap: 11px; min-width: 0; }
.dialog-columns,
.export-dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.dialog-checks { display: flex; flex-wrap: wrap; gap: 14px; }
.dialog-note { font-size: .9rem; }
.dialog-error:empty { display: none; }
.modal-content p.dialog-error { margin-top: 0; color: var(--negative); }
.modal-content .slider-field { grid-template-columns: 1fr 48px; align-items: center; }
.modal-content .slider-field > input[type="range"] { grid-column: 1 / -1; width: 100%; }
.modal-content .slider-field > output { grid-column: 2; grid-row: 1; text-align: right; }
.export-preview { display: grid; min-width: 0; align-content: start; justify-items: center; gap: 9px; color: var(--muted); }
.export-preview :is(img, canvas) {
  max-height: min(320px, 37vh);
  object-fit: contain;
  border: 1px solid var(--stroke-strong);
  border-radius: 5px;
  background: conic-gradient(var(--checker-b) 25%, var(--checker-a) 0 50%, var(--checker-b) 0 75%, var(--checker-a) 0) 0 0 / 14px 14px;
}
.document-info { display: grid; grid-template-columns: minmax(105px, 1fr) 2fr; gap: 8px; margin: 0; }
.document-info dt { color: var(--muted); }
.document-info dd { margin: 0; }
.history-list { display: grid; max-height: 41vh; gap: 4px; overflow: auto; }
.history-row { display: flex; align-items: center; gap: 8px; border-radius: var(--radius); padding: 7px; text-align: left; }
.history-row:hover,
.history-row[aria-current="true"] { background: var(--accent-soft); }
@media (max-width: 520px) {
  .export-dialog-grid { grid-template-columns: minmax(0, 1fr); }
}

.toast {
  position: fixed;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  right: 15px;
  bottom: 49px;
  max-width: min(410px, calc(100vw - 30px));
  border: 1px solid var(--stroke-strong);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--panel-2);
  box-shadow: 0 5px 18px #0005;
  color: var(--text);
}

.toast > svg { color: var(--positive); }
.toast-error > svg { color: var(--negative); }

.home-view {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: 222px minmax(0, 1fr);
}

.home-sidebar {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--stroke);
  padding: 17px 12px;
  background: var(--panel);
}

.home-main {
  min-height: 0;
  overflow: auto;
  padding: clamp(20px, 4vw, 55px);
  background: var(--workspace);
}

.home-main :is(h1, h2, h3) { letter-spacing: -.027em; }
.home-main h1 { font-size: clamp(24px, 3vw, 36px); line-height: 1.14; }
.home-main h2 { font-size: 1.28rem; }

@media (max-width: 1100px) {
  :root { --inspector-width: 258px; }
  .topbar { gap: 9px; padding-inline: 10px; }
  .brand-group { gap: 8px; padding-right: 8px; }
  .top-actions { gap: 5px; }
  .menubar > button { padding-inline: 5px; }
  .panel-section { padding-inline: 10px; }
}

@media (max-width: 850px) {
  :root { --rail-width: 48px; }
  .topbar { flex-basis: 52px; }
  .brand { gap: 6px; }
  .brand > img { width: 29px; height: 29px; }
  .top-actions-divider { margin: 0; }
  .share-button { width: 32px; min-height: 32px; padding: 0; }
  .share-button > span { display: none; }
  .editor-view { grid-template-rows: 39px minmax(0, 1fr) 33px; }
  .center { padding: 22px; }
}

@media (max-width: 650px) {
  :root { --ruler-size: 20px; }
  .brand > span { display: none; }
  .brand-group { gap: 3px; padding-right: 4px; }
  .topbar { gap: 6px; padding-inline: 7px; }
  .top-actions { gap: 2px; }
  .top-actions .button { width: 31px; min-height: 31px; padding: 0; }
  .top-actions .button > span,
  .top-actions-divider { display: none; }
  .apps-button { width: 29px; }
  .profile-button { width: 29px; height: 29px; }
  .contextbar { gap: 6px; padding-inline: 5px; }
  .history-actions { gap: 0; padding-right: 5px; }
  .history-actions .icon-button { width: 27px; }
  .context { gap: 7px; }
  .editing-frame { grid-template-columns: var(--rail-width) minmax(0, 1fr); }
  .inspector {
    position: absolute;
    inset: 43px 0 0 auto;
    width: min(var(--panel-width, var(--inspector-width)), calc(100% - var(--rail-width)));
    box-shadow: -5px 0 14px #0003;
  }
  .center { padding: 16px; }
  .statusbar { gap: 4px; padding-inline: 6px; }
  .status-left { gap: 5px; }
  .status-left .status-divider,
  .status-document,
  .zoom-controls .fit-button { display: none; }
  .zoom-controls { gap: 1px; }
  .zoom-controls > input { width: 49px; }
  .home-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .home-sidebar { display: flex; gap: 5px; overflow: auto hidden; padding: 7px; }
  .home-main { padding: 15px; }
}

@media (max-height: 660px) {
  .toolrail { gap: 2px; padding-block: 5px; }
  .tool-button, .toolrail > button[data-tool] { height: 30px; }
  .tool-separator, .tool-divider { margin-block: 2px; }
}

body[data-screen="home"] .home-button {
  background: var(--accent-soft);
  color: var(--accent);
}

.history-row time {
  margin-left: auto;
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

.print-image { display: none; }

@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  body:has(.print-image) { display: block; }
  body:has(.print-image) > :not(.print-image) { display: none !important; }
  .print-image { display: block; max-width: 100%; max-height: 95vh; margin: auto; object-fit: contain; }
}
