/* Alpha Concrete CRM — brand: logo black, white, logo red; cured-concrete ground; saw-cut joints. */
@font-face { font-family: Archivo; font-weight: 600; font-display: swap; src: url(/fonts/archivo/files/archivo-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Archivo; font-weight: 700; font-display: swap; src: url(/fonts/archivo/files/archivo-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Archivo; font-weight: 800; font-display: swap; src: url(/fonts/archivo/files/archivo-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(/fonts/barlow/files/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap; src: url(/fonts/barlow/files/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(/fonts/barlow/files/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 700; font-display: swap; src: url(/fonts/barlow/files/barlow-latin-700-normal.woff2) format("woff2"); }

:root {
  --black: #000000;
  --white: #ffffff;
  --red: #e70025;          /* logo red, sampled from the logo file */
  --red-press: #c2001f;
  --red-tint: #fbe7e8;
  --slab: #ebeae7;         /* cured concrete — page ground */
  --panel: #ffffff;
  --panel-2: #f7f6f3;
  --joint: #2a2a2a;        /* saw-cut control joint */
  --stone: #6d6a65;        /* muted text */
  --ash: #a3a09a;
  --line: #d6d3cd;
  --line-soft: #e8e6e1;
  --line-strong: #b9b5ae;
  --green: #1c6a3b;
  --green-tint: #e4f0e8;
  --amber: #8a5600;
  --amber-tint: #fbf0d6;
  --display: Archivo, "Arial Black", "Segoe UI", sans-serif;
  --body: Barlow, "Segoe UI", system-ui, Arial, sans-serif;
  --j: 4px;
  --r: 4px;
  --side: 244px;
  --c-sale: #000000;
  --c-cost: #bdb9b2;
  --c-gp: #e70025;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--slab); color: var(--black); font: 400 16px/1.5 var(--body); font-variant-numeric: tabular-nums; }
img { max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--red); }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.015em; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.005em; }
h3, .h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 12px; }
code { font-size: 0.92em; background: var(--panel-2); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--line-soft); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--white); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ shell */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--black); color: #d9d6d0; display: flex; flex-direction: column; z-index: 40; }
.side-logo { display: block; padding: 14px 18px 6px; border-bottom: var(--j) solid var(--red); }
.side-logo img { display: block; width: 100%; height: auto; }
.side-nav { padding: 12px 0; flex: 1; overflow-y: auto; }
.nav-link { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 20px; color: #d9d6d0; text-decoration: none; font-weight: 600; font-size: 15.5px; border-left: var(--j) solid transparent; }
.nav-link:hover { background: rgba(255, 255, 255, 0.07); color: var(--white); }
.nav-link.is-active { color: var(--white); border-left-color: var(--red); background: rgba(255, 255, 255, 0.1); }
.nav-link .ic { opacity: 0.85; }
.nav-count { margin-left: auto; background: var(--red); color: var(--white); font-size: 12px; min-width: 22px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 14px 20px; border-top: 1px solid #262626; font-size: 14px; }
.side-user strong { display: block; color: var(--white); font-weight: 600; }
.side-user span { color: var(--ash); font-size: 13px; }
.side-out { background: none; border: 1px solid #3a3a3a; color: #d9d6d0; width: 36px; height: 36px; border-radius: var(--r); display: grid; place-items: center; cursor: pointer; }
.side-out:hover { border-color: var(--white); color: var(--white); }
.shell { margin-left: var(--side); min-height: 100vh; }
.topbar { display: none; }
.main { max-width: 1360px; padding: 28px 36px 64px; }
body.wide .main { max-width: none; }
.scrim { display: none; }

/* ------------------------------------------------------------------ page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { min-width: 0; }
.page-title .sub { color: var(--stone); margin: 6px 0 0; max-width: 72ch; }
.back { display: inline-block; font-size: 14px; color: var(--stone); margin-bottom: 6px; text-decoration: none; }
.back::before { content: "‹ "; }
.back:hover { color: var(--black); }
.title-sep { color: var(--ash); font-weight: 600; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: -8px 0 18px; color: var(--stone); font-size: 15px; }
.status-line a { color: var(--black); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--white); color: var(--black); font: 600 15px/1 var(--body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--black); }
.btn .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.btn-primary { background: var(--black); border-color: var(--black); color: var(--white); }
.btn-primary:hover { background: #262626; }
.btn-accent { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-accent:hover { background: var(--red-press); border-color: var(--red-press); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--white); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-xs { height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: 0.6; cursor: progress; }
.icon-btn { width: 36px; height: 36px; border: 1px solid transparent; background: none; border-radius: var(--r); font-size: 22px; line-height: 1; color: var(--stone); cursor: pointer; }
.icon-btn:hover { border-color: var(--line); color: var(--red); }
form.inline { display: inline; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ panels & sections */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.pad { padding: 20px 22px; }
.pad-x { padding-left: 20px; padding-right: 20px; }
.panel + .panel, .panel + form.panel, form.panel + .panel, form.panel + form.panel, section.panel + section.panel { margin-top: 16px; }
.panel h2.h3, .panel > h3 { margin-bottom: 12px; }
.panel h3 { margin: 18px 0 6px; font-size: 15px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head p { margin: 0; }
.panel-inset { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-top: 16px; }
.narrow { max-width: 560px; }
.muted { color: var(--stone); }
.small { font-size: 14px; }
.lead { font-size: 18px; }
.pre { white-space: pre-line; }
.cap { text-transform: capitalize; }
.footnote { color: var(--stone); font-size: 13.5px; margin: 12px 0 0; max-width: 90ch; }
.hint { color: var(--stone); font-size: 14px; margin: 6px 0 0; }
.warn-text { color: var(--amber); font-weight: 600; }
.err-text { color: var(--red); }
.neg { color: var(--red); }
.below { color: var(--red); }
.due { color: var(--red); font-weight: 600; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.split-main, .split-side { min-width: 0; }
.split-side > .panel + .panel { margin-top: 16px; }
.sticky-side { position: sticky; top: 16px; }
.danger-zone { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); }
.delete-zone { margin-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-text { color: var(--red-press); }
.delete-details > summary { list-style: none; display: inline-flex; }
.delete-details > summary::-webkit-details-marker { display: none; }
.delete-details .form { max-width: 560px; margin-top: 12px; }
.plain-fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.plain-fieldset legend { font-weight: 600; margin-bottom: 6px; }
.note { margin-top: 16px; }
.internal { background: var(--panel-2); border-style: dashed; }
.tag-internal { display: inline-block; margin-left: 8px; font: 600 12px var(--body); color: var(--stone); border: 1px solid var(--line-strong); border-radius: 3px; padding: 1px 7px; vertical-align: 2px; }
.tag-sample { display: inline-block; font: 600 11.5px var(--body); color: var(--amber); background: var(--amber-tint); border-radius: 3px; padding: 0 6px; vertical-align: 1px; }

/* ------------------------------------------------------------------ the slab: KPI panels with saw-cut joints */
.slab, .stats, .profit-grid { display: grid; gap: var(--j); background: var(--joint); border: var(--j) solid var(--joint); border-radius: 3px; }
.slab-fin { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.slab-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { background: var(--panel); padding: 16px 18px 14px; text-decoration: none; display: flex; flex-direction: column; gap: 2px; min-height: 116px; position: relative; }
.tile:hover { background: var(--panel-2); }
.tile:hover .tile-label { color: var(--black); }
.tile-label { font-weight: 600; font-size: 14px; color: var(--stone); }
.tile-value { font: 800 28px/1.15 var(--display); letter-spacing: -0.02em; margin-top: 4px; }
.tile-lg .tile-value { font-size: 32px; }
.tile-sub { font-size: 13.5px; color: var(--stone); margin-top: auto; padding-top: 6px; }
.tile-attn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--j); background: var(--red); }
.attn-num { color: var(--red); }
.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 20px; }
.stats-tight { margin: 4px 0 12px; }
.stat { background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
a.stat:hover { background: var(--panel-2); }
.stat > span { font-weight: 600; font-size: 14px; color: var(--stone); }
.stat > strong { font: 800 22px/1.2 var(--display); letter-spacing: -0.01em; }
.stat > em { font-style: normal; font-size: 13px; color: var(--stone); }
.contact-strip { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: -8px 0 18px; font-size: 16px; }

/* ------------------------------------------------------------------ dashboard */
.dash-head { align-items: flex-end; }
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 28px; }
.dash-charts { grid-template-columns: 1fr 1fr; }
.chart-sub { margin: 26px 0 4px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.chart-sub h3 { font-size: 15px; }
.chart-panel { margin-top: 28px; }
.actions-panel { padding: 16px 0 8px; }
.actions-panel .section-head { margin-bottom: 8px; }
.count-pill { background: var(--red); color: var(--white); border-radius: 12px; padding: 0 9px; font-size: 13px; line-height: 22px; }
.act-list { max-height: 520px; overflow-y: auto; }
.act-group h3 { font: 600 13.5px var(--body); color: var(--stone); padding: 10px 20px 4px; margin: 0; display: flex; gap: 8px; }
.act-group h3 a { text-decoration: none; }
.act-group h3 b { color: var(--black); }
.act-group ul { list-style: none; margin: 0; padding: 0; }
.act-group li a { display: block; padding: 8px 20px; text-decoration: none; border-left: var(--j) solid transparent; font-size: 15px; }
.act-group li a:hover { background: var(--panel-2); border-left-color: var(--red); }
.act-group li span { display: block; font-size: 13.5px; color: var(--stone); }
.period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg-links { display: inline-flex; background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; flex-wrap: wrap; }
.seg-links a { padding: 8px 13px; text-decoration: none; font-weight: 600; font-size: 14.5px; border-right: 1px solid var(--line); }
.seg-links a:last-child { border-right: 0; }
.seg-links a:hover { background: var(--panel-2); }
.seg-links a.is-active { background: var(--black); color: var(--white); }
.period-custom { position: relative; }
.period-custom summary { list-style: none; cursor: pointer; padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--white); font-weight: 600; font-size: 14.5px; }
.period-custom summary::-webkit-details-marker { display: none; }
.period-custom summary.is-active, .period-custom[open] summary { background: var(--black); color: var(--white); border-color: var(--black); }
.period-custom[open] { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* charts */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis0 { stroke: var(--black); stroke-width: 1.2; }
.chart .tick { fill: var(--stone); font: 500 12px var(--body); }
.chart .tick-target { fill: var(--red); font-weight: 600; }
.chart .bar-sale { fill: var(--c-sale); }
.chart .bar-cost { fill: var(--c-cost); }
.chart .bar-gp { fill: var(--c-gp); }
.chart .bar-neg { fill: var(--white); stroke: var(--red); stroke-width: 1.5; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover { fill: rgba(0, 0, 0, 0.04); }
.chart .line { fill: none; stroke: var(--black); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--black); stroke: var(--white); stroke-width: 2; }
.chart .dot-low { fill: var(--white); stroke: var(--red); stroke-width: 2.5; }
.chart .target { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 6 5; }
.chart-note { font-size: 13px; color: var(--stone); margin: 6px 0 0; }
.legend { display: flex; gap: 18px; font-size: 14px; color: var(--stone); margin-bottom: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.sw-sale { background: var(--c-sale); } .sw-cost { background: var(--c-cost); } .sw-gp { background: var(--c-gp); }
.hbars { display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 1.1fr) 2fr auto; gap: 12px; align-items: center; text-decoration: none; padding: 7px 6px; border-radius: 3px; }
.hbar:hover { background: var(--panel-2); }
.hbar-label { font-size: 14.5px; font-weight: 500; }
.hbar-label em, .hbar-val em { font-style: normal; color: var(--stone); font-size: 13px; }
.hbar-track { height: 12px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--black); }
.hbar-fill.f-light { background: var(--c-cost); }
.hbar-fill.f-mid { background: var(--stone); }
.hbar-val { font-weight: 600; font-size: 14.5px; text-align: right; min-width: 88px; }

/* ------------------------------------------------------------------ tabs / toolbar */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px 9px; text-decoration: none; font-weight: 600; color: var(--stone); border-bottom: 3px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover { color: var(--black); }
.tabs a.is-active { color: var(--black); border-bottom-color: var(--red); }
.tabs b { font-weight: 600; font-size: 12.5px; color: var(--stone); background: var(--line-soft); border-radius: 10px; padding: 1px 7px; margin-left: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin: 0 0 14px; }
.toolbar-link { font-size: 14.5px; font-weight: 600; }
.search { position: relative; flex: 0 1 420px; min-width: 220px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--stone); }
.search input[type=search] { padding-left: 40px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.inline-field input, .inline-field select { height: 40px; width: auto; }
.filter-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--black); color: var(--white); border-radius: 3px; padding: 6px 6px 6px 12px; font-size: 14px; }
.filter-chip a { color: var(--white); text-decoration: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 2px; }
.filter-chip a:hover { background: var(--red); }

/* ------------------------------------------------------------------ tables */
.scroll-x { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font: 600 13.5px var(--body); color: var(--stone); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.table th a { text-decoration: none; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 2px solid var(--black); font-weight: 600; background: var(--panel-2); }
.table .r, .table th.r { text-align: right; }
.rowlink:hover td { background: #faf9f7; }
.rowlink td > a:first-child { text-decoration: none; }
.rowlink td > a:first-child:hover { text-decoration: underline; text-decoration-color: var(--red); }
.cell-sub { display: block; font-size: 13.5px; color: var(--stone); }
.clamp { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.attn td:first-child { box-shadow: inset var(--j) 0 0 var(--red); }
.attn-reason { display: block; font-size: 13px; font-weight: 600; color: var(--red); }
tr.future td { color: var(--ash); }
tr.editing td { background: var(--amber-tint); }
.table.report td, .table.report th { white-space: nowrap; }
.actions-col { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.meter-cell { width: 120px; }
.meter { display: block; height: 8px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--black); }
.meter.over > span { background: var(--red); }
.show-sm { display: none; }

/* menu popover */
details.menu { position: relative; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); background: var(--white); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14); min-width: 200px; z-index: 20; padding: 4px 0; text-align: left; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: 0; font: 500 15px var(--body); text-decoration: none; cursor: pointer; color: var(--black); }
.menu-pop a:hover, .menu-pop button:hover { background: var(--panel-2); }
.menu-pop form { margin: 0; }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 3px; font: 600 13px/1 var(--body); white-space: nowrap; border: 1px solid transparent; }
.b-estimate-draft, .b-invoice-draft, .b-project-cancelled { background: var(--line-soft); color: #4a4843; }
.b-estimate-sent, .b-project-in_progress { background: var(--black); color: var(--white); }
.b-estimate-expired, .b-project-unscheduled, .b-invoice-partial, .b-warn { background: var(--amber-tint); color: var(--amber); border-color: #efd9a6; }
.b-estimate-won, .b-project-completed, .b-invoice-paid, .b-ok { background: var(--green-tint); color: var(--green); border-color: #bfdcc9; }
.b-estimate-lost { background: var(--line-soft); color: var(--stone); }
.b-project-scheduled, .b-invoice-issued { background: var(--white); color: var(--black); border-color: var(--black); }
.b-invoice-overdue, .b-bad { background: var(--red); color: var(--white); }
.b-invoice-void { background: var(--line-soft); color: var(--stone); text-decoration: line-through; }

/* ------------------------------------------------------------------ flashes / empty */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid; margin-bottom: 16px; font-size: 15.5px; }
.flash .ic { margin-top: 2px; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.flash p { margin: 4px 0 8px; }
.flash-ok { background: var(--green-tint); border-color: #bfdcc9; color: #123d24; }
.flash-error { background: var(--red-tint); border-color: #f0b8bc; color: #7a1017; }
.flash-warn { background: var(--amber-tint); border-color: #efd9a6; color: #5c3a00; }
.flash-info { background: var(--panel-2); border-color: var(--line); color: #33312d; }
.flash a { color: inherit; font-weight: 600; }
.empty { text-align: center; padding: 48px 20px; background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.empty h2 { margin: 16px 0 6px; }
.empty p { color: var(--stone); max-width: 52ch; margin: 0 auto 18px; }
.empty-mark { width: 52px; height: 52px; margin: 0 auto; border: 3px solid var(--joint);
  background: linear-gradient(var(--joint), var(--joint)) center / 3px 100% no-repeat, linear-gradient(var(--joint), var(--joint)) center / 100% 3px no-repeat, var(--slab); }

/* ------------------------------------------------------------------ forms */
.form .field, .stack .field { margin-bottom: 14px; }
.stack { display: grid; gap: 0; margin-top: 10px; }
.field label { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
.field label em { font-style: normal; font-weight: 400; color: var(--stone); font-size: 13.5px; }
input[type=text], input[type=email], input[type=url], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--white); color: var(--black); font: 400 16px var(--body); }
textarea { height: auto; padding: 10px 12px; line-height: 1.45; resize: vertical; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 3px rgba(215, 31, 43, 0.22); }
input[disabled], select[disabled], textarea[disabled] { background: var(--panel-2); color: var(--stone); }
.has-err input, .has-err select, .has-err textarea, [aria-invalid=true] { border-color: var(--red); }
.err { color: var(--red); font-size: 14px; font-weight: 500; margin: 6px 0 0; }
fieldset { border: 0; padding: 0; margin: 4px 0 8px; min-width: 0; }
legend { font-weight: 700; font-family: var(--display); font-size: 15px; margin-bottom: 8px; padding: 0; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 4px 0 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--black); }
.grid { display: grid; gap: 0 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-addr { grid-template-columns: minmax(0, 2fr) minmax(0, 0.7fr) minmax(0, 1fr); }
.g-cost { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.2fr); }
.split-side .g-cost { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split-side .g-cost [data-unit-field] { grid-row: 2; grid-column: 1 / -1; }
.affix { display: flex; align-items: stretch; }
.affix > span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--panel-2); color: var(--stone); font-weight: 600; }
.affix > input { border-radius: 0 var(--r) var(--r) 0; min-width: 0; }
.affix-r > span { border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--r) var(--r) 0; }
.affix-r > input { border-radius: var(--r) 0 0 var(--r); }
.inline-field .affix input { width: 90px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--slab) 70%, transparent); padding: 16px 0 12px; margin-top: 12px; z-index: 5; }
.doc-form > .panel { margin-top: 16px; }
.doc-form > .panel:first-of-type { margin-top: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.inline-form .field { margin: 0; }
.small-form { margin-top: 12px; }
.small-form input { height: 36px; }
details > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
details > summary:hover { color: var(--red); }
.confirm-box .check { margin-top: 10px; }

/* line items */
.items-head, .item-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 96px 136px 112px 36px; gap: 8px; align-items: start; }
.items-head { font: 600 13.5px var(--body); color: var(--stone); padding: 0 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.items-head span:nth-child(5) { text-align: right; }
.item-row { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.item-row textarea { min-height: 44px; resize: none; overflow: hidden; }
.item-row output { display: block; text-align: right; font-weight: 600; padding-top: 11px; }
.item-row .err { grid-column: 1 / -1; }
.item-row.has-err input, .item-row.has-err textarea { border-color: var(--red); }
.items-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-top: 12px; flex-wrap: wrap; }
.totals { margin: 0; min-width: 320px; }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; }
.totals dt { color: var(--stone); font-weight: 500; }
.totals dd { margin: 0; font-weight: 600; text-align: right; }
.totals dd .affix { width: 150px; }
.totals dd input { height: 38px; text-align: right; }
.totals .grand { border-top: 2px solid var(--black); margin-top: 6px; padding-top: 10px; }
.totals .grand dt { color: var(--black); font-weight: 700; }
.totals .grand dd { font: 800 22px var(--display); }
.totals.static { margin: 14px 0 6px auto; max-width: 360px; }
.est-profit { font-weight: 600; margin: 4px 0 12px; }
.items-table td:first-child { min-width: 240px; }

/* cost form */
.cost-form { display: grid; gap: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips legend { width: 100%; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); font-weight: 600; font-size: 14.5px; background: var(--white); }
.chip input:checked + span { background: var(--black); color: var(--white); border-color: var(--black); }
.chip input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }
.mode { display: flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; margin-bottom: 14px; }
.mode[hidden] { display: none; }
.seg { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 9px 8px; font-weight: 600; font-size: 14px; background: var(--white); }
.seg + .seg span { border-left: 1px solid var(--line-strong); }
.seg input:checked + span { background: var(--black); color: var(--white); }
.seg input:focus-visible + span { outline: 3px solid var(--red); outline-offset: -3px; }
.cost-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--black); padding: 10px 0 14px; margin-top: 2px; }
.cost-total span { font-weight: 600; }
.cost-total output { font: 800 26px var(--display); }

/* ------------------------------------------------------------------ project page */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--j); padding: 0; margin: 0 0 14px; }
.stepper li { border-top: 6px solid var(--line); padding-top: 8px; color: var(--stone); font-weight: 600; font-size: 14.5px; }
.stepper li em { display: block; font-style: normal; font-weight: 400; font-size: 13.5px; }
.stepper li.done { border-top-color: var(--black); color: var(--black); }
.stepper li.current { border-top-color: var(--red); color: var(--black); }
.stepper li.current span { font-weight: 700; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 22px; }
.stage-form { position: relative; }
.stage-form > summary { list-style: none; padding: 0; }
.stage-form > summary::-webkit-details-marker { display: none; }
.stage-form[open] { flex-basis: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.profit { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 18px; }
.profit-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.profit-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 4px; }
.profit-grid > div { background: var(--panel); padding: 12px 14px; }
.profit-grid > div > span { display: block; font-weight: 600; font-size: 14px; color: var(--stone); }
.profit-grid > div > strong { display: block; font: 800 26px/1.2 var(--display); letter-spacing: -0.015em; margin: 2px 0; }
.profit-grid > div > em { font-style: normal; font-size: 13px; color: var(--stone); }
.profit.is-provisional .profit-grid > div { background-image: repeating-linear-gradient(135deg, transparent 0 10px, rgba(0, 0, 0, 0.018) 10px 20px); }
.billing-box { margin-bottom: 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip-link { padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); text-decoration: none; font-weight: 600; font-size: 14.5px; background: var(--white); }
.chip-link:hover { border-color: var(--black); }
.chip-link.is-active { background: var(--black); color: var(--white); border-color: var(--black); }
.balance-due { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.balance-due strong { font: 800 24px var(--display); }
.doc-parties { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 8px; }
.doc-parties h3 { margin: 0 0 4px; font: 600 13.5px var(--body); color: var(--red); }
.kv { margin: 0 0 8px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.kv dt { color: var(--stone); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 14.5px; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; background: var(--black); }
.co-status select { height: 34px; width: auto; font-size: 14px; }
.pdf-frame { width: 100%; height: calc(100vh - 200px); min-height: 600px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); }
.mail-frame { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: var(--r); margin-top: 12px; background: var(--slab); }
.defs dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px 28px; margin: 0; }
.defs dt { font-weight: 700; }
.defs dd { margin: 2px 0 0; color: #33312d; font-size: 15px; }
#definitions { margin-top: 28px; }

/* ------------------------------------------------------------------ pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: var(--j); background: var(--joint); border: var(--j) solid var(--joint); border-radius: 3px; overflow-x: auto; min-height: 60vh; }
.board-col { background: var(--slab); display: flex; flex-direction: column; min-width: 0; }
.board-col header { background: var(--panel); padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.board-col h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; background: var(--black); color: var(--white); font: 700 12px var(--body); border-radius: 2px; }
.col-unscheduled .step-n, .col-scheduled .step-n, .col-in_progress .step-n, .col-completed .step-n { background: var(--red); }
.board-sum { display: block; font-size: 14px; color: var(--stone); margin-top: 4px; }
.board-sum b { color: var(--black); }
.board-col header p { margin: 2px 0 0; font-size: 13px; color: var(--stone); }
.board-cards { padding: 10px; display: grid; gap: 8px; align-content: start; }
.board-empty { color: var(--ash); font-size: 14px; text-align: center; padding: 20px 0; margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.card-attn { box-shadow: inset var(--j) 0 0 var(--red); }
.card-main { display: block; padding: 10px 12px 8px; text-decoration: none; }
.card-main:hover strong { text-decoration: underline; text-decoration-color: var(--red); }
.card-num { display: block; font-size: 12.5px; color: var(--stone); font-weight: 600; }
.card-main strong { display: block; font-size: 15.5px; }
.card-title { display: block; font-size: 14px; color: #33312d; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 13.5px; color: var(--stone); }
.card-meta b { color: var(--black); font-size: 15px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.lost-drawer { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 16px; }
.lost-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ------------------------------------------------------------------ settings */
.settings-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: -6px 0 16px; font-weight: 600; font-size: 14.5px; }
.logo-row { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; margin-bottom: 16px; }
.logo-preview { background: var(--black); padding: 12px; border-radius: var(--r); border-bottom: var(--j) solid var(--red); }
.logo-preview img { display: block; width: 100%; height: auto; }
.email-status { border-left: var(--j) solid var(--amber); background: var(--amber-tint); padding: 12px 14px; border-radius: 0 var(--r) var(--r) 0; margin-bottom: 16px; }
.email-status.ok { border-left-color: var(--green); background: var(--green-tint); }
.email-status p:last-child { margin-bottom: 0; }
.select-all { user-select: all; }

