:root{--navy:#0f3d7a;--navy-dark:#0a2e5f;--bg:#f4f6f9;--text:#111827;--muted:#6b7280;--border:#d8dee8;--danger:#b42318;--success:#137333;--paper:#fff;--shadow:0 18px 50px rgba(15,61,122,.12)}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,Arial,sans-serif;background:var(--bg);color:var(--text)}button,input,select{font:inherit}.hidden{display:none!important}
.auth-shell{min-height:100vh;display:grid;place-items:center;padding:24px}.auth-card{width:min(420px,100%);background:#fff;border:1px solid var(--border);border-radius:18px;padding:30px;box-shadow:var(--shadow)}.auth-logo{width:72px;height:72px;object-fit:contain}.auth-card h1{margin:14px 0 6px;color:var(--navy)}.auth-card p{margin:0 0 22px;color:var(--muted)}.auth-card form{display:grid;gap:14px}.auth-card label{display:grid;gap:6px;font-weight:700}.auth-card input{width:100%;padding:12px;border:1px solid var(--border);border-radius:10px}.error-text{min-height:18px;margin-top:8px;color:var(--danger);font-size:13px}
.app-header{position:sticky;top:0;z-index:30;background:#fff;border-bottom:1px solid var(--border);min-height:72px;padding:10px 18px;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:18px}.brand-lockup{display:flex;align-items:center;gap:10px}.brand-lockup img{width:48px;height:48px;object-fit:contain}.brand-lockup h1{margin:0;color:var(--navy);font-size:20px}.brand-lockup p{margin:2px 0 0;color:var(--muted);font-size:12px}.main-nav{display:flex;background:#eef3f8;border-radius:10px;padding:4px;gap:3px}.nav-button{border:0;background:transparent;padding:9px 14px;border-radius:8px;color:#4b5563;font-weight:700;cursor:pointer}.nav-button.active{background:#fff;color:var(--navy);box-shadow:0 1px 6px rgba(0,0,0,.08)}.user-menu{justify-self:end;display:flex;align-items:center;gap:12px;color:#374151;font-size:13px}.link-button{border:0;background:none;color:var(--navy);font-weight:700;cursor:pointer}
.workspace{display:grid;grid-template-columns:minmax(360px,440px) minmax(0,1fr);gap:20px;padding:20px;max-width:1600px;margin:0 auto}.form-panel{background:#fff;border:1px solid var(--border);border-radius:16px;padding:18px;box-shadow:0 6px 24px rgba(15,61,122,.06);height:calc(100vh - 112px);overflow:auto;position:sticky;top:92px}.form-topline{display:flex;justify-content:space-between;align-items:center;padding-bottom:14px;border-bottom:1px solid #edf0f4}.form-topline>div{display:flex;align-items:center;gap:8px}.status-pill{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;background:#eef3f8;color:var(--navy);font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.status-pill.finalized{background:#e7f4eb;color:var(--success)}
.section-title{display:flex;gap:10px;align-items:flex-start;margin:17px 0 12px}.section-title>span{width:25px;height:25px;border-radius:50%;display:grid;place-items:center;background:var(--navy);color:#fff;font-weight:800;font-size:12px;flex:0 0 auto}.section-title h2{font-size:15px;margin:1px 0 2px;color:var(--navy)}.section-title p{font-size:12px;margin:0;color:var(--muted)}.section-spaced{margin-top:22px}.field{display:grid;gap:6px;margin-bottom:12px;font-size:12.5px;font-weight:700}.field b{color:var(--danger)}.field input,.field select,.history-filters input,.history-filters select,.service-row select,.service-row input[type=number]{width:100%;padding:10px;border:1px solid var(--border);border-radius:9px;background:#fff}.field-grid{display:grid;gap:10px}.two-cols{grid-template-columns:1fr 1fr}.field input:focus,.field select:focus,.history-filters input:focus,.history-filters select:focus{outline:2px solid rgba(15,61,122,.12);border-color:var(--navy)}
.services-chooser{display:grid;gap:8px}.service-row{border:1px solid var(--border);border-radius:10px;padding:10px;background:#fbfcfe}.service-row-main{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center}.service-row-main input[type=checkbox]{width:18px;height:18px}.service-row-name{font-weight:800;font-size:13px}.service-row-desc{font-size:11.5px;color:var(--muted);margin-top:2px;line-height:1.35}.service-row-controls{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:9px 0 0 28px}.service-helper{margin:7px 0 0 28px;color:#8a5a00;font-size:11px}.notice-card{margin-top:10px;border:1px solid #b8c9de;background:#f5f9ff;color:#173a62;padding:10px;border-radius:10px;font-size:12px}.notice-card.warning{border-color:#edcf8b;background:#fff8e6;color:#775000}.checkbox-line{display:flex;gap:8px;align-items:flex-start}.checkbox-line input{margin-top:2px}
.price-block{display:grid;gap:10px}.price-line{display:grid;grid-template-columns:1fr 150px;gap:10px;align-items:center}.price-line label{font-size:12px;font-weight:700}.price-input{display:flex;align-items:center;border:1px solid var(--border);border-radius:9px;overflow:hidden;background:#fff}.price-input input{width:100%;border:0;padding:10px;outline:0}.price-input span{padding:10px;background:#f3f5f8;font-size:12px;white-space:nowrap}.auto-copy-card{margin-top:10px;padding:11px;border:1px solid var(--border);border-radius:10px;background:#fafbfc}.auto-copy-card>span{display:block;color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.05em;font-weight:800}.auto-copy-card strong{display:block;color:var(--navy);font-size:13px;margin:2px 0 9px}.auto-copy-card p{margin:2px 0 0;font-size:12px;line-height:1.35}.form-actions{display:grid;grid-template-columns:1fr auto;gap:8px;margin-top:14px}.button{min-height:42px;padding:9px 14px;border-radius:9px;border:1px solid transparent;font-weight:800;cursor:pointer}.button.primary{background:var(--navy);color:#fff}.button.primary:hover{background:var(--navy-dark)}.button.secondary{background:#fff;color:var(--navy);border-color:#b8c9de}.button.small{min-height:34px;padding:6px 10px;font-size:12px}.button:disabled{opacity:.55;cursor:not-allowed}
.preview-panel{min-width:0}.preview-toolbar{display:flex;justify-content:space-between;align-items:center;padding:0 4px 9px;font-size:12px;color:var(--muted)}.preview-toolbar>div{display:flex;align-items:center;gap:9px}.preview-toolbar strong{color:var(--navy);font-size:14px}.preview-toolbar #pageStatus{padding:3px 7px;border-radius:999px;background:#e8f0fa;color:var(--navy);font-weight:800}.preview-viewport{min-height:820px;overflow:auto;border:1px solid rgba(15,61,122,.12);border-radius:14px;background:#e7e8eb;padding:20px;display:flex;justify-content:center;align-items:flex-start}.pdf-document{display:flex;flex-direction:column;gap:12px}.quote-page{width:210mm;height:297mm;background:#fff;padding:13mm 13.5mm 9mm;box-shadow:var(--shadow);font-family:Calibri,Carlito,"Segoe UI",Arial,sans-serif;color:#111;font-size:10.2pt;line-height:1.3;display:flex;flex-direction:column;overflow:hidden}.quote-header{display:grid;grid-template-columns:minmax(0,1fr) 39mm;gap:5mm;align-items:start}.quote-title-line{display:flex;align-items:baseline;gap:3mm;white-space:nowrap;color:var(--navy);font-weight:700;line-height:1}.quote-title-line>span,.quote-title-line>strong{font-size:29pt;letter-spacing:-.25pt}.quote-meta{margin-top:3.2mm;color:var(--navy);font-size:9.5pt;line-height:1.48}.quote-logo{width:38mm;height:38mm;object-fit:contain;justify-self:end;margin-top:-3.5mm}.blue-rule{height:1.25pt;background:var(--navy);width:100%;flex:0 0 auto}.quote-header+.blue-rule{margin-top:2.6mm}.parties{display:grid;grid-template-columns:1fr 1fr;gap:17mm;padding:3.2mm 0 3.6mm;min-height:31mm}.party{display:flex;flex-direction:column;gap:.9mm;font-size:10.1pt;line-height:1.28}.party strong{font-weight:700}.client-block{padding-left:4mm}.subject-line{margin:0 0 2.5mm;color:var(--navy);font-size:12.2pt;font-weight:700;line-height:1.3}.subject-line b{font-weight:700}.services-table{width:100%;border-collapse:separate;border-spacing:0;border:1pt solid #111;table-layout:fixed;font-size:10pt;line-height:1.3}.services-table col:nth-child(1){width:27%}.services-table col:nth-child(2){width:51%}.services-table col:nth-child(3){width:22%}.services-table th,.services-table td{border:0;border-right:1pt solid #111;border-bottom:1pt solid #111;padding:3.1mm 2.5mm;vertical-align:middle}.services-table tr>*:last-child{border-right:0}.services-table tfoot tr:last-child>*{border-bottom:0}.services-table tfoot th[rowspan]{border-bottom:0}.services-table thead th,.services-table tfoot th{background:var(--navy);color:#fff;font-weight:700;text-align:center}.services-table thead th{font-size:10.4pt;padding-top:2.7mm;padding-bottom:2.7mm}.services-table tbody td:first-child{font-weight:700}.services-table tbody td:last-child{text-align:center;font-weight:700}.services-table tfoot th{font-size:10.2pt;padding-top:3.2mm;padding-bottom:3.2mm}.services-table tfoot.mixed-totals th{padding-top:2.8mm;padding-bottom:2.8mm}.mixed-price-stack{display:flex;flex-direction:column;gap:1.7mm;text-align:left}.mixed-price-stack>div{display:flex;flex-direction:column;gap:.25mm}.mixed-price-stack>div+div{padding-top:1.5mm;border-top:1pt solid rgba(255,255,255,.78)}.mixed-price-stack span{font-size:7.8pt;font-weight:600;line-height:1.05;opacity:.92}.mixed-price-stack strong{font-size:10.2pt;line-height:1.15;white-space:nowrap}.scope-section,.conditions-section{margin-top:3mm}.scope-section h2,.conditions-section h2{margin:0 0 1.2mm;color:var(--navy);font-size:12.2pt;line-height:1.2}.scope-section ul,.conditions-section ul{margin:0;padding-left:5.6mm}.scope-section li,.conditions-section li{font-size:9.9pt;margin:0 0 .55mm;line-height:1.32}.quote-footer{margin-top:auto;padding-top:2mm}.footer-content{display:flex;justify-content:space-between;align-items:flex-start;padding:2.3mm 10mm 0 11mm;color:#444}.footer-content>div{display:flex;flex-direction:column;gap:.8mm;font-size:9pt;line-height:1.2}.footer-content img{width:22mm;height:20mm;object-fit:contain;opacity:.62}.quote-page.compact{padding-top:11.5mm;padding-bottom:7.5mm}.quote-page.compact .quote-title-line>span,.quote-page.compact .quote-title-line>strong{font-size:27pt}.quote-page.compact .quote-logo{width:35mm;height:35mm}.quote-page.compact .parties{padding:2.5mm 0 2.8mm;min-height:27mm}.quote-page.compact .party{font-size:9.5pt}.quote-page.compact .subject-line{font-size:11.4pt;margin-bottom:2mm}.quote-page.compact .services-table{font-size:9.2pt}.quote-page.compact .services-table th,.quote-page.compact .services-table td{padding:2.3mm 2.2mm}.quote-page.compact .scope-section,.quote-page.compact .conditions-section{margin-top:2.2mm}.quote-page.compact .scope-section h2,.quote-page.compact .conditions-section h2{font-size:11.3pt}.quote-page.compact .scope-section li,.quote-page.compact .conditions-section li{font-size:8.8pt;margin-bottom:.35mm}.quote-page.second-page .parties,.quote-page.second-page .subject-line,.quote-page.second-page .services-table{display:none}.quote-page.second-page .page2-heading{display:block}.page2-heading{display:none;color:var(--navy);font-size:15pt;margin:4mm 0 3mm}.pdf-export-pages{position:fixed;left:-10000px;top:0;width:210mm;background:#fff}.pdf-export-pages .quote-page{box-shadow:none;margin:0}.pdf-export-pages .quote-page+ .quote-page{page-break-before:always}
.history-view{max-width:1300px;margin:0 auto;padding:24px}.history-card{background:#fff;border:1px solid var(--border);border-radius:16px;padding:18px}.history-header{display:flex;justify-content:space-between;align-items:flex-start}.history-header h2{margin:0;color:var(--navy)}.history-header p{margin:4px 0 0;color:var(--muted);font-size:12px}.history-filters{display:grid;grid-template-columns:1fr 180px;gap:10px;margin:16px 0}.history-table-wrap{overflow:auto}.history-table{width:100%;border-collapse:collapse;font-size:12px}.history-table th,.history-table td{padding:10px;border-bottom:1px solid #edf0f4;text-align:left;white-space:nowrap}.history-table th{color:#657084;font-size:10px;text-transform:uppercase;letter-spacing:.05em}.history-table td.client-cell{white-space:normal;min-width:180px}.row-actions{display:flex;gap:6px}.mini-button{border:1px solid #c7d2e0;background:#fff;color:var(--navy);padding:5px 8px;border-radius:7px;font-size:11px;font-weight:800;cursor:pointer}.mini-button.primary{background:var(--navy);color:#fff;border-color:var(--navy)}
.busy-overlay{position:fixed;inset:0;z-index:100;background:rgba(5,18,34,.55);display:grid;place-items:center;backdrop-filter:blur(3px)}.busy-card{min-width:240px;background:#fff;padding:24px;border-radius:14px;text-align:center}.busy-card strong,.busy-card span{display:block}.busy-card strong{color:var(--navy);margin-top:10px}.busy-card span{color:var(--muted);font-size:12px;margin-top:4px}.spinner{width:34px;height:34px;margin:auto;border:3px solid #dce5f0;border-top-color:var(--navy);border-radius:50%;animation:spin .7s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.toast{position:fixed;right:18px;bottom:18px;z-index:110;background:#111827;color:#fff;padding:10px 14px;border-radius:9px;opacity:0;transform:translateY(8px);pointer-events:none;transition:.2s}.toast.show{opacity:1;transform:translateY(0)}
body.exporting .quote-page{box-shadow:none}body.exporting .quote-page{height:296mm}.pdf-document.exporting{gap:0}.pdf-document.exporting .quote-page{page-break-after:auto}
@media(max-width:1000px){.app-header{grid-template-columns:1fr auto}.main-nav{order:3;grid-column:1/-1;justify-self:center}.user-menu{grid-column:2}.workspace{display:block;padding:12px}.form-panel{position:static;height:auto;margin-bottom:14px}.preview-viewport{min-height:440px}.history-view{padding:12px}}
@media(max-width:600px){.app-header{padding:9px 12px}.brand-lockup h1{font-size:17px}.brand-lockup img{width:40px;height:40px}.user-menu span{display:none}.two-cols,.history-filters,.price-line{grid-template-columns:1fr}.service-row-controls{grid-template-columns:1fr;margin-left:0}.form-actions{grid-template-columns:1fr}.preview-viewport{padding:8px}.history-table th:nth-child(4),.history-table td:nth-child(4){display:none}}

.auth-link{appearance:none;border:0;background:transparent;color:#0f3d7a;font:inherit;font-weight:700;cursor:pointer;padding:10px 0 0;text-align:left}.auth-link:hover{text-decoration:underline}.auth-card form .auth-link{width:auto}
