:root {
  --paper: #f3efe7; --sheet: #f8f5ef; --side: #e8e2d6; --ink: #24221e; --ink2: #4a463f; --muted: #6b6459; --line: #d9d1c3;
  --accent: #5f7a5e; --accent-d: #4d654c; --amber: #b7841f; --amber-bg: #fbf0d3; --red: #b4483c; --red-bg: #f7e1dc; --green: #4f7a4f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
:root {
  color-scheme: light dark;
  --bg-dfe6dc: #dfe6dc;
  --bg-e1ebf2: #e1ebf2;
  --bg-e2dccf: #e2dccf;
  --bg-e3eee1: #e3eee1;
  --bg-e9e4da: #e9e4da;
  --bg-e9efe6: #e9efe6;
  --bg-ebe6dc: #ebe6dc;
  --bg-ebe7df: #ebe7df;
  --bg-ece7de: #ece7de;
  --bg-ede6da: #ede6da;
  --bg-eef2ec: #eef2ec;
  --bg-eef4ec: #eef4ec;
  --bg-f1ede5: #f1ede5;
  --bg-f1f6ef: #f1f6ef;
  --bg-f3efe7: #f3efe7;
  --bg-f3f7f1: #f3f7f1;
  --bg-f4ecd9: #f4ecd9;
  --bg-fbf9f5: #fbf9f5;
  --bg-fdfcfa: #fdfcfa;
  --bg-fff8ec: #fff8ec;
  --bg-ffffff: #ffffff;
  --fg-1f1e1c: #1f1e1c;
  --fg-2e2b27: #2e2b27;
  --fg-34312c: #34312c;
  --fg-3a3631: #3a3631;
  --fg-3b3935: #3b3935;
  --fg-3b7be0: #3b7be0;
  --fg-3f6d8f: #3f6d8f;
  --fg-3f7a4f: #3f7a4f;
  --fg-4a463f: #4a463f;
  --fg-4b463e: #4b463e;
  --fg-5a5347: #5a5347;
  --fg-6aa7c4: #6aa7c4;
  --fg-6d4a06: #6d4a06;
  --fg-6d665b: #6d665b;
  --fg-6f6a60: #6f6a60;
  --fg-7a5538: #7a5538;
  --fg-7d756a: #7d756a;
  --fg-7d766a: #7d766a;
  --fg-7d8287: #7d8287;
  --fg-8a5a12: #8a5a12;
  --fg-8a6a1f: #8a6a1f;
  --fg-8a8274: #8a8274;
  --fg-8b8478: #8b8478;
  --fg-9a9284: #9a9284;
  --fg-9b9385: #9b9385;
  --fg-a3741a: #a3741a;
  --fg-a99f8d: #a99f8d;
  --fg-b3402c: #b3402c;
  --fg-b3aa9b: #b3aa9b;
  --fg-b6ac9b: #b6ac9b;
  --fg-b7841f: #b7841f;
  --fg-b9c7b5: #b9c7b5;
  --fg-b9cfe0: #b9cfe0;
  --fg-bcd2b7: #bcd2b7;
  --fg-c4baa9: #c4baa9;
  --fg-c9bfae: #c9bfae;
  --fg-c9c1b3: #c9c1b3;
  --fg-cdc4b4: #cdc4b4;
  --fg-cfc6b6: #cfc6b6;
  --fg-cfc8bb: #cfc8bb;
  --fg-cfdccb: #cfdccb;
  --fg-cfdde2: #cfdde2;
  --fg-d39a2a: #d39a2a;
  --fg-d3cabb: #d3cabb;
  --fg-d8c08a: #d8c08a;
  --fg-d9d2c4: #d9d2c4;
  --fg-dbe8fb: #dbe8fb;
  --fg-ddd5c7: #ddd5c7;
  --fg-dde7d9: #dde7d9;
  --fg-dfe7ea: #dfe7ea;
  --fg-e0cfa6: #e0cfa6;
  --fg-e3dccf: #e3dccf;
  --fg-e4ddd0: #e4ddd0;
  --fg-e6dfd2: #e6dfd2;
  --fg-e6dfd3: #e6dfd3;
  --fg-e8e1d3: #e8e1d3;
  --fg-e8e1d5: #e8e1d5;
  --fg-ebe8e1: #ebe8e1;
  --fg-ecd59a: #ecd59a;
  --fg-ecd9ae: #ecd9ae;
  --fg-ece6db: #ece6db;
  --fg-efc9c1: #efc9c1;
  --fg-efe9df: #efe9df;
  --fg-efede6: #efede6;
  --fg-f0ebe2: #f0ebe2;
  --fg-f1ede5: #f1ede5;
  --fg-f3eee6: #f3eee6;
  --fg-f6f2ea: #f6f2ea;
  --fg-f6f5f0: #f6f5f0;
  --fg-f7f4ee: #f7f4ee;
  --fg-fbfaf7: #fbfaf7;
  --fg-fff3d6: #fff3d6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1a17; --sheet: #24211d; --side: #151311; --ink: #ece6da; --ink2: #cfc8ba; --muted: #a39b8c; --line: #3a352e;
    --accent: #5f7a5e; --accent-d: #a9c9a6; --amber: #e0b457; --amber-bg: #3a2f15; --red: #e08a7c; --red-bg: #3d2420; --green: #8fc19a;
    --blue: #6fa3ee;
    --bg-dfe6dc: #303c2b;
    --bg-e1ebf2: #20394b;
    --bg-e2dccf: #1e1c17;
    --bg-e3eee1: #2b4426;
    --bg-e9e4da: #211e19;
    --bg-e9efe6: #32422a;
    --bg-ebe6dc: #221f1a;
    --bg-ebe7df: #22201a;
    --bg-ece7de: #221f1a;
    --bg-ede6da: #221f1a;
    --bg-eef2ec: #34422d;
    --bg-eef4ec: #304729;
    --bg-f1ede5: #24211b;
    --bg-f1f6ef: #324829;
    --bg-f3efe7: #25221c;
    --bg-f3f7f1: #344829;
    --bg-f4ecd9: #4a3d20;
    --bg-fbf9f5: #28251e;
    --bg-fdfcfa: #29261f;
    --bg-fff8ec: #28241e;
    --bg-ffffff: #2a2721;
    --fg-1f1e1c: #edeceb;
    --fg-2e2b27: #e1dfdc;
    --fg-34312c: #dcdad6;
    --fg-3a3631: #d7d4d0;
    --fg-3b3935: #d3d2cf;
    --fg-3b7be0: #568adc;
    --fg-3f6d8f: #82a7c3;
    --fg-3f7a4f: #95c4a2;
    --fg-4a463f: #c9c6c0;
    --fg-4b463e: #cac6c0;
    --fg-5a5347: #c0bbb1;
    --fg-6aa7c4: #71a7c1;
    --fg-6d4a06: #f6dcaa;
    --fg-6d665b: #aca79e;
    --fg-6f6a60: #a8a49c;
    --fg-7a5538: #caad96;
    --fg-7d756a: #a19a91;
    --fg-7d766a: #a19b91;
    --fg-7d8287: #95999d;
    --fg-8a5a12: #eac58c;
    --fg-8a6a1f: #dfc68a;
    --fg-8a8274: #a19b91;
    --fg-8b8478: #a09b92;
    --fg-9a9284: #a29b90;
    --fg-9b9385: #a29b90;
    --fg-a3741a: #e2bc74;
    --fg-a99f8d: #a69d8c;
    --fg-b3402c: #d17363;
    --fg-b3aa9b: #6e6556;
    --fg-b6ac9b: #6e6453;
    --fg-b7841f: #dcb360;
    --fg-b9c7b5: #465542;
    --fg-b9cfe0: #283f52;
    --fg-bcd2b7: #3c5336;
    --fg-c4baa9: #615645;
    --fg-c9bfae: #5c5140;
    --fg-c9c1b3: #574e40;
    --fg-cdc4b4: #564c3c;
    --fg-cfc6b6: #544a3a;
    --fg-cfc8bb: #4f473a;
    --fg-cfdccb: #313f2c;
    --fg-cfdde2: #26363c;
    --fg-d39a2a: #d6ad5c;
    --fg-d3cabb: #4f4535;
    --fg-d8c08a: #806731;
    --fg-d9d2c4: #463f2f;
    --fg-dbe8fb: #091a35;
    --fg-ddd5c7: #433b2b;
    --fg-dde7d9: #263221;
    --fg-dfe7ea: #1e282c;
    --fg-e0cfa6: #655328;
    --fg-e3dccf: #3c3425;
    --fg-e4ddd0: #3b3324;
    --fg-e6dfd2: #393122;
    --fg-e6dfd3: #383022;
    --fg-e8e1d3: #38301f;
    --fg-e8e1d5: #362e1f;
    --fg-ebe8e1: #2a261d;
    --fg-ecd59a: #71591b;
    --fg-ecd9ae: #5e491b;
    --fg-ece6db: #30291b;
    --fg-efc9c1: #4b2017;
    --fg-efe9df: #2c2518;
    --fg-efede6: #252219;
    --fg-f0ebe2: #292317;
    --fg-f1ede5: #272116;
    --fg-f3eee6: #282115;
    --fg-f6f2ea: #1c1a17;
    --fg-f6f5f0: #252318;
    --fg-f7f4ee: #292215;
    --fg-fbfaf7: #282315;
    --fg-fff3d6: #3a2a03;
  }
  body { color-scheme: dark; }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; background: var(--paper); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-d); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ic { width: 17px; height: 17px; flex: none; }

