/* Clean list pages: compact buttons, one-line filters, quiet selection bar, tables that fit. Loaded last. */
body .page-content .btn{min-height:36px;padding:6px 14px;font-size:14px;border-radius:6px;gap:6px}
body .page-content .btn.secondary{border-color:var(--border)}
body .page-content .btn.secondary:hover{border-color:var(--control-border)}
body .page-content .page-actions{margin-top:-52px;gap:8px}
body .page-content .page-heading p{font-size:14px}

/* Filters: one tidy row of equal-height controls. */
body .page-content .filter-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:12px}
body .page-content .filter-row :is(input:not([type=hidden]),select){min-height:36px;height:36px;padding:4px 10px;font-size:14px;border-radius:6px;margin:0;width:auto}
body .page-content .filter-row .search-box{display:flex;align-items:center;gap:8px;flex:1 1 260px;margin:0;min-height:36px;border-radius:6px}
body .page-content .filter-row .search-box input{flex:1;width:100%;height:34px;min-height:34px;border:0!important}
body .page-content .filter-row .search-box svg{flex:0 0 16px;width:16px;height:16px;color:var(--muted)}
body .page-content .filter-row label{display:flex;flex-direction:row;align-items:center;gap:6px;margin:0;font-size:14px;color:var(--muted)}
body .page-content .filter-row input[type=date]{width:150px}
body .page-content .panel>p.small.muted{font-size:13px;margin:0 0 10px}

