/* Built-in – the look of a CAD program: neutral greys, one accent colour (blue) for what is selected or pressed,
   colours for errors and warnings, small radii, fields with frames. The materials keep their real colour (decor
   swatches, textures in 3D). The tokens below carry the palette; the last section of this file (the look of a CAD
   program) restyles the layout of the sections above it.
   Light tokens are the default (start page, setup, light design); .configurator[data-theme="dark"] is the dark one. */

/* The typeface is a file of the app (vendor/, tools/vendor.mjs) – nothing is loaded from the internet.
   One variable file per script range; Czech needs latin-ext. */
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("vendor/inter-tight/inter-tight-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("vendor/inter-tight/inter-tight-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: var(--font-sans); /* one typeface; numbers line up by tabular figures (html, body) */

  --bg: #eceef1;            /* the ground of the window */
  --surface: #ffffff;       /* panels */
  --surface-2: #f4f5f7;     /* bars, headers of panels */
  --text: #1e2228;
  --muted: #626a75;
  --border: #d3d7dd;        /* frames of controls and cards */
  --line: #bfc5cd;          /* lines between the regions of the window */
  --grid: transparent;
  --hover: #e6e9ee;

  --accent: #0b63ce;        /* fills of the pressed / selected state */
  --accent-strong: #0850a8;
  --accent-text: #ffffff;   /* text on accent fills */
  --accent-ink: #0b5cc0;    /* accent used as text / lines on the current ground */
  --accent-ink-on-dark: #6fb0f7;
  --accent-soft: #e2eefc;

  --ok: #1c7c3f;
  --error: #c62828;
  --warning: #a76200;

  --input-bg: #ffffff;
  --input-border: #b9bfc8;
  --flex-a: #f1f3f6;
  --flex-b: #e7eaef;
  --keep-fill: #39424e;     /* keep modules in the bar */
  --keep-text: #ffffff;
  --stage: #dfe3e9;
  --chrome: #0b63ce;        /* primary buttons */
  --chrome-text: #ffffff;
  --chrome-muted: #ffffff;
  --chrome-accent: #ffffff;

  --titlebar: #2a323d;      /* the title strip of the window */
  --titlebar-text: #e8ecf1;
  --titlebar-hover: rgba(255, 255, 255, 0.12);
  --titlebar-line: rgba(255, 255, 255, 0.2);
  --shadow: 0 1px 2px rgba(20, 28, 40, 0.08);
  --shadow-strong: 0 3px 12px rgba(20, 28, 40, 0.18);
  --cube-face: rgba(250, 251, 252, 0.94);
  --cube-edge: #9aa3ae;
  --dim: #1e2228;           /* dimensions over the 3D scene */
  --dim-halo: rgba(255, 255, 255, 0.85);
  --dwg-ground: #c5cad2;    /* around the sheet of a drawing */

  /* Elevation drawings (src/elevation.js) – technical line drawing */
  --el-carcass: #ffffff;
  --el-back: #ffffff;
  --el-front: #ffffff;
  --el-filler: #f1f3f6;
  --el-leg: #39424e;
  --el-plinth: #39424e;
  --el-worktop: #39424e;
  --el-backsplash: #ffffff;
  --el-line: #2a2f37;
  --el-room: #7b838e;
}

.configurator[data-theme="dark"] {
  --bg: #1b1d21;
  --surface: #25282d;
  --surface-2: #2d3036;
  --text: #e3e6ea;
  --muted: #9aa2ad;
  --border: #40454d;
  --line: #14161a;
  --hover: #363a42;
  --accent: #2f7fe0;
  --accent-strong: #4a94ee;
  --accent-text: #ffffff;
  --accent-ink: #74b3f8;
  --accent-soft: #223a56;
  --ok: #58c27d;
  --error: #ff6b6b;
  --warning: #f0b24a;
  --input-bg: #1c1e22;
  --input-border: #555b65;
  --flex-a: #2b2e34;
  --flex-b: #33373e;
  --keep-fill: #cfd4db;
  --keep-text: #1b1d21;
  --stage: #17191c;
  --chrome: #2f7fe0;
  --chrome-text: #ffffff;

  --titlebar: #121417;
  --titlebar-text: #dfe3e8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-strong: 0 3px 14px rgba(0, 0, 0, 0.5);
  --cube-face: rgba(52, 56, 64, 0.94);
  --cube-edge: #7c8591;
  --dim: #e3e6ea;
  --dim-halo: rgba(20, 22, 26, 0.85);
  --dwg-ground: #121316;

  --el-carcass: #25282d;
  --el-back: #25282d;
  --el-front: #25282d;
  --el-filler: #2d3036;
  --el-leg: #cfd4db;
  --el-plinth: #cfd4db;
  --el-worktop: #cfd4db;
  --el-backsplash: #25282d;
  --el-line: #cfd4db;
  --el-room: #7c8591;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
}

body.has-dialog {
  overflow: hidden;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.15;
}

a {
  color: inherit;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Controls ---------- */

button {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--chrome);
  border-radius: 0;
  background: var(--chrome);
  color: var(--chrome-text);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}

button.primary:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--line);
  color: var(--text);
}

button.primary:disabled {
  border-style: dashed;
  border-color: var(--line);
  background: var(--bg);
  color: var(--text);
}

.arrow {
  width: 18px;
  height: 18px;
  flex: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--line);
}

