/* Editor chrome and artwork are selected as objects, not browser text ranges.
   Manual text entry keeps native caret, selection and copy/paste behaviour. */
body.editor-body,
body.editor-body * {
  -webkit-user-select: none;
  user-select: none;
}
body.editor-body :is(
  input:not([type="button"], [type="submit"], [type="reset"], [type="checkbox"],
    [type="radio"], [type="range"], [type="color"], [type="file"], [type="image"], [type="hidden"]),
  textarea,
  [contenteditable="true"], [contenteditable=""], [contenteditable="plaintext-only"]
):not([readonly], :disabled),
body.editor-body :is([contenteditable="true"], [contenteditable=""], [contenteditable="plaintext-only"]) * {
  -webkit-user-select: text;
  user-select: text;
}

/* Prooflet's task rail keeps creation discoverable and leaves the canvas unobstructed. */
.editor-workbench.has-task-rail {
  --editor-side-panel-w: 460px;
  grid-template-columns: 76px minmax(0, 1fr) var(--editor-side-panel-w);
}
.editor-task-rail {
  position: sticky;
  top: var(--editor-topbar-h);
  align-self: start;
  height: calc(100dvh - var(--editor-topbar-h));
  padding: 12px 6px;
  background: var(--editor-dark-panel);
  border-right: 1px solid var(--editor-dark-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
}
.editor-task-rail .editor-tools-anchor { display: block; position: static; }
.editor-task-rail .toolbar-add { display: flex; flex-direction: column; border: 0; background: none; gap: 8px; }
.editor-task-rail .toolbar-add > button,
.editor-task-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 64px;
  min-height: 64px;
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--editor-dark-text);
  font: 500 12px/1.2 "IBM Plex Sans", sans-serif;
  cursor: pointer;
}
.editor-task-rail .prooflet-ui-icon { width: 22px; height: 22px; }
.editor-task-rail button:hover:not(:disabled) { background: var(--editor-dark-hover); }
.editor-task-rail .toolbar-add > button.is-active,
.editor-task-rail .toolbar-add > button[aria-expanded="true"] { background: #c9441f; color: #fff; }
.editor-task-rail button:focus-visible,
.editor-context-menu button:focus-visible,
#konva-host:focus-visible { outline: 2px solid #f0744f; outline-offset: -3px; }
.editor-task-rail button:disabled { opacity: 0.45; cursor: default; }
.editor-task-rail .editor-layers-flyout {
  position: fixed;
  top: calc(var(--editor-topbar-h) + 8px);
  left: 84px;
  width: min(360px, calc(100vw - 100px));
  max-height: calc(100dvh - var(--editor-topbar-h) - 24px);
  overflow: auto;
}
.editor-task-rail .editor-layers-flyout[hidden],
.editor-task-rail [hidden] { display: none; }
.editor-workspace-hint {
  position: absolute;
  z-index: 2;
  top: 68px;
  left: 60px;
  right: 16px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--editor-dark-muted);
  pointer-events: none;
}
.editor-context-menu {
  position: fixed;
  z-index: 150;
  width: 256px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 8px;
  background: var(--editor-dark-panel, #313134);
  color: var(--editor-dark-text, #ececea);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  font: 400 13px/1.4 "IBM Plex Sans", sans-serif;
  color-scheme: dark;
}
.editor-context-menu[hidden] { display: none; }
.editor-context-title { margin: 0; padding: 8px 10px; font-weight: 600; overflow-wrap: anywhere; }
.editor-context-note { margin: 0; padding: 0 10px 10px; color: var(--editor-dark-muted); }
.editor-context-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.editor-context-menu button:hover,
.editor-context-menu button:focus { background: var(--editor-dark-hover, #4a4a4f); }
.editor-context-menu button:disabled { cursor: default; opacity: .45; }
.editor-context-menu .is-destructive { color: #ffb6aa; }
.editor-context-menu kbd { font: inherit; font-size: 11px; color: var(--editor-dark-muted); white-space: nowrap; }
.editor-context-menu [role="separator"] { height: 1px; background: var(--editor-dark-line); margin: 5px 6px; }
@media (max-width: 1280px) {
  .editor-workbench.has-task-rail { --editor-side-panel-w: 420px; grid-template-columns: 68px minmax(0, 1fr) var(--editor-side-panel-w); }
  .editor-task-rail { padding-inline: 2px; }
  .editor-task-rail .editor-layers-flyout { left: 76px; }
  .editor-workspace-hint { display: none; }
}

.editor-workbench.has-task-rail.side-panel-collapsed { --editor-side-panel-w: 0px; }
/* The existing phone entry already names the preview in its heading. */
body.is-phone-viewer .phone-viewer-card > .rail-label { display: none; }

/* One compact selection strip; the canvas retains all document and command ownership. */
.editor-selection-actions { flex: none; display: grid; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--editor-dark-line); }
.editor-selection-actions[hidden] { display: none; }
.editor-selection-actions :is(.selection-actions-primary, .selection-actions-space) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.editor-selection-actions :is(.selection-actions-primary, .selection-actions-space) > :only-child { grid-column: 1 / -1; }
.editor-selection-actions .selection-actions-align { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.editor-selection-actions .button { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-width: 0; min-height: 36px; padding: 7px 10px; border-radius: 6px; font: 400 13px/1.4 "IBM Plex Sans", sans-serif; white-space: normal; }
.editor-selection-actions .selection-actions-align .button { padding: 7px 4px; }
.editor-selection-actions .selection-actions-align svg { width: 18px; height: 18px; }
.editor-selection-actions .selection-actions-status { margin: 0; font: 400 12px/1.45 "IBM Plex Sans", sans-serif; }
.has-selection-actions :is(#editor-ctx-actions, #editor-label-info-card) { display: none; }
.has-selection-actions :is(#selected-align-row, #selected-distribute-row) { display: none; }
.has-selection-actions .artwork-group-toolbar { display: none; }
.has-merged-text-selection #editor-placement-fields { display: none; }
@media (pointer: coarse) { .editor-selection-actions .button { min-height: 44px; } }
