/* FloorPlanner Takeoff — styled to match Simpro (Simpro Shared UI tokens). */
:root {
  --navy: #05183b;          /* headings, totals, switch symbols */
  --blue: #1976d2;          /* primary actions, selection */
  --blue-dark: #1565c0;
  --blue-soft: #e3f2fd;
  --blue-hover: #f1f7fd;
  --ink: #212529;
  --muted: #555c63;
  --icon: #495057;
  --line: #ced4da;
  --line-soft: #e9ecef;
  --hover: #e2e6ea;
  --bg: #f1f3f5;
  --panel: #ffffff;
  --subtle: #f8f9fa;
  --teal: #0f766e;          /* measurements: walls, lengths, areas */
  --teal-soft: #e3f3f2;
  --orange: #ea580c;        /* new work */
  --orange-soft: #fff8f2;
  --purple: #7e22ce;        /* needs checking */
  --purple-soft: #f8f3fc;
  --purple-line: #f1e6f8;
  --green: #2e7d32;
  --green-soft: #e8f5e9;
  --red: #dc3545;
  --red-soft: #fde8e8;
  --amber-soft: #fffbeb;
  --amber-line: #fde68a;
  --shadow: 0 2px 4px rgba(0,0,0,.1);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { display: flex; flex-direction: column; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-dark); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cap { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Buttons. Plain <button> is the secondary style, so older markup keeps working. */
button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 12px;
  cursor: pointer; min-height: 32px; transition: background .15s ease-in-out; font-weight: 500;
}
button:hover { background: var(--blue-hover); }
button:disabled { opacity: .45; cursor: default; background: var(--panel); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; white-space: nowrap; }
.btn-p, button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-p:hover, button.primary:hover { background: var(--blue-dark); }
.btn-s { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 12px; }
button.danger { color: var(--red); }
button.danger:hover { background: var(--red-soft); }
button.danger.primary { color: #fff; background: var(--red); border-color: var(--red); }   /* confirmBox({ danger }): red text on the blue primary was unreadable */
button.danger.primary:hover { background: var(--red); filter: brightness(0.92); }
button.link-btn { border: none; padding: 0; min-height: 0; background: none; color: var(--blue-dark); }
button.link-btn:hover { text-decoration: underline; background: none; }
.tool { width: 36px; height: 36px; min-height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--icon); flex: none; }
.tool:hover { background: var(--hover); }
.tool.on { background: var(--blue-soft); color: var(--blue-dark); }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; flex: none; }
.segg { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--bg); border-radius: 6px; }
.seg { border: 0; background: transparent; padding: 4px 10px; border-radius: 4px; color: var(--icon); min-height: 28px; font-size: 12px; }
.seg:hover { background: var(--hover); }
.seg.on { background: #fff; color: var(--blue-dark); font-weight: 600; box-shadow: var(--shadow); }

input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: #fff; min-height: 32px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.input { width: 100%; min-height: 40px; }
.select-sm { min-height: 32px; font-size: 12px; padding: 4px 8px; }

.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 9999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.chip.syncing { background: var(--blue-soft); color: var(--blue-dark); }
.chip.teal { background: var(--teal-soft); color: var(--teal); font-size: 11px; padding: 0 8px; }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.chip.orange { background: var(--orange-soft); color: var(--orange); }

/* Page header */
.page-head { height: 56px; flex: none; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 12px; padding: 0 16px; overflow-x: auto; }
.head-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.head-title > span:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.head-title .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.steps { display: flex; gap: 20px; margin-left: 24px; align-self: stretch; }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 0 4px; color: var(--muted); min-height: 0; white-space: nowrap; }
.tab:hover { background: transparent; color: var(--ink); }
.tab[aria-selected="true"] { color: var(--blue-dark); border-bottom-color: var(--blue); font-weight: 600; }
.tab:disabled { opacity: .5; }
.avatar { width: 32px; height: 32px; min-height: 32px; padding: 0; border-radius: 9999px; border: 0; background: var(--blue-soft);
  color: var(--blue-dark); font-weight: 600; font-size: 12px; flex: none; }

/* Toolbar */
.toolbar { min-height: 52px; flex: none; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  flex-wrap: wrap; gap: 2px; padding: 4px 12px; }
.toolbar .btn-sm, .toolbar .select-sm { margin: 0 2px; }
.zoom-pct { min-width: 52px; border: 0; background: transparent; font-size: 12px; padding: 0 4px; }
.zoom-pct:hover { background: var(--hover); }
.tool-hint { margin-left: 10px; font-size: 12px; color: var(--blue-dark); background: var(--blue-soft); padding: 2px 10px; border-radius: 9999px; }
.tool-hint:empty { display: none; }
.menu-wrap { position: relative; }
.dropdown { position: absolute; top: calc(100% + 4px); left: 0; z-index: 15; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 6px 16px rgba(0,0,0,.12); padding: 6px; min-width: 200px; }
.dropdown label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.dropdown label:hover { background: var(--hover); }
.dropdown input { min-height: 0; }

/* Board: rooms | plan | side panel */
.board { --left-w: 260px; --right-w: 320px; flex: 1; min-height: 0; display: grid;
  grid-template-columns: var(--left-col, var(--left-user, var(--left-w))) minmax(0, 1fr) var(--right-col, var(--right-user, var(--right-w))); }