.icon-button:disabled {
  opacity: 0.35;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* A secondary action: outlined; a switch: a check box and its label, no frame. */
.chip-button,
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.toggle {
  padding: 0 8px;
  border-color: transparent;
}

.chip-button:hover {
  background: var(--accent);
  color: var(--accent-text);
}

.toggle input {
  margin: 0;
  accent-color: var(--accent);
}

/* Fields are underlined only; a text area keeps its frame. */
input[type="number"],
input.calc-input,
select,
textarea {
  width: 100%;
  padding: 7px 2px;
  font: inherit;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
}

textarea {
  padding: 8px 10px;
  border: 1px solid var(--input-border);
}

input[type="number"],
input.calc-input,
select {
  font-family: var(--font-mono);
  font-size: 14px;
}

/* A number field with an expression it cannot evaluate (calc_input.js). */
input.calc-invalid {
  border-color: var(--error);
  outline: 1px solid var(--error);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: 2px;
}

.eyebrow {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag {
  display: inline-block;
  font-weight: 500;
}

.muted,
.help,
.hint {
  color: var(--muted);
}

.help,
.hint {
  margin: 6px 0 0;
  font-size: 12px;
}

/* ---------- Elevation drawings ---------- */

.elevation {
  display: block;
  width: 100%;
  height: 100%;
}

.elevation rect {
  stroke: var(--el-line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.elevation .el-room {
  fill: none;
  stroke: var(--el-room);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  vector-effect: non-scaling-stroke;
}

.el-carcass { fill: var(--el-carcass); }
.el-back { fill: var(--el-back); }
.el-shelf { fill: var(--el-carcass); }
.el-front { fill: var(--el-front); }
.el-filler { fill: var(--el-filler); }
.el-leg { fill: var(--el-leg); }
.el-plinth { fill: var(--el-plinth); }
.el-worktop { fill: var(--el-worktop); }
.el-backsplash { fill: var(--el-backsplash); }

/* ---------- Home ---------- */

.home {
  min-height: 100%;
  background: var(--bg);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  max-width: 1344px;
  margin: 0 auto;
  padding: 24px 40px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: none;
  background: var(--accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 32px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.home-main {
  display: flex;
  flex-direction: column;
  gap: 104px;
  max-width: 1344px;
  margin: 0 auto;
  padding: 88px 40px 0;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px 64px;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 999 1 640px;
  min-width: 0;
}

.hero h1 {
  max-width: 920px;
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero-lead {
  flex: 1 1 300px;
  max-width: 400px;
  margin: 0;
  font-size: 18px;
}

/* The last design: one row between two lines. */
.continue {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.continue-visual {
  height: 92px;
}

.continue h2 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.continue .muted {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 14px;
}

/* ---------- Saved designs (src/designs_panel.js, docs/configurator_ui_reference.md section 9) ---------- */

.saved {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.saved-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
}

.saved-where {
  font-family: var(--font-mono);
  font-size: 13px;
}

.saved-search {
  width: min(280px, 100%);
  height: 32px;
  margin-left: auto;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

/* One row per design: front view, name, product · room · modules, the time of the save, actions. */
.saved-grid {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.saved-card {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.saved-visual {
  flex: none;
  width: 132px;
  height: 84px;
  padding: 10px 8px;
  border: none;
  background: var(--surface-2);
}

.saved-visual svg {
  width: 100%;
  height: 100%;
}

.saved-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 28px;
  flex: 1;
  min-width: 0;
  padding: 12px 0;
}

.saved-name {
  flex: 1 1 220px;
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The design last open: a black square before its name. */
.saved-card.is-current .saved-name::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 10px 2px 0;
  background: var(--accent);
}

.saved-name-input {
  flex: 1 1 220px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--accent-ink);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-weight: 500;
}

.saved-meta,
.saved-date {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}

.saved-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.saved-actions .saved-open {
  min-height: 36px;
  margin-right: 8px;
  gap: 14px;
}

.saved-error {
  margin: 0;
  color: var(--error);
}

/* The save button of the top bars: a square while the open design has changes not saved (data-state = new | dirty | saved). */
.save-button {
  position: relative;
  font-weight: 500;
}

.save-button[data-state="dirty"]::after {
  content: "";
  position: absolute;
  top: 2px;
  right: -4px;
  width: 6px;
  height: 6px;
  background: var(--accent-ink);
}

.save-dialog {
  width: min(440px, calc(100vw - 32px));
}

.save-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.save-field input {
  height: 38px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
}

.save-dialog .save-where {
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.save-dialog .save-error {
  margin: -8px 0 14px;
  color: var(--error);
}

/* Products: columns divided by lines. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  border-top: 1px solid var(--line);
}

.product-card {
  display: flex;
  flex-direction: column;
  padding: 0 32px;
  border-right: 1px solid var(--line);
}

.product-card:first-child {
  padding-left: 0;
}

.product-card:last-child {
  padding-right: 0;
  border-right: 0;
}

.product-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-visual {
  height: 240px;
  padding: 28px 0 20px;
}

.product-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  padding: 0 0 8px;
}

.product-text h2 {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.product-text p {
  margin: 0;
  font-size: 15px;
}

.product-specs {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.product-text button.primary {
  align-self: flex-start;
  margin-top: auto;
}

.how {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.how-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 0 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-steps li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.how-steps strong {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.site-footer {
  max-width: 1344px;
  margin: 120px auto 0;
  padding: 0 40px 32px;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

/* ---------- Setup dialog ---------- */

.setup {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
}

.setup-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.setup-head-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px;
  padding: 18px 40px;
}

.setup-head h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.setup-head .icon-button {
  width: 64px;
  height: auto;
  border: none;
  background: transparent;
}

.setup-body {
  width: 100%;
  max-width: 1344px;
  margin: 0 auto;
  padding: 48px 40px;
}

.setup-step + .setup-step {
  margin-top: 56px;
}

.setup-step h3 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 22px;
  font-weight: 500;
}

.step-help {
  max-width: 720px;
  margin: 8px 0 20px;
}

.start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.start-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 16px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.start-card:hover:not(:disabled) {
  outline: 2px solid var(--line);
  outline-offset: -2px;
}

.start-card:disabled {
  border-style: dashed;
  text-decoration: line-through;
}

.start-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.start-visual {
  height: 160px;
  margin: 8px 16px;
}

/* The picture of the empty design: no wall – the floor, a faint grid and the origin with its two axes. */
.elevation .el-grid,
.elevation .el-axis {
  fill: none;
  stroke: var(--el-room);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.elevation .el-grid { opacity: 0.45; }
.elevation .el-axis { stroke-width: 1.5; }
.elevation .el-axis.is-x { stroke: #e5484d; }
.elevation .el-axis.is-y { stroke: #30a46c; }
.elevation .el-origin { fill: var(--el-line); }

.start-title {
  padding: 0 16px;
  font-size: 18px;
  font-weight: 500;
}

.start-note {
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Configurator ---------- */

.configurator {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: 56px minmax(0, 1fr);
  grid-template-areas:
    "top top"
    "library stage";
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

/* Top bar: no cells, just space between the groups; the one black button is Save. */
.topbar {
  grid-area: top;
  display: flex;
  align-items: stretch;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 13px;
}

.topbar > * {
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.topbar-product {
  gap: 10px;
  min-width: 0; /* a narrow top bar shortens the title (…) instead of pushing the buttons out of the window */
}

.topbar-product .brand-mark {
  flex: none;
}

.topbar-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-inline {
  gap: 8px;
  margin-right: auto;
  color: var(--muted);
}

.room-inline label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-inline input {
  width: 64px;
  height: 30px;
  padding: 0 2px;
  text-align: center;
}

.export-button {
  font-weight: 500;
  white-space: nowrap; /* "Nářezový plán" stays on one line in a narrow top bar */
}

.topbar .save-button {
  align-self: center;
  height: 36px;
  margin: 0 6px;
  padding: 0 16px;
  background: var(--chrome);
  color: var(--chrome-text);
}

.topbar .save-button:hover {
  text-decoration: none;
  outline: 1px solid var(--line);
  outline-offset: 2px;
}

.topbar .save-button[data-state="dirty"]::after {
  top: 6px;
  right: 6px;
  background: var(--chrome-text);
}

/* Segmented switch (panels): pressed = black. In the top bar and on the home page plain words: CZ / EN. */
.theme-switch {
  gap: 0;
  padding: 0 14px;
}

.theme-switch button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.theme-switch button + button {
  border-left: none;
}

.theme-switch button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  font-weight: 500;
}

.topbar .theme-switch,
.site-nav .theme-switch {
  gap: 4px;
  padding: 0 10px;
}

.topbar .theme-switch button,
.site-nav .theme-switch button {
  padding: 0 2px;
  border: 0;
  background: none;
  font-size: 13px;
  white-space: nowrap; /* "/ EN" stays together in a narrow top bar */
}

.topbar .theme-switch button + button::before,
.site-nav .theme-switch button + button::before {
  content: "/";
  margin-right: 6px;
  font-weight: 400;
  text-decoration: none;
  display: inline-block;
}

.topbar .theme-switch button[aria-pressed="true"],
.site-nav .theme-switch button[aria-pressed="true"] {
  background: none;
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.history {
  gap: 0;
  padding: 0;
}

.history .icon-button {
  width: 40px;
  height: 100%;
  border: none;
  background: transparent;
}

.history .icon-button:hover:not(:disabled) {
  outline: 1px solid var(--line);
  outline-offset: -8px;
}

/* Library */

.library {
  grid-area: library;
  overflow-y: auto;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.configurator[data-theme="dark"] .library {
  border-right-width: 1px;
}

/* Free wardrobe library: heading of a project section (types for one project only). */

.library h2 {
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library > .hint {
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
}

/* A type of the library: one row between lines. */
.lib-type {
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.lib-variant:hover,
.lib-card:hover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent);
  color: var(--accent-text);
}

.lib-name {
  font-weight: 600;
  font-size: 13px;
}

.lib-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.configurator[data-theme="dark"] .lib-card {
  border-color: var(--border);
}

.lib-icon {
  width: 100%;
  height: 56px;
  pointer-events: none;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 104px;
  margin: -40px 0 0 -52px;
  padding: 6px;
  border: 1px dashed #000000;
  background: #ffffff;
  color: #000000;
  pointer-events: none;
}

.ghost-icon {
  width: 100%;
  height: 50px;
}

.ghost-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.drag-ghost.is-valid {
  border: 2px solid #000000;
  padding: 5px;
}

.configurator.is-dragging,
.configurator.is-dragging * {
  cursor: grabbing !important;
}

/* Stage */

.stage {
  grid-area: stage;
  container: stage / inline-size; /* the messages go below the tools of the view when the stage is narrow */
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--stage);
}

.viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  /* The canvas takes the new size of its place a frame after the window changes: until then it must not widen the page. */
  overflow: hidden;
  touch-action: none;
}

.viewport canvas {
  display: block;
}

.viewport-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ai-toggle {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.ai-toggle:hover {
  outline: 1px solid var(--line);
  outline-offset: 2px;
}


.messages {
  position: absolute;
  top: 14px;
  left: 14px;
  /* Beside the tools of the view (five toggles and three buttons, about 770 px), never under them. */
  max-width: clamp(240px, calc(100% - 800px), 460px);
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
  overflow-wrap: anywhere; /* a file name is one long word */
}

/* A stage too narrow for the messages beside the tools of the view (the module builder, a small window): they go
   below the row of the tools – two rows when the tools wrap. */
@container stage (max-width: 1040px) {
  .messages {
    top: 64px;
    max-width: min(460px, calc(100% - 28px));
  }
}

@container stage (max-width: 760px) {
  .messages {
    top: 110px;
  }
}

/* No colours: the kind of a message is its mark – ✕ error, ! warning, › information; an error has a heavier frame. */
.messages li {
  margin-bottom: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.messages li::before {
  content: "› ";
}

.messages li.error {
  border-width: 2px;
  padding: 7px 11px;
}

.messages li.error::before {
  content: "✕ ";
}

.messages li.warning::before {
  content: "! ";
  font-weight: 600;
}

/* Module bar */

.bar {
  padding: 12px 20px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.configurator[data-theme="dark"] .bar {
  border-top-width: 1px;
}

.bar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 8px;
}

.bar-summary {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* Proportional track: the run in mm, left to right. */

/* Wall caps at both ends of the run. */

/* Blue marks only the selection (as in 3D), never a module type. */

.strip {
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 2px 0 6px;
  list-style: none;
  overflow-x: auto;
}

.strip-empty {
  padding: 10px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.chip {
  position: relative;
  display: grid;
  gap: 5px;
  flex: none;
  width: 160px;
  margin-left: 18px;
  padding: 7px 6px 7px 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: inset 4px 0 0 var(--keep-fill);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.chip select,
.chip input {
  cursor: auto;
}

/* Chip being dragged along the bar to reorder the run. */
.chip.is-dragged {
  z-index: 2;
  opacity: 0.92;
  cursor: grabbing;
  box-shadow: inset 4px 0 0 var(--keep-fill);
  outline: 2px solid var(--line);
}

/* While sorting, the other chips slide aside to open the gap. */
.strip.is-sorting .chip:not(.is-dragged) {
  transition: transform 0.18s ease;
}

.strip.is-sorting .chip + .chip::before {
  visibility: hidden;
}

.configurator[data-theme="dark"] .chip {
  border-color: var(--border);
}

.chip:first-child {
  margin-left: 0;
}

/* The bar reads like a formula: 600 mm : 1 : 2 : 400 mm */
.chip + .chip::before {
  content: ":";
  position: absolute;
  top: 50%;
  left: -13px;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--muted);
}

.chip.is-flex {
  border-style: dashed;
  box-shadow: inset 4px 0 0 var(--muted);
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, var(--surface) 10px 20px);
}

.chip.is-selected {
  border-color: var(--accent-ink);
  outline: 1px solid var(--line);
  outline-offset: -1px;
}

.chip select,
.chip input {
  min-width: 0;
  height: 28px;
  padding: 0 5px;
  font-size: 12px;
}

.chip-mode {
  display: flex;
  flex: none;
  border: 1px solid var(--input-border);
}

.chip-mode button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: var(--input-bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.chip-mode button + button {
  border-left: 1px solid var(--border);
}

.chip-mode button[aria-checked="true"] {
  background: var(--keep-fill);
  color: var(--keep-text);
  font-weight: 600;
}

.detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-height: 42px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
}

.detail > strong {
  color: var(--accent-ink);
}

.detail-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.detail-field select {
  width: auto;
  height: 32px;
  padding: 0 6px;
  text-transform: none;
}

.detail-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.detail-actions .icon-button {
  width: 34px;
  height: 32px;
}

.danger-button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--error);
  border-radius: 0;
  background: transparent;
  color: var(--error);
  font-family: var(--font-mono);
  font-size: 12px;
}

.danger-button:hover {
  background: var(--error);
  color: var(--bg);
}

/* ---------- AI assistant ---------- */

.assistant {
  position: absolute;
  top: 60px;
  right: 14px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100% - 28px));
  max-height: calc(100% - 300px);
  min-height: 280px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px 14px;
  border-bottom: 1px solid var(--border);
}

.assistant-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.assistant-head strong svg {
  color: var(--accent-ink);
}

.assistant-head .icon-button {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
}

.assistant-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
}

.ai-examples p {
  margin: 0 0 10px;
  font-size: 13px;
}

.ai-example {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 1px dashed var(--input-border);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  text-align: left;
}

.ai-example:hover {
  border-style: solid;
  border-color: var(--accent-ink);
}

.ai-msg {
  max-width: 92%;
  margin-bottom: 10px;
  padding: 8px 12px;
  font-size: 13px;
}

.ai-msg p {
  margin: 0;
  white-space: pre-wrap;
}

/* The user's own words: inverted. */
.ai-msg.is-user {
  margin-left: auto;
  background: var(--text);
  color: var(--bg);
}

.ai-msg.is-assistant {
  padding-left: 0;
}

.ai-msg.is-assistant::before {
  content: "Assistant";
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-msg.is-pending {
  color: var(--muted);
  font-style: italic;
}

/* A request in progress can be cancelled. */
.ai-msg.is-pending .ai-cancel {
  margin-top: 6px;
  padding: 0;
  font-style: normal;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--muted);
}

.ai-msg.is-pending .ai-cancel:hover {
  color: var(--text);
}

.ai-msg.is-error {
  border: 2px solid var(--error);
  color: var(--error);
}

.ai-msg.is-error::before {
  content: "✕ ";
}

.ai-meta {
  display: block;
  margin-top: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.assistant-status {
  margin: 0;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--warning);
}

.assistant-status:empty {
  display: none;
}

.assistant-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}

.assistant-form textarea {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  resize: none;
}

.assistant-form button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- Materials (src/materials_panel.js) ---------- */

.materials {
  position: absolute;
  top: 60px;
  right: 14px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100% - 28px));
  max-height: calc(100% - 300px);
  min-height: 280px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.materials-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 16px;
}

.mat-scope {
  display: flex;
  padding: 0;
  border: none;
}

.mat-scope button {
  flex: 1;
}

.mat-scope button:disabled {
  opacity: 0.45;
}

.mat-hint {
  margin: 10px 0 0;
  font-size: 12px;
}

.mat-row {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.mat-card {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mat-card.is-own {
  border-color: var(--accent-ink);
}

.mat-card h4 {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mat-current {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mat-current-swatch {
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background-size: cover;
}

.mat-current-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 13px;
}

.mat-current-text > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mat-current-text .muted {
  font-size: 12px;
}

.mat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.mat-actions .chip-button {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.mat-grain[aria-pressed="true"] {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.mat-picker {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mat-tabs button {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
}

.mat-tabs button[aria-selected="true"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.mat-search {
  width: 100%;
  margin-top: 8px;
  padding: 6px 9px;
  border: 0;
  border-bottom: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.mat-grid-holder {
  max-height: 260px;
  margin-top: 8px;
  overflow-y: auto;
}

.mat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}

.mat-swatch {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
}

.mat-swatch img,
.mat-swatch-plain {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

/* (A decor of the catalogue of the workshop without a texture: the plain colour of the swatch itself.) */
.mat-swatch-plain {
  background: transparent;
}

.mat-swatch-code {
  padding: 2px 3px;
  overflow: hidden;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mat-swatch:hover {
  border-color: var(--accent-ink);
}

.mat-swatch[aria-selected="true"] {
  outline: 1px solid var(--line);
  outline-offset: 1px;
}

.mat-empty {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.detail-materials {
  height: 32px;
}

.mat-grain-fixed {
  font-size: 12px;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 980px) {
  .configurator {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(460px, 75vh) auto;
    grid-template-areas: "top" "stage" "library";
    height: auto;
    min-height: 100%;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar > * {
    min-height: 48px;
  }

  .room-inline {
    margin-right: 0;
  }

  .library {
    border: none;
    border-top: 1px solid var(--line);
    overflow: visible;
  }

  .messages {
    max-width: calc(100% - 28px);
    top: 60px;
  }

  .assistant,
  .materials {
    max-height: calc(100% - 70px);
  }

  /* Touch: the page must scroll over the library; items are added by tapping. */
  .lib-card,
  .lib-variant {
    touch-action: manipulation;
  }
}

@media (max-width: 640px) {
  .site-header,
  .home-main,
  .site-footer,
  .setup-head-title,
  .setup-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .continue {
    grid-template-columns: 1fr;
  }

  .product-card {
    padding: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .product-visual {
    height: 200px;
    padding: 20px 0 8px;
  }

  .product-text {
    padding: 0 0 24px;
  }

  .saved-visual {
    display: none;
  }
}

/* ---------- Configurator: the library with the sizes of the next module, the front view ---------- */

/* A module of the library in the free wardrobe: a row – icon and name, the size of the next one under it. */
.stk-type .stk-card {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 2px 0;
  border: 0;
  text-align: left;
}

.stk-type .stk-card:hover {
  background: none;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stk-type .stk-card .lib-icon {
  width: 56px;
  height: 64px;
  flex: none;
}

.stk-size {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.stk-size-field {
  display: grid;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.stk-size-field input {
  width: 100%;
  height: 30px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--input-border);
}

.stk-size-field input.is-invalid {
  border-color: var(--error);
  outline: 1px solid var(--error);
}

.detail-field input.stk-dim {
  width: 80px;
  height: 32px;
  padding: 0 6px;
}

/* Bottom bar of the free wardrobe: the front view map and the add button. */
.matrix {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 0;
  padding: 2px 0 6px;
  list-style: none;
  overflow-x: auto;
}

/* Front view at scale: the room, the space between the fillers, the modules where they stand. */
.stk-map {
  position: relative;
  flex: none;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(45deg, transparent 0 6px, var(--border) 6px 7px);
}

.stk-map-space {
  position: absolute;
  border: 1px dashed var(--muted);
  border-bottom: none;
  background: var(--surface);
}
/* No wall at that side, no ceiling: the space is open there. */
.stk-map-space.is-open-left { border-left-color: transparent; }
.stk-map-space.is-open-right { border-right-color: transparent; }
.stk-map-space.is-open-top { border-top-color: transparent; }

.mx-cell.stk-map-cell {
  position: absolute;
  padding: 1px 4px;
}

/* The plinth legs under the carcass of a module in the front view: a strip of their height at its bottom. */
.stk-map-legs {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  border-left: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  border-top: 1px dashed var(--muted);
  pointer-events: none;
}

/* Question before a width change of a module with modules standing on it. */
.stk-dialog {
  max-width: min(480px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
}

.stk-dialog::backdrop {
  background: rgb(255 255 255 / 0.85);
}

.stk-dialog h3 {
  font-size: 18px;
  font-weight: 600;
}

.stk-dialog p {
  margin: 12px 0 20px;
}

.stk-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stk-dialog-actions button:not(.text-button) {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.stk-dialog-actions button.stk-dialog-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.stk-dialog-actions button:hover:not(.stk-dialog-primary) {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.stk-dialog-actions .text-button {
  height: 36px;
  margin-left: auto;
}

/* The tool "Rozměr" (src/resize_panel.js, docs/stack_reference.md 7.4c): the labels of the six arrows over the stage,
   the field of the side clicked, the dialog about the modules the new size reaches. */
.rz-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.rz-chip,
.rz-edit {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.rz-chip {
  cursor: pointer;
}

.rz-chip:hover,
.rz-chip:focus-visible {
  background: var(--accent);
  color: var(--accent-text);
}

.rz-glyph {
  font-size: 13px;
  line-height: 1;
}

.rz-edit {
  padding-right: 6px;
  background: var(--accent);
  color: var(--accent-text);
}

.rz-edit input {
  width: 74px;
  height: 20px;
  padding: 0 4px;
  border: 1px solid var(--accent-strong);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  text-align: right;
}

.rz-edit input.calc-invalid {
  border-color: var(--error);
  outline: 1px solid var(--error);
}

.rz-unit {
  font-weight: 500;
}

.rz-edit-hint {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  padding: 2px 6px;
  border: 1px solid var(--error);
  background: var(--surface);
  color: var(--error);
  font-weight: 500;
}

.rz-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
}

.rz-dialog p {
  margin: 10px 0;
}

.rz-dialog .rz-summary {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rz-dialog .rz-limit,
.rz-dialog .rz-problem {
  padding: 8px 10px;
  border-left: 3px solid var(--error);
  background: var(--surface);
  color: var(--error);
}

.rz-hits {
  margin: 0 0 20px;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.rz-hit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.rz-hit-text {
  display: flex;
  flex: 1 1 200px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.rz-hit-text span {
  color: var(--muted);
  font-size: 12px;
}

.rz-options {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--input-border);
}

.rz-option {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.rz-option:first-child {
  border-left: 0;
}

.rz-option:hover:not(:disabled) {
  color: var(--accent-ink);
}

.rz-option[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.rz-option:disabled {
  color: var(--muted);
  text-decoration: line-through;
  cursor: not-allowed;
}

.mx-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  box-shadow: inset 4px 0 0 var(--keep-fill);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.mx-cell.is-none {
  box-shadow: inset 4px 0 0 var(--muted);
  background: repeating-linear-gradient(135deg, var(--flex-a) 0 3px, var(--flex-b) 3px 6px);
}

.mx-cell.is-drawers {
  box-shadow: inset 4px 0 0 var(--keep-fill), inset 0 -3px 0 var(--border);
}

.mx-cell:hover {
  border-color: var(--accent-ink);
}

.mx-cell.is-selected {
  border-color: var(--accent-ink);
  outline: 1px solid var(--line);
  outline-offset: -1px;
}

.mx-type {
  flex: none;
  max-width: 60%;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mx-add-column:hover {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.mx-tail {
  flex: none;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
}

.mx-add-column {
  height: 60px;
  padding: 0 12px;
  border: 1px dashed var(--muted);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

@media (max-width: 980px) {
  .stk-type .stk-card {
    touch-action: manipulation;
  }
}

/* mm / × switch of a module size (stack configurator). */
.stk-dim-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.stk-dim-head .chip-mode button {
  width: 24px;
  height: 20px;
  font-size: 11px;
}

.stk-size-field select {
  width: 100%;
  height: 30px;
  padding: 0 4px;
}

.stk-flex-note {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 6px;
  border: 1px dashed var(--muted);
  font-size: 11px;
  text-transform: none;
}

.detail-field .chip-mode button {
  height: 32px;
}

.detail-field select {
  height: 32px;
}

.stk-resolved {
  color: var(--text);
  text-transform: none;
  white-space: nowrap;
}

/* Move mode: distances of the selected module over the 3D stage (stack configurator). */
.stk-dims {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.stk-dim-label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
}

.stk-dim-label input {
  width: 72px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.stk-dim-label.is-free {
  padding: 3px 8px;
  border: 1px dashed var(--accent-ink);
  background: var(--surface);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Size change waiting for the side that moves (section 7.4b): buttons at the arrows over the stage. */
.stk-dim-label.stk-side {
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.stk-dim-label.stk-side:disabled {
  border-style: dashed;
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
}

.detail-field input.stk-dim.is-pending {
  border-color: var(--accent-ink);
  outline: 1px solid var(--line);
}

.stk-side-choice {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stk-move[aria-pressed="true"] {
  border-color: var(--accent-ink);
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- Module builder (builder.html, docs/module_builder_reference.md) ---------- */

/* Construction left, the stage, definition right (docs/module_builder_reference.md section 9). */
.builder {
  grid-template-columns: 400px minmax(0, 1fr) 400px;
  grid-template-areas:
    "top top top"
    "library stage definition";
}

.mb-drafts {
  gap: 8px;
}

.mb-drafts-label {
  color: var(--muted);
}

.mb-drafts select {
  width: 240px;
  height: 32px;
  padding: 0 8px;
}

.mb-drafts .chip-button,
.mb-drafts .danger-button,
.mb-save-group .chip-button {
  height: 32px;
}

.mb-panel {
  padding: 12px 14px 48px;
}

.mb-intro {
  margin: 0;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--border);
}

.mb-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.mb-heading {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mb-sub {
  margin: 14px 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mb-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mb-row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mb-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.mb-field input,
.mb-field select {
  height: 32px;
  padding: 0 8px;
  text-transform: none;
}

.mb-field input[type="text"] {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.mb-segmented {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  border-left: none;
}

.mb-segmented button {
  height: 30px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

/* The open zone: breadcrumb, front view (schema) and its icons in one box. */
.mb-open {
  margin: 14px 0 0;
  padding: 10px 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.mb-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.mb-crumb-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.mb-crumb {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mb-crumb:hover {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.mb-crumb[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.mb-crumb-sep,
.mb-crumb-size {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.mb-schema {
  display: grid;
  place-items: center;
  padding: 6px;
  background: var(--stage);
}

.mb-schema-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 440px;
  font-family: var(--font-mono);
}

.mb-schema-svg polygon,
.mb-schema-svg rect {
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}

/* Cabinet oblique view: the front, top and right face of every box in their own shade. */
.mb-sch-open polygon {
  fill: var(--surface-2);
  stroke: var(--el-line);
  stroke-width: 1;
}

.mb-sch-open .mb-face-top,
.mb-sch-open .mb-face-right {
  fill: var(--surface);
}

.mb-sch-zone polygon {
  fill: transparent;
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: all;
  cursor: pointer;
}

.mb-sch-zone:hover polygon {
  fill: var(--accent-soft);
  stroke: var(--accent-ink);
  stroke-dasharray: none;
}

.mb-sch-hatch {
  stroke: var(--muted);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.6;
}

.mb-sch-back polygon {
  fill: var(--el-back);
  fill-opacity: 0.6;
  stroke: var(--el-line);
  stroke-width: 0.8;
  pointer-events: none;
}

.mb-sch-back .mb-face-front {
  fill: url(#mb-hatch);
}

.mb-sch-back.is-selected polygon {
  stroke: var(--accent);
  stroke-width: 2.5;
}

/* See-through boards, so the inside of the zone stays visible (as the translucent 3D view). */
.mb-sch-board polygon {
  fill-opacity: 0.55;
  stroke: var(--el-line);
  stroke-width: 1;
  cursor: pointer;
}

.mb-sch-board .mb-face-front {
  fill: var(--el-carcass);
}

.mb-sch-board .mb-face-top {
  fill: var(--el-back);
}

.mb-sch-board .mb-face-right {
  fill: var(--border);
}

.mb-sch-board.is-loose polygon {
  stroke-dasharray: 3 2;
}

.mb-sch-board:hover polygon {
  stroke: var(--accent-ink);
  stroke-width: 2;
}

.mb-sch-board.is-selected polygon {
  fill: var(--accent);
  fill-opacity: 0.85;
  stroke: var(--accent);
}

.mb-sch-board.is-selected .mb-face-top {
  opacity: 0.8;
}

.mb-sch-board.is-selected .mb-face-right {
  opacity: 0.65;
}

.mb-sch-front {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.2;
  stroke-dasharray: 6 3;
  pointer-events: none;
}

.mb-sch-front.is-selected {
  stroke-width: 2.5;
  stroke-dasharray: none;
}

.mb-sch-label {
  fill: var(--muted);
  pointer-events: none;
}

.mb-sch-id {
  fill: var(--text);
  font-weight: 600;
}

.mb-sch-tag {
  cursor: pointer;
}

.mb-sch-tag rect {
  fill: var(--surface-2);
  stroke: var(--accent-ink);
  stroke-width: 1;
}

.mb-sch-tag text {
  fill: var(--accent-ink);
  font-weight: 600;
}

.mb-sch-tag-back rect {
  stroke: var(--muted);
}

.mb-sch-tag-back text {
  fill: var(--muted);
}

.mb-sch-tag:hover rect,
.mb-sch-tag.is-selected rect {
  fill: var(--accent);
  stroke: var(--accent);
}

.mb-sch-tag:hover text,
.mb-sch-tag.is-selected text {
  fill: var(--accent-text);
}

.mb-schema-hint {
  margin-bottom: 4px;
}

.mb-open .mb-sub {
  margin-top: 12px;
}

.mb-part {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.mb-part-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mb-part-head .mb-heading {
  margin: 0;
}

.mb-close {
  width: 30px;
  height: 30px;
}

/* The bin beside the close button of the part settings: pushed right, red on hover. */
.mb-part-delete {
  margin-left: auto;
}

.mb-part-delete:hover {
  border-color: var(--error);
  color: var(--error);
}

.mb-row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* The two heights of a module with their locks and its plinth legs (docs/module_builder_reference.md section 7a). */
.mb-height-input {
  display: flex;
  gap: 4px;
  align-items: center;
}

.mb-height-input input {
  flex: 1;
  min-width: 0;
}

.mb-hold {
  flex: none;
  width: 32px;
  height: 32px;
  color: var(--muted);
}

.mb-hold[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.mb-field.mb-legs-on {
  flex-direction: row;
  align-items: center;
  align-self: end;
  gap: 8px;
  height: 32px;
  color: var(--text);
}

.mb-legs-on input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.mb-legs-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.mb-legs-note.is-warning {
  color: var(--warning);
}

.mb-icons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.mb-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px 6px;
  border: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.mb-icon:hover:not(:disabled) {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.mb-icon[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.mb-icon:disabled {
  border-style: dashed;
  text-decoration: line-through;
}

.mb-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mb-checks .toggle {
  height: 30px;
  padding: 0 10px;
}

.mb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mb-actions .chip-button {
  height: 32px;
}

.mb-joint span {
  text-transform: none;
}

.mb-parts {
  flex: none;
  max-height: 34%;
  overflow-y: auto;
  padding: 10px 16px 12px;
}

.mb-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}

.mb-table th {
  position: sticky;
  top: 0;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-align: left;
}

.mb-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.mb-table tbody tr {
  cursor: pointer;
}

.mb-table tbody tr:hover {
  text-decoration: underline;
}

/* The selected part: inverted (its tokens too, so the cells keep the contrast). */
.mb-table tr.is-selected {
  background: var(--line);
  color: var(--bg);
  --text: var(--bg);
  --muted: var(--bg);
}

/* ---------- Module library (library_panel.js): builder drawer, free wardrobe panel ---------- */

.mb-save-group {
  gap: 8px;
  margin-right: auto;
}

.mb-save {
  min-height: 0;
  height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}

/* The builder has more in its top bar: tighter cells, nothing wraps. */
.builder .topbar > * {
  padding: 0 12px;
  white-space: nowrap;
}

.builder .topbar-title {
  font-size: 15px;
}

.builder .mb-drafts select {
  width: 190px;
}

.mb-save-state {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.mb-save-state[data-state="changed"] {
  color: var(--warning);
}

.mb-save-state[data-state="saved"] {
  color: var(--ok);
}

.ml-drawer {
  position: absolute;
  top: 14px;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.ml-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
}

.ml-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 16px;
}

.ml-embedded {
  margin: 4px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.ml-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 36px 8px 0;
}

.ml-embedded .ml-head {
  margin-right: 0;
}

.ml-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.ml-manage {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

.ml-folder {
  margin-top: 10px;
}

.ml-folder-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.ml-toggle {
  display: inline-flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 0;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ml-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ml-name-input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--accent-ink);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

.ml-count {
  min-width: 20px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.ml-small {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.ml-empty {
  margin: 6px 2px 0;
}

.ml-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

/* The free wardrobe: the modules of the library as the catalog types (card + the size of the next one). */
.ml-list {
  margin-top: 8px;
}

.ml-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ml-card {
  width: 100%;
}

.ml-card.is-current {
  outline: 2px solid var(--line);
  outline-offset: -2px;
}

.ml-card .lib-name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-align: center;
}

.ml-size {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.ml-error {
  margin: 10px 0 0;
  color: var(--error);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* The manager of the module library (src/library_manager_panel.js): a dialog with the folders on the left and the
   modules of the chosen folder on the right; a band on top while a new module is being saved. */
.library-manager {
  width: min(960px, calc(100vw - 32px));
  max-width: none;
  height: min(680px, calc(100vh - 48px));
  padding: 0;
  overflow: hidden;
  border-radius: 6px;
}

.library-manager[open] {
  display: flex;
  flex-direction: column;
}

/* (The window behind is dimmed the same in the light and in the dark theme.) */
.library-manager::backdrop {
  background: rgb(0 0 0 / 0.38);
}

.library-manager:focus {
  outline: none;
}

.library-manager p {
  margin: 0;
}

.lm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.lm-head h3 {
  margin: 0;
  font-size: 15px;
}

.lm-body,
.lm-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}

.lm-save {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
}

.lm-save-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.lm-save-field:first-child {
  flex: 1;
}

.lm-save-input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.lm-save-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.lm-save-folder {
  display: block;
  max-width: 260px;
  height: 32px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 32px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-button.lm-save-here {
  height: 32px;
  padding: 0 22px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.chip-button.lm-save-here:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: var(--accent-text);
}

.library-manager .chip-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.library-manager .chip-button:disabled:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.lm-note {
  padding: 8px 20px;
}

.lm-columns {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  min-height: 0;
}

.lm-folders {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.lm-items {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.lm-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--border);
}

.lm-col-head h4 {
  margin: 0;
}

.lm-folder-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-col-head .lm-count {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.lm-folder-list {
  flex: 1;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.lm-folder {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 2px 4px 2px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.lm-folder:hover {
  background: var(--hover);
}

.lm-folder.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lm-folder.is-drop {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.lm-folder:focus-visible,
.lm-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.lm-folder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-folder .lm-count {
  min-width: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.lm-folder.is-drop .lm-count {
  color: inherit;
}

.lm-folder-tools {
  display: flex;
  gap: 2px;
  visibility: hidden;
}

.lm-folder:hover .lm-folder-tools,
.lm-folder.is-selected .lm-folder-tools,
.lm-folder:focus-within .lm-folder-tools {
  visibility: visible;
}

.library-manager.is-dragging .lm-folder .lm-folder-tools {
  visibility: hidden;
}

.lm-name-input {
  width: 100%;
  border-radius: 4px;
}

.lm-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 45px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.lm-move {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  white-space: nowrap;
}

.lm-move-to {
  max-width: 200px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}

.lm-move-to:disabled {
  opacity: 0.45;
}

.lm-selected {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.lm-question {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.chip-button.lm-remove-yes {
  border-color: var(--error);
  color: var(--error);
}

.chip-button.lm-remove-yes:hover {
  border-color: var(--error);
  background: var(--error);
  color: var(--accent-text);
}

.lm-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 14px 16px;
  overflow-y: auto;
}

.lm-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.lm-card:hover {
  border-color: var(--accent);
}

.lm-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.lm-card .lib-icon {
  height: 72px;
}

.lm-card-name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.lm-card .lm-name-input {
  flex: none;
  text-align: center;
  user-select: text;
}

.lm-empty {
  padding: 24px 16px;
}

.lm-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.lm-foot p {
  flex: 1;
  min-width: 0;
}

.lm-message {
  font-size: 13px;
}

.lm-message.is-error {
  color: var(--error);
}

.lm-message.is-info {
  color: var(--ok);
}

.chip-button.lm-done {
  justify-content: center;
  min-width: 96px;
}

/* ---------- The versions of the modules of the library (rule Z5 – docs/sestava_v_zakazce.md §2.4) ---------- */
/* "v3" on a card of the library: beside the size (the builder, the manager), beside the name (the cards of a design). */
.ml-version {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.lib-text:has(> .ml-version) {
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 6px;
  align-items: baseline;
}

.lib-text:has(> .ml-version) > .lib-meta {
  grid-column: 1 / -1;
}

.lib-card:hover .ml-version {
  color: inherit;
}

/* The question which modules of a design take their newer version (src/library_updates_panel.js). */
.library-updates {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
}

.library-updates .lu-hint {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.lu-all,
.lu-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.lu-all {
  padding: 0 10px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.lu-list {
  max-height: min(320px, 50vh);
  margin: 0 0 16px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.lu-row {
  border-bottom: 1px solid var(--border);
}

.lu-label {
  padding: 8px 10px;
}

.lu-row:hover {
  background: var(--hover);
}

.lu-all input,
.lu-label input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
}

.lu-number {
  min-width: 34px;
  font-variant-numeric: tabular-nums;
}

.lu-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lu-renamed {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.lu-versions {
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}

.library-updates .lu-message {
  margin: -6px 0 14px;
  color: var(--error);
  font-size: 13px;
}

.library-updates .stk-dialog-primary:disabled {
  opacity: 0.45;
  cursor: default;
}

/* The version of a module in the panel of properties: "v2 · v knihovně v3" and Převzít…. */
.inspector .stk-version-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
  color: var(--text);
}

.inspector .stk-version.has-newer .stk-version-text {
  color: var(--accent-ink);
}

.inspector .stk-version-take {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.lm-ghost {
  position: fixed;
  z-index: 5;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.library-manager.is-dragging,
.library-manager.is-dragging .lm-card,
.library-manager.is-dragging .lm-folder {
  cursor: grabbing;
  user-select: none;
}

/* Narrower screens: the builder's top bar keeps to one line without scrolling. */
@media (max-width: 1800px) {
  .mb-drafts-label {
    display: none;
  }

  .builder .mb-drafts select {
    width: 170px;
  }

  .builder .topbar > * {
    padding: 0 9px;
  }

  .builder .topbar-title {
    font-size: 13px;
  }

  .builder .history .icon-button {
    width: 40px;
  }

  .builder .theme-switch button {
    padding: 0 9px;
  }
}

/* Hardware of the selected doors / drawers (module builder): one card per leaf / drawer. */
.mb-box {
  margin: 10px 0 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
}

.mb-box-error {
  border-style: dashed;
}

.mb-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mb-box-head strong {
  font-size: 13px;
}

.mb-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.mb-box-error .mb-badge {
  color: var(--error);
}

.mb-box-room {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.mb-box .mb-field {
  margin-top: 8px;
}

/* Fixed material of a part (module builder): the decor's swatch beside its choice. */
.mb-decor-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.mb-decor-row .mb-field {
  flex: 1;
  min-width: 0;
}

.mb-decor-row select {
  width: 100%;
}

.mb-decor-thumb {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.mb-choice button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 36px;
  line-height: 1.1;
}

.mb-choice button small {
  font-size: 9px;
  opacity: 0.7;
}

.mb-choice button:disabled {
  border-style: dashed;
  text-decoration: line-through;
  cursor: not-allowed;
}

.mb-spec {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 11px;
}

.mb-spec th,
.mb-spec td {
  padding: 3px 0;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.mb-spec th {
  width: 40%;
  padding-right: 8px;
  color: var(--muted);
  font-weight: normal;
}

.mb-spec td {
  font-family: var(--font-mono);
}

/* Joint descriptors (module builder): a collapsible card per joint of the module and per contact. */
.mb-link + .mb-link {
  margin-top: 6px;
}

/* Joints added by hand (module builder): a remove button on the joint, the card choosing the second part. */
.mb-link {
  position: relative;
}

.mb-link-remove {
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
}

.mb-link:has(.mb-link-remove) .mb-joint > span {
  padding-right: 26px;
}

.mb-link-add {
  margin-top: 8px;
}

.mb-link-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mb-linking {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  background: var(--surface-2);
}

.mb-linking .hint {
  margin: 0;
}

.mb-link-mates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mb-linking > .chip-button {
  justify-self: start;
}

.mb-desc > summary {
  cursor: pointer;
  list-style: none;
}

.mb-desc > summary::-webkit-details-marker {
  display: none;
}

.mb-desc > summary strong::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  transition: transform 0.15s;
}

.mb-desc[open] > summary strong::before {
  transform: rotate(90deg);
}

.mb-desc .mb-badge {
  white-space: normal;
  text-align: right;
}

/* A value stored for this module / contact (not inherited). */
.mb-own > span {
  color: var(--accent-ink);
}

.mb-own > span::after {
  content: " •";
}

/* The rules of a joint (module builder): a table by the length, one row of a linear division per connector. */
.mb-rules {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mb-rules th {
  padding: 0 4px 4px 0;
  color: var(--muted);
  font-weight: normal;
  text-align: left;
}

.mb-rules td {
  padding: 2px 4px 2px 0;
}

.mb-rules input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-bottom: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mb-rules .mb-rule-length {
  width: 72px;
}

.mb-rule-any {
  font-family: var(--font-mono);
  color: var(--muted);
}

.mb-conn-edit {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  background: var(--surface, transparent);
  color: inherit;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
}

/* The connectors of one joint along it: dowels filled, confirmats hollow. */
.mb-strip {
  position: relative;
  height: 16px;
  margin: 6px 0 2px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mb-strip-mark {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 8px;
  margin-left: -4px;
  border-radius: 50%;
}

.mb-strip-mark.mb-conn-dowel_8 {
  background: var(--text);
}

.mb-strip-mark.mb-conn-confirmat_7x50 {
  border: 1.5px solid var(--text);
  background: var(--bg);
}

.mb-box-error-text {
  margin: 4px 0;
  color: var(--error);
  font-size: 12px;
}

/* The rules of the workshop (module builder): a wider drawer, tabs by group, a field per rule. */
.rules-drawer {
  width: min(560px, calc(100% - 28px));
}

.mb-rules-toggle {
  width: 36px;
  height: 36px;
}

.rules-version {
  margin: 6px 0 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.rules-tabs {
  margin-bottom: 12px;
}

.rules-body {
  display: grid;
  gap: 10px;
}

.rules-field {
  padding-left: 8px;
  border-left: 3px solid transparent;
}

.rules-field.is-changed {
  border-left-color: var(--accent);
}

.rules-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.rules-factory {
  font-family: var(--font-mono);
}

.rules-reset {
  margin-left: 6px;
  padding: 0;
  font-size: 11px;
  text-decoration: underline;
}

.rules-length {
  max-width: 220px;
}

.rules-preview {
  margin: 4px 0 8px;
}

.rules-problems {
  margin: 6px 0;
  padding-left: 18px;
  color: var(--error);
  font-size: 12px;
}

.rules-ok {
  color: var(--muted);
}

/* ---------- A module of the free wardrobe edited in place (docs/stack_reference.md section 7.9) ---------- */

.stack-cfg.is-editing {
  grid-template-columns: var(--dock-left, 400px) minmax(0, 1fr) var(--dock-right, 400px);
  grid-template-areas:
    "top top top"
    "library stage definition";
}

/* The left panel is the module builder, the bar its parts list; the library, the map and the wardrobe messages wait. */
.stack-cfg.is-editing .library:not(.mb-definition) > :not(.stk-edit-panel),
.stack-cfg.is-editing .bar-head,
.stack-cfg.is-editing #stk-matrix,
.stack-cfg.is-editing #stk-messages {
  display: none;
}

.stk-edit-panel {
  padding: 0 2px 48px;
}

.stk-edit-parts {
  max-height: 240px;
  overflow-y: auto;
  padding-top: 8px;
}

.stk-edit-parts[hidden],
.stk-edit-panel[hidden] {
  display: none;
}

.stk-edit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
}

.stk-edit-head .mb-badge {
  padding: 2px 8px;
  border: 1px solid var(--border);
}

.stk-edit-head .mb-badge.is-edited {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.stk-edit-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ---------- Module builder: the definition panel (right) and the tree of the zones (construction panel) ---------- */

.mb-definition {
  grid-area: definition;
  border-right: 0;
  border-left: 1px solid var(--line);
}

.configurator[data-theme="dark"] .mb-definition {
  border-left-width: 1px;
}

.mb-definition[hidden] {
  display: none;
}

.mb-definition > .mb-part {
  margin-top: 0;
}

.mb-tree {
  padding: 14px 0 0;
}

.mb-zone {
  border: 1px solid var(--border);
  background: var(--surface);
}

.mb-zone + .mb-zone {
  margin-top: 6px;
}

.mb-zone.is-open {
  box-shadow: inset 0 0 0 1px var(--line);
}

.mb-zone-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 6px 0 2px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mb-zone-caret {
  width: 24px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
}

.mb-zone-caret:hover {
  color: var(--accent-ink);
}

.mb-zone-name {
  padding: 3px 6px;
  border: 1px solid transparent;
  background: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.mb-zone-name:hover {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.mb-zone-name[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.mb-zone-size {
  color: var(--muted);
  font-size: 11px;
}

.mb-zone-carcass {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  margin-left: auto;
  padding: 0 6px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.mb-zone-carcass[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.mb-zone-rows {
  display: grid;
}

/* One face (or the division) of a zone: a narrow row. */
.mb-face-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 2px 6px 2px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.mb-face-row:last-child {
  border-bottom: 0;
}

/* The face whose part is shown in the definition: inverted (its tokens too, so the row keeps the contrast). */
.mb-face-row.is-selected {
  background: var(--line);
  color: var(--bg);
  --text: var(--bg);
  --muted: var(--bg);
  --accent-ink: var(--bg);
  --input-border: var(--bg);
}

.mb-split-row {
  border-top: 1px dashed var(--input-border);
}

.mb-face-name {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.mb-row-part {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 4px;
  border: 0;
  background: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  text-align: left;
}

.mb-row-part:hover {
  color: var(--accent-ink);
}

.mb-face-row.is-empty .mb-row-part {
  color: var(--muted);
}

.mb-row-icon {
  display: inline-flex;
  flex: none;
}

.mb-row-adds {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mb-row-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 7px 0 3px;
  border: 1px dashed var(--input-border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.mb-row-add:hover {
  border-style: solid;
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.mb-row-remove {
  width: 24px;
  height: 24px;
}

.mb-row-remove:hover {
  border-color: var(--error);
  color: var(--error);
}

/* The zones of a division: under their division, indented with a line – they belong to the zone above. */
.mb-zone-children {
  display: grid;
  gap: 6px;
  margin: 0 0 6px 14px;
  padding: 6px 6px 0 10px;
  border-left: 1px solid var(--line);
}

.mb-zone-children .mb-zone-head {
  background: var(--surface);
}

@media (max-width: 980px) {
  .builder,
  .stack-cfg.is-editing {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "stage" "library" "definition";
  }

  .mb-definition {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* A divided top: its strips from the front (left) to the back (right); a pressed strip is a board (lub). */
.mb-rails {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin: 8px 0 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}

.mb-rails-band {
  display: flex;
  gap: 2px;
  min-width: 0;
}

.mb-rail {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 44px;
  padding: 0 2px;
  border: 1px dashed var(--input-border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
}

.mb-rail small {
  font-size: 10px;
}

.mb-rail:hover {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.mb-rail[aria-pressed="true"] {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* The plinth legs of a module off the floor (left out / kept by hand), in the bar of the builder in place. */
.stk-edit-legs {
  color: var(--muted);
  font-size: 11px;
}

/* ---------- Desktop app: notices, recent files, settings (src/app.js, src/settings_panel.js;
   docs/desktop_reference.md sections 13, 15) ---------- */

.app-notice {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(640px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.app-notice[data-type="error"] {
  border-width: 2px;
}

.app-notice[data-type="error"]::before {
  content: "✕ ";
}

.recent .recent-open {
  margin-left: auto;
}

.recent-card .saved-meta {
  overflow-wrap: anywhere;
}

.recent-card.is-missing .saved-name {
  text-decoration: line-through;
}

.ai-settings-link {
  padding: 0;
  text-decoration: underline;
}

.settings-dialog {
  width: min(660px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 48px);
  padding: 0;
}

.settings-dialog p {
  margin: 0;
}

.set-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.set-head h3 {
  margin: 0;
}

.set-body {
  padding: 0 24px 16px;
}

.set-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.set-card:last-child {
  border-bottom: 0;
}

.set-card h4 {
  margin: 0;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.set-segment button {
  padding: 4px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.set-segment button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.set-path {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.set-hint {
  font-size: 13px;
}

.set-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* What cannot be chosen now: dashed and struck through, as everywhere in the app. */
.settings-dialog .chip-button:disabled {
  border-style: dashed;
  text-decoration: line-through;
}

.settings-dialog .chip-button:disabled:hover {
  background: var(--surface-2);
  color: var(--text);
}

.set-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.set-note {
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-size: 13px;
}

.set-note.is-error {
  border-width: 2px;
}

.set-note.is-error::before {
  content: "✕ ";
}

.set-table {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.set-table-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.set-folder {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.set-input {
  height: 34px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

/* The actions of a message of the desktop app (show the saved file in its folder, open it, the settings). */
.messages .msg-action {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

/* The dialog of the production data in the desktop app: where the data go. */
.prod-as {
  display: inline-flex;
  margin-top: 4px;
  border: 1px solid var(--line);
}

.prod-as button {
  padding: 4px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.prod-as button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

/* A window too narrow for the whole top bar of the configurator on one row (with every export: below about
   1560 px – the smallest window of the desktop app, a display scaled to 125 % or 150 %): the bar wraps onto a second
   row instead of pushing its end out of the window. */
@media (min-width: 981px) and (max-width: 1560px) {
  .stack-cfg {
    grid-template-rows: minmax(56px, auto) minmax(0, 1fr);
  }

  .stack-cfg .topbar {
    flex-wrap: wrap;
  }

  .stack-cfg .topbar > * {
    min-height: 44px;
  }
}

/* ---------- The tools of the 3D view (src/view_tools_panel.js, src/viewer_tools.js) ---------- */

/* The dock: the lower right corner of the viewport – the readout of the measuring, the section, the bar, one above
   the other. Only its boxes take the pointer. */
.view-dock {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.view-dock > * {
  pointer-events: auto;
}

/* The bar: groups of buttons that share their borders. */
.view-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.view-tools-group {
  display: flex;
}

.view-tool {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.view-tools-group .view-tool + .view-tool {
  border-left: 0;
}

.view-tool:hover:not(:disabled),
.view-tool[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.view-tool:disabled {
  border-style: dashed;
  opacity: 0.45;
  cursor: default;
}

/* The section: its axis, the slider of its position, the side that stays – above the bar. */
.view-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.view-section[hidden],
.view-readout[hidden],
.view-measure-label[hidden] {
  display: none;
}

.view-section-slider {
  width: 220px;
  accent-color: var(--accent);
}

.view-section-value {
  min-width: 78px;
  font-size: 13px;
  text-align: right;
}

/* Measuring: what the two points say. */
.view-readout {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.view-dock > .view-readout {
  pointer-events: none;
}

.view-readout-value small {
  margin-right: 6px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.view-readout-value.is-main b {
  font-size: 16px;
}

/* A straight view: the points count as they are seen – a quiet note beside what the tool says. */
.view-readout-projected {
  color: var(--muted);
  white-space: nowrap;
}

/* The overlay of a tool over the canvas: never in the way of the pointer. */
.view-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  color: var(--text);
  pointer-events: none;
}

.view-measure-line {
  stroke: currentColor;
  stroke-width: 1.5;
}

.view-measure-legs {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}

.view-measure-point {
  fill: var(--surface);
  stroke: currentColor;
  stroke-width: 1.5;
}

.view-measure-hover {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.view-measure-label {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  padding: 2px 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* ====================================================================================================================
   The look of a CAD program (2026-11): a title strip with the workspaces, a ribbon of tools in groups, panels with
   headers, a status bar; neutral greys with one accent colour; small radii; fields with frames. This section comes
   last and restyles what the sections above lay out – the tokens at the top of the file carry the palette.
   Source of truth: docs/configurator_ui_reference.md, section 1
   ==================================================================================================================== */

html, body {
  font-size: 13px;
  line-height: 1.4;
}

/* ---------- Controls ---------- */

button.primary {
  min-height: 32px;
  padding: 0 14px;
  gap: 12px;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--chrome-text);
}

button.primary:disabled {
  border-style: solid;
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

.icon-button:hover:not(:disabled) {
  border-color: transparent;
  background: var(--hover);
}

.chip-button,
.toggle {
  height: 28px;
  padding: 0 10px;
  border-color: var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 12.5px;
}

.toggle {
  border-color: transparent;
  background: none;
}

.chip-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.text-button {
  font-family: var(--font-sans);
}

.danger-button {
  border-radius: 4px;
}

input[type="number"],
input[type="text"],
input.calc-input,
select,
textarea {
  padding: 4px 6px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 13px;
}

input[type="number"]:hover,
input[type="text"]:hover,
input.calc-input:hover,
select:hover {
  border-color: var(--muted);
}

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

/* A segmented switch: one frame, the pressed part in the accent. */
.theme-switch button {
  height: 26px;
  padding: 0 10px;
  border-color: var(--border);
  font-family: var(--font-sans);
  font-size: 12px;
}

.theme-switch button:first-child {
  border-radius: 4px 0 0 4px;
}

.theme-switch button:last-child {
  border-radius: 0 4px 4px 0;
}

.theme-switch button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.mono-label,
.eyebrow {
  letter-spacing: 0.04em;
}

/* Messages: the kind of a message is its colour (and its mark). */
.messages {
  /* (Never narrower than a few words: on a scene as narrow as it may get – 320 px – a message broken into a column of
     letters would reach below the scene and give the window a scroll bar.) */
  max-width: min(460px, max(220px, calc(100% - 290px)));
}

.messages li {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-family: var(--font-sans);
  font-size: 12.5px;
}

.messages li.error {
  padding: 6px 10px;
  border-width: 1px 1px 1px 3px;
  border-left-color: var(--error);
}

.messages li.error::before {
  color: var(--error);
}

.messages li.warning {
  border-left-color: var(--warning);
}

.messages li.warning::before {
  color: var(--warning);
}

/* ---------- The start page ---------- */

.home {
  background: var(--bg);
}

.site-header {
  max-width: none;
  padding: 0 20px;
  height: 40px;
  background: var(--titlebar);
  color: var(--titlebar-text);
}

.site-header .brand {
  font-size: 14px;
  letter-spacing: 0;
}

.site-nav {
  font-family: var(--font-sans);
  font-size: 13px;
}

.site-nav .theme-switch button {
  color: inherit;
}

.site-nav .theme-switch button[aria-pressed="true"] {
  color: inherit;
}

.home-main {
  gap: 20px;
  max-width: 1200px;
  padding: 28px 32px 40px;
}

.hero {
  align-items: baseline;
  gap: 6px 40px;
}

.hero-title {
  gap: 4px;
  flex: 1 1 480px;
}

.hero h1 {
  max-width: none;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.hero-lead {
  flex: 1 1 380px;
  max-width: 520px;
  font-size: 13px;
  color: var(--muted);
}

.home .continue,
.home .saved,
.home .product-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.home .continue {
  padding: 14px 18px;
}

.home .saved {
  padding: 14px 18px;
}

.site-footer {
  color: var(--muted);
}

/* ---------- The shell of the design: title strip, ribbon, panels, status bar ---------- */

.cad {
  grid-template-columns: 292px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) 24px;
  grid-template-areas:
    "top top"
    "library stage"
    "status status";
}

.cad[data-workspace="drawing"] {
  grid-template-columns: var(--dock-left, 236px) minmax(0, 1fr) var(--dock-right, 280px);
  grid-template-areas:
    "top top top"
    "library stage definition"
    "status status status";
}

.cad.is-editing {
  grid-template-areas:
    "top top top"
    "library stage definition"
    "status status status";
}

.cad-top {
  display: block;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-sans);
}

.cad-top > * {
  padding: 0;
}

.cad-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 6px;
  background: var(--titlebar);
  color: var(--titlebar-text);
}

.cad-titlebar .icon-button,
.cad-titlebar .text-button,
.cad-titlebar .cad-home,
.cad-titlebar .theme-switch button {
  color: inherit;
}

.cad-titlebar .icon-button:hover:not(:disabled),
.cad-home:hover {
  background: var(--titlebar-hover);
}

.cad-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: none;
  font-size: 12.5px;
}

.cad-titlebar .topbar-product {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 12px;
  border-left: 1px solid var(--titlebar-line);
}

.cad-titlebar .topbar-title {
  font-size: 13px;
  font-weight: 600;
}

.cad-titlebar .brand-mark {
  width: 10px;
  height: 10px;
  background: var(--accent-ink-on-dark);
}

.cad-docname {
  overflow: hidden;
  max-width: 280px;
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.75;
}

.cad-docname:not(:empty)::before {
  content: "· ";
}

.cad-spacer {
  flex: 1;
}

/* The workspaces: tabs that stand on the ribbon. */
.cad-workspaces {
  display: flex;
  align-self: flex-end;
  gap: 2px;
  margin-left: 18px;
}

.cad-workspaces button {
  height: 28px;
  padding: 0 18px;
  border: 0;
  border-radius: 5px 5px 0 0;
  background: none;
  color: inherit;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.8;
}

.cad-workspaces button:hover:not(:disabled) {
  background: var(--titlebar-hover);
  opacity: 1;
}

.cad-workspaces button[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  opacity: 1;
}

.cad-workspaces button:disabled {
  opacity: 0.4;
}

.cad-titlebar .history {
  display: inline-flex;
  gap: 2px;
}

.cad-titlebar .history .icon-button {
  width: 28px;
  height: 28px;
}

.cad-titlebar .history .icon-button:hover:not(:disabled) {
  outline: 0;
}

.cad-titlebar .save-button {
  position: relative;
  height: 26px;
  margin: 0 8px 0 4px;
  padding: 0 12px;
  gap: 6px;
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
}

.cad-titlebar .save-button:hover {
  outline: 0;
  background: var(--accent-strong);
  text-decoration: none;
}

.cad-titlebar .theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 0 4px;
}

.cad-titlebar .theme-switch button {
  height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: none;
  font-size: 12px;
  opacity: 0.65;
}

.cad-titlebar .theme-switch button + button::before {
  content: none;
}

.cad-titlebar .theme-switch button[aria-pressed="true"] {
  background: var(--titlebar-hover);
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  opacity: 1;
}

/* The ribbon: groups of tools with a caption under each. */
.cad-ribbon {
  display: flex;
  align-items: stretch;
  padding: 5px 4px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cad[data-workspace="model"] .cad-ribbon[data-for="drawing"],
.cad[data-workspace="drawing"] .cad-ribbon[data-for="model"] {
  display: none;
}

.rb-group {
  display: flex;
  flex: none;
  flex-direction: column;
  padding: 0 8px;
  border-right: 1px solid var(--border);
}

.rb-group:last-child {
  border-right: 0;
}

.rb-items {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 2px;
  min-height: 52px;
}

.rb-items.rb-small {
  display: grid;
  grid-template-rows: repeat(2, 25px);
  grid-auto-flow: column;
  align-content: center;
  gap: 2px 2px;
}

.rb-caption {
  padding: 2px 0 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.rb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 58px;
  height: 52px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  line-height: 1.1;
  white-space: nowrap;
}

.rb svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.rb-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 0 8px 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  cursor: pointer;
}

.rb-check svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.rb-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rb:hover:not(:disabled),
.rb-check:hover:not(:disabled) {
  border-color: var(--border);
  background: var(--hover);
  text-decoration: none;
}

.rb[aria-pressed="true"],
.rb[aria-expanded="true"],
.rb-check:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.rb:disabled,
.rb-check:disabled {
  opacity: 0.4;
}

.rb.ai-toggle {
  border-color: transparent;
  background: none;
  color: var(--text);
  font-weight: 400;
}

.rb.ai-toggle svg {
  color: var(--accent-ink);
}

.rb.ai-toggle:hover {
  outline: 0;
}

.cad-ribbon .room-inline {
  display: grid;
  gap: 3px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.cad-ribbon .room-inline label {
  display: grid;
  grid-template-columns: 14px 68px;
  align-items: center;
  gap: 4px;
}

.cad-ribbon .room-inline input {
  width: 68px;
  height: 23px;
  padding: 0 6px;
  text-align: right;
}

/* Panels: the library, the browser of the drawings, the properties. */
.cad .library {
  padding: 0 10px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.cad .library h2 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 -10px 8px;
  padding: 8px 12px 7px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.cad .library > .hint {
  border-bottom: 0;
}

.lib-help {
  margin: 0 0 8px;
  font-size: 12px;
}

.lib-help summary {
  color: var(--muted);
  cursor: pointer;
}

.lib-help .hint {
  margin: 6px 0 0;
}

.lib-type {
  border-bottom-color: var(--border);
  background: none;
}

.lib-card {
  border-color: var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.lib-variant:hover,
.lib-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.cad .mb-definition,
.cad .dwg-properties {
  grid-area: definition;
  border-right: 0;
  border-left: 1px solid var(--line);
}

/* What each workspace shows. */
.cad[data-workspace="model"] .dwg-browser,
.cad[data-workspace="model"] .dwg-stage,
.cad[data-workspace="model"] .dwg-properties,
.cad[data-workspace="drawing"] .library:not(.dwg-browser):not(.dwg-properties),
.cad[data-workspace="drawing"] .viewport,
.cad[data-workspace="drawing"] .assistant,
.cad[data-workspace="drawing"] .materials,
.cad[data-workspace="drawing"] .bar {
  display: none;
}

.cad .stage {
  background: var(--stage);
}

.cad .bar {
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.bar-summary {
  font-family: var(--font-sans);
}

/* The panels over the stage (the assistant, the materials) stand beside the view cube. */
.cad .assistant,
.cad .materials {
  top: 12px;
  right: 276px;
  border-color: var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-strong);
  max-height: calc(100% - 230px);
}


.drag-ghost {
  border: 1px dashed #5f6772;
  border-radius: 4px;
}

.drag-ghost.is-valid {
  border: 2px solid #0b63ce;
}

/* The status bar. */
.statusbar {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  padding: 0 4px 0 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-hint {
  overflow: hidden;
  min-width: 0;
  color: var(--text);
  text-overflow: ellipsis;
}

.status-spacer {
  flex: 1;
}

.status-item {
  padding: 0 10px;
  border-left: 1px solid var(--border);
}

.status-item:empty {
  display: none;
}

/* ---------- The 3D view: the view cube, the navigation bar, the dimensions ---------- */

.view-corner {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 6px;
  user-select: none;
}

.view-cube {
  position: relative;
  grid-column: 1 / -1;
  justify-self: center;
  width: 144px;
  height: 132px;
  cursor: grab;
  touch-action: none;
}

.view-cube.is-turning {
  cursor: grabbing;
}

.view-cube-scene {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
}

.view-cube-box {
  position: absolute;
  transform-style: preserve-3d;
}

.view-cube-face {
  position: absolute;
  top: -38px;
  left: -38px;
  display: grid;
  grid-template: 15px 1fr 15px / 15px 1fr 15px;
  width: 76px;
  height: 76px;
  border: 1px solid var(--cube-edge);
  background: var(--cube-face);
  backface-visibility: hidden;
}

.view-cube-cell {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: inherit;
}

.view-cube-face.is-facing .view-cube-cell.is-face {
  color: var(--text);
}

.view-cube-cell.is-hot {
  background: var(--accent);
  color: #ffffff;
}

.view-cube-axes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.view-cube-axis {
  stroke-width: 1.6;
  stroke-linecap: round;
}

.view-cube-axis-label {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
}

.view-cube-axis.is-x { stroke: #e5484d; }
.view-cube-axis.is-y { stroke: #30a46c; }
.view-cube-axis.is-z { stroke: #3b82f6; }
.view-cube-axis-label.is-x { fill: #e5484d; }
.view-cube-axis-label.is-y { fill: #30a46c; }
.view-cube-axis-label.is-z { fill: #3b82f6; }

.view-home {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.view-home:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.view-modes {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

/* (Two ways of looking, as wide as each other: the name of the parallel one changes – straight / axonometric –
   and must not move the buttons.) */
.view-mode {
  flex: 1 1 0;
  min-width: 82px;
  height: 22px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 10.5px;
  white-space: nowrap;
}

.view-mode + .view-mode {
  border-left: 1px solid var(--border);
}

.view-mode:hover:not(:disabled) {
  background: var(--hover);
}

.view-mode[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

/* The navigation bar: in the middle of the lower edge of the viewport. */
.view-dock {
  right: 12px;
  bottom: 10px;
  left: 12px;
  align-items: center;
}

.view-tools {
  flex-wrap: nowrap;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.view-tools-group {
  gap: 1px;
  padding: 0 4px;
  border-right: 1px solid var(--border);
}

.view-tools-group:last-child {
  border-right: 0;
}

.view-tool {
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: none;
  font-family: var(--font-sans);
  font-size: 12px;
}

.view-tools-group .view-tool + .view-tool {
  border-left: 0;
}

.view-tool:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.view-tool[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.view-tool:disabled {
  opacity: 0.4;
}

.view-section,
.view-readout {
  border-color: var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-strong);
}

.view-section .view-tool {
  border: 1px solid var(--border);
}

/* The tray: what the active tool says and the section, in the middle of the upper edge of the viewport. */
.view-tray {
  position: absolute;
  top: 10px;
  right: 276px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.view-tray > .view-section,
.view-tray .view-readout button {
  pointer-events: auto;
}

.view-readout {
  align-items: center;
  font-family: var(--font-sans);
}

/* The bar under the 3D view: the front view of the space on the left, the selected module beside it. */
.cad .bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "map detail"
    "parts parts";
  gap: 4px 18px;
}

.cad .bar .bar-head {
  grid-area: head;
  margin-bottom: 0;
}

.cad .bar .matrix {
  grid-area: map;
}

.cad .bar .detail {
  grid-area: detail;
  align-self: start;
}

.cad .bar .stk-edit-parts {
  grid-area: parts;
}

.view-measure-line,
.view-measure-point,
.view-measure-hover {
  stroke: var(--accent-ink);
}

.view-measure-legs {
  stroke: var(--accent-ink);
}

.view-measure-label {
  border-radius: 3px;
}

/* Dimensions over the scene. */
.view-dim-lines {
  fill: none;
  stroke: var(--dim);
  stroke-width: 1.1;
}

.view-dim-arrows {
  fill: var(--dim);
}

.view-dim-text {
  fill: var(--dim);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--dim-halo);
  stroke-width: 4px;
  stroke-linejoin: round;
  cursor: move;
  pointer-events: auto;
  user-select: none;
}

.view-dim.is-selected .view-dim-lines,
.view-dim.is-preview .view-dim-lines {
  stroke: var(--accent-ink);
}

.view-dim.is-selected .view-dim-arrows,
.view-dim.is-preview .view-dim-arrows,
.view-dim.is-selected .view-dim-text,
.view-dim.is-preview .view-dim-text {
  fill: var(--accent-ink);
}

.view-dim.is-preview .view-dim-text {
  pointer-events: none;
}

/* The module builder page: its switches of the view stand on the left, the view cube on the right. */
.builder .viewport-tools {
  right: auto;
  left: 12px;
  justify-content: flex-start;
  max-width: calc(100% - 170px);
}

.builder .messages {
  top: 52px;
}

.builder .topbar {
  background: var(--titlebar);
  color: var(--titlebar-text);
  border-bottom: 0;
}

.builder .topbar .text-button,
.builder .topbar .icon-button,
.builder .topbar .theme-switch button,
.builder .topbar .mb-save-state {
  color: inherit;
}

.builder .topbar .theme-switch button[aria-pressed="true"] {
  color: inherit;
}

/* ---------- The drawing workspace (src/drawing_panel.js) ---------- */

.dwg-stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.dwg-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--dwg-ground);
  touch-action: none;
  user-select: none;
}

.dwg-canvas.is-panning {
  cursor: grabbing;
}

.dwg-canvas[data-tool]:not([data-tool=""]) {
  cursor: crosshair;
}

.dwg-sheet {
  position: absolute;
  top: 0;
  left: 0;
  background: #ffffff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
  transform-origin: 0 0;
}

.dwg-sheet[hidden] {
  display: none;
}

.dwg-sheet-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.dwg-canvas.is-stale .dwg-sheet {
  opacity: 0.55;
}

.dwg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dwg-view-hit,
.dwg-dim-hit {
  pointer-events: all;
}

.dwg-canvas:not([data-tool]) .dwg-view,
.dwg-canvas[data-tool=""] .dwg-view {
  cursor: move;
}

.dwg-canvas:not([data-tool]) .dwg-dim,
.dwg-canvas[data-tool=""] .dwg-dim {
  cursor: pointer;
}

.dwg-dim.is-selected path[stroke="#000000"],
.dwg-preview path[stroke="#000000"] {
  stroke: #0b63ce;
}

.dwg-dim.is-selected [fill="#000000"],
.dwg-preview [fill="#000000"] {
  fill: #0b63ce;
}

.dwg-selection,
.dwg-hover,
.dwg-ghost,
.dwg-snap,
.dwg-cutline,
.dwg-guide {
  fill: none;
  stroke: #0b63ce;
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}

.dwg-selection {
  stroke-dasharray: 5 3;
}

.dwg-hover {
  stroke-width: 1px;
  opacity: 0.6;
}

.dwg-ghost {
  fill: rgba(11, 99, 206, 0.07);
  stroke-dasharray: 6 3;
}

.dwg-ghost-text {
  fill: #0b63ce;
  font-family: var(--font-sans);
  font-size: 3.6px;
  font-weight: 600;
}

.dwg-snap {
  stroke: #e5484d;
}

.dwg-cutline {
  stroke: #e5484d;
  stroke-dasharray: 14 4 2 4;
}

.dwg-guide {
  stroke: #30a46c;
  stroke-width: 1px;
  stroke-dasharray: 4 3;
}

.dwg-toolbar {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 5px 8px 5px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow-strong);
  color: var(--text);
  font-size: 12.5px;
  transform: translateX(-50%);
}

.dwg-toolbar[hidden] {
  display: none;
}

.dwg-toolbar-hint {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dwg-tool-options {
  display: flex;
  flex: none;
  padding: 0;
}

.dwg-tool-options button {
  height: 24px;
  padding: 0 8px;
  white-space: nowrap;
}

.dwg-tool-end {
  flex: none;
  height: 24px;
}

.dwg-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.dwg-empty[hidden] {
  display: none;
}

.dwg-empty-card {
  display: grid;
  gap: 12px;
  width: min(400px, calc(100% - 32px));
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.dwg-empty-card h3 {
  font-size: 16px;
}

.dwg-empty-card p {
  margin: 0;
}

.dwg-empty-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dwg-empty-fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.dwg-create {
  justify-content: center;
}

/* The tabs of the sheets, under the sheet. */
.dwg-tabs {
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: 2px;
  height: 28px;
  padding: 0 8px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  scrollbar-width: none;
}

.dwg-tab {
  flex: none;
  height: 23px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 5px 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dwg-tab:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.dwg-tab[aria-selected="true"] {
  border-bottom: 2px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.dwg-tab-add {
  padding: 0 9px;
  font-size: 14px;
}

/* The tree of the sheets. */
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% + 20px);
  height: 26px;
  margin: 0 -10px;
  padding-right: 10px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
}

.tree-row:hover {
  background: var(--hover);
}

.tree-row.is-selected {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.tree-icon {
  width: 14px;
  color: var(--muted);
  text-align: center;
}

.tree-label {
  overflow: hidden;
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tree-meta {
  margin-left: auto;
  flex: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

/* The properties of the selection. */
.prop-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 12.5px;
}

.prop-field > span {
  color: var(--muted);
}

.prop-field input,
.prop-field select {
  height: 26px;
  padding: 0 6px;
}

.prop-switch {
  display: flex;
  padding: 0;
}

.prop-switch button {
  flex: 1;
  padding: 0 4px;
}

.prop-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 12.5px;
}

.prop-check input {
  accent-color: var(--accent);
}

.prop-heading {
  margin: 16px -10px 8px;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.prop-value {
  margin: 2px 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.prop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .cad,
  .cad[data-workspace="drawing"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(460px, 75vh) auto auto;
    grid-template-areas: "top" "stage" "library" "status";
  }
}

/* The products of the start page: a card each. */
.product-grid {
  gap: 16px;
  border-top: 0;
}

.home .product-card,
.home .product-card:first-child,
.home .product-card:last-child {
  padding: 4px 18px 16px;
  border: 1px solid var(--border);
}

.product-head {
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.product-visual {
  height: 190px;
  padding: 18px 0 14px;
}

.product-text {
  gap: 8px;
}

.product-text h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.product-text p {
  font-size: 13px;
}

.product-specs {
  font-family: var(--font-sans);
  font-size: 12px;
}

.continue-text h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ====================================================================================================================
   The environment (2026-11): the two sides of the left panel, the tree and the properties of rooms, walls, openings
   and fixtures (src/environment_panel.js), the tray and the overlay of the tools that draw them (src/viewer_draw.js).
   ==================================================================================================================== */

/* The left panel has two sides: the library of modules, the environment. */
.side-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  margin: 0 -10px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.side-tabs button {
  flex: 1;
  height: 31px;
  padding: 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.side-tabs button:hover {
  background: var(--hover);
  color: var(--text);
}

.side-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  background: var(--surface);
  color: var(--text);
}

.env-tools {
  display: flex;
  gap: 6px;
  margin: 2px 0 8px;
}

.env-tools .chip-button {
  flex: 1;
}

.env-tools .chip-button[aria-pressed="true"],
.rb-check[data-run][aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.env-panel .hint {
  margin: 10px 2px;
  font-size: 12px;
}

.env-props .prop-heading:first-child {
  margin-top: 12px;
}

.prop-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.prop-pair input {
  width: 100%;
  min-width: 0;
}

.prop-output {
  font-variant-numeric: tabular-nums;
}

/* What goes into a wall: the tiles of the panel of a selected wall or room (docs/environment_reference.md §6.1) –
   clicked, or dragged onto a wall. The ribbon has only the wall and the room. */
.env-insert {
  margin-bottom: 6px;
}

.env-add.env-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 4px;
}

.env-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: grab;
  touch-action: none;
}

.env-tile svg {
  display: block;
  width: 22px;
  height: 22px;
}

.env-tile-label {
  line-height: 1.15;
  text-align: center;
}

.env-tile:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.env-tile[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.env-tile:disabled {
  opacity: 0.45;
  cursor: default;
}

.env-insert .hint {
  margin: 6px 2px 0;
}

/* The tray of the wall and the placing tool: what the tool asks for, the next wall, the numbers under the pointer. */
.env-readout {
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  pointer-events: auto;
}

.env-readout-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.env-readout-field small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.env-readout-field input {
  width: 64px;
  height: 24px;
  padding: 0 6px;
  text-align: right;
}

.env-readout-align {
  display: inline-flex;
  padding: 0;
}

.env-readout-align button {
  padding: 0 8px;
}


/* The overlay: the wall being drawn (its line, its footprint, its ends), what is being placed on a wall. */
.env-overlay {
  color: var(--accent);
}

.env-line {
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.env-ghost {
  fill: var(--accent);
  fill-opacity: 0.18;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.env-point {
  fill: var(--surface);
  stroke: currentColor;
  stroke-width: 1.5;
}

.env-point.is-corner {
  fill: var(--accent);
}


/* The dimension lines of what a wall carries while it is placed or selected (docs/environment_reference.md §6): the
   look of the dimensions of a design; what is left of the wall (driven) fainter and in brackets; the numbers of the
   selected object are typed over – a click opens a field in their place. */
.env-dim .view-dim-text {
  cursor: default;
  pointer-events: none;
}

.env-dim.is-driven {
  opacity: 0.6;
}

.env-dim.is-editable .view-dim-text {
  cursor: pointer;
  pointer-events: auto;
}

.env-dim.is-editable:hover .view-dim-text {
  fill: var(--accent-ink);
}

.env-dim.is-editable:hover .view-dim-lines {
  stroke: var(--accent-ink);
}

.env-dim.is-editable:hover .view-dim-arrows {
  fill: var(--accent-ink);
}


.viewport input.env-dim-field {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 80px;
  max-width: none;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* A tool of the ribbon dragged onto a wall: a small label beside the pointer – the place on the wall stays in sight. */
.drag-ghost.is-env {
  flex-direction: row;
  gap: 6px;
  width: auto;
  margin: 16px 0 0 18px;
  padding: 4px 8px 4px 6px;
}

.drag-ghost.is-env.is-valid {
  padding: 3px 7px 3px 5px;
}

.drag-ghost.is-env .ghost-icon {
  width: 20px;
  height: 20px;
}

.drag-ghost.is-env .ghost-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- How a module is turned (docs/stack_reference.md §7.4) ---------- */

/* The detail of a module: its angle and the two quarter turns. */
.detail-field input.stk-dim.stk-pos {
  width: 72px;
}

.detail-field.stk-turns {
  gap: 4px;
}

.chip-button.stk-turn {
  width: 34px;
  padding: 0;
  justify-content: center;
  font-size: 16px;
}

/* The bottom bar with more groups: which one its front view shows. */
.bar-summary .stk-group-tab {
  height: 24px;
  padding: 0 8px;
  margin-right: 6px;
  font-size: 12px;
}

.bar-summary .stk-group-tab[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* ====================================================================================================================
   A clearer window (2026-11): the panel of properties on the right – what is selected (a module, an object of the
   environment), else the assembly as a whole –, the materials and the AI assistant open in its place instead of over
   the scene, a ribbon that always fits the window (src/ribbon_panel.js), a library of compact cards, a front view
   that can be folded away, messages that can be put away, a start page that begins with what can be done.
   This section comes last and restyles what the sections above lay out.
   Source of truth: docs/configurator_ui_reference.md, section 1
   ==================================================================================================================== */

/* ---------- The shell: library · scene · properties ---------- */

.cad {
  grid-template-columns: var(--dock-left, 288px) minmax(0, 1fr) var(--dock-right, 300px);
  grid-template-areas:
    "top top top"
    "library stage definition"
    "status status status";
}

/* A small window: narrower panels, the scene keeps its room. */
@media (min-width: 981px) and (max-width: 1240px) {
  .cad:not([data-workspace="drawing"]):not(.is-editing):not(.builder) {
    grid-template-columns: var(--dock-left, 256px) minmax(0, 1fr) var(--dock-right, 272px);
  }
}

/* ---------- The title strip: the document by its name, and whether it is saved ---------- */

.cad-titlebar .topbar-product {
  min-width: 0;
}

/* (The product is said only while the document has no name.) */
.cad-titlebar .topbar-product:has(.cad-docname:not(:empty)) .topbar-title {
  display: none;
}

.cad-docname {
  max-width: 360px;
  font-size: 13px;
  font-weight: 600;
  opacity: 1;
}

.cad-docname:not(:empty)::before {
  content: none;
}

.cad-docstate {
  flex: none;
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0.7;
}

.cad-docstate:not(:empty)::before {
  content: "· ";
}

.cad-docstate[data-state="dirty"] {
  color: var(--accent-ink-on-dark);
  opacity: 1;
}

/* ---------- The ribbon: it always fits the window (src/ribbon_panel.js sets how dense it is drawn) ---------- */

.cad-ribbon {
  overflow: hidden;
}

/* (A little tighter than a ribbon that may scroll: with every word shown it fits a window of 1536 px.) */
.rb-group {
  padding: 0 7px;
}

.rb {
  min-width: 54px;
}

.rb-check {
  gap: 5px;
  padding: 0 6px 0 5px;
}

/* A large button with the small tools of its group beside it. */
.rb-items .rb-items.rb-small {
  flex: none;
  min-height: 0;
  margin-left: 4px;
}

/* The last group stands at the right end. */
.rb-group.rb-end {
  margin-left: auto;
  border-right: 0;
  border-left: 1px solid var(--border);
}

.rb-group:has(+ .rb-end) {
  border-right: 0;
}

/* A group drawn dense: its small tools are icons – the tooltip says what each is. */
.rb-group.is-compact .rb-check > span {
  display: none;
}

.rb-group.is-compact .rb-check {
  justify-content: center;
  gap: 0;
  width: 28px;
  padding: 0;
}

/* Denser still: the large buttons get narrower (their words may take two lines), then lose their words too. */
.cad-ribbon[data-density="5"] .rb-group,
.cad-ribbon[data-density="6"] .rb-group {
  padding: 0 5px;
}

.cad-ribbon[data-density="5"] .rb {
  min-width: 46px;
  max-width: 62px;
  padding: 3px;
  gap: 2px;
  font-size: 10.5px;
  line-height: 1.05;
  white-space: normal;
}

.cad-ribbon[data-density="5"] .rb svg {
  width: 19px;
  height: 19px;
}

.cad-ribbon[data-density="6"] .rb {
  min-width: 36px;
  padding: 4px;
}

.cad-ribbon[data-density="6"] .rb > span {
  display: none;
}

/* ---------- The panel of properties (index.html #stk-inspector, src/stack_configurator.js) ---------- */

.inspector {
  grid-area: definition;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 12.5px;
}

.cad[data-workspace="drawing"] .inspector,
.cad.is-editing .inspector {
  display: none;
}

.insp-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 6px 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.insp-head h2 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.insp-head .icon-button {
  width: 24px;
  height: 24px;
  border: 0;
  background: none;
}

.insp-body,
.inspector .detail {
  display: block;
  min-height: 0;
  margin: 0;
  padding: 10px 12px 18px;
  border: 0;
  font-family: var(--font-sans);
  font-size: 12.5px;
}

/* What it is: its name with what places it. */
.insp-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 2px 0 10px;
}

.insp-name strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.insp-name span {
  overflow: hidden;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector .prop-heading {
  margin: 14px -12px 8px;
  padding: 5px 12px;
}

/* A field: its name, then what sets it. */
.inspector .detail-field {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  color: var(--muted);
}

.inspector .detail-field > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector .detail-field select,
.inspector .detail-field input,
.inspector .detail-field input.stk-dim,
.inspector .detail-field input.stk-dim.stk-pos {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  text-align: left;
}

/* A size: its name, the value in mm, "Fill" (width and height: the free space around it, once). */
.inspector .stk-size-row {
  grid-template-columns: minmax(50px, auto) minmax(52px, 1fr) auto auto;
  gap: 6px;
}

/* The lock of one of the two heights of a module (docs/stack_reference.md section 3.6): pressed = the fixed one. */
.inspector .stk-hold {
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.inspector .stk-hold[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

/* The plinth legs of a module: on / off, their height, what they are or why there are none. */
.inspector .detail-field.stk-legs-on {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.inspector .stk-legs-on input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
}

.inspector .stk-legs-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.inspector .stk-legs-note.is-warning {
  color: var(--warning);
}

.inspector .stk-fill {
  height: 28px;
  padding: 0 8px;
}

.cad .chip-mode {
  overflow: hidden;
  border-color: var(--border);
  border-radius: 4px;
}

.cad .chip-mode button {
  width: auto;
  height: 26px;
  padding: 0 7px;
  font-family: var(--font-sans);
  font-size: 11.5px;
}

.cad .chip-mode button[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.inspector .stk-resolved {
  color: var(--text);
  font-size: 12px;
}

.stk-flex-note {
  height: 28px;
  border-radius: 3px;
  border-color: var(--border);
}

/* A new size waits for the edge that moves. */
.inspector .stk-side-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--text);
}

.inspector .stk-side-choice > span:first-child {
  flex: 1 0 100%;
  white-space: normal;
}


/* More modules selected: how many (the panel shows the one clicked last). */
.stk-selection-note {
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12px;
}

/* The size of the next module of a card: the unit after the field. */
.stk-size-field .stk-unit {
  color: var(--muted);
  font-size: 11.5px;
}

.insp-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.inspector .insp-pair .detail-field {
  grid-template-columns: 12px minmax(0, 1fr);
}

.stk-turn-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stk-turn-row .detail-field {
  flex: 1;
}

.stk-turns {
  display: inline-flex;
  flex: none;
  gap: 4px;
}

.chip-button.stk-turn {
  width: 30px;
  height: 28px;
}

.inspector .stk-gap {
  grid-template-columns: minmax(0, 1fr) 82px;
}

/* What can be done: one button under another. */
.insp-actions {
  display: grid;
  gap: 6px;
}

.insp-action,
.inspector .danger-button {
  justify-content: center;
  width: 100%;
  height: 30px;
  font-family: var(--font-sans);
  font-size: 12.5px;
}

.insp-action.stk-move {
  margin-top: 4px;
}

.insp-action.is-main {
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.stk-move[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* The assembly as a whole: what it holds, what it takes, whether it can be built. */
.insp-facts {
  display: grid;
  margin: 0 0 12px;
}

.insp-fact {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.insp-fact dt {
  color: var(--muted);
}

.insp-fact dd {
  margin: 0;
  color: var(--text);
}

.insp-fact.is-ok dd {
  color: var(--ok);
}

.insp-fact.is-warning dd {
  color: var(--warning);
  font-weight: 600;
}

.insp-fact.is-error dd {
  color: var(--error);
  font-weight: 600;
}

.insp-tips {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* A switch of the assembly in the panel (fillers and gaps from the walls). */
.insp-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  cursor: pointer;
}

.insp-check input {
  margin: 0;
  accent-color: var(--accent);
}

/* The niche in the panel: the same fields as every other. */
.inspector .room-inline {
  display: block;
  margin: 0;
}

.inspector .hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.inspector .env-props .prop-heading:first-child {
  margin-top: 0;
}

/* ---------- The materials and the AI assistant: in the place of the properties, not over the scene ---------- */

.cad > .materials,
.cad > .assistant {
  position: relative;
  top: auto;
  right: auto;
  z-index: 3;
  grid-area: definition;
  width: auto;
  min-width: 0;
  min-height: 0;
  max-height: none;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.cad > .materials .assistant-head,
.cad > .assistant .assistant-head {
  flex: none;
  height: 32px;
  padding: 0 4px 0 12px;
  background: var(--surface-2);
}

.cad > .materials .assistant-head strong,
.cad > .assistant .assistant-head strong {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.cad > .materials .assistant-head .icon-button,
.cad > .assistant .assistant-head .icon-button {
  width: 24px;
  height: 24px;
}

.cad > .materials .mat-grid-holder {
  max-height: 340px;
}

/* ---------- The library: compact cards; the size of the next module opens on demand ---------- */

.lib-lead {
  margin: 0 2px 6px;
  color: var(--muted);
  font-size: 12px;
}

.stk-type {
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  background: none;
}

.stk-type-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.stk-type .stk-card {
  flex: 1;
  min-width: 0;
  gap: 10px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
}

.configurator[data-theme="dark"] .stk-type .stk-card {
  border-color: transparent;
}

.stk-type .stk-card:hover,
.configurator[data-theme="dark"] .stk-type .stk-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.stk-type .stk-card .lib-icon {
  width: 40px;
  height: 44px;
}

.lib-text {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.lib-text .lib-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-meta {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
  white-space: nowrap;
}

/* A size that is not the module's own (typed, or flexible) shows in the accent. */
.lib-meta.is-custom {
  color: var(--accent-ink);
  font-weight: 600;
}

.stk-size-toggle {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  background: none;
  color: var(--muted);
}

.stk-size-toggle[aria-expanded="true"],
.stk-size-toggle.is-custom {
  color: var(--accent-ink);
}

.stk-size-toggle[aria-expanded="true"] {
  background: var(--accent-soft);
}

.stk-size {
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  margin: 4px 0 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

.stk-size-caption {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.stk-size-field {
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
}

.stk-size-field input,
.stk-size-field select {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--input-border);
}

/* ---------- The bar under the 3D view: the front view of a group – it can be folded away ---------- */

.cad .bar {
  display: block;
  padding: 0 12px 8px;
}

.cad .bar .bar-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 30px;
  margin: 0;
}

.bar-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 6px 0 2px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bar-toggle:hover {
  background: var(--hover);
  color: var(--text);
}

.bar-toggle svg {
  transition: transform 0.12s ease;
}

.bar.is-closed .bar-toggle svg {
  transform: rotate(-90deg);
}

.bar.is-closed {
  padding-bottom: 0;
}

.bar.is-closed .matrix {
  display: none;
}

.cad .bar .bar-summary {
  overflow: hidden;
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* A module edited in place: the bar of the builder over its parts list (the front view waits). */
.cad.is-editing .bar .bar-head {
  display: none;
}

.stk-edit-bar {
  padding: 8px 0 2px;
}

.stk-edit-bar[hidden] {
  display: none;
}

/* ---------- Over the scene: the tray of a tool, messages that can be put away, how an empty design starts ---------- */

/* The tray in a narrower view: the words of a tool may take two lines, its switches and numbers stay in one row. */
.view-readout {
  max-width: 100%;
}

.view-readout .theme-switch {
  display: flex;
  flex: none;
  padding: 0;
}

.view-readout-value {
  flex: none;
  white-space: nowrap;
}

/* (Nothing stands at the upper edge of the scene any more: the messages start there, whatever its width.) */
.cad .messages {
  top: 10px;
  left: 12px;
}

.messages li {
  position: relative;
}

.messages li:has(.msg-close) {
  padding-right: 28px;
}

.messages .msg-close {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  pointer-events: auto;
}

.messages .msg-close::before {
  content: "×";
}

.messages .msg-close:hover {
  background: var(--hover);
  color: var(--text);
}




/* ---------- The status bar: the errors and the warnings of the design, counted ---------- */

.status-problems[data-kind="error"] {
  color: var(--error);
  font-weight: 600;
}

.status-problems[data-kind="warning"] {
  color: var(--warning);
  font-weight: 600;
}

/* ---------- The start page: a new design first, as one row – its picture, its words, its button ---------- */

.home .product-card,
.home .product-card:first-child,
.home .product-card:last-child {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 32px;
  padding: 14px 18px;
}

.home .product-visual {
  height: 92px;
  padding: 0;
}

.home .product-text {
  gap: 3px;
  padding: 0;
}

.home .product-text .eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
}

.home .product-text p {
  color: var(--muted);
}

.home .product-text .product-tagline {
  color: var(--text);
}

.home .product-card > button.primary {
  align-self: center;
}

@media (max-width: 760px) {
  .home .product-card,
  .home .product-card:first-child,
  .home .product-card:last-child {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .home .product-card > button.primary {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* ---------- The module builder page (builder.html): the same shell as a design ---------- */

.cad.builder {
  grid-template-columns: var(--dock-left, 400px) minmax(0, 1fr) var(--dock-right, 400px);
}

.cad.builder .topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.cad.builder .topbar > * {
  padding: 0;
  white-space: normal;
}

.cad.builder .cad-titlebar {
  padding: 0 10px 0 6px;
  white-space: nowrap;
}

.cad.builder .cad-ribbon {
  padding: 5px 4px 2px;
}

.cad.builder .topbar-title {
  font-size: 13px;
}

a.cad-home {
  color: inherit;
  text-decoration: none;
}

/* The module that is open and whether the library holds it as it is. */
.mb-docname {
  overflow: hidden;
  max-width: 260px;
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.8;
}

.mb-docname:not(:empty)::before,
.cad-titlebar .mb-save-state:not(:empty)::before {
  content: "· ";
}

.cad-titlebar .mb-save-state,
.cad-titlebar .mb-save-state[data-state="saved"] {
  flex: none;
  color: inherit;
  font-family: var(--font-sans);
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0.7;
}

.cad-titlebar .mb-save-state[data-state="changed"] {
  color: var(--accent-ink-on-dark);
  opacity: 1;
}

.cad-titlebar .save-button:disabled {
  opacity: 0.45;
}

/* The modules in progress: the one that is open over what can be done with them. */
.rb-items.rb-stack {
  display: grid;
  grid-template-rows: 25px 25px;
  align-content: center;
  gap: 2px;
}

.rb-row {
  display: flex;
  gap: 2px;
}

.cad.builder .mb-drafts select {
  width: 100%;
  min-width: 212px;
  height: 25px;
  padding: 0 6px;
}

.rb-check.rb-danger:hover:not(:disabled) {
  border-color: var(--error);
  color: var(--error);
}

.cad .bar.mb-parts {
  padding-top: 8px;
}

/* The rules of the workshop: a tab per group in as many rows as they take, a set of edges as switches. */
.theme-switch.rules-tabs {
  flex-wrap: wrap;
  gap: 4px;
}

.theme-switch.rules-tabs button,
.theme-switch.rules-tabs button:first-child,
.theme-switch.rules-tabs button:last-child {
  flex: none;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.theme-switch.rules-tabs button[aria-pressed="true"] {
  border-color: var(--accent);
}

.rules-directions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rules-directions .chip-button {
  height: 26px;
  padding: 0 9px;
}

.rules-directions .chip-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* A small window: the two panels of the builder give the scene some of their width. */
@media (min-width: 981px) and (max-width: 1240px) {
  .cad.builder,
  .cad.is-editing {
    grid-template-columns: var(--dock-left, 330px) minmax(0, 1fr) var(--dock-right, 330px);
  }
}

/* ---------- One column (a window narrower than the app allows): the properties follow the scene ---------- */

@media (max-width: 980px) {
  .cad,
  .cad[data-workspace="drawing"],
  .cad.is-editing,
  .cad.builder {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(460px, 75vh) auto auto auto;
    grid-template-areas: "top" "stage" "definition" "library" "status";
  }

  /* (The module builder: its construction panel, then the definition.) */
  .cad.is-editing,
  .cad.builder {
    grid-template-areas: "top" "stage" "library" "definition" "status";
  }

  .inspector {
    overflow: visible;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

/* ====================================================================================================================
   Panels that dock and resize (2026-11): the panels beside the scene work the way the areas of Blender do – the edge
   between a side and the scene is dragged (nearly shut = the side is folded away to a rail), a panel is dragged by
   its heading to the other side, above, below or beside the other panel, or the two swap; the edge over what stands
   under the scene is dragged too. src/dock_layout.js holds the layout as data, src/dock_panel.js sets on the window
   (.cad) --dock-left / --dock-right (the widths of the two sides: the column rules above read them), data-dock-left /
   data-dock-right (the panels docked there, the upper – side by side: the left – one first), data-dock-closed (the
   panels of a folded side), --dock-upper / --dock-lower (two panels on one side, one above the other), data-dock-row
   with --dock-inner (two panels on one side, side by side: that side, the width of the inner one) and --dock-bottom.
   One column (a narrow window): none of it.
   Source of truth: docs/configurator_ui_reference.md, section 1.1
   ==================================================================================================================== */

.dock-edge,
.dock-rail,
.dock-grip,
.dock-drop[hidden],
.dock-ghost[hidden] {
  display: none;
}

@media (min-width: 981px) {
  /* ---------- Where the two panels stand ---------- */

  /* The two swapped. */
  .cad[data-dock-left="properties"][data-dock-right="library"] {
    grid-template-areas:
      "top top top"
      "definition stage library"
      "status status status";
  }

  /* Both on one side: they share its height (the other side has no width – the scene takes it). */
  .cad[data-dock-left~="library"][data-dock-left~="properties"],
  .cad[data-dock-right~="library"][data-dock-right~="properties"] {
    grid-template-rows: auto minmax(0, var(--dock-upper, 1fr)) minmax(0, var(--dock-lower, 1fr)) 24px;
  }

  .cad[data-dock-left="library properties"] {
    grid-template-areas:
      "top top top"
      "library stage stage"
      "definition stage stage"
      "status status status";
  }

  .cad[data-dock-left="properties library"] {
    grid-template-areas:
      "top top top"
      "definition stage stage"
      "library stage stage"
      "status status status";
  }

  .cad[data-dock-right="library properties"] {
    grid-template-areas:
      "top top top"
      "stage stage library"
      "stage stage definition"
      "status status status";
  }

  .cad[data-dock-right="properties library"] {
    grid-template-areas:
      "top top top"
      "stage stage definition"
      "stage stage library"
      "status status status";
  }

  /* Both on one side, side by side: the three columns of the window are the two panels and the scene – the outer one
     as wide as its side, the inner one --dock-inner. (As specific as the columns of a small window, so that the rule
     holds in every window and workspace.) */
  .cad[data-dock-row="left"][data-dock-left~="library"][data-dock-left~="properties"][data-dock-right=""] {
    grid-template-columns: var(--dock-left) var(--dock-inner) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) 24px;
  }

  .cad[data-dock-row="right"][data-dock-right~="library"][data-dock-right~="properties"][data-dock-left=""] {
    grid-template-columns: minmax(0, 1fr) var(--dock-inner) var(--dock-right);
    grid-template-rows: auto minmax(0, 1fr) 24px;
  }

  .cad[data-dock-row="left"][data-dock-left="library properties"] {
    grid-template-areas:
      "top top top"
      "library definition stage"
      "status status status";
  }

  .cad[data-dock-row="left"][data-dock-left="properties library"] {
    grid-template-areas:
      "top top top"
      "definition library stage"
      "status status status";
  }

  .cad[data-dock-row="right"][data-dock-right="library properties"] {
    grid-template-areas:
      "top top top"
      "stage library definition"
      "status status status";
  }

  .cad[data-dock-row="right"][data-dock-right="properties library"] {
    grid-template-areas:
      "top top top"
      "stage definition library"
      "status status status";
  }

  /* A panel has its line at the scene, whichever side it stands on (side by side the outer one has it at the inner
     one); the lower of two has one above it. */
  .cad > [data-dock-panel][data-dock-side="left"] {
    border-right: 1px solid var(--line);
    border-left: 0;
  }

  .cad > [data-dock-panel][data-dock-side="right"] {
    border-right: 0;
    border-left: 1px solid var(--line);
  }

  .cad:not([data-dock-row])[data-dock-left="library properties"] > [data-dock-panel="properties"],
  .cad:not([data-dock-row])[data-dock-right="library properties"] > [data-dock-panel="properties"],
  .cad:not([data-dock-row])[data-dock-left="properties library"] > [data-dock-panel="library"],
  .cad:not([data-dock-row])[data-dock-right="properties library"] > [data-dock-panel="library"] {
    border-top: 1px solid var(--line);
  }

  /* A side folded away: its panels wait, a rail stands in their place. */
  .cad[data-dock-closed~="library"] > [data-dock-panel="library"],
  .cad[data-dock-closed~="properties"] > [data-dock-panel="properties"] {
    display: none;
  }

  .cad .dock-rail:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    grid-row: 2 / -2;
    width: auto;
    min-width: 0;
    height: auto;
    padding: 10px 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--surface-2);
    color: var(--muted);
    font-family: var(--font-sans);
    cursor: pointer;
  }

  .cad .dock-rail[data-side="left"] {
    grid-column: 1;
    border-right: 1px solid var(--line);
  }

  .cad .dock-rail[data-side="right"] {
    grid-column: 3;
    border-left: 1px solid var(--line);
  }

  .cad .dock-rail:hover,
  .cad .dock-rail:focus-visible {
    background: var(--hover);
    color: var(--text);
  }

  .dock-rail .dock-icon {
    display: inline-flex;
    flex: none;
  }

  .dock-rail-name {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    writing-mode: vertical-rl;
  }

  /* (On the left the name reads upwards, as the spine of a book lying on its back.) */
  .dock-rail[data-side="left"] .dock-rail-name {
    transform: rotate(180deg);
  }

  /* ---------- The edges that are dragged ---------- */

  .dock-edge:not([hidden]) {
    display: block;
  }

  .dock-edge {
    position: relative;
    z-index: 6;
    touch-action: none;
  }

  .dock-edge[data-edge="left"],
  .dock-edge[data-edge="right"] {
    grid-area: stage;
    width: 7px;
    cursor: col-resize;
  }

  .dock-edge[data-edge="left"] {
    justify-self: start;
    margin-left: -4px;
  }

  .dock-edge[data-edge="right"] {
    justify-self: end;
    margin-right: -4px;
  }

  .dock-edge[data-edge="stack"] {
    align-self: start;
    height: 7px;
    margin-top: -4px;
    cursor: row-resize;
  }

  /* (Two panels side by side: the edge between them stands at the left of the right one.) */
  .dock-edge[data-edge="stack"][data-arrange="row"] {
    align-self: stretch;
    justify-self: start;
    width: 7px;
    height: auto;
    margin-top: 0;
    margin-left: -4px;
    cursor: col-resize;
  }

  /* (The edge over what stands under the scene takes no height of its own.) */
  .dock-edge[data-edge="bottom"] {
    flex: none;
    height: 0;
    cursor: row-resize;
  }

  .dock-edge[data-edge="bottom"]::before {
    content: "";
    position: absolute;
    top: -3px;
    right: 0;
    left: 0;
    height: 7px;
  }

  /* The line of an edge shows under the pointer, while it is dragged and while it has the keyboard. */
  .dock-edge::after {
    content: "";
    position: absolute;
    inset: 0 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
  }

  .dock-edge[data-edge="stack"]::after {
    inset: 2px 0;
  }

  .dock-edge[data-edge="stack"][data-arrange="row"]::after {
    inset: 0 2px;
  }

  .dock-edge[data-edge="bottom"]::after {
    inset: -1px 0 auto;
    height: 3px;
  }

  .dock-edge:hover::after,
  .dock-edge.is-active::after,
  .dock-edge:focus-visible::after {
    opacity: 1;
  }

  .dock-edge:focus-visible {
    outline: none;
  }

  .cad[data-dock-resizing] {
    user-select: none;
  }

  /* (While an edge is dragged the scene is not hovered: the pointer belongs to the edge.) */
  .cad[data-dock-resizing] .stage > :not(.dock-edge),
  .cad[data-dock-resizing] > [data-dock-panel] {
    pointer-events: none;
  }

  /* ---------- A panel is taken by its heading ---------- */

  .dock-grip {
    display: inline-flex;
    flex: none;
    align-items: center;
    align-self: stretch;
    justify-content: center;
    width: 18px;
    color: var(--muted);
    opacity: 0.5;
    cursor: grab;
  }

  .cad > [data-dock-panel] > :hover > .dock-grip {
    opacity: 1;
  }

  .cad > [data-dock-panel] .insp-head,
  .cad > [data-dock-panel] .assistant-head,
  .cad > [data-dock-panel] h2 {
    cursor: grab;
  }

  .insp-head:has(.dock-grip),
  .cad > .materials .assistant-head:has(.dock-grip),
  .cad > .assistant .assistant-head:has(.dock-grip) {
    padding-left: 2px;
  }

  .insp-head .dock-grip + h2,
  .assistant-head .dock-grip + strong {
    margin-right: auto;
    margin-left: 4px;
  }

  /* While a panel is dragged: its name at the pointer, the part of the window that would take it lit up. */
  .cad[data-dock-dragging] {
    user-select: none;
  }

  .cad[data-dock-dragging] * {
    cursor: grabbing !important;
  }

  .cad[data-dock-dragging] .stage {
    pointer-events: none;
  }

  .dock-drop {
    position: fixed;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent);
    border-radius: 4px;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    pointer-events: none;
  }

  .dock-drop span {
    max-width: 90%;
    padding: 5px 10px;
    border-radius: 4px;
    background: var(--accent);
    color: var(--accent-text);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
  }

  .dock-ghost {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 61;
    padding: 4px 10px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    background: var(--surface);
    box-shadow: var(--shadow-strong);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
  }

  /* ---------- What stands under the scene, dragged to a height of its own ---------- */

  /* (The front view map of the model is drawn at that height by the configurator.) */
  .cad.is-editing[data-dock-bottom] .stk-edit-parts,
  .cad.builder[data-dock-bottom] .mb-parts {
    height: var(--dock-bottom);
    max-height: none;
  }
}

/* ---------- What a file of the data folder holds and the app cannot use (docs/desktop_reference.md section 5) ----------
   A library / the rules / the saved designs whose file cannot be read or was saved by a newer version of the app; the
   items of a file kept aside, each with its reason; a question asked in the panel itself (never a dialog of the browser). */

.lm-blocked {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.lm-blocked .ml-error,
.ml-blocked {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
}

.lm-blocked .lm-tools {
  padding: 0;
  border-bottom: 0;
}

.ml-invalid-note {
  margin: 0 0 8px;
  font-family: var(--font-sans);
}

.lm-invalid,
.saved-invalid {
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.saved-invalid {
  margin: 0 0 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.lm-invalid .hint,
.saved-invalid .hint {
  margin: 4px 0 8px;
}

.lm-invalid-list,
.saved-invalid-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lm-invalid-item,
.saved-invalid-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-height: 30px;
  font-size: 13px;
}

.lm-invalid-name,
.saved-invalid-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lm-invalid-why,
.saved-invalid-why {
  flex: 1;
  min-width: 160px;
  color: var(--error);
  font-size: 12px;
}

.lm-invalid-tools,
.saved-invalid-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.saved-confirm {
  flex-wrap: wrap;
  gap: 6px;
}

.saved-question,
.rules-question-text {
  flex: 1 1 100%;
  font-size: 13px;
}

.saved-aside {
  margin: 0 0 10px;
  justify-content: flex-start;
}

.rules-question {
  flex-wrap: wrap;
}

.chip-button.lm-aside-yes,
.chip-button.lm-invalid-yes,
.chip-button.saved-remove-yes,
.chip-button.saved-invalid-yes,
.chip-button.saved-aside-yes,
.chip-button.rules-yes {
  border-color: var(--error);
  color: var(--error);
}

.rules-unused {
  list-style: disc;
}

/* ---------- The shell: an error of the page itself, a question asked in the page (src/shell_panel.js) ---------- */

.page-fault {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  max-width: min(760px, calc(100vw - 32px));
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 2px solid var(--error);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: var(--shadow-strong);
  color: var(--text);
  font-size: 13px;
}

.page-fault-title {
  color: var(--error);
}

.page-fault-text {
  flex: 1 1 320px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.page-fault-tools {
  display: inline-flex;
  gap: 6px;
}

.ask-dialog {
  max-width: min(440px, calc(100vw - 32px));
}

.ask-text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stk-dialog-actions button.stk-dialog-primary.is-danger {
  border-color: var(--error);
  background: var(--error);
}

/* The menu Soubor of the title strip and the dialog Exportovat… (src/file_menu_panel.js, src/export_dialog_panel.js;
   docs/configurator_ui_reference.md 1.4). */
.cad-titlebar .cad-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin-left: 2px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.cad-titlebar .cad-file:hover,
.cad-titlebar .cad-file[aria-expanded="true"] {
  background: var(--titlebar-hover);
}

.cad-file-caret {
  opacity: 0.7;
}

.file-menu {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  padding: 4px 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-strong);
}

.file-menu-item {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 30px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.file-menu-item:hover:not(:disabled),
.file-menu-item:focus-visible {
  outline: none;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.file-menu-item:disabled {
  color: var(--muted);
  opacity: 0.6;
  cursor: default;
}

.file-menu-label {
  flex: 1;
}

.file-menu-key {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.file-menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

.stk-dialog.export-dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 20px 24px;
}

/* The heading, the folder and the buttons stay; only the list scrolls when the window is low. */
.stk-dialog.export-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.export-dialog > * {
  flex: none;
}

.export-dialog .exp-lead {
  margin: 6px 0 14px;
  color: var(--muted);
}

.export-dialog .exp-groups {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

.exp-group-title {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.exp-items {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--surface);
}

.exp-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 5px 10px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.exp-item:first-child {
  border-top: 0;
}

.exp-item:hover:not(.is-off) {
  background: var(--hover);
}

.exp-item input {
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.exp-item.is-off {
  cursor: default;
}

.exp-item.is-off .exp-name,
.exp-item.is-off .exp-help {
  color: var(--muted);
}

.exp-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.exp-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
}

.exp-name strong {
  font-weight: 600;
}

.exp-ext {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.exp-help,
.exp-why {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.exp-why {
  color: var(--warning);
}

.exp-notes {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.exp-notes:empty {
  display: none;
}

.exp-notes .error {
  color: var(--error);
}

.exp-notes .warning {
  color: var(--warning);
}

.exp-notes .info {
  color: var(--muted);
}

.exp-state {
  min-width: 0;
  max-width: 180px;
  padding-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-item[data-state="working"] .exp-state {
  color: var(--accent-ink);
}

.exp-item[data-state="done"] .exp-state {
  color: var(--ok);
}

.exp-item[data-state="error"] .exp-state {
  color: var(--error);
}

.exp-where {
  margin: 14px 0 4px;
}

.exp-where-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.exp-where-row[hidden] {
  display: none;
}

.exp-label {
  color: var(--muted);
  font-size: 12px;
}

.exp-folder {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-dialog .exp-change {
  height: 28px;
}

.export-dialog p.exp-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.export-dialog p.exp-note[hidden] {
  display: none;
}

.exp-question,
.exp-result {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.exp-question {
  border-color: var(--warning);
}

.exp-question[hidden],
.exp-result[hidden] {
  display: none;
}

.export-dialog .exp-question p,
.export-dialog .exp-result p {
  margin: 0 0 8px;
}

.exp-existing,
.exp-written {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}

.exp-written li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
}

.exp-written li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-result-title {
  font-weight: 600;
}

.export-dialog .stk-dialog-actions {
  margin-top: 16px;
}

.exp-written .msg-action {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.exp-notes .file {
  color: var(--text);
  overflow-wrap: anywhere;
}

/* The edges of a kind of part in the rules of the workshop: its banded edges and its band (thickness, material). */
.rules-kind {
  display: grid;
  gap: 4px;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--line);
}

.rules-kind > .rules-field.is-changed {
  border-left-color: transparent;
}

.rules-kind.is-changed {
  box-shadow: inset 3px 0 0 var(--accent);
}

.rules-band {
  display: grid;
  grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding-left: 8px;
}

.rules-band select {
  min-width: 0;
}

/* The drawers of a zone from one descriptor (module builder, setDrawers): the fronts as a stack, the top one on top,
   each as high as its front. */
.mb-drawers-stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  height: 140px;
  padding: 4px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--surface-2);
}

.mb-drawers-front {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-height: 14px;
  padding: 0 8px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 11px;
  overflow: hidden;
}

.mb-drawers-front small {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.mb-drawers-error {
  color: var(--error);
}


/* ---------- The rectangle of a selection in the 3D view (configurator_ui_reference.md §5): a window from left to
   right – a solid frame in the accent; a crossing from right to left – a dashed frame in another tint (as in AutoCAD) ---------- */

.viewport .select-rect {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  border: 1px solid var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  pointer-events: none;
}

.viewport .select-rect.is-crossing {
  border: 1px dashed var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

.viewport .select-rect[hidden] {
  display: none;
}

/* ---------- The state of a record of the core in the panels of the workshop data (D-60) ---------- */
/* A module, a saved design or the rules changed without the connection to the core of the company: it waits to be sent. */
.rec-pending {
  color: var(--warning);
  font-size: 11px;
  line-height: 1.2;
}
.rec-pending-note {
  color: var(--warning);
}

/* ---------- Free modelling: sketches in the plane of a UCS, extrusion, the UCS (src/sketch_panel.js, src/viewer_sketch.js) ---------- */
.sk-layer .sk-line {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.6;
}

.sk-layer .sk-preview {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.6;
  stroke-dasharray: 6 4;
}

.sk-layer .sk-profile,
.sk-layer .sk-face {
  fill: var(--accent);
  fill-opacity: 0.18;
  fill-rule: evenodd;
  stroke: var(--accent-ink);
  stroke-width: 1.4;
}

.sk-layer .sk-prism {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.4;
}

.sk-layer .sk-selected {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 2.4;
}

/* The selected entities of the sketches: their lines in the ink of the selection, thicker. */
.sk-layer .sk-entity-selected {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-linecap: round;
}

.sk-layer .sk-mark {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.6;
}

/* The icon of the UCS: the axes in the colours of the view cube (X red, Y green, Z blue). */
.sk-layer path.sk-ucs-axis {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.sk-layer .sk-ucs-x { stroke: #e5484d; fill: #e5484d; }
.sk-layer .sk-ucs-y { stroke: #30a46c; fill: #30a46c; }
.sk-layer .sk-ucs-z { stroke: #3b82f6; fill: #3b82f6; }

.sk-layer .sk-ucs-letter {
  stroke: none;
  font: 600 11px var(--font-sans);
}

.sk-layer .sk-ucs-origin {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.2;
}

.sk-layer .sk-ucs-name {
  fill: var(--muted);
  font: 11px var(--font-sans);
}

.view-tray .sk-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
}

.view-tray .sk-tray[hidden],
.sk-tray .sk-hint[hidden],
.sk-ucs-chip[hidden] {
  display: none;
}

.view-tray .sk-tray button,
.view-tray .sk-tray input {
  pointer-events: auto;
}

.sk-ucs-chip {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.sk-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.sk-body[hidden] {
  display: none;
}

.sk-body-field {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sk-body-field small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sk-field {
  width: 72px;
  padding: 2px 6px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.sk-body-field input[data-field="label"] {
  width: 120px;
}

.sk-body-remove {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--error);
  font: inherit;
  cursor: pointer;
}

/* A body made a module: the button of the tray, the reason when it cannot be; the dialog of the module it takes after. */
.sk-body-module {
  padding: 2px 8px;
  white-space: nowrap;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.sk-body-module:disabled {
  border-color: var(--border);
  color: var(--muted);
  cursor: default;
}

.sk-body-why {
  flex-basis: 100%;
  order: 1;
  color: var(--warning);
  font-size: 11px;
}

.sk-to-module-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(360px, 50vh);
  margin: 8px 0;
  overflow: auto;
}

.sk-to-module-list h4 {
  margin: 8px 0 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sk-to-module-item {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sk-to-module-item:hover {
  background: var(--hover);
}

.sk-to-module-item[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* The manager of the UCS (a dialog of the page, not over the scene). */
.sk-manager {
  width: min(460px, calc(100vw - 32px));
  max-width: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.sk-manager h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.sk-manager h4 {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sk-manager-now,
.sk-manager-empty {
  margin: 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.sk-manager-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}

.sk-manager-use {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sk-manager-use:hover {
  background: var(--hover);
}

.sk-manager-use[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sk-manager-small {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.sk-manager-save {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.sk-manager-save .sk-field {
  flex: 1;
  width: auto;
}

.sk-manager-error {
  margin: 6px 0 0;
  color: var(--error);
  font-size: 12px;
}

.sk-manager-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.sk-manager-place {
  display: flex;
  gap: 6px;
}

/* The layer of free modelling and its number: like the overlays of the tools of the view, a class of their own (the
   tools of the view own .view-overlay and .view-measure-label – the layer of free modelling stays when they end). */
.sk-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  color: var(--text);
  pointer-events: none;
}

.sk-label {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* Dragging an arrow of the tool "Rozměr" (src/resize_panel.js, docs/stack_reference.md 7.4c): the label of the side
   taken, what it caught, the faces outlined over the stage; the field holds an expression ("800-150+50"). */
.rz-edit input {
  width: 110px;
}

.rz-chip.is-dragged {
  background: var(--accent);
  color: var(--accent-text);
  cursor: grabbing;
}

.rz-chip.is-dragged.is-blocked {
  border-color: var(--warning);
  background: var(--warning);
}

.rz-snap {
  padding-left: 6px;
  border-left: 1px solid currentColor;
  font-family: var(--font-sans);
  font-weight: 500;
}

.rz-snap-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.rz-snap-face,
.rz-snap-target {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.rz-snap-target {
  fill: var(--accent);
  fill-opacity: 0.08;
}

/* ---------- The readout of a tool of the view in a narrow viewport (the module builder: the tool Kóta) ---------- */
/* It wraps by its parts – the hint, the choices, the value – never the hint word by word. */
.view-tray .view-readout {
  flex-wrap: wrap;
  max-width: 100%;
  row-gap: 6px;
}

.view-tray .view-readout-hint {
  flex: 1 1 260px;
  min-width: min(260px, 100%);
}

/* ---------- The start page: its three ways and what they show (docs/sestava_v_zakazce.md Z8; src/app.js,
   src/home_orders_panel.js, src/designs_panel.js) ---------- */

.home-paths {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.home-path {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.home-path:hover {
  border-color: var(--accent);
}

.home-path[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 -3px 0 var(--accent), var(--shadow);
}

.home-path svg {
  flex: none;
  width: 30px;
  height: 30px;
  color: var(--accent);
}

.home-path-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.home-path-text strong {
  font-size: 15px;
  font-weight: 600;
}

.home-path-text span {
  color: var(--muted);
  font-size: 12.5px;
}

.home-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.home-templates {
  padding: 14px 18px;
}

.home .home-templates .saved {
  padding: 0;
  border: none;
  box-shadow: none;
}

.home-empty {
  margin: 0;
  color: var(--muted);
}

/* Open an order: the list of the orders beside the designs of the one chosen. */
.ho-body {
  display: flex;
  flex-direction: column;
}

.ho-split {
  display: flex;
  min-height: 320px;
  max-height: min(62vh, 640px);
}

.ho-list {
  display: flex;
  flex-direction: column;
  width: 340px;
  flex: none;
  border-right: 1px solid var(--border);
  min-height: 0;
}

.ho-list-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.ho-list-head .sf-filter {
  padding: 0;
  border: none;
}

.ho-rows {
  min-height: 0;
}

.ho-detail {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 12px 16px;
}

.ho-detail.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ho-detail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.ho-detail-head h3 {
  flex: 1 1 260px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.ho-detail-tools {
  display: flex;
  gap: 6px;
}

.ho-designs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ho-design {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.ho-design-text {
  display: flex;
  flex: 1 1 260px;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ho-design-text strong {
  font-size: 14px;
}

.ho-note {
  color: var(--warning);
  font-size: 12px;
}

.ho-design-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ho-version {
  max-width: 220px;
}

@media (max-width: 760px) {
  .ho-split {
    flex-direction: column;
    max-height: none;
  }

  .ho-list {
    width: auto;
    max-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ---------- The dialog of a new design (src/new_design_panel.js; docs/sestava_v_zakazce.md Z1) ---------- */

.setup-frame {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.setup-frame .setup-body {
  flex: 1;
  padding-top: 28px;
  padding-bottom: 28px;
}

.setup-frame .setup-step + .setup-step {
  margin-top: 32px;
}

.setup-frame .setup-step h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
}

.nd-lead {
  max-width: 760px;
  margin: 0 0 24px;
  color: var(--muted);
}

.nd-order-mode {
  margin-bottom: 12px;
}

.nd-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 520px;
  margin-bottom: 10px;
}

.nd-field.is-wide {
  max-width: 760px;
}

.nd-field > span {
  color: var(--muted);
  font-size: 12px;
}

.nd-field select,
.nd-field input,
.nd-field textarea {
  width: 100%;
  font-size: 14px;
}

.nd-fixed {
  margin: 0;
  font-size: 15px;
}

.setup-frame .start-card {
  cursor: pointer;
}

.setup-frame .start-card.is-chosen {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.setup-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 40px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.setup-foot .nd-spacer,
.setup-foot .nd-error {
  flex: 1;
}

.nd-error {
  margin: 0;
  color: var(--error);
}

/* A question of the model before it saves into its order (src/question_panel.js): the fields one under another. */
.question-dialog .save-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.question-dialog textarea {
  width: 100%;
  min-width: min(420px, 70vw);
}

.question-note {
  color: var(--muted);
}

/* The dialog of the production data: the numbers of the parts – of a release, or a trial. */
.prod-dialog .prod-numbers[data-numbers="trial"] {
  color: var(--warning);
}

.prod-dialog input[readonly] {
  background: var(--surface-2);
  cursor: default;
}

/* ---------- The checks of the solver (stage 3, A2): a module at what a wall carries, at an opening ---------- */

/* The panel of a module: what was found about it – a few words, the sentence, the way to the thing. */
.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.check-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: start;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: 3px;
  background: var(--surface-2);
}

.check-item strong {
  color: var(--warning);
  font-weight: 600;
}

.check-item .check-text {
  grid-column: 1 / -1;
  grid-row: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.check-item .check-show {
  grid-column: 2;
  grid-row: 1;
}

.stk-checks .prop-heading {
  color: var(--warning);
}

/* The properties of a fixture or an opening: the modules standing at it. */
.env-check {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin: 0 0 8px;
  padding: 6px 8px;
  border-left: 3px solid var(--warning);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

/* The front view: a module with warnings carries a flag; the thing behind it is drawn where it is. */
.mx-cell.stk-map-cell.has-checks {
  overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--warning);
}

.stk-map-flag {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--warning);
  color: var(--surface);
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}

.stk-map-mark {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  pointer-events: none;
}

.stk-map-mark.is-opening {
  border-style: dashed;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
}

.stk-map-mark.is-cable,
.stk-map-mark.is-water,
.stk-map-mark.is-waste {
  border-radius: 50%;
}

/* ---------- AI assistant: attachments and the report of a run (src/assistant_panel.js) ---------- */

.ai-attach {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 0;
  border-top: 1px solid var(--border);
}

.ai-attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
}

.ai-attach-row button {
  white-space: nowrap;
}

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 4px 2px 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
}

.ai-chip-kind {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.ai-chip-name {
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chip-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.ai-chip-remove {
  width: 18px;
  height: 18px;
  font-size: 11px;
}

.ai-files {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
}

.ai-files-title {
  margin: 0 0 4px;
  color: var(--muted);
}

.ai-file {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ai-file:hover:not(:disabled) {
  background: var(--surface);
}

.ai-file:disabled {
  color: var(--muted);
  cursor: default;
}

.ai-attach-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.ai-attach-note.is-error {
  color: var(--error);
}

.ai-report {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
}

.ai-report-title {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ai-report ul {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.ai-report ul:last-child {
  margin-bottom: 0;
}

.ai-report li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 3px 0;
  border-top: 1px solid var(--border);
}

.ai-report li:first-child {
  border-top: 0;
}

.ai-report-what {
  flex: 1 1 140px;
}

.ai-report-from {
  flex-basis: 100%;
  color: var(--muted);
}

.ai-certainty {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.ai-certainty.is-certain {
  border-color: var(--ok);
  color: var(--ok);
}

.ai-certainty.is-likely {
  border-color: var(--warning);
  color: var(--warning);
}

.ai-certainty.is-guess {
  border-color: var(--error);
  color: var(--error);
}

/* ---------- Underlays (stage 3, A4): the dialog of a new one, their rows in the tree of the environment ---------- */

.underlay-dialog {
  width: min(480px, 92vw);
}

.underlay-dialog .ul-files {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
}

.underlay-dialog .ul-empty {
  padding: 10px 12px;
  color: var(--muted);
}

.underlay-dialog .ul-pick {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.underlay-dialog .ul-file:last-child .ul-pick {
  border-bottom: 0;
}

.underlay-dialog .ul-pick:hover {
  background: var(--hover);
}

.underlay-dialog .ul-file.is-chosen .ul-pick {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.underlay-dialog .ul-size {
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.underlay-dialog .ul-row {
  margin: 0 0 12px;
}

.underlay-dialog .ul-field {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.underlay-dialog .ul-message {
  color: var(--error);
}

/* A hidden underlay and one whose picture is not at hand, in the tree. */
.tree-row.is-hidden .tree-label {
  color: var(--muted);
  text-decoration: line-through;
}

.tree-row.is-missing .tree-icon {
  color: var(--warning);
}

/* ---------- The blocks of an assembly (stage 3, A5): Kopie in the panel of a module, the dialog Řada modulů ---------- */

.stk-copy-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stk-copy-row .stk-copy.insp-action {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.stk-copy-row .stk-copy-side {
  flex: 0 1 auto;
  min-width: 0;
}

.stk-copy-row .stk-copy-count {
  width: 56px;
}

.stk-copy-row .stk-copy-times {
  color: var(--muted);
}

.mx-tail {
  display: flex;
  gap: 6px;
}

.row-dialog {
  width: min(560px, 94vw);
}

.row-dialog .row-head,
.row-dialog .row-line {
  display: grid;
  grid-template-columns: 1fr 92px 112px 28px;
  gap: 6px;
  align-items: center;
}

.row-dialog .row-head {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.row-dialog .row-line {
  margin-top: 4px;
}

.row-dialog .row-line select,
.row-dialog .row-line input,
.row-dialog .row-where {
  min-width: 0;
  width: 100%;
}

.row-dialog .row-tools {
  margin: 8px 0 12px;
}

.row-dialog .row-field {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.row-dialog .row-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-dialog .row-pair input {
  width: 96px;
}

.row-dialog .row-unit {
  color: var(--muted);
}

.row-dialog .row-message {
  color: var(--error);
}

/* ---------- The manager of the library: the description of a module (stage 3, track A) ---------- */

.lm-card-description {
  display: -webkit-box;
  overflow: hidden;
  width: 100%;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lm-description-input {
  box-sizing: border-box;
  width: 100%;
}

/* The check of a sheet of a drawing in its properties (src/drawing_panel.js – stage 3, A8a). */
.dwg-check {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.dwg-check-item {
  padding: 5px 8px;
  border-left: 3px solid var(--warning);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.dwg-check-show {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dwg-check-show:hover {
  color: var(--accent-ink);
}

.dwg-check-ok,
.dwg-check-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* The vocabulary of a draughtsman on a sheet (src/drafting.js – notes with leaders, axes, details, parts lists):
   what the pointer grabs, the selection in the accent, what a tool shows before a click, the text of a note. */
.dwg-hit {
  pointer-events: all;
}

.dwg-canvas:not([data-tool]) :is(.dwg-note, .dwg-detail, .dwg-table),
.dwg-canvas[data-tool=""] :is(.dwg-note, .dwg-detail, .dwg-table) {
  cursor: move;
}

.dwg-canvas:not([data-tool]) .dwg-axis,
.dwg-canvas[data-tool=""] .dwg-axis {
  cursor: pointer;
}

:is(.dwg-note, .dwg-axis, .dwg-detail, .dwg-detail-mark, .dwg-table).is-selected [stroke="#000000"] {
  stroke: #0b63ce;
}

:is(.dwg-note, .dwg-detail, .dwg-detail-mark, .dwg-table).is-selected [fill="#000000"] {
  fill: #0b63ce;
}

.dwg-axis-preview {
  fill: none;
  stroke: #0b63ce;
  stroke-width: 1.5px;
  stroke-dasharray: 12 3 2 3;
  vector-effect: non-scaling-stroke;
}

.dwg-tool-text {
  width: 220px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.prop-field .dwg-note-text {
  width: 100%;
  min-height: 62px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  resize: vertical;
}

/* ---------- The CAD in the web of T‑platforma (src/app.js, src/page_window_panel.js): the state "read only" of a
   design somebody else holds, the way back to the order, the question of the page about unsaved changes ---------- */

.cad-docstate[data-state="held"] {
  color: var(--accent-ink-on-dark);
  opacity: 1;
}

.cad-back-order {
  white-space: nowrap;
}

.cad-back-order[hidden] {
  display: none;
}

.page-question .page-question-note {
  margin: 0 0 12px;
  font-size: 12.5px;
}
