/* The console palette belongs to the Constructor and its three native dialogs. */
#section-constructor,
dialog.ctor-dialog,
dialog.ctor-kitchen-dialog[open],
dialog.bazis-dialog[open] {
  --ctor-base: #101927;
  --ctor-surface: #152033;
  --ctor-field: #0b1422;
  --ctor-border: #34435b;
  --ctor-text: #f3f6fe;
  --ctor-muted: #b0bfd6;
  --ctor-accent: #9fceff;
  --ctor-primary: #c7e4ff;
  --ctor-ring: #b5ddff;
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
#appView:has(#section-constructor.active) > .sidebar {
  --shell-line: #253146;
  --shell-muted: #abb8cd;
  --shell-hover: #17253b;
  --shell-active: #1a355a;
  --shell-accent: #9ccfff;
  background: linear-gradient(165deg, #121c2b, #0c121e 50%);
}
#appView > .main:has(> #section-constructor.active) {
  background:
    radial-gradient(ellipse 100% 580px at 87% 0%, #17284180, transparent 80%),
    #090f19;
  min-height: 100dvh;
}
#appView > .main:has(> #section-constructor.active) > .topbar {
  min-height: 69px;
  margin-bottom: 20px;
  border-color: #273348;
}
#appView > .main:has(> #section-constructor.active) > .topbar h2 {
  color: #edf2fc;
  font-size: clamp(21px, 2vw, 26px);
  font-weight: 570;
  letter-spacing: -.035em;
}
#appView > .main:has(> #section-constructor.active) > .topbar .eyebrow { color: #a5bcd8; }
#appView > .main:has(> #section-constructor.active) > .topbar > .top-actions { display: none; }
#section-constructor .ctor-workspace {
  grid-template-areas: "main library";
  grid-template-columns: minmax(0, 1fr) clamp(215px, 18cqi, 270px);
  gap: clamp(16px, 1.6cqi, 27px);
}
#section-constructor .ctor-main { grid-area: main; }
#section-constructor .ctor-sidebar {
  grid-area: library;
  border-radius: 17px;
  padding: 17px;
  background: linear-gradient(145deg, #18253a, #101928 72%);
}
#section-constructor .ctor-sidebar-heading h3 {
  font-size: 17px;
  letter-spacing: -.025em;
}
#section-constructor .ctor-product {
  border-radius: 8px;
  padding-block: 10px;
  background: #ffffff03;
}
#section-constructor .ctor-product:hover { background: #1b2c44; }
#section-constructor .ctor-product.is-active {
  background: #1c3351;
  border-color: #587fa9;
}
#section-constructor .ctor-product small { color: var(--ctor-muted); }
#section-constructor .ctor-list-count { border-color: var(--ctor-border); }
#section-constructor .ctor-button.ctor-library-jump { display: none; }
#section-constructor .ctor-output-chooser { gap: 14px; }

