/* AIBuild — design tokens + components. All colors via custom properties:
   dark is the :root default, light overrides under [data-theme="light"]
   (app.js applyTheme always sets one of the two). */

/* Inter (variable, wght 100–900) bundled in vendor/fonts/inter — SIL OFL,
   see OFL.txt. Latin + Cyrillic subsets cover fr/en/es/it/de/ru; zh falls
   back to the system CJK font through the --font stack. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fonts/inter/inter-latin.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;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fonts/inter/inter-latin-ext.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";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fonts/inter/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/fonts/inter/inter-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-elev: #11141b;
  --panel-bg: #0e1117;
  --card: #161a23;
  --card-2: #1c212c;
  --input-bg: #0f1218;
  --border: #282e3b;
  --border-soft: #1f2430;
  --border-strong: #39414f;
  --text: #e8ebf1;
  --text-dim: #8f99ad;
  --accent: #5a8dff;
  --align: #e0398f; /* 2026-10-30: alignment guides (2D / 3D) */
  --accent-hover: #77a2ff;
  --accent-text: #93b7ff;
  --accent-soft: rgba(90, 141, 255, 0.14);
  --accent-ring: rgba(90, 141, 255, 0.32);
  --accent-contrast: #ffffff;
  --primary: #3d6ff0;        /* filled buttons / user chat bubbles (white label) */
  --primary-hover: #4d7ef7;
  /* brand mark gradient (header + splash tile) — shared by both themes */
  --brand-1: #60a5fa;
  --brand-2: #4f46e5;
  /* splash rainbow bands (the original arc palette) */
  --rb1: #845ec2;
  --rb2: #3bb2b8;
  --rb3: #42e695;
  --rb4: #f9f871;
  --rb5: #ffc371;
  --rb6: #ff5f6d;
  --danger: #ff6b74;
  --danger-soft: rgba(255, 107, 116, 0.12);
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.12);
  --warn: #ffb020;
  --warn-soft: rgba(255, 176, 32, 0.12);
  /* category hues (editor panel organization) */
  --cat-room: #5a8dff;
  --cat-room-soft: rgba(90, 141, 255, 0.14);
  --cat-envelope: #f0a35e;
  --cat-envelope-soft: rgba(240, 163, 94, 0.14);
  --cat-surfaces: #f472b6;
  --cat-surfaces-soft: rgba(244, 114, 182, 0.13);
  --cat-building: #94a3b8;
  --cat-building-soft: rgba(148, 163, 184, 0.14);
  --cat-systems: #38bdf8;
  --cat-systems-soft: rgba(56, 189, 248, 0.13);
  --cat-design: #a78bfa;
  --cat-design-soft: rgba(167, 139, 250, 0.14);
  --cat-add: #34d399;
  --cat-add-soft: rgba(52, 211, 153, 0.13);
  --cat-list: #5a8dff;
  --cat-list-soft: rgba(90, 141, 255, 0.14);
  /* segmented controls (nav tabs, 3D pick mode) */
  --seg-bg: #0b0d12;
  --seg-active: #232937;
  --row-hover: rgba(255, 255, 255, 0.025);
  --glass: rgba(20, 24, 32, 0.82);
  --overlay: rgba(3, 5, 9, 0.58);
  --scroll-thumb: rgba(143, 153, 173, 0.28);
  --spinner-track: rgba(255, 255, 255, 0.22);
  --grid-line: rgba(143, 153, 173, 0.08);
  --viewport-bg: radial-gradient(1200px 600px at 50% 0%, #1f2531 0%, var(--bg) 70%);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 20px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --elev-base: #222838;      /* 2D wall elevations: unassigned surface */
  --elev-band: #2a3245;      /* zone band without a covering */
  --elev-opening: #0a0d14;   /* door/window insets */
  --elev-trim: #e8e0d0;      /* trim line without a material color */
  /* chrome glyphs as CSS masks (paint with background: currentColor) */
  --ico-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 5.5 6.5 6.5L9 18.5'/%3E%3C/svg%3E");
  --ico-room: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='17' height='17' rx='2'/%3E%3Cpath d='M3.5 12.5H10v8M14 3.5V9h6.5'/%3E%3C/svg%3E");
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f99ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "JetBrains Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --bg-elev: #ffffff;
  --panel-bg: #f7f8fa;
  --card: #ffffff;
  --card-2: #f4f6f9;
  --input-bg: #ffffff;
  --border: #e1e5eb;
  --border-soft: #eceff3;
  --border-strong: #c7cfda;
  --text: #111827;
  --text-dim: #5f6b7e;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-text: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --accent-ring: rgba(37, 99, 235, 0.22);
  --accent-contrast: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  /* splash rainbow bands — deepened so every band keeps contrast on white */
  --rb1: #7448b8;
  --rb2: #22858c;
  --rb3: #149a5c;
  --rb4: #b89000;
  --rb5: #d97a1e;
  --rb6: #e54857;
  --danger: #d92d3a;
  --danger-soft: rgba(217, 45, 58, 0.08);
  --ok: #128a5c;
  --ok-soft: rgba(18, 138, 92, 0.1);
  --warn: #b26f00;
  --warn-soft: rgba(214, 140, 0, 0.11);
  /* category hues (editor panel organization) */
  --cat-room: #2563eb;
  --cat-room-soft: rgba(37, 99, 235, 0.09);
  --cat-envelope: #c2410c;
  --cat-envelope-soft: rgba(234, 88, 12, 0.09);
  --cat-surfaces: #db2777;
  --cat-surfaces-soft: rgba(219, 39, 119, 0.08);
  --cat-building: #475569;
  --cat-building-soft: rgba(71, 85, 105, 0.09);
  --cat-systems: #0284c7;
  --cat-systems-soft: rgba(2, 132, 199, 0.09);
  --cat-design: #7c3aed;
  --cat-design-soft: rgba(124, 58, 237, 0.08);
  --cat-add: #059669;
  --cat-add-soft: rgba(5, 150, 105, 0.09);
  --cat-list: #2563eb;
  --cat-list-soft: rgba(37, 99, 235, 0.09);
  --seg-bg: #eef1f5;
  --seg-active: #ffffff;
  --row-hover: rgba(17, 24, 39, 0.025);
  --glass: rgba(255, 255, 255, 0.86);
  --overlay: rgba(15, 23, 42, 0.32);
  --scroll-thumb: rgba(95, 107, 126, 0.32);
  --spinner-track: rgba(17, 24, 39, 0.16);
  --grid-line: rgba(37, 99, 235, 0.06);
  --viewport-bg: radial-gradient(1200px 600px at 50% 0%, #e4e9f1 0%, var(--bg) 70%);
  --shadow-xs: 0 1px 1px rgba(16, 24, 40, 0.03);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, 0.16), 0 4px 10px rgba(16, 24, 40, 0.06);
  --elev-base: #dfe6f2;
  --elev-band: #ccd6e8;
  --elev-opening: #22304a;
  --elev-trim: #8a7f6c;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6b7e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Light-theme overrides for spots that hardcode dark-friendly colors */
:root[data-theme="light"] .badge[data-category="paint"] { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; }
:root[data-theme="light"] .badge[data-category="undercoat"] { background: rgba(71, 85, 105, 0.1); color: #475569; }
:root[data-theme="light"] .badge[data-category="wallpaper"] { background: rgba(147, 51, 234, 0.09); color: #7e22ce; }
:root[data-theme="light"] .badge[data-category="parquet"] { background: rgba(180, 83, 9, 0.09); color: #9a3412; }
:root[data-theme="light"] .badge[data-category="tile"] { background: rgba(13, 148, 136, 0.09); color: #0f766e; }
:root[data-theme="light"] .badge[data-category="plaster"] { background: rgba(190, 18, 60, 0.07); color: #9f1239; }
:root[data-theme="light"] .badge[data-category="concrete"] { background: rgba(100, 116, 139, 0.11); color: #475569; }
:root[data-theme="light"] .badge[data-category="masonry"] { background: rgba(181, 107, 74, 0.11); color: #9a4a2e; }
:root[data-theme="light"] .badge[data-category="insulation"] { background: rgba(202, 138, 4, 0.11); color: #a16207; }
:root[data-theme="light"] .badge[data-category="joinery"] { background: rgba(160, 106, 60, 0.11); color: #7c4f21; }
:root[data-theme="light"] .badge[data-category="window_unit"] { background: rgba(2, 132, 199, 0.09); color: #0369a1; }
:root[data-theme="light"] .badge[data-category="door_unit"] { background: rgba(122, 82, 48, 0.11); color: #7a5230; }
:root[data-theme="light"] .badge[data-category="other"],
:root[data-theme="light"] .badge[data-source="manual"],
:root[data-theme="light"] .badge-no,
:root[data-theme="light"] .llm-badge[data-state="off"] { background: rgba(71, 85, 105, 0.09); color: #475569; }
:root[data-theme="light"] .badge[data-source="llm"] { color: #1d4ed8; }

* { box-sizing: border-box; }
/* thin, theme-tinted scrollbars everywhere (Chromium 121+ standard props) */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.5 var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-ring); }

h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 10px; }
h4 { font-size: 13px; font-weight: 650; margin: 0; }
.muted { color: var(--text-dim); }
.pad { padding: 16px; }
.spacer { flex: 1; }

/* inline stroke icons (renderer/icons.js) */
.ico { width: 16px; height: 16px; flex: none; display: block; }

/* modern disclosure chevrons for every <summary> except the category heads
   (those draw their own, right-aligned) */
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary:not(.cat-head)::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-inline-end: 6px;
  vertical-align: -1px;
  background: currentColor;
  opacity: 0.7;
  -webkit-mask: var(--ico-chevron) center / contain no-repeat;
  mask: var(--ico-chevron) center / contain no-repeat;
  transition: transform 0.15s ease;
}
details[open] > summary:not(.cat-head)::before { transform: rotate(90deg); }

/* ---------------------------------------------------------------- header */

#app-header {
  min-height: 56px;
  height: auto;
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: relative;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-inline-end: 4px;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
  filter: drop-shadow(0 3px 10px color-mix(in srgb, var(--brand-2) 45%, transparent));
}
#brand-mark-grad .g1 { stop-color: var(--brand-1); }
#brand-mark-grad .g2 { stop-color: var(--brand-2); }
/* mark (2026-10-27, from AIBuild-Solution-Overview): full squircle, open chevron, near-white gradient stroke */
.brand-mark-glyph {
  fill: none;
  stroke: url(#brand-glyph-grad);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* project picker + rename field read as ONE joined control */
.project-field {
  display: flex;
  align-items: stretch;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.project-field:hover { border-color: var(--border-strong); }
.project-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.project-field .input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-color: transparent;
  height: 32px;
  padding-top: 0;
  padding-bottom: 0;
}
.project-field .input:focus { box-shadow: none; }
.project-field select.input {
  font-weight: 600;
  border-inline-end: 1px solid var(--border-soft);
  border-radius: 8px 0 0 8px;
}

#project-select { max-width: 190px; }
#project-name { width: 180px; }

.save-indicator {
  font-size: 12px;
  font-weight: 500;
  color: var(--ok);
  opacity: 0;
  transition: opacity 0.25s;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.save-indicator.visible { opacity: 1; }
.save-indicator.save-error { color: var(--danger); }

.history-btns {
  display: flex;
  gap: 2px;
  padding-inline-start: 10px;
  border-inline-start: 1px solid var(--border-soft);
}

#app-header .btn-icon { min-width: 32px; height: 32px; }
#app-header .btn-icon .ico { width: 17px; height: 17px; }

/* header LLM status chip (button reusing the badge palette) + status dot */
.llm-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  transition: filter 0.15s;
}
.llm-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}
.llm-chip:hover { filter: brightness(1.08); }

.nav-tabs {
  display: flex;
  gap: 2px;
  background: var(--seg-bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 3px;
}

.nav-tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: 600 12.5px var(--font);
  padding: 5px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
  background: var(--seg-active);
  color: var(--accent-text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1), 0 0 0 1px var(--border-soft);
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--select-chevron) no-repeat right 8px center / 13px 13px, transparent;
  color: var(--text-dim);
  font: 600 12.5px var(--font);
  padding: 0 28px 0 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.lang-select:hover { color: var(--text); border-color: var(--border-strong); }
/* native dropdown lists take the SELECT's background: the transparent selects
   (language, project) opened white with light text in dark mode (2026-10-18) —
   every option list now follows the theme */
select option, select optgroup { background-color: var(--card); color: var(--text); }

/* ---------------------------------------------------------------- layout */

main { flex: 1; min-height: 0; }

.view { height: 100%; }
.view[hidden] { display: none; }
.view-scroll { overflow-y: auto; padding: 24px 28px 32px; }

.plan-layout {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-w, 230px) minmax(0, 1fr) var(--panel-w, 380px);
  height: 100%;
  min-height: 0;
}

#sidebar-resizer,
#panel-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 10;
  transition: background 0.15s;
}
#sidebar-resizer { inset-inline-start: calc(var(--sidebar-w, 230px) - 3px); }
#panel-resizer { inset-inline-end: calc(var(--panel-w, 380px) - 3px); }
#sidebar-resizer:hover,
#panel-resizer:hover,
#sidebar-resizer.dragging,
#panel-resizer.dragging {
  background: linear-gradient(90deg, transparent 2px, var(--accent) 2px, var(--accent) 4px, transparent 4px);
}
body.col-dragging {
  cursor: col-resize;
  user-select: none;
}
body.col-dragging .editor3d {
  pointer-events: none; /* keep OrbitControls out of the drag */
}

.rooms-sidebar {
  border-inline-end: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto; /* short windows: the column scrolls instead of overlapping */
}

.editor3d {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--viewport-bg);
}
.editor3d.editor-fallback::after {
  content: "3D";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--border);
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.rooms-panel {
  border-inline-start: 1px solid var(--border);
  background: var(--panel-bg);
  overflow-y: auto;
  padding: 14px;
  min-height: 0;
}

/* ---------------------------------------------------------------- sidebar */

.side-head { padding: 16px 16px 8px; }
.side-head h2 { font-size: 15px; font-weight: 700; }
.side-foot { padding: 10px 12px 12px; margin-top: auto; border-top: 1px solid var(--border-soft); }

.room-list {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  overflow-y: auto;
  flex: 1;
}

.room-item {
  position: relative;
  display: block;
  width: 100%;
  text-align: start;
  border: none;
  background: transparent;
  color: var(--text);
  font: 500 13px var(--font);
  padding: 7px 10px 7px 33px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s, color 0.12s;
}
.room-item::before {
  content: "";
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  background: currentColor;
  opacity: 0.5;
  -webkit-mask: var(--ico-room) center / contain no-repeat;
  mask: var(--ico-room) center / contain no-repeat;
}
.room-item:hover { background: var(--card-2); }
.room-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.room-item.active::before { opacity: 1; }

/* ---------------------------------------------------------------- controls */

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: 600 12.5px/18px var(--font);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
}
.btn:hover { background: var(--card-2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--card-2); border-color: transparent; color: var(--text); }
.btn-ghost.btn-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm .ico { width: 15px; height: 15px; }
.btn-block { width: 100%; white-space: normal; text-align: center; }
.btn-icon { min-width: 30px; padding: 5px 7px; line-height: 18px; }

.input {
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font: 13px var(--font);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  width: 100%;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.input:hover:not(:disabled):not(:focus) { border-color: var(--border-strong); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input:disabled { opacity: 0.6; cursor: not-allowed; }
.input::placeholder { color: color-mix(in srgb, var(--text-dim) 70%, transparent); }
select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px 14px;
  padding-inline-end: 30px;
  text-overflow: ellipsis;
  cursor: pointer;
}
.table select.input,
.pick-filters select.input,
.project-field select.input {
  padding-inline-end: 24px;
  background-position: right 6px center;
  background-size: 12px 12px;
}
textarea.input { resize: vertical; min-height: 60px; line-height: 1.5; }
.input.num { text-align: end; font-variant-numeric: tabular-nums; }
input[type="file"].input { padding: 4px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
input[type="file"].input::file-selector-button {
  margin-inline-end: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-2);
  color: var(--text);
  font: 600 12px var(--font);
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
input[type="file"].input:hover::file-selector-button { border-color: var(--border-strong); }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent); }

/* ---------------------------------------------------------------- forms */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 12px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--text-dim); font-weight: 550; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox > span { font-size: 12.5px; color: var(--text); }
.field.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); }
.span-2 { grid-column: span 2; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
summary.section-title { display: flex; align-items: center; user-select: none; }
summary.section-title:hover { color: var(--text); }

.panel-toolbar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.panel-empty { padding: 32px 12px; text-align: center; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.page-head h2 { font-size: 22px; letter-spacing: -0.025em; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------------------------------------------------------- tables */

.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: start;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: var(--row-hover); }
.table .num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.table tfoot td { border-bottom: none; font-weight: 700; padding-top: 10px; }
.table .actions { white-space: nowrap; text-align: end; }
.table .input { padding: 5px 8px; font-size: 12.5px; }

.row-total td { border-top: 1px solid var(--border); }

.undercoat-row td { color: var(--text-dim); font-size: 12.5px; }
.undercoat-row td.indent { padding-inline-start: 26px; }

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 16px;
  background: var(--card-2);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge[data-category="paint"] { background: rgba(90, 141, 255, 0.16); color: #a5c2ff; }
.badge[data-category="undercoat"] { background: rgba(148, 163, 184, 0.16); color: #b8c2d6; }
.badge[data-category="wallpaper"] { background: rgba(192, 132, 252, 0.16); color: #d3aafc; }
.badge[data-category="parquet"] { background: rgba(245, 158, 11, 0.15); color: #f5c168; }
.badge[data-category="tile"] { background: rgba(45, 212, 191, 0.15); color: #6fe3d3; }
.badge[data-category="plaster"] { background: rgba(251, 113, 133, 0.15); color: #fda4af; }
.badge[data-category="other"] { background: rgba(148, 163, 184, 0.14); color: #a9b4c9; }
.badge[data-category="concrete"] { background: rgba(154, 160, 166, 0.18); color: #c3c9cf; }
.badge[data-category="masonry"] { background: rgba(181, 107, 74, 0.18); color: #e09b7f; }
.badge[data-category="insulation"] { background: rgba(232, 212, 79, 0.16); color: #e8d44f; }
.badge[data-category="joinery"] { background: rgba(160, 106, 60, 0.18); color: #c99a6c; }
.badge[data-category="window_unit"] { background: rgba(159, 212, 240, 0.16); color: #9fd4f0; }
.badge[data-category="door_unit"] { background: rgba(122, 82, 48, 0.22); color: #b98a5e; }

.badge[data-source="manual"] { background: rgba(148, 163, 184, 0.14); color: #a9b4c9; }
.badge[data-source="llm"] { background: var(--accent-soft); color: var(--accent-text); }
.badge[data-source="fallback"] { background: var(--warn-soft); color: var(--warn); }

.badge-yes { background: var(--ok-soft); color: var(--ok); }
.badge-no { background: rgba(148, 163, 184, 0.14); color: #a9b4c9; }

.llm-badge[data-state="off"] { background: rgba(148, 163, 184, 0.14); color: #a9b4c9; }
.llm-badge[data-state="starting"] { background: var(--warn-soft); color: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.llm-badge[data-state="ready"] { background: var(--ok-soft); color: var(--ok); }
.llm-badge[data-state="error"] { background: var(--danger-soft); color: var(--danger); }

/* gen3d job state chips (mirrors llm-badge states) */
.gen3d-state[data-state="queued"] { background: var(--accent-soft); color: var(--accent-text); }
.gen3d-state[data-state="processing"] { background: var(--warn-soft); color: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.gen3d-state[data-state="preparing"], .gen3d-state[data-state="validating"] { background: var(--accent-soft); color: var(--accent-text); animation: pulse 1.2s ease-in-out infinite; } /* 2026-11-15 GEN-06 */
.gen3d-state[data-state="done"] { background: var(--ok-soft); color: var(--ok); }
.gen3d-state[data-state="error"] { background: var(--warn-soft); color: var(--warn); }
:root[data-theme="light"] .gen3d-state[data-state="queued"] { color: #1d4ed8; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------------------------------------------------------------- surfaces */

/* one column in the default-width panel, two once it is dragged wide */
.surfaces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 10px;
}

.surface-card {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.surface-card:hover { border-color: var(--border-strong); }
.surface-card:focus-visible { outline: none; border-color: var(--accent); }
.surface-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* D23: project-wide 3D pick list (left sidebar, under the room list) */
.pick-list { margin: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); box-shadow: var(--shadow-xs); }
.pick-list summary { padding: 9px 11px; cursor: pointer; color: var(--text-dim); font-size: 12.5px; font-weight: 600; user-select: none; }
.pick-list summary:hover { color: var(--text); }
.pick-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 8px 8px; }
.pick-filters [data-pick-filter='room'] { grid-column: 1 / -1; }
.pick-filters .input { min-width: 0; padding: 3px 6px; font-size: 11.5px; }
.pick-list-body { padding: 0 6px 8px; max-height: 260px; overflow-y: auto; }
.pick-empty { padding: 2px 8px 6px; font-size: 12px; }
/* collapsible groups: storey (accent) → room (dim) */
details.pick-rm { margin: 2px 0; }
details.pick-rm > summary { cursor: pointer; user-select: none; padding: 3px 4px; font-size: 11px; font-weight: 650; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
details.pick-lvl { margin-top: 6px; }
details.pick-lvl:first-child { margin-top: 0; }
details.pick-lvl > summary { cursor: pointer; user-select: none; padding: 6px 4px 3px; font-size: 11px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.06em; border-top: 1px solid var(--border-soft); }
details.pick-lvl:first-child > summary { padding-top: 0; border-top: 0; }
.pick-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; text-align: start; background: none; border: 1px solid transparent;
  border-radius: 6px; padding: 3px 8px; font: inherit; font-size: 12.5px; color: var(--text);
  cursor: pointer; transition: background 0.1s, border-color 0.1s;
}
.pick-row .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; font-size: 11.5px; }
.pick-row:hover { background: var(--card-2); }
.pick-row:focus-visible { outline: none; border-color: var(--accent); }
.pick-row.selected { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent-text); }

.surface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.surface-name { font-weight: 650; font-size: 13px; }
.surface-removed { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; font-size: 12px; }
.surface-area { font-size: 11.5px; white-space: nowrap; }
.surface-area strong { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- catalog */

.catalog-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.catalog-layout.editing { grid-template-columns: minmax(0, 1fr) 400px; }

.editor-card h3 { margin-bottom: 14px; }
.editor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-size: 12px;
}
.editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

/* one consistent, clearly visible focus ring (was: thin UA outline, invisible on dark) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid var(--spinner-track);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.missing-url-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.missing-url-row .btn .spinner { display: inline-block; vertical-align: middle; }

/* norm compliance card (NF C 15-100) */
.compliance-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; max-height: 220px; overflow: auto; }
.compliance-list li.ok { color: var(--ok); }
.compliance-list li.ko { color: var(--warn); }

/* structure pre-dimensioning card */
.structure-card .ok-row strong { color: var(--ok); }
.structure-card .ko-row strong { color: var(--danger); }
.structure-note { margin: 4px 0 0; font-size: 12px; }
.structure-disclaimer { margin: 10px 0 0; padding: 9px 11px; font-size: 12px; color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--radius-sm); }

/* catalog editor while an analysis runs: inputs are inert (edits would be lost) */
.editor-busy :is(input, select, textarea, button) { pointer-events: none; }
.editor-busy .form-grid, .editor-busy .editor-actions { opacity: 0.55; }
.editor-busy-note { margin: 4px 0 0; font-size: 12px; }

/* ---------------------------------------------------------------- summary */

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 16px;
  align-items: start;
}

.rooms-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.totals-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; align-self: start; min-width: 0; }

.room-summary h3 { margin-bottom: 10px; }

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.total-row > strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-row.grand {
  border-bottom: none;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-text);
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
}

/* labor table can be wider than the totals column — scroll inside the card
   instead of pushing the whole page sideways */
.labor-block { padding: 8px 0; border-bottom: 1px solid var(--border-soft); overflow-x: auto; }
.labor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.labor-table { margin-bottom: 4px; }
.labor-table .unit-cell { width: 56px; }
/* UX-21 (2026-11-15): the labour lines card sits in the main column — wide
   enough for the rate picker and a readable description */
.labor-card .labor-table td:nth-child(2) input { min-width: 220px; }
.labor-card .labor-table .rate-pick { min-width: 150px; }
.labor-card .labor-table input.num { min-width: 80px; }

.margin-editor { display: flex; gap: 6px; align-items: center; flex: 1; justify-content: flex-end; }
.margin-editor select { width: auto; }
.margin-editor input { width: 90px; }
.vat-input { width: 80px; }

.warnings-card { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 5%, var(--card)); }
.warnings-card h4 { color: var(--warn); margin-bottom: 8px; }
.warnings-card ul { margin: 0; padding-inline-start: 18px; color: var(--text-dim); font-size: 12.5px; }
.warnings-card li { padding: 2px 0; }
/* EST-07 (2026-11-15): notices grouped by kind, each with "Y aller" */
.warnings-card .notice-group + .notice-group { margin-top: 10px; }
.warnings-card h5 { margin: 0 0 4px; font-size: 12.5px; color: var(--text); display: flex; gap: 6px; align-items: center; }
.warnings-card li { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.warnings-card .notice-go { flex: none; padding: 1px 8px; font-size: 11.5px; }
.warnings-card .notice-unpriced h5 { color: var(--warn); }

/* ---------------------------------------------------------------- settings */

/* centered reading column instead of a left-hugging strip on wide screens */
#settings-root { max-width: 860px; margin: 0 auto; }
.settings-card { max-width: none; margin-bottom: 14px; }
.ai-models-table .ai-warn { color: var(--warn); }

.llm-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.llm-head h3 { margin: 0; }
.llm-status-label { margin-inline-start: auto; font-size: 12px; }

#llm-detail { font-size: 12px; margin-bottom: 12px; min-height: 16px; word-break: break-all; }

.llm-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.progress {
  height: 8px;
  background: var(--card-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand-1), var(--accent));
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress-label { font-size: 12px; margin-top: 6px; min-height: 16px; word-break: break-all; }

/* ---------------------------------------------------------------- toasts */

#toast-root {
  position: fixed;
  inset-inline-end: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  max-width: 420px;
}

.toast {
  --toast-hue: var(--accent);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 12px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  word-break: break-word;
}
.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--toast-hue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--toast-hue) 18%, transparent);
}
.toast-ok { --toast-hue: var(--ok); }
.toast-error { --toast-hue: var(--danger); }
.toast-warn { --toast-hue: var(--warn); }
/* prerequisite toast (2026-10-28): "Y aller" reveals the missing prerequisite */
.toast-action {
  flex: none;
  align-self: center;
  border: 1px solid color-mix(in srgb, var(--toast-hue) 55%, var(--border));
  background: color-mix(in srgb, var(--toast-hue) 14%, transparent);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.toast-action:hover { background: color-mix(in srgb, var(--toast-hue) 26%, transparent); }
.toast.out { opacity: 0; transform: translateX(12px); transition: opacity 0.3s, transform 0.3s; }
.toast-msg { flex: 1; }
.toast-close {
  border: none;
  background: transparent;
  color: var(--text-dim);
  line-height: 1;
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  display: grid;
  place-items: center;
}
.toast-close .ico { width: 14px; height: 14px; }
.toast-close:hover { color: var(--text); background: var(--card-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- help tips */

.tip-bubble {
  position: fixed;
  z-index: 2000;
  max-width: 330px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.tip-bubble.visible { opacity: 1; transform: none; }
.tip-direct { font-weight: 600; }
.tip-under { margin-top: 4px; font-size: 11.5px; color: var(--text-dim); }
/* "what it does" (bold) is set apart from "how it works / what it changes" */
.tip-direct + .tip-under { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--border-soft); }
/* feature headings that carry a help bubble: help cursor + dotted underline on
   hover (summary headings keep their pointer — they also fold/unfold) */
:is(h2, h3, h4, .side-sec-title, .sgroup-title > span, .fgroup > span, .sub-head > span, .plan-underlay > span)[data-i18n-tip] { cursor: help; }
:is(h2, h3, h4, .side-sec-title, .sgroup-title > span, .fgroup > span, .sub-head > span, .plan-underlay > span)[data-i18n-tip]:hover {
  text-decoration: underline dotted color-mix(in srgb, var(--text-dim) 70%, transparent);
  text-underline-offset: 3px;
}
@media print { .tip-bubble { display: none !important; } }

/* ---------------------------------------------------------------- misc */

.fatal {
  margin: 60px auto;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 24px;
  font-size: 14px;
}

/* ---------------------------------------------------------------- print */

@page { margin: 14mm; }

@media print {
  body { background: #fff; color: #000; overflow: visible; display: block; }
  #app-header, #toast-root, .no-print { display: none !important; }
  main { overflow: visible; }
  .view { display: none !important; height: auto; }
  #view-summary { display: block !important; overflow: visible; padding: 0; }
  .summary-grid { grid-template-columns: 1fr; }
  #view-summary .card {
    background: #fff;
    border: 1px solid #bbb;
    box-shadow: none;
    break-inside: avoid;
    margin-bottom: 10px;
    padding: 12px;
  }
  #view-summary * { color: #000 !important; box-shadow: none !important; }
  #view-summary .table th { border-bottom-color: #888; }
  #view-summary .table td { border-bottom-color: #ccc; }
  #view-summary input,
  #view-summary select {
    border: none !important;
    background: transparent !important;
    padding: 0;
    width: auto;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
  }
  #view-summary input::-webkit-outer-spin-button,
  #view-summary input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  #view-summary .total-row { border-bottom-color: #ccc; }
  #view-summary .total-row.grand { font-size: 17px; background: none; padding: 12px 0 0; }
  #view-summary .warnings-card { border-color: #888; }
}

/* ---------------------------------------------------------------- theme toggle */

.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

/* ------------------------------------------------------------- quick add card */

.quick-add-card {
  margin-bottom: 14px;
  padding: 12px 14px;
}
.quick-add-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.quick-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quick-add-row .input { flex: 1; min-width: 0; }
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.switch-label input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ------------------------------- 3D context menu --------------------------- */
.ctx-menu {
  position: fixed;
  z-index: 1000;
  min-width: 210px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  font-size: 13px;
  animation: menu-in 0.12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }
.ctx-title {
  padding: 6px 10px 7px;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
  white-space: nowrap;
}
.ctx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: start;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.ctx-item:hover { background: var(--accent-soft); color: var(--accent-text); }
.ctx-item.ctx-current { color: var(--accent-text); font-weight: 600; }
.ctx-sub {
  display: none;
  position: absolute;
  inset-inline-start: 100%;
  top: -6px;
  min-width: 210px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
}
.ctx-has-sub:hover > .ctx-sub { display: block; }
.ctx-sub.ctx-sub-flip { inset-inline-start: auto; inset-inline-end: 100%; } /* E3D-19: no room on that side */
.ctx-arrow { color: var(--text-dim); }
/* "Sélectionner une surface" flyout (iso with the rooms-panel pick list):
   storey group headers + room labels, surface rows indented; taller scroller */
.ctx-sub-pick { min-width: 240px; max-height: min(60vh, 560px); }
.ctx-group { padding: 6px 10px 2px; color: var(--accent-text); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.ctx-group.ctx-room { color: var(--text-dim); font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0.02em; padding-inline-start: 14px; }
.ctx-item.ctx-pick { padding-inline-start: 26px; }
/* D24 furniture menu: measures readout + destructive action */
.ctx-measures { padding: 4px 10px 2px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctx-measures-sub { color: var(--text-dim); padding-bottom: 6px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; }
.ctx-item.ctx-danger { color: var(--danger, #e06c60); }
.ctx-item.ctx-danger:hover { background: var(--danger-soft); }
/* D25 opening menu: position/size adjuster rows (label + −/+) */
.ctx-adj { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 3px; padding: 1px 4px; }
.ctx-adj > span { padding: 0 6px; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.ctx-adj .ctx-item { width: auto; padding: 4px 8px; font-size: 11.5px; }
.ctx-adj.ctx-adj4 { grid-template-columns: 1fr auto auto auto auto; } /* v35 existing volumes: −1 m −10 cm +10 cm +1 m */

/* ------------------------------- 2D plan editor (schema view) --------------
   SVG layer stacked over the 3D canvas (plan2d.js). Sizes are SVG user units
   = metres, so strokes/text scale with the plan zoom. */
.plan2d {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
}
.plan2d[hidden] { display: none; }
.plan2d-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.plan2d-toolbar .input { width: auto; }
.plan2d-toolbar .btn.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); }
.plan2d-canvas { flex: 1; width: 100%; height: 100%; display: block; touch-action: none; }
.plan2d.draw .plan2d-canvas { cursor: crosshair; }
.plan2d.panning .plan2d-canvas, .plan2d.panning .plan2d-canvas * { cursor: grabbing !important; }
.plan2d-underlay { opacity: 0.5; }
.plan2d-floor { fill: var(--bg-elev); cursor: move; }
.plan2d-room.selected .plan2d-floor { fill: var(--accent-soft); }
.plan2d-wall { stroke: var(--text); stroke-width: 0.12; stroke-linecap: square; cursor: pointer; }
.plan2d-wall.t-porteur { stroke-width: 0.16; }
.plan2d-wall.t-mur { stroke: color-mix(in srgb, var(--text) 70%, transparent); stroke-width: 0.12; }
.plan2d-wall.t-cloison { stroke: color-mix(in srgb, var(--text) 45%, transparent); stroke-width: 0.06; }
/* v31 exact walls: real-thickness bands, French plan convention (porteur solid, mur grey, cloison light) */
.plan2d-wall.plan2d-band { stroke: color-mix(in srgb, var(--text) 60%, transparent); stroke-width: 0.006; stroke-linejoin: round; }
.plan2d-wall.plan2d-band.t-porteur { fill: var(--text); }
.plan2d-wall.plan2d-band.t-mur { fill: color-mix(in srgb, var(--text) 50%, transparent); }
.plan2d-wall.plan2d-band.t-cloison { fill: color-mix(in srgb, var(--text) 22%, transparent); }
.plan2d-wall.removed { stroke: color-mix(in srgb, var(--text) 40%, transparent); stroke-width: 0.025; stroke-dasharray: 0.08 0.06; fill: none; }
.plan2d-whandle { cursor: move; }
/* 2026-10-30: alignment guides while a wall / room is dragged (align.js) */
.plan2d-guide { stroke: var(--align); stroke-width: 0.02; stroke-dasharray: 0.1 0.05; pointer-events: none; }
.plan2d-guide.k-touch, .plan2d-guide.k-wall { stroke-dasharray: none; stroke-width: 0.03; }
.plan2d-guide-label { fill: var(--align); font-size: 0.13px; font-weight: 600; pointer-events: none; user-select: none; paint-order: stroke; stroke: var(--bg, #fff); stroke-width: 0.03px; }
/* v31 phase C: door swing hit area + exterior dimension chains */
.plan2d-door-hit { fill: transparent; stroke: none; cursor: pointer; }
.plan2d-door-hit:hover { fill: var(--accent-soft); }
/* trade focus: a door swing / furniture the trade doesn't handle — no click, furniture faded as context */
.plan2d-door-hit.off { cursor: default; }
.plan2d-door-hit.off:hover { fill: transparent; }
.plan2d-furn.off { opacity: 0.35; pointer-events: none; }
.plan2d-xdim-line, .plan2d-xdim-tick { stroke: var(--text-dim); stroke-width: 0.012; }
.plan2d-xdim { fill: var(--text-dim); font-size: 0.15px; text-anchor: middle; dominant-baseline: auto; }
.plan2d-xdim.small { font-size: 0.09px; }
.plan2d-xdim.total { fill: var(--text); font-weight: 600; }
.plan2d-xdim { pointer-events: none; user-select: none; }
.plan2d-xdims line { pointer-events: none; }
.plan2d-room-over .plan2d-door, .plan2d-room-over .plan2d-window { pointer-events: none; }
/* v31 walls card (rooms panel) */
.walls-table td { vertical-align: middle; }
.walls-table .input.num { width: 5.5em; }
/* 2026-11-15 (UX-24): room-shape corners — readable X / Z / sag inputs, actions never cut */
.shape-table { width: 100%; table-layout: auto; }
.shape-table .input.num { min-width: 64px; width: 100%; box-sizing: border-box; }
.shape-table .row-actions { white-space: nowrap; width: 1%; }
.shape-table .shape-wall-row td { padding-top: 0; font-size: 0.85em; border-top: 0; }
.warn-text { color: var(--warn); }
.wall-model-row { display: flex; flex-direction: column; gap: 4px; }
.plan2d-door { stroke: var(--text-dim); stroke-width: 0.025; }
.plan2d-window { stroke: var(--text-dim); stroke-width: 0.02; }
.plan2d-name { fill: var(--text); font-size: 0.17px; font-weight: 600; text-anchor: middle; pointer-events: none; user-select: none; }
.plan2d-dims { fill: var(--text-dim); font-size: 0.13px; text-anchor: middle; pointer-events: none; user-select: none; }
.plan2d-furn-box { fill: var(--bg); stroke: var(--text-dim); stroke-width: 0.02; cursor: move; }
.plan2d-glyph { fill: none; stroke: var(--text-dim); stroke-width: 0.02; pointer-events: none; }
.plan2d-furn-label { fill: var(--text-dim); font-size: 0.11px; text-anchor: middle; dominant-baseline: middle; pointer-events: none; user-select: none; }
.plan2d-handle { fill: var(--accent); stroke: var(--bg); stroke-width: 0.02; }
.plan2d-hole { fill: none; stroke: var(--text-dim); stroke-width: 0.02; stroke-dasharray: 0.08 0.05; pointer-events: none; }
.plan2d-hole.ceiling { stroke: var(--accent); }
.plan2d-cutout rect, .plan2d-cutout path { fill: none; stroke: var(--text-dim); stroke-width: 0.018; pointer-events: none; }
.plan2d-cutout.ceiling rect { stroke-dasharray: 0.08 0.05; }
.plan2d-cutout.well rect, .plan2d-cutout.well path { stroke: var(--accent); }
/* stairs v2 (2026-11-11): stairs in the 2D plan */
.plan2d-stair { cursor: move; }
.plan2d-stair.arriving { pointer-events: none; opacity: 0.55; }
.plan2d-stair-tread { fill: var(--card-2, #f3f4f6); stroke: var(--text-dim); stroke-width: 0.012; }
.plan2d-stair-tread.landing { fill: color-mix(in srgb, var(--accent) 10%, var(--card-2, #f3f4f6)); }
.plan2d-stair-tread.above { stroke-dasharray: 0.05 0.035; fill-opacity: 0.55; }
.plan2d-stair.arriving .plan2d-stair-tread { fill: none; stroke-dasharray: 0.05 0.035; }
.plan2d-stair.selected .plan2d-stair-tread { stroke: var(--primary); stroke-width: 0.02; }
.plan2d-stair-walk { fill: none; stroke: var(--accent); stroke-width: 0.02; pointer-events: none; }
.plan2d-stair-arrow, .plan2d-stair-dot { fill: var(--accent); pointer-events: none; }
.plan2d-stair-label { fill: var(--text-dim); font-size: 0.11px; pointer-events: none; user-select: none; }
.plan2d-stair-handle { stroke: #fff; stroke-width: 0.02; cursor: grab; }
.plan2d-stair-handle.h-start { fill: #22a447; }
.plan2d-stair-handle.h-end { fill: #f08a00; }
.plan2d-stair-handle.h-corner { fill: #2f6bff; }
.plan2d-stair-handle.h-bend { fill: #a23ccf; }
.plan2d-handle-nw, .plan2d-handle-se { cursor: nwse-resize; }
.plan2d-handle-ne, .plan2d-handle-sw { cursor: nesw-resize; }
.plan2d-vertex { cursor: move; fill: var(--accent-text); } /* v29 polygon corner */
/* v32 cadastral parcel: dashed limit under the rooms + edge lengths */
.plan2d-parcel { fill: none; stroke: var(--ok); stroke-width: 0.05; stroke-dasharray: 0.3 0.15; pointer-events: none; }
/* v33: each parcel of the site (inner limits faint), the outline's move grip, centre cross + "N" handle */
.plan2d-parcel-part { fill: color-mix(in srgb, var(--ok) 8%, transparent); stroke: none; pointer-events: none; }
.plan2d-existing { fill: url(#plan2d-ex-hatch); stroke: color-mix(in srgb, var(--text) 70%, transparent); stroke-width: 0.06; pointer-events: none; } /* v35 existing buildings */
.plan2d-existing.ghost { stroke-dasharray: 0.2 0.12; opacity: 0.7; }
.plan2d-existing-hatch { stroke: color-mix(in srgb, var(--text) 32%, transparent); stroke-width: 0.04; }
.plan2d-existing-name, .plan2d-existing-h { text-anchor: middle; fill: var(--text); paint-order: stroke; stroke: var(--bg, #fff); pointer-events: none; font-weight: 600; }
.plan2d-existing-h { font-weight: 400; fill: var(--text-dim); }
.plan2d-parcel-part.multi { stroke: color-mix(in srgb, var(--ok) 45%, transparent); stroke-width: 0.02; stroke-dasharray: 0.08 0.08; }
.plan2d-parcel-hit { fill: none; stroke: transparent; pointer-events: stroke; cursor: move; }
.plan2d-parcel-hit:hover { stroke: color-mix(in srgb, var(--ok) 18%, transparent); }
.plan2d-parcel-axis { stroke: color-mix(in srgb, var(--ok) 55%, transparent); stroke-dasharray: 0.12 0.1; pointer-events: none; }
.plan2d-parcel-move { cursor: move; }
.plan2d-parcel-move circle { fill: color-mix(in srgb, var(--ok) 14%, var(--bg, #fff)); stroke: var(--ok); stroke-width: 0.03; }
.plan2d-parcel-move path { stroke: var(--ok); fill: none; }
.plan2d-parcel-rot { cursor: grab; }
.plan2d-parcel-rot circle { fill: var(--ok); stroke: var(--bg, #fff); stroke-width: 0.03; }
.plan2d-parcel-rot text { fill: #fff; font-weight: 800; text-anchor: middle; dominant-baseline: central; pointer-events: none; user-select: none; }
.plan2d-parcel-len { fill: var(--ok); font-weight: 600; text-anchor: middle; dominant-baseline: middle; pointer-events: none; user-select: none; paint-order: stroke; stroke: var(--bg, #fff); }
.plan2d-parcel-name { fill: var(--ok); font-weight: 700; text-anchor: middle; pointer-events: none; user-select: none; opacity: 0.8; }
.plan2d-rubber { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 0.03; stroke-dasharray: 0.12 0.07; pointer-events: none; }
/* 2026-10-30: free room drawing (corner by corner) + live segment lengths */
.plan2d.draw .plan2d-canvas .plan2d-floor, .plan2d.draw .plan2d-canvas .plan2d-wall, .plan2d.draw .plan2d-canvas .plan2d-handle, .plan2d.draw .plan2d-canvas .plan2d-furn-box, .plan2d.draw .plan2d-canvas .plan2d-door-hit { cursor: crosshair; }
.plan2d-poly-fill { fill: var(--accent-soft); stroke: none; pointer-events: none; }
.plan2d-poly-line { fill: none; stroke: var(--accent); stroke-width: 0.04; stroke-linejoin: round; pointer-events: none; }
.plan2d-poly-live { stroke: var(--accent); stroke-width: 0.03; stroke-dasharray: 0.12 0.07; pointer-events: none; }
.plan2d-poly-close { stroke: color-mix(in srgb, var(--accent) 45%, transparent); stroke-width: 0.02; stroke-dasharray: 0.06 0.06; pointer-events: none; }
.plan2d-poly-pt { fill: var(--bg); stroke: var(--accent); stroke-width: 0.03; cursor: move; }
.plan2d.draw .plan2d-canvas .plan2d-poly-pt { cursor: move; }
.plan2d-poly-pt.first { fill: var(--accent); cursor: pointer; }
.plan2d-poly-pt.first.hot { stroke: var(--align); stroke-width: 0.06; }
.plan2d-poly-cursor { fill: var(--accent); pointer-events: none; }
.plan2d-seglen { fill: var(--text); font-size: 0.14px; font-weight: 600; text-anchor: middle; dominant-baseline: middle; pointer-events: none; user-select: none; paint-order: stroke; stroke: var(--bg, #fff); stroke-width: 0.035px; }
.plan2d-seglen.live { fill: var(--accent-text); font-size: 0.16px; }
.plan2d-seglen.closing { fill: var(--text-dim); font-weight: 400; }
.plan2d-status { font-size: 12px; color: var(--text-dim); margin-left: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan2d-popups { position: absolute; inset: 0; pointer-events: none; }
.plan2d-popup {
  position: absolute;
  pointer-events: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  z-index: 30;
}
.plan2d-popup-title { font-weight: 650; font-size: 12.5px; color: var(--text-dim); }
.plan2d-popup .field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.plan2d-popup .field > span { color: var(--text-dim); }
.plan2d-popup-btns { display: flex; gap: 6px; justify-content: flex-end; }

/* ------------------------------- schema v2 surface editors ----------------- */
.sub-block {
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
}
.sub-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sub-head .btn { text-transform: none; letter-spacing: 0; }
/* v32 cadastre block (Site section) */
.cad-block { margin-top: 10px; }
.cad-info { margin: 8px 0 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.cad-note { margin: 6px 0 0; font-size: 11px; line-height: 1.4; }
.ex-block { margin-top: 10px; } /* v35 existing buildings */
.ex-cands { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.ex-cand { font-size: 12px; align-items: flex-start; }
.ex-cand.placed { opacity: 0.6; }
.ex-row { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.ex-row-head .input { flex: 1; min-width: 0; }
.ex-meta { margin: 4px 0 0; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cad-parts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 4px; }
.cad-part {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cad-part-x {
  border: 0; background: none; color: inherit; font: inherit; font-size: 11px; line-height: 1;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
}
.cad-part-x:hover { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.cad-parts .btn { margin-inline-start: auto; }
.cad-keep { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; font-size: 12px; cursor: pointer; }
.zone {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-bottom: 6px;
  background: var(--card-2);
}
.zone-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.zone-head .field-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.zone-head .field-inline span { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.zone-head .input { width: 90px; }
.zone-hint { font-size: 11.5px; white-space: nowrap; }
.layer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.layer .input { min-width: 0; flex: 1; }
.layer .coats-input { flex: 0 0 62px; }
.layer-bonding { flex: 0 0 62px; text-align: center; font-size: 12px; }
.trim { margin-bottom: 6px; }
.trim .trim-pos { flex: 0 0 110px; }
.kind-badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 650;
  vertical-align: middle;
}
.prep-row td { color: var(--text-dim); }
.row-prep-total td { border-top: 1px solid var(--border-soft); font-size: 12.5px; }
.total-sub { font-size: 12.5px; margin-top: -6px; }

/* ------------------------------- phases 5-8 -------------------------------- */
.level-filter { padding: 4px 4px 8px; }
.level-filter .input { width: 100%; }
.room-filter { padding: 0 4px 8px; font-size: 12.5px; }
.room-filter summary { cursor: pointer; color: var(--text-dim); font-weight: 550; user-select: none; padding: 2px 0; }
.room-filter summary:hover { color: var(--text); }
.room-filter-body { padding: 6px 0 2px 4px; }
.room-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 0; }
.room-filter-row label { display: flex; align-items: center; gap: 7px; cursor: pointer; min-width: 0; }
.room-filter-row label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link { background: none; border: none; padding: 0 2px; color: var(--accent-text); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
.btn-link:disabled { color: var(--text-dim); cursor: default; text-decoration: none; }
.room-filter-all { margin-top: 4px; }
.cutout-hint { font-size: 12px; margin: 4px 0 6px; }
.client-input { min-width: 180px; }
.color-input { padding: 2px; height: 34px; cursor: pointer; }
.texture-picker > span { display: block; margin-bottom: 4px; }
.texture-current { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.texture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}
.texture-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.texture-thumb:hover { border-color: var(--accent); transform: translateY(-1px); }
.texture-active { border-color: var(--ok); cursor: default; }
.gen3d-thumbs { max-height: 160px; overflow-y: auto; }
.gen3d-thumbs .texture-active { border-color: var(--accent); cursor: pointer; }
.audit-row td {
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 2px 8px 6px 22px;
  border-top: 0;
  font-family: var(--font-mono);
}
.recap-card { margin-top: 12px; }
.print-header { display: none; }

/* ------------------------------- print (devis) ----------------------------- */
@media print {
  #app-header, .no-print, .rooms-sidebar, #rooms-panel, #sidebar-resizer, #panel-resizer,
  .editor3d, .nav-tabs, .toast, .ctx-menu { display: none !important; }
  body { background: #fff; color: #000; }
  .print-header { display: block; margin-bottom: 12px; }
  .print-header h1 { font-size: 22px; margin: 0 0 4px; }
  .print-meta { color: #444; font-size: 12px; }
  .summary-grid { display: block; }
  .card { border: 1px solid #bbb; background: #fff; page-break-inside: avoid; margin-bottom: 10px; }
  .table th, .table td { color: #000; }
  .audit-row td { color: #333; }
  .muted { color: #555; }
  input, select { border: none; background: none; color: #000; pointer-events: none; }
}

/* ------------------------------- 3D opacity slider -------------------------- */
/* floating glass toolbar over the canvas: slider + view toggles; wraps (right-
   aligned) instead of overflowing when the 3D column is narrow */
.view3d-opacity {
  position: absolute;
  inset-inline-end: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding: 5px 6px 5px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  z-index: 20;
}
.view3d-opacity input[type="range"] { width: 120px; margin: 0 4px; accent-color: var(--accent); }
.view3d-opacity b {
  min-width: 38px;
  margin-inline-end: 4px;
  padding-inline-end: 10px;
  border-inline-end: 1px solid var(--border);
  text-align: end;
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.view3d-walltoggle {
  height: 28px;
  padding: 0 10px;
  font: 600 12px var(--font);
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.view3d-walltoggle:hover { color: var(--text); background: var(--card-2); }
.view3d-walltoggle.active {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.view3d-attrib {
  padding-inline: 3px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.72;
  white-space: nowrap;
}
/* Surfaces / Mobilier / Tout pick-mode trio as one segmented control */
.view3d-pickmode {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  margin: 0 2px;
  background: var(--seg-bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}
.view3d-pickmode .view3d-walltoggle { height: 24px; border: 0; }
.view3d-pickmode .view3d-walltoggle.active {
  background: var(--seg-active);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 0 0 1px var(--border-soft);
}
/* Soleil panel: sits just above the 3D overlay bar, right-aligned */
.view3d-sun {
  position: absolute;
  inset-inline-end: 12px;
  bottom: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  color: var(--text-dim);
  z-index: 20;
}
.view3d-sun[hidden] { display: none; }
.view3d-sun label { display: flex; align-items: center; gap: 6px; }
.view3d-sun input[type="range"] { width: 130px; accent-color: var(--accent); }
.view3d-sun input[type="date"] {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: 12px var(--font);
  padding: 3px 6px;
}
.view3d-sun b { min-width: 38px; text-align: end; color: var(--text); font-variant-numeric: tabular-nums; }
/* Render quality (2026-10-31): "Rendu" label inside the Bas/Moyen/Haut segment */
.view3d-quality { align-items: center; }
.view3d-quality-label { padding: 0 4px 0 6px; font-weight: 600; }
.view3d-walltoggle[hidden] { display: none; }
/* Rendu photo: the path-traced canvas over the 3D canvas (under the bars and
   the 2D plan), and its progress panel top-right */
.view3d-photo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.view3d-photo {
  position: absolute;
  inset-inline-end: 12px;
  top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  z-index: 20;
}
.view3d-photo[hidden] { display: none; }
.texture-cell { position: relative; }
.texture-pipette {
  position: absolute;
  inset-inline-end: 2px;
  bottom: 2px;
  padding: 1px 5px;
  font-size: 11px;
  background: var(--bg-elev);
  opacity: 0.9;
}

/* ------------------------------- v4 additions -------------------------------- */
.badge-stale { background: var(--warn-soft); color: var(--warn); }
.elevations { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.elevation { margin: 0; }
.elevation svg { border: 1px solid var(--border); border-radius: 8px; display: block; }
.elevation figcaption { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; text-align: center; }
.plan-underlay { margin-top: 8px; border-top: 1px solid var(--border-soft); padding: 10px 4px 6px; display: grid; gap: 6px; font-size: 12px; }
.plan-row { display: flex; gap: 6px; align-items: center; }
.validity-input { width: 74px; }
.quote-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.quote-company { text-align: end; font-size: 12px; color: var(--text-dim); max-width: 45%; }
.quote-parties { display: flex; justify-content: space-between; gap: 16px; margin-top: 8px; font-size: 13px; }
.rates-table { margin-bottom: 8px; }
@media print {
  .quote-top, .quote-parties { display: flex; }
  .quote-company { color: #44506a; }
}

/* --------------------------- dialogs (voice, confirm, modules) -------------- */
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* --------------------------- voice dictation (v5) ---------------------------- */
.voice-overlay { position: fixed; inset: 0; background: var(--overlay); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 300; animation: overlay-in 0.18s ease; }
.voice-overlay[hidden] { display: none; }
.voice-panel { width: min(560px, 92vw); max-height: 86vh; overflow: auto; padding: 20px 22px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: dialog-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.voice-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.voice-head h3 { margin: 0; }
.voice-head .voice-lang { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.voice-head .voice-lang span { color: var(--text-dim); font-size: 12px; }
.voice-center { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 0; text-align: center; }
.voice-rec-btn { width: 68px; height: 68px; border-radius: 50%; font-size: 24px; display: inline-flex; align-items: center; justify-content: center; }
.voice-rec-btn .ico { width: 26px; height: 26px; }
.voice-rec-btn.recording { animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 95, 107, 0); }
  50% { box-shadow: 0 0 0 14px rgba(255, 95, 107, 0.18); }
}
.voice-elapsed { font-variant-numeric: tabular-nums; color: var(--text-dim); }
.voice-level { width: 220px; height: 8px; background: var(--card-2); border: 1px solid var(--border-soft); border-radius: 999px; overflow: hidden; }
.voice-level-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 60%, var(--warn))); transition: width 80ms linear; }
.voice-text { width: 100%; resize: vertical; }
.voice-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.voice-actions .spacer { flex: 1; }
.voice-warn { color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--radius-sm); padding: 9px 11px; }
.voice-error { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: var(--radius-sm); padding: 9px 11px; }
.voice-cmd-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.voice-cmd { display: flex; gap: 10px; align-items: flex-start; background: var(--card-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; transition: border-color 0.15s; }
.voice-cmd:hover { border-color: var(--border-strong); }
.voice-cmd input { margin-top: 3px; }

/* themed confirm dialog (replaces window.confirm) */
.confirm-overlay { position: fixed; inset: 0; background: var(--overlay); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 400; animation: overlay-in 0.18s ease; }
.confirm-panel { width: min(420px, 92vw); padding: 20px 22px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: dialog-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.confirm-msg { margin: 0 0 8px; white-space: pre-wrap; }

/* module activation panel (Phase 0) */
.modules-overlay { position: fixed; inset: 0; background: var(--overlay); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 350; animation: overlay-in 0.18s ease; }
.modules-overlay[hidden] { display: none; }
.modules-panel { width: min(660px, 94vw); max-height: 88vh; overflow: auto; padding: 22px 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: dialog-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.modules-panel h3 { margin-top: 0; }
.modules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 14px 0; }
.module-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); cursor: pointer; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.module-card:hover { border-color: var(--border-strong); }
.module-card.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.module-card.disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.module-card input { position: absolute; opacity: 0; pointer-events: none; }
.module-name { font-weight: 650; }
.module-desc { font-size: 12px; color: var(--text-dim); }
.module-expert { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-weight: 600; cursor: pointer; }
.module-expert.active { color: var(--accent-text); }
.modules-nl { display: flex; gap: 8px; }
.modules-nl .input { flex: 1; }
.modules-hint { margin: 8px 0 0; }
.modules-current { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modules-current + .modules-current { margin-top: 10px; }
/* trades panel (2026-10-31): the module cards with a trade icon */
.modules-panel.trades-panel { width: min(900px, 94vw); }
.trades-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.trade-card .module-name { display: inline-flex; align-items: center; gap: 8px; }
.trade-ico { display: inline-flex; width: 20px; height: 20px; color: var(--accent); }
.trade-ico svg { width: 100%; height: 100%; }
/* header trade chip: [⛑ trades | ⏷ filtered / 👁 everything] */
.trade-chip { display: inline-flex; align-items: stretch; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.trade-chip[hidden] { display: none; }
.trade-chip button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 5px 10px; }
.trade-chip button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.trade-chip svg { width: 15px; height: 15px; flex-shrink: 0; }
.trade-chip-main span { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.trade-chip-toggle { border-inline-start: 1px solid color-mix(in srgb, var(--accent) 30%, transparent) !important; }
.trade-chip[data-filter="off"] { background: var(--warn-soft); color: var(--text); }
.module-badge[data-active="1"] { background: var(--accent-soft); color: var(--accent-text); }

/* chat assistant — non-modal right drawer: the plan stays visible and
   interactive while the user describes it (no backdrop, clicks pass through) */
.chat-overlay { position: fixed; top: 56px; inset-inline-end: 0; bottom: 0; z-index: 300; pointer-events: none; }
.chat-overlay[hidden] { display: none; }
.chat-panel { pointer-events: auto; width: min(420px, 94vw); height: 100%; display: flex; flex-direction: column; padding: 16px 18px; border-radius: var(--radius-lg) 0 0 var(--radius-lg); border-inline-end: 0; box-shadow: -18px 0 40px rgba(0, 0, 0, 0.18); animation: drawer-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.chat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.chat-head h3 { margin: 0; }
.chat-head .spacer { flex: 1; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px; }
.chat-hint { margin: 6px 2px; line-height: 1.55; }
.chat-msg { max-width: 85%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.5; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-end-end-radius: 4px; box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.chat-msg.bot { align-self: flex-start; background: var(--card-2); border: 1px solid var(--border-soft); border-end-start-radius: 4px; }
.chat-msg.chat-msg-wide { max-width: 100%; width: 100%; }
.chat-msg-error { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.chat-msg .spinner { display: inline-block; vertical-align: -2px; }
.chat-proposal .voice-cmd-list { max-height: 220px; }
.chat-cmd-done { cursor: default; }
/* 2026-11-15 (audit 09 AI-05/06/08/11/12/26): review notes under a proposal line */
.voice-notes { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; font-size: 0.85em; }
.voice-note { color: var(--text-dim); }
.voice-note-warn { color: var(--warn); }
.voice-note-err { color: var(--danger); }
.voice-cmd-bad { opacity: 0.75; }
.voice-cmd-dropped { opacity: 0.55; cursor: default; font-style: italic; }
.voice-mat-pick { max-width: 100%; padding: 2px 6px; font-size: 0.95em; }
.voice-notices { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.voice-notice { margin: 0; }
.chat-composer { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); align-items: flex-end; }
.chat-composer textarea { flex: 1; resize: none; }
.chat-mode { display: flex; flex-direction: column; gap: 4px; }
.chat-mode-btn { opacity: 0.65; }
.chat-mode-btn.active { opacity: 1; border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); background: var(--accent-soft); }
.rate-pick { max-width: 150px; }
/* the AI entry point gets a soft accent → violet tint so it reads as special */
.chat-open-btn {
  margin-inline-start: 4px;
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--cat-design) 14%, transparent));
}
.chat-open-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--cat-design) 22%, transparent));
}
.badge-no-url { background: var(--warn-soft); color: var(--warn); margin-inline-start: 6px; }
.missing-url-card { margin-bottom: 14px; border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 5%, var(--card)); }
.missing-url-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.missing-url-name { min-width: 160px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- responsive */
/* header: shed width in steps (narrower project fields, icon-only assistant
   with a visually-hidden label, mark-only brand) before it has to wrap */
@media (max-width: 1500px) {
  #project-select { max-width: 150px; }
  #project-name { width: 130px; }
  .nav-tab { padding: 5px 11px; }
}
@media (max-width: 1460px) {
  .brand-name { display: none; }
  .chat-open-btn { padding-inline-start: 8px; padding-inline-end: 8px; }
  .chat-open-btn > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
}
@media (max-width: 1320px) {
  #app-header { gap: 8px; }
  #project-select { max-width: 130px; }
  #project-name { width: 110px; }
  .nav-tab { padding: 5px 9px; }
}
/* one breakpoint: stack the two-column editing layouts under ~1150 px */
@media (max-width: 1150px) {
  .catalog-layout.editing { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .totals-col { position: static; }
  .brand-name { display: none; }
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- splash */
/* AIBuild startup splash choreography: the rounded brand mark (gradient
   squircle tile + roofline "A") springs in with an overshoot ease, a thin
   RAINBOW ring (the original arc's palette, --rb1..--rb6) draws around it
   and a sheen sweeps the tile; the wordmark letters BUILD UP one after
   another — each a rainbow band with a window-grid texture, revealed from
   the ground up like a building under construction — above a rounded rainbow
   foundation growing from the center, and the English-only tagline fades up.
   The stage then exits upward and the menu rises (revealMenu timer mirrors
   these timings). All colors come from the app tokens — both themes share
   this one ruleset. A faint blueprint grid sits behind everything. */
.splash-overlay {
  position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(130% 100% at 50% 0%, var(--bg-elev) 0%, var(--bg) 75%);
  color: var(--text); transition: opacity 0.45s ease; outline: none;
}
.splash-overlay::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; /* grid above the video */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, #000 0%, transparent 78%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, #000 0%, transparent 78%);
}
.splash-overlay.closing { opacity: 0; pointer-events: none; }
/* the website's blurred background video (2026-10-18): bleeds past the edges so
   the blur never shows a border, fades in once playing; the veil keeps the
   stage and menu readable and ends on the theme background */
.splash-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.splash-bg video {
  position: absolute; inset: -24px; width: calc(100% + 48px); height: calc(100% + 48px);
  object-fit: cover; filter: blur(10px) saturate(1.15) brightness(0.62); transform: scale(1.03);
  opacity: 0; transition: opacity 0.9s ease;
}
.splash-bg.playing video { opacity: 1; }
.splash-bg::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, transparent 0%, rgba(11, 13, 18, 0.55) 70%),
    linear-gradient(180deg, rgba(11, 13, 18, 0.35) 0%, rgba(11, 13, 18, 0.75) 60%, var(--bg) 100%);
}
:root[data-theme="light"] .splash-bg video { filter: blur(10px) saturate(1.05) brightness(1.2); }
:root[data-theme="light"] .splash-bg::after {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, transparent 0%, rgba(243, 245, 248, 0.5) 70%),
    linear-gradient(180deg, rgba(243, 245, 248, 0.3) 0%, rgba(243, 245, 248, 0.72) 60%, var(--bg) 100%);
}
.splash-overlay.busy .splash-menu { pointer-events: none; opacity: 0.55; }

/* the stage (mark + wordmark + tagline) enters, holds, then exits upward —
   the menu opens only once the stage is gone. The logo block is English-only,
   so it stays left-to-right under the Arabic RTL layout (else the flex row of
   letters reads "dliuBIA" and the tagline's period jumps to the front). */
.splash-stage {
  position: absolute; left: 50%; top: 45%; z-index: 1;
  direction: ltr;
  display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: splash-stage-journey 2.95s cubic-bezier(0.25, 0.6, 0.3, 1) 0.05s forwards;
}
/* soft ambient glow behind the mark */
.splash-stage::before {
  content: ''; position: absolute; left: 50%; top: 24%; z-index: -1;
  width: 420px; height: 420px; transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 65%);
  pointer-events: none;
}
@keyframes splash-stage-journey {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + 22px)) scale(0.94); filter: blur(10px); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 12px)) scale(0.975); filter: blur(6px); }
}
.splash-overlay.skipped .splash-stage { display: none; } /* skip: menu only */

/* brand mark: rounded gradient tile + roofline "A", ring + sheen */
.splash-mark {
  position: relative; width: clamp(88px, 13vw, 116px); aspect-ratio: 1;
  opacity: 0; transform: scale(0.6);
  animation: splash-mark-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}
@keyframes splash-mark-in { to { opacity: 1; transform: scale(1); } }
.splash-mark-svg {
  display: block; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 10px 26px color-mix(in srgb, var(--brand-2) 38%, transparent));
}
#splash-mark-grad .g1 { stop-color: var(--brand-1); }
#splash-mark-grad .g2 { stop-color: var(--brand-2); }
#splash-ring-grad .rb1 { stop-color: var(--rb1); }
#splash-ring-grad .rb2 { stop-color: var(--rb2); }
#splash-ring-grad .rb3 { stop-color: var(--rb3); }
#splash-ring-grad .rb4 { stop-color: var(--rb4); }
#splash-ring-grad .rb5 { stop-color: var(--rb5); }
#splash-ring-grad .rb6 { stop-color: var(--rb6); }
/* the rainbow ring = the original arc, modernized into a clean draw-on */
.splash-ring {
  fill: none; stroke-width: 2; opacity: 0.85;
  stroke-dasharray: 283; stroke-dashoffset: 283;
  animation: splash-ring 1.1s cubic-bezier(0.4, 0, 0.2, 1) 0.35s forwards;
}
@keyframes splash-ring { to { stroke-dashoffset: 0; } }
.splash-mark-glyph {
  fill: none; stroke: url(#splash-glyph-grad); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 72; stroke-dashoffset: 72;
  animation: splash-glyph 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}
@keyframes splash-glyph { to { stroke-dashoffset: 0; } }
/* sheen: a light band sweeping across the tile once it has landed */
.splash-mark-sheen {
  position: absolute; inset: 9.5%; border-radius: 31%; overflow: hidden; pointer-events: none;
}
.splash-mark-sheen::after {
  content: ''; position: absolute; top: -25%; bottom: -25%; left: 0; width: 48%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-170%) skewX(-16deg);
  animation: splash-sheen 0.9s cubic-bezier(0.4, 0, 0.2, 1) 0.85s forwards;
}
@keyframes splash-sheen { to { transform: translateX(330%) skewX(-16deg); } }

/* wordmark: each letter is a rainbow band with a window-grid texture (the
   original "buildings" look), BUILDING UP from the ground one after another —
   clip-path reveals bottom-first, staggered via --i */
.splash-titlewrap { margin-top: 30px; display: flex; flex-direction: column; align-items: center; }
.splash-title { display: flex; gap: 0.02em; font-weight: 800; letter-spacing: 0.01em;
  font-size: clamp(46px, 8vw, 84px); line-height: 1; font-family: inherit; }
.splash-letter {
  --lc: var(--rb1);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0 2px, transparent 2px 13px),
    linear-gradient(180deg,
      color-mix(in srgb, var(--lc) 100%, #ffffff 22%) 0%,
      var(--lc) 55%,
      color-mix(in srgb, var(--lc) 78%, #000000) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  clip-path: inset(100% 0 0 0);
  transform: translateY(0.12em);
  animation: splash-letter-build 0.65s cubic-bezier(0.3, 0.7, 0.25, 1) forwards;
  animation-delay: calc(0.45s + var(--i) * 95ms);
}
.splash-letter:nth-child(1) { --lc: var(--rb1); }
.splash-letter:nth-child(2) { --lc: var(--rb2); }
.splash-letter:nth-child(3) { --lc: var(--rb3); }
.splash-letter:nth-child(4) { --lc: var(--rb4); }
.splash-letter:nth-child(5) { --lc: var(--rb5); }
.splash-letter:nth-child(6) { --lc: var(--rb6); }
.splash-letter:nth-child(7) { --lc: var(--rb1); } /* 7 letters, 6 bands: wrap */
@keyframes splash-letter-build {
  0% { clip-path: inset(100% 0 0 0); transform: translateY(0.12em); }
  70% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 0 0); transform: translateY(0); }
}

/* rounded rainbow foundation growing from the center once the word is set */
.splash-foundation {
  margin-top: 16px; height: 4px; width: 72%; border-radius: 999px;
  background: linear-gradient(90deg,
    var(--rb1), var(--rb2), var(--rb3), var(--rb4), var(--rb5), var(--rb6));
  transform: scaleX(0); transform-origin: center;
  animation: splash-foundation 0.6s cubic-bezier(0.22, 0.9, 0.32, 1) 1.2s forwards;
}
@keyframes splash-foundation { to { transform: scaleX(1); } }

.splash-tagline {
  margin-top: 16px; font-size: 15px; color: var(--text-dim); letter-spacing: 0.05em;
  opacity: 0; transform: translateY(8px);
  animation: splash-tagline 0.6s ease 1.25s forwards;
}
@keyframes splash-tagline { to { opacity: 1; transform: none; } }

/* main menu — rises softly once the stage has exited */
.splash-menu {
  position: relative; z-index: 1;
  width: min(92vw, 940px); margin-top: 34px; box-sizing: border-box;
  max-height: calc(100vh - 48px); overflow-y: auto; /* the 14-trade picker can outgrow a small window */
  padding: 6px 12px 14px; /* room for the cards' hover lift + shadow inside the scroller */
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 0.9, 0.32, 1);
}
.splash-menu.show { opacity: 1; transform: none; pointer-events: auto; }
.splash-heading {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin: 24px 0 12px;
}
.splash-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; } /* 5 new-project presets (2026-11-15 + parcel) */
.splash-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 18px; border-radius: var(--radius-lg); cursor: pointer; text-align: start;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: inherit; font: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.splash-card:hover, .splash-card:focus-visible, .splash-card[aria-expanded="true"] {
  transform: translateY(-3px); border-color: var(--accent); outline: none;
  box-shadow: var(--shadow), 0 14px 34px -14px color-mix(in srgb, var(--accent) 55%, transparent);
}
.splash-card-icon {
  display: inline-flex; width: 42px; height: 42px; padding: 10px; margin-bottom: 6px;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  transition: background 0.18s ease, color 0.18s ease;
}
.splash-card:hover .splash-card-icon, .splash-card:focus-visible .splash-card-icon {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff;
}
.splash-card-icon svg { width: 100%; height: 100%; }
.splash-card-name { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.splash-card-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.splash-cont-list { max-height: 26vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.splash-cont-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius); cursor: pointer;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  color: inherit; font: inherit; font-weight: 550; text-align: start;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.splash-cont-row:hover, .splash-cont-row:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.splash-cont-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.splash-cont-date { color: var(--text-dim); font-size: 12px; font-weight: 500; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.splash-empty { margin: 4px 0; }
/* "Par métier" picker (2026-10-31): unfolds under the cards, multi-select chips */
.splash-trades {
  margin-top: 14px; padding: 16px 18px; border-radius: var(--radius-lg);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px; animation: dialog-in 0.22s ease;
}
.splash-trades[hidden] { display: none; }
.splash-trades-hint { margin: 0; font-size: 12.5px; color: var(--text-dim); }
.splash-trade-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.splash-trade {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--radius);
  background: var(--bg-elev, var(--card)); border: 1px solid var(--border); color: inherit; font: inherit;
  font-weight: 600; font-size: 13.5px; cursor: pointer; text-align: start;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.splash-trade:hover, .splash-trade:focus-visible { border-color: var(--accent); outline: none; }
.splash-trade[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.splash-trade-icon { display: inline-flex; width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.splash-trade-icon svg { width: 100%; height: 100%; }
.splash-trade-go { align-self: flex-end; }
/* trade bundles (splash picker + trades panel): one click = exactly those trades */
.trade-bundles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 4px; }
.trade-bundles-label { font-size: 12px; font-weight: 650; color: var(--text-dim); margin-inline-end: 2px; }
.trade-bundle {
  border: 1px dashed var(--border-strong); background: transparent; color: inherit; font: inherit; font-size: 12.5px;
  font-weight: 600; padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.trade-bundle:hover, .trade-bundle:focus-visible { border-color: var(--accent); outline: none; }
.trade-bundle[aria-pressed="true"] { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
@media (max-width: 860px) { .splash-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .splash-cards, .splash-trade-list { grid-template-columns: 1fr; } }

/* ============================================================ categories */
/* Collapsible category sections (.cat): the editor panel's top-level        */
/* organization. Hue per category via data-cat (tokens at the top) — carried */
/* by the icon tile and count pill rather than a heavy colored header.       */

details.cat {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
details.cat[hidden] { display: none; }
/* module / trade scope (state.applyModuleScope): a hidden tagged block or nav
   chip really hides, whatever display its own class sets (grid, flex…) */
[data-module][hidden], [data-feature][hidden], .catnav-btn[hidden] { display: none !important; }
.scope-contents { display: contents; } /* a scoped group inside a grid / cell keeps its children in the flow */
.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.cat-head:hover { background: var(--card-2); }
.cat-head::-webkit-details-marker { display: none; }
.cat-head::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-inline-start: auto;
  background: var(--text-dim);
  -webkit-mask: var(--ico-chevron) center / contain no-repeat;
  mask: var(--ico-chevron) center / contain no-repeat;
  transition: transform 0.18s ease;
}
details.cat[open] > .cat-head::after { transform: rotate(90deg); }
details.cat[open] > .cat-head {
  border-bottom: 1px solid var(--border-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.cat-icon {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--cat-soft, var(--accent-soft));
  color: var(--cat-hue, var(--accent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-hue, var(--accent)) 18%, transparent);
}
.cat-icon .ico { width: 16px; height: 16px; }
.cat-title { font-size: 13.5px; font-weight: 650; letter-spacing: -0.005em; }
.cat-count {
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--cat-soft, var(--accent-soft));
  color: var(--cat-hue, var(--accent));
  font-variant-numeric: tabular-nums;
}
.cat-body { padding: 12px 12px 14px; }
.cat-body > details[data-v5-card] { margin-top: 8px; }
/* avoid a double rule under the category header */
.cat-body > details[data-v5-card]:first-of-type > summary.section-title {
  margin-top: 4px;
  padding-top: 0;
  border-top: none;
}

/* per-category hues (shared with the mini-nav chips) */
.cat[data-cat="room"], .catnav-btn[data-cat="room"] { --cat-hue: var(--cat-room); --cat-soft: var(--cat-room-soft); }
.cat[data-cat="envelope"], .catnav-btn[data-cat="envelope"] { --cat-hue: var(--cat-envelope); --cat-soft: var(--cat-envelope-soft); }
.cat[data-cat="surfaces"], .catnav-btn[data-cat="surfaces"] { --cat-hue: var(--cat-surfaces); --cat-soft: var(--cat-surfaces-soft); }
.cat[data-cat="building"], .catnav-btn[data-cat="building"] { --cat-hue: var(--cat-building); --cat-soft: var(--cat-building-soft); }
.cat[data-cat="systems"], .catnav-btn[data-cat="systems"] { --cat-hue: var(--cat-systems); --cat-soft: var(--cat-systems-soft); }
.cat[data-cat="design"], .catnav-btn[data-cat="design"] { --cat-hue: var(--cat-design); --cat-soft: var(--cat-design-soft); }

/* sticky category mini-nav at the top of the editor panel (frosted) */
.panel-catnav {
  position: sticky;
  top: -14px; /* cancels the panel's 14px padding so it sticks flush */
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -14px -14px 12px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--panel-bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.catnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font: 600 11px/16px var(--font);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.catnav-btn:hover { border-color: color-mix(in srgb, var(--cat-hue, var(--accent)) 50%, transparent); background: var(--cat-soft, var(--accent-soft)); color: var(--text); }
.catnav-ico { display: inline-flex; color: var(--cat-hue, var(--accent)); }
.catnav-ico .ico { width: 13px; height: 13px; }
.catnav-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat-hue, var(--accent)); }

/* labeled sidebar sections */
.side-sec { padding: 10px 10px 2px; border-top: 1px solid var(--border-soft); }
.side-sec-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 4px 4px 8px;
}
.side-rooms { flex: 1 1 0; min-height: 230px; display: flex; flex-direction: column; }
.side-rooms-add {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border-soft);
}
.voice-dictate-btn {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: none;
}
.voice-dictate-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: transparent; }

/* foldable surface cards */
.surface-head { justify-content: flex-start; }
.surface-head .surface-area { margin-inline-start: auto; }
.surface-card.folded .sub-block { display: none; }
.surface-fold { min-width: 26px; padding: 2px 6px; font-size: 11px; color: var(--text-dim); }

/* form-group titles (catalog editor, summary totals card) */
.fgroup {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
  margin-top: 2px;
}
.fgroup:first-child, .fgroup-first { border-top: none; padding-top: 0; }

/* settings groups */
.sgroup { margin-bottom: 24px; }
.sgroup-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 10px 2px;
}
.sgroup .settings-card:last-child { margin-bottom: 0; }

/* summary view: Devis + Exports bar above the two columns */
.quote-bar { display: grid; grid-template-columns: 1fr auto; gap: 14px; margin-bottom: 16px; }
.quote-bar .card { box-shadow: var(--shadow-xs); }
.quote-meta h4, .export-card h4 { margin: 0 0 12px; }
.quote-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px 12px; }
.export-card { min-width: 320px; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.export-card .export-doc { margin-bottom: 10px; }
/* EST-05: Print prints the selected quote document from a print-only container */
#quote-print { display: none; }
@media print {
  body.print-quote #summary-root > :not(#quote-print) { display: none !important; }
  body.print-quote #quote-print { display: block !important; }
}
.rooms-col-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
@media (max-width: 1100px) {
  .quote-bar { grid-template-columns: 1fr; }
  .quote-meta-grid { grid-template-columns: 1fr 1fr; }
}

/* catalog page: Ajouter / Matériaux categories + grouped table */
.cat[data-cat="add"] { --cat-hue: var(--cat-add); --cat-soft: var(--cat-add-soft); }
.cat[data-cat="list"] { --cat-hue: var(--cat-list); --cat-soft: var(--cat-list-soft); }

.list-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.list-toolbar .list-filter { flex: 1; min-width: 160px; }
.list-toolbar select.input { max-width: 220px; }

/* category group header rows inside the materials table */
.mgroup-row td {
  cursor: pointer;
  user-select: none;
  padding-top: 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.mgroup-row:hover td { color: var(--accent-text); }
.mgroup-row .muted { font-weight: 500; margin-inline-start: 6px; }
.mgroup-chev { display: inline-block; width: 14px; color: var(--text-dim); }

/* sub-blocks inside the Ajouter category */
.cat-body .missing-url-card { margin: 12px 0 0; }

/* --- fix-B (2026-10-04): state/data-safety fixes ------------------------- */

/* chat.js one-shot proposal Undo: the help bubble sits on the wrapper — a
   disabled <button> receives no hover events, so let them fall through to it */
.chat-undo-wrap { display: inline-flex; }
.chat-undo-wrap .btn:disabled { pointer-events: none; }

/* rooms.js plan underlay: translated "Choose an image…" button replacing the
   OS-language <input type=file> (the input itself is [hidden]); keep the
   button at its natural width inside the .plan-underlay grid */
.plan-underlay [data-action="pick-plan-file"] { justify-self: start; }

/* texture unit picker (catalog): crop one motif + layout + live preview */
.texunit { margin-top: 10px; padding: 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); }
.texunit-head { margin-bottom: 8px; font-size: 12.5px; }
.texunit-body { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.texunit-stage { position: relative; flex: 1 1 260px; max-width: 420px; cursor: crosshair; user-select: none; touch-action: none; direction: ltr; }
.texunit-stage img { display: block; width: 100%; height: auto; border-radius: 6px; pointer-events: none; }
.texunit-crop { position: absolute; border: 2px solid var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); border-radius: 2px; cursor: move; }
.texunit-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: var(--primary); border-radius: 3px; cursor: nwse-resize; }
.texunit-stage { overflow: hidden; }
.texunit-side { display: flex; flex-direction: column; gap: 8px; flex: 0 1 240px; }
.texunit-preview { width: 240px; height: 160px; border-radius: 6px; border: 1px solid var(--border-soft); background: var(--card-2); }

/* a cutout picked in the 3D view (rooms panel → Enveloppe → Découpes) */
.openings-table tr.cutout-selected td { background: color-mix(in srgb, var(--primary) 14%, transparent); }
/* stairs v2 (2026-11-11): labelled stair fields, readout, 3D-selected block */
.stair-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px 8px; margin-bottom: 6px; }
.stair-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stair-field > span { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stair-field .input { width: 100%; min-width: 0; }
.stair-readout { font-size: 12px; line-height: 1.5; margin: 2px 0 6px; }
.stair-readout .stair-warn { color: #c56a00; font-weight: 600; }
.stair-readout .stair-ok { color: var(--success, #2f9e57); font-weight: 600; }
.stair-readout .stair-hint { color: var(--text-dim); font-style: italic; }
.stair-actions { flex-wrap: wrap; }
.zone.stair-selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }

/* ---------------------------------------------------------------- right-to-left (Arabic, 2026-10-18)
   Margins/paddings/borders/insets/text-align above are logical properties
   and mirror on their own; these are the physical leftovers. */
[dir="rtl"] select.input { background-position: left 9px center; }
[dir="rtl"] .lang-select { background-position: left 8px center, 0 0; }
[dir="rtl"] .table select.input,
[dir="rtl"] .pick-filters select.input,
[dir="rtl"] .project-field select.input { background-position: left 6px center; }
[dir="rtl"] .chat-panel {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: 18px 0 40px rgba(0, 0, 0, 0.18);
  animation-name: drawer-in-rtl;
}
@keyframes drawer-in-rtl { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
/* Arabic-capable faces first (Segoe UI on Windows, Noto on Linux) */
[dir="rtl"] { --font: "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic UI", Tahoma, system-ui, sans-serif; }
/* numbers, dimensions, prices and IDs stay left-to-right inside Arabic text */
[dir="rtl"] input[type="number"], [dir="rtl"] input[type="url"] { direction: ltr; text-align: right; }


/* v28 phase C: roof structure section (Bâtiment card) */
.roof-structure { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.roof-structure .section-subtitle { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.structure-table td, .structure-table th { white-space: nowrap; }
.structure-table select.input { min-width: 150px; }
.structure-ok { color: var(--success, #2f9e5b); font-weight: 600; }
.structure-fail { color: var(--danger, #d23c3c); font-weight: 700; }
.structure-row-fail td { background: color-mix(in srgb, var(--danger, #d23c3c) 10%, transparent); }
.structure-warnings { margin: 4px 0 0; padding-inline-start: 18px; font-size: 12px; }

/* prerequisites (2026-10-28): the control "Y aller" lands on pulses; inline
   card warning with its own "Y aller" link */
.prereq-pulse { animation: prereq-pulse 1.6s ease-out 2; border-radius: 8px; }
@keyframes prereq-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 70%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}
.prereq-warn {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0 2px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
}
.prereq-warn span { flex: 1; }
.prereq-warn button {
  flex: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.chat-msg-prereq { border-inline-start: 3px solid var(--warn); background: var(--warn-soft); }
.chat-msg-prereq .btn { margin-top: 6px; display: block; }

/* 2026-10-30: 3D alignment tip next to the pointer while a room moves */
.align-tip { position: absolute; z-index: 5; pointer-events: none; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #fff; background: var(--align); white-space: nowrap; }
.align-tip.align-tip-plain { background: var(--accent); }
/* stairs v2: the live stair tip turns amber when a comfort rule is broken */
.align-tip.stair-tip-warn { background: #c56a00; }

/* v34 fences: 3D draw-mode banner, panel card, 2D plan */
.fence-draw-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none;
  max-width: calc(100% - 32px); padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; line-height: 1.35;
  color: #fff; background: color-mix(in srgb, #f08a00 88%, #000); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); text-align: center;
}
.fence-hint { font-size: 12px; margin: 2px 0 6px; }
.fence-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.fence-zone .fence-mats { margin-top: 2px; }
.fence-gates-title { font-size: 11px; color: var(--text-dim); margin: 4px 0 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.fence-gate { border-top: 1px dashed var(--border-soft, rgba(127, 127, 127, 0.25)); padding-top: 6px; margin-top: 4px; }
/* fences pass 2: ground level of every corner (sloped ground) */
.fence-ground { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0 2px; }
.fence-ground-title { width: 100%; font-size: 0.85em; opacity: 0.8; }
.fence-ground-pt { display: inline-flex; align-items: center; gap: 3px; }
.fence-ground-pt > span { font-size: 0.8em; opacity: 0.7; min-width: 1.2em; text-align: right; }
.fence-ground-pt .input.num { width: 5.6em; }
.fence-gate-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; justify-content: flex-end; margin-bottom: 4px; }
.fence-gate-acts .stair-warn { color: #c56a00; font-weight: 600; font-size: 12px; margin-right: auto; }
.plan2d-fence { cursor: pointer; }
.plan2d-fence-gy { font-size: 0.17px; fill: #0e8c99; font-weight: 600; pointer-events: none; }
.plan2d-fence.selected { cursor: move; }
.plan2d-fence-hit { stroke: transparent; stroke-width: 0.35; fill: none; }
.plan2d-fence-line { stroke: var(--text-dim); stroke-linecap: butt; fill: none; }
.plan2d-fence.t-masonry .plan2d-fence-line, .plan2d-fence.t-lowwall .plan2d-fence-line { stroke: #b5a98f; }
.plan2d-fence.t-wood .plan2d-fence-line, .plan2d-fence.t-composite .plan2d-fence-line { stroke: #9c6b3f; }
.plan2d-fence.t-gabion .plan2d-fence-line { stroke: #8f8a80; }
.plan2d-fence.selected .plan2d-fence-line { stroke: var(--primary); }
.plan2d-fence-post { fill: var(--text); pointer-events: none; }
.plan2d-fence-found { stroke: #9aa0a6; stroke-opacity: 0.45; stroke-linecap: butt; fill: none; pointer-events: none; }
.plan2d-fence-plot { fill: #9aa0a6; fill-opacity: 0.45; pointer-events: none; }
.plan2d-gate-pillar { fill: var(--text); pointer-events: none; }
.plan2d-gate-leaf { stroke: #f08a00; stroke-width: 0.04; fill: none; pointer-events: none; }
.plan2d-gate-arc { stroke: #f08a00; stroke-width: 0.015; stroke-dasharray: 0.08 0.05; fill: none; pointer-events: none; }
.plan2d-gate-zone { stroke: var(--ok); stroke-width: 0.12; stroke-opacity: 0.5; pointer-events: none; }
.plan2d-gate-zone.bad { stroke: #e5484d; }
.plan2d-fence-len, .plan2d-fence-name { fill: var(--text-dim); font-size: 0.16px; text-anchor: middle; dominant-baseline: middle; pointer-events: none; user-select: none; }
.plan2d-fence-len { fill: var(--primary); font-weight: 600; }
.plan2d-fence-handle { fill: #2f6bff; stroke: #fff; stroke-width: 0.02; cursor: grab; }
.plan2d-fence-handle.gate { fill: #f08a00; }

/* 2026-11-14 Settings → Rendu 3D (render GPU) */
.render-gpu-now { margin-top: 8px; font-size: 12px; overflow-wrap: anywhere; }
.render-gpu-pending { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.render-gpu-warn { margin-top: 6px; color: var(--warn); }

/* v36 terrain in the 2D plan: contour lines, platforms, spot heights; 2026-11-14 measuring tool */
.plan2d-contour { fill: none; stroke: color-mix(in srgb, #a0703c 55%, transparent); stroke-width: 0.025; pointer-events: none; }
.plan2d-contour.major { stroke: color-mix(in srgb, #8a5a2b 80%, transparent); stroke-width: 0.05; }
.plan2d-contour-label, .plan2d-spot, .plan2d-pad-label { text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: var(--bg, #fff); pointer-events: none; }
.plan2d-contour-label { fill: #8a5a2b; font-weight: 600; }
.plan2d-spot { fill: var(--text-dim); }
.plan2d-pad { fill: color-mix(in srgb, #c9a46a 16%, transparent); stroke: #b07a2a; stroke-width: 0.06; stroke-dasharray: 0.25 0.12; pointer-events: none; }
.plan2d-pad.wall { stroke-dasharray: none; stroke: #6b7280; stroke-width: 0.1; }
.plan2d-pad-label { fill: #8a5a2b; font-weight: 600; }
.plan2d-poly.measure .plan2d-poly-line, .plan2d-poly.measure .plan2d-poly-live { stroke: #e0559b; }
.plan2d-poly.measure .plan2d-poly-pt { fill: #e0559b; }
.plan2d-poly.measure .plan2d-poly-fill { fill: color-mix(in srgb, #e0559b 12%, transparent); }
.plan2d-poly.pad .plan2d-poly-line, .plan2d-poly.pad .plan2d-poly-live { stroke: #b07a2a; }
/* 2026-11-14 measuring tool (3D): pink banner + segment labels over the canvas */
.fence-draw-hint.measure-hint { background: color-mix(in srgb, #e0559b 86%, #000); }
.measure-label {
  position: absolute; z-index: 5; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
  padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: #fff; background: rgba(200, 60, 130, 0.92); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.measure-label.live { background: rgba(200, 60, 130, 0.7); }
.measure-label.area { background: rgba(40, 44, 52, 0.88); }
/* v36 terrain block (Site card) */
.terrain-block { margin-top: 10px; }
.terrain-pad { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.terrain-pad .plan-row .input { flex: 1; min-width: 0; }
.terrain-meta { margin: 4px 0 0; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.terrain-actions { flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.terrain-ew { margin-top: 10px; font-size: 12px; }
.terrain-ew .input { width: 80px; }
.fence-quote { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); } /* 2026-11-15 fences in the quote */
/* 2026-11-15 "Convertir en bâtiment modifiable" dialog */
.convert-modal { width: min(1040px, 96vw); max-height: 92vh; overflow-y: auto; }
.convert-body { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(280px, 380px); gap: 16px; margin-top: 8px; }
@media (max-width: 860px) { .convert-body { grid-template-columns: 1fr; } }
.convert-step { padding: 8px 0; border-bottom: 1px solid var(--border-soft, var(--border)); }
.convert-step .form-grid { margin-top: 6px; }
.cv-hint { font-size: 11.5px; margin: 4px 0 0; }
.convert-preview { display: flex; flex-direction: column; gap: 8px; }
.convert-plan { width: 100%; height: 230px; background: var(--bg, #fff); border: 1px solid var(--border); border-radius: 8px; }
.convert-section { width: 100%; height: 170px; background: var(--bg, #fff); border: 1px solid var(--border); border-radius: 8px; }
.cv-outline { fill: color-mix(in srgb, var(--text) 10%, transparent); stroke: var(--text-dim); }
.cv-room { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); }
.convert-plan text { text-anchor: middle; dominant-baseline: middle; fill: var(--text); font-weight: 600; }
.cv-storey { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 1; }
.cv-roof { fill: color-mix(in srgb, #b0634c 35%, transparent); stroke: #b0634c; stroke-width: 1; }
.cv-ground { stroke: #8a5a2b; stroke-width: 2; }
.convert-section text { font-size: 10px; text-anchor: middle; fill: var(--text); }
.convert-section .cv-dim { text-anchor: start; fill: var(--text-dim); }
.convert-next { margin: 10px 0 4px 18px; display: grid; gap: 8px; font-size: 13px; line-height: 1.45; }
/* 2026-11-15 combles (rooms under the roof): cross-section in the attic card, 2D low headroom */
.attic-section { width: 100%; max-width: 360px; height: 150px; margin: 8px 0 4px; background: var(--bg, #fff); border: 1px solid var(--border); border-radius: 8px; }
.attic-section .as-room { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 1.5; }
.attic-section .as-low { fill: color-mix(in srgb, #d9822b 22%, transparent); }
.attic-section .as-180 { stroke: #d9822b; stroke-width: 1; stroke-dasharray: 4 3; }
.attic-section .as-floor { stroke: var(--text-dim); stroke-width: 1.5; }
.attic-section .as-lbl { font-size: 9px; fill: var(--text-dim); }
.attic-readout { font-size: 12px; font-variant-numeric: tabular-nums; }
.plan2d-lowroom { fill: url(#plan2d-low-hatch); stroke: none; pointer-events: none; }
/* 2026-11-15 (audit P2D-24): the < 1.80 m hatch — a light fill + diagonal strokes */
.plan2d-lowroom-bg { fill: color-mix(in srgb, #d9822b 12%, transparent); stroke: none; }
.plan2d-lowroom-hatch { stroke: color-mix(in srgb, #d9822b 60%, transparent); stroke-width: 0.025; }
/* 2026-11-15 (audit part 06): overlaps, partitions, labels overlay, roof windows, ghost storey, legend */
.plan2d-room.conflict .plan2d-floor { fill: color-mix(in srgb, var(--danger, #e5484d) 12%, var(--bg-elev)); stroke: var(--danger, #e5484d); stroke-width: 0.04; stroke-dasharray: 0.14 0.08; }
.plan2d-wall.plan2d-partition { cursor: default; }
.plan2d-labels text { pointer-events: none; user-select: none; paint-order: stroke; stroke: var(--bg, #fff); stroke-linejoin: round; }
.plan2d-labels .plan2d-name { stroke-opacity: 0.85; }
.plan2d-wallnum { fill: var(--accent-text, var(--accent)); font-weight: 700; text-anchor: middle; }
.plan2d-roofwin polygon { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: var(--accent); stroke-width: 0.03; pointer-events: none; }
.plan2d-roofwin path { fill: none; stroke: var(--accent); stroke-width: 0.015; stroke-dasharray: 0.06 0.04; pointer-events: none; }
.plan2d-roofwin.k-chimney polygon { fill: color-mix(in srgb, var(--text) 30%, transparent); stroke: var(--text-dim); }
.plan2d-ghost polygon { fill: none; stroke: color-mix(in srgb, var(--text) 30%, transparent); stroke-width: 0.03; stroke-dasharray: 0.12 0.08; pointer-events: none; }
.plan2d-room:focus { outline: none; }
.plan2d-room:focus-visible .plan2d-floor { stroke: var(--accent); stroke-width: 0.05; }
.plan2d-popup-warn { font-size: 12px; max-width: 260px; }
.plan2d-legend {
  position: absolute; inset-inline-start: 10px; bottom: 8px; z-index: 2;
  display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border-radius: 8px;
  font-size: 11px; color: var(--text-dim); background: color-mix(in srgb, var(--bg) 82%, transparent);
  max-width: 46%;
}
.plan2d-legend:empty { display: none; }
.plan2d-scale { display: flex; align-items: center; gap: 6px; direction: ltr; }
.plan2d-scale-bar { display: inline-block; height: 6px; border: 1.5px solid var(--text); border-top: 0; }
.plan2d-north { display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--text); }
.plan2d-north path { fill: var(--ok); }
.plan2d-leg-items { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.plan2d-leg-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.plan2d-leg-item .leg { stroke: none; }
.plan2d-leg-item .leg.t-porteur { fill: var(--text); }
.plan2d-leg-item .leg.t-mur { fill: color-mix(in srgb, var(--text) 70%, transparent); }
.plan2d-leg-item .leg.t-cloison { fill: color-mix(in srgb, var(--text) 45%, transparent); }
.plan2d-leg-item .plan2d-roofwin-leg { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: var(--accent); stroke-width: 0.03; }
.plan2d-leg-item .plan2d-conflict-leg { fill: color-mix(in srgb, var(--danger, #e5484d) 12%, transparent); stroke: var(--danger, #e5484d); stroke-width: 0.03; stroke-dasharray: 0.08 0.05; }

/* 2026-11-15 catalogue pricing fixes (audit 08): analysis review sheet, price info, paste box */
.review-panel { width: min(760px, 94vw); max-height: 88vh; display: flex; flex-direction: column; gap: 8px; }
.review-panel h3 { margin: 0; }
.review-summary { display: grid; gap: 4px; padding: 8px 10px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent, #4a7) 8%, var(--card)); font-variant-numeric: tabular-nums; }
.review-warnings { margin: 0; padding: 8px 10px 8px 28px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); }
.review-warnings li { margin: 2px 0; }
.review-scroll { overflow: auto; max-height: 40vh; }
.review-table td.review-old { color: var(--text-dim); text-decoration: line-through; }
.review-table td.review-new { font-weight: 600; }
.review-table tr.review-group td { padding-top: 10px; }
.price-info { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.price-info .price-warn { color: var(--warn); }
.paste-text { width: 100%; min-height: 140px; resize: vertical; font-size: 12px; }
.shared-used-card { margin: 0 0 12px; }
.usage-note { grid-column: 1 / -1; margin: 0; color: var(--warn); }
/* platform guards (2026-11-15, part 12): storage / damaged-catalogue banner, versions dialog */
.storage-banner { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 450; width: min(920px, 94vw); display: flex; flex-direction: column; gap: 6px; }
.storage-banner[hidden] { display: none; }
.storage-banner-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-lg, 12px); background: var(--warn-soft); border: 1px solid var(--warn); color: var(--text); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 13px; }
.storage-banner-msg { flex: 1; line-height: 1.4; }
.versions-panel { width: min(640px, 94vw); }
.versions-list { list-style: none; margin: 8px 0 12px; padding: 0; max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.versions-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; }


/* ---- AIBuild Free / Pro (2026-11-17, src/renderer/edition.js) ----------------------
   Free: the Pro controls are hidden (the features are not in the Free package) and the
   "AIBuild Pro" notes show instead. The selector list = edition.js proSelector() plus the
   merchant image grid; tests/edition.test.js checks the two stay in sync. */
html:not([data-edition="free"]) [data-free-only] {
  display: none !important;
}
html[data-edition="free"] [data-action="dictate"],
html[data-edition="free"] [data-action="llm-start"],
html[data-edition="free"] [data-action="llm-stop"],
html[data-edition="free"] [data-action="dl-runtime"],
html[data-edition="free"] [data-action="dl-model"],
html[data-edition="free"] [data-action="voice-dl-runtime"],
html[data-edition="free"] [data-action="voice-dl-model"],
html[data-edition="free"] [data-action="gen3d"],
html[data-edition="free"] [data-action="gen3d-gate"],
html[data-edition="free"] [data-action="gen3d-stair"],
html[data-edition="free"] [data-action="gen3d-sys"],
html[data-edition="free"] [data-action="gen3d-opening"],
html[data-edition="free"] [data-action="gen3d-trim"],
html[data-edition="free"] [data-action="gen3d-relaunch"],
html[data-edition="free"] [data-action="gen3d-cancel"],
html[data-edition="free"] [data-action="gen3d-dismiss"],
html[data-edition="free"] [data-action="walkthrough-video"],
html[data-edition="free"] [data-action="walkthrough-video-open"],
html[data-edition="free"] [data-action="geo-search"],
html[data-edition="free"] [data-action="cad-search-address"],
html[data-edition="free"] [data-action="cad-by-ref"],
html[data-edition="free"] [data-action="cad-near-site"],
html[data-edition="free"] [data-action="cad-neighbours"],
html[data-edition="free"] [data-action="terrain-fetch"],
html[data-edition="free"] [data-action="terrain-fine"],
html[data-edition="free"] [data-action="ex-search"],
html[data-edition="free"] [data-action="ex-generate"],
html[data-edition="free"] [data-action="analyze"],
html[data-edition="free"] [data-action="reanalyze-all"],
html[data-edition="free"] [data-action="refresh-images"],
html[data-edition="free"] [data-action="pick-texture"],
html[data-edition="free"] [data-action="sample-color"],
html[data-edition="free"] #llm-chip,
html[data-edition="free"] #chat-open,
html[data-edition="free"] [data-g="dictate"],
html[data-edition="free"] [data-pro],
html[data-edition="free"] .texture-grid {
  display: none !important;
}
.pro-card .pro-list {
  margin: 6px 0 8px 18px;
  padding: 0;
}
.pro-card .pro-list li {
  margin: 2px 0;
}