/* ---------- sidebar ---------- */
#side { width: 256px; flex: none; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.side-top { padding: 22px 22px 10px; }
.brand { display: flex; align-items: center; gap: 9px; margin: -4px 0 18px; font: 600 19px/1 var(--serif); letter-spacing: .01em; color: var(--ink); }
.brand svg { width: 22px; height: 22px; flex: none; fill: var(--ink); }
.brand svg .p { fill: var(--side); }
.eyebrow { font: 600 10.5px var(--mono); letter-spacing: .12em; color: var(--muted); margin-bottom: 6px; }
#room-pick { width: 100%; font: 600 15px var(--serif); padding: 9px 10px; border: 1px solid var(--fg-cfc6b6); background: var(--bg-fbf9f5); border-radius: 4px; color: var(--ink); }
.asof { font: 12px var(--mono); color: var(--muted); margin-top: 7px; letter-spacing: .04em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#room-export { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 0; font: 12px var(--mono); letter-spacing: .04em; color: var(--accent-d); }
#room-export .ic { width: 13px; height: 13px; }
#room-export:hover { color: var(--ink); }
nav { padding: 8px 14px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 5px; color: var(--ink); font-size: 14px; }
.nav:hover { background: rgba(0,0,0,.045); text-decoration: none; }
.nav.on { background: var(--accent); color: #fff; }
.nav span:not(.badge) { flex: 1; }
.nav.add { margin-top: 10px; color: var(--muted); border-top: 1px solid var(--line); border-radius: 0; padding-top: 14px; }
.nav.add.on { color: #fff; border-radius: 5px; }
.badge { font: 600 11px var(--mono); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--red-bg); color: var(--red); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.soft { background: rgba(0,0,0,.06); color: var(--ink2); }
.nav.on .badge { background: rgba(255,255,255,.22); color: #fff; }
.ok { color: var(--green); } .bad { color: var(--red); }
.conf-measured { color: var(--green); } .conf-documented { color: var(--fg-3f6d8f); } .conf-estimated { color: var(--fg-8a6a1f); } .conf-assumed { color: var(--amber); }

/* ---------- top bar ---------- */
#wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
#top { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 22px; border-bottom: 1px solid var(--line); background: var(--bg-fbf9f5); }
.ur { display: flex; align-items: center; gap: 6px; }
.ur button { border: 0; background: none; color: var(--ink2); padding: 6px; border-radius: 4px; display: flex; }
.ur button:disabled { color: var(--fg-c9c1b3); cursor: default; }
.ur button:not(:disabled):hover { background: rgba(0,0,0,.05); }
.save { font: 12px var(--mono); color: var(--muted); margin-left: 10px; }
.save.error { color: var(--red); }
.togs { display: flex; gap: 8px; }
.tog { display: flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); border-radius: 4px; color: var(--muted); font-size: 12.5px; }
.tog .ic { width: 15px; height: 15px; }
.tog.on { background: var(--bg-dfe6dc); border-color: var(--fg-b9c7b5); color: var(--ink); }
main { flex: 1; overflow: auto; min-height: 0; }

/* ---------- pages ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 34px 40px 60px; }
.ph { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
h1 { font: 700 32px/1.15 var(--serif); margin: 0; letter-spacing: -.01em; }
h2 { font: 600 18px var(--serif); margin: 0; display: flex; align-items: center; gap: 8px; }
h3 { font: 600 17px var(--serif); margin: 2px 0 4px; }
.sub { color: var(--muted); margin-top: 4px; }
.lede { font-size: 15.5px; color: var(--ink2); margin: 14px 0 4px; max-width: 760px; }
.dimsline { font: 13.5px var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); margin: 0 0 22px; }
.chip { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 5px 12px; border-radius: 14px; border: 1px solid currentColor; background: #fff8; white-space: nowrap; }
.chip.conf-assumed { background: var(--amber-bg); border-color: var(--fg-ecd59a); }
.chip.conf-estimated { background: var(--bg-f4ecd9); border-color: var(--fg-e0cfa6); }
.chip.conf-measured { background: var(--bg-e3eee1); border-color: var(--fg-bcd2b7); }
.chip.conf-documented { background: var(--bg-e1ebf2); border-color: var(--fg-b9cfe0); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi { position: relative; display: block; background: var(--bg-fdfcfa); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; color: var(--ink); box-shadow: 0 1px 2px rgba(60,50,30,.05); }
.kpi:hover { text-decoration: none; border-color: var(--fg-c4baa9); }
.kpi-ic { width: 34px; height: 34px; border-radius: 6px; background: var(--bg-ebe6dc); display: flex; align-items: center; justify-content: center; color: var(--accent-d); margin-bottom: 16px; }
.kpi-l { font: 600 15px var(--serif); color: var(--ink2); }
.kpi-v { font: 700 30px/1.2 var(--serif); margin-top: 2px; }
.kpi-v small { font: 13px var(--mono); color: var(--muted); margin-left: 6px; }
.kpi-s { font-size: 13px; color: var(--muted); margin-top: 4px; }

.card { background: var(--bg-fdfcfa); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(60,50,30,.04); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--fg-ece6db); }
.card > :not(.card-h) { margin-left: 20px; margin-right: 20px; }
.card > table.qt, .card > table.kv, .card > table.mt, .card > div.ba-grid { margin-left: 0; margin-right: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two .card { margin-bottom: 18px; }
.ba-grid { display: grid; grid-template-columns: 1fr 1fr; }
.ba-grid figure { position: relative; margin: 0; aspect-ratio: 4 / 3.4; background: var(--bg-e9e4da); overflow: hidden; }
.ba-grid figure + figure { border-left: 1px solid var(--line); }
.ba-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-grid figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 10px; color: #fff; font-size: 12.5px; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.tag { position: absolute; top: 10px; left: 10px; font: 600 10.5px var(--mono); letter-spacing: .1em; color: #fff; background: rgba(30,28,25,.72); padding: 4px 9px; border-radius: 10px; }
.ph-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font: 13px var(--mono); border: 1px dashed var(--fg-cdc4b4); margin: 14px; border-radius: 4px; height: calc(100% - 28px); }
.thumbs { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.thumbs button { width: 42px; height: 42px; padding: 0; border: 2px solid rgba(255,255,255,.6); border-radius: 4px; overflow: hidden; background: none; opacity: .75; }
.thumbs button.on { border-color: #fff; opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

ul.scope, ul.oi, ul.val, ul.edges { list-style: none; padding: 10px 0 14px; margin: 0 20px; }
.scope li { display: flex; gap: 10px; padding: 5px 0; }
.scope .mk { width: 14px; color: var(--muted); }
.scope li.done .mk { color: var(--green); font-weight: 700; }
.scope em { font: 11.5px var(--mono); font-style: normal; color: var(--green); }
.oi li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--fg-f0ebe2); }
.oi li:last-child { border-bottom: 0; }
.sev { font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 9px; height: fit-content; margin-top: 2px; flex: none; width: 62px; text-align: center; }
.sev.high { background: var(--red-bg); color: var(--red); } .sev.medium { background: var(--amber-bg); color: var(--amber); } .sev.low { background: var(--bg-ebe7df); color: var(--muted); }
.blocks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.blocks span { font: 11px var(--mono); color: var(--muted); background: var(--bg-f1ede5); padding: 1px 7px; border-radius: 3px; }
.oi.big li { padding: 11px 0; }
.val li { padding: 7px 0; display: flex; gap: 10px; align-items: baseline; border-bottom: 1px solid var(--fg-f0ebe2); }
.val li:last-child { border-bottom: 0; }
.val .code { font: 600 10.5px var(--mono); color: var(--muted); letter-spacing: .05em; min-width: 140px; }
.val li.error { color: var(--red); } .val li.warn { color: var(--fg-8a5a12); }
.val li.okline { color: var(--green); }

/* the estimate that leads the Overview */
.estimate { display: grid; grid-template-columns: minmax(240px, 1fr) 1.6fr; align-items: stretch; background: var(--bg-fdfcfa); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 2px rgba(60,50,30,.05); margin: 0 0 18px; overflow: hidden; }
.est-total { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 22px 24px; background: var(--accent-d); color: #fff; }
.est-total:hover { text-decoration: none; background: var(--accent); }
.est-l { font: 600 15px var(--serif); opacity: .92; }
.est-v { font: 700 44px/1.1 var(--serif); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.est-s { font-size: 13px; opacity: .85; margin-top: 4px; }
.est-rows { list-style: none; margin: 0; padding: 6px 0; display: grid; align-content: center; }
.est-rows li + li { border-top: 1px solid var(--fg-f0ebe2); }
.est-rows a { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 24px; color: var(--ink); }
.est-rows a:hover { background: var(--bg-f3efe7); text-decoration: none; }
.er-l { font-size: 15px; }
.er-l em { font-style: normal; font-size: 13.5px; color: var(--muted); margin-left: 10px; }
.er-v { font: 600 16px var(--sans); font-variant-numeric: tabular-nums; }

/* ---------- drawings ---------- */
.view-plan, .view-walls, .view-unfolded, .view-3d { display: flex; flex-direction: column; }
.dh { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--bg-fbf9f5); }
.dh-t { display: flex; align-items: baseline; gap: 12px; }
.walls-h .dh-t { flex: 1; justify-content: center; }
.wnav { color: var(--ink2); font-size: 14px; }
.wall-tabs { display: flex; gap: 6px; justify-content: center; padding: 10px; }
.wall-tabs a { font: 600 13px var(--serif); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--ink2); background: var(--bg-fbf9f5); }
.wall-tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.wall-tabs a:hover { text-decoration: none; }
.wall-tabs .wt-step, .dh-t .t-short, .rm-eyebrow { display: none; }
.plan-zoom, .plan-key { display: none; }
.dim-ext.leader, .dim2-ext.leader { stroke: var(--fg-8b8478); stroke-width: 0.3; }
.sheet { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px 26px; }
.sheet svg { width: 100%; height: 100%; max-height: calc(100vh - 210px); }
.view-plan .sheet svg { max-height: calc(100vh - 170px); }
.view-walls .sheet { padding: 10px 14px; }
.view-walls .sheet svg { max-height: calc(100vh - 200px); }
.wall-facts { display: flex; gap: 8px 24px; justify-content: center; font: 13.5px var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); padding: 4px 20px 16px; flex-wrap: wrap; }
.legend { display: flex; gap: 18px; justify-content: center; font: 13.5px var(--sans); color: var(--muted); padding: 0 0 16px; }
.legend .lg { display: inline-block; width: 22px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.lg.c-meas { border-color: var(--ink); } .lg.c-doc { border-color: var(--fg-3f6d8f); } .lg.c-est { border-color: var(--fg-8a6a1f); border-top-style: dashed; } .lg.c-asm { border-color: var(--amber); border-top-style: dotted; border-top-width: 3px; }

svg.drawing { font-family: var(--mono); }
.wallband { fill: var(--fg-34312c); }
.veil { fill: var(--fg-f6f2ea); opacity: .5; stroke: none !important; pointer-events: none; }
.wall-in { stroke-width: 0.7; fill: none; }
.wall-in.c-meas { stroke: var(--ink); } .wall-in.c-doc { stroke: var(--fg-3f6d8f); } .wall-in.c-est { stroke: var(--fg-b7841f); stroke-dasharray: 3 2; } .wall-in.c-asm { stroke: var(--fg-d39a2a); stroke-dasharray: 1.2 1.6; stroke-width: 1; }
.jamb { stroke: var(--fg-34312c); stroke-width: 0.8; }
.door-leaf { stroke: var(--ink); stroke-width: 0.9; }
.door-arc { fill: none; stroke: var(--fg-7d766a); stroke-width: 0.45; stroke-dasharray: 2 1.5; }
.win-plan { fill: var(--fg-dbe8fb); stroke: var(--blue, var(--fg-3b7be0)); stroke-width: 0.5; }
.win-line { stroke: var(--fg-3b7be0); stroke-width: 0.4; }
.fx rect, .fx ellipse { stroke: var(--fg-4a463f); stroke-width: 0.45; }
.fx.c-asm rect, .fx.c-asm ellipse, .fx.c-est rect, .fx.c-est ellipse { stroke-dasharray: 1.6 1.1; }
.fx-white { fill: var(--fg-fbfaf7); } .fx-inner { fill: var(--fg-ebe8e1); } .fx-vanity { fill: var(--fg-efe9df); } .fx-shower { stroke: var(--fg-6f6a60) !important; }
.drain { fill: var(--fg-3b3935); }
.tap { fill: var(--fg-1f1e1c); stroke: none !important; }
.glass { stroke: var(--fg-6aa7c4); stroke-width: 1.1; }
.curtain { stroke: var(--fg-6f6a60); stroke-width: 0.8; stroke-dasharray: 1 1; }
.ceil-item { fill: none; stroke: var(--fg-6f6a60); stroke-width: 0.4; stroke-dasharray: 1 1; }
.wall-letter { font-family: var(--serif); font-weight: 700; fill: var(--accent-d); }
.plan .wall-letter, .plan .lbl-small, .plan .dim-t, .plan .dim2-t, .zone-lbl, .elev .lbl-small, .unfolded .lbl-small { paint-order: stroke; stroke: var(--fg-f6f2ea); stroke-width: 0.6; stroke-linejoin: round; }
.corner { fill: var(--fg-9b9385); letter-spacing: .04em; }
.lbl-small { fill: var(--fg-4b463e); letter-spacing: .06em; }
.lbl-small.asm { fill: var(--fg-7d756a); }
.dim-l, .dim2-l { stroke: var(--fg-8b8478); stroke-width: 0.35; }
.dim-ext, .dim2-ext { stroke: var(--fg-b3aa9b); stroke-width: 0.25; }
.dim-tk, .dim2-tk { stroke: var(--fg-6d665b); stroke-width: 0.45; }
.dim-t { fill: var(--fg-4b463e); } .dim2-t { fill: var(--fg-7d756a); }
.dim.c-asm .dim-t, .dim.c-est .dim-t { fill: var(--fg-a3741a); }
.paint-field { stroke: none; }
.zone { stroke: var(--fg-a99f8d); stroke-width: 0.3; }
.courses line { stroke: var(--fg-f7f4ee); stroke-width: 0.45; opacity: .95; }
.zone-lbl { fill: var(--fg-5a5347); letter-spacing: .06em; }
.leader { stroke: var(--fg-6d665b); stroke-width: 0.5px; vector-effect: non-scaling-stroke; fill: none; }
.un-stack { display: none; }
.wall-outline { fill: none; stroke: var(--fg-2e2b27); stroke-width: 0.9; }
.wall-outline.c-asm { stroke-dasharray: 2.5 1.5; } .wall-outline.c-est { stroke-dasharray: 5 2; }
.floor-line { stroke: var(--fg-2e2b27); stroke-width: 1.2; }
.edge-trim { stroke: var(--fg-1f1e1c); stroke-width: 0.9; }
.el-white { fill: var(--fg-fbfaf7); stroke: var(--fg-6f6a60); stroke-width: 0.4; }
.el-fine { stroke: var(--fg-9a9284); stroke-width: 0.3; fill: none; }
.el-black { fill: var(--fg-1f1e1c); }
.el-handle { stroke: var(--fg-1f1e1c); stroke-width: 0.9; stroke-linecap: round; }
.el-cab { fill: var(--fg-e8e1d5); stroke: var(--fg-6f6a60); stroke-width: 0.4; }
.el-cab.walnut { fill: var(--fg-7a5538); }
.el-kick { fill: var(--fg-3a3631); }
.el-top { fill: var(--fg-f1ede5); stroke: var(--fg-6f6a60); stroke-width: 0.35; }
.el-casing { fill: var(--fg-f6f5f0); stroke: var(--fg-8b8478); stroke-width: 0.35; }
.el-door { fill: var(--fg-efede6); stroke: var(--fg-8b8478); stroke-width: 0.35; }
.el-win { fill: var(--fg-dbe8fb); stroke: var(--fg-3b7be0); stroke-width: 0.7; }
.el-win-x { stroke: var(--fg-3b7be0); stroke-width: 0.5; stroke-dasharray: 2 1.5; }
.el-mirror { fill: var(--fg-dfe7ea); stroke: var(--fg-6f6a60); stroke-width: 0.5; }
.el-glint { stroke: #fff; stroke-width: 0.6; opacity: .8; }
.el-bulb { fill: var(--fg-fff3d6); stroke: var(--fg-d8c08a); stroke-width: 0.25; }
.el-niche { fill: var(--fg-cfc8bb); stroke: var(--fg-6f6a60); stroke-width: 0.4; }
.el-wood { fill: var(--fg-7a5538); }
.el-plate { fill: var(--fg-fbfaf7); stroke: var(--fg-8b8478); stroke-width: 0.3; }
.c-asm.el-white, .c-asm .el-white, .c-asm .el-cab, .c-asm .el-mirror, .c-asm .el-casing { stroke-dasharray: 1.6 1; }
.fold { stroke: var(--fg-b3aa9b); stroke-width: 0.35; stroke-dasharray: 2 2; }

/* ---------- editing ---------- */
.edit-wrap { flex: 1; min-height: 0; display: flex; }
.edit-wrap .sheet { min-width: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.hit { fill: transparent; stroke: none !important; }
[data-oid] { cursor: grab; }
[data-oid]:hover .hit { fill: rgba(95,122,94,.10); }
.selbox { fill: none !important; stroke: var(--fg-3f7a4f) !important; stroke-width: 1 !important; stroke-dasharray: 2.5 1.5 !important; pointer-events: none; }
.fx-label, .plan text, .elev text, .unfolded text, .door-arc, .door-leaf, .dim, .dim2 { pointer-events: none; }
.insp { width: 292px; flex: none; border-left: 1px solid var(--line); background: var(--bg-fbf9f5); padding: 16px 18px; overflow: auto; }
.insp h3 { margin: 0 0 10px; font: 600 16px var(--serif); }
.insp h4 { font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.insp-h { display: flex; justify-content: space-between; align-items: center; }
.insp-h .x { border: 0; background: none; font-size: 20px; color: var(--muted); padding: 0 4px; }
.addgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.addgrid button { display: flex; align-items: center; gap: 6px; border: 1px solid var(--fg-d3cabb); background: var(--bg-ffffff); border-radius: 4px; padding: 6px 8px; font-size: 13px; color: var(--ink2); text-align: left; }
.addgrid button:hover { border-color: var(--accent); color: var(--ink); }
.addgrid .ic { width: 13px; height: 13px; color: var(--accent-d); }
.hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; line-height: 1.45; }
.readout { font: 12px var(--mono); color: var(--accent-d); background: var(--bg-eef2ec); border-radius: 4px; padding: 6px 8px; margin: 0 0 10px; min-height: 28px; }
.fl { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0; font-size: 13px; color: var(--ink2); }
.fl .fi { display: flex; align-items: center; gap: 6px; }
.fl input.len { width: 70px; font: 13px var(--mono); padding: 5px 7px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); }
.fl input.len.bad { border-color: var(--red); background: var(--red-bg); }
.fl em { font: normal 11px var(--mono); color: var(--muted); min-width: 34px; }
.fl input.txt { width: 160px; font: 13px var(--sans); padding: 5px 7px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; }
.fl select { font: 13px var(--sans); padding: 4px 6px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); max-width: 160px; }
.insp-btns { display: flex; gap: 8px; margin-top: 14px; }
.insp-btns button { flex: 1; border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); padding: 7px 10px; border-radius: 4px; font-size: 13px; }
.insp-btns .danger { color: var(--red); }
table.mini td { padding: 3px 0; font-size: 13px; color: var(--ink2); }
table.mini input.len { width: 70px; font: 13px var(--mono); padding: 4px 6px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; }
table.mini .fmt { font: 11px var(--mono); color: var(--muted); margin-left: 6px; }

/* ---------- tile swapping ---------- */
.srow { padding: 10px 0; border-bottom: 1px solid var(--fg-ece6db); }
.srow:last-of-type { border-bottom: 0; }
.slbl { font-size: 12.5px; color: var(--ink2); margin-bottom: 5px; font-weight: 600; }
.spick { width: 100%; font: 13px var(--sans); padding: 6px 7px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); }
.sopts { display: flex; gap: 6px; margin-top: 6px; }
.sopts select { flex: 1; font: 12.5px var(--sans); padding: 4px 5px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-fbf9f5); }
.surfgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 22px; padding: 6px 0 12px; }
.surfgrid .srow { border-bottom: 0; }
@media (min-width: 768px) {
  .surfgrid { grid-template-columns: 1fr; }
  .surfgrid .srow { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; grid-template-rows: auto 1fr; gap: 6px 28px; align-items: start; }
  .surfgrid .srow .slbl { grid-area: 1 / 1; margin: 0; }
  .surfgrid .srow .spick { grid-area: 2 / 1; align-self: start; }
  .surfgrid .srow .layout { grid-area: 1 / 2 / 3 / 3; margin: 0; max-width: 520px; }
}
.libgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 14px 0; }
.libtile { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; }
.libtile img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--bg-ebe6dc); flex: none; }
.libf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 4px 0 18px; border-top: 1px solid var(--fg-ece6db); }
.libf h4 { grid-column: 1 / -1; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 0; }
.libf label { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink2); }
.libf input, .libf select { font: 13px var(--sans); padding: 6px 8px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); }
.libf input[type=color] { padding: 2px; height: 32px; }
.libf .two-in { display: flex; align-items: center; gap: 6px; }
.libf .two-in input { width: 70px; }
.libf .row { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.libf button { border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); padding: 7px 14px; border-radius: 4px; }
.view-3d .edit-wrap .three { flex: 1; min-width: 0; }
.insp.surf { width: 280px; }
.wi-line { stroke: var(--fg-1f1e1c); stroke-width: 0.7; }
.wi-black { fill: var(--fg-1f1e1c); }
.wi-mirror { fill: var(--fg-cfdde2); stroke: var(--fg-6f6a60); stroke-width: 0.3; }
.wi-niche { fill: var(--fg-e6dfd3); stroke: var(--fg-4a463f); stroke-width: 0.45; stroke-dasharray: 1.2 0.8; }
.wi-wood { fill: var(--fg-7a5538); }
.wi-plate { fill: var(--fg-fbfaf7); stroke: var(--fg-8b8478); stroke-width: 0.3; }
.curb { stroke: var(--fg-4a463f); stroke-width: 0.45; }
.curb-el { stroke: var(--fg-6f6a60); stroke-width: 0.4; }
.pony { stroke: var(--fg-34312c); stroke-width: 0.7; stroke-linejoin: round; }
.pony-el { stroke: var(--fg-34312c); stroke-width: 0.55; }