/* ------------------------------------------------------------------ sign-in and public document pages */
body.gate { background: var(--black); min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-main { width: 100%; max-width: 420px; }
.gate-logo { display: block; width: 300px; max-width: 80%; height: auto; margin: 0 auto 20px; }
.gate-card { background: var(--white); border-top: var(--j) solid var(--red); border-radius: var(--r); padding: 26px 24px 22px; }
.gate-card h1 { font-size: 24px; margin-bottom: 16px; }
.gate-card .field { margin-bottom: 14px; }
.gate-note { margin: 14px 0 0; text-align: center; }
body.public { background: var(--slab); }
.pub-head { background: var(--black); border-bottom: var(--j) solid var(--red); text-align: center; padding: 14px 16px; }
.pub-head img { height: 110px; width: auto; }
.pub-main { max-width: 860px; margin: 0 auto; padding: 28px 16px 48px; }
.pub-main h1 { margin-bottom: 14px; }
.pub-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--j); background: var(--joint); border: var(--j) solid var(--joint); margin: 0 0 18px; border-radius: 3px; }
.pub-facts div { background: var(--white); padding: 12px 14px; }
.pub-facts dt { color: var(--stone); font-weight: 600; font-size: 14px; }
.pub-facts dd { margin: 0; font: 800 22px var(--display); }
.pub-pdf { width: 100%; height: 80vh; border: 1px solid var(--line); margin: 16px 0; background: var(--white); }

