/* FREE PLAN ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ local Plan Editor shell (MyRoomTool visual language) */

:root {
  --pe-ink: #223245;
  --pe-accent: #f93e22;
  --pe-bg: #fefdfa;
  --pe-surface: #ffffff;
  --pe-border: #e4e2dc;
  --pe-border-soft: #e2e2e2;
  --pe-muted: #5a6b7d;
  --pe-grid: #d9d4cb;
  --pe-radius: 16px;
  --pe-radius-pill: 30px;
  --pe-shadow: 0 2px 8px -1px rgba(34, 50, 69, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--pe-bg);
  color: var(--pe-ink);
  font-family: "Carlito", Calibri, "Segoe UI", sans-serif;
}

button {
  font-family: inherit;
}

.pe-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* ----- Header ----- */

.pe-header {
  padding: 8px 12px 6px;
  background: var(--pe-surface);
  border-bottom: 1px solid var(--pe-border);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

/*
 * Header: tools | canvas | actions.
 * Right column is max-content so action buttons are NOT tied to the
 * 260px Properties panel width (that forced a two-row wrap).
 * Center uses minmax(0,1fr) so the hint can shrink and wrap.
 */
.pe-header-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) max-content;
  gap: 12px 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.pe-header-tools-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  /* Align room title with pe-panel content (14px padding) */
  padding: 0 0 0 14px;
}

.pe-header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pe-header-nav .pe-btn {
  padding: 7px 12px;
  font-size: 12px;
}

.pe-header-nav .pe-lang {
  margin-left: 0;
}

/* Room type + optional guide fab (fab is fixed on desktop, in-row on mobile) */
.pe-room-type-row {
  display: block;
  min-width: 0;
  max-width: 100%;
}

/* Same typography as .pe-panel-title; clickable control to change room type in-page */
.pe-room-type.pe-panel-title {
  margin: 0;
  max-width: 100%;
  line-height: 1.2;
}

button.pe-room-type--btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(34, 50, 69, 0.18);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(34, 50, 69, 0.04);
}

button.pe-room-type--btn:hover {
  border-color: rgba(249, 62, 34, 0.45);
  color: var(--pe-accent, #f93e22);
}

button.pe-room-type--btn:focus-visible {
  outline: 2px solid var(--pe-accent, #f93e22);
  outline-offset: 2px;
}

button.pe-room-type--btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
  flex-shrink: 0;
  margin-left: 2px;
}

.pe-header-canvas-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  overflow: visible;
}

/*
 * Brand defines row height (logo top = action buttons top).
 * Hint sits to the right, vertically centered against the logo.
 */
.pe-header-canvas-top {
  --pe-brand-w: 168px;
  position: relative;
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

html[lang="en"] .pe-header-canvas-top {
  --pe-brand-w: 160px;
}

.pe-brand-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 3px;
  width: var(--pe-brand-w);
  position: relative;
  z-index: 1;
}

.pe-logo-link {
  display: block;
  width: var(--pe-brand-w);
  max-width: 100%;
  line-height: 0;
  text-decoration: none;
  color: inherit;
}

.pe-logo {
  width: var(--pe-brand-w);
  max-width: 100%;
  height: auto;
  display: block;
}

.pe-logo-link .pe-logo {
  width: 100%;
}

.pe-title {
  margin: 0;
  width: 100%;
  font-family: "Montserrat", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--pe-ink);
  line-height: 1.1;
  text-align: left;
}

.pe-title-mobile {
  display: none;
}

html[lang="en"] .pe-title {
  font-size: 16px;
  letter-spacing: 0.06em;
}

.pe-context-hint {
  --pe-hint-lh: 1.28;
  --pe-hint-fs: 13px;
  position: absolute;
  left: calc(var(--pe-brand-w) + 12px);
  right: 0;
  /* Vertical offset set in JS to center against the logo */
  top: 8px;
  bottom: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  box-sizing: border-box;
  overflow: visible;
  z-index: 2;
  /* Grid column-gap (20px) keeps space before ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ«ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¼ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂµÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ½ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¸ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ» */
}

.pe-context-hint-main,
.pe-context-hint-sub {
  margin: 0;
  font-family: "Carlito", Calibri, "Segoe UI", sans-serif;
  color: var(--pe-muted);
  line-height: var(--pe-hint-lh);
  white-space: normal;
  /* Break only between words ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ never mid-word */
  overflow-wrap: normal;
  word-wrap: normal;
  word-break: normal;
  hyphens: none;
  overflow: visible;
  max-height: none;
}

.pe-context-hint-main {
  font-size: var(--pe-hint-fs);
  color: var(--pe-muted);
  transition: color 0.55s ease;
}

/* One-shot attention flash on first load (not an error state). */
.pe-context-hint-main.is-intro-flash {
  color: #e07060;
}

@media (prefers-reduced-motion: reduce) {
  .pe-context-hint-main {
    transition: none;
  }
}

.pe-context-hint-sub {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.92;
}

.pe-context-hint[data-expandable="1"] {
  cursor: pointer;
}