/* ---------- 3d ---------- */
.cam { display: flex; align-items: center; gap: 8px; }
.cam button { border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); padding: 4px 10px; border-radius: 4px; font-size: 12.5px; color: var(--ink2); }
.cam .muted { font-size: 12px; margin-left: 6px; }
.three { position: relative; flex: 1; min-height: 0; background: var(--bg-ede6da); }
.three canvas { display: block; }
.tip { position: absolute; display: none; pointer-events: none; background: rgba(250,247,240,.96); color: var(--ink); font: 12px var(--mono); padding: 6px 9px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap; z-index: 2; }
.no3d { color: var(--fg-e8e1d3); padding: 60px; text-align: center; font-size: 14px; line-height: 1.7; }
/* the 3D view's own controls, on the picture */
.navpad { position: absolute; right: 14px; bottom: 14px; z-index: 3; display: grid; gap: 7px; padding: 8px; border-radius: 10px; background: rgba(28,27,25,.8); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 4px 16px rgba(0,0,0,.35); user-select: none; -webkit-user-select: none; touch-action: none; }
.navpad button { display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); color: var(--fg-4a463f); border-radius: 5px; padding: 0; font-size: 12px; }
.navpad button:hover { background: #fff; color: var(--ink); }
.navpad button:active { background: var(--bg-dfe6dc); }
.navpad .ic { width: 15px; height: 15px; }
.np-fab { display: none; }
.np-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.np-mode button { height: 28px; padding: 0 9px; color: var(--muted); }
.np-mode button.on { background: var(--bg-dfe6dc); border-color: var(--fg-b9c7b5); color: var(--ink); font-weight: 600; }
.np-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.np-pad { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 30px); gap: 3px; }
.np-pad [data-nav=up] { grid-area: 1 / 2; }
.np-pad [data-nav=left] { grid-area: 2 / 1; }
.np-pad [data-nav=fit] { grid-area: 2 / 2; }
.np-pad [data-nav=right] { grid-area: 2 / 3; }
.np-pad [data-nav=down] { grid-area: 3 / 2; }
.np-zoom { display: grid; grid-template-rows: 30px 30px; gap: 3px; }
.np-zoom button { width: 30px; }
/* the 3D rail: every item by name, and a surface's way to its item */
details.items { margin: 0 0 14px; border: 1px solid var(--fg-ddd5c7); border-radius: 6px; background: var(--bg-ffffff); }
details.items summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; font: 600 12.5px var(--sans); color: var(--ink2); list-style: none; }
details.items summary::-webkit-details-marker { display: none; }
details.items summary::before { content: '▸'; color: var(--muted); font-size: 11px; width: 9px; }
details.items[open] summary::before { content: '▾'; }
details.items summary .badge { margin-left: auto; }
details.items .hint { margin: 0 10px 8px; }
.itemlist { display: grid; gap: 3px; padding: 0 8px 8px; }
.itemlist button { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; border: 1px solid var(--fg-e4ddd0); background: var(--bg-fbf9f5); border-radius: 4px; padding: 5px 7px; font-size: 12.5px; color: var(--ink); text-align: left; }
.itemlist button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itemlist button em { flex: none; font: 10.5px var(--mono); color: var(--muted); }
.itemlist button:hover { border-color: var(--accent); }
.itemlist button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--bg-f3f7f1); }
/* a card in the Tile list opens that surface's details: the arrow says so */
.surflist .surfbtn { position: relative; padding-right: 26px; cursor: pointer; }
.surfbtn .sgo { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 17px/1 var(--sans); color: var(--fg-b6ac9b); font-style: normal; }
.surfbtn:hover .sgo { color: var(--accent-d); }
/* a part's details (a pony wall, a curb, a wall, a surface): the way back above its name, the item it belongs to under its numbers */
.partback { display: block; border: 0; background: none; padding: 0 0 8px; font: 600 12px var(--sans); color: var(--accent-d); cursor: pointer; }
.partback:hover { text-decoration: underline; }
.partup { display: block; width: 100%; margin: 10px 0 2px; text-align: left; border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); border-radius: 5px; padding: 7px 9px; font: 12.5px var(--sans); color: var(--ink); cursor: pointer; }
.partup:hover { border-color: var(--accent); background: var(--bg-eef4ec); }
.partchips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 10px 0 2px; }
.partchips > span { font-size: 11.5px; font-weight: 600; color: var(--ink2); margin-right: 2px; }
.insp.part .tilework { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--fg-e3dccf); }
.insp.part .itemlist.flat { padding: 0; }
.insp.part .part-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; justify-content: start; padding: 6px 0 2px; }
.insp.part ul.edges { margin: 0; padding: 2px 0 6px; }
.insp.part table.mini { margin: 0; }
/* an item's details in the 3D rail are one panel, not a panel inside a panel */
#panel3d > .insp { width: auto; border: 0; padding: 0; background: none; overflow: visible; }
#panel3d > .insp + details.items { margin-top: 20px; }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; }
.qt th, .mt th { text-align: left; font: 600 13px var(--sans); color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--fg-e6dfd3); }
.qt td, .mt td { padding: 10px 12px; border-bottom: 1px solid var(--fg-f0ebe2); vertical-align: top; }
.qt th:first-child, .qt td:first-child, .mt th:first-child, .mt td:first-child { padding-left: 20px; }
.n { text-align: right; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.qt tr.sub td { padding-top: 3px; padding-bottom: 3px; color: var(--muted); font-size: 13.5px; border-bottom: 0; }
.qt tr.sub td:first-child { padding-left: 34px; }
.qt tr.mat td { border-top: 1px solid var(--fg-e6dfd3); }
.math { font: 13.5px/1.5 var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); margin-top: 3px; }
.qt.tiles td.n small { display: none; }
.short { font: 600 13px var(--mono); color: var(--red); }
.okc { font: 600 13px var(--mono); color: var(--green); }
.kv { margin: 6px 0 10px; }
.kv td { padding: 6px 20px; border-bottom: 1px solid var(--fg-f3eee6); }
.kv tr.tot td { font-weight: 600; }
.kv td.math { padding-top: 10px; }
.bywall { display: flex; gap: 8px 18px; flex-wrap: wrap; font: 13.5px var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); padding: 0 0 14px; }
.bywall b { color: var(--ink2); font-weight: 500; }
.edges li { font: 13.5px var(--sans); font-variant-numeric: tabular-nums; color: var(--ink2); padding: 3px 0; }