/* ------------------------------------------------------------------ responsive */
.hide-lg { display: none; }
@media (max-width: 1280px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
  .profit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profit-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .split, .dash-top { grid-template-columns: minmax(0, 1fr); }
  .sticky-side { position: static; }
  .act-list { max-height: none; }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  :root { --side: 280px; }
  .side { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.4); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 30; }
  .shell { margin-left: 0; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--black); height: 60px; padding: 0 12px; border-bottom: var(--j) solid var(--red); }
  .topbar-menu { background: none; border: 0; color: var(--white); width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
  .topbar-menu .ic { width: 26px; height: 26px; }
  .topbar-logo img { height: 46px; width: auto; display: block; }
  .topbar-cost { margin-left: auto; background: var(--red); border-color: var(--red); height: 40px; }
  .main { padding: 20px 16px 56px; }
  .hide-md { display: none; }
  .hide-lg { display: inline-flex; }
  .slab-fin, .slab-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-cols, .dash-charts { grid-template-columns: minmax(0, 1fr); }
  .board { grid-auto-columns: minmax(260px, 82vw); }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .g2, .g3, .g5 { grid-template-columns: minmax(0, 1fr); }
  .g-cost { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .g-cost [data-unit-field] { grid-row: 2; grid-column: 1 / -1; }
  .g-addr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .g-addr > :first-child { grid-column: 1 / -1; }
  .tile { min-height: 100px; padding: 12px 14px; }
  .tile-value, .tile-lg .tile-value { font-size: 23px; }
  .profit-grid > div > strong { font-size: 22px; }
  .doc-parties { grid-template-columns: 1fr; }
  .pad { padding: 16px; }
  .items-head { display: none; }
  .item-row { grid-template-columns: 1fr 1fr 1.4fr 36px; }
  .item-row textarea { grid-column: 1 / -1; }
  .item-row output { grid-column: 1 / 4; padding-top: 0; }
  .item-row .icon-btn { grid-row: 2; grid-column: 4; }
  .totals { min-width: 0; width: 100%; }
  .stepper li { font-size: 13px; }
  .logo-row { grid-template-columns: 1fr; }
  .logo-preview { max-width: 240px; }
  .search { flex: 1 1 100%; }
  .period { width: 100%; }
  .seg-links { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg-links a { white-space: nowrap; }
  .table td, .table th { padding: 10px 10px; }
  .row-actions .btn-ghost { display: none; }
  .hbar { grid-template-columns: 1fr auto; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .side, .topbar, .page-actions, .stage-actions, form, .split-side { display: none !important; }
  .shell { margin: 0; } body { background: #fff; } .split { display: block; }
}

.costs-table td:first-child, .table td.nowrap { white-space: nowrap; }

/* automations */
.auto-list { display: grid; gap: var(--j); background: var(--joint); border: var(--j) solid var(--joint); border-radius: 3px; }
.auto-card { background: var(--panel); padding: 16px 18px; display: flex; gap: 20px; justify-content: space-between; align-items: flex-start; }
.auto-card.is-off .auto-main { opacity: 0.6; }
.auto-card h3 { margin: 0 0 2px; font-size: 17px; }
.auto-card h3 a { text-decoration: none; }
.auto-card p { margin: 4px 0 0; }
.auto-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; flex: none; }
.step-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.step-head .check { margin: 0; }
.step-wait { align-items: center; margin: 4px 0 14px; font-weight: 600; }
.days-input { width: 70px !important; text-align: center; }
.step-blank { background: var(--panel-2); border-style: dashed; }
.step-blank summary { font-family: var(--display); }
.ph-list { list-style: none; padding: 0; margin: 10px 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.ph-list code { font-size: 12.5px; }
.mail-preview .mail-body { border-left: var(--j) solid var(--line); padding: 4px 0 4px 16px; max-width: 72ch; }
.auto-panel .timeline { margin-bottom: 10px; }
@media (max-width: 640px) { .auto-card { flex-direction: column; } .auto-side { align-items: flex-start; text-align: left; } }

/* roles */
.role-key { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--j); background: var(--joint); border: var(--j) solid var(--joint); border-radius: 3px; margin: 0 0 16px; }
.role-key > div { background: var(--panel); padding: 10px 12px; }
.role-key dt { font-weight: 700; }
.role-key dd { margin: 2px 0 0; font-size: 14px; color: var(--stone); }
.role-form select { height: 34px; width: auto; font-size: 14px; }

/* closed (archived) jobs */
.tag-closed { display: inline-block; font: 600 11.5px var(--body); color: var(--stone); background: var(--line-soft); border-radius: 3px; padding: 0 6px; vertical-align: 1px; }
.bulk-close { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-left: var(--j) solid var(--black); border-radius: var(--r); padding: 10px 14px; margin: 0 0 14px; font-size: 15px; }

/* installed on a phone home screen: keep clear of the notch and home bar */
@media (max-width: 960px) {
  .topbar { height: calc(60px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .main { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
}

/* analytics */
.an-nav { position: sticky; top: 0; z-index: 6; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; background: var(--slab); padding: 8px 0; margin: -6px 0 8px; border-bottom: 1px solid var(--line); }
.an-nav a { white-space: nowrap; padding: 6px 12px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--stone); }
.an-nav a:hover { background: var(--panel); color: var(--black); }
.an-section { margin-top: 30px; scroll-margin-top: 64px; }
/* joints drawn per tile, so a part-filled last row shows the page, not dark blocks */
.an-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); background: none; border: 0; gap: 0; padding: 2px; }
.an-grid > .tile { box-shadow: 0 0 0 2px var(--joint); margin: 2px; }
.an-tile { min-height: 124px; }
.an-tile .tile-value small { font: 600 14px var(--body); color: var(--stone); letter-spacing: 0; }
.an-cmp { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.an-cmp:first-of-type { margin-top: auto; padding-top: 6px; }
.an-cmp em { font-style: normal; color: var(--stone); }
.delta { font-weight: 700; white-space: nowrap; }
.delta.good { color: var(--green); }
.delta.bad { color: var(--red); }
.delta.flat, .delta.none { color: var(--stone); font-weight: 600; }
.an-gap { margin-top: 16px; }
.an-section .dash-cols { margin-top: 16px; }
.an-section h3 { font-size: 15px; margin-bottom: 10px; }
.chart .ml { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.chart .ml.s-cur { stroke: var(--black); }
.chart .ml.s-prev { stroke: var(--c-cost); stroke-dasharray: 5 4; }
.chart .ml-dot { stroke: var(--white); stroke-width: 1.5; }
.chart .ml-dot.s-cur { fill: var(--black); }
.chart .ml-dot.s-prev { fill: var(--c-cost); }
.sw-line { height: 3px; width: 16px; border-radius: 0; }
.sw-line.s-cur { background: var(--black); }
.sw-line.s-prev { background: var(--c-cost); }
@media (max-width: 960px) { .an-nav { top: calc(64px + env(safe-area-inset-top)); } }
@media (max-width: 640px) {
  .an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-tile { min-height: 0; padding: 12px; }
  .an-tile .tile-value { font-size: 21px; }
  .an-tile .tile-label { font-size: 13px; }
  .an-cmp { flex-wrap: wrap; font-size: 12px; gap: 2px 6px; }
}

/* ---- Job photos (internal) and signed copies */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.photo-upload { margin-bottom: 18px; }
.photo-pick { cursor: pointer; }
.photo-upload input[type=file]:focus-visible + * , .photo-upload:has(input[type=file]:focus-visible) .photo-pick { outline: 3px solid var(--red); outline-offset: 2px; }
.upload-picked { margin: 0; font-weight: 600; }
.upload-status:empty { display: none; }
.upload-status { margin: 0; font-weight: 600; color: var(--stone); }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-grid li { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; min-width: 0; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 2px; display: block; background: var(--line-soft); }
.photo-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.photo-cap { font-weight: 600; }
.photo-del { margin: 0; }
.photo-del .btn { width: 100%; }
.signed-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.signed-list li { line-height: 1.5; }
.signed-list form.inline { display: inline-block; margin-top: 4px; }

/* ---- Customer approve-and-sign (public estimate link) */
.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pub-sign { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--r); padding: 20px; margin: 22px 0; }
.pub-sign h2 { margin: 0 0 8px; }
.pub-sign.pub-done { border-top-color: var(--green); }
.sign-accept { align-items: flex-start; gap: 10px; font-weight: 600; line-height: 1.45; }
.sign-accept input { margin-top: 4px; flex: none; width: 20px; height: 20px; }
.sig-pad { border: 2px solid var(--black); border-radius: var(--r); background: #fff; }
.sig-pad-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 8px 0 12px; font-weight: 600; color: var(--stone); }
.sig-tools { display: flex; gap: 4px; }
.sig-pad canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; border-top: 1px dashed var(--line-strong); margin-top: 6px; }
.sign-error { margin: 0; color: var(--red); font-weight: 700; }
.approval-link input { width: 100%; font: 500 14px var(--body); }

/* ---------------------------------------------------------------- notifications: bell, menu dots, pop-ups */
.nav-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--black); flex: none; }
.nav-dot[hidden] { display: none; }
.notif { position: relative; }
.notif > summary { list-style: none; cursor: pointer; }
.notif > summary::-webkit-details-marker { display: none; }
.notif-btn { display: flex; align-items: center; gap: 12px; color: #d9d6d0; font-weight: 600; }
.notif-count { background: var(--red); color: var(--white); font-size: 12px; min-width: 22px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.notif-count[hidden] { display: none; }
.notif-side .notif-btn { height: 48px; padding: 0 20px; border-bottom: 1px solid #262626; font-size: 15.5px; }
.notif-side .notif-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--white); }
.notif-side .notif-count { margin-left: auto; }
.notif-side[open] .notif-btn { color: var(--white); background: rgba(255, 255, 255, 0.1); }
.notif-panel { position: fixed; z-index: 60; background: var(--panel); color: var(--black); border: 1px solid var(--line-strong); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; max-height: min(560px, calc(100vh - 32px)); }
.notif-side .notif-panel { left: calc(var(--side) + 8px); top: 16px; width: 400px; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: var(--j) solid var(--joint); }
.notif-head strong { font: 800 16px var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.notif-head form { margin: 0; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--red-press); font: 600 14px var(--body); cursor: pointer; text-decoration: underline; }
.link-btn[hidden] { display: none; }
.notif-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.notif-list li + li { border-top: 1px solid var(--line-soft); }
.notif-list a { display: grid; gap: 2px; padding: 12px 16px 12px 22px; color: var(--black); text-decoration: none; position: relative; }
.notif-list a:hover, .notif-list a:focus-visible { background: var(--panel-2); }
.notif-list strong { font-weight: 600; font-size: 15px; line-height: 1.3; }
.notif-list span { color: var(--stone); font-size: 14px; }
.notif-list time { color: var(--ash); font-size: 13px; }
.notif-list .is-unread a { background: var(--red-tint); }
.notif-list .is-unread a::before { content: ""; position: absolute; left: 9px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.notif-list .is-unread strong { font-weight: 700; }
.notif-empty { margin: 0; padding: 18px 16px; color: var(--stone); font-size: 14px; }
.notif-empty[hidden] { display: none; }
.notif-top { display: none; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; background: var(--black); color: var(--white); padding: 14px 14px 14px 16px;
  border-left: var(--j) solid var(--red); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3); text-decoration: none; animation: toast-in 0.2s ease-out; }
.toast .ic { width: 22px; height: 22px; color: var(--red); }
.toast strong { display: block; font-weight: 700; }
.toast span { color: #cfccc6; font-size: 14px; }
.toast button { background: none; border: 0; color: #cfccc6; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 960px) {
  .notif-side { display: none; }
  .notif-top { display: block; margin-left: auto; }
  .notif-top + .topbar-cost { margin-left: 0; }
  .notif-top .notif-btn { width: 44px; height: 44px; justify-content: center; position: relative; color: var(--white); }
  .notif-top .notif-btn .ic { width: 26px; height: 26px; }
  .notif-top .notif-count { position: absolute; top: 2px; right: -2px; height: 18px; min-width: 18px; font-size: 11px; padding: 0 5px; }
  .notif-top .notif-panel { top: calc(64px + env(safe-area-inset-top)); left: 8px; right: 8px; }
  .toasts { left: 16px; right: 16px; width: auto; bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media print { .notif, .toasts { display: none !important; } }
.push-panel .push-status { font-weight: 600; }
.push-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.push-actions [hidden], .push-help[hidden], .push-panel .hint[hidden] { display: none; }
.push-help { background: var(--panel-2); border-left: var(--j) solid var(--red); padding: 12px 16px; margin-top: 12px; }
.push-help ol { margin: 8px 0 0; padding-left: 22px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.notif-phone { margin-left: auto; margin-right: 14px; font-size: 13px; color: var(--stone); }

/* ---------------------------------------------------------------- schedule calendar */
.crew-full { --crew-bg: var(--red); --crew-fg: var(--white); }
.crew-half { --crew-bg: #f2b01e; --crew-fg: var(--black); }
.crew-none { --crew-bg: #c9c5be; --crew-fg: var(--black); }
.cal-appt { --crew-bg: #1f5fd6; --crew-fg: var(--white); }
.cal-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.cal-nav, .cal-views { display: flex; align-items: center; gap: 6px; }
.cal-title { font: 800 18px var(--display); margin: 0 0 0 8px; text-transform: uppercase; letter-spacing: 0.01em; }
.cal-views .is-on { background: var(--black); color: var(--white); border-color: var(--black); }
.cal-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 12px; padding: 0; font-size: 14px; color: var(--stone); }
.cal-legend li { display: flex; align-items: center; gap: 6px; }
.cal-legend i, .crew-pick i { width: 14px; height: 14px; border-radius: 3px; background: var(--crew-bg); display: inline-block; }
.cal-legend i.is-done { opacity: 0.45; }
.cal { border: 1px solid var(--line-strong); background: var(--panel); }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--black); color: var(--white); font: 700 12px var(--body); text-transform: uppercase; letter-spacing: 0.06em; }
.cal-head div { padding: 8px 10px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 28px repeat(var(--rows), 26px) 8px; row-gap: 3px; border-top: 1px solid var(--line); }
.cal-day { border-left: 1px solid var(--line-soft); min-height: 100%; }
.cal-day:first-child { border-left: 0; }
.cal-day.is-weekend { background: var(--panel-2); }
.cal-day.is-other { background: #f1f0ec; }
.cal-day.is-other .cal-date { color: var(--ash); }
.cal-day.is-past .cal-date { color: var(--stone); }
.cal-date { display: inline-block; padding: 4px 8px; font: 600 13px var(--body); color: var(--black); text-decoration: none; border-radius: 3px; }
.cal-date:hover { background: var(--line-soft); }
.cal-day.is-today { box-shadow: inset 0 3px 0 var(--red); }
.cal-day.is-today .cal-date { background: var(--red); color: var(--white); }
.cal-job { display: block; z-index: 1; margin: 0 4px; padding: 0 8px; border-radius: 4px; background: var(--crew-bg); color: var(--crew-fg); font-size: 13px; line-height: 26px; height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal-job:hover, .cal-job:focus-visible { filter: brightness(0.92); outline: 2px solid var(--black); outline-offset: 1px; }
.cal-job.cont-left { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-job.cont-right { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-job.is-done { opacity: 0.45; }
.cal-job span { opacity: 0.85; }
.cal-agenda { display: none; }
.cal-agenda section { margin-bottom: 14px; }
.cal-agenda h3 { font: 700 14px var(--body); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--stone); }
.cal-agenda h3.is-today { color: var(--red); }
.cal-agenda .cal-job { margin: 0 0 6px; height: auto; line-height: 1.35; padding: 8px 10px; white-space: normal; }
.sched-lower { margin-top: 20px; align-items: start; }
.sched-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.crew-pick { border: 0; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 24px; }
.crew-pick legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.crew-pick .check { gap: 8px; }
.crew-pick.has-err legend { color: var(--red-press); }
@media (max-width: 760px) {
  .cal { display: none; }
  .cal-agenda { display: block; }
}
@media print { .cal-job { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.sched-item { display: grid; gap: 6px; }
.sched-notes { margin: 0; padding: 8px 10px; background: var(--panel-2); border-left: 3px solid var(--line-strong); font-size: 14px; }
.sched-notes > span { display: block; font: 700 11px var(--body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--stone); margin-bottom: 2px; }
.sched-notes p { margin: 0; }
.sched-notes p + p { margin-top: 6px; }
.purge-zone { margin-top: 16px; padding: 10px 14px; border: 1px dashed var(--line-strong); font-size: 14px; }
.purge-zone summary { cursor: pointer; color: var(--stone); }
.purge-zone .form { margin-top: 10px; max-width: 520px; }

/* ------------------------------------------------------------------ paying online, integrations */
.pub-pay { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.pub-pay .btn { min-height: 48px; font-size: 16px; }
.integ-list { display: grid; gap: 16px; }
.integ { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: start; }
.integ-mark { width: 56px; height: 56px; border-radius: 8px; display: grid; place-items: center; font: 800 18px var(--display); color: var(--white); background: var(--black); }
.integ-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 4px; }
.integ-head h2 { margin: 0; }
.integ-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.integ details { margin-top: 12px; }
.integ .table { font-size: 14px; }
.integ-small { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.integ-small .panel { margin: 0; }
@media (max-width: 640px) { .integ { grid-template-columns: minmax(0, 1fr); } .integ-mark { width: 44px; height: 44px; font-size: 15px; } }
.integ-group { margin: 26px 0 10px; color: var(--stone); text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; }
.receipt-offer { align-items: center; flex-wrap: wrap; }
.receipt-offer > span { flex: 1; min-width: 14em; }
.b-contractor { background: var(--white); color: var(--black); border-color: var(--line-strong); }
.contractor-toggle { display: inline-flex; align-items: center; gap: 8px; }

/* Character count under long text boxes (2026-11-03) */
.char-count { font-size: 13px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.char-count.char-over { color: var(--red); font-weight: 600; }