/* Fixed popup so it can clamp to the viewport without growing the header */
.pe-context-hint-popup {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  width: min(420px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(50vh, 320px);
  margin: 0;
  padding: 10px 12px;
  background: var(--pe-surface);
  color: var(--pe-ink);
  border: 1px solid var(--pe-border);
  border-radius: 10px;
  box-shadow: var(--pe-shadow);
  font-family: "Carlito", Calibri, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 40;
  pointer-events: auto;
  box-sizing: border-box;
}

.pe-context-hint.is-open .pe-context-hint-popup {
  display: block;
}

/* Progress ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ full canvas width, just above the drawing grid */
.pe-canvas-shell > .pe-progress.progress-bar {
  margin: 0;
  width: 100%;
  height: 6px;
  background: #d9d9d9;
  border-radius: 0;
  overflow: hidden;
  flex: 0 0 auto;
}

/* plan3d: hide free-planner step chrome without leaving a gap */
[data-planner-progress][hidden] {
  display: none !important;
}

.pe-canvas-shell > .pe-progress .progress-fill {
  height: 100%;
  background: rgb(249, 62, 34);
  border-radius: 0 10px 10px 0;
}

.pe-header-actions {
  display: flex;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  align-self: start;
  padding: 0;
  min-width: 0;
}

.pe-header-actions .pe-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Done CTA: full label on desktop/tablet; short on phone */
.pe-btn-label--short {
  display: none;
}

@media (max-width: 560px) {
  .pe-btn-label--full {
    display: none;
  }

  .pe-btn-label--short {
    display: inline;
  }
}

.pe-eyebrow {
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pe-muted);
}

.pe-btn {
  appearance: none;
  border: none;
  border-radius: var(--pe-radius-pill);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.pe-btn:active:not(:disabled) {
  transform: scale(0.97);
  opacity: 0.85;
}

.pe-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pe-btn-primary {
  background: var(--pe-accent);
  color: #fff;
}

.pe-btn-secondary {
  background: var(--pe-ink);
  color: #fff;
}

.pe-btn-ghost {
  background: transparent;
  color: var(--pe-ink);
  border: 1px solid var(--pe-border-soft);
}

/* Sketch «Назад» is an <a.pe-btn>; kill UA underline without changing other chrome */
.pe-sketch-page a#btn-back.pe-btn,
.pe-sketch-page a#btn-back.pe-btn:link,
.pe-sketch-page a#btn-back.pe-btn:visited,
.pe-sketch-page a#btn-back.pe-btn:hover,
.pe-sketch-page a#btn-back.pe-btn:focus,
.pe-sketch-page a#btn-back.pe-btn:active {
  text-decoration: none;
}

/* Language switch ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ same visual as main site (.lang-switch / .lang-btn) */
.lang-switch,
.pe-lang.lang-switch {
  display: flex;
  background: #ffffff;
  border: 1px solid #e4e2dc;
  border-radius: 20px;
  padding: 3px;
  gap: 0;
  margin-left: 0;
}

.lang-btn,
.pe-lang-btn.lang-btn {
  appearance: none;
  min-width: 0;
  padding: 5px 12px;
  font-family: "Carlito", sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #223245;
  cursor: pointer;
  border: none;
  border-radius: 15px;
  background: transparent;
  transition: 0.2s;
}

.lang-btn.active,
.pe-lang-btn.lang-btn.active {
  background: rgb(249, 62, 34);
  border-color: transparent;
  color: #fff;
}

/* ----- Layout ----- */

.pe-body {
  flex: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.pe-panel {
  background: var(--pe-surface);
  border: 1px solid var(--pe-border);
  border-radius: var(--pe-radius);
  box-shadow: var(--pe-shadow);
  padding: 14px;
  min-height: 0;
  overflow: auto;
}

.pe-panel-title {
  margin: 0 0 12px;
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pe-ink);
}

/* Wall props: compact title → progress → length field */
.pe-panel-props .pe-panel-title {
  margin-bottom: 4px;
}

.pe-prop-block--wall {
  gap: 6px;
}

.pe-prop-block--wall .pe-prop-fields {
  gap: 6px;
}

.pe-prop-block--wall .pe-prop-field {
  gap: 2px;
}

.pe-wall-fill-progress {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #f93e22;
  line-height: 1.2;
}

.pe-opening-need-walls {
  text-transform: none;
  letter-spacing: 0.01em;
}

/* Staged handoff: object props → «set wall sizes» hint → wall props */
#properties-content.pe-props-gate-out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}

#properties-content.pe-props-gate-in {
  opacity: 0;
  transform: translateY(6px);
}

#properties-content.pe-props-gate-in.pe-props-gate-in-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pe-prop-block--wall-size-gate {
  min-height: 72px;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.pe-prop-block--wall-size-gate.pe-props-gate-hint-visible {
  opacity: 1;
  transform: none;
}

.pe-prop-block--wall-size-gate .pe-opening-need-walls {
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

@media (prefers-reduced-motion: reduce) {
  #properties-content.pe-props-gate-out,
  #properties-content.pe-props-gate-in,
  #properties-content.pe-props-gate-in.pe-props-gate-in-visible,
  .pe-prop-block--wall-size-gate,
  .pe-prop-block--wall-size-gate.pe-props-gate-hint-visible {
    transition: none;
    transform: none;
  }
}

.pe-input.pe-input--error {
  border-color: #f93e22;
  box-shadow: 0 0 0 2px rgba(249, 62, 34, 0.18);
}

.pe-tool-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pe-tool {
  width: 100%;
  text-align: left;
  border: 1px solid var(--pe-border-soft);
  background: #fff;
  color: var(--pe-ink);
  border-radius: 14px;
  padding: 12px 14px;
  /* Tool buttons only — Carlito regular; active uses 700 below */
  font-family: "Carlito", Calibri, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.pe-tool:hover:not(:disabled) {
  border-color: var(--pe-accent);
}

.pe-tool.active {
  border: 2px solid var(--pe-accent);
  font-weight: 700;
}

.pe-tool:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Mobile howto text link; desktop keeps the article card below */
.pe-tools-howto-link {
  display: none;
}

/* Sketch tools help Ã¢ÂÂ article 012 (desktop card / mobile text link) */
.pe-tools-guide {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--pe-border-soft);
  min-width: 0;
}

.pe-tools-guide__lead {
  margin: 0 0 6px;
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--pe-ink);
}

.pe-tools-guide__sub {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--pe-muted);
}