/* ---------- materials ---------- */
.mgrid { align-items: start; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 18px 0 22px; }
.mcard { background: var(--bg-fdfcfa); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.mcard .sw { height: 170px; background: var(--bg-e9e4da); }
.mcard .sw img { width: 100%; height: 100%; object-fit: cover; }
.swatch { width: 100%; height: 100%; }
.mb { padding: 14px 18px 16px; }
.mh { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.paint-chip { flex: none; width: 64px; height: 64px; border-radius: 10px; border: 1px solid rgba(0,0,0,.14); box-shadow: inset 0 -14px 22px rgba(255,255,255,.28), inset 0 10px 18px rgba(0,0,0,.07); }
.mk { font: 600 13px var(--sans); color: var(--muted); text-transform: capitalize; }
.mm { color: var(--ink2); font-size: 13px; }
.mb dl { display: grid; grid-template-columns: 74px 1fr; gap: 4px 10px; margin: 10px 0 0; font-size: 13px; }
.mb dt { color: var(--muted); font: 13px var(--sans); padding-top: 1px; }
.mb dd { margin: 0; }
.selline { margin-top: 10px; font: 13px var(--sans); color: var(--muted); border-top: 1px solid var(--fg-efe9df); padding-top: 8px; }
.fxph { display: flex; gap: 6px; margin-top: 6px; }
.fxph img { width: 64px; height: 48px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); }
.qt.fx td:first-child { width: 150px; }

/* ---------- measurements ---------- */
.mt input.len { width: 82px; font: 13px var(--mono); padding: 5px 7px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); }
.mt input.len:focus { outline: 2px solid var(--fg-b9c7b5); border-color: var(--accent); }
.mt input.len.bad { border-color: var(--red); background: var(--red-bg); }
.mt input.len:disabled { background: transparent; border-color: transparent; color: var(--fg-8a8274); -webkit-text-fill-color: var(--fg-8a8274); opacity: 1; }
.mt .fmt { font: 13px var(--mono); color: var(--muted); margin-left: 6px; }
.mt select { font: 12.5px var(--sans); padding: 4px 6px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-fbf9f5); }
.cs.conf-measured { color: var(--green); } .cs.conf-assumed { color: var(--amber); }
.objs td { padding-top: 7px; padding-bottom: 7px; }
.warnline { color: var(--red); padding: 10px 20px 14px; font-size: 13px; }

