/* Simply OnSite 2 — shared styles, rev 2 look (../Handoff/SPEC-rev2-addendum.md §1).
   Product chrome lives here as tokens. Trade, status and document-kind colours do NOT: app.js writes them
   from the company data into a generated <style id="theme"> as .trade-<id>{--c}, .s-<id>{--sc}, .mk-<id>, .kind-<id>{--c}. */
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/assets/fonts/figtree-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/assets/fonts/figtree-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --slate: #263b46;        /* sidebar, primary button */
  --canvas: #f5f4f0;       /* page ground */
  --warm-gray: #e4e3de;    /* borders, segmented track, empty cover */
  --card: #ffffff;
  --ink: #1e2b31;
  --muted: #5a666b;
  --sage: #578e8d;         /* utility icons, accents; single token so it can be retuned */
  --teal-text: #3f6f6e;    /* links, job numbers, headings on drawing chrome */
  --amber: #d9955a;        /* sparing highlight: the + on New job */
  --sb-text: #cbd6da;
  --sb-muted: #a9bcc2;
  --sb-active: #7fb3b1;
  --hold: #b42318;         /* red stripe for hold / no drawings (status model) */
  --hold-bg: #f7c9c4;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-card: 12px; --r-btn: 10px; --r-row: 8px;
  --bar-h: 48px;
  --rail: 68px; --sb: 240px;
}
@media (max-width: 699px) { :root { --rail: 56px; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  background: var(--canvas);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; }
a { color: inherit; text-decoration: none; }
.ui-ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.ui-ico.sm { width: 18px; height: 18px; }
.ui-ico.amber { stroke: var(--amber); stroke-width: 2.4; }
.t-ico { width: 28px; height: 28px; fill: none; stroke: var(--c, var(--sage)); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.t-ico.white { stroke: #fff; stroke-width: 1.6; }

/* ---- login (only when a job has a password) ---- */
body.login { background: var(--slate); min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--card); border-radius: var(--r-card); padding: 36px 32px 32px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.brand { font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--teal-text); margin: 0 0 8px; min-height: 1em; }
.login-card h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.login-card .job { font-size: 13px; color: var(--muted); margin: 0 0 28px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.login-card input[type="password"] { width: 100%; font: inherit; font-size: 20px; padding: 14px 16px; border: 1px solid var(--warm-gray); border-radius: var(--r-btn); background: var(--canvas); color: var(--ink); outline: none; margin-bottom: 18px; }
.login-card input[type="password"]:focus { border-color: var(--sage); background: #fff; }
.login-card button { width: 100%; padding: 16px; font-size: 17px; font-weight: 700; color: #fff; background: var(--slate); border: 0; border-radius: var(--r-btn); cursor: pointer; }

/* ---- app shell: sidebar + stage ---- */
html:has(body.app) { overflow: hidden; height: 100%; overscroll-behavior: none; touch-action: none; }
body.app { position: fixed; inset: 0; overflow: hidden; width: 100%; height: 100%; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; }

/* stage: content area right of the sidebar. Tile screens get pushed by an expanded sidebar; drawing screens never move. */
.stage { position: fixed; top: 0; right: 0; bottom: 0; left: var(--rail); background: var(--canvas); transition: left 0.2s ease; }
.screen-tiles.sb-expanded .stage { left: var(--sb); }
.screen-drawing .stage { top: calc(var(--bar-h) + env(safe-area-inset-top)); left: var(--rail); }
@media (max-width: 699px) { .screen-tiles.sb-expanded .stage { left: var(--rail); } }

/* ---- persistent left sidebar ---- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail); z-index: 40;
  background: var(--slate); color: var(--sb-text);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  transition: width 0.2s ease;
}
.sb-expanded .sidebar { width: var(--sb); }
.sidebar.overlay { box-shadow: 12px 0 40px rgba(0, 0, 0, 0.3); }
.sb-scrim { position: fixed; inset: 0; z-index: 39; background: rgba(30, 43, 49, 0.25); }
.sb-edge { position: fixed; top: 0; bottom: 0; left: calc(var(--rail) - 6px); width: 12px; z-index: 41; cursor: ew-resize; }
.sb-expanded .sb-edge { left: calc(var(--sb) - 6px); }
.sb-top { display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 10px; flex: 0 0 auto; }
.sb-collapsed .sb-top { flex-direction: column; height: auto; padding: 8px 0 2px; gap: 2px; }
.sb-toggle { width: 44px; height: 44px; flex: 0 0 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--sb-muted); border-radius: var(--r-row); cursor: pointer; }
.sb-toggle:active, .sb-row:active { background: rgba(255, 255, 255, 0.08); }
.wordmark { display: inline-flex; align-items: baseline; gap: 4px; font-size: 11px; letter-spacing: 3px; color: #fff; white-space: nowrap; line-height: 1; }
.wordmark .l { font-weight: 300; } .wordmark .h { font-weight: 800; }
.wordmark .wm-short { display: none; letter-spacing: 1px; font-size: 13px; }
.sb-collapsed .wordmark .wm-full { display: none; }
.sb-collapsed .wordmark .wm-short { display: inline; }
/* customer's company block: the prominent element */
.sb-co { display: flex; align-items: center; gap: 12px; margin: 4px 10px 10px; padding: 8px; border-radius: var(--r-btn); color: #fff; min-height: 60px; }
.sb-co:active { background: rgba(255, 255, 255, 0.08); }
.sb-collapsed .sb-co { justify-content: center; margin: 4px 6px 8px; padding: 6px 0; }
.sb-logo { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 10px; background: var(--sb-active); color: var(--slate); font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.sb-logo img { width: 100%; height: 100%; object-fit: cover; }
.sb-co-text { min-width: 0; display: flex; flex-direction: column; }
.sb-co-name { font-size: 16px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-co-sub { font-size: 12px; color: var(--sb-muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-collapsed .sb-co-text { display: none; }
.sb-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; padding: 0 8px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-section { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.1); display: flex; flex-direction: column; gap: 2px; }
.sb-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sb-muted); padding: 2px 12px 6px; }
.sb-collapsed .sb-label { display: none; }
.sb-row {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px;
  border-radius: var(--r-row); color: var(--sb-text); background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer;
  font-size: 15px; font-weight: 500; line-height: 1.2;
}
.sb-row.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sb-row.active .sb-ico { color: var(--sb-active); }
.sb-row.soon { color: var(--sb-muted); }
.sb-ico { width: 28px; height: 28px; flex: 0 0 28px; display: inline-flex; align-items: center; justify-content: center; color: var(--sb-text); }
.sb-ico .t-ico { width: 24px; height: 24px; stroke: var(--c, var(--sb-text)); }
.sb-trade .sb-ico .t-ico { stroke-width: 1.7; }
.sb-text { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; flex-direction: column; }
.sb-text small { font-size: 11px; color: var(--sb-muted); font-weight: 400; }
.sb-collapsed .sb-row { justify-content: center; padding: 0; gap: 0; }
.sb-collapsed .sb-text { display: none; }
.sb-jobmark { width: 26px; height: 26px; border-radius: 7px; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; letter-spacing: 0.02em; }
.sb-job .sb-text { font-weight: 700; color: #fff; }
.sb-bottom { flex: 0 0 auto; padding: 8px 8px 10px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
/* collapsed-rail tooltip (long-press on touch, title on desktop) */
.tip { position: fixed; z-index: 60; transform: translateY(-50%); background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 7px 11px; border-radius: 8px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); pointer-events: none; }

/* ---- top bar: drawing screens only (back + breadcrumb + legend), 48 px ---- */
.topbar {
  position: fixed; top: 0; right: 0; left: var(--rail); height: var(--bar-h);
  background: var(--card); color: var(--ink); border-bottom: 1px solid var(--warm-gray);
  display: flex; align-items: center; gap: 2px; padding: 0 6px; z-index: 10;
  padding-top: env(safe-area-inset-top); box-sizing: content-box;
}
.icon-btn { width: 44px; height: 44px; flex: 0 0 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--ink); border-radius: var(--r-row); cursor: pointer; }
.icon-btn:active { background: rgba(30, 43, 49, 0.07); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.crumbs { display: flex; align-items: center; min-width: 0; flex: 1; overflow: hidden; font-size: 15px; line-height: 1.2; }
.crumb { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; border-radius: var(--r-row); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--teal-text); font-weight: 600; min-width: 0; flex: 0 1 auto; }
a.crumb:active { background: rgba(30, 43, 49, 0.07); }
.crumb.current { color: var(--ink); font-weight: 700; flex: 1 1 auto; }
.crumb-sep { color: var(--muted); padding: 0 2px; flex: 0 0 auto; }
@media (max-width: 600px) { .crumb:not(.current) { max-width: 28vw; } .crumbs { font-size: 14px; } }

/* legend in the top bar (trade plans): chips inline when wide, a "Legend" drop-down when narrow */
.topbar .legend { margin-left: auto; position: relative; flex: 0 0 auto; display: flex; align-items: center; }
.legend-toggle { display: none; align-items: center; gap: 4px; height: 34px; padding: 0 10px 0 12px; background: var(--canvas); color: var(--ink); border: 1px solid var(--warm-gray); border-radius: var(--r-btn); font-size: 13px; font-weight: 600; cursor: pointer; }
.legend-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.legend-items { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--ink); justify-content: flex-end; }
.lg-bubble { --c: var(--sage); display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px 0 8px; border-radius: 14px; background: var(--canvas); border: 1px solid var(--warm-gray); white-space: nowrap; }
.lg-bubble .sw { display: inline-block; width: 16px; height: 11px; border-radius: 2px; background: color-mix(in srgb, var(--c) 45%, #fff); border: 1.5px solid var(--c); }
.lg-bubble .sw.striped { border: 1.5px solid var(--hold); background: repeating-linear-gradient(45deg, var(--hold) 0 1.5px, var(--hold-bg) 1.5px 4px); }
@media (max-width: 1023px) {
  .legend-toggle { display: inline-flex; }
  .legend-items { display: none; position: absolute; right: 0; top: calc(100% + 8px); flex-direction: column; align-items: flex-start; gap: 10px; min-width: 200px; padding: 12px 14px; background: var(--card); border: 1px solid var(--warm-gray); border-radius: var(--r-btn); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18); z-index: 12; }
  .legend.open .legend-items { display: flex; }
}

.empty { padding: 40px 4px; color: var(--muted); font-size: 14px; }

/* ---- tile pages: jobs, job, sheets, specs, placeholders ---- */
.page { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.page-inner { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; padding-top: calc(22px + env(safe-area-inset-top)); padding-right: max(24px, env(safe-area-inset-right)); }
@media (max-width: 699px) { .page-inner { padding-left: 16px; padding-right: 16px; } }
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); margin: 0; line-height: 1.1; }
.page-sub { font-size: 15px; color: var(--muted); margin-top: 6px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -8px 0 4px -8px; padding: 0 10px 0 6px; border-radius: var(--r-row); color: var(--teal-text); font-weight: 600; font-size: 15px; }
.back-link:active { background: rgba(30, 43, 49, 0.06); }

/* jobs page */
.jobs-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.jh-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-field { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: var(--card); border: 1px solid var(--warm-gray); border-radius: var(--r-btn); color: var(--muted); min-width: 220px; }
.search-field input { flex: 1; min-width: 0; font: inherit; font-size: 15px; border: 0; outline: none; background: transparent; color: var(--ink); -webkit-appearance: none; }
.search-field:focus-within { border-color: var(--sage); }
.btn-primary { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px; background: var(--slate); color: #fff; border: 0; border-radius: var(--r-btn); font-weight: 700; font-size: 15px; cursor: pointer; }
.btn-primary:active { opacity: 0.85; }
.segmented { display: inline-flex; padding: 3px; background: var(--warm-gray); border-radius: var(--r-btn); margin-bottom: 18px; }
.seg-btn { min-height: 38px; padding: 0 16px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.seg-btn.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1023px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 699px) { .cards { grid-template-columns: 1fr; gap: 14px; } }
.jcard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--warm-gray); border-radius: var(--r-card); overflow: hidden; color: var(--ink); }
.jcard:active { background: #fbfaf7; }
.jc-cover { height: 176px; background: color-mix(in srgb, var(--warm-gray) 70%, var(--sage) 8%); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
@supports not (background: color-mix(in srgb, red 50%, #fff)) { .jc-cover { background: var(--warm-gray); } }
.jc-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-svg { width: 78%; height: 86%; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; }
.jc-body { padding: 14px 16px 14px; display: flex; flex-direction: column; gap: 4px; }
.jc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.jc-name { font-size: 19px; font-weight: 700; line-height: 1.2; min-width: 0; }
.jc-num { font-size: 14px; font-weight: 700; color: var(--teal-text); white-space: nowrap; }
.jc-addr { font-size: 14px; color: var(--muted); line-height: 1.3; }
.jc-trades { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--warm-gray); min-height: 22px; }
.jc-trade { display: inline-flex; }
.jc-trade .t-ico { width: 21px; height: 21px; stroke-width: 1.7; }

/* job page */
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 4px 0 20px; }
.job-cover { width: 132px; height: 74px; flex: 0 0 132px; border-radius: 10px; border: 1px solid var(--warm-gray); background: color-mix(in srgb, var(--warm-gray) 70%, var(--sage) 8%); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.job-cover img { width: 100%; height: 100%; object-fit: cover; }
.job-cover .cover-svg { width: 80%; height: 86%; stroke-width: 2.2; }
@media (max-width: 699px) { .job-cover { display: none; } }
.ttiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1023px) { .ttiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 699px) { .ttiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.ttile { --c: var(--sage); position: relative; display: flex; flex-direction: column; min-height: 142px; padding: 16px; background: var(--card); border: 1px solid var(--warm-gray); border-radius: var(--r-card); color: var(--ink); }
.ttile:active { background: #fbfaf7; }
.tt-circle { width: 60px; height: 60px; border-radius: 50%; background: var(--c); display: inline-flex; align-items: center; justify-content: center; }
.tt-circle .t-ico { width: 30px; height: 30px; }
.tt-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.tt-name { font-size: 17px; font-weight: 700; line-height: 1.15; min-width: 0; }
.tt-count { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; flex: 0 0 auto; line-height: 1.3; }
.urows { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; max-width: 760px; }
.urow { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 0 12px 0 14px; background: var(--card); border: 1px solid var(--warm-gray); border-radius: var(--r-card); color: var(--ink); }
.urow:active { background: #fbfaf7; }
.ur-ico { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: color-mix(in srgb, var(--sage) 14%, #fff); color: var(--sage); display: inline-flex; align-items: center; justify-content: center; }
@supports not (background: color-mix(in srgb, red 14%, #fff)) { .ur-ico { background: var(--canvas); } }
.ur-label { flex: 1; font-size: 17px; font-weight: 700; }
.ur-chev { color: var(--muted); }

/* placeholder card (sheets, specs, set and spec routes in rev 1) */
.ph-card { background: var(--card); border: 1px solid var(--warm-gray); border-radius: var(--r-card); padding: 22px 22px 20px; max-width: 640px; margin-top: 16px; }
.ph-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.ph-text { font-size: 15px; line-height: 1.45; color: var(--muted); }
.kinds { max-width: 640px; margin-top: 14px; background: var(--card); border: 1px solid var(--warm-gray); border-radius: var(--r-card); overflow: hidden; }
.kind-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 16px 8px 14px; }
.kind-row + .kind-row { border-top: 1px solid var(--warm-gray); }
.kind-row .p-name { flex: 1; }

/* ---- viewport (pan/zoom layer, v1) ---- */
.vp-holder, .viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.viewport:active { cursor: grabbing; }
.vp-content { position: absolute; left: 0; top: 0; transform-origin: 0 0; container-type: inline-size; --inv: 1; --zoom: 1; }
.vp-content.vp-moving { will-change: transform; }
.plan-img, .sheet-img { image-rendering: auto; }
[data-tap] { position: absolute; }
[data-tap]::before { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, calc(44px * var(--inv))); height: max(100%, calc(44px * var(--inv))); transform: translate(-50%, -50%); }

/* ---- floor plans (v1) ---- */
.plans { container-type: inline-size; padding: var(--pad, 6px) 0 40px; --w: 50%; }
.floor { width: var(--w); margin: 0 auto; padding: var(--pad, 6px) 0 var(--gap, 8px); container-type: inline-size; }
.plan { position: relative; width: 100%; background: #fff; border: 1px solid var(--warm-gray); container-type: inline-size; }
.plan-img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.plan.no-image { background: #e9e6df; }
.plan-missing { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2.2cqw; }
/* rev 1 empty state: blank paper sheet with the floor name and a card */
.plan.paper { background: #fff; box-shadow: 0 0.3cqw 1.2cqw rgba(30, 43, 49, 0.08); display: flex; align-items: center; justify-content: center; }
.empty-card { text-align: center; padding: 3cqw 4cqw; border: 0.14cqw dashed var(--warm-gray); border-radius: 1.4cqw; background: var(--canvas); max-width: 70%; }
.ec-floor { font-size: 3.2cqw; font-weight: 700; color: var(--teal-text); letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.1; }
.ec-text { margin-top: 1cqw; font-size: 1.9cqw; color: var(--muted); }

/* floor bar directly below the plan (v1) */
.floor-bar { display: flex; align-items: baseline; gap: 2cqw; flex-wrap: wrap; margin-top: 0.8cqw; background: #fff; border: 0.18cqw solid var(--teal-text); border-left-width: 0.9cqw; padding: 0.9cqw 1.4cqw 1cqw; color: var(--teal-text); font-size: 1.35cqw; line-height: 1.25; white-space: nowrap; }
.floor-bar .fb-name { font-size: 2.4cqw; font-weight: 700; letter-spacing: -0.01em; }
.floor-bar .fb-job { color: var(--muted); }
.floor-bar .fb-sheet { font-weight: 700; }
.floor-bar .fb-sheet span { font-weight: 400; color: var(--muted); margin-left: 0.8cqw; }

/* piece highlights (v1): 45% fill of the trade / markup colour; red stripes for hold / none */
.hl { --c: var(--sage); position: absolute; display: block; background: color-mix(in srgb, var(--c) 45%, transparent); border: 0.14cqw solid var(--c); border-radius: 0.08cqw; }
@supports not (background: color-mix(in srgb, red 45%, transparent)) { .hl { background: var(--c); opacity: 0.6; } }
.hl.red { border-color: var(--hold); background: repeating-linear-gradient(45deg, var(--hold) 0 0.1cqw, var(--hold-bg) 0.1cqw 0.39cqw); }
.tag-chip { position: absolute; left: 0; top: 0; transform: translate(-30%, -60%); background: #fff; color: var(--ink); border: 0.07cqw solid var(--ink); border-radius: 0.22cqw; font-weight: 700; font-size: 0.83cqw; line-height: 1; padding: 0.19cqw 0.28cqw; white-space: nowrap; pointer-events: none; }
.tag-chip.red { border-color: var(--hold); color: var(--hold); }
.room-label { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; background: rgba(255, 255, 255, 0.92); border: 0.07cqw solid var(--ink); border-radius: 0.28cqw; padding: 0.25cqw 0.44cqw; text-align: center; white-space: nowrap; box-shadow: 0 0.08cqw 0.28cqw rgba(0, 0, 0, 0.15); }
.room-label .rn { font-weight: 700; font-size: 0.94cqw; line-height: 1.15; letter-spacing: 0.02em; text-transform: uppercase; }
.room-label .rnum { font-size: 0.83cqw; line-height: 1.2; color: var(--muted); }
.room-label.red { border-color: var(--hold); }
.room-label.red .rnum { color: var(--hold); }
.door-pill { --c: var(--teal-text); position: absolute; transform: translate(-50%, -50%); background: var(--c); color: #fff; border-radius: 1.1cqw; font-weight: 700; font-size: 0.8cqw; line-height: 1; padding: 0.28cqw 0.5cqw; white-space: nowrap; box-shadow: 0 0.08cqw 0.22cqw rgba(0, 0, 0, 0.25); }

/* ---- drawing viewer / spec viewer (v1; status and kind colours come from the theme) ---- */
.spec-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 2px 10px; }
.spec-link { --c: var(--teal-text); position: static; display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px; background: #fff; border: 1.5px solid var(--c); color: var(--c); font-size: 13px; font-weight: 700; }
.spec-link::before { display: none; }
.sheets { padding: 6px 1.2cqw 60px; }
.sheet { margin-bottom: 14px; }
.sheet-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 6px 2px 5px; font-size: 12px; line-height: 1.2; }
.sheet-n { color: var(--muted); }
.sheet-num { font-weight: 700; }
.sheet-title { font-weight: 700; }
.sheet-rev { color: var(--muted); margin-left: auto; }
.sheet-frame { position: relative; width: 100%; background: #fff; border: 1px solid var(--warm-gray); container-type: inline-size; }
.sheet-img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.status-strip { padding: 7px 10px; font-size: 12px; font-weight: 700; line-height: 1.2; color: #fff; background: var(--sc, var(--slate)); border-radius: 0 0 4px 4px; }
.callout { --c: var(--teal-text); position: absolute; transform: translate(-50%, -50%); background: rgba(255, 255, 255, 0.96); border: 0.18cqw solid var(--c); color: var(--c); border-radius: 1.6cqw; font-weight: 700; font-size: 1.25cqw; line-height: 1; padding: 0.45cqw 0.8cqw; white-space: nowrap; box-shadow: 0 0.1cqw 0.4cqw rgba(0, 0, 0, 0.2); }
.sheet.cutsheet { margin-left: 6%; }
.item-hl { --c: var(--teal-text); position: absolute; left: 4.5%; right: 4.5%; background: color-mix(in srgb, var(--c) 22%, transparent); border: 0.18cqw solid var(--c); border-radius: 0.3cqw; pointer-events: none; }
.item-hl .item-tag { position: absolute; left: -0.2cqw; top: 50%; transform: translate(-100%, -50%); background: var(--c); color: #fff; font-weight: 700; font-size: 1.2cqw; padding: 0.3cqw 0.6cqw; border-radius: 0.3cqw; }

/* status colours in text (modal): from the theme */
.m-value[class*="s-"] { color: var(--sc, var(--ink)); }

/* ---- room navigator panel (Spec/SIDE-PANEL-STYLE.md), slides out beside the sidebar ---- */
.panel-scrim { position: fixed; inset: 0; background: rgba(30, 43, 49, 0.3); z-index: 20; }
.panel {
  position: fixed; left: var(--rail); bottom: 0; top: 0;
  width: min(420px, calc(100vw - var(--rail))); background: var(--canvas); z-index: 21;
  transform: translateX(-102%); transition: transform 0.22s ease;
  display: flex; flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.22);
  touch-action: pan-y; -webkit-user-select: text; user-select: text;
  padding-top: env(safe-area-inset-top);
}
.panel.open { transform: translateX(0); }
.panel-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 10px 14px; }
.panel-search { flex: 1; font: inherit; font-size: 16px; padding: 11px 14px; border: 1px solid var(--warm-gray); border-radius: var(--r-btn); background: #fff; outline: none; color: var(--ink); -webkit-appearance: none; }
.panel-search:focus { border-color: var(--sage); }
.panel .icon-btn.dark { color: var(--muted); }
.panel-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 2px 14px 14px; display: flex; flex-direction: column; }
.panel-body > * { flex: 0 0 auto; }
.p-num.p-ico { --c: var(--teal-text); padding: 0; }
.p-num.p-ico .tab-ico { width: 22px; height: 22px; fill: none; stroke: var(--c); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.p-pages { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.p-muted { padding: 8px 16px 10px 16px; color: var(--muted); font-size: 14px; }

.fcard { background: #fff; border: 1px solid var(--warm-gray); border-radius: var(--r-card); margin-bottom: 12px; overflow: hidden; }
.fcard-head { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 10px 10px 16px; }
.fcard-head .stair { width: 26px; height: 26px; flex: 0 0 26px; fill: none; stroke: var(--teal-text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fcard-title { flex: 1; min-width: 0; display: block; color: inherit; }
.fcard-title .fname { display: block; font-size: 16px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--teal-text); line-height: 1.2; }
.fcard-title .fsub { display: block; font-size: 14px; color: var(--muted); line-height: 1.3; margin-top: 1px; }
.fcard-title:active { opacity: 0.7; }
.fcard-toggle { width: 44px; height: 44px; flex: 0 0 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--muted); cursor: pointer; border-radius: var(--r-row); }
.fcard-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.18s ease; }
.fcard.closed .fcard-toggle svg { transform: rotate(180deg); }
.fcard.closed .fcard-rooms { display: none; }
.fcard-rooms { border-top: 1px solid var(--warm-gray); }

.p-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 16px 8px 14px; color: var(--ink); }
.p-row + .p-row { border-top: 1px solid var(--warm-gray); }
.p-row:active { background: #fbfaf7; }
.p-num { flex: 0 0 auto; min-width: 54px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; background: color-mix(in srgb, var(--sage) 12%, #fff); color: var(--teal-text); border-radius: var(--r-row); font-size: 15px; font-weight: 700; }
@supports not (background: color-mix(in srgb, red 12%, #fff)) { .p-num { background: var(--canvas); } }
.p-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.p-name { font-size: 17px; font-weight: 500; line-height: 1.2; color: var(--ink); }
.p-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.p-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; background: var(--canvas); color: var(--teal-text); border-radius: 6px; font-size: 12px; font-weight: 700; }
/* status pills: colours from the theme (.mk-<status>) */
.mk { flex: 0 0 auto; display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap; background: var(--canvas); color: var(--teal-text); }

/* ---- "what is known" modal ---- */
.modal-scrim { position: fixed; inset: 0; background: rgba(30, 43, 49, 0.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { background: var(--card); border-radius: var(--r-card); width: 100%; max-width: 440px; max-height: 85vh; overflow-y: auto; padding: 10px 20px 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); -webkit-user-select: text; user-select: text; touch-action: pan-y; }
.m-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.m-kicker { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hold); font-weight: 700; }
.m-row { padding: 9px 0; border-top: 1px solid #efede8; }
.m-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.m-value { font-size: 16px; line-height: 1.4; white-space: pre-line; }
.m-link { display: block; margin-top: 14px; padding: 13px; text-align: center; background: var(--slate); color: #fff; border-radius: var(--r-btn); font-weight: 700; }

.sb-scroll::-webkit-scrollbar { display: none; }
@media (max-width: 699px) { .tt-foot { flex-direction: column; align-items: flex-start; gap: 2px; } .tt-name { font-size: 16px; } }
