:root{font-family:system-ui,sans-serif;color:#1a2e27;background:#f3f5ef;--green:#16382e;--line:#dce3da;--soft:#e6eee2;--accent:#d9f293}
*{box-sizing:border-box}body{margin:0}header{background:#fff;border-bottom:1px solid var(--line)}.mast,main{max-width:1120px;margin:auto;padding:0 24px}.mast{display:flex;align-items:center;justify-content:space-between;min-height:72px;gap:12px}.brand{font-weight:800;color:var(--green);text-decoration:none;white-space:nowrap}.mark{display:inline-grid;place-items:center;background:var(--green);color:var(--accent);width:32px;height:32px;border-radius:8px;margin-right:5px}nav{display:flex;gap:4px}button,input,select{font:inherit}button{cursor:pointer;border:1px solid var(--line);border-radius:8px;padding:10px 14px;background:white;color:var(--green);font-weight:650}button:hover{border-color:#739583}button:focus-visible,a:focus-visible{outline:3px solid #7ba940;outline-offset:2px}nav button{border-color:transparent}nav button[aria-pressed=true]{background:var(--soft)}main{padding-top:26px}.hero{background:var(--green);color:#fff;padding:30px 32px;border-radius:16px;display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}.hero p{color:#d4e2d9;margin:7px 0 0}h1,h2,p{margin:0}h1{font-size:clamp(2rem,6vw,3.25rem);letter-spacing:-.055em;line-height:1}h2{font-size:1.22rem}.light{background:var(--accent);border-color:transparent;white-space:nowrap}.actions,.counts{display:grid;gap:12px;margin:0 0 16px}.actions{grid-template-columns:1fr 1fr}.actions button{text-align:left;padding:17px}.actions button:first-child{background:#e9f2d4}.actions strong,.actions span{display:block}.actions span{font-size:.86rem;font-weight:400;color:#43574c;margin-top:3px}.counts{grid-template-columns:repeat(3,1fr)}.counts div,.panel{background:white;border:1px solid var(--line);border-radius:12px}.counts div{padding:13px 16px}.counts span{font-size:.69rem;color:#53675d;font-weight:800;display:block;letter-spacing:.06em}.counts strong{display:block;font-size:clamp(1rem,4vw,1.6rem);margin-top:4px;overflow-wrap:anywhere}.panelHead{padding:18px;display:grid;gap:12px}.filters{display:grid;grid-template-columns:2fr 1fr 1fr;gap:10px}label{display:grid;gap:5px;font-size:.82rem;font-weight:650;min-width:0}input,select{width:100%;min-width:0;border:1px solid #becbc1;border-radius:7px;background:white;padding:9px;color:#18372b;font-size:1rem}input:focus,select:focus{outline:2px solid #789d62;outline-offset:1px}.empty{border-top:1px solid var(--line);padding:34px 16px;text-align:center;color:#4d6357}.entry{border-top:1px solid var(--line);padding:15px 18px;display:flex;justify-content:space-between;align-items:center;gap:12px;overflow-wrap:anywhere}.entry p{color:#4d6357;font-size:.88rem;margin-top:4px}.entryActions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.entryActions button{padding:7px 10px}.badge{display:inline-block;background:var(--soft);padding:2px 8px;border-radius:20px;margin:5px 4px 0 0;font-size:.8rem}.primary{background:var(--green);color:white;border-color:var(--green)}footer{padding:19px 0;color:#52665b;font-size:.82rem}dialog{border:1px solid var(--line);border-radius:14px;width:min(520px,calc(100% - 24px));padding:18px;color:inherit;max-height:calc(100dvh - 28px);overflow:auto}dialog::backdrop{background:#0d251dae}.dialogHead{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}.dialogHead button{font-size:1.2rem;padding:2px 11px}form{display:grid;gap:10px}.pair{display:grid;grid-template-columns:1fr 1fr;gap:10px}.hint{color:#476055;font-size:.9rem;margin-bottom:8px}.error{color:#9c2626;font-size:.88rem}.error:empty{display:none}video{display:block;width:100%;max-height:35dvh;border-radius:9px;background:#1b352e;margin-bottom:10px;object-fit:contain}video[hidden]{display:none}@media(max-width:590px){main,.mast{padding-left:12px;padding-right:12px}.mast{min-height:62px}nav button{font-size:.8rem;padding:8px}.brand{font-size:.85rem}.mark{width:25px;height:25px;margin-right:2px}main{padding-top:13px}.hero{padding:21px 15px;align-items:flex-start}.hero p{font-size:.86rem}.hero button{padding:8px}.filters{grid-template-columns:1fr 1fr}.search{grid-column:1/-1}.counts div{padding:9px}.entry{align-items:flex-start;flex-direction:column}.entryActions{justify-content:flex-start}}
.actions{grid-template-columns:repeat(3,minmax(0,1fr))}
dialog.receiptDialog{width:min(720px,calc(100% - 24px))}
.receiptRow{border:1px solid var(--line);border-radius:9px;margin:0;padding:12px;min-width:0;display:grid;gap:8px}
.receiptRow legend{font-weight:700;padding:0 5px}
.receiptRow button{justify-self:start}
.receiptTools{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}
.receiptPreview{display:block;max-width:100%;max-height:220px;object-fit:contain;margin:0 auto 12px}
.receiptPreview[hidden]{display:none}
.receiptHint{padding:8px 0}
.receiptDialog textarea{font:inherit;width:100%;min-height:72px;border:1px solid #becbc1;border-radius:7px;padding:8px}
.receiptDialog details summary{cursor:pointer;font-weight:650}
@media(max-width:590px){.actions{grid-template-columns:1fr 1fr}.actions #importReceipt{grid-column:1/-1}}
#usageRows{display:grid;gap:10px}.usageRow{display:grid;gap:8px;border:1px solid var(--line);border-radius:9px;padding:10px}.usageLineFooter{display:flex;justify-content:space-between;align-items:center;gap:8px}.usageLineFooter .hint{margin:0}.usageLineFooter button{padding:5px 9px;flex-shrink:0}.usageItems{padding-left:1.2rem;margin:7px 0 0;font-size:.9rem;color:#43574c}.usageItems li+li{margin-top:10px}
.vendorField{display:grid;align-content:start;gap:5px;min-width:0}.vendorControl{display:flex;gap:5px}.vendorControl button{padding:6px 11px}.vendorChoices{display:grid;gap:4px;padding:5px;background:#f3f5ef;border:1px solid var(--line);border-radius:8px}.vendorChoices[hidden]{display:none}.vendorChoices button{text-align:left;padding:7px 9px}.vendorChoices p{margin:4px;font-size:.83rem;color:#43574c}
dialog[open]{display:flex;flex-direction:column;overflow:hidden}
.dialogHead{flex:none}
dialog #body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:3px;scroll-padding:10px}
dialog.keyboardViewport{position:fixed;top:calc(var(--visible-top) + 8px);bottom:auto;margin-block:0;max-height:calc(var(--visible-height) - 16px)}
#appPage.keyboardPage{position:fixed;inset:var(--visible-top) 0 auto;height:var(--visible-height);overflow:auto;overscroll-behavior:contain;background:#f3f5ef}
.stockIdentity{display:flex;align-items:flex-start;gap:12px;min-width:0}.productPhoto{width:54px;height:54px;object-fit:contain;background:#fff;border:1px solid var(--line);border-radius:6px;flex:none}.productPhoto[hidden]{display:none}.usageItems li:has(.productPhoto){list-style:none;display:flex;gap:8px;align-items:center}.usageItems .productPhoto{width:36px;height:36px}.productTools{border:1px solid var(--line);border-radius:8px;padding:10px}.productTools summary{cursor:pointer;font-weight:650}.productTools[open]>:not(summary){margin-top:8px}
.stockHeading,.csvActions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.stockHeading{justify-content:space-between}.csvActions button{padding:7px 10px}.csvPreview{min-width:0;overflow-wrap:anywhere}.csvPreview ul{padding-left:20px;margin:6px 0 12px}.csvPreview li{margin-bottom:4px}
#jobAddressField{display:grid;gap:6px}#jobLocate{justify-self:start}#jobAddressChoices{display:grid;gap:5px}#jobAddressChoices[hidden]{display:none}#jobAddressChoices button{text-align:left}#jobAddressStatus:empty{display:none}.addressCredit{color:#52665b}.addressCredit a{color:inherit}.materialTotal{font-weight:750}.entry p.materialTotal{margin-top:10px}
.invoiceMaterial{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(90px,1fr);align-items:center;gap:10px;border-bottom:1px solid var(--line);padding-bottom:8px}.invoiceTaxOptions{display:flex;flex-wrap:wrap;gap:12px}.invoiceTaxOptions label{display:flex;align-items:center}.invoiceTaxOptions input{width:auto}.invoiceTotals{margin:4px 0 0}.invoiceTotals>div{display:flex;justify-content:space-between;gap:8px;padding:4px 0}.invoiceTotals dd{margin:0}.invoiceGrandTotal{font-weight:750;border-top:1px solid var(--line)}#invoiceStatus:empty,#invoicePrint{display:none}
@media print{body.printingInvoice #pageFrame,body.printingInvoice dialog{display:none!important}body.printingInvoice dialog::backdrop{display:none}body.printingInvoice #invoicePrint{display:block;color:#000;background:#fff}}
.addressLocality{display:grid;grid-template-columns:minmax(0,2fr) minmax(52px,.75fr) minmax(85px,1.2fr);gap:8px}.addressLocality input[name="addressState"]{text-transform:uppercase}
.companyContactFields{display:grid;gap:9px}.invoiceSender{border:1px solid var(--line);border-radius:8px;padding:9px}.invoiceSender summary{cursor:pointer;font-weight:650}.invoiceSender[open] .companyContactFields{margin-top:9px}#companyStatus:empty{display:none}.printedSender{margin:12px 0}
@media(max-width:480px){.mast{flex-wrap:wrap;gap:3px;padding-top:8px;padding-bottom:8px}.mast nav{flex-wrap:wrap}}
.companyLogo{display:block;max-width:140px;max-height:62px;width:auto;height:auto;object-fit:contain}.companyMonogram{display:inline-flex;align-items:center;justify-content:center;min-width:42px;height:42px;padding:0 6px;border-radius:8px;background:#33576a;color:#fff;font-weight:800;letter-spacing:.07em}.companyLogoPreview:empty{display:none}.invoiceNotesInput{width:100%;min-width:0;padding:8px;border:1px solid var(--line);border-radius:7px;font:inherit}
@media print{body.printingInvoice{background:#fff}.invoiceDocument tr{break-inside:avoid}}
.invoiceDocument{color:#1c3039;background:#fff;print-color-adjust:exact;-webkit-print-color-adjust:exact;font-size:10pt;overflow-wrap:anywhere}
.invoiceDocument p{margin:6px 0}.invoiceDocument table{width:100%;border-collapse:collapse}.invoiceDocument th,.invoiceDocument td{padding:7px;border-bottom:1px solid #ccc;text-align:left}
  .invoiceDocument .invoiceMast{display:grid;gap:16px;background:#e2ebef;border-top:7px solid #33576a;padding:20px 22px}
  .invoiceHeaderDetails{display:flex;justify-content:space-between;gap:16px;align-items:baseline;flex-wrap:wrap}
  .invoiceLogoBanner{display:flex;justify-content:center;min-width:0}
  .invoiceLogoBanner .companyLogo{width:min(100%,440px);max-width:100%;max-height:120px;object-fit:contain}
  .invoiceDocument h1{font-size:31pt;letter-spacing:-.03em;margin:0}
  .invoiceBrand .printedSender{margin:0}.invoiceRecipient{text-align:right}
  .invoiceBrand .printedSender strong{display:block;font-size:12pt;margin-bottom:4px}
  .invoiceMeta{margin:0;display:flex;gap:14px}.invoiceMeta dt{font-size:8pt;font-weight:700;text-transform:uppercase}.invoiceMeta dd{margin:2px 0 0}
  .invoiceSheet{padding:18px 22px}.invoiceParties{display:flex;gap:32px;align-items:flex-start;margin-bottom:16px}.invoiceParties>div{flex:1;min-width:0;overflow-wrap:anywhere}
  .invoiceDocument h2{font-size:9pt;text-transform:uppercase;letter-spacing:.07em;margin:0 0 5px}
  .invoiceDocument table{margin:0 0 10px}.invoiceDocument thead{display:table-header-group}.invoiceDocument th{color:#fff;background:#33576a}
  .invoiceDocument th:not(:first-child),.invoiceDocument td:not(:first-child){text-align:right;white-space:nowrap}
  .invoiceDocument td{border-bottom-color:#c4d4db}.invoiceDocument tbody tr:nth-child(even){background:#f1f6f8}
  .invoiceDocument .invoiceTotals{margin:12px 0 18px auto;width:52%;break-inside:avoid}.invoiceDocument .invoiceTotals>div{padding:5px 8px}
  .invoiceDocument .invoiceGrandTotal{background:#33576a;color:#fff}
  .printedPayment{border-top:1px solid #c4d4db;padding-top:10px;break-inside:avoid}.printedPayment+.printedPayment{margin-top:12px}.printedPayment span{padding:0 4px}.invoiceNotes{white-space:pre-wrap}

dialog:has(.invoiceViewer){width:min(720px,calc(100% - 24px))}
.invoiceViewerActions,.invoiceListActions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.invoiceViewerActions{margin-bottom:10px}
.invoiceViewer .invoiceDocument{border:1px solid var(--line)}
@media screen and (max-width:480px){
  .invoiceViewer .invoiceMast{padding:12px;gap:12px}
  .invoiceViewer .invoiceHeaderDetails{gap:12px;flex-wrap:wrap}
  .invoiceViewer .invoiceDocument h1{font-size:23pt;margin-bottom:8px}
  .invoiceViewer .invoiceSheet{padding:12px}
  .invoiceViewer .invoiceParties{gap:12px}
  .invoiceViewer .invoiceDocument th,.invoiceViewer .invoiceDocument td{padding:5px 3px}
  .invoiceViewer .invoiceTotals{width:min(100%,260px)}
}
#quoteMaterials{display:grid;gap:8px}#quoteMaterials:empty{display:none}
.counts button{background:#fff;border:1px solid var(--line);border-radius:12px;text-align:left;padding:13px 16px;min-width:0}.counts button:hover{border-color:#61796a}.counts button.needsReorder{background:#fff0ef;border-color:#cf6460;color:#912b27}.counts button.needsReorder span{color:inherit}.photoPasteTarget{border:1px dashed #61796a;border-radius:7px;min-height:42px;padding:8px;font-size:16px}.photoPasteTarget:empty::before{content:'Paste copied image here';color:#496157;pointer-events:none}
@media(max-width:500px){.counts button{padding:9px}}
.lowStockControls{display:grid;gap:8px;margin-bottom:8px}
.copyNumberOverride{display:flex;align-items:center;gap:8px}.copyNumberOverride input{width:auto}
.usageItemPicker{min-width:0;border:1px solid var(--line);border-radius:8px;padding:8px}.usageItemPicker summary{cursor:pointer;font-weight:650;overflow-wrap:anywhere}.usageItemPicker label{margin-top:8px}.usageItemResults{display:grid;gap:4px;max-height:190px;overflow:auto;margin-top:8px}.usageItemResults button{text-align:left;overflow-wrap:anywhere}
.photoImportRow{border:1px solid var(--line);border-radius:8px;padding:8px;margin-bottom:8px;overflow-wrap:anywhere}
.customerHistory{display:grid;gap:12px}.customerProfile{display:grid;gap:4px}.customerProfile button,.customerJob button{justify-self:start;margin-top:8px}.customerJob{border:1px solid var(--line);border-radius:8px;padding:10px;overflow-wrap:anywhere}.customerJob summary{font-weight:650;cursor:pointer}.customerJob .materialTotal{margin-top:8px}
.customerPicker [data-clear-customer]{margin-top:8px}

.invoicePayments,#invoiceBalanceSection{background:#f3f5ef;border:1px solid var(--line);border-radius:9px;padding:12px;overflow-wrap:anywhere}
.invoicePayments{margin-bottom:12px}
.invoicePaymentHeading,.invoicePayments li,#invoiceBalances>div{display:flex;align-items:center;justify-content:space-between;gap:8px}
.invoicePaymentHeading{flex-wrap:wrap}
.invoicePayments ul{list-style:none;margin:8px 0 0;padding:0}
.invoicePayments li{border-top:1px solid var(--line);padding-top:7px;margin-top:7px}
.invoicePayments li button{padding:5px 9px}
.invoicePaymentStatus[data-status="Unpaid"]{background:#f7e6e5;color:#862e2e}
.invoicePaymentStatus[data-status="Partially paid"]{background:#faefd6;color:#684714}
.invoicePaymentStatus[data-status="Paid"]{background:#e0eedf;color:#285b29}
#invoiceBalances{margin:6px 0 0}
#invoiceBalances>div{padding:4px 0}
#invoiceBalances dd{margin:0;font-weight:750;font-variant-numeric:tabular-nums}
#invoiceList .invoiceListActions .hint{margin:0}

.stockWorkActions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.stockToolsControls{display:grid;gap:10px;margin-bottom:12px}
.stockToolsControls .entryActions{justify-content:flex-start}
.stockMovementChanges{display:grid;gap:4px;list-style:none;padding:0;margin:8px 0}
.stockMovementChanges li{display:flex;gap:8px;flex-wrap:wrap;font-size:.9rem}
.stockMovementChanges span{color:#4d6357}

.workspace-panel { margin-bottom: 1rem; padding: 1rem; }
.workspace-panel > label { max-width: 28rem; }
.workspace-panel details { margin-top: .6rem; }
.workspace-panel form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin: .6rem 0; }
.workspace-panel form[hidden] { display: none; }
.workspace-panel li { margin-block: .35rem; overflow-wrap: anywhere; }
#workspaceStatus:empty { display: none; }

#workspaceLegacy:not([hidden]) { margin-top: .8rem; padding: .85rem; border: 1px solid #789d62; border-radius: 8px; background: var(--soft); }
#workspaceLegacy p { margin: .4rem 0 .65rem; }
#workspaceLegacy button { margin-block: .2rem; }

#itemEditorActions {
  flex: none;
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
}
#itemEditorActions .error:not(:empty) { margin-bottom: 8px; }
#itemEditorActions button { width: 100%; }

.clearableSearch { position: relative; min-width: 0; }
.clearableSearch input { min-height: 46px; padding-inline-end: 46px; }
.clearableSearch input::-webkit-search-cancel-button { display: none; }
.clearSearch {
  position: absolute;
  inset-inline-end: 1px;
  bottom: 1px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
}
.clearableSearch:has(input:placeholder-shown) > .clearSearch { visibility: hidden; }

.helpGuide { display: grid; gap: .85rem; }
.helpGuide details { padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 8px; }
.helpGuide summary { font-weight: 700; cursor: pointer; }
.helpGuide ol { margin: .65rem 0 0; padding-inline-start: 1.4rem; }
.helpGuide li + li { margin-top: .45rem; }
#workspaceInviteLink { margin-bottom: .5rem; }