/* ---------- source ---------- */
.src .srcbtns { display: flex; gap: 8px; }
.srcbtns button, .newf button { border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); padding: 7px 14px; border-radius: 4px; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
#src { width: 100%; height: calc(100vh - 230px); font: 12.5px/1.5 var(--mono); padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-fdfcfa); color: var(--ink); resize: vertical; tab-size: 2; }
.srcmsg { font: 12px var(--mono); margin: 10px 0; min-height: 16px; }
.srcmsg.ok { color: var(--green); } .srcmsg.bad { color: var(--red); }
.newf { padding: 20px; display: grid; gap: 14px; max-width: 520px; margin-top: 18px; }
.newf label { display: grid; gap: 5px; font-size: 13px; color: var(--ink2); }
.newf input { font: 14px var(--sans); padding: 8px 10px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; }
.newf .row { display: flex; align-items: center; gap: 12px; }
.fatal { padding: 20px; }

@media (max-width: 900px) {
  #side { width: 210px; }
  .two, .ba-grid { grid-template-columns: 1fr; }
  .togs span { display: none; }
}

/* ---------- Tile workspace (3D panel) ---------- */
.surflist { display: grid; gap: 6px; }
.surfbtn { display: grid; text-align: left; gap: 1px; padding: 8px 10px; border: 1px solid var(--fg-ddd5c7); background: var(--bg-ffffff); border-radius: 5px; }
.surfbtn:hover { border-color: var(--fg-b9c7b5); }
.surfbtn.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--bg-f3f7f1); }
.surfbtn .sl { font-size: 12px; font-weight: 600; color: var(--ink2); }
.surfbtn .sm { font-size: 12.5px; color: var(--ink); }
.surfbtn .sq { font: 11px var(--mono); color: var(--muted); }
.insp .sopts { margin: 8px 0 2px; }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.swatches .sw { display: grid; gap: 4px; padding: 4px; border: 1px solid var(--fg-ddd5c7); background: var(--bg-ffffff); border-radius: 5px; text-align: left; font-size: 11px; line-height: 1.25; color: var(--ink2); }
.swatches .sw img, .swatches .swi { width: 100%; aspect-ratio: 1.6; object-fit: cover; border-radius: 3px; background: var(--bg-ebe6dc); display: block; }
.swatches .swi.same { background: repeating-linear-gradient(45deg, var(--bg-ece7de) 0 6px, var(--bg-e2dccf) 6px 12px); }
.swatches .sw:hover { border-color: var(--fg-b9c7b5); }
.swatches .sw.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.addtile { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 32px; margin: 4px 0 12px; padding: 0 12px; border: 1px solid var(--fg-b9c7b5); background: var(--bg-ffffff); color: var(--accent-d); border-radius: 5px; font: 600 13px var(--sans); }
.addtile:hover { border-color: var(--accent); }
.addtile .ic { width: 14px; height: 14px; }
.libf.compact { grid-template-columns: 1fr; border-top: 0; padding-top: 8px; }
.libf .chk { display: flex; align-items: center; gap: 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 4px; }
.presets button { border: 1px solid var(--fg-d3cabb); background: var(--bg-ffffff); border-radius: 4px; padding: 3px 8px; font: 12px var(--mono); color: var(--ink2); }
.presets button.on { border-color: var(--accent); color: var(--accent-d); background: var(--bg-f3f7f1); }
.el-niche { fill: rgba(60, 50, 40, .16) !important; stroke: var(--fg-4a463f) !important; stroke-width: 0.5 !important; }
.insp.surf { width: 312px; }
@media (min-width: 1200px) { .insp.surf { width: 372px; } }
/* the 3D panel's Layout, Direction and Height choices: the label over a full-width row of its choices */
@media (min-width: 768px) {
  #panel3d .lrow { grid-template-columns: 1fr; gap: 4px; }
  #panel3d .ll { padding-top: 0; }
  #panel3d .chips { gap: 5px; }
  #panel3d .chips .chip { flex: 1 1 auto; text-align: center; }
  #panel3d .kheight .fl, #panel3d .fl { flex-wrap: wrap; }
}
/* the orbit pad: a small clear pill that opens when the pointer comes to it */
@media (min-width: 601px) {
  .navpad { padding: 6px; gap: 6px; border-radius: 12px; background: rgba(250,247,240,.62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid rgba(60,50,30,.16); box-shadow: 0 2px 10px rgba(36,34,30,.14); color: var(--ink2); transition: background .15s; }
  .navpad:hover, .navpad:focus-within { background: rgba(250,247,240,.9); }
  .navpad:not(:hover):not(:focus-within) .np-mode, .navpad:not(:hover):not(:focus-within) .np-row { display: none; }
  .navpad:not(:hover):not(:focus-within)::after { content: ''; width: 34px; height: 34px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a463f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v18M3 12h18M12 3l-3 3M12 3l3 3M12 21l-3-3M12 21l3-3M3 12l3-3M3 12l3 3M21 12l-3-3M21 12l-3 3'/%3E%3C/svg%3E") center / 22px no-repeat; }
}
@media (hover: none) and (min-width: 601px) { .navpad:not(:hover):not(:focus-within) .np-mode { display: grid; } .navpad:not(:hover):not(:focus-within) .np-row { display: flex; } .navpad:not(:hover):not(:focus-within)::after { display: none; } }
.insp .fl input.txt { width: 100%; max-width: 168px; }
.insp .fl select { max-width: 168px; }
.insp .fl .fi input.len { width: 64px; }
.libf[hidden] { display: none !important; }
.addtile.open { background: var(--bg-e9efe6); }
.pub { margin-left: 12px; border: 1px solid var(--fg-b9c7b5); background: var(--bg-eef2ec); color: var(--accent-d); padding: 4px 11px; border-radius: 4px; font-size: 12.5px; }
.pub:disabled { opacity: .6; }
#pub-state a { color: var(--accent-d); }
.linkform { display: flex; gap: 6px; margin: 2px 0 8px; }
.linkform input { flex: 1; min-width: 0; height: 32px; box-sizing: border-box; font: 13px var(--sans); padding: 0 9px; border: 1px solid var(--fg-b9c7b5); border-radius: 5px; background: var(--bg-ffffff); }
.linkform input:focus { outline: 2px solid var(--fg-cfdccb); border-color: var(--accent); }
.linkform button { height: 32px; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 5px; padding: 0 14px; font: 600 13px var(--sans); }
.linkmsg { font-size: 12.5px; line-height: 1.4; color: var(--ink2); background: var(--bg-f3f7f1); border: 1px solid var(--fg-dde7d9); border-radius: 5px; padding: 7px 9px; margin: 0 0 8px; }
.linkmsg.bad { background: var(--red-bg); border-color: var(--fg-efc9c1); color: var(--red); }
.bmkrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.bmk { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; background: none; color: var(--accent-d) !important; font: 600 13px var(--sans); text-decoration: none !important; cursor: grab; }
.bmk:hover { text-decoration: underline !important; text-underline-offset: 3px; }
.bmk .ic { width: 12px; height: 12px; }
.pricefix { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--red); background: var(--red-bg); border-radius: 5px; padding: 6px 8px; margin: 8px 0 0; }
.pricefix span { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); }
.pricefix input { width: 64px; font: 13px var(--mono); padding: 3px 6px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; }
.pricefix a { margin-left: auto; font-size: 12px; }
.colorfix { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink2); margin: 8px 0 0; }
.colorfix input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); cursor: pointer; }
.colorfix img { width: 28px; height: 28px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); }
.colorfix a { margin-left: auto; font-size: 12px; }
.revert { display: inline-flex; align-items: center; gap: 6px; margin: 5px 0 0; border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); border-radius: 4px; padding: 3px 8px; font-size: 12px; color: var(--ink2); cursor: pointer; }
.revert:hover { border-color: var(--accent); }
.revert i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.22); display: inline-block; flex: none; }
.rdr { font-size: 12px; margin-right: auto; }
.rdr.on { color: var(--green); font-weight: 600; }
.rdr.on::before { content: '● '; }
.readerhelp { font-size: 12.5px; line-height: 1.45; background: var(--bg-ffffff); border: 1px solid var(--fg-ddd5c7); border-radius: 6px; padding: 10px 12px; margin: 0 0 10px; color: var(--ink2); }
.readerhelp ol { margin: 6px 0 8px 18px; padding: 0; }
.readerhelp code { font: 11.5px var(--mono); background: var(--bg-f3efe7); padding: 1px 4px; border-radius: 3px; }
.readerhelp .row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.readerhelp .path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readerhelp button { border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); border-radius: 4px; padding: 3px 8px; font-size: 12px; }
/* changing the room's shape */
.shapebtns { display: flex; flex-direction: column; gap: 6px; }
.shapebtns button { border: 1px solid var(--fg-d3cabb); background: var(--bg-ffffff); border-radius: 4px; padding: 6px 8px; font-size: 13px; color: var(--ink2); text-align: left; }
.shapebtns button:hover { border-color: var(--accent); color: var(--ink); }
.insp.shape .readout:empty { display: none; }
.insp.shape .readout { margin: 10px 0 0; line-height: 1.45; }
.insp.shape .readout.bad { color: var(--red); background: var(--red-bg); }
.insp.shape .presets button { font-family: var(--sans); }
.insp-btns .go { background: var(--accent); color: #fff; border-color: var(--accent-d); }
.insp-btns .go:disabled { opacity: .45; }
.roomhint { padding: 0 20px 14px; margin: 0; }
.newf > .hint { margin: 0 0 4px; }
.shape-prev { stroke-width: .6; stroke-dasharray: 2 1.5; pointer-events: none; }
.shape-prev.cut { fill: rgba(179,64,44,.22); stroke: var(--fg-b3402c); }
.shape-prev.add { fill: rgba(63,122,79,.22); stroke: var(--fg-3f7a4f); }
.shape-prev.bad { fill: rgba(120,120,120,.14); stroke: var(--fg-8b8478); }
.pick-wall { stroke: transparent; stroke-width: 8; stroke-linecap: butt; cursor: pointer; }
.pick-wall:hover { stroke: rgba(95,160,110,.45); }
.pick-wall.on { stroke: rgba(95,160,110,.7); }
.pick-corner { fill: rgba(63,122,79,.14); stroke: var(--fg-3f7a4f); stroke-width: .5; cursor: pointer; }
.pick-corner:hover { fill: rgba(63,122,79,.32); }
.pick-corner.on { fill: rgba(63,122,79,.6); }
/* the selected tile's photo, and what it does */
.tphoto { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 0; padding: 8px; background: var(--bg-ffffff); border: 1px solid var(--fg-ddd5c7); border-radius: 6px; font-size: 12.5px; color: var(--ink2); }
.tphoto > img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.tphoto .tp-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tphoto label { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; color: var(--muted); }
.tphoto select { font: 12.5px var(--sans); padding: 4px 6px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); color: var(--ink); max-width: 100%; }
.tphoto .tp-acts { display: flex; align-items: center; gap: 10px; }
.tphoto .tp-acts button { border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); border-radius: 4px; padding: 3px 8px; font-size: 12px; color: var(--ink2); }
.tphoto .tp-acts a { font-size: 12px; margin-left: auto; }
.tphoto.none { align-items: center; gap: 12px; }
.tp-empty { flex: none; width: 64px; height: 64px; box-sizing: border-box; border: 1px solid var(--fg-d9d2c4); border-radius: 4px; background: var(--bg-fbf9f5); object-fit: cover; display: block; }
.tp-add { border: 0; background: none; padding: 6px 2px; font: 600 12.5px var(--sans); color: var(--accent-d); }
.tp-add:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
#panel3d.dropping .tp-empty { border-color: var(--accent); background: var(--bg-eef2ec); }
.insp.dropping { outline: 3px dashed var(--accent); outline-offset: -6px; background: var(--bg-f1f6ef); }
.linkmsg.warn { background: var(--bg-fff8ec); border-color: var(--fg-ecd9ae); color: var(--fg-6d4a06); }
.save.note { color: var(--accent-d); }
.cl-mark { pointer-events: none; }
.cl-line { stroke: var(--fg-6d665b); stroke-width: 0.3; stroke-dasharray: 4 1.2 1 1.2; }
.cl-sym { fill: var(--fg-4b463e); paint-order: stroke; stroke: var(--fg-f6f2ea); stroke-width: 0.6; stroke-linejoin: round; }
.cl-dim .dim-t { font-weight: 600; }

