:root{--surface:#fff;--surface-alt:#fafbfc;--canvas:#fff;--text:#303b48;--muted:#6d7b8c;--line:#d9e0e7;--field:#fff;--hover:#f3f6fa;--accent:#2585df;--accent-soft:#eaf3ff;--green:#239658;--red-bg:#fcecee;--red-text:#aa4652;--shadow:0 20px 65px #23374726;color-scheme:light}
:root[data-theme=dark]{--surface:#2d3944;--surface-alt:#26323d;--canvas:#202832;--text:#edf2f7;--muted:#afbfce;--line:#536473;--field:#202c36;--hover:#384b5c;--accent:#4e9cef;--accent-soft:#294563;--green:#239658;--red-bg:#633b45;--red-text:#ffe0e6;--shadow:0 20px 65px #0005;color-scheme:dark}
html,body{background:var(--canvas);color:var(--text)}h1,h2,h3,h4{color:var(--text)}
.sidebar,.topbar,.storage-banner,.auth-screen,.auth-box,.editor,.editor>header,.editor>footer,.panel,.settings-nav,.settings-card,.lead-card,.status-hide,.status-hide>div,.field-setting,.print-menu>div{background:var(--surface);color:var(--text);border-color:var(--line)}
.sidebar{border-right:1px solid var(--line)}.brand{border-color:var(--line)}.brand-name,.brand-name small,.nav-link,.service-city{color:var(--text)}.brand-logo{background:var(--accent-soft);color:var(--accent)}.workspace-label,.eyebrow,.location,.service-city,.company-grid small,.settings-card>small,.subscription-counts span,.page-heading p,.muted,td small,.stock-metadata,.empty,.history-event time,.history-event small,.lead-card span,.lead-card small{color:var(--muted)}
.nav-link:hover,.nav-link.active{background:var(--accent-soft);color:var(--accent)}.nav-link.active{border-left-color:var(--accent)}.nav-link[data-page=metrics],.nav-link[data-page=settings],.sidebar-footer,.settings-backup{border-color:var(--line)}.nav-icon,[data-page=salary] .nav-icon{color:var(--muted)}.nav-link.active .nav-icon{color:var(--accent)}
input,select,textarea{background:var(--field);color:var(--text);border-color:var(--line)}input::placeholder,textarea::placeholder{color:var(--muted)}input:focus,select:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:1px}
.button,.button.subtle,.work-search-results .button,.expand-menu{background:var(--surface-alt);border-color:var(--line);color:var(--text)}.button:hover{background:var(--hover);border-color:var(--accent)}.button.primary{background:#2585df;color:#fff;border-color:#2585df}.button.primary:hover{background:#1672c8}.button.payment-accept{background:var(--green);border-color:var(--green);color:#fff}.button.payment-refund{background:var(--red-bg);color:var(--red-text);border-color:#bf768066}.button.payment-refund:hover{filter:brightness(.96)}.button:disabled{cursor:not-allowed}
.stat,.stat.blue,.stat.red,.stat.amber,.stat.green,.stat.gray{background:var(--surface);color:var(--text);border-color:var(--line);border-top:3px solid #8a99a9}.stat.blue{border-top-color:#2585df}.stat.green{border-top-color:#239658}.stat.red{border-top-color:#d7636a}.stat.amber{border-top-color:#d7a649}.stat span{color:var(--muted)}.stat.active{background:var(--accent-soft)}
th{background:var(--surface-alt);color:var(--muted);border-color:var(--line)}td{color:var(--text)}tbody tr:hover{background:var(--hover)}
td,.panel-footer,.tabs,.editor fieldset,#tab-info details,.settings-backup{border-color:var(--line)}.panel-footer{background:var(--surface-alt);color:var(--muted)}.order-row:hover{background:var(--hover)}.order-link,#tab-info summary{color:var(--accent)}.tabs button{color:var(--muted)}.tabs button.active{color:var(--text);border-bottom-color:var(--accent)}.settings-nav>button{color:var(--muted)}.settings-nav>button.active,.settings-badge{background:var(--accent-soft);color:var(--accent)}
.notice{background:var(--surface-alt);border-color:var(--line);color:var(--text)}.form-error{background:var(--red-bg);color:var(--red-text)}.empty strong{color:var(--text)}.funnel-column{background:var(--surface-alt)}.funnel-column h3 span{background:var(--hover);color:var(--text)}.bar-progress::-webkit-progress-bar{background:var(--hover)}.print-menu .button{background:var(--surface);color:var(--text)}.print-menu .button:hover{background:var(--hover)}.payment-summary>div{background:var(--surface-alt);border-color:var(--line)}.payment-summary small{color:var(--muted)}
/* Order workspace follows the reference: centered tabs/status, left work area, right history. */
#editor.order-editor{width:min(1400px,96vw);max-width:1400px;border:1px solid var(--line);border-radius:5px;background:var(--surface);color:var(--text);box-shadow:var(--shadow)}
#editor.order-editor>header{padding:20px 28px 14px;border-bottom:0;display:flex;gap:15px;background:var(--surface)}.order-header>[data-close]{order:-1;border:0;background:transparent;font-size:30px}.order-header>div:first-child{margin-right:auto}.order-header #editor-caption{display:none}.order-header #editor-title{font-size:30px;font-weight:500;margin:0}.order-header-action{margin-left:auto}.order-header-action .button{padding:12px 18px}
.order-editor .order-layout{grid-template-columns:minmax(0,1fr) 265px;min-height:68vh}.order-editor .order-main{background:var(--surface);padding:16px 28px 32px;min-width:0}.order-context{display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:12px;color:var(--muted);padding:0 0 14px}.order-context strong{font-weight:500}.order-context small{font-size:11px}
.order-editor .order-card-tabs{display:grid;grid-template-columns:1.25fr 1.25fr .8fr;border:1px solid var(--line);background:var(--surface-alt);border-radius:5px;gap:0;width:min(750px,100%);margin:0 auto 10px;overflow:hidden}.order-editor .order-card-tabs button{padding:13px 10px;font-size:14px;margin:0;border:0;border-right:1px solid var(--line);color:var(--muted)}.order-editor .order-card-tabs .icon{width:17px;height:17px;vertical-align:middle;margin-right:5px}.order-editor .order-card-tabs button:last-child{border:0}.order-editor .order-card-tabs button.active{background:var(--accent-soft);color:var(--accent);box-shadow:inset 0 -2px var(--accent)}.order-editor .card-status{justify-content:center;margin:0 0 28px}.order-editor .card-status label{font-size:0;gap:0}.order-editor #card-status{min-width:120px;padding:6px 12px;font-size:13px;color:var(--accent);background:var(--accent-soft);border:1px solid var(--accent);border-radius:5px;text-align:center}.order-urgent{background:var(--red-bg);color:var(--red-text);padding:5px 10px;border-radius:5px;font-size:12px}
.order-block{margin:0 0 24px;padding:0;background:var(--surface);border:0;border-radius:0}.order-editor .order-block h3{font-size:13px;font-weight:500;margin:0 0 12px;color:var(--muted)}.order-editor .works-controls{display:grid;grid-template-columns:minmax(240px,1.4fr) 60px minmax(200px,1fr);gap:12px 18px;align-items:end}.order-editor .works-controls>label:first-child{grid-column:1;grid-row:1}.order-editor .works-controls>label:nth-child(2){grid-column:1;grid-row:2}.order-editor .works-controls>label{font-size:0;gap:0}.order-editor .works-controls input,.order-editor .works-controls select{font-size:14px;height:42px}.work-or{grid-column:2;grid-row:2;align-self:center;text-align:center;color:var(--muted)}.order-editor .works-controls>.button{grid-column:3;grid-row:2;min-height:42px;font-size:14px}.order-editor #card-master{width:100%}.work-search-results{margin:12px 0 0}.work-search-results:empty{display:none}#part-choices{border:1px solid var(--line);padding:18px;background:var(--surface-alt);margin-top:14px;border-radius:4px}
.order-editor .line-table{min-width:650px;background:var(--surface)}.order-editor .line-table th{padding:12px 10px;font-size:13px;background:var(--surface);border-bottom:1px solid var(--line)}.order-editor .line-table td{padding:12px 10px;border-color:var(--line)}.line-table [data-warranty]{width:100px}.line-name select{display:block;margin-top:6px;font-size:11px;padding:4px}.lines-empty td{height:100px;color:var(--muted);text-align:center}.lines-empty span{display:block;font-size:14px}.work-totals,.work-profit{display:flex;justify-content:flex-end;gap:18px;align-items:baseline;padding:12px 4px 0;color:var(--muted);font-size:14px}.work-totals strong,.work-profit strong{min-width:110px;text-align:right;color:var(--text);font-size:17px}.work-profit{padding-top:8px}.work-profit strong{font-size:14px;font-weight:500}.order-editor #master-note{width:100%;min-height:105px}.order-editor #note-count{float:right;font-size:11px;color:var(--muted)}.order-editor .order-history{padding:22px 20px;border-color:var(--line);background:var(--surface-alt);border-top:0}.order-editor .order-history h3{font-size:27px;font-weight:400;color:var(--text);margin:0 0 24px}.history-event{border-color:var(--line)}.history-event strong{color:var(--accent);display:inline-block;padding:5px 8px;border:1px solid var(--accent);background:var(--accent-soft);border-radius:4px}.order-editor>footer{padding:16px 28px;gap:16px;background:var(--surface);border-color:var(--line);flex-wrap:wrap}.order-window-buttons{display:flex;gap:8px}.order-editor>footer .total{margin:0 auto 0 0;text-align:left}.order-editor>footer .total strong{font-size:20px}.order-footer-actions{margin-left:auto}.order-footer-actions .print-menu{order:5}.order-footer-actions [data-action=order.issue]{background:var(--green);border-color:var(--green);color:#fff}.order-editor .document-fields{padding:18px;border:1px solid var(--line);border-radius:5px;background:var(--surface-alt)}.document-fields p{padding:4px 0;line-height:1.4}.document-fields small{color:var(--muted)}.order-editor .payment-summary{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.order-editor .payment-summary strong{font-size:22px;color:var(--text)}.order-editor .payment-summary .credit{color:var(--green)}.payment-choice{display:flex;gap:14px;margin:22px 0;flex-wrap:wrap}.payment-choice>.button{padding:12px 24px;font-size:16px}.payment-choice>.selected{outline:2px solid var(--accent);outline-offset:3px}#payment-entry{background:var(--surface-alt);border:1px solid var(--line);border-radius:5px;padding:22px;margin:20px 0}.payment-direction{color:var(--muted);font-size:13px}.order-editor .payment-history-block{margin-top:28px}
/* Appearance and document editor */
.theme-options{display:flex;gap:18px;flex-wrap:wrap;margin:0 0 24px}.theme-option{position:relative;border:2px solid var(--line);border-radius:8px;max-width:260px;flex:1;min-width:180px;padding:15px;cursor:pointer;gap:8px}.theme-option.selected{border-color:var(--accent)}.theme-option input{position:absolute;top:15px;right:15px}.theme-option small{color:var(--muted);font-weight:400}.theme-sample{height:85px;width:140px;background:#fff;border:1px solid #dce2e8;padding:12px 12px 12px 40px;position:relative;border-radius:4px;display:grid;gap:8px}.theme-sample:before{content:'';position:absolute;inset:0 auto 0 0;width:28px;background:#f1f4f8;border-right:1px solid #dce2e8}.theme-sample i{display:block;background:#dce7f3;border-radius:3px}.theme-sample.dark{background:#303e49;border-color:#586b7b}.theme-sample.dark:before{background:#202c36;border-color:#586b7b}.theme-sample.dark i{background:#4b6378}
#editor.print-editor{width:min(1150px,96vw);max-width:1150px}.print-edit-toolbar{display:flex;gap:6px;flex-wrap:wrap;position:sticky;top:95px;z-index:1;background:var(--surface);padding:10px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.print-edit-toolbar .button{min-width:36px;font-size:14px}.print-editor-intro p{margin:0;color:var(--muted);line-height:1.5}.document-edit-wrap{background:var(--surface-alt);border:1px solid var(--line);padding:24px;overflow:auto;max-height:65vh}#document-editor{background:#fff;color:#243244;padding:18mm;min-height:297mm;width:210mm;margin:0 auto;box-shadow:0 2px 12px #0001;font:14px Arial;line-height:1.5;outline-color:var(--accent)}#document-editor h1,#document-editor h2,#document-editor h3{color:#243244;font-weight:600}#document-editor table{min-width:0;border-collapse:collapse;width:100%;margin:12px 0}#document-editor th,#document-editor td{border:1px solid #ccd5df;padding:8px;color:#243244;background:white;white-space:normal}#document-editor p{margin:10px 0}#document-editor:focus{outline:2px solid var(--accent)}.label-editor #document-editor{width:58mm;min-height:40mm;padding:2mm;font-size:10px}.label-editor #document-editor h1{font-size:24px}.print-edit-actions{display:flex;gap:10px;flex-wrap:wrap}.print-extra label{margin:15px 0}.print-extra summary{cursor:pointer;color:var(--muted)}#print-settings-preview{background:#e9edf2;color:#243244;border:1px solid #d1d9e3;max-height:650px;padding:20px}#print-settings-preview>h3{color:#56677a}#print-settings-preview .receipt-sheet{background:white;box-sizing:border-box;width:210mm;min-height:297mm;margin:auto;padding:18mm;color:#243244}#print-settings-preview .label-sheet{background:white;width:58mm;height:40mm;overflow:hidden;margin:auto;padding:2mm;color:#243244;font-size:9px}#print-settings-preview h1,#print-settings-preview h2,#print-settings-preview h3{color:#243244}#print-settings-preview table{min-width:0;color:#243244}#print-settings-preview th,#print-settings-preview td{color:#243244;background:white;white-space:normal}.custom-sheet{line-height:1.5}.custom-sheet table{min-width:0}.custom-label p{margin:1mm 0}.custom-label h1{font-size:20pt;margin:1mm 0}.custom-label h2{font-size:11pt;margin:1mm 0}
@media(max-width:1100px){.order-editor .payment-summary{grid-template-columns:repeat(2,1fr)}.order-editor .works-controls{grid-template-columns:minmax(200px,1fr) 30px minmax(160px,1fr)}.order-footer-actions{max-width:65%}}
@media(max-width:850px){.order-editor .order-layout{grid-template-columns:1fr}.order-editor .order-history{border-top:1px solid var(--line);border-left:0}.order-header-action .button{font-size:11px;padding:8px}.order-editor .order-main{padding:16px 20px}.order-editor .order-card-tabs button{font-size:12px}.document-edit-wrap{padding:10px}.order-footer-actions{max-width:none}}
@media(max-width:560px){#editor.order-editor>header{padding:16px 12px}.order-header #editor-title{font-size:23px}.order-header-action{display:none}.order-editor .order-main{padding:12px}.order-editor .works-controls{grid-template-columns:1fr;gap:12px}.order-editor .works-controls>label:first-child{grid-row:1;grid-column:1}.order-editor .works-controls>label:nth-child(2){grid-row:2;grid-column:1}.order-editor .work-or{display:none}.order-editor .works-controls>.button{grid-row:3;grid-column:1}.order-editor .order-card-tabs button{padding:10px 5px;font-size:11px}.order-editor .payment-summary strong{font-size:18px}.order-editor>footer{padding:12px;display:flex;flex-direction:row;align-items:center}.order-footer-actions{width:100%}.print-edit-toolbar{top:110px}.theme-option{min-width:140px}.theme-sample{width:110px}.payment-choice>.button{flex:1;padding:12px}}
@media print{html,body,#print-area{background:#fff!important;color:#000!important;color-scheme:light!important}#print-area h1,#print-area h2,#print-area h3,#print-area th,#print-area td,#print-area .muted{color:#000!important}#print-area table{min-width:0}#print-area th{background:#fff!important}#print-area .receipt-sheet{width:auto;min-height:0;box-shadow:none}#print-area .custom-label{width:58mm;height:40mm;overflow:hidden}.custom-sheet table{break-inside:auto}.custom-sheet tr{break-inside:avoid}}
