:root{--bg:#faf9f7;--surface:#fff;--text:#2c2c2c;--text-muted:#5c5c5c;--border:#e0ddd8;--accent:#8b6914;--accent-light:#c9a227;--quoted:#6b7280;--pop:#7c3aed;--paid:#2563eb;--cancelled:#dc2626;--dispatched:#d97706;--transit:#059669;--delivered:#047857;--ordered:#6b7280}*{box-sizing:border-box}body{background:var(--bg);color:var(--text);margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1.5}.header{background:var(--surface);border-bottom:1px solid var(--border);padding:1.5rem 2rem}.header-top{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:1rem;display:flex}.header h1{margin:0 0 .25rem;font-size:1.5rem;font-weight:600}.dashboard-nav{align-items:center;gap:.5rem;padding-top:.25rem;display:flex}.nav-link{color:var(--text-muted);border:1px solid var(--border);background:var(--surface);border-radius:6px;padding:.4rem 1rem;font-size:.9rem;font-weight:500;text-decoration:none;transition:border-color .15s,color .15s,background .15s}.nav-link:hover{color:var(--accent);border-color:var(--accent-light)}.nav-link-active{background:var(--accent);color:#fff;border-color:var(--accent)}.nav-link-active:hover{color:#fff}.user-menu{position:relative}.user-avatar{background:var(--accent);color:#fff;cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;width:2rem;height:2rem;font-size:.85rem;font-weight:700;transition:background .15s;display:flex}.user-avatar:hover{background:var(--accent-light)}.user-dropdown{background:var(--surface);border:1px solid var(--border);z-index:200;border-radius:8px;min-width:180px;position:absolute;top:calc(100% + .5rem);right:0;overflow:hidden;box-shadow:0 4px 16px #0000001a}.user-dropdown-header{color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em;border-bottom:1px solid var(--border);padding:.6rem 1rem;font-size:.75rem;font-weight:600}.user-dropdown-item{width:100%;color:var(--text);cursor:pointer;text-align:left;background:0 0;border:none;align-items:center;gap:.5rem;padding:.6rem 1rem;font-size:.875rem;text-decoration:none;transition:background .1s;display:flex}.user-dropdown-item:hover{background:var(--bg)}.user-dropdown-divider{background:var(--border);height:1px;margin:.25rem 0}.user-dropdown-signout{color:var(--cancelled)}.user-dropdown-signout:hover{background:#fff5f5}.xero-status{cursor:default}.xero-status-connected{color:#16a34a}.xero-status-disconnected{color:var(--text-muted);cursor:pointer}.xero-status-disconnected:hover{background:var(--bg);color:var(--text)}.subtitle{color:var(--text-muted);margin:0;font-size:.95rem}.main{max-width:1100px;margin:0 auto;padding:1.5rem 2rem}.filters{background:var(--surface);border:1px solid var(--border);border-radius:8px;flex-direction:column;gap:.75rem;margin-bottom:1.5rem;padding:1rem;display:flex}.filters-row{flex-wrap:wrap;align-items:flex-end;gap:.75rem;display:flex}.filters-actions{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.filters input[type=text],.filters input[type=date]{border:1px solid var(--border);background:var(--surface);min-width:140px;color:var(--text);border-radius:6px;padding:.5rem .75rem;font-size:.9rem}.filter-group{flex-direction:column;gap:.25rem;display:flex}.filter-group-search{flex:1;min-width:160px}.filter-group-search input{width:100%}.filter-group-label{color:var(--text-muted);text-transform:uppercase;letter-spacing:.03em;font-size:.75rem;font-weight:500}.match-waybills-status{color:var(--text-muted);margin:.5rem 0 1rem;font-size:.9rem}.match-waybills-status.match-waybills-status-success{color:var(--delivered)}.match-waybills-status.match-waybills-status-error{color:var(--cancelled)}.multi-select{position:relative}.multi-select-btn{border:1px solid var(--border);background:var(--surface);min-width:160px;color:var(--text);cursor:pointer;text-align:left;border-radius:6px;justify-content:space-between;align-items:center;gap:.5rem;padding:.5rem .75rem;font-size:.9rem;display:flex}.multi-select-btn:hover{border-color:var(--accent-light)}.multi-select-btn[aria-expanded=true]{border-color:var(--accent);outline:2px solid color-mix(in srgb,var(--accent)25%,transparent)}.multi-select-label{text-overflow:ellipsis;white-space:nowrap;max-width:130px;overflow:hidden}.multi-select-arrow{color:var(--text-muted);flex-shrink:0;font-size:.7rem}.multi-select-dropdown{z-index:200;background:var(--surface);border:1px solid var(--border);white-space:nowrap;border-radius:8px;min-width:100%;padding:.4rem 0;position:absolute;top:calc(100% + 4px);left:0;box-shadow:0 4px 16px #0000001f}.multi-select-dropdown label{cursor:pointer;width:100%;color:var(--text);text-align:left;box-sizing:border-box;border-radius:4px;margin:0;padding:.5rem 1rem;font-size:.9rem;transition:background .1s,color .1s;display:block}.multi-select-dropdown label:hover{background:var(--bg)}.multi-select-dropdown input[type=checkbox]{display:none}.multi-select-dropdown label:has(input:checked){background:var(--accent);color:#fff;font-weight:500}.btn{cursor:pointer;border:none;border-radius:6px;padding:.5rem 1rem;font-size:.9rem}.btn-primary{background:var(--accent);color:#fff}.btn-primary:hover{background:var(--accent-light)}.btn-secondary{background:var(--surface);color:var(--text);border:1px solid var(--border)}.btn-secondary:hover{background:var(--bg)}.summary-bar{background:var(--surface);border:1px solid var(--border);border-radius:8px;align-items:center;gap:0;margin-bottom:.75rem;padding:.85rem 1.25rem;display:flex}.summary-stat{flex-direction:column;gap:.2rem;padding:0 1.5rem;display:flex}.summary-stat:first-child{padding-left:0}.summary-label{text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);font-size:.75rem;font-weight:500}.summary-value{color:var(--text);font-size:1.25rem;font-weight:700}.summary-divider{background:var(--border);flex-shrink:0;width:1px;height:2.5rem}.pagination-bar{background:var(--surface);border:1px solid var(--border);color:var(--text-muted);border-radius:8px;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.75rem;margin-bottom:.75rem;padding:.75rem 1rem;font-size:.88rem;display:flex}.pagination-controls{flex-wrap:wrap;align-items:center;gap:1.25rem;display:flex}.rows-label{color:var(--text-muted);align-items:center;gap:.5rem;font-size:.88rem;display:flex}.rows-label select{border:1px solid var(--border);background:var(--surface);cursor:pointer;border-radius:6px;padding:.3rem .5rem;font-size:.88rem}.page-nav{align-items:center;gap:.35rem;display:flex}.btn-page{border:1px solid var(--border);background:var(--surface);cursor:pointer;width:32px;height:32px;color:var(--text);border-radius:6px;justify-content:center;align-items:center;font-size:1rem;transition:background .15s,border-color .15s;display:flex}.btn-page:hover:not(:disabled){background:var(--bg);border-color:var(--accent-light)}.btn-page:disabled{opacity:.35;cursor:default}.table-wrap{background:var(--surface);border:1px solid var(--border);border-radius:8px;overflow:hidden}.orders-table{border-collapse:collapse;width:100%}.orders-table th,.orders-table td{text-align:left;border-bottom:1px solid var(--border);padding:.75rem 1rem}.orders-table th{background:var(--bg);color:var(--text-muted);text-transform:uppercase;letter-spacing:.02em;font-size:.8rem;font-weight:600}.orders-table th.sortable{cursor:pointer;-webkit-user-select:none;user-select:none;white-space:nowrap}.orders-table th.sortable:hover{color:var(--text)}.sort-icon{opacity:.7;margin-left:.25rem;font-size:.7rem}.orders-table th.sort-asc .sort-icon:after{content:" ↑"}.orders-table th.sort-desc .sort-icon:after{content:" ↓"}.orders-table tbody tr{cursor:pointer}.orders-table tbody tr:hover{background:var(--bg)}.stage-badge{border-radius:999px;padding:.25rem .6rem;font-size:.8rem;font-weight:500;display:inline-block}.stage-Quoted{color:var(--quoted);background:#e5e7eb}.stage-SendPOP{color:var(--pop);background:#ede9fe}.stage-Paid{color:var(--paid);background:#dbeafe}.stage-Cancelled{color:var(--cancelled);background:#fee2e2}.stage-Dispatched{color:var(--dispatched);background:#ffedd5}.stage-In_transit{color:var(--transit);background:#d1fae5}.stage-Delivered{color:var(--delivered);background:#d1fae5}.stage-Ordered{color:var(--ordered);background:#e5e7eb}.stage-Collection{color:#92400e;background:#fef3c7}.stage-none{color:var(--text-muted);font-size:.85rem}.delivered-date{white-space:nowrap}.order-num-cell{white-space:nowrap;flex-wrap:nowrap;align-items:center;gap:.5rem;display:flex}.orders-table th:first-child,.orders-table td:first-child{min-width:160px}.source-badge{border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:20px;height:20px;line-height:1;display:inline-flex}.source-badge svg{width:12px;height:12px;display:block}.source-badge-xero{color:#1a6bbf;background:#e0f0ff}.source-badge-hubspot{color:#c1510c;background:#fff0e8}.source-toggle{border:1px solid var(--border);border-radius:6px;gap:0;display:flex;overflow:hidden}.source-toggle-btn{background:var(--surface);color:var(--text-muted);cursor:pointer;border:none;border-right:1px solid var(--border);padding:.5rem .75rem;font-size:.9rem;font-weight:500;transition:background .15s,color .15s}.source-toggle-btn:last-child{border-right:none}.source-toggle-btn:hover{background:var(--bg);color:var(--text)}.source-toggle-btn-all.active{background:var(--text);color:#fff}.source-toggle-btn-hubspot.active{color:#fff;background:#c1510c}.source-toggle-btn-xero.active{color:#fff;background:#1a6bbf}.total-cell{white-space:nowrap;font-weight:500}.orders-table td[data-date]{white-space:nowrap}.currency-code{color:var(--text-muted);vertical-align:middle;margin-left:.3rem;font-size:.65rem;font-weight:600}.order-detail-overlay{z-index:1000;background:#0006;justify-content:center;align-items:center;padding:1rem;display:flex;position:fixed;inset:0}.order-detail-overlay[hidden]{display:none}.order-detail-overlay .order-detail-inner{background:var(--surface);border:1px solid var(--border);border-radius:12px;width:100%;max-width:440px;max-height:90vh;padding:0;overflow-y:auto;box-shadow:0 8px 32px #00000026}.popup-header{justify-content:space-between;align-items:center;gap:1rem;padding:1.25rem 1.5rem 0;display:flex}.order-detail-inner h2{margin:0;font-size:1.25rem;font-weight:600}.popup-close-x{width:2rem;height:2rem;color:var(--text-muted);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0;font-size:1.5rem;line-height:1;display:flex}.popup-close-x:hover{background:var(--bg);color:var(--text)}.popup-body{padding:1rem 1.5rem 1.25rem}.popup-stages{flex-wrap:wrap;gap:1.5rem;margin-bottom:1rem;display:flex}.popup-stage-group{flex-direction:column;gap:.35rem;min-width:120px;display:flex}.popup-stage-label{text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);font-size:.75rem;font-weight:600}.popup-stage-row{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.popup-stage-select{border:1px solid var(--border);background:var(--surface);color:var(--text);cursor:pointer;border-radius:6px;outline:none;padding:.25rem .5rem;font-family:inherit;font-size:.8rem}.popup-stage-select:focus{border-color:var(--accent)}.popup-customer{margin-bottom:1rem}.popup-customer-name{margin-bottom:.25rem;font-size:1rem;font-weight:600}.popup-customer-detail{color:var(--text-muted);margin-bottom:.2rem;font-size:.875rem;line-height:1.4}.popup-customer-email{color:var(--text-muted);margin-bottom:.5rem;font-size:.9rem}.popup-customer-address{color:var(--text-muted);margin-top:.15rem;font-size:.85rem}.popup-divider{border:none;border-top:1px solid var(--border);margin:1rem 0}.popup-section-title{color:var(--text);align-items:center;gap:.35rem;margin-bottom:.5rem;font-size:.9rem;font-weight:500;display:flex}.popup-items-box{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:.75rem 1rem}.popup-item-line{color:var(--text);margin-bottom:.5rem;font-size:.9rem}.popup-item-row{color:var(--text);justify-content:space-between;margin-bottom:.35rem;font-size:.9rem;display:flex}.popup-item-row:last-of-type{margin-bottom:0}.shipping-row{color:var(--text-muted);border-top:1px dashed var(--border);margin-top:.15rem;padding-top:.35rem;font-style:italic}.popup-total-row{border-top:1px solid var(--border);justify-content:space-between;padding-top:.5rem;font-size:.95rem;display:flex}.popup-waybill{margin-bottom:.35rem;font-size:.9rem}.popup-waybill-none{color:var(--text-muted);margin-bottom:.75rem;font-size:.85rem;font-style:italic}.popup-waybill-display{align-items:center;gap:.6rem;margin-bottom:.35rem;display:flex}.btn-inline-edit{border:1px solid var(--border);color:var(--accent);cursor:pointer;background:0 0;border-radius:5px;padding:.15rem .55rem;font-family:inherit;font-size:.78rem;transition:background .12s,border-color .12s}.btn-inline-edit:hover{border-color:var(--accent);background:#8b691412}.popup-waybill-entry{margin-top:.25rem}.popup-waybill-label{color:var(--text-muted);margin-bottom:.4rem;font-size:.85rem;display:block}.popup-waybill-row{align-items:center;gap:.5rem;display:flex}.popup-waybill-input{border:1px solid var(--border);background:var(--surface);color:var(--text);letter-spacing:.03em;border-radius:6px;outline:none;flex:1;padding:.45rem .75rem;font-family:inherit;font-size:.9rem;transition:border-color .15s}.popup-waybill-input:focus{border-color:var(--accent);box-shadow:0 0 0 2px #8b69141f}.btn-sm{white-space:nowrap;padding:.45rem 1rem;font-size:.85rem}.popup-waybill-status{min-height:1.2em;margin-top:.4rem;font-size:.8rem}.popup-waybill-status-error{color:#dc2626}.popup-waybill-status-success{color:var(--delivered)}.popup-track-link{color:var(--accent);margin-bottom:.75rem;font-size:.9rem;text-decoration:none;display:inline-block}.popup-track-link:hover{text-decoration:underline}.tracking-timeline{border:1px solid var(--border);background:#f9f7f4;border-radius:8px;flex-direction:column;gap:.5rem;margin:.75rem 0;padding:.75rem 1rem;display:flex}.tracking-event{align-items:flex-start;gap:.6rem;display:flex}.tracking-event-icon{flex-shrink:0;margin-top:.1rem;font-size:1rem}.tracking-event-body{flex-direction:column;display:flex}.tracking-event-desc{color:var(--text);font-size:.875rem;font-weight:500}.tracking-event-date{color:var(--text-muted);margin-top:.1rem;font-size:.8rem}.tracking-event-delivered .tracking-event-desc{color:#2d7a4f}.delivered-date{color:#2d7a4f;font-size:.875rem;font-weight:500}.order-detail-inner>.btn{width:calc(100% - 3rem);margin:0 1.5rem 1.5rem;display:block}.panel-error{color:var(--text-muted);margin:0;padding:1rem 1.5rem}
