/* Shared screen foundations. No external fonts, scripts, or changes to printed documents. */
@media screen {
 :root{--ui-sidebar:232px;--ui-gutter:24px;--ui-text:#342f3e;--ui-muted:#706879;--ui-border:#e3dfe8;--ui-surface:#fff;--ui-accent:#714b67;--line:var(--ui-border);font-family:"Segoe UI",system-ui,-apple-system,BlinkMacSystemFont,sans-serif}
 body{font-size:14px;line-height:1.45;color:var(--ui-text);background:#f6f5f8}
 button,input,select,textarea{font-family:inherit}button{touch-action:manipulation}
 .layout{grid-template-columns:var(--ui-sidebar) minmax(0,1fr)}
 .layout>.sidebar{width:var(--ui-sidebar);height:100dvh;padding:24px 12px 16px;z-index:30;background:linear-gradient(180deg,#382d3e,#2d2834);border-right:1px solid #ffffff0c}
 .sidebar .brand{padding:0 12px 24px;gap:12px;min-height:74px;align-items:center}
 .sidebar .brand img{width:38px;height:38px;flex:0 0 38px}.sidebar .brand strong{font-size:25px;line-height:1.2;letter-spacing:-.5px}.sidebar .brand small{font-size:10px;letter-spacing:2px;margin-top:4px}
 .sidebar .nav{display:grid;grid-auto-rows:max-content;align-content:start;gap:4px;overflow-x:hidden;overflow-y:auto;flex:1;min-height:0;scrollbar-width:thin;scrollbar-color:#81758d transparent}
 .sidebar .nav button{display:flex;flex-direction:row;align-items:center;gap:12px;min-height:42px;padding:10px 12px;font-size:13px;line-height:20px;font-weight:500;border-radius:8px;letter-spacing:0;text-align:left;white-space:normal;flex-shrink:0}
 .sidebar .nav svg{width:20px;height:20px;flex:0 0 20px;align-self:center;stroke-width:1.6}
 .sidebar .nav button.active{background:#ffffff12;box-shadow:inset 3px 0 #8bd5c6;color:#fff}
 .sidebar .nav button:hover{background:#ffffff0c}.sidebar .nav button:focus-visible{outline:2px solid #a6e4d8;outline-offset:-2px}
 .sidebar .sidebar-foot{flex:none;margin-top:16px;padding:14px 12px 0;font-size:12px;line-height:18px}.sidebar-foot span{font-size:11px;margin-top:4px}
 .main{min-width:0}.workspace-header{box-shadow:0 2px 6px #30223804}
 /* Shared geometry takes precedence over legacy editor-only shell rules. */
 .main .workspace-header .topbar,body:has(.document-editor) .main .topbar{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;height:auto;min-height:80px;padding:10px var(--ui-gutter);border-bottom:1px solid var(--ui-border)}
 .workspace-header .company-name{font-size:15px;line-height:21px;letter-spacing:-.15px;min-width:0;font-weight:650}.workspace-header .company-name small{font-size:11px;line-height:16px;margin-top:2px;color:var(--ui-muted)}
 .workspace-header .overview-clock{font-size:10px;line-height:14px;margin-top:2px;letter-spacing:0}
 .workspace-header .top-actions{gap:8px;align-items:center;width:auto;max-width:100%;min-width:0}.workspace-header .top-actions .btn{min-height:36px;padding:8px 12px;font-size:12px;line-height:18px;border-radius:8px}.workspace-header .badge{font-size:11px;line-height:16px}.workspace-header .avatar{width:34px;height:34px;flex:0 0 34px}
 .workspace-header .workspace-tabs{display:flex;align-items:stretch;gap:4px;min-height:42px;max-width:100%;padding:0 var(--ui-gutter);overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:#c9becf transparent;overscroll-behavior-x:contain}
 .workspace-tabs .workspace-tab{display:flex;flex:0 0 auto;align-items:center;max-width:260px;min-height:42px}.workspace-tabs .workspace-tab [role=tab]{min-height:42px;padding:10px 6px 10px 10px;font-size:12px;line-height:20px;font-weight:500}.workspace-tabs .tab-close{display:flex;align-items:center;justify-content:center;width:30px;height:32px;padding:4px;font-size:18px;line-height:20px}
 .main .workspace,.main .workspace:has(.document-editor),body:has(.document-editor) .main .workspace{padding:20px var(--ui-gutter) 28px;max-width:1680px;width:100%;margin:0 auto}
 .workspace #view>.heading,.workspace:has(.document-editor) .heading,.workspace:has(.invoice-workbench) .heading{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:8px 12px;height:auto;min-height:36px;margin:0 0 16px}
 .heading>div:first-child{margin-right:auto;min-width:0}.workspace #view>.heading h1,body:has(.document-editor) .workspace .heading h1{font-size:24px;line-height:30px;letter-spacing:-.5px;font-weight:650;margin:0 0 4px;color:#3e3447}
 .workspace #view>.heading p,.workspace:has(.document-editor) .heading p{font-size:12px;line-height:18px;margin:0;color:var(--ui-muted)}
 .btn,.heading .btn{font-size:13px;line-height:18px;min-height:36px;padding:8px 12px;border-radius:8px;flex-shrink:0}.btn.secondary{border-color:#ddd6e3}.btn:not(:disabled):hover{filter:brightness(.98)}
 .workbench-context-toggle{font-size:12px!important;min-height:34px!important;padding:7px 10px!important}
 .panel{padding:20px;border-radius:12px;box-shadow:0 1px 3px #30253804;border-color:var(--ui-border)}
 .panel-header{gap:12px;flex-wrap:wrap;align-items:center}.panel h2{font-size:17px;line-height:24px;font-weight:650}.panel h3{font-size:14px;line-height:20px}.panel p{line-height:1.55}
 .field{min-width:0}.field>label{font-size:12px;line-height:18px;font-weight:500;color:#51485a}.field input,.field select,.field textarea,.filter>input{border-radius:6px;border-color:#d6d4df;color:#393344;background:#fff;font-size:14px;line-height:20px;min-height:36px;padding:7px 10px;max-width:100%}
 input:focus,select:focus,textarea:focus{outline:2px solid #ad90b5;outline-offset:1px;border-color:#8b6b94}
 :where(input,textarea)::placeholder{color:#817c8a;opacity:1}.muted,.tiny{color:var(--ui-muted)}
 .filter,.inventory-filters,.contact-filters{align-items:end;gap:12px}.inventory-filters>input,.contact-filters>input{min-width:160px;height:36px}.inventory-filters>.field,.contact-filters>.field{min-width:160px;flex:0 1 220px;margin:0}.filter>.field{margin-bottom:0}
 #view .table-wrap:not(.invoice .table-wrap){border-radius:8px;scrollbar-width:thin}
 #view .table-wrap:not(.invoice .table-wrap) th{padding:8px 10px;font-size:11px;line-height:16px;font-weight:600;letter-spacing:.35px;background:#f6f4f8;color:#73687c;vertical-align:middle}
 #view .table-wrap:not(.invoice .table-wrap) td{font-size:13px;line-height:19px;padding:6px 10px;vertical-align:middle;border-bottom-color:#eeeaf2}
 #view .table-wrap:not(.invoice .table-wrap) td small{font-size:11px;line-height:16px;color:#797181}#view .table-wrap:not(.invoice .table-wrap) tbody tr:hover{background:#faf8fc}
 #view .table-wrap:not(.invoice .table-wrap) .btn{min-height:28px;padding:4px 10px;font-size:12px;line-height:18px}
 .document-editor{border-radius:12px;padding:14px!important}.document-editor .field>label,.invoice-workbench .field>label,.invoice-workbench .contact-picker>label{font-size:12px!important;line-height:18px!important;min-height:18px}
 .document-editor .document-fields{align-items:end}.document-editor .document-fields input,.document-editor .document-fields select,.invoice-workbench .contact-picker input{height:34px!important;min-height:34px!important;font-size:13px!important;padding:6px 8px!important}
 #bill-form .document-fields{align-items:start}#bill-form .document-fields>.field{align-self:start}#bill-form .document-fields>.field>label,#bill-form .document-fields .contact-picker>label{min-height:36px!important;display:flex;align-items:flex-end}
 .workbench-grid-tools>strong{font-size:12px}.workbench-grid-tools>small{font-size:10px;color:#776c80}.workbench-grid-tools [data-workbench-count]{font-size:10px;color:#776c80}
 .invoice-workbench .entry-table th{font-size:10px;line-height:15px;font-weight:600}.invoice-workbench .entry-table td{font-size:12px;line-height:20px}.invoice-workbench .entry-table input,.invoice-workbench .entry-table select{font-size:12px!important;min-height:26px!important;height:26px!important}.invoice-workbench .blank-line input[type=search]{font-size:12px!important}
 .invoice-workbench .line-latest-cost,.invoice-workbench .line-average-cost{font-size:9px!important;color:#a8a3b3!important;font-weight:400!important}.invoice-workbench .line-amount{font-size:12px!important;color:#51475c}.invoice-workbench [data-last-customer-price] span{font-size:9px}.invoice-workbench [data-last-customer-price] b{font-size:10px}
 .workbench-terms>small,.workbench-terms b,.workbench-terms span{font-size:10px;color:#786981}.workbench-payment summary,.workbench-payment summary strong,.invoice-workbench .entry-extra>summary{font-size:12px}.workbench-payment [data-payment-brief]{font-size:10px}.workbench-adjustments>.field>label{font-size:11px!important;line-height:16px!important}.workbench-adjustments>small{font-size:10px;line-height:15px;color:#786981}
 .workbench-metrics small{font-size:10px;line-height:15px;color:#786981}.workbench-metrics strong{font-size:16px!important;line-height:22px;color:#604966}.invoice-workbench .workbench-save .btn{font-size:12px;min-height:34px;padding:7px 12px}
 .contact-summary{scrollbar-width:thin;scrollbar-color:#c9becf transparent}.invoice-workbench-layout .contact-summary{font-size:12px;padding:16px!important}.invoice-workbench-layout .contact-summary h2{font-size:17px;line-height:24px}.invoice-workbench-layout .contact-summary h3,.invoice-workbench-layout .contact-summary>details>summary{font-size:12px}.invoice-workbench-layout .contact-summary dl,.invoice-workbench-layout .contact-summary li div,.invoice-workbench-layout .contact-summary .tiny,.invoice-workbench-layout .contact-summary .muted{font-size:11px;line-height:17px}.invoice-workbench-layout .contact-summary small{font-size:10px;line-height:16px}.contact-summary dd{font-variant-numeric:tabular-nums;white-space:nowrap}
 .entry-with-summary .contact-summary h2{font-size:17px;line-height:24px}.entry-with-summary .contact-summary dl{font-size:12px;line-height:18px}
 dialog{border:1px solid var(--ui-border);border-radius:12px;box-shadow:0 16px 64px #29203329;color:var(--ui-text)}dialog::backdrop{background:#28203366}dialog>h2{font-size:20px;line-height:26px}dialog .field>label{font-size:12px}dialog .dialog-actions{gap:8px}dialog input:not([type=checkbox]):not([type=radio]),dialog select,dialog textarea{font-size:14px}dialog .btn{font-size:13px}
 :where(button,a,input,select,textarea,summary):focus-visible{outline:2px solid #92699b;outline-offset:2px}
 @media (prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
}
@media screen and (min-width:1250px){.invoice-workbench-layout{grid-template-columns:minmax(0,1fr) 264px!important;gap:16px!important}.invoice-workbench-layout.workbench-context-hidden{grid-template-columns:minmax(0,1fr)!important}}
@media screen and (min-width:761px){
 #modal.compact-dialog[data-layout=payment] #dialog-form>.field:has(.contact-picker){grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:18px auto;gap:4px 12px;align-items:start}
 #modal.compact-dialog[data-layout=payment] #dialog-form>.field>.contact-picker{grid-column:1;grid-row:1/3;display:grid;gap:4px;margin:0}
 #modal.compact-dialog[data-layout=payment] #dialog-form>.field:has(.contact-picker)>label{grid-column:2;grid-row:1;margin:0}
 #modal.compact-dialog[data-layout=payment] #dialog-form>.field:has(.contact-picker)>select{grid-column:2;grid-row:2}
 #modal.compact-dialog[data-layout=payment] .contact-picker>label{font-size:12px;line-height:18px;font-weight:500}
 #modal.compact-dialog[data-layout=payment] .contact-picker>input{height:36px;min-height:36px;font-size:14px;padding:7px 10px}
 #modal.compact-dialog[data-layout=payment] .contact-picker>[role=alert]:empty{display:none}
}
@media screen and (max-width:1249px) and (min-width:761px){.invoice-workbench-layout{grid-template-columns:minmax(0,1fr)!important}.invoice-workbench-layout .contact-summary{max-height:220px;grid-row:2!important}}
@media screen and (max-width:1000px) and (min-width:761px){:root{--ui-sidebar:216px;--ui-gutter:20px}.sidebar .nav button{font-size:12px;gap:10px;padding:10px}.workspace-header .top-actions{gap:6px}}
@media screen and (max-width:1200px) and (min-width:761px){
 .main .workspace-header .topbar,body:has(.document-editor) .main .topbar{display:grid;grid-template-columns:160px minmax(0,1fr);min-height:104px;gap:12px}
 .workspace-header .top-actions{width:100%;justify-content:flex-end;flex-wrap:wrap;gap:6px}.workspace-header .top-actions .btn{padding:7px 9px;font-size:11px;min-height:34px}
}
@media screen and (max-width:760px){
 :root{--ui-gutter:12px}.layout{display:block}.layout>.sidebar{position:sticky;top:0;width:100%;height:auto;padding:6px 8px;display:block;z-index:30}.sidebar .brand,.sidebar .sidebar-foot{display:none}
 .sidebar .nav{display:flex;flex-direction:row;overflow-x:auto;overflow-y:hidden;align-items:stretch;gap:4px;scrollbar-width:none;scrollbar-color:auto}.sidebar .nav button{flex-direction:column;justify-content:center;flex:0 0 auto;min-height:56px;gap:4px;padding:7px 10px;font-size:11px;line-height:16px;white-space:nowrap;border-radius:7px}.sidebar .nav button.active{box-shadow:inset 0 -2px #8bd5c6}.sidebar .nav svg{width:19px;height:19px;flex:0 0 19px}
 .main .workspace-header .topbar,body:has(.document-editor) .main .topbar{min-height:70px;padding:10px 12px;gap:8px;display:flex;flex-wrap:wrap;align-items:center}.workspace-header .company-name{font-size:14px;flex:1 1 145px}.workspace-header .top-actions{width:auto;flex:0 1 auto;justify-content:flex-end;gap:6px}.workspace-header .top-actions .btn{font-size:11px;min-height:36px;padding:8px 10px}.workspace-header .company-name small{font-size:10px}.workspace-header .badge{font-size:10px;padding:5px 8px}
 .workspace-header .workspace-tabs{padding:0 8px;min-height:42px}.workspace-tabs .workspace-tab [role=tab]{font-size:12px;min-height:42px}.workspace-tabs .tab-close{width:32px;height:36px}
 .main .workspace,.main .workspace:has(.document-editor),body:has(.document-editor) .main .workspace{padding:16px 12px 24px}.workspace #view>.heading,.workspace:has(.document-editor) .heading,.workspace:has(.invoice-workbench) .heading{margin-bottom:12px;gap:8px}.workspace #view>.heading h1,body:has(.document-editor) .workspace .heading h1{font-size:22px;line-height:28px}.workspace #view>.heading p{font-size:12px;line-height:18px}.heading .btn,.btn{min-height:40px;font-size:12px;padding:9px 12px}
 .panel{padding:16px;border-radius:10px}.panel h2{font-size:16px}.field input,.field select,.field textarea,.filter>input{font-size:16px;min-height:40px}.filter,.inventory-filters,.contact-filters{gap:10px;flex-wrap:wrap}.inventory-filters>input,.contact-filters>input{width:100%;flex:1 1 100%;height:40px}.inventory-filters>.field,.contact-filters>.field{flex:1 1 130px;min-width:0;width:auto}.inventory-filters>.field label{min-height:18px}
 #view .table-wrap:not(.invoice .table-wrap) th{font-size:11px;padding:8px}#view .table-wrap:not(.invoice .table-wrap) td{font-size:13px;padding:7px 8px}#view .table-wrap:not(.invoice .table-wrap) .btn{min-height:36px;padding:6px 10px}
 .document-editor{padding:10px!important;min-height:0;height:auto}.document-editor form{height:auto}.document-editor .entry-body{flex:none;overflow:visible}.document-editor .entry-table,.invoice-workbench .entry-table{flex:none;height:clamp(180px,30dvh,260px);min-height:180px;max-height:260px!important}.invoice-workbench .document-footer{max-height:none;overflow:visible}.document-editor .document-fields input,.document-editor .document-fields select,.invoice-workbench .contact-picker input{font-size:16px!important;min-height:38px!important;height:38px!important}.document-editor .field>label,.invoice-workbench .contact-picker>label{font-size:12px!important}
 .invoice-workbench .entry-table tr{padding:8px 5px}.invoice-workbench .entry-table input[type=search]{font-size:16px!important;min-height:28px!important;height:28px!important}.invoice-workbench .line-mobile-summary{font-size:10px;line-height:16px;color:#786981}.invoice-workbench .entry-row .line-mobile-toggle{min-width:28px;min-height:32px;top:5px;right:0}.invoice-workbench .entry-table tr.mobile-expanded input[type=number],.invoice-workbench .entry-table tr.mobile-expanded select{font-size:16px!important;min-height:38px!important;height:38px!important}.invoice-workbench .entry-table tr.mobile-expanded td::before{font-size:10px!important}.invoice-workbench .entry-table tr.mobile-expanded td:nth-child(9)>button{min-height:36px}
 .workbench-payment summary,.workbench-payment summary strong,.invoice-workbench .entry-extra>summary{font-size:11px;min-height:32px}.workbench-adjustments>.field>label{font-size:10px!important;line-height:15px!important}.workbench-adjustments input{font-size:16px!important;min-height:36px!important;height:36px!important}.workbench-adjustments>small{font-size:9px;line-height:13px}.workbench-metrics small{font-size:9px}.workbench-metrics strong{font-size:13px!important;line-height:18px}.invoice-workbench .workbench-save .btn{min-height:40px;font-size:12px}.workbench-pay-fields input,.workbench-pay-fields select,.invoice-workbench .split-row input,.invoice-workbench .split-row select{font-size:16px!important;min-height:38px!important;height:38px!important}
 .invoice-workbench-layout .contact-summary{padding:14px!important;max-height:240px}.workbench-grid-tools>strong{font-size:12px}.workbench-grid-tools>small{display:none}
 dialog input:not([type=checkbox]):not([type=radio]),dialog select,dialog textarea{font-size:16px}dialog .btn{min-height:40px}dialog>h2{font-size:19px}
 .home-app strong{font-size:12px}.home-action{font-size:12px;min-height:40px}.home-app{min-height:90px}.home-launcher h1{font-size:23px}
}

[data-action="activate-offline-update"][hidden]{display:none!important}

#product-history{width:min(1200px,calc(100vw - 24px));max-height:90dvh}
.product-report-filters{display:flex;align-items:end;flex-wrap:wrap;gap:10px;margin:16px 0}
.product-report-filters .field{flex:1 1 150px;min-width:0;margin:0}
.product-report-filters .field:first-child{flex:2 1 240px}
.product-report-summary{display:flex;gap:12px 24px;flex-wrap:wrap;align-items:center;background:#f6f3f8;padding:10px 12px;border-radius:6px;font-size:13px;margin-bottom:12px}
.product-report-summary strong{margin-left:6px;font-size:inherit;font-variant-numeric:tabular-nums}
.product-report-summary small{color:var(--muted)}
#activity-rows .table-wrap{max-height:48dvh;overflow:auto}
#activity-rows table{min-width:950px}
#activity-rows th{position:sticky;top:0;background:#f6f3f8;z-index:1}
#activity-rows td,#activity-rows th{font-size:12px;padding:7px 9px}
#activity-rows td:nth-child(5),#activity-rows td:nth-child(6){text-align:right;font-variant-numeric:tabular-nums}
@media(max-width:760px){.product-report-filters{gap:8px}.product-report-filters .field:first-child{flex-basis:100%}.product-report-filters .field{flex-basis:135px}.product-report-summary{gap:8px 16px}#activity-rows .table-wrap{max-height:40dvh}}

/* Keep native search clearing and serial entry in separate control areas. */
.entry-row td:nth-child(2):has(>.serial-detail)>input[type=search]{width:calc(100% - 72px);padding-right:4px!important}
.entry-row td:nth-child(2)>.serial-detail{right:5px;top:2px;max-width:66px;margin:0}
.entry-row td:nth-child(2)>.serial-detail summary{max-width:66px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.entry-row td:nth-child(2)>.serial-detail[open]{position:static;display:block;max-width:100%;width:230px;margin:3px 0;box-shadow:none}
.entry-row td:nth-child(2)>.serial-detail[open] input{width:100%;box-sizing:border-box}
@media screen and (max-width:760px){
 .invoice-workbench .entry-row td:nth-child(2):has(>.serial-detail)>input[type=search]{width:100%}
 .invoice-workbench .entry-table tr.mobile-expanded .serial-detail,
 .invoice-workbench .entry-table tr.mobile-expanded .serial-detail[open]{position:static;width:100%;max-width:100%;padding:0;border:0;box-shadow:none;margin-top:4px}
 .invoice-workbench .entry-table tr.mobile-expanded .serial-detail input{min-width:0;width:100%}
}

/* Keep asset product names readable in phone dialogs. */
@media(max-width:760px){#modal.compact-dialog:has([name=assetProductSearch]) .field:has([name=assetProductSearch]),#modal.compact-dialog:has([name=assetProductSearch]) .field:has(select[name=productId]){grid-column:1/-1!important}}

/* Browser-like equal-width workspace tabs; labels truncate without shifting close controls. */
@media screen{
 .workspace-tabs .workspace-tab{flex:0 0 180px;width:180px;min-width:180px;max-width:180px}
 .workspace-tabs .workspace-tab [role=tab]{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
 .workspace-tabs .tab-close{flex:0 0 30px}
}
@media screen and (max-width:760px){.workspace-tabs .workspace-tab{flex-basis:150px;width:150px;min-width:150px;max-width:150px}}
/* Compact sale heading returns vertical space to the flexible product grid. */
@media screen and (min-width:761px){
 body:has(#sale-form) .main .workspace{padding-top:6px;padding-bottom:12px}
 body:has(#sale-form) .workspace #view>.heading{min-height:26px;height:auto;gap:6px 10px;margin:0 0 4px}
 body:has(#sale-form) .workspace #view>.heading h1{font-size:18px;line-height:22px;margin:0;letter-spacing:-.25px}
 body:has(#sale-form) .workspace #view>.heading .workbench-context-toggle{min-height:26px!important;padding:3px 9px!important;line-height:18px}
}
/* Settings: payment QR + social links */
.settings-qr-row{display:flex;gap:12px;align-items:flex-start;flex-wrap:wrap}
.settings-qr-row img{width:96px;height:96px;object-fit:contain;image-rendering:pixelated;border:1px solid var(--line,#d8dde3);background:#fff;border-radius:6px}
.settings-qr-row img[hidden]{display:none}
.settings-social{border:1px solid var(--line,#d8dde3);border-radius:8px;padding:8px 12px 4px;margin:8px 0;min-width:0}
.settings-social legend{font-size:13px;font-weight:600;padding:0 4px}

/* Smart insights */
#smart-insights .insight-group{border:1px solid var(--line,#d8dde3);border-radius:8px;padding:8px 12px;margin:8px 0}
#smart-insights .insight-group summary{cursor:pointer}
#smart-insights .insight-count{display:inline-block;min-width:22px;padding:0 6px;border-radius:10px;background:var(--soft,#eef1f4);text-align:center;font-size:12px}
#smart-insights td small{display:block;opacity:.7}

/* Bill import: text read from a photo */
.bill-import-text pre{max-height:220px;overflow:auto;white-space:pre-wrap;font-size:12px;background:var(--soft,#f4f6f8);padding:8px;border-radius:6px}

/* Alignment audit 2026-11-08: side-by-side fields line up by the input, even when one label wraps to two lines. */
.document-fields,.form-grid{align-items:end}

/* On-screen amount in words next to amount labels (never printed). One line, cut with … so nothing moves. */
label:has(.amount-words){display:flex;align-items:baseline;gap:8px;min-width:0;white-space:nowrap}
label .amount-words{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:400;color:var(--muted,#6b7280);text-align:right;text-transform:none;letter-spacing:0}
@media print{.amount-words{display:none!important}}
.amount-words-bubble{position:fixed;z-index:1000;max-width:min(420px,calc(100vw - 8px));padding:4px 9px;border-radius:6px;background:#1f2937;color:#fff;font-size:12px;line-height:1.3;pointer-events:none;box-shadow:0 4px 12px rgba(0,0,0,.18)}
@media print{.amount-words-bubble{display:none!important}}

.invoice-workbench .customer-rate-inline [data-last-customer-price],.invoice-workbench [data-last-customer-price],.invoice-workbench [data-last-customer-price] b,.invoice-workbench [data-last-customer-price] span{font-size:9px!important;color:#a8a3b3!important;font-weight:400!important;opacity:1}

/* ===== Phone app shell: top app bar, bottom navigation, More sheet, table rows as cards (<=760px) ===== */
.nav-more-btn{display:none}
@media screen and (max-width:760px){
 :root{--phone-nav:64px;--phone-safe:env(safe-area-inset-bottom,0px)}
 body{padding-bottom:calc(var(--phone-nav) + var(--phone-safe) + 8px)}
 /* Bottom navigation */
 .layout>.sidebar{position:fixed;top:auto;bottom:0;left:0;right:0;width:100%;height:auto;padding:6px 6px calc(6px + var(--phone-safe));background:#fff;border-top:1px solid #e4dde8;box-shadow:0 -2px 12px #2b1b2d14;z-index:60}
 .sidebar .nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;overflow:visible}
 .sidebar .nav button{display:none;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:52px;padding:6px 2px;border-radius:16px;font-size:11px;line-height:14px;font-weight:600;color:#6b5a6e;background:none;white-space:normal;text-align:center;box-shadow:none}
 .sidebar .nav button svg{width:22px;height:22px;flex:0 0 22px;color:currentColor!important;stroke:currentColor!important}
 .sidebar .nav button:nth-child(-n+4),.sidebar .nav .nav-more-btn{display:flex}
 .sidebar .nav button.active{background:#ece2ed;color:#4d3448;box-shadow:none}
 /* More sheet */
 body.nav-more::before{content:"";position:fixed;inset:0;background:#1d101f66;z-index:55}
 body.nav-more .layout>.sidebar{border-radius:24px 24px 0 0;padding-top:18px}
 body.nav-more .sidebar .nav{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px 2px;max-height:70dvh;overflow:auto}
 body.nav-more .sidebar .nav button{display:flex;min-height:68px}
 /* Top app bar */
 .main .workspace-header{top:0!important}
 .main .workspace-header .topbar,body:has(.document-editor) .main .topbar{min-height:56px;padding:6px 12px;flex-wrap:nowrap}
 .workspace-header .company-name{flex:1 1 auto;min-width:0;font-size:16px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .workspace-header .company-name small,.workspace-header .badge,.workspace-header .overview-clock{display:none}
 .workspace-header .top-actions{flex:0 0 auto;flex-wrap:nowrap}
 .workspace-header .top-actions .btn{min-height:40px;border-radius:20px}
 /* Page tabs become a slim chip row */
 .workspace-header .workspace-tabs{min-height:44px;padding:4px 8px;gap:6px;align-items:center;border-top:1px solid #efe9f1}
 .workspace-tabs .workspace-tab{flex:0 0 auto;width:auto;min-width:0;max-width:170px;min-height:36px;border-radius:18px;background:#f3eef4}
 .workspace-tabs .workspace-tab.active{background:#ece2ed;box-shadow:none}
 .workspace-tabs .workspace-tab [role=tab]{min-height:36px;padding:6px 4px 6px 12px}
 .workspace-tabs .tab-close{width:32px;height:36px}
 /* Table rows as cards */
 :is(#view,#modal) :is(.table-wrap,.payment-open-table):has(.card-table){overflow:visible;border:0;background:none;padding:0}
 :is(#view,#modal) table.card-table,:is(#view,#modal) table.card-table tbody{display:block;width:100%;min-width:0}
 :is(#view,#modal) table.card-table thead{display:none}
 :is(#view,#modal) table.card-table tr{display:block;margin:0 0 10px;padding:10px 14px;background:#fff;border:1px solid #e4dde8;border-radius:16px;box-shadow:0 1px 3px #2b1b2d0d}
 :is(#view,#modal) table.card-table td{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;padding:5px 0;border:0;text-align:right;white-space:normal;word-break:break-word}
 :is(#view,#modal) table.card-table td:empty{display:none}
 :is(#view,#modal) table.card-table td::before{content:attr(data-label);flex:0 0 38%;max-width:42%;text-align:left;font-size:11px;font-weight:600;color:#7a6a7d;text-transform:uppercase;letter-spacing:.03em;line-height:20px}
 :is(#view,#modal) table.card-table td:first-child:not(:has(input)){display:block;text-align:left;font-size:15px;font-weight:700;padding-bottom:6px;margin-bottom:4px;border-bottom:1px solid #efe9f1}
 :is(#view,#modal) table.card-table td:first-child:not(:has(input))::before{display:none}
 :is(#view,#modal) table.card-table td:has(>button:only-child,>.btn,>a.btn){justify-content:flex-start;flex-wrap:wrap;text-align:left}
 :is(#view,#modal) table.card-table td:has(>button:only-child,>.btn,>a.btn)::before{display:none}
 :is(#view,#modal) table.card-table .btn,:is(#view,#modal) table.card-table button{min-height:40px}
}

/* Phone: package / quotation line editor as one card per line */
@media screen and (max-width:760px){
 #workflow-lines{max-height:none;height:auto;overflow:visible;border:0;background:none;padding:0}
 #modal #workflow-lines table.line-cards,#workflow-lines table.line-cards,#workflow-lines table.line-cards tbody{display:block;width:100%;min-width:0}
 #workflow-lines table.line-cards thead{display:none}
 #workflow-lines table.line-cards tr.entry-row{position:relative;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 10px;margin:0 0 12px;padding:12px 40px 12px 12px;background:#fff;border:1px solid #e4dde8;border-radius:16px;box-shadow:0 1px 3px #2b1b2d0d;height:auto!important}
 #workflow-lines table.line-cards tr.blank-line{border-style:dashed;background:#faf7fb;box-shadow:none}
 #workflow-lines table.line-cards td{display:block;height:auto!important;min-width:0;padding:0;border:0;text-align:left;white-space:normal;line-height:1.3}
 #workflow-lines table.line-cards td:first-child{display:none}
 #workflow-lines table.line-cards td:nth-child(2){grid-column:1/-1;order:1}
 #workflow-lines table.line-cards td:nth-child(3){order:2}
 #workflow-lines table.line-cards td:nth-child(4){order:3}
 #workflow-lines table.line-cards td:has(input[data-key=actualPrice]){order:4}
 #workflow-lines table.line-cards td:has(input[data-key=price]){order:5}
 #workflow-lines table.line-cards td.line-latest-cost,#workflow-lines table.line-cards td.line-average-cost{order:6;font-size:12px;color:#7a6a7d}
 #workflow-lines table.line-cards td.line-amount{order:7;grid-column:1/-1;display:flex;justify-content:space-between;font-weight:700;padding-top:6px;border-top:1px solid #efe9f1}
 #workflow-lines table.line-cards td:last-child{position:absolute;top:8px;right:6px}
 #workflow-lines table.line-cards td:last-child:empty{display:none}
 #workflow-lines table.line-cards td[data-label]:not(:nth-child(2)):not(:last-child):not(.line-amount):not(:empty)::before{content:attr(data-label);display:block;margin-bottom:3px;font-size:11px;font-weight:600;color:#7a6a7d;text-transform:uppercase;letter-spacing:.03em}
 #workflow-lines table.line-cards td.line-amount::before{content:"Amount";font-weight:600;font-size:11px;color:#7a6a7d;text-transform:uppercase;letter-spacing:.03em;align-self:center}
 #workflow-lines table.line-cards td:empty{display:none}
 #workflow-lines table.line-cards td.line-latest-cost:empty,#workflow-lines table.line-cards td.line-average-cost:empty{display:none}
 #workflow-lines table.line-cards input,#workflow-lines table.line-cards select{width:100%;min-width:0!important;height:44px!important;font-size:16px;box-sizing:border-box}
 #workflow-lines table.line-cards td:nth-child(2) input[type=search]{min-width:0!important;width:100%}
 #workflow-lines table.line-cards .line-specs{height:40px!important;margin-top:8px;font-size:14px}
 #workflow-lines table.line-cards td:last-child button{width:36px;height:36px!important;font-size:20px;border:0;background:none;color:#a35566}
 #workflow-lines table.line-cards .line-mobile-summary,#workflow-lines table.line-cards .line-mobile-toggle{display:none}
}
@media screen and (max-width:760px){
 #view table.table-empty{display:block;width:100%;min-width:0}
 #view table.table-empty thead{display:none}
 #view .table-wrap:has(table.table-empty){overflow:visible}
 #view .table-wrap:has(table.table-empty)::after{content:"Nothing here yet";display:block;padding:22px 8px;text-align:center;color:#7a6a7d;font-size:14px}
}
@media screen and (max-width:760px){
 .workspace-header .top-actions .topbar-button[data-action=sale],.workspace-header .top-actions .topbar-button[data-action=product]{display:none}
 #view table.card-table td{min-width:0}
 #view table.card-table td .btn,#view table.card-table td button{white-space:normal;max-width:100%;height:auto;text-align:center}
 #view table.card-table td>*{max-width:100%}
}

/* Phone: New sale / vendor bill lines as one card per line, page scrolls normally (no inner scroll box) */
@media screen and (max-width:760px){
 #app .document-editor{height:auto!important;min-height:0!important}
 #app .document-editor form{height:auto}
 #app .document-editor .entry-body{overflow:visible!important;flex:none}
 #app .document-editor .entry-table,#app .invoice-workbench .entry-table{max-height:none!important;overflow:visible!important;border:0;background:none}
 #app .invoice-workbench .entry-table table.line-cards,#app .invoice-workbench .entry-table table.line-cards tbody{display:block;width:100%!important;min-width:0!important}
 #app .invoice-workbench .entry-table table.line-cards thead{display:none}
 #app .invoice-workbench .entry-table table.line-cards tr.entry-row{position:relative;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 10px;align-items:start;margin:0 0 12px;padding:12px 44px 12px 12px;background:#fff;border:1px solid #e4dde8;border-radius:16px;box-shadow:0 1px 3px #2b1b2d0d;height:auto!important}
 #app .invoice-workbench .entry-table table.line-cards tr.empty-entry{display:none}
 #app .invoice-workbench .entry-table table.line-cards tr.blank-line{border-style:dashed;background:#faf7fb;box-shadow:none}
 #app .invoice-workbench .entry-table table.line-cards td{display:block;height:auto!important;min-width:0;padding:0!important;border:0;text-align:left;white-space:normal;line-height:1.3;grid-row:auto!important;grid-column:auto}
 #app .invoice-workbench .entry-table table.line-cards td:first-child{display:none}
 #app .invoice-workbench .entry-table table.line-cards tr.blank-line td:not(:nth-child(2)){display:none}
 #app .invoice-workbench .entry-table table.line-cards td:nth-child(2){grid-column:1/-1!important;order:1}
 #app .invoice-workbench .entry-table table.line-cards td:nth-child(3){order:2}
 #app .invoice-workbench .entry-table table.line-cards td:nth-child(4){order:3}
 #app .invoice-workbench .entry-table table.line-cards td:has(input[data-key=price]){order:4}
 #app .invoice-workbench .entry-table table.line-cards td.line-latest-cost,#app .invoice-workbench .entry-table table.line-cards td.line-average-cost{order:5;font-size:12px!important;color:#7a6a7d;text-align:left}
 #app .invoice-workbench .entry-table table.line-cards td.line-amount{order:6;grid-column:1/-1!important;display:flex;justify-content:space-between;font-size:15px!important;font-weight:700;padding-top:6px!important;border-top:1px solid #efe9f1}
 #app .invoice-workbench .entry-table table.line-cards td:last-child{display:block;position:absolute;top:8px;right:6px;grid-column:auto!important}
 #app .invoice-workbench .entry-table table.line-cards td:last-child:empty{display:none}
 #app .invoice-workbench .entry-table table.line-cards td:last-child>button{display:block;width:36px;height:36px!important;font-size:20px;border:0;background:none;color:#a35566}
 #app .invoice-workbench .entry-table table.line-cards td[data-label]:not(:nth-child(2)):not(:last-child):not(.line-amount):not(:empty)::before{content:attr(data-label);display:block;margin-bottom:3px;font-size:11px;font-weight:600;color:#7a6a7d;text-transform:uppercase;letter-spacing:.03em}
 #app .invoice-workbench .entry-table table.line-cards td.line-amount::before{content:"Amount";font-size:11px;font-weight:600;color:#7a6a7d;text-transform:uppercase;letter-spacing:.03em;align-self:center}
 #app .invoice-workbench .entry-table table.line-cards input:not([type=checkbox]),#app .invoice-workbench .entry-table table.line-cards select{width:100%;min-width:0!important;height:44px!important;min-height:44px!important;font-size:16px!important;padding:6px 10px!important;box-sizing:border-box;white-space:normal;text-overflow:ellipsis}
 #app .invoice-workbench .entry-table table.line-cards .line-mobile-summary,#app .invoice-workbench .entry-table table.line-cards .line-mobile-toggle{display:none!important}
 #app .invoice-workbench .entry-table table.line-cards .serial-detail{display:block!important;position:static;width:100%;max-width:100%;margin-top:6px;padding:0;border:0;box-shadow:none}
 #app .invoice-workbench .entry-table table.line-cards .serial-detail input{height:40px!important;margin-top:4px}
 #app .invoice-workbench .entry-table table.line-cards .line-specs{height:40px!important;margin-top:8px;font-size:14px!important}
}
@media screen and (max-width:760px){
 #app .invoice-workbench .entry-table table.line-cards td:last-child>button{font-size:0!important;line-height:0;overflow:hidden}
 #app .invoice-workbench .entry-table table.line-cards td:last-child>button::after{content:"\00d7";font-size:24px;line-height:36px;color:#a35566}
}
.phone-filter-toggle{display:none}
@media screen and (max-width:760px){
 .phone-filter-toggle{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:48px;margin:0 0 10px;padding:10px 16px;border:1px solid #e4dde8;border-radius:14px;background:#fff;color:#4d3448;font-size:15px;font-weight:600}
 .phone-filter-toggle::after{content:"\25BE";font-size:14px;color:#7a6a7d}
 .phone-filter-toggle[aria-expanded=true]::after{content:"\25B4"}
 #view form.register-filters.phone-collapsed{display:none}
 #view form.register-filters{margin-bottom:12px}
}
@media screen and (max-width:760px){
 /* Overview: page scrolls as one, no scroll box inside the launcher */
 #app .home-launcher{height:auto!important;min-height:0!important}
 #app .home-app-grid{overflow:visible!important;flex:none!important;grid-auto-rows:minmax(92px,auto)}
 /* Long placeholders end with an ellipsis instead of being cut mid-word */
 input,textarea{text-overflow:ellipsis}
 input::placeholder,textarea::placeholder{font-size:14px;text-overflow:ellipsis}
}
@media screen and (max-width:760px){#modal .payment-open-table:has(.card-table){max-height:none;overflow:visible}}
@media screen and (max-width:760px){:is(#view,#modal) table.card-table input[type=checkbox]{width:24px;height:24px;margin:0}}
@media screen and (max-width:760px){
 #view .document-fields:has(>button:last-child):not(:has(#cart)){grid-template-columns:1fr 1fr;align-items:end;gap:10px}
 #view .document-fields:has(>button:last-child):not(:has(#cart))>button{grid-column:1/-1;min-height:44px}
 #view .document-fields:has(>button:last-child):not(:has(#cart)) input[type=date]{width:100%;min-width:0;height:44px}
}
@media screen and (max-width:760px){#view .document-fields:has(>button:last-child):not(:has(#cart))>.field{grid-column:1/-1}}
