/* =========================================================
   measure.css — /measure tablet surveyor
   ---------------------------------------------------------
   Consumes the styles.css :root tokens (--ink/--line/--bg-alt/--accent).
   CAD-professional flat style: sharp corners, hairlines, no shadows.
   Touch targets >= 44px everywhere a finger lands (goal §12).
   Layout: top bar / left palette / stage / right properties panel;
   on tablet portrait the right panel becomes a slide-over so the
   canvas keeps the full width.
   ========================================================= */

/* flex/grid display rules below would defeat the `hidden` attribute — reassert it */
.mz-body [hidden] { display: none !important; }

.mz-body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  /* the page never scrolls — the canvas owns every gesture */
  overscroll-behavior: none;
}

/* ----------------------------- top bar ----------------------------- */
.mz-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 52px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mz-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.mz-logo .logo-mark img { width: 22px; height: 22px; display: block; }
.mz-proj {
  min-height: 44px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.mz-flow {
  display: flex;
  border: 1px solid var(--ink);
  min-height: 44px;
}
.mz-flow__tab {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.mz-flow__tab:first-child { border-left: 0; }
.mz-flow__tab.is-active { background: var(--ink); color: var(--white); }
.mz-hist { display: flex; gap: 4px; }
.mz-icon {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mz-icon:disabled { opacity: 0.35; cursor: default; }
.mz-tabs { display: flex; }
.mz-tab {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-left-width: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.mz-tab:first-child { border-left-width: 1px; }
.mz-tab.is-active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.mz-bar__spacer { flex: 1; }
.mz-sync {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 8px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.mz-sync.is-synced { color: #1b7a3d; border-color: #1b7a3d; }
.mz-sync.is-local { color: #b06000; border-color: #b06000; }
.mz-lang { font-size: 13px; font-weight: 700; }
.mz-exportwrap { position: relative; }
.mz-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 40;
  background: var(--bg);
  border: 1px solid var(--ink);
  min-width: 220px;
  display: flex;
  flex-direction: column;
}
.mz-menu button {
  min-height: 48px;
  padding: 0 14px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.mz-menu button:last-child { border-bottom: 0; }
.mz-menu button:active { background: var(--bg-alt); }
.mz-paneltoggle { display: none; }

/* ----------------------------- read-only banner ----------------------------- */
.mz-robanner {
  flex: 0 0 auto;
  background: #7a1f1f;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.mz-robanner a { color: #fff; }

/* ----------------------------- main layout ----------------------------- */
.mz-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* palette */
.mz-palette {
  flex: 0 0 76px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
  padding: 6px 4px;
  gap: 4px;
}
.mz-palette__measure, .mz-palette__systems {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mz-tool {
  min-height: 54px;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
}
.mz-tool__ico { font-size: 19px; line-height: 1; }
.mz-tool.is-active { border-color: var(--ink); background: var(--bg-alt); }
.is-systems .mz-tool[data-system-tool].is-active { border-color: #315f4a; background: #e9f1ed; color: #214b38; }
.mz-tool:disabled { opacity: 0.35; cursor: default; }
.mz-palette__sep { border-top: 1px solid var(--line); margin: 6px 2px; }
.mz-palette__grow { flex: 1; }
.mz-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  min-height: 34px;
  padding: 0 6px;
  cursor: pointer;
}
.mz-check input { width: 16px; height: 16px; }
.mz-privacy {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
  text-decoration: none;
}

/* stage */
.mz-stage {
  flex: 1;
  position: relative;
  min-width: 0;
  background: var(--bg-alt);
  overflow: hidden;
}
.mz-canvas {
  position: absolute;
  inset: 0;
  /* the pointer pipeline owns EVERY gesture (pinch included) */
  touch-action: none;
  display: block;
}
.mz-3d { position: absolute; inset: 0; background: #eceae6; touch-action: none; }
/* setSize(w,h,false) never touches style — without 100% here a DPR>1 canvas
   lays out at its raw pixel size and the view becomes a 2x crop */
.mz-3d canvas { display: block; width: 100%; height: 100%; }
.mz-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  right: 130px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  pointer-events: none;
  background: rgba(255, 255, 255, 0.85);
  padding: 4px 8px;
  max-width: 640px;
}
.mz-surfacechip {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  z-index: 8;
  max-width: calc(100% - 150px);
  padding: 7px 10px;
  border: 1px solid var(--ink);
  background: rgba(255,255,255,0.94);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mz-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 35;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 700;
}
.mz-toast button { border: 0; background: none; color: #fff; font: inherit; text-decoration: underline; cursor: pointer; }
.mz-closeloop {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  min-height: 44px;
}
.mz-fit {
  position: absolute;
  right: 10px;
  top: 10px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 17px;
  cursor: pointer;
}
.mz-zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* inline number editor */
.mz-inline {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 6px;
  z-index: 30;
}
.mz-inline input {
  width: 96px;
  min-height: 40px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  border: 1px solid var(--line);
  padding: 0 8px;
}
.mz-inline__unit { font-size: 12px; color: var(--ink-soft); }
.mz-inline__lock {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 17px;
  cursor: pointer;
}
.mz-inline__lock.is-locked { border-color: #c0392b; background: #fdf1ef; }
.mz-inline__win {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #c0392b;
  background: #fdf1ef;
  color: #c0392b;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* wall-link popup */
.mz-linkpop {
  position: absolute;
  transform: translate(-50%, -100%);
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 10px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.mz-linkpop__row { display: flex; align-items: center; gap: 6px; }
.mz-linkpop__row input {
  width: 90px;
  min-height: 44px;
  font: inherit;
  font-size: 17px;
  border: 1px solid var(--line);
  padding: 0 8px;
}
.mz-linkpop__actions { display: flex; gap: 8px; justify-content: flex-end; }
.mz-linkpop .btn { min-height: 44px; }

/* ----------------------------- side panel ----------------------------- */
.mz-side {
  flex: 0 0 300px;
  border-left: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.mz-side__sec { border-bottom: 1px solid var(--line); padding: 10px 12px; }
.mz-side__props { flex: 1; }
.mz-side__head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.mz-help { font-size: 12px; color: var(--ink-soft); margin: 0 0 8px; }
.mz-side textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  padding: 8px;
  resize: vertical;
  background: var(--bg);
}

/* ----------------------------- systems inspector ----------------------------- */
.mz-systemspanel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mz-systemspanel__head {
  flex: 0 0 auto;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 9px 10px 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mz-systemspanel__head > div { min-width: 0; }
.mz-systemspanel__head .mz-side__head { display: block; margin-bottom: 3px; }
.mz-systemspanel__head strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mz-systemspanel__flow { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 10.5px; font-weight: 600; }
.mz-systemspanel__head .mz-icon { display: none; }
.mz-systemsbody { flex: 1; overflow-y: auto; padding: 12px; }
.mz-system-empty { color: var(--ink-soft); font-size: 13px; line-height: 1.45; margin: 0; }
.mz-system-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 10px;
  font-size: 12px;
}
.mz-system-meta span:nth-child(odd) { color: var(--ink-soft); }
.mz-system-meta span:nth-child(even) { font-weight: 700; text-align: right; }
.mz-assembly-family { margin: 14px 0 7px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.mz-assembly-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mz-assembly-card {
  min-height: 86px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  padding: 8px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.mz-assembly-card:hover, .mz-assembly-card:active { border-color: var(--ink); background: var(--bg-alt); }
.mz-assembly-card.is-active { border: 2px solid #315f4a; background: #e9f1ed; padding: 7px; }
.mz-assembly-card strong, .mz-assembly-card span { display: block; }
.mz-assembly-card strong { font-size: 14px; }
.mz-assembly-card span { margin-top: 4px; font-size: 11px; line-height: 1.25; color: var(--ink-soft); }
.mz-assembly-card small { display: inline-block; margin-top: 6px; color: #1b6b45; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.mz-system-controls { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.mz-segment-label { display: block; margin: 10px 0 5px; font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.mz-segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.mz-segments button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-left: 0;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mz-segments button:first-child { border-left: 1px solid var(--line); }
.mz-segments button.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.mz-system-field { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; }
.mz-system-field input[type="number"] { width: 92px; min-height: 40px; border: 1px solid var(--line); padding: 0 8px; font: inherit; }
.mz-system-field input[type="checkbox"] { width: 20px; height: 20px; }
.mz-system-scope { margin-top: 12px; display: grid; gap: 6px; }
.mz-scope-btn, .mz-system-remove {
  min-height: 46px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  padding: 6px 9px;
  text-align: left;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mz-scope-btn span { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 10.5px; font-weight: 600; }
.mz-system-remove { border-color: #b8483a; color: #a23b30; margin-top: 10px; text-align: center; }
.mz-coverage-list { display: grid; gap: 5px; }
.mz-coverage-item { min-height: 44px; border: 1px solid #bd8c3c; background: #fff9ec; padding: 6px 8px; font: inherit; text-align: left; cursor: pointer; }
.mz-coverage-item strong, .mz-coverage-item span { display: block; }
.mz-coverage-item span { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

/* workflow modes keep only the controls relevant to the current job */
.is-systems .mz-measure-only, .is-boq .mz-measure-only { display: none !important; }
.is-systems .mz-systemspanel { display: flex; }
.is-systems .mz-palette__measure, .is-boq .mz-palette__measure { display: none; }
.is-systems .mz-palette__systems, .is-boq .mz-palette__systems { display: flex; }
.is-boq .mz-palette__systems { opacity: .4; pointer-events: none; }
.is-systems .mz-hint, .is-boq .mz-hint { bottom: 8px; }

/* ----------------------------- live BOQ drawer ----------------------------- */
.mz-boq {
  flex: 0 0 58px;
  min-height: 58px;
  border-top: 1px solid var(--ink);
  background: var(--bg);
  overflow: hidden;
  transition: flex-basis 180ms ease-out;
  z-index: 50;
}
.mz-boq.is-open { flex-basis: min(44vh, 410px); }
.mz-boq__summary {
  width: 100%;
  height: 57px;
  border: 0;
  background: var(--bg);
  color: var(--ink);
  padding: 0 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.mz-boq__selected { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.mz-boq__coverage { border: 1px solid var(--line); padding: 4px 8px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.mz-boq__coverage.is-complete { color: #1b6b45; border-color: #1b6b45; }
.mz-boq__chev { font-size: 18px; transform: rotate(0); transition: transform 180ms; }
.mz-boq.is-open .mz-boq__chev { transform: rotate(180deg); }
.mz-boq__sheet { height: calc(100% - 58px); border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.mz-boq__head { flex: 0 0 auto; min-height: 54px; padding: 7px 12px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.mz-boq__head > div { flex: 1; min-width: 0; }
.mz-boq__head strong, .mz-boq__head span { display: block; }
.mz-boq__head span { font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; }
.mz-boq__head label { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; }
.mz-boq__head label span { margin: 0; }
.mz-boq__head select, .mz-boq__csv { min-height: 40px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; padding: 0 8px; }
.mz-boq__csv { min-width: 54px; font-weight: 700; cursor: pointer; }
.mz-boq__uncovered { flex: 0 0 auto; min-height: 0; background: #fff9ec; color: #765015; padding: 5px 12px; font-size: 11.5px; font-weight: 700; }
.mz-boq__uncovered:empty { display: none; }
.mz-boq__tablewrap { flex: 1; min-height: 0; overflow: auto; }
.mz-boq__table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 12px; }
.mz-boq__table th { position: sticky; top: 0; z-index: 2; background: var(--bg-alt); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-size: 9.5px; text-align: left; }
.mz-boq__table th, .mz-boq__table td { border-bottom: 1px solid var(--line); padding: 7px 12px; }
.mz-boq__table th:not(:first-child), .mz-boq__table td:not(:first-child) { text-align: right; white-space: nowrap; }
.mz-boq__row { cursor: pointer; }
.mz-boq__row:hover, .mz-boq__row.is-active { background: #eef4f1; }
.mz-boq__row small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 10px; }
.mz-boq__group { background: #e8e5df; border-top: 2px solid var(--ink); }
.mz-boq__group td { padding-top: 8px; padding-bottom: 8px; }
.mz-boq__group strong, .mz-boq__group small { display: block; }
.mz-boq__group small { margin-top: 3px; color: var(--ink-soft); font-size: 10.5px; }
.mz-boq__group .mz-boq__rule { color: #765015; }
.mz-boq__edit { display: flex; align-items: end; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mz-boq__edit label { display: grid; gap: 2px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.mz-boq__edit input { width: 76px; height: 34px; border: 1px solid var(--line); background: var(--bg); padding: 0 6px; font: inherit; }
.mz-boq__edit button { min-height: 34px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 0 8px; font: inherit; font-size: 10px; font-weight: 800; }
.mz-boq__source {
  min-height: 30px;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  padding: 0 8px;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.mz-boq__source:hover, .mz-boq__source:focus-visible { border-color: #2f6edc; color: #2f6edc; }
.mz-boq__jump3d { border-color: #2f6edc !important; color: #2f6edc !important; }
.mz-boq__empty { color: var(--ink-soft); text-align: center !important; padding: 18px !important; }
.mz-boq__disclaimer { flex: 0 0 auto; margin: 0; padding: 5px 12px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 10px; }

/* next-step fork — the two things a finished survey can become */
.mz-next__btn {
  display: block;
  width: 100%;
  min-height: 56px;
  text-align: left;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.mz-next__btn:last-child { margin-bottom: 0; }
.mz-next__btn:active { background: var(--bg-alt); }
.mz-next__btn[disabled] {
  border-color: var(--line);
  color: var(--ink-soft);
  cursor: default;
  opacity: 0.55;
}
.mz-next__ttl { display: block; font-weight: 700; font-size: 14px; }
.mz-next__sub { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.mz-next__soon {
  display: inline-block;
  margin-top: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.mz-next__note { font-size: 11.5px; color: #b06000; margin: 0 0 8px; }

/* room cards */
.mz-room {
  border: 1px solid var(--line);
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.mz-room.is-active { border-color: var(--ink); background: var(--bg-alt); }
.mz-room__top { display: flex; align-items: center; gap: 6px; }
.mz-room__name { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mz-room__ok { font-size: 11px; font-weight: 700; color: #1b7a3d; white-space: nowrap; }
.mz-room__warn { font-size: 11px; font-weight: 700; color: #b06000; white-space: nowrap; }
.mz-room__meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.mz-room__btns { display: flex; gap: 4px; margin-top: 6px; }
.mz-room__btns button {
  min-width: 44px;
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
}

/* measurement inbox */
.mz-inbox__list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mz-reading {
  min-height: 44px;
  min-width: 64px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  background: var(--bg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.mz-reading.is-armed { background: var(--ink); color: var(--white); }
.mz-reading.is-used { opacity: 0.35; text-decoration: line-through; border-color: var(--line); }

/* property rows (built by JS) */
.mz-prop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.mz-prop input[type="number"], .mz-prop input[type="text"], .mz-prop select {
  width: 110px;
  min-height: 44px;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  padding: 0 8px;
  background: var(--bg);
}
.mz-prop--ro span:last-child { color: var(--ink-soft); font-weight: 500; }
.mz-lockline { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-height: 44px; cursor: pointer; }
.mz-lockline input { width: 18px; height: 18px; }
.mz-propbtn {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 6px;
}
.mz-propbtn--danger { border-color: #c0392b; color: #c0392b; }
.mz-propmeta { font-size: 12px; color: var(--ink-soft); margin: 4px 0 8px; }

/* wall elevation (inline SVG pane) */
.mz-elev { border: 1px solid var(--line); margin: 6px 0 10px; background: var(--bg-alt); }
.mz-elev svg { display: block; width: 100%; touch-action: none; }
.mz-elev .ew-wall { fill: #ffffff; stroke: var(--ink); stroke-width: 1.5; }
.mz-elev .ew-open { fill: #dfe8f4; stroke: #2f6edc; stroke-width: 1.5; cursor: grab; }
.mz-elev .ew-open.is-sel { stroke: #c0392b; fill: #f8e4e0; }
.mz-elev .ew-door { fill: #efe3d2; stroke: #8a5a2b; }
.mz-elev .ew-lbl { font: 600 10px var(--sans); fill: var(--ink-soft); }

/* ----------------------------- overlays ----------------------------- */
.mz-overlay, .mz-gate, .mz-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(17, 17, 17, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.mz-overlay__panel, .mz-gate__panel, .mz-modal__panel {
  background: var(--bg);
  border: 1px solid var(--ink);
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 18px;
}
.mz-overlay__head { display: flex; align-items: center; justify-content: space-between; }
.mz-overlay__head h3 { margin: 0; }
.mz-projlist { margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.mz-projrow { border: 1px solid var(--line); padding: 10px; display: flex; align-items: center; gap: 8px; }
.mz-projrow.is-current { border-color: var(--ink); background: var(--bg-alt); }
.mz-projrow__main { flex: 1; min-width: 0; cursor: pointer; }
.mz-projrow__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mz-projrow__meta { font-size: 11.5px; color: var(--ink-soft); }
.mz-projrow button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.mz-projnew { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.mz-projnew h4 { margin: 0; }
.mz-projnew input {
  min-height: 44px;
  font: inherit;
  border: 1px solid var(--line);
  padding: 0 10px;
}
.mz-projnew .btn { min-height: 48px; }
.mz-logout {
  margin-top: 14px;
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
}

/* auth gate */
.mz-gate__panel { max-width: 380px; }
.mz-gate__panel h3 { margin: 14px 0 8px; }
.mz-gate__panel input {
  display: block;
  width: 100%;
  min-height: 48px;
  font: inherit;
  font-size: 16px;
  border: 1px solid var(--line);
  padding: 0 12px;
  margin-bottom: 10px;
  background: var(--bg);
}
.mz-gate__panel .btn { width: 100%; min-height: 48px; }
.mz-gate__err { color: #c0392b; font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.mz-gate__alt {
  display: block;
  width: 100%;
  margin-top: 10px;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.mz-gate__offline { color: #b06000; font-size: 13px; font-weight: 600; }
.mz-gate__privacy { display: block; margin-top: 12px; font-size: 11px; color: var(--muted); }
.gate__brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.gate__brand .logo-mark img { width: 22px; height: 22px; display: block; }

/* modal */
.mz-modal__panel { max-width: 320px; }
.mz-modal__panel p { margin: 0 0 10px; font-weight: 600; }
.mz-modal__panel input {
  width: 100%;
  min-height: 48px;
  font: inherit;
  font-size: 17px;
  border: 1px solid var(--line);
  padding: 0 10px;
}
.mz-modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.mz-modal__actions .btn { min-height: 44px; }

/* a2hs hint */
.mz-a2hs {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 80;
  background: var(--ink);
  color: var(--white);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.mz-a2hs .mz-icon { background: none; border-color: rgba(255, 255, 255, 0.4); color: #fff; flex: 0 0 auto; }
.mz-a2hs .btn { min-height: 44px; flex: 0 0 auto; }
.mz-a2hs span { flex: 1; }

/* read-only mode: grey the editing tools out */
.is-readonly .mz-palette__measure .mz-tool:not([data-tool="select"]):not(#btnInbox) { opacity: 0.35; pointer-events: none; }

/* boot failure (a lib missing even from the SW cache): visible, never a blank page */
.mz-booterr {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 420px;
  z-index: 200;
  background: var(--ink);
  color: var(--white);
  padding: 14px 18px;
  font-size: 14px;
  text-align: center;
}

/* ----------------------------- tablet portrait ----------------------------- */
@media (max-width: 1024px) {
  .mz-paneltoggle { display: inline-flex; }
  .mz-side {
    position: fixed;
    top: 52px;
    right: 0;
    bottom: 0;
    width: min(320px, 86vw);
    z-index: 60;
    transform: translateX(100%);
    transition: transform 200ms ease-out;
    box-shadow: none;
  }
  .mz-body.panel-open .mz-side { transform: translateX(0); }
  .mz-proj { max-width: 130px; }
  .mz-logo span:last-child { display: none; }
  .mz-flow__tab { padding: 0 10px; }
  .is-systems .mz-side {
    position: relative;
    inset: auto;
    flex: 0 0 min(300px, 32vw);
    width: min(300px, 32vw);
    height: auto;
    transform: none;
    transition: none;
    z-index: 3;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .is-systems.panel-open .mz-side { transform: none; }
  .is-systems .mz-paneltoggle { display: none; }
  .is-boq .mz-side { display: none; }
}
@media (max-width: 720px) {
  .is-systems .mz-side {
    position: fixed;
    top: 52px;
    right: 0;
    bottom: 58px;
    left: auto;
    width: min(300px, 86vw);
    height: auto;
    transform: translateX(100%);
    transition: transform 200ms ease-out;
    z-index: 60;
  }
  .is-systems.panel-open .mz-side { transform: translateX(0); }
  .is-systems .mz-paneltoggle { display: inline-flex; }
  .is-systems .mz-systemspanel__head .mz-icon { display: inline-flex; }
}
@media (max-width: 640px) {
  .mz-tabs .mz-tab { padding: 0 10px; }
  .mz-hist { display: none; }
  .mz-hint { right: 66px; }
  .mz-bar { gap: 4px; padding: 0 5px; }
  .mz-proj { max-width: 86px; padding: 0 7px; }
  .mz-flow__tab { padding: 0 7px; font-size: 11px; }
  .mz-viewtabs { display: none; }
  .mz-sync { display: none; }
  .mz-boq__head { gap: 6px; }
  .mz-boq__head > div span, .mz-boq__head label > span { display: none; }
  .mz-boq__table th, .mz-boq__table td { padding-left: 8px; padding-right: 8px; }
}
