/* Fence Estimator Pro — styles */
:root {
  --bg: #eef1f2; --panel: #ffffff; --panel-2: #f6f8f9; --ink: #1b2328; --muted: #5d6b73; --faint: #8a979e;
  --line: #d9e0e3; --line-2: #e9eef0; --accent: #f59e0b; --accent-2: #d97706; --accent-ink: #b45309; --accent-soft: #fef3c7; --on-accent: #1c1405;
  --gate: #2f6fd6; --gate-soft: #e7eefb; --warn: #8a5a00; --warn-soft: #fff3d1; --err: #b3261e; --err-soft: #fde8e6; --ok: #2e7d4f;
  --canvas: #fbfcfc; --grid: #edf1f2; --grid-major: #d6dee1; --ref: #c3ccd0; --sel: #7c3aed;
  --m0: var(--ink); --m1: #7c3aed; --m2: #0d9488; --m3: #db2777; --m4: #65a30d; --m5: #b91c1c;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 8px; --shadow: 0 1px 2px rgba(20, 30, 35, .06), 0 6px 18px rgba(20, 30, 35, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11171a; --panel: #182125; --panel-2: #1d272c; --ink: #e3e9ec; --muted: #9aa8b0; --faint: #6f7d85;
    --line: #2b373d; --line-2: #243036; --accent: #fbbf24; --accent-2: #f59e0b; --accent-ink: #fbbf24; --accent-soft: #3a2b0c; --on-accent: #1a1204;
    --gate: #6d9ff0; --gate-soft: #1c2a40; --warn: #f0c060; --warn-soft: #3a2f12; --err: #ff8a80; --err-soft: #3d1b19; --ok: #7fd3a0;
    --canvas: #141c1f; --grid: #1c2529; --grid-major: #2a363b; --ref: #3c4a50; --sel: #a78bfa;
    --m1: #a78bfa; --m2: #2dd4bf; --m3: #f472b6; --m4: #a3e635; --m5: #f87171;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11171a; --panel: #182125; --panel-2: #1d272c; --ink: #e3e9ec; --muted: #9aa8b0; --faint: #6f7d85;
  --line: #2b373d; --line-2: #243036; --accent: #fbbf24; --accent-2: #f59e0b; --accent-ink: #fbbf24; --accent-soft: #3a2b0c; --on-accent: #1a1204;
  --gate: #6d9ff0; --gate-soft: #1c2a40; --warn: #f0c060; --warn-soft: #3a2f12; --err: #ff8a80; --err-soft: #3d1b19; --ok: #7fd3a0;
  --canvas: #141c1f; --grid: #1c2529; --grid-major: #2a363b; --ref: #3c4a50; --sel: #a78bfa;
  --m1: #a78bfa; --m2: #2dd4bf; --m3: #f472b6; --m4: #a3e635; --m5: #f87171;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--body); display: grid; grid-template-rows: auto 1fr; height: 100dvh; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 56px; padding-top: max(8px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 7px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font: 700 20px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.job-name { flex: 1; min-width: 120px; max-width: 360px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 6px 8px; font-weight: 600; font-size: 15px; }
.job-name:hover { border-color: var(--line); }
.job-name:focus { border-color: var(--accent); background: var(--panel); outline: none; }
.save-state { font-size: 11.5px; color: var(--faint); white-space: nowrap; transition: color .3s; }
.save-state.ok::before { content: "✓ "; }
.save-state.flash { color: var(--ok); }
.save-state.bad { color: var(--err); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 7px 12px; font-weight: 500; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.danger { color: var(--err); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.icon-btn { padding: 7px 9px; }
.btn.icon-btn svg { width: 18px; height: 18px; }

.privacy-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; font-size: 13px; font-weight: 500; }
.privacy-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pt-track { width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.pt-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.privacy-toggle input:checked + .pt-track { background: var(--accent); }
.privacy-toggle input:checked + .pt-track::after { transform: translateX(14px); }
.privacy-toggle input:focus-visible + .pt-track { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
body.customer .privacy-toggle { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 300px minmax(0, 1fr) 380px; min-height: 0; }
.panel { background: var(--panel); overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); }
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sec { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.sec:last-child { border-bottom: 0; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.sec-h h2 { margin: 0; font: 700 15px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sec-h .aside { font-size: 12px; color: var(--muted); }
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.hint.warn { color: var(--warn); }

.seg { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 5px; padding: 6px 8px; font-weight: 500; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 5px 0; min-width: 44px; font-weight: 600; font-size: 13px; font-family: var(--mono); }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pill:disabled { opacity: .3; cursor: not-allowed; }
.pill.wide { padding: 5px 10px; font-family: var(--body); }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.opt:first-child { border-top: 0; }
.opt small { display: block; color: var(--muted); font-size: 11.5px; }

.sw { position: relative; display: inline-block; width: 36px; height: 21px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.sw span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span::after { transform: translateX(15px); }
.sw input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.sw.sm { width: 30px; height: 18px; }
.sw.sm span::after { width: 14px; height: 14px; }
.sw.sm input:checked + span::after { transform: translateX(12px); }

input.in, select.in, textarea.in { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 8px; font-size: 13.5px; width: 100%; min-width: 0; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--accent); outline: none; }
input.in.num { text-align: right; }
.in.xs { width: 64px; }
.in.sm { width: 88px; }

.spec-fab { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: var(--panel-2); font-size: 12px; color: var(--muted); }
.spec-fab b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.posts-sum { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; margin-top: 10px; }
.posts-sum dt { color: var(--muted); }
.posts-sum dd { margin: 0; font-family: var(--mono); font-size: 12px; }

/* material selections */
.swl { display: inline-block; width: 16px; height: 4px; border-radius: 2px; background: var(--c, var(--ink)); flex: none; }
.sels { margin: -2px 0 12px; }
.sel-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sel-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 5px 7px; font-size: 12.5px; max-width: 100%; }
.sel-chip:hover { border-color: var(--faint); }
.sel-chip.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); font-weight: 600; }
.sel-chip .sc-n { font: 700 11px var(--mono); color: var(--muted); }
.sel-chip .sc-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-chip .sc-f { font: 500 11px var(--mono); color: var(--muted); }
.sel-chip.add { padding: 5px 6px; color: var(--accent-ink); }
.sel-chip .swl { width: 13px; }
.sel-chip.add svg { width: 15px; height: 15px; }
.sel-cur { font-size: 12px; color: var(--muted); margin-top: 7px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.sel-cur b { color: var(--ink); }
.sel-cur .linkbtn { margin-left: auto; color: var(--err); font-size: 12px; }
body.multispec .spec-sec { box-shadow: inset 3px 0 0 var(--selc, var(--accent)); }
.opt-sub { padding: 2px 0 9px; }
.opt-sub .label { margin-bottom: 6px; }
.pill.weave { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.pill.weave[aria-pressed="true"] { font-weight: 600; }
.wv { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); flex: none; }
.wv-black { background: #1d1d1d; } .wv-green { background: #2f6b3a; } .wv-brown { background: #6b4a2b; }
.wv-beige { background: #d8c7a3; } .wv-grey { background: #8c9196; } .wv-white { background: #f4f4f2; }
.mono-seg button { font-family: var(--mono); font-size: 12.5px; padding: 6px 4px; }
/* wood or chain link: the options panel shows the controls for the selection being edited */
#panelSpec.is-wood .cl-only, #panelSpec:not(.is-wood) .wd-only { display: none !important; }
.seg.wrap-seg { flex-wrap: wrap; }
/* Settings → Pricing & labour: markup and labour for chain link or wood */
.kind-seg { max-width: 320px; margin: 4px 0 0; }
.kind-panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 6px 0 14px; background: var(--panel-2); }
.seg.wrap-seg button { flex: 1 1 auto; white-space: nowrap; }
.pt-white { background: #eeede7; } .pt-black { background: #2a2a2a; } .pt-grey { background: #8c9194; } .pt-brown { background: #5f4330; } .pt-green { background: #3e5d45; }
.st-natural { background: #c9a86e; } .st-cedar { background: #a5582f; } .st-brown { background: #6b4a2b; } .st-grey { background: #8c9196; } .st-black { background: #1d1d1d; }
#wBuildHint { margin: -2px 0 2px; }
.wood-prices { width: auto; margin-top: 4px; }
.wood-prices input.in { width: 84px; }
.star-no { display: block; font-size: 11px; color: var(--faint); }
#segWall button { line-height: 1.2; padding: 5px 3px; }
#segWall .wall-t { display: block; font: 500 10.5px var(--mono); opacity: .75; margin-top: 1px; }

/* lines & gates lists */
.list { display: flex; flex-direction: column; gap: 6px; }
.empty { color: var(--muted); font-size: 13px; padding: 10px; text-align: center; border: 1px dashed var(--line); border-radius: 7px; }
.ln { border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; background: var(--panel); }
.ln.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ln.off { opacity: .6; }
.ln-top { display: flex; align-items: center; gap: 6px; }
.badge { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--panel); font: 700 13px/26px var(--body); text-align: center; flex: none; border: 0; padding: 0; }
.ln.sel .badge { background: var(--accent); color: var(--on-accent); }
.badge.gate { background: var(--gate); color: #fff; border-radius: 6px; font-size: 11px; width: auto; padding: 0 6px; }
.ln-len { width: 82px; }
.ln-h { width: 78px; padding: 5px 4px !important; font-size: 12.5px !important; }
.x { border: 0; background: transparent; color: var(--faint); width: 26px; height: 26px; border-radius: 5px; font-size: 18px; line-height: 1; margin-left: auto; flex: none; }
.x:hover { color: var(--err); background: var(--err-soft); }
.ln-meta { font-size: 12px; color: var(--muted); margin: 5px 0 0 32px; font-family: var(--mono); }
.ln-mat { display: flex; align-items: center; gap: 7px; margin: 6px 0 0 32px; }
.ln-mat .in { padding: 4px 6px; font-size: 12.5px; }
.ln-meta b { color: var(--accent-ink); font-weight: 600; }
.ln-more { margin: 7px 0 0 32px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12.5px; }
.ln-more label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.gt { border: 1px solid var(--line); border-left: 3px solid var(--gate); border-radius: 7px; padding: 7px 8px; display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; font-size: 12.5px; }
.gt.sel { box-shadow: 0 0 0 2px var(--gate-soft); border-color: var(--gate); }
.gt-f { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gt-f select, .gt-f input { width: auto; padding: 4px 6px; font-size: 12.5px; }
.gt-f .in.off { width: 74px; }

/* ---------- canvas ---------- */
.toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.tool { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--ink); }
.tool:hover { background: var(--panel-2); }
.tool[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.tool[data-tool="gate"][aria-pressed="true"] { background: var(--gate-soft); border-color: var(--gate); color: var(--gate); }
.tool svg { width: 17px; height: 17px; flex: none; }
.tool:disabled { opacity: .35; cursor: not-allowed; }
.tsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }
.canvas-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--canvas); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: crosshair; }
#cv.grab { cursor: grab; } #cv.grabbing { cursor: grabbing; } #cv.pointer { cursor: pointer; } #cv.move { cursor: move; }
/* fence preview: a small picture of the open option in the drawing's corner; click for the big one */
.fence-thumb { position: absolute; left: 10px; top: 10px; z-index: 3; width: 128px; height: 80px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); box-shadow: var(--shadow); cursor: zoom-in; }
.fence-thumb:hover { border-color: var(--accent); }
.fence-thumb svg, .oc-pic svg, .pv-pic svg { display: block; width: 100%; height: 100%; }
.fence-thumb::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 18px; height: 18px; border-radius: 5px; background: rgba(15, 23, 42, .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7'/%3E%3C/svg%3E") center / 11px no-repeat; }
.canvas-wrap .canvas-hint { left: 148px; max-width: calc(100% - 214px); }
.pv-pic { aspect-ratio: 8 / 5; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.pv-opts { margin-bottom: 10px; flex-wrap: wrap; }
.pv-cap { margin-top: 10px; font-size: 13.5px; line-height: 1.5; }
.pv-cap b { font-weight: 600; }
.pv-cap .num { font-weight: 700; color: var(--accent-ink); }
.oc-pic { display: block; aspect-ratio: 8 / 5; border-radius: 6px; overflow: hidden; margin: 6px 0 4px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: zoom-in; }
.fence-thumb img, .oc-pic img, .pv-pic img, .oc-mini img { display: block; width: 100%; height: 100%; object-fit: cover; }
.oc-wrap { display: flex; flex-direction: column; min-width: 0; }
.oc-wrap > .oc { flex: 1; }
.oc-photo { display: flex; align-items: center; gap: 7px; padding: 5px 2px 0; font-size: 12px; color: var(--muted); }
.oc-mini { flex: none; width: 44px; height: 28px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line-2); background: var(--panel-2); cursor: zoom-in; padding: 0; }
.oc-mini svg { display: block; width: 100%; height: 100%; }
.oc-photo .linkbtn { font-size: 12px; }
.pv-photo { margin-top: 10px; gap: 8px; }
@media (max-width: 600px) { .fence-thumb { width: 96px; height: 60px; } .canvas-wrap .canvas-hint { left: 114px; max-width: calc(100% - 124px); } }
.canvas-hint { position: absolute; left: 10px; top: 10px; background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12px; color: var(--muted); pointer-events: none; max-width: calc(100% - 80px); }
.zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; box-shadow: var(--shadow); }
.zoom button { border: 0; background: transparent; width: 36px; height: 34px; font-size: 18px; }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button:hover { background: var(--panel-2); }
.len-pop { position: absolute; z-index: 6; width: 262px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(10, 16, 18, .22); padding: 10px; }
.lp-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.lp-h .x { margin-left: auto; }
.lp-h .badge.new { background: var(--accent); color: var(--on-accent); }
.lp-row { display: flex; align-items: center; gap: 6px; }
.lp-row .in { flex: 1; min-width: 0; font: 600 20px/1.2 var(--mono); text-align: center; padding: 7px 6px; }
.lp-step { flex: none; width: 40px; height: 42px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 7px; font-size: 20px; line-height: 1; color: var(--ink); }
.lp-step:hover { border-color: var(--faint); }
.lp-prev { font: 12px/1.45 var(--mono); color: var(--muted); margin: 7px 0 8px; min-height: 17px; }
.lp-prev b { color: var(--accent-ink); font-weight: 600; }
.lp-type { margin: 0 0 9px; }
.lp-type .seg button { padding: 5px 6px; font-size: 12.5px; }
.lp-opt { display: flex; align-items: center; gap: 7px; font-size: 13px; margin: 0 0 9px; cursor: pointer; }
.lp-f { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.lp-f .grow { flex: 1; }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); background: var(--err-soft); }
.btn.danger-fill { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-fill:hover { filter: brightness(1.08); }
dialog.ask { width: min(420px, calc(100vw - 24px)); }
dialog.ask .dlg-h h2 { font-size: 19px; }
.post-bar { position: absolute; z-index: 5; box-shadow: var(--shadow); border-radius: 9px; background: var(--panel); border: 1px solid var(--line); padding: 7px; display: flex; flex-direction: column; gap: 7px; max-width: 290px; }
.pb-exist { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.pb-opts { display: flex; flex-direction: column; gap: 5px; }
.pb-opts .label { margin: 2px 0 0; }
.pb-opts .seg button { padding: 5px 4px; font-size: 12px; }
.pb-opts .hint { margin-top: 0; }
.lp-mat { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin: 0 0 9px; color: var(--muted); }
.lp-mat span { white-space: nowrap; }
.lp-mat .in { padding: 4px 6px; font-size: 12.5px; }
/* old fence removal: the box beside a line (Remove old fence tool) and the same fields in the length box */
.rm-pop { width: 278px; }
.badge.rm, .lp-h .badge.rm { background: var(--err); color: #fff; }
.rm-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 10px; align-items: center; font-size: 12.5px; margin: 0 0 10px; }
.rm-f { display: contents; }
.rm-k { color: var(--muted); white-space: nowrap; }
.rm-fields select.in { padding: 4px 6px; font-size: 12.5px; min-width: 0; }
.rm-fields .seg button { padding: 5px 4px; font-size: 12.5px; }
.rm-by { display: flex; align-items: center; gap: 5px; min-width: 0; }
.rm-by .in { flex: 1; min-width: 0; text-align: center; font: 600 14px/1.2 var(--mono); padding: 5px 4px; }
.rm-by .lp-step { width: 34px; height: 32px; font-size: 18px; }
.rm-sum { grid-column: 1 / -1; line-height: 1.45; }
.rm-sum small { color: var(--muted); font-size: 12px; }
.rm-sum .hint { margin-top: 2px; }
.lp-rm { border-top: 1px solid var(--line-2); padding-top: 9px; margin-top: -2px; }
.legend { position: absolute; left: 10px; bottom: 36px; z-index: 4; display: flex; flex-direction: column; gap: 2px; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 5px; box-shadow: var(--shadow); max-width: calc(100% - 80px); }
.lg { display: flex; align-items: center; gap: 7px; border: 1px solid transparent; background: transparent; border-radius: 5px; padding: 3px 6px; font-size: 12px; text-align: left; }
.lg:hover { background: var(--panel-2); }
.lg.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.lg span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg em { font: normal 500 11px var(--mono); color: var(--muted); margin-left: auto; padding-left: 8px; }
.lg .swl { width: 18px; height: 4px; }
/* option quotes over the drawing */
.optbar { display: flex; align-items: flex-end; gap: 3px; padding: 6px 10px 0; background: var(--panel-2); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.optbar::-webkit-scrollbar { display: none; }
.opt-tab { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-bottom: 0; background: var(--panel-2); border-radius: 7px 7px 0 0; padding: 6px 11px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; margin-bottom: -1px; }
.opt-tab:hover { color: var(--ink); background: var(--panel); }
.opt-tab.on { background: var(--panel); color: var(--ink); font-weight: 600; border-color: var(--line); box-shadow: inset 0 2px 0 var(--accent); }
.opt-tab .ot-v { font-size: 12px; color: var(--accent-ink); font-weight: 600; }
.opt-tab svg { width: 16px; height: 16px; color: var(--muted); }
.opt-add { display: inline-flex; align-items: center; gap: 5px; border: 1px dashed var(--line); background: transparent; border-radius: 7px; padding: 5px 10px; margin: 0 0 4px 4px; font-size: 12.5px; color: var(--accent-ink); white-space: nowrap; }
.opt-add:hover { border-color: var(--accent); }
.opt-names { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 4px auto; padding-left: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.opt-names select.in { width: auto; padding: 3px 6px; font-size: 12px; max-width: 220px; }
.opt-names.wide { display: flex; margin: 10px 0 0; padding: 0; }
.opt-names.wide select.in { flex: 1; max-width: none; }
.opt-add svg { width: 14px; height: 14px; }
.op-choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 7px; cursor: pointer; }
.op-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.op-choice input { margin-top: 3px; accent-color: var(--accent); }
.op-choice b { display: block; font-size: 13.5px; }
.op-choice select.in.op-from { display: inline-block; width: auto; max-width: 100%; margin-left: 4px; padding: 2px 6px; font-size: 13px; font-weight: 600; vertical-align: baseline; }
.op-choice small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.post-bar .btn { background: var(--panel); align-self: flex-start; }
.in.bad { border-color: var(--err) !important; box-shadow: 0 0 0 2px var(--err-soft); }
.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.canvas-empty button { pointer-events: auto; }
.canvas-empty > div { pointer-events: none; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; box-shadow: var(--shadow); max-width: 340px; }
.canvas-empty h3 { margin: 0 0 6px; font: 700 20px/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.canvas-empty p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.status { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 7px 12px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.status b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.status .units { margin-left: auto; padding: 1px; flex: none; }
.status .units button { padding: 1px 10px; font: 600 12px var(--mono); min-height: 0; }

/* ---------- estimate ---------- */
.est-hero { padding: 16px; background: var(--ink); color: var(--panel); }
.est-hero .k { font: 700 13px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.est-hero .v { font: 600 34px/1.1 var(--mono); margin: 6px 0 2px; letter-spacing: -.01em; }
.est-hero .s { font-size: 12.5px; opacity: .75; }
.rows { display: flex; flex-direction: column; }
.er { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; }
.er .v { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.er.sub { color: var(--muted); font-size: 12.5px; padding-left: 10px; }
.er.tot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; font-weight: 600; }
.er.grand { border-top: 2px solid var(--ink); font-size: 16px; font-weight: 700; }
.er.profit { color: var(--ok); font-weight: 600; }
.pro-box { margin-top: 12px; padding: 10px 12px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); }
.pro-box .ttl { font: 700 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
body.customer .pro { display: none !important; }
.cust-only { display: none !important; }
body.customer .cust-only { display: revert !important; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 4px 4px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 4px 4px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl .grp td { background: var(--panel-2); font: 700 12px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); padding: 7px 4px 5px; }
.tbl .code { font-family: var(--mono); font-size: 11px; white-space: nowrap; color: var(--accent-ink); display: block; font-weight: 500; }
.tbl .desc { color: var(--ink); line-height: 1.35; }
.tbl small { display: block; color: var(--muted); font-size: 11px; }
.tbl .nowrap { white-space: nowrap; }
.tbl .qcell { width: 64px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--sel); font-size: 11px; text-decoration: underline; cursor: pointer; }
.tbl input.in { padding: 3px 5px; font-size: 12.5px; }
.tbl .qty { width: 58px; text-align: right; }
.tbl tr.adj td .qty { border-color: var(--sel); }
.tbl tr.missing td { background: var(--err-soft); }
.chg { border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; margin-bottom: 6px; }
.chg .row .in { flex: 1; }
.chg-nums { display: flex; align-items: flex-end; gap: 6px; margin-top: 6px; }
.chg-nums label { display: flex; flex-direction: column; gap: 2px; }
.chg-nums small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chg-nums .in { width: 76px; padding: 4px 6px; }
.chg-nums label:first-child .in { width: 50px; }
.chg-nums .amt { margin-left: auto; padding-bottom: 5px; font-weight: 600; white-space: nowrap; }
.add-charge { display: flex; gap: 6px; margin-top: 8px; }
.flags { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.flag { font-size: 12px; padding: 6px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); border-left: 3px solid currentColor; }
.flag.error { background: var(--err-soft); color: var(--err); }
.draft-note { font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px dashed var(--line); border-radius: 6px; padding: 7px 9px; margin-bottom: 10px; }
.draft-note a { color: var(--accent-ink); cursor: pointer; text-decoration: underline; }
/* estimate summary: cost / sell / profit, each row opens its controls */
.sum-sec { padding-top: 12px; }
.sum-head, .sum-row { display: grid; grid-template-columns: minmax(64px, 1fr) repeat(3, minmax(58px, auto)); gap: 4px 10px; align-items: baseline; }
.sum-head { font: 700 11.5px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 9px 7px 27px; }
.sum-head span, .sum-row .num { text-align: right; }
.sum-head .c, .sum-row .c { color: var(--err); }
.sum-head .s, .sum-row .s { color: var(--ink); }
.sum-head .p, .sum-row .p { color: var(--ok); }
.sum-row .num { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-row .nm { font-weight: 600; font-size: 13.5px; }
.sum-row.one { grid-template-columns: 1fr auto; }
.acc { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--panel); }
.acc > summary { list-style: none; cursor: pointer; padding: 10px 9px 10px 27px; position: relative; border-radius: 8px; user-select: none; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::before { content: ""; position: absolute; left: 11px; top: 50%; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-65%) rotate(-45deg); transition: transform .15s; }
.acc[open] > summary::before { transform: translateY(-75%) rotate(45deg); }
.acc > summary:hover { background: var(--panel-2); }
.acc[open] > summary { border-bottom: 1px solid var(--line-2); border-radius: 8px 8px 0 0; }
.acc.total { border-color: var(--faint); }
.acc.total .nm { text-transform: uppercase; letter-spacing: .04em; }
.acc-b { padding: 10px 11px 12px; }
.acc-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 8px; }
.acc-sub .label { margin: 0; }
.sum-margin { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 9px 0 27px; font-size: 13.5px; color: var(--muted); }
.sum-margin b { font: 700 16px var(--mono); color: var(--ok); }
.sum-margin.per-day { padding-top: 4px; }
.sum-margin.per-day small { font-size: 11.5px; color: var(--faint); margin-left: 4px; }
.sum-margin.per-day b { font-size: 15px; }
.sum-margin.oh b { color: var(--err); font-size: 14px; }
.sum-margin.net b { font-size: 16px; }
.sum-margin b.neg, .oc .num.neg { color: var(--err); }
.sum-margin .linkbtn { font-size: 11.5px; }
.lb-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.sum-margin .tgt { color: var(--muted); }
.ok-t { color: var(--ok); font-weight: 600; } .bad-t { color: var(--err); font-weight: 600; }
/* Settings → Revenue */
/* Settings → Overhead & revenue: section links that stay in view, the two headline figures side by side */
.bz-nav { position: sticky; top: -16px; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: -16px -18px 10px; padding: 9px 18px 8px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12.5px; }
#setBody [id^="bz"] { scroll-margin-top: 46px; }          /* a section jumped to stays clear of the links */
.bz-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.bz-sum .oh-sum { margin: 0; }
.rv-apply { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.rv-warn { margin: 8px 0 0; } .rv-warn .flag { margin-bottom: 6px; }
.rv-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 10px 0 4px; }
.rv-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel); }
.rv-h { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.rv-h span { font-size: 12px; color: var(--muted); }
.rv-big { display: flex; justify-content: space-between; align-items: baseline; }
.rv-big b { font: 700 20px var(--mono); }
.rv-stack { margin: 8px 0; font-size: 13px; }
.rv-r { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.rv-r.c .num { color: var(--err); } .rv-r.p .num { color: var(--ok); }
.rv-r.tot { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 4px; font-weight: 700; }
.rv-now { font-size: 12.5px; line-height: 1.45; border-top: 1px dashed var(--line); padding-top: 6px; }
.rv-crew .cur .in { width: 76px; }
.rv-crew .rv-out td { font-size: 12px; color: var(--muted); padding: 0 4px 8px; border-top: 0; }
.rv-pl { width: 100%; font-size: 13px; margin: 4px 0; }
.rv-pl td, .rv-pl th { padding: 4px 6px; }
.rv-pl td small { display: block; font-size: 11px; color: var(--faint); font-weight: 400; }
.rv-pl td.num small { display: inline; margin-left: 4px; color: var(--muted); }
.rv-pl .rv-sub td { font-size: 12px; color: var(--muted); padding-left: 20px; }
.rv-pl .rv-sub td.num { padding-left: 6px; }
.rv-pl .rv-rev td, .rv-pl .rv-gp td { font-weight: 600; border-top: 1px solid var(--line); }
.rv-pl .rv-net td { font-weight: 700; border-top: 2px solid var(--line-2, var(--line)); }
.rv-goal { margin-top: 8px; }
.rv-levers { margin: 0 0 8px; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.rv-levers li { margin-bottom: 4px; }
.flag.ok-flag { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ink); }
.rv-season { margin: 12px 0 4px; } .rv-season summary { cursor: pointer; font-weight: 600; font-size: 13px; }
/* Settings → Overhead */
.oh-sum { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel-2); margin-bottom: 4px; }
.oh-big { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.oh-big span { font-weight: 600; }
.oh-big b { font: 700 22px var(--mono); color: var(--ink); }
.warn-t { color: var(--warn); }
.oh-week { max-width: 460px; margin-bottom: 10px; }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; }
.cal-mode { flex: 0 1 320px; }
.cal-year { display: flex; align-items: center; gap: 6px; }
.cal-year b { font: 700 15px var(--mono); min-width: 44px; text-align: center; }
.cal-hint { margin: 4px 0 8px; min-height: 1.3em; }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px 16px; }
.cal-h { font-weight: 600; font-size: 12.5px; margin: 0 0 3px 2px; }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-g > b { font-size: 9.5px; color: var(--faint); text-align: center; font-weight: 600; }
.cd { aspect-ratio: 1; min-width: 0; border: 0; border-radius: 4px; padding: 0; font: 500 11px var(--mono); background: transparent; color: var(--faint); cursor: pointer; position: relative; display: inline-flex; align-items: center; justify-content: center; }
.cd:hover { outline: 1.5px solid var(--accent); }
.cd.work { background: color-mix(in srgb, var(--ok) 24%, transparent); color: var(--ink); }
.cd.extra { background: color-mix(in srgb, var(--ok) 24%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ok); }
.cd.rest { background: var(--panel-2); color: var(--muted); }
.cd.holiday { background: color-mix(in srgb, var(--err) 22%, transparent); color: var(--err); font-weight: 700; }
.cd.off { background: var(--panel-2); color: var(--muted); text-decoration: line-through; }
.cd.out { opacity: .5; }
.cd.hd:not(.holiday)::after { content: ''; position: absolute; top: 2px; right: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--err); }
.cd.edge { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 2px; font-size: 12px; color: var(--muted); }
.cal-key span { display: inline-flex; align-items: center; gap: 5px; }
.cal-key .cd { width: 18px; height: 18px; cursor: default; font-size: 10px; }
.cal-key .cd:hover { outline: 0; }
.oh-hols { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 14px; }
.oh-hol { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; padding: 4px 0; font-size: 13px; }
.oh-hol input { margin-top: 3px; }
.oh-hol small { grid-column: 2; color: var(--faint); font-size: 11.5px; }
.oh-hol.out span { color: var(--muted); }
.oh-count { margin: 10px 0 0; padding: 8px 10px; border-radius: 7px; background: var(--panel-2); font-size: 13px; }
.oh-grp { display: flex; align-items: baseline; justify-content: space-between; margin: 12px 0 2px; }
.oh-grp .label { margin: 0; }
.oh-tbl td { padding: 3px 4px; vertical-align: middle; }
.oh-tbl .oh-nm { width: 100%; }
.oh-tbl .oh-nm .in { width: 100%; min-width: 150px; }
.oh-tbl .cur .in { width: 96px; }
.oh-tbl select.in { width: auto; }
.oh-yr { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 92px; }
.oh-total { margin: 12px 0 4px; padding: 8px 10px; border-radius: 7px; background: var(--panel-2); font-size: 13px; }
@media (max-width: 560px) { .oh-tbl .oh-yr { display: none; } .oh-tbl .cur .in { width: 76px; } .oh-hols { grid-template-columns: 1fr; } }

/* option quotes, side by side */
.opt-cmp .sec-h { margin-bottom: 8px; }
.oc-key { font: 600 11px var(--mono); }
.oc-key .c, .oc-g .c { color: var(--err); } .oc-key .s, .oc-g .s { color: var(--ink); } .oc-key .p, .oc-g .p, .oc-r .p { color: var(--ok); }
.oc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.oc { display: flex; flex-direction: column; gap: 5px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 9px 9px 8px; min-width: 0; }
.oc:hover { border-color: var(--faint); }
.oc.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); cursor: default; }
.oc-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.oc-h b { font: 700 15px/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-on { font-size: 10.5px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; flex: none; }
.oc-d { font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-bottom: 2px; }
.oc-g { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; column-gap: 4px; padding-top: 4px; border-top: 1px solid var(--line-2); }
.oc-g .oc-k { grid-column: 1 / -1; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.oc-g .num { font: 600 11.5px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.oc-g.tot { border-top: 1px solid var(--faint); }
.oc-g.tot .num { font-size: 12px; }
.oc-r { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 12px; }
.oc-r .num { font: 600 12px var(--mono); white-space: nowrap; }
.oc-r.sub { color: var(--muted); }
.oc-r.tot { border-top: 1px solid var(--line-2); padding-top: 4px; font-weight: 600; }
.oc-r.m .num { font-size: 13px; }
.oc-r.grand { border-top: 2px solid var(--ink); padding-top: 5px; margin-top: 2px; font-weight: 700; }
.oc-r.grand .num { font-size: 13.5px; }
.opt-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 9px; }
.opt-title b { font: 700 15px var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); }
.opt-title span { font-size: 12px; color: var(--muted); }
.actions .btn.opt-btn { grid-column: 1 / -1; }

/* labour & pricing controls */
.crew-seg button { font-family: var(--mono); font-weight: 600; }
.workers { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.wk { display: flex; flex-direction: column; gap: 2px; }
.wk small, .lb-note { font-size: 11.5px; color: var(--muted); }
.lb-note { margin-top: 5px; }
.lb-note b, .lb-tot b { color: var(--ink); font-family: var(--mono); font-weight: 600; }
.cur { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 0 6px; }
.cur:focus-within { border-color: var(--accent); }
.cur em { font-style: normal; color: var(--muted); font-size: 12.5px; }
.cur .in { border: 0; padding: 6px 3px; background: transparent; }
.cur .in:focus { box-shadow: none; }
.lb-rng { display: flex; align-items: baseline; justify-content: space-between; }
.lb-rng output { font: 600 14px var(--mono); color: var(--accent-ink); }
.rng { width: 100%; accent-color: var(--accent); margin: 4px 0 0; height: 24px; }
.rng-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); font-family: var(--mono); position: relative; }
.rng-zero { position: absolute; top: -3px; width: 2px; height: 7px; margin-left: -1px; background: var(--faint); border-radius: 1px; }
.lb-rng output small { font-size: 12px; color: var(--muted); }
.margin-f { margin-bottom: 10px; }
#smTotAdj { font: 600 11.5px var(--mono); color: var(--accent-ink); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.lb-tot { font-size: 12.5px; color: var(--muted); padding: 8px 10px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); margin: 4px 0 8px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn { justify-content: center; }
.actions .btn.primary { grid-column: 1 / -1; padding: 10px; font-size: 14.5px; }

/* ---------- mobile tabs ---------- */
.mtabs { display: none; }
@media (max-width: 1180px) { .app { grid-template-columns: 280px minmax(0, 1fr) 340px; } .brand-sub { display: none; } }
@media (max-width: 980px) {
  body { grid-template-rows: auto 1fr auto; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .app > * { display: none !important; }
  body[data-tab="spec"] #panelSpec, body[data-tab="draw"] #panelDraw, body[data-tab="est"] #panelEst { display: flex !important; flex-direction: column; }
  body[data-tab="spec"] #panelSpec, body[data-tab="est"] #panelEst { display: block !important; }
  .panel.left, .panel.right { border: 0; }
  .mtabs { display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .mtabs button { flex: 1; border: 0; background: transparent; padding: 9px 4px 8px; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .mtabs button[aria-pressed="true"] { color: var(--accent-ink); }
  .mtabs button .mt-v { font-family: var(--mono); font-size: 11px; font-weight: 500; }
  .top { gap: 8px; padding: 6px 10px; flex-wrap: wrap; }
  .brand-name { font-size: 17px; }
  .job-name { order: 3; flex-basis: 100%; max-width: none; }
  .top-actions .btn .lbl { display: none; }
  .top-actions #btnSettings .lbl { display: inline; }
  .privacy-toggle .pt-label { display: none; }
}
@media (max-width: 520px) { .brand-mark { width: 30px; height: 30px; } .brand > div:last-child { display: none; } .top-actions { gap: 4px; } .btn { padding: 6px 9px; } }

/* ---------- dialogs ---------- */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); }
dialog.wide { width: min(1080px, calc(100vw - 24px)); }
dialog.mid { width: min(760px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10, 16, 18, .45); }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-h h2 { margin: 0; font: 700 21px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.dlg-b { padding: 16px 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.dlg-h, .dlg-f, .tabs { flex: none; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-f .grow { margin-right: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
@media (max-width: 600px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.sample { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 0; text-align: left; overflow: hidden; display: flex; flex-direction: column; }
.sample:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sample svg { display: block; width: 100%; height: auto; background: var(--canvas); border-bottom: 1px solid var(--line-2); }
.sample .t { font-weight: 600; padding: 8px 10px 0; }
.sample .d { font-size: 12px; color: var(--muted); padding: 2px 10px 10px; }
.sv-line { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.sv-gate { stroke: var(--gate); stroke-width: 2.4; stroke-dasharray: 3 2; }
.sv-post { fill: var(--ink); }
.sv-ref { fill: var(--panel-2); stroke: var(--ref); stroke-dasharray: 3 2; }
.sv-letter { font: 700 9px var(--body); fill: var(--accent-ink); text-anchor: middle; }
.dirs { display: grid; grid-template-columns: repeat(3, 44px); gap: 4px; }
.dirs button { height: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; font-size: 18px; }
.dirs button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.dirs .c { visibility: hidden; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 12px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.set-h { font: 700 14px/1 var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.set-h:first-child { margin-top: 0; }

/* ---- kits (Settings → Kits) */
dialog.wide.kits-open { width: min(1480px, calc(100vw - 24px)); }
.kit { --kit-bar-h: 96px; position: relative; }
.kit-bar { position: sticky; top: -16px; z-index: 4; margin: -16px -18px 10px; padding: 9px 18px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.kit-bar-r1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.kit-bar-r2 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; }
.kit-bar-r2 .flag { padding: 3px 7px; font-size: 11.5px; }
.kit-sum { margin: 0; font-size: 12px; color: var(--muted); flex: 1 1 320px; }
.kit-seg { flex: none; }
.kit-seg button { padding: 5px 10px; font-size: 12.5px; }
.kit-bar-sp { flex: 1; }
.kit-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.kit-sel select.in { width: auto; padding: 4px 6px; font-size: 12.5px; }
.kit-more { position: relative; }
.kit-more > summary { display: flex; align-items: center; cursor: pointer; font-size: 12.5px; font-weight: 600; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; list-style: none; }
.kit-more > summary::-webkit-details-marker { display: none; }
.kit-more[open] > summary { border-color: var(--accent); }
.kit-more-b { position: absolute; z-index: 6; top: calc(100% + 4px); left: 0; width: min(430px, calc(100vw - 48px)); display: grid; gap: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kit-sels { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.kit-sels .kit-sel { justify-content: space-between; }
.kit-lock { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.kit-locktag { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; }
.kit-draft { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: var(--radius); font-size: 12.5px; }
.kit-draft p { margin: 0; flex: 1 1 300px; }
.kit-draft.ok { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
.kit-draft .linkbtn { font-size: 12px; }
.kit-how { margin: 6px 0 10px; font-size: 12.5px; color: var(--muted); }
.kit-how summary { cursor: pointer; font-weight: 600; }
.kit-how p { margin: 6px 0 0; max-width: 820px; }
.kit-main { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
/* palette */
.kit-pal { min-width: 0; }
.kit-pal-d > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 4px 0 6px; }
.kit-pal-narrow { display: none; }
.kit-pal-b { display: grid; gap: 7px; }
.kit-pal-h { display: flex; align-items: baseline; gap: 8px; }
.kit-pal-h small { color: var(--muted); font-size: 11px; }
.kit-cats .pill { padding: 3px 8px; font-size: 11.5px; min-width: 0; }
.kit-sub select.in { flex: 1; }
.kit-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; max-height: 40vh; background: var(--panel); }
.kit-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--line-2); }
.kit-item:last-child { border-bottom: 0; }
.kit-item > button { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; align-items: baseline; text-align: left; border: 0; background: transparent; padding: 6px 8px 6px 2px; font-size: 12px; cursor: grab; }
.kit-item > button b { grid-column: 1; grid-row: 1; font-size: 11.5px; color: var(--accent-ink); font-weight: 600; }
.kit-item > button > span:not([class]) { grid-column: 1 / -1; grid-row: 2; line-height: 1.3; }
.kit-item > button[aria-pressed="true"], .kit-item:hover > button { background: var(--accent-soft); }
.kit-price { grid-column: 2; grid-row: 1; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.kit-badge { grid-row: 3; grid-column: 1; justify-self: start; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.kit-sug { grid-row: 3; grid-column: 2; font-size: 10.5px; color: var(--muted); }
.kit-grip { flex: none; display: grid; place-items: center; width: 22px; color: var(--faint); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; font-size: 14px; }
.kit-grip:hover { color: var(--ink); }
.kit-more-n { margin: 0; }
/* board */
.kit-jump { display: none; margin-bottom: 8px; }
.kit-cols { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 10px; align-items: start; }
.kit-col { min-width: 0; display: grid; gap: 8px; padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.kit-col-h h3 { margin: 0; font: 700 16px/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.kit-col-h p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.kit-col-h .kit-cnote, .kit-cnote { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.kit-gprev { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.kit-gprev .seg button { padding: 3px 7px; font-size: 11.5px; }
.kit-col-h .kit-gcost { color: var(--ink); font-weight: 600; }
.kit-zone { display: grid; gap: 6px; min-height: 44px; padding: 4px; border-radius: 6px; }
.kit-zh { margin: 2px 0 0; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kit-zone .empty, .kit-jobcards .empty { padding: 8px; font-size: 11.5px; }
.kit-dragging .kit-zone, .kit-dragging .kit-jobstrip { outline: 1px dashed var(--faint); outline-offset: -1px; }
.kit-zone.over, .kit-col.over, .kit-jobstrip.over { outline: 2px dashed var(--accent); outline-offset: -1px; background: var(--accent-soft); }
.kit-zone.no, .kit-col.no, .kit-jobstrip.no { outline-color: var(--err); background: var(--err-soft); }
.kit-card { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: start; gap: 2px 4px; padding: 5px 6px 5px 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; }
.kit-card .kit-grip { grid-row: 1 / span 4; align-self: stretch; }
/* the box and the name keep columns 2 and 3 with or without the grip (view only has none), so the tags,
   reason and message under them never land in a narrow auto column */
.kit-card input[type="checkbox"] { grid-column: 2; margin: 3px 2px 0; }
.kit-card-b { grid-column: 3; min-width: 0; display: grid; gap: 1px; border: 0; background: none; padding: 0; text-align: left; }
.kit-card-b b { font-size: 12.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.kit-card-b .mono { font-size: 11px; color: var(--accent-ink); overflow-wrap: anywhere; }
.kit-q { color: var(--muted); }
.kit-tags, .kit-why, .kit-msg { grid-column: 3; }
.kit-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.kit-tags:empty { display: none; }
.kit-tag { font-size: 10.5px; line-height: 1.5; padding: 0 6px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.kit-tag.off { color: var(--err); }
.kit-why { font-size: 11px; color: var(--muted); }
.kit-msg { font-size: 11px; color: var(--warn); overflow-wrap: anywhere; }
.kit-card.is-off { opacity: .6; }
.kit-card.is-bad { border-color: var(--err); }
.kit-card.is-bad .kit-msg { color: var(--err); }
.kit-card.is-warn { border-color: var(--warn); }
.kit-card.is-new { animation: kitFlash 1.2s ease-out; }
@keyframes kitFlash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
.kit-idle > summary { cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 4px; }
.kit-idle[open] { display: grid; gap: 6px; }
.kit-addhere { border: 1px dashed var(--accent); background: transparent; color: var(--accent-ink); border-radius: 6px; padding: 4px; font-size: 11.5px; font-weight: 600; }
.kit-jobstrip, .kit-other { margin-top: 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.kit-other { border-color: var(--warn); }
.kit-jobstrip h3, .kit-other h3 { margin: 0; font: 700 15px/1.1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.kit-jobstrip .hint, .kit-other .hint { margin: 2px 0 6px; }
.kit-jobcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.kit-ghost { position: fixed; left: 0; top: 0; z-index: 10; pointer-events: none; box-shadow: var(--shadow); max-width: 280px; padding: 5px 9px; background: var(--panel); border: 1px solid var(--accent); border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kit-dragging, .kit-dragging * { user-select: none; -webkit-user-select: none; cursor: grabbing; }
/* the tap path: what to do with a picked item */
.kit-pickbar { position: sticky; bottom: -16px; z-index: 5; display: grid; gap: 6px; margin: 10px -18px -16px; padding: 8px 18px; background: var(--panel); border-top: 2px solid var(--accent); box-shadow: 0 -6px 18px rgba(20, 30, 35, .08); }
.kit-pick-r { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kit-pick-t { margin-right: 4px; font-size: 12.5px; }
.kit-pick-r .btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
/* the item editor */
.kit-ed { display: grid; gap: 10px; margin-top: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); scroll-margin: calc(var(--kit-bar-h) + 8px) 0 90px; }
.kit-ed-h h3 { margin: 0; font: 700 19px/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.kit-ed-h .hint { margin: 2px 0 0; }
.kit-ed-g { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 14px; }
.kit-ed-sec { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.kit-ed-sec h4 { margin: 0; font: 700 13px/1 var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kit-ed-sec > p { margin: 0; font-size: 12.5px; }
.kit-ed .kit-seg { display: inline-flex; }
.kit-f .label { margin-bottom: 4px; }
.kit-f .hint { margin: 3px 0 0; }
.kit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kit-row > .in { flex: 1 1 140px; }
.kit-radios { display: grid; gap: 4px; margin: 0; padding: 0; border: 0; font-size: 12.5px; }
.kit-radios label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kit-radios input.kit-bl { flex: 0 1 170px; width: 170px; }
.kit-radios .hint { margin: 0; }
.kit-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.kit-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 6px; font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.kit-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.kit-cpart { display: inline-flex; align-items: center; gap: 2px; padding: 1px 2px 1px 7px; font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.kit-cpart .x { width: 22px; height: 22px; font-size: 15px; }
.kit-chips .hint { margin: 0; align-self: center; }
.kit-err { margin: 4px 0 0; font-size: 12px; color: var(--err); }
.kit-qty { max-width: 110px; }
.kit-ht-wrap { overflow-x: auto; }
.kit-ht { min-width: 660px; }
.kit-ht th[scope="row"] { white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--line-2); }
.kit-ht th small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.kit-ht input.in { font-size: 12px; padding: 3px 5px; }
.kit-ht input.in.num { width: 72px; }
.kit-ht input.in::placeholder { color: var(--muted); }
.kit-ht input.in:not(:placeholder-shown) { font-weight: 700; }
.kit-ht .kit-gets { font-size: 11px; color: var(--muted); }
.kit-ht .kit-gets small { display: block; }
.kit-ht .kit-gets small.bad { color: var(--err); }
.kit-ht .kit-gets small.warnt { color: var(--warn); }
.kit-ht .linkbtn { display: block; margin-top: 2px; }
.kit-ed-more > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kit-ed-more[open] { display: grid; gap: 8px; }
.kit-ed-f { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.kit-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (min-width: 1100px) {
  .kit-main { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
  .kit-pal { position: sticky; top: calc(var(--kit-bar-h) - 8px); }
  .kit-pal-d > summary { display: none; }
  .kit-list { max-height: calc(100dvh - 260px); }
}
@media (max-width: 1099px) {
  .kit-cols { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; }
  .kit-col { scroll-snap-align: start; }
}
@media (max-width: 759px) {
  .kit-bar { position: static; }
  .kit-bar-r1 > .kit-seg { flex: 1 1 100%; }
  .kit-more { position: static; flex: 1 1 100%; }                 /* "Preview with" opens in place, inside the dialog */
  .kit-more-b { position: static; width: auto; margin-top: 6px; box-shadow: none; }
  .kit-sels { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kit-pal-wide { display: none; }
  .kit-pal-narrow { display: inline; }
  .kit-cols { grid-auto-columns: minmax(260px, 86%); scroll-snap-type: x mandatory; }
  .kit-jump { display: flex; }
  .kit-addhere { display: none; }
  .kit-ed { padding: 10px; }
  .kit-ht { min-width: 0; }
  .kit-ht thead { display: none; }
  .kit-ht, .kit-ht tbody, .kit-ht th, .kit-ht td { display: block; }
  .kit-ht tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin-bottom: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
  .kit-ht th[scope="row"], .kit-ht td.kit-gets { grid-column: 1 / -1; border: 0; padding: 0; }
  .kit-ht td { padding: 0; border: 0; }
  .kit-ht td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--muted); }   /* the kit set's own words */
  .kit-ht input.in, .kit-ht input.in.num { width: 100%; }
}
@media (pointer: coarse) {
  .kit-grip { min-width: 44px; min-height: 44px; }
  .kit-card-b, .kit-item > button, .kit-addhere, .kit-chip, .kit-more > summary { min-height: 44px; }
  .kit-cats .pill { min-height: 38px; }
  .kit input.in, .kit select.in, .kit .kit-ht input.in { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .kit-card.is-new { animation: none; } }
/* Material recipe: its link to the kits */
.rcp-kits { display: block; width: fit-content; font-size: 12.5px; margin: 0 0 8px; }

.recipe-wrap { overflow-x: auto; }
.recipe { min-width: 1040px; }
.recipe td { vertical-align: top; }
.recipe input.in, .recipe select.in { font-family: var(--mono); font-size: 11.5px; padding: 3px 5px; }
.recipe select.in { width: 116px; }
.recipe .prev { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 170px; max-width: 260px; }
.recipe .prev .ok, .recipe-sum .prev .ok { color: var(--ok); }
.recipe-sum { min-width: 760px; }
.recipe-sum td { vertical-align: top; padding-top: 6px; padding-bottom: 6px; }
.recipe-sum tr.off td { opacity: .45; }
.recipe-sum .rs-item b { font-weight: 600; }
.recipe-sum .rs-item small.mono { color: var(--accent-ink); font-size: 11px; }
.recipe-sum .rs-qty { width: 210px; }
.recipe-sum .rs-qty .in { width: 100%; font-size: 12.5px; padding: 3px 6px; }
.recipe-sum .rs-qty .in.num { width: 64px; }
.recipe-sum .rs-per { width: 230px; }
.recipe-sum .rs-per small { color: var(--muted); }
.recipe-sum .prev { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 150px; max-width: 240px; }
.recipe-sum .prev .bad { color: var(--err); }
.hcounts { width: auto; min-width: 560px; margin-bottom: 4px; }
.hcounts td:first-child { white-space: nowrap; padding-right: 12px; }
.hcounts .in { width: 50px; padding: 3px 5px; font-size: 12.5px; }
.rcp-adds { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 12.5px; margin: 0 0 6px; }
.rcp-adds dt { font-weight: 600; }
.rcp-adds dd { margin: 0; color: var(--muted); }
.recipe .prev .bad { color: var(--err); }
.recipe tr.off td { opacity: .45; }
.tokens { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12px; margin: 8px 0 12px; }
.tokens code { font-family: var(--mono); color: var(--accent-ink); }
/* Settings → Company: branding on the PDFs (the logo preview sits on white, like the PDF page) */
.brand-tag { display: inline-block; vertical-align: 1px; margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font: 600 11px/1.3 var(--body); letter-spacing: 0; text-transform: none; }
.brand-lock { flex-wrap: wrap; margin-bottom: 10px; }
.brand-lock .hint { margin: 0; flex: 1 1 260px; }
.brand-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.brand-set:disabled { opacity: .55; }
.brand-logo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-bottom: 12px; }
.brand-logo > div:last-child { flex: 1 1 200px; min-width: 0; }
.brand-drop { width: 220px; max-width: 100%; height: 88px; padding: 8px; border: 1.5px dashed var(--line); border-radius: 8px; background: #fff; color: #5d6b73; font-size: 12px; display: grid; place-items: center; text-align: center; cursor: pointer; }
.brand-drop.over { border-color: var(--accent); }
.brand-drop img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-swatch { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); flex: none; cursor: pointer; }
#brColorHex { width: 104px; }
.results { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; margin-top: 8px; }
.res { display: grid; grid-template-columns: 90px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.res:last-child { border-bottom: 0; }
.res .code { font-family: var(--mono); font-size: 11.5px; }
.jobs { display: flex; flex-direction: column; gap: 6px; }
.job { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.job .meta { flex: 1; min-width: 0; }
.job .meta b { display: block; }
.job .meta small { color: var(--muted); }
.job .job-price { font-size: 12.5px; white-space: nowrap; }
.job .job-acts { display: flex; align-items: center; gap: 4px; }
.job .job-acts .btn.ghost svg { width: 16px; height: 16px; }
select.in.status-sel { width: auto; flex: none; padding: 3px 6px; font-size: 12px; font-weight: 600; border-radius: 999px; }
.status-sel.st-quoted { border-color: var(--gate); color: var(--gate); }
.status-sel.st-sold { border-color: var(--ok); color: var(--ok); }
.status-sel.st-lost { border-color: var(--faint); color: var(--faint); }
.jobs-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.jobs-bar .in { flex: 1 1 220px; }
.jobs-filter { flex: 0 1 auto; }
.jobs-filter button { padding: 6px 10px; }
.removal { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.rm-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 8px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.rm-row .badge { background: var(--err); color: #fff; }
.rm-row .rm-len { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; }
.rm-row .rm-adj { flex: none; }
.rm-row .rm-adj button { padding: 4px 10px; }
.rm-row .rm-by { display: inline-flex; align-items: center; gap: 5px; }
.rm-row .rm-by .in { width: 84px; padding: 4px 6px; }
.rm-row .rm-ft { font-weight: 600; margin-left: auto; }
.ln-rm { margin: 4px 0 0 32px; font-size: 12px; color: var(--err); }
/* customer line items (under Materials) */
.items-box { margin: 10px 0 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.it { border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; margin-bottom: 8px; background: var(--panel); }
.it.picking { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.it-h { display: flex; gap: 6px; align-items: center; }
.it-h .in { flex: 1; min-width: 0; font-weight: 600; }
.it-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 12.5px; flex-wrap: wrap; }
.it-k { width: 62px; flex: none; color: var(--muted); }
.it-v { flex: 1; min-width: 0; }
.it-row.lab .rng { flex: 1; min-width: 110px; margin: 0; }
.it-row.lab output { flex: none; min-width: 96px; text-align: right; font: 600 12.5px var(--mono); color: var(--accent-ink); }
.it-note { margin: 2px 0 0 70px; }
.it-row.add label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.it-row.add .in { width: 78px; padding: 4px 6px; }
.it-sum, .it-fence { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.it-sum { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line-2); }
.it-sum .num, .it-fence .num { font: 700 13px var(--mono); }
.it-fence { color: var(--muted); padding: 0 2px; }
.it-tag { display: inline-block; margin-top: 4px; border: 1px dashed var(--accent); background: transparent; color: var(--accent-ink); border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 600; cursor: pointer; }
.it-tag.on { background: var(--accent); border-style: solid; color: var(--on-accent); }
.it-tag.ro { border: 1px solid var(--line); color: var(--muted); cursor: default; }
@media (pointer: coarse) { .it-tag { padding: 6px 12px; font-size: 12.5px; } .it-row.add .in { width: 90px; } }
.order-row { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.order-row .label { margin-bottom: 6px; }
@media (max-width: 600px) { .job { flex-wrap: wrap; } .job .meta { flex-basis: 100%; } .save-state { display: none; } }
.status-line { font-size: 13px; margin-top: 10px; min-height: 20px; }
.status-line.ok { color: var(--ok); } .status-line.err { color: var(--err); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 9px 14px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; }
@media (max-width: 980px) { .toast { bottom: calc(70px + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- touch screens: finger-sized targets ---------- */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 9px 14px; }
  .btn.sm { min-height: 40px; padding: 7px 12px; font-size: 13.5px; }
  .tool { min-height: 44px; padding: 8px 12px; }
  .seg button { min-height: 42px; }
  .pill { min-height: 42px; min-width: 52px; }
  .x { width: 40px; height: 40px; font-size: 22px; }
  .badge { width: 32px; height: 32px; line-height: 32px; }
  .sel-chip, .opt-tab, .opt-add, .lg { min-height: 42px; }
  input.in, select.in, textarea.in, .job-name { font-size: 16px; min-height: 42px; }      /* 16px stops iPhone zooming in on focus */
  select.in.status-sel { font-size: 14px; min-height: 38px; padding: 4px 10px; }
  .tbl input.in, .recipe input.in, .recipe select.in { min-height: 36px; font-size: 15px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  .sw { width: 48px; height: 28px; }
  .sw span::after { width: 24px; height: 24px; }
  .sw input:checked + span::after { transform: translateX(20px); }
  .zoom button { width: 50px; height: 48px; font-size: 22px; }
  .lp-step { width: 52px; height: 52px; }
  .lp-row .in { font-size: 22px; min-height: 52px; }
  .lp-f .btn { min-height: 44px; }
  .rm-by .lp-step { width: 46px; height: 44px; }
  .mtabs button { padding: 12px 4px 11px; font-size: 13px; }
  .acc > summary { padding-top: 13px; padding-bottom: 13px; }
  .oc { padding: 11px; }
}

/* ---------- plans (docs/PLANS.md): locked controls, the plan bar, Settings a plan doesn't have ---------- */
.seg button.locked, .pill.locked, .btn.locked, .opt-add.locked { color: var(--faint); }
.pill.locked { background: var(--panel-2); border-style: dashed; }
.btn.locked { border-style: dashed; }
.opt.locked .sw { opacity: .45; }
.opt.locked > span:first-child { color: var(--muted); }
.lock-tag, .opt small.lock-tag { display: inline-block; width: max-content; padding: 0 5px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink);
  font: 600 9.5px/1.55 var(--body); letter-spacing: .02em; text-transform: none; white-space: nowrap; vertical-align: middle; }
.seg .lock-tag, .pill .lock-tag { display: block; margin: 2px auto 0; }
.opt small.lock-tag { margin-top: 3px; }
.set-h .lock-tag { margin-left: 6px; }
.plan-bar { padding: 12px 16px 0; display: grid; gap: 8px; }
.plan-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding: 9px 11px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 7px; background: var(--panel-2); font-size: 12.5px; line-height: 1.45; }
.plan-bar .plan-note { margin: 0; }
.plan-note > span:first-child { flex: 1 1 200px; min-width: 0; }
.plan-note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.plan-pick { display: inline-flex; gap: 6px; }
#setBody .in:disabled { background: var(--panel-2); color: var(--muted); border-style: dashed; cursor: not-allowed; opacity: 1; }
.plan-locked { margin: 14px 0; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; background: var(--panel-2); color: var(--muted); }
.plan-locked .set-h { margin: 0 0 6px; }
.plan-locked .hint { margin: 0 0 10px; max-width: 75ch; }
/* The header on phones and small tablets: the job name beside the logo and the buttons in a row of their own,
   so the account menu (in try mode: the way to the plans) always fits on screen. Between tablet and desktop
   the Samples, Jobs and Customer view labels give way the same way, and the job name narrows first. */
.top { min-width: 0; }
@media (max-width: 760px) {
  .top .job-name, .top .save-state { order: 1; }
  .top .job-name { flex: 1 1 0; min-width: 0; }
  .top-actions { order: 2; flex: 1 0 100%; margin-left: 0; justify-content: space-between; }
}
@media (max-width: 600px) { .top-actions .btn { padding-left: 11px; padding-right: 11px; } }
@media (max-width: 420px) { .top-actions #btnSettings .lbl { display: none; } }
@media (min-width: 981px) and (max-width: 1180px) { .top-actions #btnSamples .lbl, .top-actions #btnJobs .lbl, .top-actions .pt-label { display: none; } }