.pe-tools-guide-card {
  margin: 0;
  width: 100%;
  min-width: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--pe-shadow);
  background: var(--pe-surface);
}

.pe-tools-guide-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.pe-tools-guide-card__link:focus-visible {
  outline: 2px solid var(--pe-accent);
  outline-offset: 2px;
}

.pe-tools-guide-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: #e8e6e1;
}

.pe-tools-guide-card__cover {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pe-tools-guide-card__title {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  box-sizing: border-box;
  max-width: 85%;
  margin: 0;
  padding: 8px 10px;
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pe-ink);
  /* Match blog C1: color only, 200ms ease (blog --duration-normal / --ease-standard) */
  transition: color 200ms ease;
}

.pe-tools-guide-card--dark .pe-tools-guide-card__title {
  color: var(--pe-ink);
  text-shadow: none;
}

/* Match blog C1 title hover ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ accent (#F93E22 / --pe-accent).
   Restrict :hover to fine pointers so touch devices don't stick red. */
@media (hover: hover) and (pointer: fine) {
  .pe-tools-guide-card__link:hover .pe-tools-guide-card__title {
    color: var(--pe-accent);
  }
}

.pe-tools-guide-card__link:focus-visible .pe-tools-guide-card__title {
  color: var(--pe-accent);
}

.pe-tools-guide__mobile {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 2px 2px;
  color: var(--pe-ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  min-height: 44px;
}

.pe-tools-guide__mobile:hover,
.pe-tools-guide__mobile:focus-visible {
  color: var(--pe-accent);
}

.pe-tools-guide__mobile:focus-visible {
  outline: 2px solid var(--pe-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.pe-tools-guide__mobile-icon {
  flex: 0 0 auto;
  color: var(--pe-accent);
  font-weight: 700;
  line-height: 1.35;
}

.pe-tools-guide__mobile-text {
  flex: 1 1 auto;
  min-width: 0;
}

.pe-hint {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--pe-muted);
}

.pe-properties-empty {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--pe-muted);
}

/* ----- Canvas ----- */

.pe-canvas-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--pe-surface);
  border: 1px solid var(--pe-border);
  border-radius: var(--pe-radius);
  box-shadow: var(--pe-shadow);
  overflow: hidden;
}

/* Sketch field keeps 24:15; SVG grid draws the notebook cells */
.pe-canvas-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 24 / 15;
  flex: 0 0 auto;
  background-color: #fffcf8;
  /* No CSS cell pattern — uniform SVG lines only (avoids double / non-square grid) */
  background-image: none;
  /* Drawing/drag gestures stay on the canvas; page scroll still works outside */
  touch-action: none;
}

/* Mobile-only chrome label over the grid (not part of sketch / export) */
.pe-canvas-stage-label {
  display: none;
}

/* Inner frame: desktop fills the 24:15 stage; mobile may letterbox outside the SVG */
.pe-canvas-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

/* Faster taps on chrome controls; do not disable page zoom globally */
.pe-btn,
.pe-tool,
.pe-lang-btn,
.pe-input,
.scale-furniture-item {
  touch-action: manipulation;
}

.pe-canvas-stage.pe-cursor-draw {
  cursor: crosshair;
}

#planCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Room geometry (editor units, not mm) */
.pe-room-fill {
  fill: rgba(249, 62, 34, 0.08);
  stroke: none;
}

