:root {
  --ink: #101418; --ink2: #3b444c; --mute: #6b747c; --line: #dde2e6; --bg: #f3f5f6; --card: #fff;
  --teal: #12a095; --teal-d: #0b7f77; --teal-l: #e3f5f3; --warn: #b45309; --warn-bg: #fff4e0;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
button, select, input { font: inherit; color: inherit; }
.muted { color: var(--mute); } .small { font-size: 12.5px; color: var(--mute); }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand .tag { color: var(--mute); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.btn { border: 1px solid var(--line); background: #fff; padding: 7px 13px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: #b9c2c9; background: #fafbfc; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #26303a; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.actions select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; font-size: 13px; font-weight: 600; max-width: 240px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 410px minmax(0, 1fr); height: calc(100vh - 64px); }
#panel { overflow: auto; background: #fff; border-right: 1px solid var(--line); padding-bottom: 40px; }
main { overflow: auto; padding: 18px 22px 40px; }

/* ---------- questionnaire ---------- */
.progress { padding: 14px 18px 12px; position: sticky; top: 0; background: #fff; z-index: 5; border-bottom: 1px solid var(--line); }
.progress-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; }
.bar { height: 7px; background: #e8ecee; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), #2bc3b6); border-radius: 99px; transition: width .3s; }
.sec { border-bottom: 1px solid var(--line); scroll-margin-top: 64px; }
.sec > button.sh { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0; padding: 14px 18px; cursor: pointer; }
.sec .num { width: 24px; height: 24px; border-radius: 50%; background: #e8ecee; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.sec.done .num { background: var(--teal); color: #fff; }
.sec .st { font-weight: 800; font-size: 15px; flex: 1; }
.sec .cnt { color: var(--mute); font-size: 12.5px; }
.sec .chev { color: var(--mute); transition: transform .2s; }
.sec.open .chev { transform: rotate(90deg); }
.sec .body { display: none; padding: 0 18px 18px; }
.sec.open .body { display: block; }
.blurb { color: var(--mute); font-size: 13px; margin: -4px 0 12px; }
.q { margin: 0 0 16px; }
.q > label, .q > .ql { display: block; font-weight: 650; margin-bottom: 7px; font-size: 13.5px; }
.q input[type=text], .q select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.q input[type=text]:focus, .q select:focus, .chip:focus-visible, .btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; text-align: left; line-height: 1.25; flex: 1 1 auto; min-width: 120px; }
.chip small { display: block; color: var(--mute); font-size: 11.5px; margin-top: 1px; }
.chip:hover:not(:disabled) { border-color: var(--teal); }
.chip[aria-pressed=true] { background: var(--teal-l); border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); font-weight: 650; }
.chip:disabled { opacity: .45; cursor: not-allowed; background: #f6f7f8; }
.opt-note { font-size: 12px; color: var(--warn); margin-top: 5px; }
.checks label { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-weight: 500; }
.sub { border-left: 3px solid var(--teal-l); padding-left: 12px; margin-left: 2px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 10px 16px; font-weight: 700; cursor: pointer; color: var(--mute); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--teal); }
.tabpane { display: none; } .tabpane.on { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.card h3 { font-size: 14px; margin-bottom: 10px; }

/* ---------- room ---------- */
.roomgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.isocard { position: relative; padding: 0; overflow: hidden; background: linear-gradient(180deg, #f9fbfb, #e9eeef); }
.isobar { display: flex; gap: 18px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.7); }
.sw { display: flex; gap: 7px; align-items: center; font-size: 13px; cursor: pointer; }
#isoWrap svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 210px); }
.empty { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: var(--mute); font-weight: 600; pointer-events: none; }
.room-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.mark { cursor: help; }
.notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 13px; }
.notes li { padding: 8px 10px; border-radius: 8px; background: #f3f6f7; }
.notes li.warn { background: var(--warn-bg); color: #6b3a05; }
.notes li button { all: unset; cursor: pointer; color: var(--teal-d); font-weight: 600; }
.notes li button:hover { text-decoration: underline; }

/* ---------- drawings ---------- */
.drawgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.drawbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.grow { flex: 1; }
.sheetbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.sheetbtns button { border: 1px solid var(--line); background: #fff; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13px; text-align: left; }
.sheetbtns button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.sheetbtns small { display: block; font-weight: 500; opacity: .75; font-size: 11px; }
.sheetview { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 6px 24px rgba(16,20,24,.08); padding: 10px; overflow: auto; }
.sheetview svg { display: block; width: 100%; height: auto; min-width: 760px; }
.layers { position: sticky; top: 0; max-height: calc(100vh - 150px); overflow: auto; }
.codebox { display: flex; gap: 8px; align-items: flex-start; background: #f3f6f7; border-radius: 8px; padding: 8px 10px; margin: 8px 0 12px; }
.codes { flex: 1; font: 700 13px/1.6 ui-monospace, Consolas, monospace; letter-spacing: .02em; word-break: break-word; }
.lrow { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid #f0f2f3; }
.lrow code { font: 700 12px ui-monospace, Consolas, monospace; background: var(--teal-l); color: var(--teal-d); border-radius: 5px; padding: 1px 6px; flex: none; }
.lrow label { cursor: pointer; display: flex; gap: 8px; align-items: flex-start; }
.lrow i { font-style: normal; color: var(--mute); display: block; font-size: 11px; }

/* ---------- document ---------- */
.doc { background: #fff; max-width: 880px; margin: 0 auto; padding: 56px 64px; border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(16,20,24,.08); border-radius: 4px; counter-reset: sec; line-height: 1.55; }
.doc h1 { font-size: 34px; font-weight: 900; letter-spacing: -.01em; margin: 6px 0 14px; }
.doc h2 { font-size: 20px; font-weight: 800; margin: 34px 0 10px; padding-top: 14px; border-top: 2px solid var(--ink); counter-increment: sec; }
.doc h2::before { content: counter(sec) ".  "; color: var(--teal-d); }
.doc-toc h2, .doc-cover h2 { counter-increment: none; }
.doc-toc h2::before { content: none; }
.doc h3 { font-size: 14.5px; margin: 20px 0 8px; color: var(--teal-d); }
.doc p { margin: 0 0 10px; } .doc ul, .doc ol { margin: 0 0 12px; padding-left: 22px; } .doc li { margin: 3px 0; }
.doc-cover { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.doc-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--teal-d); }
.doc-for { font-size: 16px; } .doc-contact, .doc-meta { color: var(--mute); margin: 2px 0; }
.doc-toc ol { columns: 2; font-size: 13.5px; } .doc-toc a { color: var(--ink2); text-decoration: none; } .doc-toc a:hover { color: var(--teal-d); }
.doc-table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 12.5px; }
.doc-table th, .doc-table td { border: 1px solid #cfd6db; padding: 6px 8px; text-align: left; vertical-align: top; }
.doc-table th { background: #eef2f4; font-weight: 700; }

/* ---------- schedules ---------- */
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtabs button { border: 1px solid var(--line); background: #fff; padding: 7px 13px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; }
.subtabs button.on { background: var(--teal-l); border-color: var(--teal); color: var(--teal-d); }
.sched { overflow: auto; }
.sched .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.sched .doc-table input { width: 100%; border: 1px solid transparent; background: #f6f8f9; border-radius: 5px; padding: 4px 6px; font-size: 12.5px; min-width: 70px; }
.sched .doc-table input:focus { border-color: var(--teal); background: #fff; outline: none; }
.sched .doc-table input.n { width: 70px; min-width: 50px; text-align: right; }
.cat-row td { background: #f3f6f7; font-weight: 700; color: var(--teal-d); }

/* ---------- letterhead (specification) ---------- */
.letterhead { display: flex; justify-content: flex-end; margin: -34px -40px 18px 0; }
.letterhead img { height: 46px; width: auto; display: block; }
.lh-table { width: 100%; border-collapse: collapse; } .lh-table td { padding: 0; border: 0; }
.lh-table .letterhead { margin: 0 0 14px; }

/* ---------- paywall ---------- */
.pw-clip { overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%); mask-image: linear-gradient(to bottom, #000 40%, transparent 100%); }
.pw-cta { text-align: center; max-width: 520px; margin: -8px auto 30px; padding: 0 20px; }
.pw-cta h3 { font-size: 19px; font-weight: 800; margin: 10px 0 6px; }
.pw-cta p { color: var(--mute); margin: 0 0 14px; }
.pw-cta .btn { padding: 10px 20px; font-size: 14px; }
.pw-lock { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; margin: 0 auto; }
.layers .pw-cta { margin-top: 0; padding: 0; } .layers .pw-cta h3 { font-size: 15px; } .layers .pw-cta p { font-size: 12.5px; }
.pw-blur { filter: blur(4px); user-select: none; pointer-events: none; }
.lockbtn { display: inline-flex; align-items: center; gap: 6px; }
.lockbtn.primary { background: var(--teal-d); border-color: var(--teal-d); }
.lockbtn.primary:hover { background: #0a6c65; }

/* paid buttons only exist while unlocked; the unlock button only while locked */
body.locked .paid { display: none !important; }
body:not(.locked) .unlock-only { display: none !important; }

/* ---------- unlock dialog ---------- */
.dlg { border: 0; border-radius: 16px; padding: 28px 30px 24px; width: min(480px, 92vw); box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.dlg::backdrop { background: rgba(16,20,24,.45); }
.dlg-logo { display: block; margin-bottom: 12px; }
.dlg h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.pw-list { margin: 10px 0 18px; padding-left: 20px; font-size: 13.5px; } .pw-list li { margin: 4px 0; }
.dlg label { display: block; font-weight: 650; margin-bottom: 6px; }
.dlg input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: 600 14px ui-monospace, Consolas, monospace; letter-spacing: .04em; }
.dlg input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.dlg-err { color: #b42318; font-size: 13px; min-height: 18px; margin: 6px 0 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- licensing ---------- */
.req { color: #b42318; font-weight: 700; }
.pkg { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f3f6f7; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 14px 0 8px; }
.pkg-l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); font-weight: 700; }
.pkg-id { font: 700 20px/1.3 ui-monospace, Consolas, monospace; letter-spacing: .06em; }
.pkg-todo { background: var(--warn-bg); color: #6b3a05; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin: 4px 0 12px; }
.pkg-todo ul { margin: 6px 0 0; padding-left: 18px; }
.dlg textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: 12.5px/1.4 ui-monospace, Consolas, monospace; resize: vertical; word-break: break-all; }
.dlg textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.dlg-actions { align-items: center; flex-wrap: wrap; }
.link { background: none; border: 0; padding: 0; color: var(--teal-d); font-weight: 600; font-size: 12.5px; cursor: pointer; text-decoration: underline; }

/* ---------- recent designs ---------- */
.recent-wrap { position: relative; }
.recent-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-height: 420px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(16,20,24,.16); z-index: 40; padding: 6px; }
.rp-head { padding: 8px 10px 8px; font-weight: 800; font-size: 13.5px; border-bottom: 1px solid #eef1f2; margin-bottom: 4px; }
.rp-head span { display: block; font-weight: 500; font-size: 11.5px; color: var(--mute); }
.rp-row { display: flex; align-items: stretch; border-radius: 8px; }
.rp-row:hover { background: #f3f6f7; } .rp-row.here { background: var(--teal-l); }
.rp-open { all: unset; flex: 1; cursor: pointer; padding: 8px 10px; min-width: 0; }
.rp-open b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-open span { display: block; font-size: 11.5px; color: var(--mute); }
.rp-open em { font-style: normal; color: var(--teal-d); font-weight: 600; }
.rp-open:focus-visible { outline: 2px solid var(--teal); border-radius: 8px; }
.rp-del { all: unset; cursor: pointer; padding: 0 12px; color: var(--mute); font-size: 18px; display: grid; place-items: center; border-radius: 8px; }
.rp-del:hover { color: #b42318; background: #fde8e8; }
.rp-empty { color: var(--mute); font-size: 13px; padding: 10px; margin: 0; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; max-width: 80vw; z-index: 50; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .roomgrid, .drawgrid { grid-template-columns: 1fr; }
  .layers { position: static; max-height: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  #panel { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .top { height: auto; flex-wrap: wrap; position: static; } .brand .tag { display: none; }
  main { overflow: visible; padding: 14px; } .doc { padding: 28px 22px; } .doc-toc ol { columns: 1; }
}

/* ---------- printing ---------- */
#printRoot { display: none; }
@page sheet { size: 17in 11in; margin: 0; }
@page docpage { size: letter; margin: 0.7in; }
@media print {
  body { background: #fff; }
  body > :not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; }
  .print-sheet { page: sheet; break-after: page; width: 17in; height: 11in; overflow: hidden; }
  .print-sheet svg { width: 17in; height: 11in; display: block; }
  .print-doc { page: docpage; }
  .print-doc .doc { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 11pt; }
  .print-doc .doc h2 { break-after: avoid; }
  .doc-table { break-inside: auto; } .doc-table tr { break-inside: avoid; }
  .doc-cover { break-after: page; } .doc-toc { break-after: page; }
}

/* ---------- coordination files ---------- */
.files-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.files-head h3 { margin-bottom: 2px; }
.file-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid #eef1f2; }
.file-ico { width: 44px; height: 52px; border-radius: 6px; background: var(--teal-l); color: var(--teal-d); font: 700 11px ui-monospace, Consolas, monospace; display: grid; place-items: center; flex: none; }
.file-txt { flex: 1; } .file-txt b { display: block; } .file-txt span { color: var(--mute); font-size: 12.5px; }
.file-row .btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- design record (last page of the print package) ---------- */
.print-record { break-before: page; }
.rec .rec-title { font-size: 26px; margin: 0 0 6px; }
.rec .rec-meta { color: var(--ink2); margin: 0 0 6px; }
.rec .mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .05em; }
.rec h3 { margin: 14px 0 4px; }
.rec .layer-seq { font: 700 15px/1.7 ui-monospace, Consolas, monospace; letter-spacing: .04em; background: #f3f6f7; border-radius: 8px; padding: 8px 12px; margin: 6px 0 10px; }
.rec .doc-table { font-size: 11.5px; margin-bottom: 6px; }
.rec .rec-table td:first-child { width: 48%; }
.rec .doc-table th, .rec .doc-table td { padding: 4px 8px; }
