/* BluSky Patios — Job Estimator. Plain CSS, no build step, mobile-first. */
:root {
  --blue: #0b7fc4;
  --blue-dark: #095d91;
  --ink: #1c2733;
  --muted: #5d6b7a;
  --line: #d9e2ea;
  --bg: #f3f6f9;
  --card: #fff;
  --green: #1d7a3d;
  --red: #b3261e;
  --amber-bg: #fff4d6;
  --amber-line: #d9a400;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.45;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: .35rem 0; }
a { color: var(--blue); }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* header + tabs */
.app-header {
  background: #10222f; color: #fff; padding: .7rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
}
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: .02em; }
.brand span { color: #4db2ec; font-weight: 800; }
.brand-sub { font-size: .8rem; opacity: .75; }
.user-chip { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.tabs {
  display: flex; gap: .25rem; overflow-x: auto; background: #fff;
  border-bottom: 1px solid var(--line); padding: .35rem .6rem;
  position: sticky; top: 0; z-index: 20;
  /* Tab row aligned with the content column underneath it (Gomin,
     2026-11-17): the first tab starts exactly where main's first text
     row starts — main is max-width 1060px, centered, .8rem side padding.
     On screens narrower than the column the max() keeps the plain .8rem. */
  padding-left: max(.8rem, calc((100% - 1060px) / 2 + .8rem));
  padding-right: max(.8rem, calc((100% - 1060px) / 2 + .8rem));
}
.tabs a {
  flex: 0 0 auto; padding: .55rem .8rem; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem;
}
.tabs a.active { background: var(--blue); color: #fff; }
.tabs a:hover:not(.active) { background: #e8f2fa; }

main { max-width: 1060px; margin: 0 auto; padding: 1rem .8rem 3rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.card h2 { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
/* Estimator/Proposal form action row — sits over the top of the data
   cards, centered (moved up from the bottom of the form, 2026-11-17). */
.form-actions { justify-content: center; margin-bottom: 1rem; }
.form-actions .btn { min-width: 150px; text-align: center; padding: .6rem 1.1rem; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }

/* forms */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea {
  width: 100%; padding: .55rem .6rem; font-size: 1rem;
  border: 1px solid #b9c7d3; border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
input[type="checkbox"] { width: auto; padding: 0; }
.field { margin-bottom: .7rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 .8rem; }
@media (max-width: 640px) { .grid, .grid3 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.checkline { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin: .4rem 0; }
.checkline input { width: 1.15rem; height: 1.15rem; }

/* buttons */
.btn {
  display: inline-block; padding: .6rem 1rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--blue); color: #fff; font-weight: 700; font-size: .95rem;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--blue-dark); }
.btn.secondary { background: #fff; color: var(--blue-dark); border-color: var(--blue); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.danger { background: var(--red); }
.btn.small { padding: .35rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #eef6fc; }
.table-wrap { overflow-x: auto; }

/* totals / breakdown */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.stat { background: #eef6fc; border: 1px solid #cfe4f3; border-radius: 8px; padding: .6rem .7rem; }
.stat .k { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.stat .v { font-size: 1.2rem; font-weight: 800; }
.stat .v.neg { color: var(--red); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.notice {
  border: 1px solid var(--amber-line); background: var(--amber-bg);
  border-radius: 8px; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .95rem;
}
.notice.info { border-color: #9cc3e5; background: #eaf4fc; }
.notice.error { border-color: #e0a19c; background: #fdecea; }
.notice.ok { border-color: #9cccab; background: #eaf7ee; }
/* history row actions — the old app's buttons, from its source: h-8
   px-3 rounded-xl (12px) text-[12px] font-medium, white with a gray-200
   border, blue #3EAAE2 text (red-400 for Delete) */
.hist-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill-btn {
  appearance: none; background: #fff; border: 1px solid #e5e7eb;
  color: #3EAAE2; border-radius: 12px; height: 32px; padding: 0 .75rem;
  font-size: 12px; font-weight: 500; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  text-decoration: none; white-space: nowrap; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.pill-btn:hover { background: rgba(62, 170, 226, .10); border-color: rgba(62, 170, 226, .30); }
.pill-btn svg { width: 12px; height: 12px; flex: none; }
.pill-btn.danger { color: #f87171; border-color: #e5e7eb; background: #fff; }
.pill-btn.danger:hover { background: #fef2f2; border-color: #fecaca; }
.pill-btn[disabled] { opacity: .55; cursor: default; }
.spin { animation: ce-rot 1s linear infinite; }
@keyframes ce-rot { to { transform: rotate(360deg); } }

/* history cards — the old app's list look, from its source: bg-white
   rounded-2xl (16px) shadow-[0_1px_3px_rgba(0,0,0,0.07)] p-4, no
   border; name / address / created date-time on the left, RETAIL
   (#3EAAE2) and PROFIT (green-600) on the upper right with the action
   buttons in a row under the figures */
.hist-list { display: flex; flex-direction: column; gap: .7rem; }
/* cost board (Stats) — expandable source groups over history-style cards */
.cb-group { border-top: 1px solid #e5e7eb; padding: 4px 0; }
.cb-summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; padding: 6px 0; }
.cb-src { font-weight: 600; color: #111827; }
.cb-nums { color: #6b7280; }
.cb-items { display: flex; flex-direction: column; gap: .7rem; padding: 6px 0 10px; }
.cb-items .hist-card { cursor: default; }
.hist-card {
  background: #fff; border: none; border-radius: 16px;
  padding: 1rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
  cursor: pointer; display: flex; gap: .75rem;
  justify-content: space-between; align-items: flex-start;
}
.hist-card-name { font-weight: 600; font-size: 14px; color: #111827; }
.hist-card-sub { color: #6b7280; font-size: 12px; margin-top: 2px; }
.hist-card-date { color: #9ca3af; font-size: 11px; margin-top: 4px; }
.hist-card-date a { color: var(--blue); }
.hist-card-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: .625rem; flex: none;
}
.hist-card-figures { display: flex; gap: 1.25rem; text-align: right; flex: none; }
.hist-fig { display: flex; flex-direction: column; }
.hist-fig-label {
  font-size: 10px; font-weight: 500; letter-spacing: .05em;
  text-transform: uppercase; color: #9ca3af;
}
.hist-fig-value { font-weight: 700; font-size: 15px; }
.hist-fig-value.retail { color: #3EAAE2; }
.hist-fig-value.profit { color: #16a34a; }
@media (max-width: 640px) {
  .hist-card { flex-direction: column; }
  .hist-card-right { align-items: flex-start; }
  .hist-card-figures { text-align: left; }
  .hist-actions .pill-btn { flex: 1; }
}

/* Contractor Payment — Job Cost Editor (the old app's dialog, ported):
   max-w-5xl, 98vw × 92vh, header + scrollable body + footer */
.ce-modal {
  background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(10, 25, 40, .35);
  width: min(1024px, 98vw); height: 92vh; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.ce-head { padding: 1rem 1.5rem; border-bottom: 1px solid #f3f4f6; flex: none; }
.ce-title { font-size: 18px; font-weight: 700; color: #111827; letter-spacing: -.01em; }
.ce-sub { font-size: 12px; color: #9ca3af; margin: .25rem 0 0; }
.ce-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.5rem; }
.ce-info {
  display: flex; flex-wrap: wrap; gap: .25rem 2rem;
  padding: .75rem; border-radius: 12px; background: #f9fafb;
  border: 1px solid #e5e7eb; font-size: 13px; color: #1f2937;
  margin-bottom: 1rem;
}
.ce-info-label { font-weight: 600; color: #6b7280; }
.ce-tablewrap { overflow-x: auto; border-radius: 12px; border: 1px solid #e5e7eb; }
.ce-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.ce-table thead th {
  background: #3EAAE2; color: #fff; font-weight: 700;
  padding: .625rem .75rem; text-align: center;
}
.ce-table thead th.l { text-align: left; }
.ce-table thead th.r { text-align: right; }
.ce-table tbody td { padding: .375rem .75rem; border-top: 1px solid #f3f4f6; vertical-align: middle; }
.ce-table tbody tr:hover { background: rgba(249, 250, 251, .6); }
.ce-cat { font-weight: 700; }
.ce-item { color: #374151; }
.ce-num { text-align: center; }
.ce-num.r { text-align: right; }
.ce-in {
  height: 36px; border: 1px solid #e5e7eb; border-radius: 8px;
  font-size: 13px; font-family: inherit; color: #1f2937; background: #fff;
  outline: none; padding: 0 .25rem;
}
.ce-in:focus { border-color: #3EAAE2; box-shadow: 0 0 0 1px rgba(62, 170, 226, .3); }
.ce-qty { width: 100%; max-width: 80px; text-align: center; }
.ce-unit { width: 100%; max-width: 110px; text-align: right; margin-left: auto; }
.ce-label { width: 100%; padding: 0 .5rem; }
.ce-cat-sel { width: 100%; font-size: 12px; padding: 0 .25rem; }
.ce-rowtotal { text-align: right; font-weight: 600; color: #1f2937; white-space: nowrap; }
.ce-del {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid #fecaca;
  color: #ef4444; background: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; line-height: 1; font-family: inherit;
}
.ce-del:hover { background: #fef2f2; }
.ce-empty { padding: 2rem .75rem !important; text-align: center; color: #9ca3af; }
.ce-addrow { padding: .75rem !important; }
.ce-add {
  display: inline-flex; align-items: center; gap: .375rem;
  font-size: 13px; font-weight: 500; color: #3EAAE2;
  background: none; border: none; cursor: pointer; font-family: inherit; padding: 0;
}
.ce-add:hover { color: #2e95cc; }
.ce-add-plus {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(62, 170, 226, .10); border: 1px solid rgba(62, 170, 226, .30);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; line-height: 1;
}
.ce-totalbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem; border-radius: 12px; margin-top: 1rem;
  background: rgba(62, 170, 226, .08); border: 1px solid rgba(62, 170, 226, .20);
}
.ce-total-label { font-size: 15px; font-weight: 700; color: #374151; }
.ce-total-value { font-size: 22px; font-weight: 700; color: #3EAAE2; }
.ce-foot {
  padding: 1rem 1.5rem; border-top: 1px solid #f3f4f6; flex: none;
  background: rgba(249, 250, 251, .8);
  display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
}
.ce-foot-right { display: flex; gap: .5rem; flex-wrap: wrap; }
.ce-btn {
  height: 40px; padding: 0 1rem; border-radius: 12px;
  font-size: 14px; font-weight: 500; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: .375rem;
  background: #fff; border: 1px solid #e5e7eb; color: #1f2937;
  transition: background .15s, border-color .15s;
}
.ce-btn svg { width: 16px; height: 16px; }
.ce-btn[disabled] { opacity: .5; cursor: default; }
.ce-reset { color: #3EAAE2; border-color: rgba(62, 170, 226, .40); }
.ce-reset:hover { background: rgba(62, 170, 226, .08); }
.ce-save { background: #16a34a; border-color: #16a34a; color: #fff; }
.ce-save:hover { background: #15803d; }
.ce-preview, .ce-download { background: #3EAAE2; border-color: #3EAAE2; color: #fff; }
.ce-preview:hover, .ce-download:hover { background: #2e95cc; }
/* Contractor Payment Preview dialog (95vw × 95vh, like the old app) */
.ce-preview-modal { width: 95vw; height: 95vh; max-height: 95vh; }
.ce-preview-head { padding: .875rem 1.25rem; }
.ce-preview-title { font-size: 15px; font-weight: 600; color: #111827; }
.ce-preview-body { flex: 1; min-height: 0; background: rgba(243, 244, 246, .6); padding: 1rem; }
.ce-frame {
  width: 100%; height: 100%; border: 1px solid #e5e7eb;
  border-radius: 12px; background: #fff;
}
.ce-preview-foot { justify-content: flex-end; padding: .875rem 1.25rem; }
.ce-preview-foot .ce-btn { height: 36px; font-size: 13px; }

/* submitted proposals queue (top of the Estimator) */
.submitted-panel { border-left: 4px solid var(--blue); }
.submitted-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--line);
}
.submitted-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.submitted-side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }

.pill {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700; background: #e8f2fa; color: var(--blue-dark);
}
.pill.green { background: #e2f3e8; color: var(--green); }
.pill.red { background: #fdecea; color: var(--red); }
.pill.amber { background: var(--amber-bg); color: #7a5b00; }

/* login */
.login-wrap { max-width: 420px; margin: 3rem auto 0; }
.login-wrap .card { padding: 1.4rem; }

/* scanned-form pages */
.doc-page {
  position: relative; width: 100%; max-width: 816px; margin: 0 auto 1rem;
  aspect-ratio: 1224 / 1584; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.12);
  overflow: hidden;
}
.doc-page.cert { aspect-ratio: 1224 / 1583; }
.doc-page img.tpl { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.overlay-field {
  position: absolute; font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(9px, 1.9vw, 15px); line-height: 1.2; color: #111;
  overflow: hidden; white-space: nowrap;
}
.overlay-field.money { font-weight: 700; text-align: right; }
.box-check {
  position: absolute; transform: translate(-50%, -55%);
  font-size: clamp(11px, 2.2vw, 17px); font-weight: 700; line-height: 1;
  color: #111; pointer-events: none;
}
.ph-token {
  position: absolute; font-family: ui-monospace, Menlo, monospace;
  font-size: clamp(6px, 1.1vw, 9px); line-height: 1.2; color: #6e7885;
  white-space: nowrap; pointer-events: none;
}
.tailcut-thumb { display: flex; align-items: center; gap: .7rem; }
.tailcut-thumb img { width: 126px; height: auto; border: 1px solid var(--line); border-radius: 6px; }

/* Data & Stats snapshot (admin-only) — inline-SVG + CSS bars, no libs */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .gridline { stroke: #d9e2ea; stroke-width: 1; }
.chart-svg .axis { font-size: 11px; fill: #5d6b7a; }
.chart-svg .bar-rev { fill: #0b7fc4; }
.chart-svg .bar-profit { fill: #1d7a3d; }
.legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.legend-swatch.rev { background: #0b7fc4; }
.legend-swatch.prof { background: #1d7a3d; }
.hbar-row { display: flex; align-items: center; gap: .6rem; margin: .45rem 0; }
.hbar-label { flex: 0 0 220px; font-size: .9rem; }
@media (max-width: 640px) { .hbar-label { flex-basis: 130px; font-size: .82rem; } }
.hbar-track { flex: 1 1 auto; background: #e8eef3; border-radius: 999px; height: 14px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: #0b7fc4; border-radius: 999px; }
.hbar-fill.warn { background: #b3261e; }
.hbar-fill.y25 { background: #9cc3e5; }
.hbar-fill.y26 { background: #0b7fc4; }
.hbar-val { flex: 0 0 auto; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.yoy-pair { margin-bottom: 1rem; }
.yoy-label { font-weight: 700; margin-bottom: .3rem; }
.yoy-delta { font-size: .9rem; font-weight: 700; margin-top: .25rem; }
.yoy-delta.up { color: #1d7a3d; }
.yoy-delta.down { color: #b3261e; }
.timeline { display: flex; flex-direction: column; gap: .6rem; }
.tl-item { display: flex; gap: .7rem; align-items: flex-start; }
.tl-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #0b7fc4; margin-top: .3rem; }
.compare-controls { align-items: flex-end; margin-bottom: .8rem; }
.compare-controls .field { min-width: 150px; margin-bottom: 0; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%) translateY(20px);
  background: #10222f; color: #fff; padding: .7rem 1.1rem; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 100; max-width: 92vw; text-align: center; font-size: .95rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

/* ---- v8 estimator flow: sticky 2D, stepped cards, groups, totals bar ---- */
.app-header { background: linear-gradient(90deg, #10222f, #16425f); }
.card { box-shadow: 0 1px 3px rgba(16, 34, 47, .06); }

/* Estimator layout (old app, 2026-11-16): form sections in the left
   column; the right rail carries the 2D PREVIEW card and the costs card
   under it, sticky on wide screens so both stay in reach while the form
   scrolls. */
.est-layout { display: grid; grid-template-columns: minmax(0, 1fr) 352px; gap: 1rem; align-items: start; }
.est-main { min-width: 0; }
.est-rail { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.est-rail .card { margin-bottom: 0; }
@media (min-width: 1024px) {
  .est-rail { position: sticky; top: 62px; max-height: calc(100vh - 74px); overflow-y: auto; padding-bottom: .2rem; }
}
@media (max-width: 1023px) {
  .est-layout { grid-template-columns: minmax(0, 1fr); }
}

/* 2D PREVIEW in the OLD app's format (2026-11-16): white card, blue
   small-caps section label, legend row, iOS-style icon-size slider, and
   the "2D Preview Editor" modal behind the Expand button. */
.twod-card { border-radius: 16px; }
.twod-head { display: flex; justify-content: space-between; align-items: center; }
.twod-title {
  font-size: .82rem; font-weight: 700; letter-spacing: .09em; color: var(--blue);
  line-height: 1.1;
}
.twod-expand {
  background: none; border: none; padding: .2rem .3rem; cursor: pointer;
  color: var(--blue); font-weight: 600; font-size: .85rem; font-family: inherit;
}
.twod-expand:hover { text-decoration: underline; }
.twod-stage { display: flex; justify-content: center; margin-top: .45rem; }
/* Compact presentation at the OLD app's size: the diagram, legend and
   slider sit in a centered ~400px column, however wide the card is.
   The editor modal uses the full width instead. */
.twod-card .twod-stage,
.twod-card .twod-legend,
.twod-card .twod-iconsize { max-width: 400px; margin-left: auto; margin-right: auto; width: 100%; }
.twod-modal .twod-stage,
.twod-modal .twod-legend,
.twod-modal .twod-iconsize { max-width: none; }
.twod-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1.05rem;
  margin-top: .55rem; font-size: .8rem; color: var(--muted);
}
.twod-legend .lg { display: inline-flex; align-items: center; gap: .38rem; }
.twod-legend .lg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.twod-legend .lg-wall { width: 16px; height: 5px; border-radius: 3px; background: #476b7f; display: inline-block; }
.twod-legend .twod-scale { margin-left: auto; font-size: .7rem; letter-spacing: .07em; color: #8494a3; display: inline-flex; align-items: center; gap: .35rem; }
.twod-legend .lg-scalebar {
  width: 26px; height: 6px; border: 1px solid #b9c6d0; display: inline-block;
  background: linear-gradient(to right, #8fb6cf 55%, #ffffff 55%);
}
.twod-iconsize { display: flex; align-items: center; gap: .6rem; margin-top: .55rem; }
.twod-iconsize-val { font-size: .82rem; color: var(--muted); min-width: 4.2ch; }
input[type="range"].ios {
  -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 3px;
  background: linear-gradient(to right, #1f8ac0 var(--p, 33%), #40474e var(--p, 33%));
  outline: none; cursor: pointer;
}
input[type="range"].ios::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 21px; height: 21px; border-radius: 50%;
  background: #1f8ac0; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(16, 34, 47, .35);
}
input[type="range"].ios::-moz-range-thumb {
  width: 19px; height: 19px; border-radius: 50%;
  background: #1f8ac0; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(16, 34, 47, .35);
}
.twod-modal-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(15, 25, 35, .45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.twod-modal {
  background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(10, 25, 40, .35);
  width: min(920px, 94vw); max-height: 92vh; overflow: auto; padding: 1.05rem 1.25rem 1.15rem;
}
.twod-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 1.02rem; color: var(--ink); margin-bottom: .35rem;
}
.twod-x {
  background: #eef2f6; border: none; width: 30px; height: 30px; border-radius: 50%;
  font-size: 1.05rem; line-height: 1; cursor: pointer; color: #40536a; font-family: inherit;
}
.twod-modal-foot { display: flex; justify-content: flex-end; margin-top: .85rem; }
.twod-done {
  background: var(--blue); color: #fff; border: none; border-radius: 999px;
  padding: .55rem 1.7rem; font-weight: 700; font-size: .92rem; cursor: pointer; font-family: inherit;
}

/* Estimator Preview pop-up (the two PDF pages from docs.js). */
.preview-modal { width: min(940px, 96vw); }
.preview-tabs { display: flex; gap: .35rem; }
.preview-tabs button {
  border: 1.5px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: .34rem 1rem; font-weight: 700; font-size: .88rem;
  cursor: pointer; font-family: inherit;
}
.preview-tabs button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.preview-body { background: #e8edf1; border-radius: 12px; padding: 14px; margin-top: .5rem; }
.preview-body .pdf-sheet + .pdf-sheet { margin-top: 14px; }
@media print {
  body:has(.preview-backdrop) * { visibility: hidden; }
  body:has(.preview-backdrop) .preview-body,
  body:has(.preview-backdrop) .preview-body * { visibility: visible; }
  body:has(.preview-backdrop) .twod-modal-head { display: none !important; }
  .preview-backdrop { position: absolute !important; inset: 0 !important; background: #fff !important; display: block !important; padding: 0 !important; }
  .preview-modal { box-shadow: none !important; max-height: none !important; width: 100% !important; padding: 0 !important; }
  .preview-body { background: #fff !important; padding: 0 !important; }
  .preview-body .pdf-sheet + .pdf-sheet { margin-top: 0; page-break-before: always; }
}

/* Section headers in the old app's voice: plain blue small caps. */
.step-head {
  font-size: .86rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--blue);
}

/* Cover fieldset groups: Size / Mount & structure / Posts & footings / Drainage */
.cgroup { margin-top: .8rem; }
.cgroup:first-of-type { margin-top: .2rem; }
.cgroup-title {
  font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--blue-dark); border-bottom: 1px dashed var(--line);
  padding-bottom: .25rem; margin-bottom: .55rem;
}
.cgroup .field { margin-bottom: .45rem; }

/* Collapsible cards (Options / Site work) */
.collapse-head {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; text-align: left; color: inherit; font: inherit;
}
.collapse-title { display: flex; align-items: center; gap: .55rem; font-size: 1.15rem; font-weight: 700; }
.collapse-chev {
  margin-left: auto; flex: 0 0 auto; width: .62rem; height: .62rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s ease;
}
.collapsible.open .collapse-chev { transform: rotate(45deg); }
.collapse-body { display: none; margin-top: .85rem; }
.collapsible.open .collapse-body { display: block; }

/* Pre-save checklist */
.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; }
@media (max-width: 640px) { .checks { grid-template-columns: 1fr; } }
.checks li { display: flex; gap: .5rem; align-items: flex-start; font-size: .93rem; }
.check-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; border-radius: 50%; flex: 0 0 auto;
  font-size: .72rem; font-weight: 800; color: #fff; margin-top: .12rem;
}
.checks li.ok .check-mark { background: var(--green); }
.checks li.warn .check-mark { background: var(--amber-line); }

/* Right-rail costs card (old app): summary grid, markup slider, custom
   price, suggested retail with nudge chips, stat chips, iOS toggles and
   the job actions — all under the 2D preview. */
.rail-card { border-radius: 16px; }
.rail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem .6rem; }
.rail-cell span { display: block; font-size: .66rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.rail-cell strong { font-size: 1.02rem; font-weight: 700; color: var(--ink); }
.rail-markup-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 1.15rem; }
.rail-markup-head span { font-size: .7rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.rail-markup-head strong { font-size: 1.2rem; font-weight: 800; color: var(--blue); }
.rail-card input[type="range"].ios { width: 100%; margin-top: .4rem; }
.rail-scale { display: flex; justify-content: space-between; font-size: .66rem; color: var(--muted); margin-top: .2rem; }
.rail-quick { display: flex; gap: .45rem; margin-top: .6rem; }
.rail-chipbtn {
  border: 1px solid var(--line); background: #f2f6f9; color: var(--ink);
  border-radius: 999px; padding: .28rem .7rem; font-size: .8rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.rail-chipbtn:hover { border-color: var(--blue); color: var(--blue); }
.rail-field { margin-top: 1.05rem; }
.rail-field label { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); margin-bottom: .3rem; }
.rail-field input { width: 100%; }
.rail-retail-label { margin-top: 1.15rem; font-size: .7rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.rail-retail { font-size: 2rem; font-weight: 800; color: var(--ink); line-height: 1.15; }
.rail-nudges { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .5rem; }
.rail-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.05rem; }
.rchip { border-radius: 8px; padding: .45rem .6rem; font-size: .66rem; font-weight: 700; letter-spacing: .05em; }
.rchip strong { display: block; font-size: .95rem; letter-spacing: 0; margin-top: .1rem; }
.rchip.profit { background: #fdf0d5; color: #8a5a00; }
.rchip.markup { background: #e3f0fa; color: #0b5f8f; }
.rchip.sf { background: #edf1f5; color: #54687a; }
.rail-toggles { margin-top: 1.05rem; border-top: 1px solid var(--line); }
.rail-toggle { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; cursor: pointer; }
.ios-switch { position: relative; display: inline-block; flex: 0 0 auto; }
.ios-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.ios-switch i {
  display: block; width: 46px; height: 27px; border-radius: 999px; background: #d7dee5;
  transition: background .18s; position: relative;
}
.ios-switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 23px; height: 23px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 34, 47, .3); transition: left .18s;
}
.ios-switch input:checked + i { background: #2fbf71; }
.ios-switch input:checked + i::after { left: 21px; }
.rail-actions { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1rem; }
.rail-btn { min-width: 132px; text-align: center; padding: .6rem 1.1rem; }

/* Feet + inches pair (cover Length / Projection) */
.ftin { display: flex; align-items: center; gap: .3rem; }
.ftin input { flex: 1 1 0; min-width: 0; }
.ftin-unit { color: var(--muted); font-size: .85rem; font-weight: 700; }

/* Slightly larger touch targets across the form */
input, select, textarea { padding: .6rem .65rem; }
.btn:not(.small) { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; }

/* print: only the document / proposal prints */
@media print {
  body { background: #fff; }
  .app-header, .tabs, .no-print, .toast { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { border: none; padding: 0; margin: 0; }
  .doc-page { box-shadow: none; border: none; max-width: 100%; margin: 0; page-break-after: always; }
  .doc-page:last-child { page-break-after: auto; }
}

/* Live cost sheet in the estimator's totals card — mirrors page 2 of the
   printed proposal PDF (Margin/Add header, Cost/Markup/Retail table). */
.live-sheet { font-family: Arial, Helvetica, sans-serif; }
.live-sheet .ls-addr { text-align: center; font-weight: 700; margin: 0 0 .15rem; }
.live-sheet .ls-head { text-align: center; font-weight: 700; margin: 0 0 .5rem; }
.live-sheet table.ls { width: 100%; border-collapse: collapse; }
.live-sheet table.ls th, .live-sheet table.ls td { padding: .3rem .4rem; border-bottom: 1px solid #ddd; }
.live-sheet table.ls th { border-bottom: 2px solid #111; text-align: right; }
.live-sheet table.ls th:first-child { text-align: left; }
.live-sheet table.ls td.r { text-align: right; white-space: nowrap; }
.live-sheet table.ls tr.sub td { border-top: 2px solid #111; font-weight: 700; }
.live-sheet table.ls tr.tot td { border-top: 2px solid #111; border-bottom: 2px solid #111; font-weight: 700; font-size: 1.05rem; }
.live-sheet .ls-foot { margin-top: .6rem; line-height: 1.6; }

/* Settings — collapsible contractor-rates sections */
.cr-head {
  cursor: pointer; user-select: none;
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .55rem 0; font-size: 1.08rem;
}
.cr-head:hover { color: var(--blue); }
.cr-head:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.cr-chev {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); font-size: 1.15rem; line-height: 1;
}
.cr-head:hover .cr-chev { border-color: var(--blue); color: var(--blue); }

/* ---- Calendar (Flowsa sync, read-only) ---- */
.cal-head { align-items: center; margin-bottom: .35rem; }
.cal-tools { margin-bottom: .35rem; }
.cal-legend { gap: 1rem; align-items: center; margin-top: .6rem; font-size: .9rem; }
.cal-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .3rem; }
.cal-month-title { font-size: 1.7rem; font-weight: 800; margin: .15rem 0 .35rem; letter-spacing: .2px; }
/* The whole control block (nav, Calendar/List switch, filters, month
   title) sticks under the app tab strip, so the way back to the
   calendar grid is always on screen — after a "+N more" jump the list
   scrolls to a day mid-month and the controls used to scroll away
   with it (Gomin, 2026-11-19). top: 50px tucks it just under the
   ~51px sticky .tabs bar (z 20); the anchor scroll leaves room for
   both bars via .cal-agenda-day's scroll-margin. */
.cal-topbar { position: sticky; top: 50px; z-index: 15; background: var(--bg); padding-top: .3rem; }
.cal-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.cal-seg .btn { border-radius: 0; border-color: transparent; }
.cal-agenda-day { scroll-margin-top: 10.5rem; }
.cal-struck { text-decoration: line-through; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-weight: 700; font-size: .8rem; color: var(--muted); padding: .2rem 0; }
.cal-cell { background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-height: 92px; padding: .3rem; display: flex; flex-direction: column; gap: 3px; }
.cal-cell.outside { opacity: .45; }
.cal-cell.today { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.cal-daynum { font-weight: 700; font-size: .85rem; }
.cal-chip { border: 0; border-radius: 6px; padding: .14rem .35rem; font-size: .72rem; line-height: 1.25; text-align: left; cursor: pointer; color: #fff; background: #5d6b7a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.cancelled { text-decoration: line-through; opacity: .55; }
.cal-more { border: 0; background: none; color: var(--blue); font-size: .72rem; text-align: left; cursor: pointer; padding: 0 .35rem; }
.cal-agenda-day { margin-bottom: 1rem; border: 2px solid transparent; border-radius: 10px; padding: .45rem .6rem; }
/* Today gets a highlighted box around the whole day in list view —
   same blue outline language as the grid's today cell (Gomin,
   2026-11-19). The transparent border + padding on every day above
   keeps the list from shifting when the box appears. */
.cal-agenda-day.today { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; background: #eef6fd; }
.cal-agenda-day.today h3 { color: var(--blue); }
.cal-agenda-day.past { opacity: .55; }
.cal-agenda-row { display: flex; align-items: center; gap: .6rem; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; margin-bottom: 4px; cursor: pointer; text-align: left; font-size: .95rem; }
.cal-agenda-row.cancelled .cal-agenda-name { text-decoration: line-through; color: var(--muted); }
.cal-agenda-time { font-weight: 700; white-space: nowrap; }
.cal-agenda-name { flex: 1; }
.cal-assigned { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.cal-status { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; background: #e4f0e8; color: var(--green); white-space: nowrap; }
.cal-status.cancelled { background: #eceff2; color: var(--muted); }
.cal-backdrop { position: fixed; inset: 0; background: rgba(16, 34, 47, .5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 1rem; }
.cal-modal { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; max-width: 430px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.cal-kind { font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; color: #fff; background: #5d6b7a; }
/* Person colors — AFTER the .cal-chip/.cal-kind base rules above, one
   selector per rule. The chips first shipped grey because a bare .c-*
   rule earlier in the file lost the cascade to the base rules' own
   background (equal specificity, later rule wins); selector lists
   proved unreliable too. Single compound selectors placed last win
   everywhere. */
.cal-chip.c-gomin { background-color: #d50000; }
.cal-kind.c-gomin { background-color: #d50000; }
.cal-dot.c-gomin { background-color: #d50000; }
.cal-chip.c-carlos { background-color: #0b7fc4; }
.cal-kind.c-carlos { background-color: #0b7fc4; }
.cal-dot.c-carlos { background-color: #0b7fc4; }
.cal-chip.c-daniel { background-color: #1d7a3d; }
.cal-chip.c-job { background-color: #1d7a3d; }
.cal-kind.c-daniel { background-color: #1d7a3d; }
.cal-kind.c-job { background-color: #1d7a3d; }
.cal-dot.c-daniel { background-color: #1d7a3d; }
.cal-dot.c-job { background-color: #1d7a3d; }
.cal-chip.c-alex { background-color: #6a1b9a; }
.cal-kind.c-alex { background-color: #6a1b9a; }
.cal-dot.c-alex { background-color: #6a1b9a; }
.cal-chip.c-other { background-color: #5d6b7a; }
.cal-kind.c-other { background-color: #5d6b7a; }
.cal-dot.c-other { background-color: #5d6b7a; }
.cal-agenda-row { border-left: 5px solid #5d6b7a; }
.cal-agenda-row.c-gomin { border-left-color: #d50000; }
.cal-agenda-row.c-carlos { border-left-color: #0b7fc4; }
.cal-agenda-row.c-daniel { border-left-color: #1d7a3d; }
.cal-agenda-row.c-job { border-left-color: #1d7a3d; }
.cal-agenda-row.c-alex { border-left-color: #6a1b9a; }
@media (max-width: 640px) {
  .cal-cell { min-height: 64px; }
  .cal-chip { font-size: .62rem; }
}

/* v44: brand mark in the header, in front of the BluSky Patios wordmark */
.brand-wrap { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; background: #fff; flex: none; }