.pe-wall-hit {
  stroke: transparent;
  /* Screen-constant touch target; does not affect visible .pe-wall */
  stroke-width: 28;
  stroke-linecap: round;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.pe-wall {
  stroke: #223245;
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
}

/* Interior walls use the same solid style as boundary walls */
.pe-wall-interior {
  stroke: #223245;
  stroke-width: 3;
  stroke-dasharray: none;
}

.pe-wall-selected {
  stroke: #f93e22;
  stroke-width: 4;
  stroke-dasharray: none;
}

/* Auto length-fill: two soft accent pulses on the newly selected wall */
@keyframes pe-wall-auto-pulse {
  0%,
  100% {
    stroke: #f93e22;
    stroke-width: 4;
    opacity: 1;
  }
  18%,
  68% {
    stroke: #f93e22;
    stroke-width: 7;
    opacity: 1;
  }
  36%,
  86% {
    stroke: #f93e22;
    stroke-width: 4;
    opacity: 0.88;
  }
}

.pe-wall.pe-wall-auto-pulse {
  animation: pe-wall-auto-pulse 0.9s ease-in-out 1;
}

@media (prefers-reduced-motion: reduce) {
  .pe-wall.pe-wall-auto-pulse {
    animation: none;
    stroke: #f93e22;
    stroke-width: 6;
  }
}

@keyframes pe-prop-auto-refresh {
  0% {
    opacity: 0.55;
  }
  100% {
    opacity: 1;
  }
}

@keyframes pe-input-auto-glow {
  0%,
  100% {
    border-color: rgba(34, 50, 69, 0.18);
    box-shadow: none;
  }
  35%,
  65% {
    border-color: rgba(249, 62, 34, 0.65);
    box-shadow: 0 0 0 2px rgba(249, 62, 34, 0.18);
  }
}

.pe-prop-block.pe-prop-block--auto-advance {
  animation: pe-prop-auto-refresh 0.35s ease-out 1;
}

.pe-input.pe-input--auto-glow {
  animation: pe-input-auto-glow 0.9s ease-in-out 1;
}

@media (prefers-reduced-motion: reduce) {
  .pe-prop-block.pe-prop-block--auto-advance {
    animation: none;
  }
  .pe-input.pe-input--auto-glow {
    animation: none;
    border-color: rgba(249, 62, 34, 0.55);
  }
}

.pe-prop-block--fill-done {
  gap: 10px;
  padding: 2px 0 4px;
}

.pe-prop-block--fill-done .pe-wall-fill-progress {
  display: none;
}

.pe-wall-fill-done-msg,
.pe-wall-fill-done-next {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--pe-ink, #223245);
}

.pe-wall-fill-done-next {
  color: var(--pe-muted, #5a6b7d);
  font-weight: 600;
}

.pe-measure {
  stroke: #5a6b7d;
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
  fill: none;
  pointer-events: stroke;
  cursor: pointer;
}

.pe-measure-selected {
  stroke: #f93e22;
  stroke-width: 2;
}

.pe-measure-hit {
  stroke: transparent;
  stroke-width: 14;
  stroke-linecap: round;
  fill: none;
  pointer-events: stroke;
  cursor: pointer;
}

.pe-measure-tick {
  stroke: #5a6b7d;
  stroke-width: 1.5;
  stroke-linecap: round;
  pointer-events: none;
}

.pe-measure-label {
  fill: #223245;
  font-family: "Carlito", Calibri, "Segoe UI", sans-serif;
  font-size: 12px;
  pointer-events: none;
}

.pe-opening-hit {
  stroke: transparent;
  stroke-width: 16;
  stroke-linecap: butt;
  fill: none;
}

.pe-opening {
  stroke-width: 6;
  stroke-linecap: butt;
  fill: none;
}

.pe-opening-window {
  stroke: #3b82c4;
}

.pe-opening-door {
  stroke: #c47a2b;
}

.pe-opening-selected {
  stroke: #f93e22;
  stroke-width: 7;
}

.pe-door-leaf {
  stroke: #c47a2b;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
}

.pe-door-arc {
  stroke: #c47a2b;
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 4 3;
  opacity: 0.9;
}

.pe-door-hinge {
  fill: #c47a2b;
  stroke: #ffffff;
  stroke-width: 1;
}

/* Entrance mat: thin muted outline ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ not furniture */
.pe-entrance-mat {
  fill: rgba(210, 205, 195, 0.04);
  stroke: #d4cfc4;
  stroke-width: 0.75;
  pointer-events: none;
}

.pe-entrance-mat-label {
  fill: #8a8578;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
}

/* Invisible pick target under columns/partitions — does not paint, only expands hit. */
.pe-struct-hit {
  fill: rgba(0, 0, 0, 0.001);
  stroke: rgba(0, 0, 0, 0.001);
  pointer-events: all;
  cursor: pointer;
}

.pe-column {
  fill: rgba(34, 50, 69, 0.22);
  stroke: #223245;
  stroke-width: 2;
  pointer-events: none;
}

.pe-column-selected {
  fill: rgba(249, 62, 34, 0.2);
  stroke: #f93e22;
  stroke-width: 2.5;
}

.pe-partition {
  fill: rgba(34, 50, 69, 0.16);
  stroke: #223245;
  stroke-width: 2;
  pointer-events: none;
}

.pe-partition-selected {
  fill: rgba(249, 62, 34, 0.18);
  stroke: #f93e22;
  stroke-width: 2.5;
}

.pe-column-preview,
.pe-partition-preview {
  fill: rgba(249, 62, 34, 0.12);
  stroke: #f93e22;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

/* Mobile floating ±45° next to selected column / partition (hidden on desktop via MQ) */
.pe-struct-rot-hud {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  display: flex;
  flex-direction: row;
  gap: 6px;
  /* Only the FAB captures clicks — empty HUD chrome must not block selection. */
  pointer-events: none;
  will-change: transform;
}

.pe-struct-rot-hud[hidden] {
  display: none !important;
}

.pe-struct-rot-fab {
  flex: 0 0 auto;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.2;
  min-height: 0;
  white-space: nowrap;
  border: 1px solid var(--pe-border-soft, #e2e2e2);
  background: #fff;
  color: var(--pe-ink, #223245);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(34, 50, 69, 0.18);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.pe-struct-rot-fab:hover,
.pe-struct-rot-fab:active {
  border-color: var(--pe-accent, #f93e22);
}

@media (min-width: 961px) {
  .pe-struct-rot-hud {
    display: none !important;
  }
}

/* Compact ±45° rotation nudges in properties (desktop) */
.pe-prop-rot-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pe-prop-rot-row .pe-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.pe-btn-rot {
  flex: 0 0 auto;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.2;
  min-height: 0;
  white-space: nowrap;
  border: 1px solid var(--pe-border-soft, #e2e2e2);
  background: #fff;
  color: var(--pe-ink, #223245);
  border-radius: 10px;
  cursor: pointer;
}

.pe-btn-rot:hover {
  border-color: var(--pe-accent, #f93e22);
}

.pe-prop-divider {
  display: block;
  height: 1px;
  margin: 12px 0 10px;
  background: rgba(34, 50, 69, 0.12);
}

.pe-prop-subheading {
  display: block;
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pe-muted, #6a7a8a);
}

.pe-col-guide-line,
.pe-col-guide-face {
  stroke: #c45c26;
  stroke-width: 1.5;
  fill: none;
  pointer-events: none;
}

.pe-col-guide-label {
  fill: #c45c26;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.pe-vertex-draggable {
  cursor: grab;
}

.pe-wall-draft {
  stroke: #223245;
  stroke-width: 2.5;
  stroke-linecap: round;
  fill: none;
}

.pe-wall-preview {
  stroke: #f93e22;
  stroke-width: 2;
  stroke-dasharray: 8 6;
  stroke-linecap: round;
  fill: none;
  opacity: 0.85;
}

.pe-wall-preview-close {
  stroke: #f93e22;
  stroke-width: 2.5;
  stroke-dasharray: none;
  opacity: 1;
}

.pe-vertex {
  fill: #ffffff;
  stroke: #223245;
  stroke-width: 2;
}

.pe-vertex-first {
  fill: #f93e22;
  stroke: #ffffff;
  stroke-width: 2;
}

.pe-vertex-preview {
  fill: #f93e22;
  stroke: #ffffff;
  opacity: 0.7;
}

.pe-vertex-close-hot {
  fill: #f93e22;
  stroke: #223245;
  stroke-width: 3;
}

.pe-prop-line {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--pe-ink);
}

.pe-prop-meta {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--pe-muted);
  word-break: break-all;
}

.pe-prop-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pe-prop-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pe-prop-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pe-prop-heading {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pe-ink);
}

.pe-prop-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--pe-ink);
}

.pe-prop-label-axis {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pe-axis-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1em;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: var(--pe-muted);
  user-select: none;
}

.pe-axis-arrow-h {
  letter-spacing: -0.05em;
}

.pe-prop-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--pe-muted);
}

.pe-prop-warn {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #8a4b08;
  background: #fff6e8;
  border: 1px solid #f0d7a8;
  border-radius: 10px;
}

.pe-prop-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pe-prop-row-gap {
  margin-top: 8px;
  flex-wrap: wrap;
}

.pe-prop-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}

.pe-prop-checks--nested {
  margin: 2px 0 0 22px;
  padding: 8px 10px;
  border-left: 2px solid var(--pe-border-soft, #d5dde6);
  background: rgba(34, 50, 69, 0.03);
  border-radius: 0 10px 10px 0;
}

.pe-prop-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--pe-ink, #223245);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.pe-prop-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}

.pe-opening-balcony-divider {
  stroke: #223245;
  stroke-width: 2.5;
  stroke-linecap: butt;
  fill: none;
  pointer-events: none;
}

.pe-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--pe-border-soft);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--pe-ink);
  background: #fff;
}