/* ---------- kitchens ---------- */
.k-over { fill: none; stroke: var(--fg-4a463f); stroke-width: 0.35; stroke-dasharray: 1.6 1.2; }
.k-over.hood { stroke: var(--fg-7d8287); }
.k-lbl { fill: #f3efe7; stroke: rgba(30,28,24,.55) !important; stroke-width: 0.7 !important; }
.plan .k-lbl { fill: var(--fg-4b463e); stroke: var(--fg-f6f2ea) !important; }
.fx .k-el rect, .k-el rect { stroke-dasharray: none; }
.nav.add.k { margin-top: 0; border-top: 0; padding-top: 8px; }
.kopts { margin: 8px 0 4px; display: grid; gap: 6px; }
.kopts .fl { margin: 0; }
/* how high the backsplash goes: up to the cabinets, or a number of courses with a stepper */
.kopts .kheight { margin: 0; }
.kstep { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.kstep button { width: 26px; height: 26px; border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); font: 600 15px/1 var(--sans); color: var(--ink); cursor: pointer; }
.kstep button:hover:not(:disabled) { border-color: var(--accent); }
.kstep button:disabled { opacity: .4; cursor: default; }
.kstep input { width: 40px; height: 26px; text-align: center; font: 600 13px var(--mono); border: 1px solid var(--fg-d3cabb); border-radius: 4px; background: var(--bg-ffffff); }
.kstep-says { font: 11px var(--mono); color: var(--muted); margin-left: 4px; }
.kh-says { margin: 0; font-size: 12px; line-height: 1.45; color: var(--ink2); }
.bd-ctl .kopts .kheight { grid-column: 1 / -1; max-width: 720px; }
/* cabinet pulls: one cabinet's length chips, what it carries, and the kitchen's rule under it */
.kpull { margin: 10px 0 4px; }
.kpulls { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: var(--ink2); }
.kpullall { margin-top: 14px; padding-top: 2px; border-top: 1px solid var(--fg-e6dfd2); }
.k-pull { stroke: none; }
.kfocus { display: flex; justify-content: center; gap: 0; margin: -4px 0 2px; }
.kfocus button { border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); padding: 3px 12px; font-size: 12px; color: var(--ink2); }
.kfocus button:first-child { border-radius: 4px 0 0 4px; } .kfocus button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.kfocus button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.page.board { max-width: none; }
.bd-crop { display: flex; } .bd-crop button { border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); padding: 5px 14px; font-size: 12.5px; color: var(--ink2); }
.bd-crop button:first-child { border-radius: 4px 0 0 4px; } .bd-crop button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.bd-crop button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bd-ctl .kopts { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 22px; align-items: end; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; padding: 16px 0 20px; }
.bd-ctl { padding: 10px 0 12px; }
/* the layout preview is one large elevation; each way to lay the tile is two feet of it, square */
.bd-preview { padding: 6px 12px 16px; }
.bd-preview svg { display: block; width: 100%; height: auto; max-height: min(46vh, 440px); }
.bd-lays { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 16px 0 20px; }
.bd-lay .bd-svg { aspect-ratio: 1; }
.bd-lay .bd-svg svg { height: 100%; }
.bd-lay .bd-cap b { padding-right: 0; }
.bd-lay .bd-on { top: 8px; right: 8px; }
.tile-patch .courses line { stroke: rgba(60,50,30,.28); stroke-width: .15; }
.bd-card { display: block; padding: 0; border: 1px solid var(--fg-ddd5c7); background: #fff; border-radius: 6px; overflow: hidden; text-align: left; color: var(--ink); }
.bd-card:hover { border-color: var(--fg-b9c7b5); }
.bd-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.bd-svg { background: var(--bg-ebe6dc); aspect-ratio: 2.1; display: block; }
.bd-svg svg { width: 100%; height: auto; display: block; pointer-events: none; }
.bd-cap { display: grid; gap: 2px; padding: 9px 12px 10px; position: relative; }
.bd-cap b { font: 600 14px var(--serif); padding-right: 64px; }
.bd-meta { font: 13px var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); }
.bd-on { position: absolute; right: 10px; top: 9px; font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--accent); border-radius: 3px; padding: 2px 6px; }