/* The luminous contour is decorative and never shares a canvas with the drawing. */
#section-constructor .ctor-output-intro {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  border: 1px solid #3c5472;
  border-radius: 18px;
  padding: clamp(23px, 2.6cqi, 41px);
  background: linear-gradient(112deg, #192537 6%, #1c304c 62%, #213b62);
}
#section-constructor .ctor-output-intro::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 23%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 76% 184% at 86% 158%,
      transparent 51%, #4073ab55 54%, #315988 57%, #4f80ba 59%,
      #b8e3ff 60%, #82b4ec 60.5%, #446a9e 61.8%, #305082 63%, transparent 73%),
    radial-gradient(ellipse 78% 178% at 90% 152%,
      transparent 69%, #93c1f555 69.5%, transparent 70%, transparent 74%,
      #91bff133 74.3%, transparent 74.8%);
  mask-image: linear-gradient(90deg, transparent, #000 52%);
}
#section-constructor .ctor-output-intro h3 {
  max-width: 80%;
  margin: 0;
  font-size: clamp(27px, 3cqi, 43px);
  line-height: 1.12;
  font-weight: 530;
  letter-spacing: -.05em;
  color: #f6f8ff;
  overflow-wrap: anywhere;
}
#section-constructor .ctor-output-intro p {
  margin: 9px 0 0;
  max-width: 68%;
  font-size: 14px;
  line-height: 1.55;
  color: #c5d4e8;
}
#section-constructor .ctor-output-group-title {
  margin: 6px 0 -4px;
  font-size: 14px;
  font-weight: 600;
  color: #c7d5ea;
}
#section-constructor .ctor-output-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}
#section-constructor .ctor-output-card {
  --tile-ink: #b9dbff;
  --tile-wash: #254e7b;
  --tile-light: #4878ae;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  align-items: start;
  gap: 20px 10px;
  min-height: 166px;
  padding: clamp(16px, 1.5cqi, 24px);
  border: 1px solid #3a4c65;
  border-radius: 15px;
  color: var(--ctor-text);
  background: linear-gradient(145deg, #1b2a41, #121c2b 83%);
  box-shadow: inset 0 1px 0 #dbe9ff0b;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
#section-constructor .ctor-output-card[data-kind="assembly-instructions"] {
  --tile-ink: #c7d3ff;
  --tile-wash: #3b4874;
  --tile-light: #6679ae;
}
#section-constructor .ctor-output-card[data-kind="instructions"] {
  --tile-ink: #ddd1ff;
  --tile-wash: #48416e;
  --tile-light: #8979b5;
}
#section-constructor .ctor-output-card[data-kind="specification"] {
  --tile-ink: #b6e7f3;
  --tile-wash: #284b5b;
  --tile-light: #547e92;
}
#section-constructor .ctor-output-card:hover,
#section-constructor .ctor-output-card:focus-visible {
  color: white;
  border-color: #95bce4;
  background: linear-gradient(145deg, #263c59, #1c2a40 85%);
  box-shadow: inset 0 0 0 1px #97c3f01c, 0 6px 16px #03070d36;
}
#section-constructor .ctor-output-card:active { background: #20334d; }
#section-constructor .ctor-output-icon {
  width: 42px;
  height: 42px;
  color: var(--tile-ink, #cbe1ff);
  border: 1px solid var(--tile-light, #526e98);
  border-radius: 12px;
  background: linear-gradient(145deg, var(--tile-wash, #2b4465), #1b2a40);
}
#section-constructor .ctor-output-card > .ctor-output-icon { grid-column: 1; grid-row: 1; }
#section-constructor .ctor-output-card > span:nth-child(2) { grid-column: 1/-1; grid-row: 2; min-width: 0; }
#section-constructor .ctor-output-arrow {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  color: #abc0dd;
  font: 400 23px/1 system-ui, sans-serif;
}
#section-constructor .ctor-output-card strong {
  color: inherit;
  font-size: clamp(16px, 1.3cqi, 20px);
  line-height: 1.25;
  letter-spacing: -.025em;
  font-weight: 615;
  overflow-wrap: anywhere;
}
#section-constructor .ctor-output-card small {
  font-size: 13px;
  line-height: 1.5;
  color: #b6c7dc;
  margin-top: 6px;
}
#section-constructor .ctor-output-kitchen {
  --tile-wash: #315c79;
  --tile-light: #6894ad;
  --tile-ink: #d1efff;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  align-content: center;
  gap: 15px;
  min-height: 88px;
  border-color: #4b6984;
  background: linear-gradient(105deg, #233d51, #192c43 65%, #1c3852);
}
#section-constructor .ctor-output-kitchen > span:nth-child(2) { grid-column: 2; grid-row: 1; }
#section-constructor .ctor-output-kitchen > .ctor-output-arrow { grid-column: 3; align-self: center; }
#section-constructor .ctor-output-kitchen:hover,
#section-constructor .ctor-output-kitchen:focus-visible {
  background: linear-gradient(105deg, #2c4d64, #223d57 75%);
}
#section-constructor .ctor-document-sources {
  margin-top: 18px;
  padding: 14px 0;
  border-color: #304058;
}
#section-constructor .ctor-document-sources h4 {
  font-weight: 550;
  color: #b0bfd6;
}

