*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a1a;
    background: #f5f5f5;
    min-height: 100vh;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #1c1c1c;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-top {
    padding: 1.25rem 0;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0 1.25rem 1rem;
    border-bottom: 1px solid #2e2e2e;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    width: 22px;
    height: 22px;
}

.nav-links {
    display: flex;
    flex-direction: column;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #777;
    padding: 1rem 1.25rem 0.35rem;
}

.nav-section-label:first-child {
    padding-top: 0.25rem;
}

.nav-links a,
.nav-settings {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
    transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-settings:hover {
    color: #fff;
    background: #2e2e2e;
}

.nav-links svg,
.nav-settings svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* Sidebar bottom */
.sidebar-bottom {
    padding: 1rem 0;
    border-top: 1px solid #2e2e2e;
}


.nav-user {
    padding: 0.75rem 1.25rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid #2e2e2e;
}

.nav-user-name {
    display: block;
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.25rem;
}

.nav-user a {
    color: #777;
    text-decoration: none;
    font-size: 0.8rem;
}

.nav-user a:hover {
    color: #fff;
}

/* Main content */
main {
    flex: 1;
    margin-left: 220px;
    padding: 2rem 2.5rem;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.page-header-subtitle {
    width: 100%;
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.1rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Tabs */
.tab-bar {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid #ddd;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
    color: #e93124;
}

.tab.active {
    color: #e93124;
    font-weight: 600;
    border-bottom-color: #e93124;
}

.tab-bar-search {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #fff;
    margin-bottom: 4px;
}

.tab-bar-search svg {
    width: 15px;
    height: 15px;
    color: #999;
    flex-shrink: 0;
}

.tab-bar-search-input {
    border: none;
    outline: none;
    font-size: 0.83rem;
    color: #1a1a1a;
    width: 180px;
    background: transparent;
}

.tab-bar-search-input::placeholder {
    color: #aaa;
}

/* Data table */
.table-wrap {
    overflow-x: auto;
    padding-bottom: 4rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: #666;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #f5f5f5;
}

.data-table .text-right {
    text-align: right;
}

/* Sortable columns */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.4rem;
}

.data-table th.sortable:hover {
    color: #333;
}

.data-table th.sortable .sort-arrow {
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    color: #bbb;
    line-height: 1;
}

.data-table th.sortable.sort-asc .sort-arrow,
.data-table th.sortable.sort-desc .sort-arrow {
    color: #333;
}

.data-table .cell-order-num a {
    color: #1a1a1a;
    font-weight: 600;
    text-decoration: none;
}

.data-table .cell-order-num a:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    padding: 2rem 0.75rem !important;
    color: #999;
}

/* Accounts table — truncation */
.col-name,
.col-contact,
.col-email,
.col-address {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.col-name    { width: 30%; }
.col-contact { width: 18%; }
.col-email   { width: 22%; }
.col-address { width: 22%; }

@media (max-width: 900px) {
    .col-contact { display: none; }
}

@media (max-width: 700px) {
    .col-email { display: none; }
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Shipping status */
.badge-fulfilled            { background: #e6f4ea; color: #1a7f37; }
.badge-not-shipped,
.badge-unfulfilled          { background: #fce8e8; color: #c00; }
.badge-partially-fulfilled,
.badge-backlog              { background: #fff3e0; color: #b45309; }

/* Order status */
.badge-so-active            { background: #e6f4ea; color: #1a7f37; }
.badge-so-draft             { background: #eee; color: #666; }
.badge-so-voided            { background: #fce8e8; color: #c00; }

/* Estimate status */
.badge-est-draft             { background: #eee; color: #666; }
.badge-est-active            { background: #e0ecff; color: #1a56db; }
.badge-est-voided            { background: #fce8e8; color: #c00; }
.badge-est-converted         { background: #e6f4ea; color: #1a7f37; }
.badge-est-deleted           { background: #eee; color: #999; }

.est-converted-banner {
    background: #e0ecff;
    color: #1a56db;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.est-converted-banner a {
    color: #1a56db;
    text-decoration: underline;
    font-weight: 600;
}

/* Invoice status */
.badge-inv-invoiced         { background: #e6f4ea; color: #1a7f37; }
.badge-inv-not-invoiced     { background: #fff3e0; color: #b45309; }

/* PO order status */
.badge-po-active            { background: #e6f4ea; color: #1a7f37; }
.badge-po-draft             { background: #eee; color: #666; }
.badge-po-received          { background: #e6f4ea; color: #1a7f37; }
.badge-po-awaiting-shipment { background: #fff3e0; color: #b45309; }
.badge-po-voided            { background: #fce8e8; color: #c00; }

/* Receiving status */
.badge-recv-fully-received     { background: #e6f4ea; color: #1a7f37; }
.badge-recv-not-received       { background: #fce8e8; color: #c00; }
.badge-recv-partially-received { background: #fff3e0; color: #b45309; }

/* Purpose badges */
.badge-purpose-stock          { background: #e8f0fe; color: #1a56db; }
.badge-purpose-customer-order { background: #fff3e0; color: #b45309; }
.badge-purpose-shop-job       { background: #eee; color: #666; }

/* Item status badges */
.badge-item-active            { background: #e6f4ea; color: #1a7f37; }
.badge-item-draft             { background: #eee; color: #666; }
.badge-item-archived          { background: #fff3e0; color: #b45309; }
.badge-kit                    { background: #ede9fe; color: #6d28d9; }

/* Kit component rows in shipping */
.kit-header-row               { background: #faf5ff; }
.kit-component-row td:first-child { font-style: italic; }

/* Item availability badges */
.badge-avail-fully-available      { background: #e6f4ea; color: #1a7f37; }
.badge-avail-partially-available  { background: #fff3e0; color: #b45309; }
.badge-avail-unavailable          { background: #fce8e8; color: #c00; }

/* Invoice dropdown */
.cell-invoice {
    position: relative;
}

.invoice-dropdown {
    position: relative;
    display: inline-block;
}

.invoice-dropdown summary {
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.invoice-dropdown summary::-webkit-details-marker {
    display: none;
}

.invoice-dropdown .caret {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: transform 0.15s;
}

.invoice-dropdown[open] .caret {
    transform: rotate(180deg);
}

.invoice-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 10;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0;
    min-width: 190px;
    white-space: nowrap;
}

.invoice-info {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    color: #666;
}

.invoice-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.1s;
}

.invoice-link:hover {
    background: #f5f5f5;
}

.invoice-link svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Login page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    color: #1a1a1a;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-error {
    background: #fee;
    color: #c00;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.login-field {
    margin-bottom: 1rem;
}

.login-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.35rem;
}

.login-field .form-input {
    width: 100%;
    box-sizing: border-box;
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: #e93124;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-login:hover {
    background: #c7281d;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-primary {
    background: #e93124;
    color: #fff;
}

.btn-primary:hover {
    background: #c7281d;
}

.btn-secondary {
    background: #e5e5e5;
    color: #333;
}

.btn-secondary:hover {
    background: #d5d5d5;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #bb2d3b;
}

.btn-accent {
    background: #1DBA1D;
    color: #fff;
}
.btn-accent:hover {
    background: #18a018;
}

.btn-print {
    background: #BB1D76;
    color: #fff;
}
.btn-print:hover {
    background: #9a1862;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

.btn-remove {
    background: none;
    border: none;
    color: #c00;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.btn-remove:hover {
    background: #fee;
}

/* Form layout */
.form-row {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }
.form-row-5 { grid-template-columns: repeat(5, 1fr); }

.form-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
}

.form-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.form-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #333;
    display: block;
    margin-bottom: 0.5rem;
}

.form-card-header .form-card-title {
    margin-bottom: 0;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-field-group {
    margin-top: 0.5rem;
}

.form-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #666;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #e93124;
}

input[type="date"].form-input {
    font-family: inherit;
}

.form-input-sm {
    width: 100px;
    padding: 0.3rem 0.5rem;
}

.form-input-table {
    width: 100%;
    font-size: 0.82rem;
    padding: 0.35rem 0.5rem;
}

.form-textarea {
    resize: vertical;
    font-family: inherit;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: #555;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    accent-color: auto;
}

.address-select-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.address-select-row .form-select {
    flex: 1;
}

.address-display {
    font-size: 0.83rem;
    color: #666;
    white-space: pre-line;
    line-height: 1.5;
    min-height: 2rem;
    padding: 0.5rem;
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #eee;
}

/* Line items table */
.line-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.line-items-table th {
    text-align: left;
    padding: 0.5rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #ddd;
}

.line-items-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.li-sku    { width: 18%; }
.li-item   { width: 32%; }
.li-qty    { width: 8%; }
.li-price  { width: 14%; }
.li-total,
.line-items-table th.li-total { width: 14%; text-align: right; }
.li-remove { width: 5%; text-align: center; }

.li-select {
    width: 100%;
}

.li-qty-input {
    width: 70px;
    text-align: center;
}

.li-price-input {
    width: 100px;
    text-align: right;
}

.li-line-total {
    text-align: right;
    font-weight: 500;
}

/* Autocomplete dropdown */
.li-sku-cell {
    position: relative;
}

.li-item-name {
    font-size: 0.83rem;
    color: #555;
}

.li-avail {
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.avail-in-stock {
    color: #16a34a;
}

.avail-out {
    color: #dc2626;
}

.ac-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 240px;
    overflow-y: auto;
}

.ac-option {
    padding: 0.45rem 0.6rem;
    font-size: 0.83rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ac-option:hover,
.ac-option.ac-active {
    background: #f5f5f5;
}

.ac-sku {
    font-weight: 600;
    color: #1a1a1a;
}

.ac-browse {
    color: #666;
    font-style: italic;
    border-top: 1px solid #eee;
}

/* Browse modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #666;
    padding: 0 0.25rem;
}

.modal-close:hover {
    color: #1a1a1a;
}

.modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
}

.modal-body > .form-input {
    margin-bottom: 0.75rem;
}

.modal-body .form-field-group {
    margin-top: 0.75rem;
}

.modal-body .form-field-group:first-child {
    margin-top: 0;
}

.modal-body .form-row {
    margin-top: 0.75rem;
}

.modal-body .form-row .form-field-group {
    margin-top: 0;
}

.modal-body .form-field-group .form-label {
    display: block;
    margin-bottom: 0.25rem;
}

.browse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.browse-table th {
    text-align: left;
    padding: 0.4rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

.browse-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.browse-table tbody tr:hover {
    background: #f5f5f5;
}

.browse-sku {
    font-weight: 600;
    white-space: nowrap;
}

.browse-desc {
    color: #666;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Payment summary */
.payment-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.payment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #555;
}

.payment-total {
    border-top: 2px solid #1a1a1a;
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    font-weight: 700;
    color: #1a1a1a;
    font-size: 0.95rem;
}

.money-input {
    margin-left: auto;
}

/* Form footer */
.form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Item viewer card */
.item-viewer {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
.item-viewer-img {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    height: 250px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
}
.item-viewer-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.item-viewer-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #aaa;
    font-size: 0.9rem;
}
.item-viewer-details {
    flex: 1;
    padding-top: 0.5rem;
}
.item-viewer-field {
    margin-bottom: 0.6rem;
}
.item-viewer-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #777;
    margin-bottom: 0.1rem;
}
.item-viewer-value {
    font-size: 0.9rem;
    color: #1a1a1a;
}
.item-viewer-field-row {
    display: flex;
    gap: 3rem;
}

/* Item sub-table tabs */
.item-tabs-section {
    margin-top: 2rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}

.item-tabs-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1rem;
}

.item-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.item-tab:hover {
    color: #e93124;
}

.item-tab.active {
    color: #e93124;
    font-weight: 600;
    border-bottom-color: #e93124;
}

.item-tab-content {
    min-height: 100px;
}

.item-tab-content .data-table {
    margin-bottom: 0;
}

.add-row td {
    padding-top: 0.5rem;
    border-bottom: none;
}

.form-select-sm,
.form-input-sm {
    font-size: 0.82rem;
    padding: 0.35rem 0.5rem;
}

.btn-sm {
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
}

/* Pictures grid */
.pictures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.picture-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fafafa;
}

.picture-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.picture-placeholder {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.8rem;
}

.picture-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
}

.picture-url-link {
    color: #666;
    text-decoration: none;
}

.picture-url-link:hover {
    text-decoration: underline;
}

/* 4-column form row */
.form-row-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Settings page */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.settings-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.settings-card-wide {
    grid-column: 1 / -1;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.settings-card-header svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #555;
}

.settings-card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
}

.settings-card-body {
    padding: 0;
}

.settings-card-body .data-table {
    margin-bottom: 0;
    border: none;
}

.settings-card-body .data-table thead th {
    background: #fff;
}

.settings-card-body .data-table tfoot td {
    background: #fff;
}

/* Reports landing page */
.reports-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.report-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.report-card:hover {
    border-color: #e93124;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.report-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-card-icon svg {
    width: 20px;
    height: 20px;
    color: #e93124;
}

.report-card-text h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.report-card-text p {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

/* Low stock highlight */
.text-low-stock {
    color: #c00;
    font-weight: 600;
}

/* Pick modal */
.pick-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pick-progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
}

.pick-progress-fill {
    height: 100%;
    background: #1a7f37;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.pick-progress-complete {
    background: #1a7f37;
}

.pick-progress-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    min-width: 3rem;
    text-align: right;
}

.pick-table .pick-qty-input {
    width: 5rem;
    text-align: right;
}

.pick-left-col {
    color: #666;
}

.pick-item-sku {
    color: #999;
    font-size: 0.8rem;
}

/* Pack tab */
.pack-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.pack-of-col {
    color: #666;
    white-space: nowrap;
}

.pack-container-select {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
}

.pack-container-title {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

.pack-container-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.5rem;
    transition: border-color 0.15s;
}

.pack-container-card:hover {
    border-color: #e93124;
}

.pack-container-card.selected {
    border-color: #e93124;
    background: #fef5f5;
}

.pack-container-icon svg {
    width: 24px;
    height: 24px;
    color: #555;
}

.pack-container-card.selected .pack-container-icon svg {
    color: #e93124;
}

.pack-container-text {
    flex: 1;
}

.pack-container-text strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.pack-container-text p {
    font-size: 0.78rem;
    color: #666;
    line-height: 1.3;
}

.pack-container-arrow {
    width: 16px;
    height: 16px;
    color: #ccc;
    flex-shrink: 0;
}

.pack-skip {
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 0.5rem;
}

.pack-skip p {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 0.75rem;
}

/* Ship tab */
.ship-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ship-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.ship-package-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}

.ship-package-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 8px;
    flex-shrink: 0;
}

.ship-package-icon svg {
    width: 22px;
    height: 22px;
    stroke: #555;
}

.ship-package-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ship-package-info strong {
    font-size: 0.9rem;
}

.ship-package-meta {
    font-size: 0.8rem;
    color: #888;
}

/* ─── Dashboard ─── */
.dash-period {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.dash-period-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dash-period-btn:hover {
    border-color: #e93124;
    color: #e93124;
}

.dash-period-btn.active {
    background: #e93124;
    color: #fff;
    border-color: #e93124;
    font-weight: 600;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.dash-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.dash-card:hover {
    border-color: #e93124;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dash-card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-card-icon svg {
    width: 24px;
    height: 24px;
}

.dash-icon-sales     { background: #e8f0fe; color: #1a56db; }
.dash-icon-revenue   { background: #e6f4ea; color: #1a7f37; }
.dash-icon-po        { background: #fff3e0; color: #b45309; }
.dash-icon-po-total  { background: #fce8e8; color: #c00; }
.dash-icon-shipped   { background: #e6f4ea; color: #1a7f37; }
.dash-icon-awaiting  { background: #fff3e0; color: #b45309; }

.dash-card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.dash-card-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

/* ─── Hamburger button (hidden on desktop) ─── */
.hamburger {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 210;
    background: #1c1c1c;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

/* Sidebar backdrop overlay (hidden on desktop) */
.sidebar-backdrop {
    display: none;
}

/* ─── Audit Report ─── */
.report-filters {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.report-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.report-filters .filter-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.report-filters .filter-group .form-input {
    width: auto;
    min-width: 140px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 1rem 0;
}

.page-link {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    background: #fff;
}

.page-link:hover {
    background: var(--bg-hover);
}

.page-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-ellipsis {
    border: none;
    background: none;
    cursor: default;
}

.badge-audit {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-login { background: #e8f4fd; color: #1a73e8; }
.badge-create { background: #e6f4ea; color: #1e7e34; }
.badge-update { background: #fff3cd; color: #856404; }
.badge-delete { background: #fde8e8; color: #c62828; }
.badge-adjust { background: #f3e8fd; color: #6a1b9a; }
.badge-import { background: #e0f2f1; color: #00695c; }
.badge-export { background: #fce4ec; color: #ad1457; }

.changes-cell {
    font-size: 0.8rem;
    max-width: 300px;
    word-break: break-word;
    color: var(--text-secondary);
}

.changes-cell .change-key {
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── Mobile breakpoint ─── */
@media (max-width: 768px) {
    /* Show hamburger */
    .hamburger {
        display: flex;
    }

    /* Sidebar: off-screen by default, slides in */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Backdrop */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 190;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Main content: remove left margin, add top padding for hamburger */
    main {
        margin-left: 0;
        padding: 3.5rem 1rem 2rem;
    }

    /* Page header */
    .page-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-header h1 {
        font-size: 1.2rem;
    }

    /* Tab bar: wrap on mobile */
    .tab-bar {
        flex-wrap: wrap;
    }

    .tab-bar-search {
        margin-left: 0;
        width: 100%;
        order: -1;
        margin-bottom: 0.5rem;
    }

    .tab-bar-search-input {
        width: 100%;
    }

    /* Form grids: stack to single column */
    .form-row-2,
    .form-row-3,
    .form-row-4,
    .form-row-5 {
        grid-template-columns: 1fr;
    }

    /* Settings grid: single column */
    .settings-grid {
        grid-template-columns: 1fr;
    }

    /* Pack layout: single column */
    .pack-layout {
        grid-template-columns: 1fr;
    }

    /* Data table: allow horizontal scroll, permit wrapping */
    .data-table td {
        white-space: normal;
    }

    /* Line items: tighter padding */
    .line-items-table th,
    .line-items-table td {
        padding: 0.35rem 0.3rem;
        font-size: 0.8rem;
    }

    /* Modal: full-width on mobile */
    .modal {
        width: 95%;
        max-height: 90vh;
    }

    /* Reports grid */
    .reports-grid {
        grid-template-columns: 1fr;
    }

    /* Dashboard grid */
    .dash-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dash-card-value {
        font-size: 1.5rem;
    }

    /* Login card */
    .login-card {
        margin: 1rem;
    }
}
