/* Modal semantics own the shared focus treatment; camera-only tools stay clear. */
html body dialog:not(:modal)::backdrop,
html body [class$="-backdrop"],
html body [class*="-backdrop "],
html body .app-status-overlay__backdrop {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html body dialog:modal::backdrop,
html body [role="dialog"][aria-modal="true"] > :is([class$="-backdrop"], [class*="-backdrop "]),
html body .app-status-overlay[data-blocking="true"] > .app-status-overlay__backdrop {
  background: rgb(15 27 38 / 18%) !important;
  backdrop-filter: blur(var(--ui-modal-blur, 4px)) !important;
  -webkit-backdrop-filter: blur(var(--ui-modal-blur, 4px)) !important;
}

/* Help is shared by the portal, designer, dialogs and detached tool windows. */
.aere-action-help {
  position: fixed; inset: auto; z-index: 2147483647; margin: 0; pointer-events: none;
  box-sizing: border-box; width: max-content; max-width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow: auto;
  padding: 9px 12px; border: 1px solid var(--ui-border-strong, #718a96);
  border-radius: 7px; background: var(--ui-surface-raised, #fff); color: var(--ui-text, #173640);
  box-shadow: var(--ui-shadow-popover); font: 400 13px/1.45 "Segoe UI", Arial, sans-serif;
  text-align: start; white-space: normal; overflow-wrap: anywhere;
}
.aere-action-help[hidden] { display: none !important; }
.aere-action-help::backdrop { background: transparent; pointer-events: none; }
:root {
  --ui-workspace-window-width: 92vw;
  --ui-workspace-window-height: 88dvh;
  --brand-orange: #ff6b00;
  --brand-teal: #002c39;
  --brand-grey-blue: #5d686e;
  --brand-ice: #e7f5f5;
  /* Shared surface roles; CAD, portal and detached tools use the same palette. */
  color-scheme: light;
  --ui-canvas: #edf2f5;
  --ui-surface: #ffffff;
  --ui-surface-muted: #e0eaf0;
  --ui-surface-hover: #d9e5eb;
  --ui-surface-raised: #ffffff;
  --ui-surface-inset: #e0eaf0;
  --ui-group-heading: #c6d8e1;
  --ui-group-heading-text: #173640;
  --ui-button: #d9e5eb;
  --ui-button-group: #d2e1e8;
  --ui-operating-group: var(--ui-surface-muted);
  --ui-operating-button: var(--ui-button-group);
  --ui-control: #ffffff;
  --ui-control-hover: #d9e5eb;
  --ui-selected: #ffead9;
  --ui-disabled: #e5e7e9;
  --ui-border-disabled: #b8bdc2;
  --ui-text: #173640;
  --ui-text-secondary: #4c6570;
  --ui-text-disabled: #60656b;
  --ui-border: #a8bcc6;
  --ui-border-strong: #718a96;
  --ui-accent: #ff6b00;
  --ui-accent-text: #002c39;
  --ui-accent-hover: #b54b00;
  --ui-accent-soft: #ffead9;
  --ui-success: #18794e;
  --ui-success-soft: #edf8f2;
  --ui-warning: #9a5b00;
  --ui-warning-soft: #fff7e8;
  --ui-warning-text: #70400c;
  --ui-warning-border: #f4c48d;
  --ui-danger: #b42318;
  --ui-danger-soft: #fff1f0;
  --ui-focus: #b54b00;
  --ui-shadow-popover: 0 16px 40px rgba(26, 27, 31, .16), 0 2px 8px rgba(26, 27, 31, .08);
  --ui-overlay: rgba(15, 23, 31, .66);
  --ui-scrollbar-thumb: #a8bcc6;
  --ui-scrollbar-track: #edf2f5;
  --ui-radius: 8px;
  --ui-radius-control: 6px;
  --ui-font-micro: 11px;
  --ui-font-secondary: 12px;
  --ui-font-control: 13px;
  --ui-font-body: 14px;
  --ui-font-lead: 16px;
  --ui-control-height-dense: 32px;
  --ui-control-height: 36px;
  --ui-space-sm: 8px;
  --ui-space-md: 12px;
  --ui-space-lg: 16px;
  --ui-control-pad-y: 8px;
  --ui-control-pad-x: 12px;
  --ui-control-gap: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

html[data-color-scheme="dark"] {
  color-scheme: dark;
  --ui-canvas: #101d24;
  --ui-surface: #22353f;
  --ui-surface-muted: #304b58;
  --ui-surface-hover: #35505e;
  --ui-surface-raised: #22353f;
  --ui-surface-inset: #304b58;
  --ui-group-heading: #122a35;
  --ui-group-heading-text: #f2f8fa;
  --ui-button: #1b303b;
  --ui-button-group: #263e4a;
  --ui-operating-group: var(--ui-surface-muted);
  --ui-operating-button: var(--ui-button-group);
  --ui-control: #192b34;
  --ui-control-hover: #263e4a;
  --ui-selected: #624028;
  --ui-disabled: #3b3e43;
  --ui-border-disabled: #61666c;
  --ui-text: #edf5f8;
  --ui-text-secondary: #c0d0d8;
  --ui-text-disabled: #a6abb0;
  --ui-border: #567381;
  --ui-border-strong: #7895a3;
  --ui-accent-soft: #624028;
  --ui-success: #b8f4d3;
  --ui-success-soft: #173b2d;
  --ui-warning: #ffd68a;
  --ui-warning-soft: #3b301c;
  --ui-warning-text: #ffd68a;
  --ui-warning-border: #8f6a2d;
  --ui-danger: #ffaaa1;
  --ui-danger-soft: #402323;
  --ui-focus: #ffb36c;
  --ui-overlay: rgba(2, 8, 13, .8);
  --ui-scrollbar-thumb: #567381;
  --ui-scrollbar-track: #101d24;
}

/* Colorful is a light native scheme. Brand/engineering/status colours retain
   their own roles; only operating groups receive the soft orange surface. */
html[data-color-scheme="colorful"] {
  color-scheme: light;
  --ui-canvas: #d4e8eb;
  --ui-surface: #ffffff;
  --ui-surface-muted: #9ecbd1;
  --ui-surface-hover: #d2e5e9;
  --ui-surface-raised: #ffffff;
  --ui-surface-inset: #c0dce0;
  --ui-group-heading: #002c39;
  --ui-group-heading-text: #ffffff;
  --ui-button: #d2e5e9;
  --ui-button-group: #88b8c0;
  --ui-operating-group: #ffdec7;
  --ui-operating-button: #ffffff;
  --ui-control: #ffffff;
  --ui-control-hover: #edf5f6;
  --ui-selected: #ffe0c4;
  --ui-text: #123b47;
  --ui-text-secondary: #3c5c67;
  --ui-border: #6d9eab;
  --ui-border-strong: #507e8b;
  --ui-accent-soft: #ffe0c4;
  --ui-scrollbar-thumb: #6d9eab;
  --ui-scrollbar-track: #d4e8eb;
}

[hidden] {
  display: none !important;
}

/* Disabled actions share neutral grey, independent of their active colour or
   the surface behind them. Do not fade the whole button into that surface. */
html[data-color-scheme] body button:is(:disabled,[aria-disabled="true"]),
html[data-color-scheme] body [role="button"][aria-disabled="true"] {
  --ui-border: var(--ui-border-disabled);
  --ui-border-strong: var(--ui-border-disabled);
  --ui-button-context: var(--ui-disabled);
  --ui-text: var(--ui-text-disabled);
  background: var(--ui-disabled) !important;
  color: var(--ui-text-disabled) !important;
  border-color: var(--ui-border-disabled) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  filter: none !important;
  cursor: not-allowed !important;
}
html[data-color-scheme] body button:is(:disabled,[aria-disabled="true"]) :is(span,svg,small) {
  color: inherit !important;
  opacity: 1 !important;
}

[data-ui-icon] {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
  line-height: 0;
}

[data-ui-icon] svg {
  display: block;
  max-height: 100%;
  max-width: 100%;
}

.visually-hidden {
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  overflow: hidden !important;
  position: absolute !important;
  white-space: nowrap !important;
  width: 1px !important;
}

::selection {
  background: rgba(237, 114, 3, .2);
}