/* Lower contrast surfaces keep the paper and the primary action prominent. */
#section-constructor .ctor-overview,
#section-constructor .ctor-output-workspace-head {
  background: linear-gradient(116deg, #1a2b42, #152135 72%, #192c45);
  border-color: #3b506b;
  border-radius: 15px;
}
#section-constructor .ctor-editor-header h3,
#section-constructor .ctor-output-heading h3 {
  color: var(--ctor-text);
  font-weight: 560;
  letter-spacing: -.04em;
}
#section-constructor .ctor-tabs {
  gap: 3px;
  padding: 4px;
  background: #0c1522;
  border-color: #314058;
}
#section-constructor .ctor-tabs button {
  color: var(--ctor-muted);
  font-weight: 560;
}
#section-constructor .ctor-tabs button.is-active {
  color: #eef6ff;
  background: #253f60;
  border-color: #59789d;
}
#section-constructor .ctor-block,
#section-constructor .ctor-document-preview { border-color: var(--ctor-border); background: var(--ctor-surface); }
#section-constructor .ctor-block-title { background: #172437; }
#section-constructor .ctor-output-step, #section-constructor .ctor-callout-tools { background: #101a29; }
#section-constructor .ctor-output-step-number { background: #2b4264; color: #d8ebff; }
#section-constructor .ctor-output-step-fields { gap: 8px; }
#section-constructor .ctor-document-preview > summary { color: #cfdef2; }
#section-constructor :is(.ctor-paper, .ctor-canvas-shell, .ctor-photo-button) { color-scheme: light; }
#section-constructor .ctor-document-state { padding: 5px 9px; border-radius: 16px; }
#section-constructor .ctor-document-state.is-ready { color: #b1edd1; background: #1b4036; }
#section-constructor .ctor-output-problems { max-width: 100%; }