/* how a tile is laid: labelled buttons */
.layout { display: grid; gap: 6px; margin: 8px 0 4px; padding: 8px 9px; border: 1px solid var(--fg-e3dccf); border-radius: 6px; background: var(--bg-fbf9f5); }
.lrow { display: grid; grid-template-columns: 62px 1fr; align-items: start; gap: 6px; }
.ll { font-size: 11.5px; font-weight: 600; color: var(--ink2); padding-top: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font: 12px var(--sans); padding: 4px 8px; border: 1px solid var(--fg-d3cabb); border-radius: 999px; background: var(--bg-ffffff); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--fg-b9c7b5); }
.chip.on { border-color: var(--accent); background: var(--bg-eef4ec); box-shadow: 0 0 0 1px var(--accent) inset; font-weight: 600; }
/* a layout that breaks a patterned tile's design says so, with the way back */
.laynote { margin: 0; padding: 6px 8px; font-size: 12px; line-height: 1.4; border: 1px solid var(--fg-ecd9ae); border-radius: 5px; background: var(--bg-fff8ec); color: var(--fg-6d4a06); }
.linklike { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent-d); text-decoration: underline; cursor: pointer; }

/* trim finishes */
.fl.fin { display: grid; gap: 5px; }
.finsw { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.fsw { display: flex; align-items: center; gap: 6px; font: 11.5px var(--sans); padding: 4px 6px; border: 1px solid var(--fg-ddd5c7); border-radius: 5px; background: var(--bg-ffffff); color: var(--ink); text-align: left; cursor: pointer; }
.fsw:hover { border-color: var(--fg-b9c7b5); }
.fsw.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--bg-f3f7f1); font-weight: 600; }
.fsw i { width: 15px; height: 15px; border-radius: 50%; flex: none; border: 1px solid rgba(0, 0, 0, 0.28); background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, 0.2)); }
.finall { margin: 2px 0 6px; font: 11.5px var(--sans); padding: 5px 8px; border: 1px dashed var(--fg-c9bfae); border-radius: 5px; background: var(--bg-ffffff); color: var(--ink2); text-align: left; cursor: pointer; }
.finall:hover { border-style: solid; border-color: var(--accent); }
.altph { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 5px; }
.altph span { width: 100%; font-size: 11px; color: var(--muted); }
.altph img { width: 40px; height: 40px; object-fit: cover; border-radius: 3px; border: 1px solid var(--fg-d3cabb); cursor: pointer; }
.altph img:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ---------- the photo card ---------- */
.ba-add { display: flex; gap: 8px; }
.addph { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); color: var(--ink2); padding: 4px 11px 4px 8px; border-radius: 4px; font-size: 12.5px; cursor: pointer; }
.addph:hover { border-color: var(--accent); color: var(--ink); }
.addph .ic { width: 14px; height: 14px; }
.card.ba-empty .card-h { border-bottom: 0; padding-bottom: 16px; }
.ba-grid.one { grid-template-columns: 1fr; }
.ba-grid.one figure { aspect-ratio: 16 / 7; }

/* ---------- phone: the menu slides in, panels stack under the drawing, tables scroll in their card ---------- */
.ur .menu-btn, .viewmenu, #scrim { display: none; }
@media (max-width: 767px) {
  body { display: block; }
  #side { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .22s ease; visibility: hidden; }
  body.navopen #side { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(36,34,30,.28); }
  body.navopen #scrim { display: block; position: fixed; inset: 0; background: rgba(36,34,30,.36); z-index: 50; }
  #wrap { height: 100vh; height: 100dvh; }
  #top { height: 52px; padding: 0 10px 0 6px; gap: 6px; }
  .ur { gap: 2px; min-width: 0; }
  .ur .menu-btn { display: flex; color: var(--ink); padding: 8px; margin-right: 4px; }
  .ur .menu-btn .ic { width: 20px; height: 20px; }
  .save { margin-left: 6px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
  .togs { display: none; }
  .viewmenu { display: block; position: relative; flex: none; }
  .viewmenu summary { list-style: none; cursor: pointer; color: var(--ink2); }
  .viewmenu summary::-webkit-details-marker { display: none; }
  .viewmenu summary::after { content: '▾'; font-size: 10px; margin-left: 2px; color: var(--muted); }
  .viewmenu[open] summary { background: var(--bg-dfe6dc); border-color: var(--fg-b9c7b5); color: var(--ink); }
  .vm-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; display: grid; gap: 4px; min-width: 176px; padding: 6px; background: var(--bg-fbf9f5); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(36,34,30,.16); }
  .vm-list .tog { justify-content: flex-start; }
  .vm-list .tog span { display: inline; }

  .page { padding: 22px 16px 48px; }
  h1 { font-size: 26px; }
  .ph { flex-wrap: wrap; }
  .lede { font-size: 15px; }
  .estimate { grid-template-columns: 1fr; }
  .est-total { padding: 18px 18px; }
  .est-v { font-size: 38px; }
  .est-rows a { padding: 12px 18px; }
  .er-l em { display: block; margin: 1px 0 0; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
  .kpi { padding: 14px 14px 13px; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } /* an odd card out runs the row's width */
  .kpi-ic { width: 30px; height: 30px; margin-bottom: 10px; }
  .kpi-l { font-size: 14px; }
  .kpi-v { font-size: 24px; }
  .kpi-v small { margin-left: 4px; }
  .kpi-s { overflow-wrap: anywhere; }
  .two, .ba-grid { grid-template-columns: 1fr; gap: 0; }
  .ba-grid figure + figure { border-left: 0; border-top: 1px solid var(--line); }
  .ba-grid.one figure { aspect-ratio: 4 / 3; }
  .card-h { padding: 14px 16px 11px; flex-wrap: wrap; row-gap: 8px; }
  .card > :not(.card-h) { margin-left: 16px; margin-right: 16px; }
  ul.scope, ul.oi, ul.val, ul.edges { margin: 0 16px; }
  .val li { flex-wrap: wrap; gap: 2px 10px; }
  .val .code { min-width: 0; }
  table.qt, table.mt, table.kv { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .qt th:first-child, .qt td:first-child, .mt th:first-child, .mt td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-fdfcfa); box-shadow: 1px 0 0 var(--fg-ece6db); }
  .qt tr.mat td:first-child { min-width: 200px; max-width: 230px; }
  .qt th:first-child, .qt td:first-child, .mt th:first-child, .mt td:first-child { padding-left: 16px; }
  .mgrid, .libgrid, .bd-grid, .surfgrid { grid-template-columns: 1fr; }
  .bd-lays { grid-template-columns: 1fr 1fr; gap: 10px; }
  .bd-lay .bd-cap { padding: 8px 10px 9px; }
  .bd-lay .bd-cap b { font-size: 13.5px; }
  .bd-lay .bd-on { position: static; justify-self: start; margin-top: 2px; }
  .bd-preview { padding: 4px 6px 12px; }
  .libf { grid-template-columns: 1fr; }
  .bd-crop { flex: none; }

  main.view-plan, main.view-walls, main.view-unfolded, main.view-3d { display: block; }
  .dh { flex-wrap: wrap; padding: 12px 16px; gap: 8px 12px; }
  .dh-t { flex-wrap: wrap; row-gap: 2px; min-width: 0; }
  .rm-eyebrow { display: block; font: 600 13px/1.2 var(--sans); color: var(--accent-d); margin: 0 0 4px; }
  .ph .sub.dup { display: none; }
  .dh .rm-eyebrow { flex: 0 0 100%; margin: 0 0 -2px; }
  .walls-h .wnav { display: none; }
  .walls-h { justify-content: center; }
  .wall-tabs .wt-step { display: flex; font-size: 18px; }
  .dh-t .t-full { display: none; }
  .dh-t .t-short { display: inline; }
  .walls-h .dh-t { flex-direction: row; align-items: baseline; justify-content: center; gap: 10px; text-align: left; }
  .wnav { font-size: 13px; white-space: nowrap; }
  .cam { max-width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .cam button { flex: none; }
  .edit-wrap { flex-direction: column; }
  .sheet { padding: 12px 8px; }
  .sheet svg, .view-plan .sheet svg { height: auto; max-height: 70vh; }
  .edit-wrap .sheet { touch-action: pan-x pan-y pinch-zoom; }
  .view-unfolded .sheet.wide { display: none; }
  .un-stack { display: grid; gap: 24px; padding: 20px 16px 40px; max-width: 560px; margin: 0 auto; }
  .un-wall h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; font: 700 22px/1.1 var(--serif); color: var(--accent-d); }
  .un-wall h3 span { font: 12px var(--mono); letter-spacing: .04em; color: var(--muted); }
  .un-wall svg { display: block; width: 100%; height: auto; max-height: none; }
  .un-wall svg.un-empty { width: 62%; }
  .insp, .insp.surf { width: auto; border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 16px; }
  .view-3d .edit-wrap .three, .three { flex: none; width: 100%; aspect-ratio: 4 / 3; min-height: 300px; }
  .navpad { right: 8px; bottom: 8px; transform: scale(.84); transform-origin: bottom right; }
  .plan-zoom { display: inline-flex; align-items: center; margin-left: auto; border: 1px solid var(--fg-cfc6b6); background: var(--bg-f3efe7); border-radius: 4px; min-height: 44px; padding: 0 16px; font-size: 15px; color: var(--ink2); }
  .view-plan .sheet { padding: 8px 0; }
  .view-plan .sheet.zoomed { overflow-x: auto; justify-content: flex-start; -webkit-overflow-scrolling: touch; }
  .view-plan .sheet.zoomed svg { width: 280%; max-width: none; max-height: none; flex: none; height: auto; }
  .view-plan .sheet.k-plan:not(.zoomed) svg .fx-label { display: none; }
  .plan-key { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 4px 16px 12px; font-size: 13.5px; color: var(--ink2); }
  .plan-key { display: flex; }
  .plan-key b { font: 600 13px var(--mono); margin-right: 6px; color: var(--ink); }
  .legend, .wall-facts { flex-wrap: wrap; gap: 6px 14px; padding-left: 16px; padding-right: 16px; }
  #src { height: 60vh; }
}