.rooms, .side-panel { background: #fff; display: flex; flex-direction: column; min-height: 0; }
.rooms { border-right: 1px solid var(--line); position: relative; min-width: 0; }
/* The left panel can be hidden to a slim rail and dragged wider or narrower (leftpanel.js), only
   while it sits beside the plan: not as a touch drawer, nor stacked on a narrow screen. */
.rooms-collapse, .rooms-rail, .rooms-resizer { display: none; }
.board.left-docked:not(.left-collapsed) .rooms-collapse { display: grid; place-items: center; position: absolute; top: 10px; right: 8px; z-index: 2;
  width: 26px; height: 26px; min-height: 0; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.board.left-docked .rooms-collapse:hover { background: var(--hover); border-color: var(--line); color: var(--navy); }
.board.left-docked:not(.left-collapsed) .rooms-resizer { display: block; position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; z-index: 3;
  cursor: col-resize; touch-action: none; }
.rooms-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .12s; }
.rooms-resizer:hover::after, .rooms-resizer:focus-visible::after, .rooms-resizer.dragging::after { background: var(--blue); }
.rooms-resizer:focus-visible { outline: none; }
body.resizing-left, body.resizing-left * { cursor: col-resize !important; user-select: none !important; }
.board.left-docked.left-collapsed { --left-col: 32px; }
.board.left-docked.left-collapsed > .rooms > :not(.rooms-rail) { display: none !important; }
.board.left-docked.left-collapsed .rooms-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; width: 100%;
  min-height: 0; padding: 12px 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.rooms-rail span { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em; }
.board.left-docked .rooms-rail:hover { background: var(--hover); color: var(--navy); }
.side-panel { border-left: 1px solid var(--line); position: relative; min-width: 0; }
/* The right panel collapses and resizes the same way (rightpanel.js, sharing dockpanel.js), mirrored. */
.side-collapse, .side-rail, .side-resizer { display: none; }
.board.right-docked:not(.right-collapsed) .side-collapse { display: grid; place-items: center; position: absolute; top: 10px; right: 8px; z-index: 2;
  width: 26px; height: 26px; min-height: 0; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.board.right-docked .side-collapse:hover { background: var(--hover); border-color: var(--line); color: var(--navy); }
.board.right-docked:not(.right-collapsed) #side-tabs { padding-right: 40px; }
.board.right-docked:not(.right-collapsed) .side-resizer { display: block; position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; z-index: 3;
  cursor: col-resize; touch-action: none; }
.side-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .12s; }
.side-resizer:hover::after, .side-resizer:focus-visible::after, .side-resizer.dragging::after { background: var(--blue); }
.side-resizer:focus-visible { outline: none; }
body.resizing-right, body.resizing-right * { cursor: col-resize !important; user-select: none !important; }
.board.right-docked.right-collapsed { --right-col: 32px; }
.board.right-docked.right-collapsed > .side-panel > :not(.side-rail) { display: none !important; }
.board.right-docked.right-collapsed .side-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; width: 100%;
  min-height: 0; padding: 12px 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.side-rail span { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em; }
.board.right-docked .side-rail:hover { background: var(--hover); color: var(--navy); }
.total-card { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.total-card .big { font-size: 24px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.total-card .stats { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.total-card .stats div { display: flex; flex-direction: column; }
.total-card .stats b { font-size: 13px; font-weight: 600; }
.total-card .stats span { font-size: 11px; color: var(--muted); }
.rooms-head { padding: 12px 12px 4px 16px; display: flex; align-items: center; gap: 8px; }
.room-tree { padding: 0 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.chev { transition: transform .15s ease-in-out; flex: none; }
details[open] > summary .chev { transform: rotate(90deg); }
.fl > summary { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 6px; min-height: 36px; font-weight: 500; }
.fl > summary:hover { background: var(--hover); }
.fl[open] > summary { font-weight: 600; }
.fl.room > summary { background: var(--blue-hover); }
.fl .fl > summary { padding-left: 22px; font-size: 13px; min-height: 32px; }
.it { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 34px; border-radius: 6px; border: 0; background: transparent;
  font-size: 13px; text-align: left; width: 100%; min-height: 30px; font-weight: 400; }
.fl .fl .it { padding-left: 44px; }
.it:hover { background: var(--hover); }
.it.on { background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.it .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it .priced { color: var(--green); font-size: 11px; font-weight: 600; }
.sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.dot-purple { width: 8px; height: 8px; border-radius: 9999px; background: var(--purple); flex: none; }

/* Plan */
.plan-area { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.plan-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); min-height: 22px; }
.plan-card { position: relative; flex: 1; min-height: 240px; background: #fff; box-shadow: var(--shadow); border-radius: 4px; display: flex; overflow: hidden; }
#plan:focus { outline: none; }   /* it takes focus on a press so keys (Space) go to the board */
#plan { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; background: #fff; }
#plan[data-tool="linear"], #plan[data-tool="area"], #plan[data-tool="rect"], #plan[data-tool="count"], #plan[data-tool="place"] { cursor: crosshair; }
#plan[data-tool="pan"], #plan.panning { cursor: grab !important; }   /* the Hand, or Space held: beats every tool's cursor */
#plan.grabbing { cursor: grabbing !important; }
  paint-order: stroke; stroke: rgba(255,255,255,.92); stroke-width: 3px; pointer-events: none; }
.plan-area.dragover::after { content: 'Drop the takeoff file'; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(25,118,210,.1); border: 3px dashed var(--blue); font-size: 20px; color: var(--blue-dark); }

/* Files from the site walk */
.frames { display: flex; flex-direction: column; gap: 8px; }
.frames:empty { display: none; }
.frames .row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.frame { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); flex: none; width: 128px;
  border: 0; background: none; padding: 0; text-align: left; min-height: 0; font-weight: 400; }
.frame:hover { background: none; color: var(--ink); }
.frame .thumb { width: 128px; height: 80px; border-radius: 4px; background: #495057 center / cover no-repeat; box-shadow: var(--shadow);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; }
.frame .thumb.pdf { background: #fff; color: var(--red); border: 1px solid var(--line); box-shadow: none; }

/* Empty state / scan list */
.empty { position: absolute; inset: 40px 24px auto; margin: auto; max-width: 460px; text-align: center; background: #fff;
  border-radius: 6px; padding: 24px; box-shadow: 0 6px 24px rgba(0,0,0,.12); z-index: 8; }
.empty h2 { margin: 0 0 8px; font-size: 18px; color: var(--navy); }
.empty p { line-height: 1.5; }
.empty .close-btn { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 16px; color: var(--muted); }
.scan-list { text-align: left; margin: 12px 0; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.scan-list button { display: flex; justify-content: space-between; align-items: center; width: 100%; border: none; border-bottom: 1px solid var(--line-soft);
  border-radius: 0; padding: 10px 12px; text-align: left; min-height: 48px; font-weight: 400; }
.scan-list button:last-child { border-bottom: 0; }
.scan-list .meta { color: var(--muted); font-size: 12px; }

/* Side panel tabs */
.ptabs { display: flex; gap: 20px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.ptab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 2px; color: var(--muted);
  min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.ptab:hover { background: transparent; color: var(--ink); }
.ptab.on { color: var(--blue-dark); border-bottom-color: var(--blue); font-weight: 600; }
.pane { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.pane[hidden] { display: none; }
.note { background: var(--subtle); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.note.check { border: 1px solid var(--purple-line); background: var(--purple-soft); }
.note.check .title { font-size: 12px; font-weight: 600; color: var(--purple); }
.note.info { background: #eff6ff; color: #244489; font-size: 12px; }
.note ul { margin: 0; padding-left: 18px; }
.note .row { display: flex; gap: 6px; flex-wrap: wrap; }
.scope-item { display: flex; gap: 8px; font-size: 13px; }
.scope-item .t { color: var(--blue-dark); font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }

/* Inspector (Selection tab) */
.inspector h3 { margin: 0 0 2px; font-size: 16px; color: var(--navy); }
.inspector .kv, .field-sheet .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; font-size: 13px; }
.inspector .kv span:nth-child(odd), .field-sheet .kv span:nth-child(odd) { color: var(--muted); }
.inspector .kv span:nth-child(even), .field-sheet .kv span:nth-child(even) { font-variant-numeric: tabular-nums; }
.field-sheet .kv { font-size: 15px; }   /* the phone's asset sheet (PRD-008 M2) */
.inspector .row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.inspector .row input:not([type]) { flex: 1; }
.inspector .attached { margin-top: 12px; }
.inspector .attached .att { display: flex; justify-content: space-between; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.inspector select { max-width: 140px; font-size: 12px; padding: 2px 6px; }

/* Catalog tab */
.catalog { gap: 10px; }
.catalog-results { flex: 1; }
.cat-item { padding: 10px 2px; border-bottom: 1px solid var(--line-soft); }
.cat-item .name { font-weight: 600; }
.cat-item .meta { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.cat-item .acts { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.cat-item .acts button { font-size: 12px; padding: 2px 8px; min-height: 28px; }

/* Step 2 · Review and price */
.review { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 16px 24px; align-items: start; }
.review[hidden] { display: none; }
.review-main, .review-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card h2 { margin: 0; font-size: 16px; color: var(--navy); }
.banner { background: var(--amber-soft); border: 1px solid var(--amber-line); border-radius: 6px; padding: 12px 16px; font-size: 13px; }
.cc { border: 1px solid var(--line-soft); border-radius: 6px; }
.cc + .cc { margin-top: 8px; }
.cc > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.cc > summary:hover { background: var(--subtle); }
.cc-name { font-weight: 600; border: 1px solid transparent; padding: 2px 6px; min-height: 0; margin-left: -6px; background: transparent; }
.cc-name:hover, .cc-name:focus { border-color: var(--line); background: #fff; }
table.lines { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lines th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--subtle); }
table.lines td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.lines tr:last-child td { border-bottom: 0; }
table.lines tr:hover td { background: var(--blue-hover); cursor: pointer; }
table.lines tr.flag td { background: var(--purple-soft); }
table.lines .r { text-align: right; }
table.lines .sub { color: var(--muted); font-size: 12px; }
table.lines input { width: 84px; text-align: right; padding: 2px 6px; min-height: 28px; font-variant-numeric: tabular-nums; }
.src { display: inline-flex; border-radius: 9999px; padding: 0 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.src.scan { background: var(--teal-soft); color: var(--teal); }
.src.web { background: var(--blue-soft); color: var(--blue-dark); }
.src.room { background: var(--line-soft); color: var(--icon); }
.src.manual { background: #fff1d6; color: #9a6200; }
.quote-name { font-size: 16px; font-weight: 600; }
.customer-row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.sum-row input { width: 64px; text-align: right; padding: 2px 6px; min-height: 28px; }
.sum-row.grand { font-size: 20px; font-weight: 700; color: var(--navy); padding-top: 6px; border-top: 1px solid var(--line-soft); }
.quick-adds { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-adds button { font-size: 12px; min-height: 28px; padding: 2px 10px; }
.empty-lines { padding: 16px 4px; color: var(--muted); line-height: 1.5; }

/* Simpro create / sync progress and result (quotesync.js); a click dismisses it */
.create-status { position: fixed; left: 16px; bottom: 16px; z-index: 25; max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; color: var(--ink); cursor: pointer; }
.create-status:empty { display: none; }

/* Menus, dialogs, toast */
.menu { position: fixed; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14); padding: 4px; min-width: 220px; }
.menu button { display: block; width: 100%; text-align: left; border: none; padding: 6px 10px; border-radius: 4px; font-weight: 400; }
.menu button:hover { background: var(--blue-hover); }
.menu .hdr { padding: 6px 10px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
dialog { border: 0; border-radius: 6px; padding: 24px; min-width: 420px; max-width: 640px; box-shadow: 0 16px 48px rgba(0,0,0,.24); }
dialog::backdrop { background: rgba(5,24,59,.35); }
dialog h3 { margin-top: 0; color: var(--navy); }
dialog .list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; }
dialog .list button { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line-soft); border-radius: 0; padding: 10px 12px; font-weight: 400; }
dialog .list button:hover { background: var(--blue-hover); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
dialog ul { padding-left: 18px; line-height: 1.5; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 6px; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 560px; }

/* Sign-in */
.signin { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); }
.signin-card { width: 380px; background: #fff; border-radius: 6px; padding: 28px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.signin-card h2 { margin: 4px 0 0; color: var(--navy); }
.signin-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.signin-card input { font-size: 15px; min-height: 40px; color: var(--ink); }
.signin-card .primary { min-height: 40px; }
.signin-card .error { color: var(--red); font-size: 13px; }
.signin-card .signup-only { display: flex; flex-direction: column; gap: 12px; }
.signin-card .signup-only[hidden] { display: none; }

/* Narrow windows: stack the panels */
@media (max-width: 1100px) {
  .board { --left-w: 220px; --right-w: 280px; }
  .review { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .board { display: flex; flex-direction: column; }
  .plan-card { min-height: 360px; }
  .steps { margin-left: 8px; gap: 12px; }
}

[hidden] { display: none !important; }

/* Quote options: Good / Better / Best */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.switch input { min-height: 0; width: 16px; height: 16px; accent-color: var(--blue); }
.opt-rec-all { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.opt-rec-all button { min-height: 28px; padding: 2px 10px; font-size: 12px; }
.opt-wrap { overflow-x: auto; }
table.options { width: 100%; border-collapse: collapse; font-size: 13px; }
table.options th, table.options td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.options th:first-child { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; vertical-align: bottom; }
table.options .r { text-align: right; }
table.options .sub { color: var(--muted); font-size: 12px; }
.opt-head { text-align: left; min-width: 170px; }
.opt-head.off { opacity: .55; }
.opt-head input:not([type]) { width: 100%; border-color: transparent; padding: 2px 6px; margin-left: -6px; min-height: 0; background: transparent; }
.opt-head input:not([type]):hover, .opt-head input:not([type]):focus { border-color: var(--line); background: #fff; }
.opt-name { font-weight: 700; color: var(--navy); font-size: 14px; }
.opt-note { font-size: 12px; color: var(--muted); }
.opt-ctl { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; font-weight: 400; color: var(--muted); }
.opt-ctl label { display: flex; align-items: center; gap: 6px; }
.opt-ctl input[type=checkbox] { min-height: 0; accent-color: var(--blue); }
.opt-ctl input.adj { width: 64px; min-height: 26px; padding: 1px 6px; text-align: right; }
button.price { min-width: 110px; font-variant-numeric: tabular-nums; font-weight: 500; }
button.price.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); font-weight: 700; box-shadow: inset 0 0 0 1px var(--blue); }
tr.pkg td { border-bottom: 0; background: var(--subtle); }
.opt-rec { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 6px; background: var(--blue-hover); border: 1px solid var(--blue-soft); }
.opt-rec .big { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.opt-rec .r { text-align: right; }
.sub.alt { color: var(--blue-dark); }
.sub.alt .link-btn { font-size: 12px; }

/* ---- Plans: sheets on the board ---- */
@keyframes pulse { 50% { opacity: .35; } }
#plan[data-tool="symbol"], #plan[data-tool="calibrate"], #plan[data-tool="wall"], #plan[data-tool="deduct"], #plan[data-tool="space"], #plan[data-tool="ruler"] { cursor: crosshair; }
.tool.ai { color: var(--purple); background: var(--purple-soft); }
.tool.ai.on { background: var(--purple-line); color: var(--purple); }
.btn-ai { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-line); font-weight: 600; }
.btn-ai:hover { background: var(--purple-line); }

/* AI progress */
.ai-progress { background: #fff; border: 1px solid var(--purple-line); border-radius: 6px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.ai-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.ai-dot { width: 10px; height: 10px; border-radius: 9999px; background: var(--purple); animation: pulse 1s ease-in-out infinite; }
.ai-bar { height: 6px; border-radius: 9999px; background: var(--purple-soft); overflow: hidden; }
.ai-bar span { display: block; height: 100%; background: var(--purple); transition: width .4s ease; }

/* Left panel tabs and rows */
.left-tabs { padding: 0 10px; gap: 10px; }
.left-tabs .ptab { min-height: 38px; padding: 6px 2px; font-size: 13px; white-space: nowrap; }
.left-pane { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.left-pane[hidden] { display: none; }
/* The Sections tab's Add level: pinned to the bottom of the panel, however long the tree is */
.pane-foot { position: sticky; bottom: 0; z-index: 1; padding: 8px 12px; background: var(--panel, #fff); border-top: 1px solid var(--line); margin-top: auto; }
.pane-foot[hidden] { display: none; }
.room-tree .empty-section { padding: 2px 12px 6px 28px; }
.pane-foot .btn { width: 100%; justify-content: center; }
.sheet-row { margin: 4px 8px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 6px; display: flex; flex-direction: column; gap: 4px; }
.sheet-row.off { opacity: .55; }
.sheet-row .name { text-align: left; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-row .row { display: flex; align-items: center; gap: 6px; }
.sheet-q { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; font-size: 12px; color: var(--muted); }
.sheet-q b { color: var(--ink); font-variant-numeric: tabular-nums; }
.height-row { display: flex; align-items: center; gap: 8px; padding: 6px 16px; font-size: 13px; }
.height-row .name { text-align: left; }
.height-row input { min-height: 28px; padding: 2px 6px; text-align: right; }

/* ---- Setup (Start from plan) ---- */
.setup { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.setup-main { max-width: 1100px; width: 100%; margin: 0 auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.setup-foot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 24px; display: flex; gap: 12px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field > span:first-child { font-weight: 600; color: var(--muted); font-size: 12px; }
.field .row, .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input.narrow { width: 90px; }
.dropzone { border: 2px dashed var(--line); border-radius: 6px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; text-align: center; background: var(--subtle); }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-hover); }
.scale-all { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table.drawings input { width: 100%; min-width: 70px; text-align: left; }
table.drawings tr.off td { opacity: .5; }
table.drawings tr:hover td { cursor: default; background: transparent; }
.scale-cell { display: flex; flex-direction: column; gap: 4px; }
.section-row { padding: 6px 0; border-top: 1px solid var(--line-soft); }
.section-row input { max-width: 260px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.trade { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.trade.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); font-weight: 600; }
.trade input { min-height: 0; accent-color: var(--blue); }
.error { color: var(--red); }

/* Symbol recognition and review */
.sym-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.sym-crop { width: 84px; height: 84px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; image-rendering: pixelated; }
.sym-opts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; margin: 10px 0; }
.sym-results { box-shadow: none; border: 1px solid var(--line-soft); }
dialog .list button.on { background: var(--blue-soft); }
.check-list label { display: block; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.review-step strong { font-size: 15px; color: var(--navy); }
.rule-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.rule-row input:not([type=checkbox]) { min-height: 30px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
.btn-p:disabled, button.primary:disabled { background: var(--blue); color: #fff; opacity: .45; }
.pricing-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px 10px; align-items: center; padding: 10px 12px; font-size: 13px; }
.pricing-grid > label { color: var(--muted); }
.pricing-grid input[type=number] { width: 90px; text-align: right; }
.fit-secs { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; }
.rules { display: flex; flex-direction: column; }
.rule { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.rule.off { opacity: .6; }
.rule .r { text-align: right; white-space: nowrap; }
.warn-text { color: var(--orange); }
#needs-review { display: flex; gap: 6px; align-items: center; background: none; padding: 0; }
#needs-review .chip { border: 0; cursor: pointer; min-height: 0; }
#needs-review .chip.on { background: var(--purple); color: #fff; }
.lock-banner { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--amber-soft); border-bottom: 1px solid var(--amber-line); font-size: 13px; }
body.read-only #toolbar button[data-tool]:not([data-tool="select"]):not([data-tool="pan"]), body.read-only #ai-btn { opacity: .4; pointer-events: none; }
.pricing-grid > select, .pricing-grid > div > select, .pricing-grid .row select { max-width: 100%; min-width: 0; width: 100%; }
.pricing-grid > div { min-width: 0; }

/* Drafting options row under the toolbar (PRD-002 FR-11, FR-12-01) */
.tool-options { min-height: 36px; flex: none; background: var(--subtle); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; padding: 0 12px; flex-wrap: wrap; }
.tool-options[hidden] { display: none; }
.tool-options .tool-hint { margin-left: 4px; }
.opt-toggle { min-height: 26px; padding: 0 10px; font-size: 12px; border-radius: 9999px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.opt-toggle[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); font-weight: 600; }
.dropdown.right { left: auto; right: 0; }
.dropdown > button { display: flex; width: 100%; justify-content: space-between; gap: 16px; align-items: center; border: 0; background: none; text-align: left; padding: 6px 8px; border-radius: 4px; font-size: 13px; white-space: nowrap; }
.dropdown > button:hover { background: var(--hover); }
.dropdown kbd { font: 500 11px ui-monospace, Menlo, monospace; color: var(--muted); }
.dropdown .div { height: 1px; background: var(--line-soft); margin: 4px 0; }

/* PRD-002 M2: Straight/Arc, Drop, the armed item, the Items panel, styles and shortcuts */
.tool-options .segg .seg { min-height: 24px; padding: 2px 10px; }
.opt-field { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.opt-field input { min-height: 26px; }
.chip.armed { background: var(--blue-soft); color: var(--blue-dark); gap: 6px; }
.chip-x { border: 0; background: none; min-height: 0; padding: 0 2px; color: var(--blue-dark); font-size: 11px; }
#items-root { display: flex; flex-direction: column; gap: 10px; }
.items-head { display: flex; align-items: center; gap: 10px; }
.sym-pick { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; flex: none; }
.sym-pick:hover { border-color: var(--blue); }
/* In the left panel the hint takes its own line above the buttons */
#pane-items .items-head { flex-wrap: wrap; gap: 6px 10px; }
#pane-items .items-head > .grow { flex: 1 1 100%; order: -1; }
#pane-items .items-head > .btn-sm { margin-right: auto; }
.item-group > summary { font-size: 13px; }
.item-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 2px; border-radius: 6px; }
.item-row.on { background: var(--blue-soft); }
.item-row.off .item-main { opacity: .5; }
.item-row .item-drops { grid-column: 1 / -1; padding: 0 8px 6px 36px; }
.item-main { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 6px 8px; min-height: 34px; text-align: left; width: 100%; border-radius: 6px; font-size: 13px; }
.item-main:hover { background: var(--hover); }
.item-main .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main .qty { font-size: 12px; color: var(--muted); white-space: nowrap; }
.item-main kbd { font: 600 11px ui-monospace, Menlo, monospace; color: var(--muted); width: 12px; }
.item-main.pick { border: 1px solid var(--line-soft); }
.item-sym { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; flex: none; }
.item-row .tool { width: 30px; height: 30px; min-height: 30px; padding: 0; }
.item-row .kebab { font-size: 16px; font-weight: 700; }
.picker { border: 1px solid var(--blue); background: var(--blue-hover); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.picker .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.summary-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.summary-table td { padding: 5px 4px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.summary-table .num { text-align: right; white-space: nowrap; }
.symbol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; max-height: 190px; overflow: auto; padding: 4px; border: 1px solid var(--line-soft); border-radius: 6px; margin-top: 6px; }
.symbol-grid .sym { width: 38px; height: 38px; min-height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.symbol-grid .sym.on { background: var(--blue-soft); border-color: var(--blue); }
label.upload { cursor: pointer; display: inline-flex; align-items: center; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; }
.change-group { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.drops .row { display: flex; align-items: center; gap: 6px; }
.shortcuts { columns: 3 250px; column-gap: 28px; }
.shortcuts section { break-inside: avoid; padding-bottom: 10px; }   /* padding, not margin: a margin would carry into the next column's top */
/* the cheat sheet gets a wider dialog than the 640 px default: up to three columns, so it rarely scrolls */
dialog:has(> .shortcuts) { max-width: min(960px, calc(100vw - 32px)); width: 960px; }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0 0; font-size: 13px; }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--muted); }
.shortcuts kbd, .item-row kbd { display: inline-block; font: 600 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; margin-right: 3px; background: #fff; }
#shortcuts-btn { font-weight: 700; }
/* FR-16-03: focus is always visible */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button:focus-visible, .seg:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
#side-tabs { gap: 14px; overflow-x: auto; scrollbar-width: none; }
#side-tabs .ptab { white-space: nowrap; }
.item-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.summary-table { table-layout: fixed; font-size: 11.5px; }
.summary-table th { white-space: normal; line-height: 1.2; vertical-align: bottom; font-size: 11px; }
.summary-table td { overflow-wrap: anywhere; }
.summary-table th:nth-child(1) { width: 17%; } .summary-table th:nth-child(2) { width: 29%; }
.summary-table th:nth-child(3) { width: 17%; } .summary-table th:nth-child(4) { width: 17%; } .summary-table th:nth-child(5) { width: 20%; }
.summary-table td.num { white-space: normal; }
.summary-table th.num { text-align: right; }
.summary-table th:nth-child(1) { width: 15%; } .summary-table th:nth-child(2) { width: 25%; }
.summary-table th:nth-child(3) { width: 19%; } .summary-table th:nth-child(4) { width: 21%; } .summary-table th:nth-child(5) { width: 20%; }
.item-main .name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.item-main .name-wrap .name { flex: none; }
.item-main .name-wrap .qty { font-size: 11.5px; }
.item-row .item-drops { padding-left: 38px; }

/* Deductions nested under their area or volume (left panel) */
.it.child { padding-left: 34px; position: relative; color: var(--muted); }
.it.child::before { content: ''; position: absolute; left: 22px; top: 0; bottom: 50%; width: 8px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.it.child .num { color: var(--red); }
.it .net { color: var(--muted); font-weight: 400; font-size: 11px; }

/* Zoomed to one section or sheet: a way back to every plan */
.view-all { position: absolute; top: 10px; left: 10px; z-index: 5; box-shadow: var(--shadow); background: #fff; }
.view-all[hidden] { display: none; }
/* Drawing revisions (revisions.js): the compare / check bar along the bottom of the plan */
.revision-bar { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 12px; background: #fff; border: 1px solid var(--orange); border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; }
.revision-bar .legend { display: inline-flex; align-items: center; gap: 4px; }
.revision-bar .k { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.revision-bar .k.red { background: #dc2626; } .revision-bar .k.blue { background: #2563eb; margin-left: 6px; }
/* the Create / Update quote status line sits bottom-left of the window: keep the bar's buttons clear of it */
body:has(#create-status:not(:empty)) .revision-bar { bottom: 80px; }
button.chip { border: 0; cursor: pointer; min-height: 0; }
.section-title { text-align: left; font-weight: 600; color: inherit; padding: 0; }
.section-title:hover { color: var(--blue-dark); text-decoration: underline; background: none; }

/* In-app dialogs (ui.js) and the Scale dialog */
dialog.ask { min-width: 380px; }
dialog.ask .field { margin: 6px 0; }
dialog.ask .segg { margin: 8px 0; }
.detect-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; max-width: 520px; }
.detect-list .cand { text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; }
.detect-list .cand.on { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.detect-preview { display: block; max-width: 520px; max-height: 260px; margin: 4px 0 8px; border: 1px solid var(--line-soft); border-radius: 6px; background: #fff; }
.detect-preview:not([src]) { display: none; }
.detect-panel { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft, #f8fafc); }
.detect-panel h3 { margin: 0 0 4px; font-size: 14px; }
.scale-dialog .row { align-items: flex-end; }

/* The catalogue opens as a dialog (it used to be a side tab) */
.catalog-dialog { width: min(560px, 92vw); max-width: none; height: min(640px, 86vh); padding: 16px; display: none; flex-direction: column; gap: 8px; }
.catalog-dialog[open] { display: flex; }
.catalog-head { display: flex; align-items: center; gap: 8px; }
.catalog-dialog .pane.catalog { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; overflow: hidden; }
.catalog-dialog .catalog-results { flex: 1; overflow: auto; }

/* History tab */
.versions { display: flex; flex-direction: column; gap: 8px; }
.version { border: 1px solid var(--line-soft); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.version.on { border-color: var(--blue); background: var(--blue-hover); }
.version .row { margin-top: 2px; }
.chip.blue { background: var(--blue-soft); color: var(--blue-dark); }
.preview-banner { background: var(--blue-soft); border-bottom-color: var(--blue); }

/* Symbol search: matches to approve, over the board */
.sym-panel { position: absolute; top: 10px; right: 10px; z-index: 6; width: 300px; max-height: calc(100% - 20px); overflow: auto; background: #fff;
  border: 1px solid var(--purple-line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.16); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sym-panel[hidden] { display: none; }
.sym-thumb { width: 36px; height: 36px; object-fit: contain; border: 1px solid var(--line-soft); border-radius: 4px; background: #fff; }
.sym-list { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.sym-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.sym-row .link-btn { text-align: left; font-size: 12px; }
.sym-opts summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.sym-opts label { display: block; margin: 4px 0; font-size: 13px; }

/* Touch mode (PRD-002 FR-16-01/02; docs/tablet-evaluation.md) ------------------------------- */
html { -webkit-text-size-adjust: 100%; }
#plan { -webkit-touch-callout: none; -webkit-user-select: none; }
.touch-only, .drawer-scrim { display: none; }
.action-bar { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 6;
  display: flex; gap: 6px; padding: 6px; background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(5,24,59,.18); max-width: calc(100% - 24px); overflow-x: auto; overscroll-behavior-x: contain; }
.action-bar[hidden] { display: none; }
.action-bar button { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.action-bar button[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); font-weight: 600; }
[data-touch="on"] { touch-action: manipulation; }
[data-touch="on"] body { overscroll-behavior: none; }
[data-touch="on"] .touch-only { display: inline-flex; }
[data-touch="on"] .toolbar, [data-touch="on"] .tool-options, [data-touch="on"] .page-head { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
[data-touch="on"] .toolbar::-webkit-scrollbar, [data-touch="on"] .tool-options::-webkit-scrollbar { display: none; }
[data-touch="on"] .toolbar > *, [data-touch="on"] .tool-options > * { flex: none; }
[data-touch="on"] .tool, [data-touch="on"] button, [data-touch="on"] .btn, [data-touch="on"] .select-sm, [data-touch="on"] select,
[data-touch="on"] .seg, [data-touch="on"] .opt-toggle, [data-touch="on"] .tool-options .seg, [data-touch="on"] .item-row .tool,
[data-touch="on"] .item-main, [data-touch="on"] .it, [data-touch="on"] .fl > summary, [data-touch="on"] .menu button,
[data-touch="on"] .dropdown > button, [data-touch="on"] .dropdown label, [data-touch="on"] .ptab, [data-touch="on"] .chip-x { min-height: 44px; }
[data-touch="on"] .tool { min-width: 44px; height: 44px; }
[data-touch="on"] select, [data-touch="on"] .select-sm { height: auto; min-height: 44px; }
[data-touch="on"] input, [data-touch="on"] select, [data-touch="on"] textarea { font-size: 16px; }
[data-touch="on"] input[type=checkbox], [data-touch="on"] input[type=radio] { width: 22px; height: 22px; }
[data-touch="on"] dialog { max-height: 90dvh; overflow: auto; margin-top: 4dvh; }
[data-touch="on"] .tool-hint { display: none; }
/* Side panels become drawers so the plan gets the whole width (up to a large tablet in landscape). */
@media (max-width: 1366px) {
  [data-touch="on"] .board { grid-template-columns: minmax(0, 1fr) !important; position: relative; }
  [data-touch="on"] .board > .rooms, [data-touch="on"] .board > .side-panel {
    position: absolute; top: 0; bottom: 0; z-index: 8; width: min(340px, 88vw); background: var(--panel, #fff);
    box-shadow: 0 8px 30px rgba(5,24,59,.22); transition: transform .2s ease; display: flex; flex-direction: column; }
  [data-touch="on"] .board > .rooms { left: 0; transform: translateX(-105%); }
  [data-touch="on"] .board > .side-panel { right: 0; transform: translateX(105%); }
  [data-touch="on"] body.drawer-left .board > .rooms, [data-touch="on"] body.drawer-right .board > .side-panel { transform: none; }
  [data-touch="on"] body.drawer-left .drawer-scrim, [data-touch="on"] body.drawer-right .drawer-scrim { display: block; position: absolute; inset: 0; z-index: 7; background: rgba(5,24,59,.18); }
  [data-touch="on"] .board > .plan-area { grid-column: 1; }
}
[data-touch="on"] body { overflow: hidden; }
@media (max-width: 820px) { [data-touch="on"] .board { display: grid !important; } }
@media (prefers-reduced-motion: reduce) { [data-touch="on"] .board > .rooms, [data-touch="on"] .board > .side-panel { transition: none; } }
/* No sticky hover on touch screens. */
@media (hover: none) { .tool:hover, button:hover, .seg:hover, .it:hover, .item-main:hover, .fl > summary:hover { background: inherit; } }
[data-touch="on"] select, [data-touch="on"] .tool-options select, [data-touch="on"] .select-sm {
  -webkit-appearance: none; appearance: none; min-height: 44px !important; height: 44px; padding: 0 30px 0 12px; border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555c63' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }

/* PRD-005 Add items side sheet */
dialog.side-sheet { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); max-width: 100vw; border-radius: 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
dialog.side-sheet:not([open]) { display: none; }
.sheet-head, .sheet-foot { display: flex; align-items: center; gap: 8px; }
.sheet-head h3 { flex: 1; margin: 0; }
.add-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; border-top: 1px solid var(--line-soft); padding-top: 6px; }
.add-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.add-row .grow { display: flex; flex-direction: column; min-width: 0; }
.add-row.have { opacity: .55; }
.add-row select { max-width: 110px; }
.add-row input[type=color] { width: 32px; height: 28px; padding: 0; border: 0; background: none; }
.num-sm { width: 64px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.att-list { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; border: 1px solid var(--line-soft); border-radius: 6px; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; text-align: left; font-size: 13px; }
.att-row.folder { font-weight: 600; }
.oneoff { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.group-add { margin-left: 6px; width: 26px; height: 26px; min-height: 26px; font-weight: 700; }
.heights-grid { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.heights-grid label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.opening { flex-wrap: wrap; }

/* PRD-003–007 remaining: sheet snapshots, asset badge, archived rows, plan library */
.thumb-tip { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line, #ced4da); border-radius: 8px; padding: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); max-width: 372px; pointer-events: none; }
.thumb-tip img { display: block; max-width: 360px; max-height: 260px; }
.scan-list .scan-thumb { width: 64px; height: 44px; object-fit: contain; background: #fff; border: 1px solid var(--line, #ced4da); border-radius: 4px; flex: none; margin-right: 10px; }
.chip.asset-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; padding: 0 6px; background: #e8f5e9; color: #2e7d32; vertical-align: middle; }
.add-row.archived, .item-row.archived { opacity: .55; }
.add-row.archived b { text-decoration: line-through; }
.plan-library .sheet-row { display: grid; gap: 4px; }
.note.assign-all { margin-bottom: 8px; }

/* PRD-008 site asset maps */
/* Quote | Assets (workmode.js), above the plan on the right. In Assets the drawing tools and drafting options give way to the asset
   controls (the site bar, in the toolbar) and the left panel is hidden for now (dockpanel.js). */
.plan-head { display: flex; align-items: center; gap: 12px; }
.plan-head .plan-note { flex: 1; min-width: 0; }
.mode-toggle { flex: none; margin-left: auto; }
.mode-toggle[hidden] { display: none; }
.mode-toggle .seg { font-size: 13px; padding: 4px 12px; }
.mode-toggle .seg[aria-pressed=true] { background: #fff; color: var(--blue-dark); font-weight: 600; box-shadow: var(--shadow); }
body.asset-mode #toolbar .quote-tool { display: none !important; }
body.asset-mode #tool-options > :not(#tool-hint):not(.grow):not(#selection-count):not(.asset-chips) { display: none !important; }
.site-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.site-bar[hidden] { display: none; }
.site-bar > button { min-height: 30px; }
/* The asset types on this map: one tap each, in order of first use (a site walk switches type at every asset) */
.asset-chips { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.asset-chips[hidden] { display: none; }
.type-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 2px 10px 2px 8px; border: 1px solid var(--line, #d1d5db); border-radius: 999px;
  background: #fff; color: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; flex: none; }
.type-chip:hover { border-color: var(--blue); }
.type-chip[aria-pressed=true] { background: #eff6ff; border-color: var(--blue); color: var(--blue-dark); font-weight: 600; box-shadow: inset 0 0 0 1px var(--blue); }
.type-chip .type-sym { display: inline-grid; place-items: center; }
.type-chip .chip-n { color: var(--muted); font-size: 11px; font-weight: 400; }
html[data-touch=on] .type-chip { min-height: 44px; padding: 4px 14px 4px 10px; font-size: 15px; }
html[data-touch=on] .asset-chips { flex-wrap: nowrap; }
.type-list .type-sym { display: inline-grid; place-items: center; width: 22px; vertical-align: middle; margin-right: 6px; }
.asset-sheet .asset-look { align-items: flex-end; gap: 10px; }
.site-legend { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.site-legend[hidden] { display: none; }
.site-legend .dot::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; border: 2.5px solid #94a3b8; vertical-align: -1px; }
.site-legend .dot-pass::before { border-color: #16a34a; } .site-legend .dot-fail::before { border-color: #dc2626; } .site-legend .dot-overdue::before { border-color: #f59e0b; }
body.asset-mode #steps, body.asset-mode #quote-status { display: none; }   /* marking assets doesn't price; Quote keeps the steps */
.list-row { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line, #e5e7eb); background: none; cursor: pointer; }
.list-row:hover { background: rgba(25,118,210,.06); }
.type-list, .site-list { max-height: 50vh; overflow: auto; margin: 8px 0; }
.place-row { padding: 4px 0; border-bottom: 1px solid var(--line, #e5e7eb); }
.place-group { margin-top: 10px; }
.asset-sheet .asset-fields { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.asset-sheet .test-pass { color: #16a34a; font-weight: 600; } .asset-sheet .test-fail { color: #dc2626; font-weight: 600; }
html[data-touch=on] .site-bar button { min-height: 44px; min-width: 44px; }

/* PRD-008 M2 field mode (a site map on a phone) */
.field-top, .field-bottom, .field-sheet, .field-reticle { display: none; }
body.field-mode .page-head, body.field-mode #toolbar, body.field-mode #tool-options, body.field-mode aside.rooms, body.field-mode aside.side-panel,
body.field-mode #site-bar, body.field-mode .drawer-scrim, body.field-mode .plan-head { display: none !important; }
body.field-mode .board { grid-template-columns: 1fr !important; }
body.field-mode .plan-area { padding: 0; }
body.field-mode .plan-card { border-radius: 0; border: 0; }
body.field-mode { padding-top: calc(84px + env(safe-area-inset-top)); padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
body.field-mode .field-top:not([hidden]) { display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 30; gap: 8px; align-items: center;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px; background: #1e3a5f; color: #fff; min-height: 52px; }
.field-top .field-title { display: flex; flex-direction: column; min-width: 0; }
.field-top .field-site { background: none; border: 0; color: #fff; text-align: left; padding: 0; font-weight: 700; }
.field-top .field-title b, .field-top .field-site { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-top select { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; min-height: 30px; font-size: 13px; max-width: 70vw; }
.field-top select option { color: #000; }
.field-icon { background: transparent; border: 0; color: inherit; font-size: 24px; min-width: 44px; min-height: 44px; }
body.field-mode .field-bottom:not([hidden]) { display: flex; flex-wrap: wrap; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line, #e5e7eb); }
.field-chips { flex: 0 0 100%; display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: -2px -10px 0; padding: 0 10px 2px; }
.field-chips::-webkit-scrollbar { display: none; }
.field-chips .type-chip { min-height: 44px; font-size: 15px; padding: 4px 14px 4px 10px; }
.field-btn { flex: 1; min-height: 52px; border-radius: 12px; border: 1px solid var(--line, #d1d5db); background: #fff; font-size: 15px; font-weight: 600; }
.field-btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.field-btn.big { flex: 1.4; font-size: 17px; }
body.field-mode .field-reticle:not([hidden]) { display: block; position: fixed; z-index: 25; width: 0; height: 0; pointer-events: none; }
.field-reticle::before, .field-reticle::after { content: ''; position: absolute; background: #2563eb; box-shadow: 0 0 0 1px #fff; }
.field-reticle::before { left: -18px; top: -1px; width: 36px; height: 2px; }
.field-reticle::after { left: -1px; top: -18px; width: 2px; height: 36px; }
.field-loupe { position: absolute; width: 120px; height: 120px; left: -60px; top: -150px; border-radius: 50%; border: 3px solid #2563eb; box-shadow: 0 6px 18px rgba(0,0,0,.25); background: #fff; }
body.field-mode .field-sheet:not([hidden]) { display: block; position: fixed; left: 0; right: 0; bottom: var(--field-bottom-h, 68px); z-index: 29; max-height: min(50dvh, calc(100dvh - var(--field-top-h, 84px) - var(--field-bottom-h, 68px) - 8px)); overflow: auto;
  background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(15,23,42,.18); padding: 4px 16px 16px; }
body.field-mode .field-sheet.full { max-height: calc(100dvh - var(--field-top-h, 84px) - var(--field-bottom-h, 68px) - 8px); }   /* the handle stays below the top bar */
.field-sheet-head { display: flex; align-items: center; justify-content: center; position: sticky; top: 0; background: #fff; }
.field-handle { width: 56px; height: 24px; border: 0; background: transparent; position: relative; }
.field-handle::before { content: ''; position: absolute; left: 12px; right: 12px; top: 10px; height: 5px; border-radius: 3px; background: #cbd5e1; }
.field-sheet-head .field-icon { position: absolute; right: 0; color: #64748b; font-size: 18px; }
body.field-mode .field-sheet input, body.field-mode .field-sheet select, body.field-mode .field-sheet button { min-height: 44px; font-size: 16px; }
.queue-chip { border-radius: 999px; border: 0; background: #2563eb; color: #fff; padding: 4px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.queue-chip.failed { background: #dc2626; }
.queue-chip[hidden] { display: none; }
.photo-grid { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photo-grid img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line, #e5e7eb); }
.photo-wait { position: relative; opacity: .65; }
.photo-wait::after { content: '↑'; position: absolute; right: 4px; bottom: 4px; background: #2563eb; color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 12px; text-align: center; line-height: 18px; }
.asset-photos { margin-top: 10px; }
.scan-video { width: 100%; max-height: 50vh; background: #000; border-radius: 8px; }

/* Connection trouble (netstatus.js): offline, or the server/database not responding */
.net-banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  max-width: min(760px, calc(100vw - 24px)); margin-top: 8px; padding: 8px 12px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(15,23,42,.18);
  background: #fff7ed; color: #7c2d12; border: 1px solid #fdba74; }
.net-banner[data-state=offline] { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
.net-banner[hidden] { display: none; }
.net-banner button { margin-left: auto; }
.load-failed { padding: 14px; border: 1px dashed var(--line, #d1d5db); border-radius: 10px; color: var(--muted, #64748b); font-size: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.load-failed b { color: var(--ink, #1f2937); }

/* Below 1600 px the toolbar keeps to one row: Visible and Export PDF show just their icons (tooltip and
   accessible name stay), which leaves room for Add items beside AI takeoff. */
@media (max-width: 1599px) { #toolbar .btn-label { display: none; } }

/* ---- Projects page (projects.js): the start, before the board ---------------------------- */
body[data-view="projects"] > :not(#projects):not(dialog):not(.menu):not(.toast):not(#create-status):not(#net-banner):not(script) { display: none !important; }
.projects { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; background: var(--bg); }
.projects[hidden] { display: none; }
.proj-head { height: 56px; flex: none; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 12px; }
.proj-main { max-width: 1240px; width: 100%; margin: 0 auto; padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 16px; }
.proj-title { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.proj-title h1 { margin: 0; font-size: 24px; line-height: 1.2; color: var(--navy); }
.proj-search { position: relative; max-width: 640px; }
.proj-search > svg { position: absolute; left: 12px; top: 12px; color: var(--icon); }
.proj-search input { padding-left: 38px; padding-right: 56px; }
.proj-search kbd { position: absolute; right: 10px; top: 10px; font: 600 11px Inter, sans-serif; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; background: #fff; color: var(--muted); }
.proj-recent { display: flex; flex-direction: column; gap: 8px; }
.proj-recent-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.proj-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 9999px; padding: 4px 12px; font-size: 13px; min-height: 34px; font-weight: 500; }
.fchip.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.fchip-wrap { display: inline-flex; align-items: center; }
.fchip-wrap .fchip { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.fchip-x { min-height: 34px; padding: 0 8px; border: 1px solid var(--blue); border-left: 0; background: var(--blue-soft); color: var(--blue-dark); border-radius: 0 9999px 9999px 0; }
.proj-summary { display: flex; gap: 18px; flex-wrap: wrap; margin-top: -6px; }
.proj-summary b { color: var(--ink); }
.proj-live { display: flex; align-items: center; gap: 10px; min-height: 0; }
.proj-live:empty { display: none; }
.proj-live .arrived { display: inline-flex; align-items: center; gap: 6px; background: var(--blue); color: #fff; border: 0; border-radius: 9999px; padding: 2px 12px; min-height: 26px; font-size: 12px; font-weight: 600; }
.proj-table-wrap { padding: 0; overflow-x: auto; }
.proj-table { width: 100%; border-collapse: collapse; min-width: 1100px; }
.proj-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; background: var(--subtle); border-bottom: 2px solid var(--line); }
.proj-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.proj-table tr:last-child td { border-bottom: 0; }
.proj-table tbody tr:hover { background: var(--hover); }
.proj-table tr.locked { background: var(--subtle); }
.proj-table .right { text-align: right; }
.nowrap { white-space: nowrap; }
.proj-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.proj-name:hover { color: var(--blue-dark); text-decoration: underline; }
.proj-thumb, .proj-card-thumb { position: relative; border: 1px solid var(--line-soft); border-radius: 4px; background: var(--subtle); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.proj-thumb { width: 64px; height: 40px; }
.proj-card-thumb { aspect-ratio: 16 / 10; width: 100%; }
.proj-thumb img, .proj-card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.kind { font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; }
.kind-plans { background: #e6f0fa; color: #1558b7; }
.kind-phone { background: var(--teal-soft); color: var(--teal); }
.kind-site { background: #eff6ff; color: #244489; }
.kind-job { background: #fff1d6; color: #92400e; }
.chip.orange { color: #9a3412; }
.proj-sheets { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.proj-sheets .bar { width: 56px; height: 6px; border-radius: 9999px; background: var(--line-soft); overflow: hidden; }
.proj-sheets .bar > span { display: block; height: 100%; background: var(--green); }
.proj-lock { display: inline-flex; align-items: center; gap: 4px; color: #92400e; font-size: 12px; white-space: nowrap; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.proj-card { background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.proj-card .proj-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-card.compact .proj-card-thumb { aspect-ratio: 16 / 9; }
.proj-card.new { border: 1px dashed var(--line); box-shadow: none; align-items: center; justify-content: center; min-height: 200px; color: var(--blue-dark); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.proj-empty { align-items: flex-start; }
.first-run { align-items: center; text-align: center; padding: 40px 24px; }
.first-run h2 { font-size: 20px; }
.first-run > p { max-width: 560px; margin: 0; line-height: 1.8; }
.start-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 860px; width: 100%; margin: 8px 0; }
.start-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; text-align: left; min-height: 0; }
.start-icon { width: 40px; height: 40px; border-radius: 9999px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-dark); }
.proj-menu { max-height: 60vh; overflow: auto; min-width: 220px; }
.proj-menu [role="menuitemradio"].on { color: var(--blue-dark); font-weight: 600; background: var(--blue-soft); }
.menu button:focus-visible, .fchip:focus-visible, .seg:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 820px) {
  .proj-main { padding: 16px 16px 40px; }
  .proj-recent-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-cards { grid-template-columns: 1fr; }
}

/* Header breadcrumb and switcher */
.crumb { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--muted); padding: 4px 6px; min-height: 32px; font-weight: 500; }
.crumb:hover { color: var(--blue-dark); background: var(--blue-hover); }
.crumb-sep { color: var(--muted); }
.menu.switcher { width: min(480px, calc(100vw - 16px)); padding: 6px; }
.menu.switcher .switcher-search { min-height: 36px; margin-bottom: 4px; }
.menu.switcher button.on { color: var(--blue-dark); font-weight: 600; }
.tab[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
@media (max-width: 820px) { .crumb span { display: none; } }

/* New project: the guided setup (intake.js) */
.wizard { max-width: 1240px; width: 100%; margin: 0 auto; padding: 24px 20px 48px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.step-rail { background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 8px; position: sticky; top: 16px; }
.step-rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.step-link { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px; border-radius: 6px; min-height: 0; }
.step-link:disabled { opacity: 1; cursor: default; background: transparent; }
.step-link b { display: block; font-size: 13px; }
.step-link .small { display: block; }
.step-rail li.here .step-link { background: var(--blue-soft); }
.step-dot { width: 24px; height: 24px; flex: none; border-radius: 9999px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); background: #fff; }
.step-rail li.here .step-dot { border-color: var(--blue); color: var(--blue-dark); }
.step-rail li.done:not(.here) .step-dot { background: #166534; border-color: #166534; color: #fff; }
.rail-note { margin: 8px 10px 4px; padding: 10px; border-radius: 6px; background: var(--subtle); }
.wizard-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.wizard-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.step-title { margin: 0; font-size: 20px; color: var(--navy); }
.ai-switch { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--purple-line); background: var(--purple-soft); border-radius: 6px; }
.ai-switch b { color: var(--purple); }
.ai-switch input { width: 18px; height: 18px; accent-color: var(--purple); margin-top: 2px; min-height: 0; }
.review-list { margin: 0; display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; font-size: 13px; }
.review-list dt { color: var(--muted); }
.review-list dd { margin: 0; font-weight: 500; }
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; background: #f0e782; color: #92400e; border-left: 4px solid #92400e; }
.alert.bad { background: #f8d7da; color: #7f1d1d; border-left-color: var(--red); }
.dropzone .btn-sm { margin: 6px 0 2px; }
@media (max-width: 820px) {
  .wizard { grid-template-columns: 1fr; padding: 16px; }
  .step-rail { position: static; }
  .step-rail ol { flex-direction: row; overflow-x: auto; }
  .step-link .small { display: none; }
  .review-list { grid-template-columns: 1fr; }
}
.draft-title { display: none; font-weight: 600; }
body.in-draft .draft-title { display: inline; }
body.in-draft .head-title, body.in-draft #project-menu-btn { display: none; }
body.in-setup #job-site-btn, body.in-setup #site-link-btn, body.in-setup #save-btn, body.in-setup #share-btn { display: none; }
.page-head .head-title { min-width: 120px; flex: 0 1 auto; }
@media (max-width: 1280px) { .crumb span, .crumb-sep { display: none; } .crumb { padding: 4px; } }
@media (max-width: 820px) { .proj-search kbd { display: none; } .proj-search input { padding-right: 12px; } }
/* The page's two actions: one height, whatever the touch mode or width */
.proj-title .btn { height: 44px; min-height: 44px; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
/* A grey border on the pale page made the white button look smaller than the blue one; a blue edge matches it */
.proj-title .btn-s { border-color: var(--blue); }
.proj-more { border: 0; background: transparent; width: 32px; height: 32px; min-height: 32px; padding: 0; border-radius: 6px; color: var(--icon); display: grid; place-items: center; flex: none; }
.proj-more:hover { background: var(--hover); }
.kind-archived { background: var(--line-soft); color: var(--muted); }
.proj-menu button.danger { color: #b91c1c; }
.proj-card .row-between .proj-name { min-width: 0; }
.kinds { display: inline-flex; gap: 4px; }
.proj-table tr.proj-row { cursor: pointer; }
.proj-rec { max-width: 220px; }
.proj-ext { color: var(--ink); text-decoration: none; }
.proj-ext:hover { color: var(--blue-dark); text-decoration: underline; }
.proj-card[data-project] { cursor: pointer; transition: box-shadow .15s ease-in-out, transform .15s ease-in-out; }
.proj-card[data-project]:hover { box-shadow: 0 6px 14px rgba(0,0,0,.16); transform: translateY(-2px); }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 0; min-height: 0; font: inherit; color: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.th-sort svg { opacity: .45; }
.th-sort:hover, .th-sort.on { color: var(--blue-dark); }
.th-sort.on svg { opacity: 1; }
.proj-table th.right .th-sort { flex-direction: row; }

/* Markup tools (PRD-010): the toolbar menu and the options row. */
.markup-face { min-width: 30px; font-weight: 700; border-radius: 6px 0 0 6px; }
.markup-caret { min-width: 18px; padding: 0 3px; margin-left: -6px; border-radius: 0 6px 6px 0; }
.markup-face .face { font-size: 15px; line-height: 1; }
.markup-opts { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.markup-opts[hidden] { display: none; }
.markup-opts .swatches { display: inline-flex; align-items: center; gap: 3px; }
.markup-opts .swatch { width: 18px; height: 18px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.markup-opts .swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--blue); }
.markup-opts .swatch-input { width: 22px; height: 22px; min-height: 0; padding: 0; border: 0; background: none; }
#markup-menu button .mk-icon { display: inline-block; width: 22px; text-align: center; margin-right: 4px; }
[data-touch="on"] #markup-menu button { min-height: 44px; }
.label-controls { display: grid; gap: 4px; margin: 6px 0; }

/* PRD-011: the Snap menu, the symbol preview toggle and the snap index chip. */
.snap-wrap { display: inline-flex; }
.snap-main { border-radius: 9999px 0 0 9999px; }
.snap-caret { border-radius: 0 9999px 9999px 0; margin-left: -1px; padding: 0 7px; }
#snap-menu { min-width: 250px; }
#snap-menu .hint-row { font-size: 12px; color: var(--muted); padding: 4px 8px; }
#snap-menu small { margin-left: auto; color: var(--muted); font-size: 11px; }
.snap-chip { font-size: 12px; margin-right: 6px; }
.snap-chip[data-state="ready"] { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.snap-chip[data-state="raster"], .snap-chip[data-state="failed"] { background: var(--amber-soft); border-color: var(--amber-line); }
.snap-chip[data-fade="1"] { opacity: .45; }
.snap-chip button { min-height: 0; padding: 0 6px; margin-left: 6px; font-size: 11px; }