/* Selection bar: only "Select all" shows until a row is ticked. */
body .page-content .invoice-bulk-delete{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:6px 12px;margin:0 0 10px;min-height:0;background:transparent;border:0;box-shadow:none;font-size:14px}
body .page-content .invoice-bulk-delete label{display:flex;flex-direction:row;align-items:center;gap:8px;margin:0;font-size:14px}
body .page-content .invoice-bulk-delete:not(.has-selection)>:not(label:first-of-type):not([type=hidden]){display:none!important}
body .page-content .invoice-bulk-delete.has-selection{background:var(--primary-soft);border-radius:6px}
body .page-content .invoice-bulk-delete select{min-height:32px;height:32px;padding:2px 8px;width:auto;margin:0;font-size:14px}
body .page-content .invoice-bulk-delete :is(button,.btn){min-height:32px;padding:4px 12px;font-size:14px;border-radius:6px}
body .page-content .invoice-bulk-delete .invoice-delete-button:not(:disabled){background:#c50f1f;border:1px solid #c50f1f;color:#fff}

/* Tables: tighter cells so more columns fit on screen. */
body .page-content table{font-size:15px}
body .page-content :is(thead th,td){padding:10px 12px}
body .page-content thead th{font-size:13px;white-space:nowrap}
body .page-content .invoice-channel-pill,body .page-content .pill{font-size:12px;padding:2px 8px}
body .page-content .invoice-row-actions{display:flex;gap:4px;justify-content:flex-end}
body .page-content .invoice-row-actions .table-action{border:0;background:none;padding:4px 8px;min-height:0;color:var(--primary);font-size:14px;border-radius:4px}
body .page-content .invoice-row-actions .table-action:hover{background:var(--primary-soft)}

/* Filters with a visible label: keep label and box on one line. */
body .page-content .filter-row>label{white-space:nowrap}
body .page-content .filter-row>label:has(input[name=s]){flex:1 1 300px}
body .page-content .filter-row>label input[name=s]{flex:1;min-width:0;width:100%}
body .page-content .filter-row .btn{min-height:36px!important;height:36px;padding:6px 14px!important;font-size:14px!important}

/* Customer list: no grid lines, compact cells, quiet actions. */
body .page-content .customer-list-table{width:100%;font-size:15px}
body .page-content .customer-list-table :is(th,td){padding:10px 14px;border-right:0}
body .page-content .customer-list-table :is(td:first-child,td:nth-child(2)){min-width:0}
body .page-content .customer-list-table .customer-amount{min-width:0}
body .page-content .customer-list-table td:first-child{display:flex;align-items:center;gap:10px}
body .page-content .customer-list-table .customer-invoice-links a{min-height:0;margin-right:8px}
body .page-content .customer-list-table .customer-list-actions{text-align:right}
body .page-content .customer-list-table .customer-list-actions a{min-height:0;padding:4px 8px;border:0;margin:0;color:var(--primary)}
body .page-content .customer-list-table .customer-list-actions a:hover{background:var(--primary-soft)}
body .page-content .customer-list-table tbody tr:hover{background:var(--secondary)}

/* Products: filters on one line, bulk tools only while products are ticked, short product names. */
body .page-content .catalog-filter-options{display:flex!important;flex-wrap:wrap;gap:8px;margin:0}
body .page-content .catalog-filter-options label{display:flex;flex-direction:row;align-items:center;gap:6px;white-space:nowrap;margin:0;font-size:14px;color:var(--muted)}
body .page-content .catalog-filter-options select{min-width:150px}
body .page-content .catalog-filter-toggle{display:none!important}
body .page-content #productBulkForm:not(.has-selection) :is(.bulk-toolbar,.bulk-toolbar+p){display:none!important}
body .page-content #productBulkForm .bulk-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:8px 12px;margin:0 0 8px;background:var(--primary-soft);border:0;border-radius:6px;font-size:14px}
body .page-content #productBulkForm .bulk-toolbar label{display:flex;flex-direction:row;align-items:center;gap:6px;margin:0;font-size:14px}
body .page-content #productBulkForm .bulk-toolbar select{min-height:32px;height:32px;padding:2px 8px;width:auto;margin:0;font-size:14px}
body .page-content #productBulkForm .bulk-toolbar .btn{min-height:32px;padding:4px 12px}
body .page-content #productBulkForm .bulk-toolbar+p{font-size:13px;margin:0 0 10px}
body .page-content .product-catalog-table{width:100%;font-size:15px}
body .page-content .product-catalog-table .product-cell{display:flex;align-items:center;gap:12px}
body .page-content .product-catalog-table .product-cell .thumb{width:40px;height:40px;flex:none}
body .page-content .product-catalog-table .strong-link{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;max-width:420px;white-space:normal;font-weight:500!important;line-height:1.35}
body .page-content .product-catalog-table td[data-label=SKU]{font-size:13px;color:var(--muted);white-space:nowrap}
body .page-content .product-catalog-table .catalog-actions{text-align:right}
body .page-content .product-catalog-table .table-action{padding:4px 8px;border:0;background:none;color:var(--primary);min-height:0}

/* Connection bar shown when the network drops. */
.net-bar{position:fixed;left:50%;top:12px;transform:translateX(-50%);z-index:10000;max-width:calc(100vw - 32px);width:max-content;padding:10px 18px;border-radius:8px;font:500 15px/1.4 "Segoe UI",Arial,sans-serif;box-shadow:0 6px 24px #0000002e;text-align:center}
.net-bar[hidden]{display:none}
.net-bar[data-kind=offline]{background:#fde7e9;color:#8a1c22;border:1px solid #c50f1f}
.net-bar[data-kind=online]{background:#dff6dd;color:#0e5c0e;border:1px solid #107c10}
.net-bar-pulse{animation:net-pulse .4s}
@keyframes net-pulse{50%{transform:translateX(-50%) scale(1.04)}}
@media(max-width:700px){.net-bar{width:auto;left:16px;right:16px;transform:none;top:8px}@keyframes net-pulse{50%{transform:scale(1.03)}}}

/* Connection signal in the top bar: three bars plus a word, coloured by strength. */
.net-signal{--net:#107c10;display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;border:1px solid var(--border);background:var(--panel);color:var(--net);font-size:13px;font-weight:500;white-space:nowrap}
.net-signal[data-net=weak]{--net:#0f6cbd}
.net-signal[data-net=none]{--net:#c50f1f;background:#fde7e9;border-color:#c50f1f}
.net-signal-bars{display:inline-flex;align-items:flex-end;gap:2px;height:12px}
.net-signal-bars i{width:3px;border-radius:1px;background:var(--net)}
.net-signal-bars i:nth-child(1){height:5px}.net-signal-bars i:nth-child(2){height:8px}.net-signal-bars i:nth-child(3){height:12px}
.net-signal[data-net=weak] .net-signal-bars i:nth-child(3),.net-signal[data-net=none] .net-signal-bars i:is(:nth-child(2),:nth-child(3)){background:var(--border)}
[data-theme=dark] .net-signal{--net:#54b054}[data-theme=dark] .net-signal[data-net=weak]{--net:#77b7f7}[data-theme=dark] .net-signal[data-net=none]{--net:#f1707b;background:#3b1418}
@media(max-width:600px){.net-signal{padding:4px 8px}.net-signal:not([data-net=none]) .net-signal-text{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}}

/* Logos in settings never wider than their box. */
body .page-content img.invoice-profile-logo{display:block;max-width:100%;max-height:80px;width:auto;height:auto;object-fit:contain}

/* Receipts: one tidy checkbox column, standard-size boxes. */
body .receipt-workspace .receipt-report-table td.receipt-check-cell{width:44px;padding:0 0 0 14px;vertical-align:middle}
body .receipt-workspace .receipt-check-cell .receipt-select{width:auto;flex:none;min-height:0;justify-content:flex-start}
body .receipt-workspace input.invoice-selection,body .receipt-workspace .invoice-bulk-delete input[type=checkbox]{width:18px;height:18px;min-height:18px;flex:0 0 18px;margin:0;cursor:pointer;accent-color:var(--primary)}
body .receipt-workspace .receipt-report-table td:has(.receipt-number){min-width:0}
body .receipt-workspace .receipt-selected td{background:var(--primary-soft)}

/* Side panel used for import and other secondary tasks. */
.app-drawer{position:fixed;inset:0 0 0 auto;margin:0;height:100%;max-height:100%;width:min(520px,100vw);padding:0;border:0;border-left:1px solid var(--border);background:var(--panel);color:var(--text);box-shadow:-8px 0 32px #0000002e;overflow-y:auto}
.app-drawer::backdrop{background:#0000004d}
.app-drawer[open]{animation:app-drawer-in .2s ease-out}
@keyframes app-drawer-in{from{transform:translateX(100%)}to{transform:none}}
.app-drawer-close{position:absolute;top:14px;right:14px;z-index:1;font-size:18px;width:36px;height:36px}
.app-drawer>.panel{border:0;box-shadow:none;border-radius:0;margin:0;padding:24px}
.app-drawer .receipt-import-upload{display:flex;flex-direction:column;align-items:stretch;gap:12px}
.app-drawer .receipt-import-upload label{display:flex;flex-direction:column;gap:6px}
.app-drawer .receipt-import-heading{padding-right:40px}

/* Receipts header and toolbar: same compact controls as other pages. */
body .receipt-workspace .receipt-head-actions{display:flex;gap:8px;align-items:center}
body .receipt-workspace .receipt-head-actions :is(.btn,summary.btn){min-height:36px;padding:6px 14px;font-size:14px;border-radius:6px}
body .receipt-workspace .receipt-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
body .receipt-workspace .receipt-toolbar :is(input:not([type=hidden]),select){min-height:36px;height:36px;font-size:14px;border-radius:6px;margin:0}
body .receipt-workspace .receipt-toolbar .btn,body .receipt-workspace .receipt-date-filter>summary{min-height:36px;height:36px;padding:6px 14px;font-size:14px;border-radius:6px;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border);box-shadow:none}
body .receipt-workspace .receipt-search{flex:1 1 260px}
body .receipt-workspace .receipt-metrics strong{font-size:22px;font-weight:600!important}
body .receipt-workspace .receipt-metrics>div{padding-top:12px;padding-bottom:12px}
body .receipt-workspace #receiptColumnToggle{min-height:34px;padding:4px 12px;font-size:14px;border-radius:6px;border:1px solid var(--border);box-shadow:none}

@media(max-width:700px){
 /* Small screens: each filter takes the full width with its label above, so nothing runs off the edge. */
 body .page-content :is(.filter-row,.catalog-filter-options)>label,body .page-content .catalog-filter-options{flex:1 1 100%;flex-direction:column!important;align-items:stretch!important;white-space:normal!important;min-width:0;width:100%}
 body .page-content :is(.filter-row,.catalog-filter-options) :is(select,input:not([type=checkbox]):not([type=hidden])){min-width:0!important;width:100%!important;max-width:100%}
 body .receipt-workspace .receipt-toolbar>*{flex:1 1 100%;min-width:0;max-width:100%}
 body .receipt-workspace .receipt-toolbar :is(label,input:not([type=hidden]),select,.btn,summary){min-width:0!important;max-width:100%;width:100%}
 body .receipt-workspace .receipt-date-filter>div{min-width:0;max-width:100%}
 body .receipt-workspace .receipt-page-head{flex-wrap:wrap;min-width:0}
 body .receipt-workspace .receipt-head-actions{flex-wrap:wrap;width:100%;min-width:0;max-width:100%}
 body .receipt-workspace .receipt-head-actions>*{flex:1 1 100%;min-width:0;max-width:100%;box-sizing:border-box}
 body .receipt-workspace .receipt-download{width:100%}
 body .receipt-workspace .receipt-download-menu{position:static;width:100%;max-width:100%;margin-top:8px;box-sizing:border-box}
 body .receipt-workspace .receipt-download-menu button{min-width:0;box-sizing:border-box}
 body .page-content .page-actions{margin-top:0}
 body .page-content .filter-row>*{flex:1 1 100%}
 body .page-content .filter-row :is(select,input[type=date]){width:100%}
 body .page-content .filter-row label input{flex:1}
}

/* Overview counters: full-colour Fluent-style icons */
body .simple-stats .overview-counter .ov-stat{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;text-align:left;gap:16px;padding:20px;min-height:0}
body .ov-icon{flex:0 0 56px;width:56px;height:56px;border-radius:14px;display:grid;place-items:center;background:#fff4e5}
body .ov-icon svg{width:36px;height:36px;display:block}
body .ov-stat--variants .ov-icon{background:#f2edff}
body .ov-stat--invoices .ov-icon{background:#e9f2fd}
body .ov-stat--items .ov-icon{background:#e3f7f3}
body .ov-stat-text{display:flex;flex-direction:column;gap:4px;min-width:0}
body .ov-stat-label{font-size:14px;font-weight:600;color:var(--muted,#5f6b7a)}
body .ov-stat-text strong{font-size:28px;line-height:1.15;font-weight:600;color:var(--text,#1b1f24);overflow-wrap:anywhere}
body .overview-counter:hover .ov-icon{transform:scale(1.04)}
body .ov-icon{transition:transform .15s ease}
@media (prefers-reduced-motion:reduce){body .ov-icon{transition:none}}
:root[data-theme="dark"] body .ov-icon{background:#3a2c17}
:root[data-theme="dark"] body .ov-stat--variants .ov-icon{background:#2c2347}
:root[data-theme="dark"] body .ov-stat--invoices .ov-icon{background:#1b2d45}
:root[data-theme="dark"] body .ov-stat--items .ov-icon{background:#163a36}
@media (max-width:600px){body .page-content .simple-stats{grid-template-columns:1fr;gap:12px}body .simple-stats .overview-counter .ov-stat{padding:16px}body .ov-icon{flex-basis:48px;width:48px;height:48px}body .ov-icon svg{width:30px;height:30px}body .ov-stat-text strong{font-size:24px}}

/* Invoice builder: stock deduction asked once */
body .simple-stock-picker [data-quick-after][hidden],body .invoice-stock-usage [hidden]{display:none!important}
body .inv-deduct-summary{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;margin:6px 0 0;font-size:13px;color:var(--muted,#5f6b7a)}
body .inv-deduct-summary span{font-weight:600;color:var(--text,#1b1f24)}
body .inv-deduct-summary .inv-link-btn{padding:2px 0;font-size:13px}
body .invoice-stock-usage .inv-deduct-summary{grid-column:1/-1;margin:0}
body .invoice-builder .invoice-stock-usage:not(:has(label:not([hidden]))){background:transparent!important;padding:0;margin-top:6px}

/* Sign-in: soft sky with slowly drifting clouds behind the card (no text) */
body.signin-page .signin-ambient{background:linear-gradient(180deg,#9fcaed 0%,#c4e0f5 55%,#e6f2fb 100%)!important}
body.signin-page .signin-cloud-layer{display:block!important}
body.signin-page .signin-sky-tint{display:block!important}
body.signin-page .cloud-distant{animation:signinCloudsFar 48s ease-in-out infinite alternate}
body.signin-page .cloud-near{animation:signinCloudsNear 34s ease-in-out infinite alternate}
@keyframes signinCloudsFar{from{transform:translate3d(-4%,-.5%,0) scale(1.06)}to{transform:translate3d(4%,.8%,0) scale(1.06)}}
@keyframes signinCloudsNear{from{transform:translate3d(4.5%,.6%,0) scale(1.08)}to{transform:translate3d(-4.5%,-.4%,0) scale(1.08)}}
body.signin-page.signin-motion-idle .signin-cloud-layer{animation-play-state:paused}
@media (prefers-reduced-motion:reduce){body.signin-page .signin-cloud-layer{animation:none}}
body.signin-page .signin-footer>span{background:rgba(255,255,255,.82);color:#3b4654;padding:4px 10px;border-radius:999px}