.pe-btn-sm {
  padding: 10px 14px;
  font-size: 12px;
  white-space: nowrap;
}

.pe-btn-danger {
  background: transparent;
  color: #b42318;
  border: 1px solid #f0c2bc;
}

.pe-status {
  padding: 8px 12px;
  border-top: 1px solid var(--pe-border);
  font-size: 12px;
  color: var(--pe-muted);
  background: var(--pe-surface);
}

/* ----- Responsive (phone / narrow only; desktop rules above stay unchanged) ----- */

@media (max-width: 960px) {
  /*
   * Unified mobile header (4 rows):
   * 1) logo | ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ°ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ·ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ°ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ´ + EN/RU
   * 2) room type
   * 3) stage hint
   * 4) action buttons
   * display:contents unwraps columns so children join this grid.
   */
  .pe-header-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: start;
  }

  .pe-header-tools-col,
  .pe-header-canvas-col,
  .pe-header-canvas-top {
    display: contents;
  }

  .pe-brand-stack {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: start;
    justify-content: center;
    width: var(--pe-brand-w, 140px);
    max-width: 100%;
    min-width: 0;
    /* Match nav control band so logo+title sit level with Back / language */
    min-height: 36px;
    /* Optical nudge: logo glyph sits in the top half of the stack */
    transform: translateY(6px);
  }

  /* Mobile header: logo only; stage title moves onto the canvas */
  .pe-title,
  .pe-title-desktop,
  .pe-title-mobile {
    display: none;
  }

  .pe-canvas-stage-label {
    display: block;
    position: absolute;
    top: 8px;
    left: 10px;
    z-index: 2;
    margin: 0;
    padding: 0;
    max-width: calc(100% - 20px);
    font-family: "Montserrat", sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
    color: #9aa3ad;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .pe-header-nav {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    max-width: 100%;
    min-height: 36px;
  }

  .pe-header-nav .pe-btn {
    padding: 7px 10px;
    font-size: 11px;
    flex: 0 0 auto;
  }

  .pe-room-type.pe-panel-title,
  .pe-room-type {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Sketch mobile: room-type button + info `i` on one row */
  .pe-sketch-page .pe-room-type-row {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
    max-width: 100%;
    min-width: 0;
  }

  .pe-sketch-page .pe-room-type-row .pe-room-type.pe-panel-title,
  .pe-sketch-page .pe-room-type-row .pe-room-type {
    grid-column: auto;
    grid-row: auto;
    flex: 0 1 auto;
    width: fit-content;
    max-width: calc(100% - 52px);
    min-width: 0;
  }

  button.pe-room-type--btn {
    padding: 6px 12px;
    font-size: 10px;
    letter-spacing: 0.03em;
    gap: 8px;
  }

  .pe-context-hint {
    grid-column: 1 / -1;
    grid-row: 3;
    position: static;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    max-height: none;
    overflow: visible;
    justify-content: flex-start;
  }

  .pe-context-hint-main,
  .pe-context-hint-sub {
    white-space: normal;
    overflow: visible;
    max-height: none;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .pe-header-actions {
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    justify-content: stretch;
    align-items: stretch;
  }

  .pe-header-actions .pe-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 40px;
    padding: 8px 6px;
    font-size: 10px;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pe-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(360px, 1fr) auto;
  }

  /* Allow panels to shrink/scroll instead of overflowing and covering siblings */
  .pe-body > .pe-panel,
  .pe-body > .pe-canvas-shell {
    min-height: 0;
    max-height: none;
    position: relative;
    z-index: 1;
  }

  /* Sketch tools stay compact so the canvas keeps touch room */
  .pe-body > .pe-panel {
    max-height: min(42vh, 420px);
  }

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

  .pe-tool {
    width: auto;
    flex: none;
    min-width: 0;
    padding: 10px 8px;
    font-family: "Carlito", Calibri, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .pe-tool.active {
    font-weight: 700;
  }

  /* Restore original mobile howto link: red → + bold dark-blue title */
  .pe-tools-howto-link {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    margin: 10px 0 0;
    padding: 10px 2px 2px;
    min-height: 44px;
    font-family: "Carlito", "Calibri", "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    text-decoration: none;
    color: var(--pe-ink, #223245);
    background: none;
    border: none;
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .pe-tools-howto-link:hover,
  .pe-tools-howto-link:focus-visible {
    color: var(--pe-accent, #f93e22);
    text-decoration: none;
  }

  .pe-tools-howto-link:hover .pe-tools-howto-link__icon,
  .pe-tools-howto-link:focus-visible .pe-tools-howto-link__icon {
    color: var(--pe-accent, #f93e22);
  }

  .pe-tools-howto-link:focus-visible {
    outline: 2px solid var(--pe-accent, #f93e22);
    outline-offset: 2px;
    border-radius: 6px;
  }

  .pe-tools-howto-link__icon {
    display: inline;
    flex: 0 0 auto;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: var(--pe-accent, #f93e22);
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    font-style: normal;
    line-height: 1.35;
    text-decoration: none;
  }

  .pe-tools-howto-link__text {
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
  }

  .pe-tools-guide {
    display: none;
  }

  .pe-panel-props .pe-panel-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .pe-prop-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
  }

  .pe-prop-field {
    min-width: 0;
  }

  .pe-prop-field .pe-prop-label {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  .pe-prop-field .pe-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .pe-prop-checks,
  .pe-prop-divider,
  .pe-prop-subheading,
  .pe-prop-hint,
  .pe-prop-row,
  .pe-prop-primary,
  .pe-prop-extra,
  .pe-prop-actions {
    grid-column: 1 / -1;
  }

  /*
   * Mobile props stack: primary sizes → Apply/Delete → extras.
   * Desktop keeps source order (primary → extras → actions).
   */
  .pe-prop-block--stack {
    display: flex;
    flex-direction: column;
  }

  .pe-prop-block--stack > .pe-prop-primary {
    order: 1;
  }

  .pe-prop-block--stack > .pe-prop-actions {
    order: 2;
    margin-top: 4px;
    margin-bottom: 0;
  }

  .pe-prop-block--stack > .pe-prop-extra {
    order: 3;
    margin-top: 8px;
  }

  .pe-prop-block--stack > .pe-prop-extra:empty {
    display: none;
  }

  .pe-prop-block--stack > .pe-prop-hint {
    order: 4;
  }

  .pe-prop-block--stack > .pe-prop-extra .pe-prop-checks {
    margin-top: 4px;
  }

  .pe-prop-block--stack > .pe-prop-extra > .pe-prop-divider {
    margin-top: 4px;
  }

  /* Opening dims: width | spacer; start | end */
  .pe-prop-fields--opening {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
  }

  .pe-prop-fields--opening .pe-prop-field--opening-spacer {
    display: block;
    min-height: 1px;
  }

  .pe-prop-extra--column-pos {
    order: 3;
  }

  /*
   * Sketch-only mobile field (1B + 1C fix):
   * - Frame is width-first at 18:15 (matches viewBox 720ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ600) so the grid spans the
   *   full shell width ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ no side letterboxing from a height-capped centered frame.
   * - Cells stay square via meet + matching AR; no preserveAspectRatio=none.
   */
  .pe-sketch-page .pe-body {
    padding-left: 0;
    padding-right: 0;
    gap: 8px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .pe-sketch-page .pe-body > .pe-panel {
    margin-left: 10px;
    margin-right: 10px;
    max-height: min(36vh, 360px);
  }

  .pe-sketch-page .pe-canvas-shell {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .pe-sketch-page .pe-canvas-stage--sketch {
    /* Size to the full-width 18:15 frame ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ do not grow into empty side bands */
    flex: 0 0 auto;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 18 / 15;
    display: block;
  }

  .pe-sketch-page .pe-canvas-stage--sketch .pe-canvas-frame {
    aspect-ratio: 18 / 15;
    width: 100%;
    height: 100%;
    max-width: 100%;
  }

  /*
   * Mobile zone scroll nav ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ questionnaire-style nav-btn look,
   * fixed on the right edge (does not alter pe-body layout).
   */
  .pe-zone-nav {
    display: block;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 0;
    z-index: 30;
    pointer-events: none;
  }

  .pe-zone-nav[hidden] {
    display: none !important;
  }

  .pe-zone-nav-btn {
    position: absolute;
    right: 0;
    /* Large invisible hit target; visible chevron stays compact */
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #f93e22;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: none;
    transition: opacity 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .pe-zone-nav-btn--up {
    /* Fallback; JS syncs vertical center to room-type control */
    top: max(40px, calc(env(safe-area-inset-top, 0px) + 36px));
  }

  /* Scale + Final: plain room-type label (no button chrome; align with logo) */
  .scale-app #scale-room-type.pe-room-type,
  .final-app #final-room-type.pe-room-type {
    display: block;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--pe-ink, #223245);
    font-family: "Carlito", "Calibri", "Segoe UI", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
    text-transform: uppercase;
    text-align: left;
    justify-self: start;
    pointer-events: none;
    cursor: default;
  }

  .scale-app #scale-room-type.pe-room-type::after,
  .scale-app #scale-room-type.pe-room-type::before,
  .final-app #final-room-type.pe-room-type::after,
  .final-app #final-room-type.pe-room-type::before {
    content: none;
    display: none;
  }

  .pe-zone-nav-btn--down {
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .pe-zone-nav-btn:active:not(:disabled) {
    transform: scale(0.92);
  }

  .pe-zone-nav-btn:disabled {
    opacity: 0.28;
    cursor: default;
    pointer-events: none;
  }

  .pe-zone-nav-chevron {
    display: block;
    width: 11px;
    height: 11px;
    border-right: 2.5px solid #f93e22;
    border-bottom: 2.5px solid #f93e22;
    box-sizing: border-box;
  }

  .pe-zone-nav-btn--up .pe-zone-nav-chevron {
    transform: translateY(3px) rotate(-135deg);
  }

  .pe-zone-nav-btn--down .pe-zone-nav-chevron {
    transform: translateY(-3px) rotate(45deg);
  }
}

/* Desktop: never show zone nav (even if markup lacks hidden) */
@media (min-width: 961px) {
  .pe-zone-nav {
    display: none !important;
  }
}

@media (max-width: 560px) {
  /* Phone: compact text link instead of article card */
  .pe-tools-guide__desktop {
    display: none;
  }

  .pe-tools-guide__mobile {
    display: flex;
  }

  .pe-tools-guide {
    margin-top: 10px;
    padding-top: 8px;
  }

  .pe-header {
    padding: 8px 10px 6px;
  }

  .pe-header-grid {
    --pe-brand-w: 128px;
  }

  .pe-brand-stack,
  html[lang="en"] .pe-brand-stack {
    width: 128px;
  }

  .pe-logo,
  html[lang="en"] .pe-logo {
    width: 128px;
  }

  .pe-title,
  html[lang="en"] .pe-title {
    font-size: 13px;
    letter-spacing: 0.03em;
  }

  .pe-room-type {
    font-size: 14px;
  }

  .pe-context-hint-main {
    font-size: 12px;
    white-space: normal;
  }

  .pe-header-actions .pe-btn {
    padding: 8px 4px;
    font-size: 10px;
  }

  .pe-btn {
    padding: 8px 12px;
    font-size: 11px;
  }

  .pe-header-actions .pe-btn {
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .pe-header-grid {
    --pe-brand-w: 118px;
  }

  .pe-brand-stack,
  html[lang="en"] .pe-brand-stack {
    width: 118px;
  }

  .pe-logo,
  html[lang="en"] .pe-logo {
    width: 118px;
  }

  .pe-header-nav .pe-btn {
    padding: 6px 8px;
    font-size: 10px;
  }

  .pe-header-actions .pe-btn {
    padding: 8px 3px;
    font-size: 9px;
    min-height: 38px;
  }
}

/* Ã¢ÂÂÃ¢ÂÂ Howto leave confirm (tools Ã¢ÂÂ article) Ã¢ÂÂÃ¢ÂÂ */
body.pe-howto-leave-open,
body.pe-display-unit-open,
body.pe-furniture-size-fit-open {
  overflow: hidden;
}

.pe-display-unit__actions {
  justify-content: stretch;
}

.pe-display-unit__actions .pe-btn {
  flex: 1 1 0;
}

.pe-display-unit__actions .pe-btn.pe-display-unit-btn--current {
  box-shadow: inset 0 0 0 2px rgba(34, 50, 69, 0.55);
}

/* Clickable mm/cm unit control (Stage F) — span so it nests in labels/buttons */
.pe-unit-toggle {
  display: inline;
  margin: 0;
  padding: 0 1px;
  border: 0;
  border-bottom: 1px dashed currentColor;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  line-height: inherit;
  cursor: pointer;
  vertical-align: baseline;
  text-decoration: none;
}

.pe-unit-toggle:hover,
.pe-unit-toggle:focus-visible {
  color: #c45c26;
  border-bottom-color: #c45c26;
  outline: none;
}

.pe-unit-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(196, 92, 38, 0.35);
  border-radius: 2px;
}

.pe-howto-leave[hidden] {
  display: none !important;
}

.pe-howto-leave {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.pe-howto-leave__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 50, 69, 0.45);
}

.pe-howto-leave__dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  box-sizing: border-box;
  padding: 18px 16px 14px;
  border-radius: 16px;
  background: var(--pe-surface, #fff);
  box-shadow: 0 16px 48px rgba(34, 50, 69, 0.22);
}

.pe-howto-leave__title {
  margin: 0 0 10px;
  font-family: "Montserrat", sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pe-ink, #223245);
}

.pe-howto-leave__text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--pe-ink, #223245);
}

.pe-howto-leave__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pe-howto-leave__actions .pe-btn {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 560px) {
  .pe-howto-leave__actions {
    flex-direction: column-reverse;
  }

  .pe-howto-leave__actions .pe-btn {
    width: 100%;
  }
}

/* Ã¢ÂÂÃ¢ÂÂ Room type picker (before furniture when type is missing) Ã¢ÂÂÃ¢ÂÂ */
body.pe-room-type-modal-open {
  overflow: hidden;
}

.pe-room-type-modal[hidden] {
  display: none !important;
}

.pe-room-type-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.pe-room-type-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 50, 69, 0.45);
}

.pe-room-type-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  box-sizing: border-box;
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: var(--pe-surface, #fff);
  box-shadow: 0 16px 48px rgba(34, 50, 69, 0.22);
}

.pe-room-type-modal__title {
  margin: 0 0 14px;
  font-family: "Montserrat", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pe-ink, #223245);
}

.pe-room-pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pe-room-pick-card {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  background: #e8e6e1;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  transition: border-color 0.2s ease, transform 0.2s ease;
  touch-action: manipulation;
  aspect-ratio: 16 / 10;
}

.pe-room-pick-card:hover {
  transform: scale(1.02);
}

.pe-room-pick-card:focus-visible {
  outline: 2px solid var(--pe-accent, #f93e22);
  outline-offset: 2px;
}

.pe-room-pick-card.is-active {
  border-color: var(--pe-accent, #f93e22);
}

.pe-room-pick-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pe-room-pick-card__label {
  position: absolute;
  top: 12px;
  left: 0;
  max-width: calc(100% - 10px);
  box-sizing: border-box;
  padding: 6px 14px;
  background: rgba(140, 140, 140, 0.75);
  color: #fff;
  font-family: "Carlito", "Montserrat", sans-serif;
  font-size: 14px;
  line-height: 1.25;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.pe-room-type-modal__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pe-room-type-modal__actions .pe-btn:disabled,
.pe-room-type-modal__actions .pe-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .pe-room-type-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .pe-room-type-modal__dialog {
    width: 100%;
    max-height: 88vh;
    padding: 14px 12px 12px;
    border-radius: 14px 14px 10px 10px;
  }

  .pe-room-type-modal__title {
    font-size: 16px;
  }

  .pe-room-pick-grid {
    gap: 8px;
  }

  .pe-room-pick-card__label {
    font-size: 12px;
    padding: 5px 10px;
  }

  .pe-room-type-modal__actions {
    flex-direction: column-reverse;
  }

  .pe-room-type-modal__actions .pe-btn {
    width: 100%;
  }
}

/* ÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ Sketch onboarding guide (collapses to fab) ÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ¢ÃÂÃÂÃÂÃÂÃÂÃÂÃÂÃÂ */
body.pe-sketch-guide-open {
  overflow: hidden;
}

.pe-sketch-guide[hidden] {
  display: none !important;
}

.pe-sketch-guide {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  pointer-events: auto;
}

.pe-sketch-guide__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(34, 50, 69, 0.45);
  transition: opacity 0.28s ease;
}

.pe-sketch-guide__dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  box-sizing: border-box;
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: var(--pe-surface, #fff);
  box-shadow: 0 16px 48px rgba(34, 50, 69, 0.22);
  transform-origin: center center;
  transition: transform 0.28s ease, opacity 0.28s ease;
  will-change: transform, opacity;
}

.pe-sketch-guide--collapsing .pe-sketch-guide__backdrop {
  opacity: 0;
  pointer-events: none;
}

.pe-sketch-guide--collapsing .pe-sketch-guide__dialog {
  pointer-events: none;
}

.pe-sketch-guide__title {
  margin: 0 0 10px;
  font-family: "Montserrat", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pe-ink, #223245);
}

.pe-sketch-guide__text {
  margin: 0 0 14px;
  font-family: "Carlito", "Montserrat", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--pe-ink, #223245);
}

.pe-sketch-guide__text--howto {
  white-space: normal;
}

.pe-sketch-guide__text--howto p {
  margin: 0 0 0.85em;
}

.pe-sketch-guide__text--howto p:last-child {
  margin-bottom: 0;
}

/* Guide pick: desktop 3ÃÂÃÂ2 so all six types fit without scrolling */
.pe-room-pick-grid--guide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pe-sketch-guide__dialog {
  overflow: hidden;
}

.pe-sketch-guide .pe-room-pick-card {
  aspect-ratio: 16 / 11;
}

@media (max-width: 720px) {
  .pe-room-pick-grid--guide {
    grid-template-columns: 1fr 1fr;
  }

  .pe-sketch-guide__dialog {
    overflow: auto;
  }
}

.pe-sketch-guide__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pe-sketch-guide__actions--stack {
  flex-direction: column;
  align-items: stretch;
}

.pe-sketch-guide__actions--stack .pe-btn {
  width: 100%;
  justify-content: center;
}

.pe-sketch-guide__actions .pe-btn:disabled,
.pe-sketch-guide__actions .pe-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.pe-sketch-guide-fab[hidden] {
  display: none !important;
}

.pe-sketch-guide-fab {
  position: fixed;
  z-index: 70;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--pe-accent, #f93e22);
  border-radius: 50%;
  background: #fff;
  color: var(--pe-accent, #f93e22);
  box-shadow: 0 6px 18px rgba(34, 50, 69, 0.18);
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pe-sketch-guide-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 22px rgba(34, 50, 69, 0.22);
}

.pe-sketch-guide-fab:focus-visible {
  outline: 2px solid var(--pe-accent, #f93e22);
  outline-offset: 3px;
}

.pe-sketch-guide-fab__glyph {
  font-family: "Montserrat", sans-serif;
  font-size: 20px;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  text-transform: lowercase;
}

@media (max-width: 960px) {
  /* Sit in header row next to room-type (not floating over the canvas) */
  .pe-sketch-page .pe-sketch-guide-fab {
    position: relative;
    right: auto;
    bottom: auto;
    top: auto;
    left: auto;
    flex: 0 0 auto;
    z-index: 5;
    /* Hit target 44px; visible ring ~25px via centered ::after */
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .pe-sketch-page .pe-sketch-guide-fab::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    /* Outer diameter stays ~25px: content 23 + 2×1 border */
    width: 23px;
    height: 23px;
    margin: 0;
    border: 1px solid var(--pe-accent, #f93e22);
    border-radius: 50%;
    background: #fff;
    box-shadow: none;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-sizing: content-box;
  }

  .pe-sketch-page .pe-sketch-guide-fab__glyph {
    position: relative;
    z-index: 1;
    font-family: "Montserrat", sans-serif;
    font-size: 14px;
    font-weight: 400;
    font-style: italic;
    color: var(--pe-accent, #f93e22);
  }
}

@media (max-width: 560px) {
  .pe-sketch-guide {
    padding: 10px;
    align-items: flex-end;
  }

  .pe-sketch-guide__dialog {
    width: 100%;
    max-height: 88vh;
    padding: 14px 12px 12px;
    border-radius: 14px 14px 10px 10px;
  }

  .pe-sketch-guide__title {
    font-size: 16px;
  }

  .pe-sketch-guide__actions {
    flex-direction: column-reverse;
  }

  .pe-sketch-guide__actions .pe-btn {
    width: 100%;
  }
}
