html {
  font-size: 14px;
}

:root { color-scheme: light; --ink: #1c2927; --muted: #64736e; --border: #dce4df; --accent: #245c4b; --paper: #fff; --background: #f3f6f3; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.app-header { height: 72px; background: var(--paper); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 0 3%; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 750; line-height: 1.15; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.editor :is(input, textarea, select):required:invalid { border-color: #d9822b; border-left: 4px solid #d9822b; background: #fff8ef; }
.editor :is(input, textarea, select):required:invalid:focus { outline: 2px solid #d9822b; outline-offset: 1px; }
.required-note { display: inline-block; padding: 2px 8px; border-left: 4px solid #d9822b; background: #fff8ef; color: #34443e; font-size: 12px; }
.business-details { margin-top: 16px; border-top: 1px solid var(--line, #dcdfdc); padding-top: 12px; }
.business-details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; color: var(--accent); }
.business-details .field-grid { margin-top: 10px; }
.brand-mark { display: block; flex: none; width: 44px; height: 44px; }
.brand-mark img { display: block; width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
.header-label, .eyebrow { color: #60766c; font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.workspace { max-width: 1600px; margin: auto; padding: 38px 3% 70px; }
.page-heading, .section-heading, .preview-heading, .item-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.page-heading { align-items: end; }
h1, h2, p { margin: 0; }
h1 { margin: 5px 0; font-size: 29px; letter-spacing: -.035em; }
h2 { font-size: 17px; letter-spacing: -.02em; }
.muted, .section-help, .preview-caption, .section-note { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { min-height: 42px; border: 1px solid var(--border); border-radius: 5px; padding: 9px 15px; font-weight: 650; background: white; color: var(--ink); }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary span { margin-left: 9px; }
.button:hover { filter: brightness(.96); }
:focus-visible { outline: 3px solid #d09134; outline-offset: 2px; }
.save-status { min-height: 25px; padding-top: 10px; color: var(--muted); font-size: 12px; }
.save-status.error, .error { color: #a3312c; }
.share-pdf { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.share-pdf-label { position: relative; display: inline-flex; align-items: center; overflow: hidden; cursor: pointer; font-size: 14px; }
.share-pdf-label:focus-within { outline: 3px solid #d09134; outline-offset: 2px; }
.share-pdf-label input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; margin-top: 16px; }
.editor { display: grid; gap: 16px; }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: 7px; padding: 22px; }
.section-heading { margin-bottom: 20px; }
.section-heading h2, .preview-heading h2 { margin-top: 4px; }
.section-note { font-size: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: block; color: #34443e; font-size: 12px; font-weight: 650; }
label.wide { grid-column: 1 / -1; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; border: 1px solid #cbd7d0; border-radius: 4px; padding: 9px 10px; color: var(--ink); background: white; font-size: 14px; font-weight: 400; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #8b9992; }
.section-help { font-size: 12px; margin: -8px 0 16px; }
.panel > label + .section-help { margin: 10px 0 0; }
.item-number { font-weight: 700; font-size: 12px; }
.item-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "num amount" "title title" "detail edit"; gap: 4px 12px; width: 100%; margin-bottom: 10px; padding: 14px; text-align: left; color: var(--ink); background: white; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; min-height: 44px; }
.item-card:hover, .item-card:focus-visible { border-color: var(--accent); }
.item-card.needs-attention { border-color: #d9822b; border-left: 4px solid #d9822b; background: #fff8ef; }
.item-card .item-number { grid-area: num; color: var(--muted); letter-spacing: .08em; }
.item-card-title { grid-area: title; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.item-card-amount { grid-area: amount; font-weight: 700; justify-self: end; }
.item-card-detail { grid-area: detail; color: var(--muted); font-size: 12px; align-self: center; }
.item-card-edit { grid-area: edit; justify-self: end; color: var(--accent); font-weight: 700; font-size: 13px; }
.item-dialog { width: min(720px, 94vw); max-height: 92vh; padding: 0; border: 0; border-radius: 8px; background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.item-dialog[open] { display: flex; flex-direction: column; }
.item-dialog::backdrop { background: rgba(20, 30, 27, .55); }
.item-dialog-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex: none; }
.item-dialog-body { display: grid; gap: 14px; padding: 16px; overflow-y: auto; flex: 1 1 auto; align-content: start; }
.item-dialog textarea { min-height: 38vh; }
.item-dialog :is(input, textarea):required:invalid { border-color: #d9822b; border-left: 4px solid #d9822b; background: #fff8ef; }
.remove-item { background: none; border: 0; color: #8d4038; font-size: 12px; font-weight: 650; padding: 3px; }
.document-title { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.add-button { width: 100%; border-style: dashed; color: var(--accent); }
.editor-total { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 15px; display: flex; justify-content: space-between; font-weight: 650; }
.editor-total strong { font-size: 20px; }
.preview-heading { margin: 0 0 14px; }
.preview-badge { background: #e4eee8; color: #315d49; font-weight: 700; font-size: 10px; letter-spacing: .07em; padding: 5px 8px; border-radius: 3px; }
.document { background: white; border: 1px solid var(--border); box-shadow: 0 3px 14px #263e3010; padding: 42px; min-height: 700px; font: 12px/1.55 Arial, sans-serif; color: #252a28; overflow-wrap: anywhere; }
.document h2 { font-size: 23px; }
.document p { margin: 0; }
.document-logo { display: block; width: 112px; max-width: 100%; height: auto; margin-bottom: 16px; }
.document-header, .document-meta { display: flex; justify-content: space-between; gap: 20px; }
.document-header { padding-bottom: 48px; }
.document-meta { padding-bottom: 34px; }
.document-reference { text-align: right; }
.document-reference .document-label:not(:first-child) { margin-top: 12px; }
.document-label { display: block; font-size: 10px; font-weight: bold; color: #747d79; }
.document-meta strong { display: block; }
.preline { white-space: pre-line; }
.document-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.document-table th { border-bottom: 1px solid #bfc9c3; text-align: right; color: #737d78; font-size: 9px; padding: 8px 3px; }
.document-table th:first-child { width: 57%; text-align: left; }
.document-table td { vertical-align: top; padding: 14px 3px; text-align: right; }
.document-table td:first-child { text-align: left; padding-right: 12px; }
.document-table td strong { display: block; }
.document-total { display: flex; justify-content: space-between; border-top: 1px solid #bfc9c3; padding: 14px 3px; font-weight: bold; }
.document-terms { margin-top: 22px; }
.preview-caption { font-size: 12px; margin-top: 12px; }
.header-actions, .customer-actions, .search-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.header-actions a, .header-link, .customer-actions a, .search-actions a { color: var(--accent); font-weight: 650; }
.header-link { border: 0; background: none; padding: 0; }
.auth-page { max-width: 460px; margin: 70px auto; padding: 0 16px; }
.auth-form { display: grid; gap: 16px; margin-top: 24px; }
.customer-actions { margin-top: 18px; }
.customer-help { margin: 10px 0 0; }
#customer-status { margin-top: 8px; font-size: 12px; }
.customer-page { max-width: 1100px; }
.customer-search, .customer-results { margin-top: 24px; }
.search-fields { grid-template-columns: 2fr 1fr 1fr; }
.search-actions { margin-top: 16px; }
.customer-result { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.customer-result small { color: var(--muted); }
.estimates-page { max-width: 1400px; }
.estimates-panel { margin-top: 28px; }
.estimate-table-wrap { overflow-x: auto; }
.estimate-table { width: 100%; min-width: 850px; border-collapse: collapse; text-align: left; }
.estimate-table th { position: relative; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.estimate-table th, .estimate-table td { border-bottom: 1px solid var(--border); padding: 14px 12px; vertical-align: middle; }
.estimate-table td { overflow-wrap: anywhere; }
.estimate-table td:nth-child(4) { max-width: 260px; }
.status-form { position: relative; display: flex; align-items: center; gap: 8px; }
.status-form select { min-width: 110px; margin: 0; }
.status-form .button { min-height: 38px; padding: 7px 10px; }
.status-form .icon-button { display: inline-grid; place-items: center; flex: none; width: 40px; min-width: 40px; height: 40px; padding: 0; color: var(--accent); }
.client-quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.client-quick-actions .button { text-decoration: none; display: inline-flex; align-items: center; }
.client-quick-actions [hidden] { display: none; }
.estimate-open, .estimate-note a { color: var(--accent); font-weight: 700; }
.estimate-row-actions a { display: block; padding: 6px 0; }
.customer-quick-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.customer-quick-actions a { color: var(--accent); font-weight: 650; padding: 8px 0; }
.estimate-message, .estimate-note { margin-top: 18px; }
.install-help { margin-top: 18px; color: var(--muted); }
.install-help summary { color: var(--accent); cursor: pointer; font-weight: 650; padding: 8px 0; }
.install-help p { max-width: 55rem; margin-top: 8px; }
#photo-status { margin-top: 10px; font-size: 12px; }
.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 12px; }
.photo-item img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--background); }
.photo-item .button { width: 100%; margin-top: 6px; }
.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; }
@media (max-width: 600px) { .item-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; margin: 0; } .item-dialog textarea { min-height: 45dvh; } .item-dialog-bar { position: sticky; top: 0; background: var(--paper); } }
@media (max-width: 600px) { .search-fields { grid-template-columns: 1fr; } .header-actions { gap: 10px; font-size: 12px; } .customer-result { align-items: start; flex-direction: column; } .button, .remove-item { min-height: 44px; } input, select, textarea { font-size: 16px; } .estimate-table { min-width: 0; } .estimate-table thead { display: none; } .estimate-table, .estimate-table tbody, .estimate-table tr, .estimate-table td { display: block; } .estimate-table tr { padding: 12px 0; border-top: 1px solid var(--border); } .estimate-table td { border: 0; padding: 4px 0; } .estimate-table td:nth-child(4) { max-width: none; } .estimate-table td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); font-weight: 650; } .estimate-row-actions { display: flex !important; gap: 20px; } }
@media (max-width: 900px) { .workspace-grid { grid-template-columns: 1fr; } .preview-column { max-width: 760px; width: 100%; margin: auto; } }
@media (max-width: 600px) { .app-header { padding: 12px 16px; height: auto; flex-wrap: wrap; gap: 12px; } .header-label { display: none; } .workspace { padding: 25px 16px 50px; } .page-heading { align-items: start; flex-direction: column; } .actions { width: 100%; } .actions .button { flex: 1; } .field-grid { grid-template-columns: 1fr; } label.wide { grid-column: auto; } .panel { padding: 17px; } .document { padding: 22px 16px; font-size: 11px; } .document-table th:first-child { width: 46%; } }
@media print { @page { margin: 16mm; } body { background: white; } .app-header, .page-heading, .save-status, .share-pdf, .editor, .preview-heading, .preview-caption { display: none !important; } .workspace { padding: 0; max-width: none; } .workspace-grid { display: block; margin: 0; } .preview-column { max-width: none; } .document { border: 0; box-shadow: none; padding: 0; min-height: 0; font-size: 11pt; } .document-table tr { break-inside: avoid; } .document-header { padding-bottom: 30px; } }
.month-nav{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0 16px}
.month-picker{display:flex;gap:8px;align-items:center}
.summary-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
.summary-card{border:1px solid #d9e0d6;border-radius:10px;padding:12px 14px;background:#fff;display:flex;flex-direction:column;gap:2px}
.summary-card span{font-size:.85rem;color:#4b5a4f}
.summary-card strong{font-size:1.4rem}
.summary-card small{color:#6b7a6f}
.summary-card.highlight{background:#eef7ee;border-color:#2f7d3a}
.job-form{margin-top:16px}
.job-form .wide{grid-column:1/-1}
@media (max-width:600px){.summary-grid{grid-template-columns:1fr 1fr}.month-nav .button{flex:1 1 30%}}

.tax-editor{display:flex;gap:12px;align-items:flex-end;margin-top:12px}
.tax-editor label{flex:1}
.document-subtotal{display:flex;justify-content:space-between;padding:6px 3px;font-weight:600}
.document-subtotal[hidden],.editor-total[hidden],.add-button[hidden],.tax-editor[hidden]{display:none}
.editor-subtotal,.editor-tax{margin-top:0;border-top:0;padding-top:8px}

.send-links{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