/* ---------- small phones: the 3D pad folds into one button, the view chips scroll on their own row ---------- */
@media (max-width: 600px) {
  .view-3d .dh { padding-right: 0; }
  .view-3d .cam { flex: 0 0 100%; min-width: 0; padding: 0 16px 2px 0; scrollbar-width: none; }
  .view-3d .cam::-webkit-scrollbar { display: none; }
  .view-3d .cam::after { content: ''; flex: none; width: 8px; height: 1px; }
  .view-3d .cam.more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
  .navpad { display: none; }
  .three.padopen .navpad { display: grid; right: 12px; bottom: 62px; }
  .np-fab { display: flex; align-items: center; justify-content: center; position: absolute; right: 12px; bottom: 12px; z-index: 4; width: 40px; height: 40px; padding: 0; border-radius: 50%; background: rgba(28,27,25,.8); color: #f3efe7; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 4px 14px rgba(0,0,0,.28); }
  .np-fab .ic { width: 18px; height: 18px; }

  /* Measurements: every item on the walls is a card of labelled boxes */
  .card > table.objs { display: block; overflow: visible; padding: 0 0 4px; }
  .objs thead { display: none; }
  .objs tbody { display: grid; gap: 12px; padding: 4px 12px 12px; }
  .objs tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; border: 1px solid var(--fg-e6dfd3); border-radius: 6px; background: var(--bg-ffffff); }
  .objs td, .objs td:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 0; border: 0; position: static; box-shadow: none; background: none; }
  .objs td.it { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 2px; }
  .objs td.it .small { flex: none; }
  .objs td.st { grid-column: 1 / -1; }
  /* Quantities: every tile a card (name, the order math, then its figures two by two, the cost last and largest);
     the figure tables run the card's width with their values on its right edge */
  .card > table.qt.tiles { display: block; overflow: visible; }
  .qt.tiles thead { display: none; }
  .qt.tiles tbody { display: block; }
  .qt.tiles tr.mat { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px; border-top: 1px solid var(--fg-e6dfd3); }
  .qt.tiles tr.mat:first-child { border-top: 0; }
  .qt.tiles tr.mat td { display: flex; flex-direction: column; gap: 3px; padding: 0; border: 0; position: static; box-shadow: none; background: none; min-width: 0; max-width: none; text-align: left; font-size: 15px; }
  .qt.tiles tr.mat td.nm { grid-column: 1 / -1; }
  .qt.tiles tr.mat td.nm b { font-size: 16px; font-weight: 600; }
  .qt.tiles tr.mat td.n small { display: inline; font: 13px var(--mono); color: var(--muted); }
  .qt.tiles tr.mat td[data-l]::before { content: attr(data-l); font: 600 13px var(--sans); color: var(--muted); }
  .qt.tiles tr.mat td.cost { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--fg-f0ebe2); text-align: right; font: 600 18px var(--mono); }
  .qt.tiles tr.mat td.selc { grid-column: 1 / -1; font-size: 13px; }
  .qt.tiles tr.mat td.selc.none { display: none; }
  .qt.tiles tr.sub { display: flex; justify-content: space-between; gap: 12px; padding: 0 16px 6px 28px; }
  .qt.tiles tr.sub:last-child { padding-bottom: 12px; }
  .qt.tiles tr.sub td { display: block; padding: 0; border: 0; position: static; box-shadow: none; background: none; min-width: 0; }
  .qt.tiles tr.sub td:empty { display: none; }
  .card > table.kv { display: table; width: 100%; overflow: visible; }
  .kv td { padding: 8px 16px; }
  .kv td.n { text-align: right; font-size: 14px; }
  .qt td a { white-space: nowrap; }
  .qt th { padding-top: 12px; padding-bottom: 12px; }
  .objs td[data-l]::before { content: attr(data-l); font: 600 13px var(--sans); color: var(--muted); }
  /* one field style on the page: 44 px, 16 px type, white, the Room table's border; a size that can't be
     changed keeps the field's shape with a dashed edge; the items are the only frames under their heading */
  .measure .mt input.len, .measure .mt select { box-sizing: border-box; height: 44px; font-size: 16px; padding: 0 10px; border: 1px solid var(--fg-d3cabb); border-radius: 5px; background: var(--bg-ffffff); }
  .measure .mt input.len { font-family: var(--mono); }
  .measure .mt:not(.objs) input.len { width: 84px; }
  .measure .mt:not(.objs) select { width: 124px; }
  .measure .mt:not(.objs) td { vertical-align: top; }
  .measure .mt:not(.objs) td:first-child { padding-top: 21px; }
  .measure .mt:not(.objs) .fmt { display: block; min-height: 14px; margin-top: 3px; }
  .objs input.len, .objs select { width: 100%; }
  .objs input.len:disabled, .measure .mt input.len:disabled { border: 1px dashed var(--fg-d3cabb); background: transparent; color: var(--fg-8a8274); -webkit-text-fill-color: var(--fg-8a8274); padding-left: 10px; }
  .card.objs-card { border: 0; background: none; box-shadow: none; }
  .objs-card > .card-h { padding: 6px 0 12px; border-bottom: 0; }
  .card.objs-card > :not(.card-h) { margin-left: 0; margin-right: 0; }
  .objs-card .objs tbody { padding: 0 0 12px; }
  .objs .fmt { margin-left: 0; min-height: 14px; }
  .three.padopen .np-fab { background: var(--bg-f3efe7); color: var(--ink); border-color: var(--fg-cfc6b6); }
}

/* ---------- phone: every control is at least 44 px tall, 8 px apart; pills read in sentence case ---------- */
.chips .chip, .partchips .chip { text-transform: none; letter-spacing: 0; }
@media (max-width: 767px) {
  .ur { gap: 8px; }
  .ur button { min-width: 44px; min-height: 44px; padding: 0; align-items: center; justify-content: center; }
  .ur .menu-btn { padding: 0; margin-right: 0; }
  .ur .menu-btn .ic, .ur button .ic { width: 22px; height: 22px; }
  .ur .pub, #share-reset { min-height: 44px; }
  .viewmenu summary, .vm-list .tog, .tog { min-height: 44px; }
  .vm-list { gap: 8px; }
  .chips { gap: 8px; }
  .chips .chip, .partchips .chip { min-height: 44px; padding: 0 16px; font: 500 15px var(--sans); display: inline-flex; align-items: center; }
  .lrow { grid-template-columns: 70px 1fr; gap: 8px; }
  .ll { font-size: 13px; padding-top: 13px; }
  .layout { gap: 12px; }
  .cam { gap: 8px; }
  .cam button { min-height: 44px; padding: 0 16px; font-size: 15px; }
  .kfocus button, .bd-crop button { min-height: 44px; padding: 0 18px; font-size: 15px; }
  .addtile, .linkform input, .linkform button { height: 44px; }
  .linkform { gap: 8px; }
  .linkform button, .addph, .tp-add, .tphoto .tp-acts button, .revert, .finall, .readerhelp button, .shapebtns button, .presets button { min-height: 44px; }
  .linkform button { padding: 0 20px; font-size: 15px; }
  .addph { padding: 0 14px 0 10px; font-size: 14px; }
  .presets { gap: 8px; }
  .presets button, .revert { padding: 0 14px; font-size: 14px; }
  .surflist { gap: 8px; }
  .surfbtn, .swatches .sw, .fsw { min-height: 44px; }
  .swatches, .finsw { gap: 8px; }
  .kstep { gap: 8px; }
  .kstep button { width: 44px; height: 44px; font-size: 18px; }
  .kstep input { width: 56px; height: 44px; font-size: 16px; }
  .wall-tabs { gap: 8px; padding: 8px 10px 12px; }
  .wall-tabs a { width: 44px; height: 44px; font-size: 16px; }
  .wnav { min-height: 44px; display: inline-flex; align-items: center; padding: 0 8px; font-size: 14px; }
  .walls-h { gap: 4px; padding-top: 4px; padding-bottom: 4px; }
  .nav { min-height: 44px; }
  .insp-h .x { min-width: 44px; min-height: 44px; }
  .addgrid { gap: 8px; }
  .addgrid button, .insp button:not(.x), .insp .primary, details.items button, main .primary { min-height: 44px; }
  main select, main input[type=text], main input[type=number], main input[type=url], main input:not([type]), main input.len, main input.txt { min-height: 44px; font-size: 16px; }
  .insp .fl input.len, .mt input.len { width: 76px; }
  .np-fab { width: 44px; height: 44px; }
  .bmk { min-height: 44px; }
  .card-h a, .oi a, .page .sub a { display: inline-flex; align-items: center; min-height: 44px; }
  .badge, .chip.conf-measured { min-height: 0; }
}