/* Neutral controls have the same meaning in the product, import and kitchen editors. */
#section-constructor .ctor-button,
dialog.ctor-dialog .ctor-button,
dialog.ctor-kitchen-dialog .ctor-kitchen-button,
dialog.bazis-dialog .bazis-button {
  color: #e2ecfc;
  background: #1e2d42;
  border-color: #455975;
  border-radius: 9px;
  font-weight: 600;
}
#section-constructor .ctor-button:hover:not(:disabled),
dialog.ctor-dialog .ctor-button:hover:not(:disabled),
dialog.ctor-kitchen-dialog .ctor-kitchen-button:hover:not(:disabled),
dialog.bazis-dialog .bazis-button:hover:not(:disabled) {
  background: #2b405e;
  border-color: #80a1ca;
}
#section-constructor .ctor-button.ctor-primary,
dialog.ctor-dialog .ctor-button.ctor-primary,
dialog.ctor-kitchen-dialog .ctor-kitchen-button.ctor-kitchen-primary,
dialog.bazis-dialog .bazis-button.bazis-primary {
  color: #10203a;
  background: var(--ctor-primary);
  border-color: #d9edff;
  font-weight: 700;
}
#section-constructor .ctor-button.ctor-primary:hover:not(:disabled),
dialog.ctor-dialog .ctor-button.ctor-primary:hover:not(:disabled),
dialog.ctor-kitchen-dialog .ctor-kitchen-button.ctor-kitchen-primary:hover:not(:disabled),
dialog.bazis-dialog .bazis-button.bazis-primary:hover:not(:disabled) {
  background: #e4f1ff;
  border-color: #eef8ff;
}
#section-constructor .ctor-sidebar-heading .ctor-button {
  color: #cde6ff;
  border-color: #4e6b8d;
  background: #233a54;
}
#section-constructor .ctor-edit-tools .ctor-button:not(:hover),
#section-constructor [data-action="output-list"]:not(:hover),
dialog.ctor-kitchen-dialog .ctor-kitchen-link:not(:hover) {
  color: #bcdcff;
  background: transparent;
  border-color: transparent;
}
#section-constructor :is(input, select, textarea):not([type="checkbox"], [type="range"]),
dialog.ctor-dialog :is(input, select, textarea):not([type="checkbox"], [type="range"]),
dialog.ctor-kitchen-dialog :is(input, select, textarea):not([type="checkbox"]),
dialog.bazis-dialog :is(input, select, textarea):not([type="checkbox"], [type="file"]) {
  color: var(--ctor-text);
  background-color: var(--ctor-field);
  border-color: #475b78;
  border-radius: 8px;
}
#section-constructor .ctor-table input:not(:hover, :focus) {
  background-color: #131e30;
  border-color: #2e3c50;
}
#section-constructor input[type="checkbox"],
dialog.ctor-kitchen-dialog input[type="checkbox"],
dialog.bazis-dialog input[type="checkbox"] { accent-color: #a8d0ff; }
#section-constructor :focus-visible,
dialog.ctor-dialog :focus-visible,
dialog.ctor-kitchen-dialog :focus-visible,
dialog.bazis-dialog :focus-visible {
  outline: 2px solid var(--ctor-ring);
  outline-offset: 2px;
}
#section-constructor .ctor-table input:focus-visible { outline-offset: -1px; }

dialog.ctor-dialog[open],
dialog.ctor-kitchen-dialog[open],
dialog.bazis-dialog[open] {
  --ck-bg: var(--ctor-base);
  --ck-card: var(--ctor-surface);
  --ck-field: var(--ctor-field);
  --ck-line: var(--ctor-border);
  --ck-text: var(--ctor-text);
  --ck-muted: var(--ctor-muted);
  color: var(--ctor-text);
  background: var(--ctor-base);
  border-color: #506581;
  border-radius: 17px;
  box-shadow: 0 24px 90px #01050bd6;
}
dialog.ctor-dialog::backdrop,
dialog.ctor-kitchen-dialog::backdrop,
dialog.bazis-dialog::backdrop { background: #030814ce; }
dialog.ctor-dialog .ctor-dialog-inner > header,
dialog.ctor-kitchen-dialog .ctor-kitchen-head,
dialog.bazis-dialog .bazis-header {
  color: #eff5ff;
  background: linear-gradient(110deg, #1b2d46, #152134);
  border-color: #3a4e69;
}
dialog.ctor-dialog .ctor-dialog-inner > header h3,
dialog.ctor-kitchen-dialog .ctor-kitchen-head h2,
dialog.bazis-dialog .bazis-header h2 {
  font-weight: 575;
  letter-spacing: -.025em;
}
dialog.ctor-dialog [data-picker-content] { display: grid; gap: 12px; min-width: 0; }
dialog.ctor-dialog .ctor-dialog-body > h4,
dialog.ctor-dialog .ctor-picker-sources h4 { margin: 0; font-size: 14px; font-weight: 600; color: #dce8f9; }
dialog.ctor-dialog .ctor-picker-products {
  display: grid;
  gap: 7px;
  max-height: min(43dvh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #526b8c transparent;
  padding: 3px;
  margin: -3px;
}
dialog.ctor-dialog .ctor-picker-products .ctor-template {
  width: 100%;
  color: #ecf4ff;
  background: #1a2a40;
  border-color: #415570;
  padding: 11px 14px;
}
dialog.ctor-dialog .ctor-picker-products .ctor-template:hover {
  background: #233b58;
  border-color: #8eb9e7;
}
dialog.ctor-dialog .ctor-picker-products small { margin-top: 4px; font-size: 12px; color: var(--ctor-muted); }
dialog.ctor-dialog .ctor-picker-sources {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--ctor-border);
}
dialog.ctor-kitchen-dialog .ctor-kitchen-library { background: #101a29; }
dialog.ctor-kitchen-dialog .ctor-kitchen-foot,
dialog.bazis-dialog .bazis-footer { background: #172437; border-color: #40536e; }
dialog.ctor-kitchen-dialog :is(.ctor-kitchen-step, .ctor-kitchen-module) {
  border-color: #35465f;
  background: #111b2b;
}
dialog.ctor-kitchen-dialog .ctor-kitchen-project[aria-current="true"],
dialog.bazis-dialog .bazis-tabs .bazis-button[aria-pressed="true"] {
  color: #e8f2ff;
  background: #264365;
  border-color: #587da5;
}
dialog.bazis-dialog .bazis-tabs .bazis-button:not([aria-pressed="true"], :hover) {
  background: transparent;
  border-color: transparent;
}
dialog.bazis-dialog .bazis-section { background: var(--ctor-surface); border-color: var(--ctor-border); }
dialog.bazis-dialog .bazis-file {
  border-color: #7096c4;
  background: linear-gradient(115deg, #1b304a, #122135);
}
dialog.bazis-dialog .bazis-file:focus-within,
dialog.bazis-dialog .bazis-file:hover { background: #203a58; }
dialog.bazis-dialog .bazis-file-format {
  color: #d1e8ff;
  background: #284566;
  border-color: #517297;
}

@container constructor (max-width: 1190px) {
  #section-constructor .ctor-output-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #section-constructor .ctor-output-card:not(.ctor-output-kitchen) {
    min-height: 132px;
    gap: 13px;
  }
}
@container constructor (max-width: 850px) {
  #section-constructor .ctor-button.ctor-library-jump { display: inline-flex; }
  #section-constructor .ctor-workspace {
    grid-template-areas: "main" "library";
    grid-template-columns: minmax(0, 1fr);
  }
  #section-constructor .ctor-sidebar { padding: 14px; }
  #section-constructor .ctor-output-card:not(.ctor-output-kitchen) { min-height: 116px; }
}
@container constructor (max-width: 530px) {
  #section-constructor .ctor-output-chooser { gap: 10px; }
  #section-constructor .ctor-output-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #section-constructor .ctor-output-intro { border-radius: 14px; padding: 19px 16px; }
  #section-constructor .ctor-output-intro h3 { max-width: 100%; font-size: 25px; }
  #section-constructor .ctor-output-intro p { max-width: 88%; font-size: 13px; }
  #section-constructor .ctor-output-intro::after { inset-inline-start: 54%; opacity: .66; }
  #section-constructor .ctor-output-card,
  #section-constructor .ctor-output-card:not(.ctor-output-kitchen) {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-content: center;
    align-items: center;
    gap: 10px;
    padding: 12px;
    min-height: 76px;
    border-radius: 12px;
  }
  #section-constructor .ctor-output-card > span:nth-child(2) { grid-column: 2; grid-row: 1; }
  #section-constructor .ctor-output-card > .ctor-output-arrow { grid-column: 3; align-self: center; }
  #section-constructor .ctor-output-icon { width: 36px; height: 36px; border-radius: 10px; }
  #section-constructor .ctor-output-icon svg { width: 21px; height: 21px; }
  #section-constructor .ctor-output-card strong { font-size: 15px; }
  #section-constructor .ctor-output-card small { font-size: 12px; line-height: 1.45; margin-top: 3px; }
  #section-constructor .ctor-document-sources { margin-top: 12px; }
}
@media (max-width: 780px) {
  #appView > .main:has(> #section-constructor.active) > .topbar {
    min-height: 0;
    margin-bottom: 12px;
    padding-block: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #section-constructor .ctor-output-card,
  #section-constructor .ctor-button,
  dialog.ctor-dialog .ctor-button,
  dialog.bazis-dialog .bazis-button { transition: none; }
}
