/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Remove number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f5f5f5;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 10px;
}

.login-subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

/* Navigation */
.main-nav {
    background: #2c3e50;
    color: white;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-title h1 {
    font-size: 24px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255,255,255,0.9);
}

.nav-tabs {
    display: flex;
    overflow-x: auto;
    background: rgba(0,0,0,0.2);
}

.nav-tab {
    padding: 15px 25px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-tab:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-tab.active {
    color: white;
    border-bottom-color: #3498db;
    background: rgba(255,255,255,0.05);
}

/* Container and Sections */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Quotes & Orders: fill the viewport, pagination pinned to bottom */
#quotes.active,
#orders.active {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 130px);
}

#quoteList,
#orderList {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#quoteList > .card,
#orderList > .card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#quoteList > .card > .pagination-container,
#orderList > .card > .pagination-container {
    margin-top: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Cards */
.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

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

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
}

th {
    background: #3498db;
    color: white;
    padding: 12px;
    text-align: left;
    font-size: 13px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
}

/* Actions column - keep buttons on same line */
td:last-child {
    white-space: nowrap;
}

td:last-child .btn-sm {
    margin-right: 5px;
    margin-bottom: 5px;
}

tr:hover {
    background: #f8f9fa;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: bold;
}

/* Search Box */
.search-box {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-box input {
    padding: 10px 15px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    width: 100%;
    max-width: 400px;
}

/* Chart Container */
.chart-container {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.chart-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #2c3e50;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.chart-label {
    min-width: 150px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.chart-bar-bg {
    flex: 1;
    background: #ecf0f1;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    background: linear-gradient(90deg, #3498db, #2ecc71);
    height: 100%;
    display: flex;
    align-items: center;
    padding-right: 10px;
    justify-content: flex-end;
}

.chart-value {
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Line Items */
.line-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.line-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.mod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.mod-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px;
    border-radius: 4px;
}

.mod-item input {
    width: 70px;
    flex-shrink: 0;
}

.mod-item label {
    margin: 0;
    font-weight: normal;
    font-size: 13px;
}

/* Job Cards (Shop Floor) */
.job-card {
    background: white;
    border: 4px solid #2196F3;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.job-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.job-card.collapsed .job-content {
    display: none;
}

.job-card.collapsed {
    padding: 15px 25px;
}

.job-content {
    margin-top: 15px;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

.job-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.job-status {
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    background: #E3F2FD;
    color: #1976D2;
    border: 2px solid #2196F3;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.detail-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.detail-label {
    font-weight: bold;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

/* Files Section */
.files-section {
    margin: 20px 0;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 8px;
    border: 2px dashed #2196F3;
}

.file-link {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px;
    background: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    overflow: hidden;
    border-top: 5px solid #3498db;
    transition: transform 0.3s;
}

.summary-card.warning-card {
    border-top: 5px solid #e74c3c;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.summary-pieces {
    font-size: 14px;
    opacity: 0.9;
}

.summary-body {
    padding: 25px;
}

.sheet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #ecf0f1;
}

.sheet-row:last-child {
    border-bottom: none;
}

.sheet-label {
    font-size: 16px;
    color: #7f8c8d;
    font-weight: 500;
}

.sheet-count {
    font-size: 36px;
    font-weight: bold;
    color: #2c3e50;
}

.sheet-count.zero {
    color: #bdc3c7;
    font-size: 24px;
}

.sheet-size {
    font-size: 18px;
    font-weight: 600;
    color: #3498db;
}

.total-row {
    background: #f8f9fa;
    padding: 20px;
    margin-top: 10px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-row.status-ok {
    background: #d4edda;
    border-left: 4px solid #27ae60;
}

.total-row.status-warning {
    background: #fff3cd;
    border-left: 4px solid #e74c3c;
}

.status-text {
    font-size: 18px;
    font-weight: bold;
}

.status-ok .status-text {
    color: #27ae60;
}

.status-warning .status-text {
    color: #e74c3c;
}

.total-label {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.total-count {
    font-size: 42px;
    font-weight: bold;
    color: #27ae60;
}

.stock-warning {
    margin-top: 15px;
    padding: 12px;
    background: #fff3cd;
    border-left: 4px solid #e74c3c;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
    font-weight: 500;
}

.stock-warning + .stock-warning {
    margin-top: 8px;
}

.order-summary {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    margin-bottom: 30px;
    border-left: 6px solid #27ae60;
}

.order-summary h2 {
    color: #27ae60;
    margin-bottom: 20px;
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.order-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 6px;
    border: 2px solid #27ae60;
    text-align: center;
}

.order-item.warning {
    border: 2px solid #e74c3c;
    background: #fff3cd;
}

.order-item-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
}

.order-item-count {
    font-size: 56px;
    font-weight: bold;
    color: #27ae60;
    margin-bottom: 10px;
}

.order-item-details {
    font-size: 13px;
    color: #7f8c8d;
    line-height: 1.6;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 10px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

/* Cards inside modals don't need their own raised look — the modal is already a container */
.modal-content .card {
    box-shadow: none;
    border: 1px solid #e8e8e8;
    padding: 14px 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.modal-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    background: none;
    border: none;
}

/* File Upload */
.file-drop-zone {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    margin-top: 15px;
}

.file-list {
    margin-top: 15px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}

.file-name {
    flex: 1;
    min-width: 0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
}

.file-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3498db;
    color: white;
    border-radius: 4px;
    font-weight: bold;
    font-size: 18px;
}

/* Progress Bar */
.progress-bar-container {
    background: #e0e0e0;
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

.progress-bar {
    background: #3498db;
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

/* Print Styles */
.print-document {
    display: none;
}

.print-document.visible {
    display: block;
    background: white;
    padding: 20px;
    border-radius: 0;
    max-width: 100%;
    margin: 0 auto;
    box-shadow: none;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print Media Queries */
@media print {
    .main-nav, .container > .content-section:not(#print) {
        display: none !important;
    }

    #print > .card, #print > .section-header, #print > h2 {
        display: none !important;
    }

    .print-document {
        display: block !important;
    }

    body {
        background: white;
    }

    /* Ensure table headers print correctly */
    table th {
        background: #3498db !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
/* QuickBooks Sync Management Styles */
.sync-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fafafa;
}

.sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.sync-header h4 {
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.sync-description {
    margin: 0;
    color: #7f8c8d;
    font-size: 14px;
}

.sync-status {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #2196F3;
}

.sync-status.success {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.sync-status.error {
    background: #ffebee;
    border-left-color: #f44336;
}

.sync-results {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
}

.sync-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.sync-item:last-child {
    border-bottom: none;
}

.sync-item-name {
    font-weight: 500;
    color: #333;
}

.sync-item-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.sync-item-status.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.sync-item-status.error {
    background: #ffebee;
    color: #c62828;
}

.sync-summary {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.sync-summary h4 {
    color: white;
    margin-bottom: 20px;
}

.sync-summary .stat-card {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

.sync-summary .stat-card h3,
.sync-summary .stat-card .stat-value,
.sync-summary .stat-card small {
    color: white;
}

.danger-zone {
    margin-top: 30px;
    padding: 20px;
    background: #fff3e0;
    border: 2px solid #ff9800;
    border-radius: 8px;
}

.danger-zone h4 {
    color: #e65100;
    margin-bottom: 10px;
}

.danger-zone p {
    color: #f57c00;
    margin-bottom: 15px;
}

.progress-fill {
    background: linear-gradient(90deg, #2196F3, #4caf50);
    height: 100%;
    transition: width 0.3s ease;
}

/* Password Modal Styles */
.modal-body {
    padding: 20px 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.danger-warning {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 15px;
    margin-bottom: 20px;
    color: #e65100;
    font-weight: 500;
    border-radius: 4px;
}

#dangerZonePassword {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ff9800;
}

#dangerZonePassword:focus {
    border-color: #e65100;
    outline: none;
}

/* ============================================
   QUICKBOOKS INTEGRATION STYLES
   ============================================ */

/* QuickBooks Badge Styles */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin: 0 5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* QuickBooks Connection Card */
#quickbooksConnection {
    min-height: 100px;
}

#quickbooksConnection .alert {
    margin-bottom: 15px;
}

#quickbooksConnection button {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* QuickBooks Button in Tables */
table .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
}

/* QuickBooks Sync Status */
.qb-sync-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #e8f5e9;
    color: #2e7d32;
}

.qb-not-synced {
    background: #fff3e0;
    color: #e65100;
}

/* QuickBooks Connect Button */
.qb-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #2ca01c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(44, 160, 28, 0.3);
}

.qb-connect-btn:hover {
    background: #248c17;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 160, 28, 0.4);
}

.qb-connect-btn img {
    height: 24px;
}

/* QuickBooks Info Grid */
.qb-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.qb-info-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #2ca01c;
}

.qb-info-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.qb-info-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

/* QuickBooks Action Buttons */
.qb-action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* QuickBooks Status Indicator */
.qb-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.qb-status-connected {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.qb-status-disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* QuickBooks Loading State */
.qb-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2ca01c;
    border-radius: 50%;
    animation: qb-spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes qb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* QuickBooks Invoice/Estimate Badge */
.qb-document-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #2ca01c 0%, #1e7a0f 100%);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(44, 160, 28, 0.2);
}

/* QuickBooks Sync Progress */
.qb-sync-progress {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2ca01c;
}

.qb-sync-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.qb-sync-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ca01c 0%, #1e7a0f 100%);
    transition: width 0.3s ease;
}

.qb-sync-progress-text {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
}

/* QuickBooks Error Message */
.qb-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 15px 0;
}

/* QuickBooks Success Message */
.qb-success {
    padding: 15px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin: 15px 0;
}

/* QuickBooks Info Message */
.qb-info {
    padding: 15px;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    margin: 15px 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .qb-action-buttons {
        flex-direction: column;
    }

    .qb-action-buttons button {
        width: 100%;
    }

    .qb-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles for QB Documents */
@media print {
    .qb-connect-btn,
    .qb-action-buttons,
    .btn-sm {
        display: none !important;
    }

    .qb-document-badge {
        background: white;
        color: black;
        border: 1px solid black;
    }
}

/* ============================================
   PAGINATION CONTROLS
   ============================================ */

.pagination-container {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pagination-info {
    text-align: center;
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 15px;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    min-width: 40px;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.pagination-btn.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
    font-weight: bold;
    cursor: default;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #bdc3c7;
    color: #bdc3c7;
}

.pagination-ellipsis {
    padding: 8px 12px;
    color: #7f8c8d;
    font-weight: bold;
}

/* Legacy pagination classes */
.page-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.page-btn:hover:not(:disabled) {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #bdc3c7;
    color: #bdc3c7;
}

.page-info {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
    min-width: 100px;
    text-align: center;
}

/* ============================================
   LABEL PRINTING STYLES
   ============================================ */

.label-print-container {
    font-family: 'Arial', sans-serif;
    background: white;
}

.product-label {
    width: 4in;
    height: 6in;
    padding: 0.3in;
    box-sizing: border-box;
    page-break-after: always;
    border: 2px solid #000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-label:last-child {
    page-break-after: auto;
}

.label-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 10px;
}

.label-logo {
    max-width: 1.2in;
    max-height: 1in;
    object-fit: contain;
}

.label-company-info {
    flex-grow: 1;
}

.label-company-info h1 {
    font-size: 22pt;
    font-weight: bold;
    margin: 0 0 5px 0;
    text-transform: uppercase;
}

.label-contact {
    font-size: 10pt;
    color: #333;
    line-height: 1.4;
}

.label-divider {
    border-top: 3px solid #000;
    margin: 10px 0 15px 0;
}

.label-body {
    flex-grow: 1;
    font-size: 14pt;
}

.label-order-number {
    font-size: 18pt;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    padding: 10px;
    background: #f0f0f0;
    border: 2px solid #000;
}

.label-row {
    margin: 12px 0;
    display: flex;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
}

.label-row strong {
    min-width: 110px;
    font-weight: bold;
}

.label-row span {
    flex-grow: 1;
    font-weight: bold;
}

.label-footer {
    text-align: center;
    border-top: 3px solid #000;
    padding-top: 15px;
    margin-top: 15px;
}

.label-counter {
    font-size: 28pt;
    font-weight: bold;
}

/* ============================================
   SUB-TAB NAVIGATION (FOR SHOP FLOOR)
   ============================================ */

.sub-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.sub-tab {
    padding: 10px 20px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.sub-tab:hover {
    background: #ecf0f1;
    transform: translateY(-1px);
}

.sub-tab.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page-controls {
        flex-direction: column;
        gap: 10px;
    }

    .page-btn {
        width: 100%;
    }

    .pagination-controls {
        gap: 5px;
    }

    .pagination-btn {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 35px;
    }

    .sub-tabs {
        flex-direction: column;
    }

    .sub-tab {
        width: 100%;
        text-align: center;
    }
}

/* ============================================
   CALENDAR VIEW STYLES
   ============================================ */

.calendar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.calendar-header h2 {
    margin: 0;
    font-size: 24px;
    min-width: 200px;
    text-align: center;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    color: #495057;
}

.calendar-day {
    min-height: 100px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px;
    background: white;
    position: relative;
    transition: all 0.2s;
}

.calendar-day.empty {
    background: #f8f9fa;
    border-color: transparent;
}

.calendar-day.today {
    border-color: #3498db;
    border-width: 2px;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.calendar-day.past-due {
    background: #ffebee;
}

.calendar-day.has-orders:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #3498db;
}

.calendar-day-number {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    color: #495057;
}

.calendar-day-orders {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day-badge {
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.calendar-order {
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-order:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Day Orders Modal Styles */
.day-orders-container {
    max-height: 500px;
    overflow-y: auto;
}

.day-order-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.day-order-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.day-order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 10px;
}

.day-order-header strong {
    font-size: 16px;
    color: #2c3e50;
}

.day-order-status {
    padding: 4px 12px;
    border-radius: 20px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.day-order-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
}

.day-order-details div {
    color: #495057;
}

.day-order-details strong {
    color: #2c3e50;
    margin-right: 5px;
}

.day-order-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Mobile responsive calendar */
@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 5px;
    }

    .calendar-day {
        min-height: 80px;
        padding: 5px;
    }

    .calendar-day-number {
        font-size: 12px;
    }

    .calendar-order {
        font-size: 9px;
        padding: 3px 5px;
    }

    .calendar-header h2 {
        font-size: 18px;
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .calendar-day-header {
        padding: 5px;
        font-size: 12px;
    }

    .calendar-day {
        min-height: 60px;
        padding: 3px;
    }

    .calendar-day-number {
        font-size: 10px;
    }

    .calendar-order {
        font-size: 8px;
        padding: 2px 4px;
    }
}

/* Print Preview Styles */
.print-preview {
    display: none;
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.print-preview.visible {
    display: block;
}

/* Print Media Query - Hide everything except print container when printing */
@media print {
    body * {
        visibility: hidden;
    }

    .print-container, .print-container * {
        visibility: visible;
    }

    .print-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .print-preview {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
}

/* ============================================
   ORDER HISTORY TIMELINE
   ============================================ */

.order-timeline {
    padding: 4px 0 8px;
}

.timeline-loading {
    color: #999;
    text-align: center;
    padding: 24px 0;
}

.timeline-item {
    display: flex;
    gap: 14px;
    padding: 10px 0;
    position: relative;
}

/* Vertical connector line between dots */
.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 17px;
    top: 40px;
    bottom: -10px;
    width: 2px;
    background: #e0e0e0;
}

.timeline-dot {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    z-index: 1;
}

.timeline-body {
    flex: 1;
    padding-top: 4px;
}

.timeline-label {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.3;
}

.timeline-detail {
    font-size: 13px;
    color: #555;
    margin-top: 2px;
}

.timeline-meta {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 12px;
    color: #95a5a6;
    flex-wrap: wrap;
}

.timeline-who {
    color: #7f8c8d;
}

/* ============================================
   PROJECTS MODULE — Gantt Chart & Calendar
   ============================================ */

/* Gantt chart outer wrapper: fixed label column + scrollable bars */
.gantt-wrapper {
    display: flex;
    overflow: hidden;
    border: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
}

/* Fixed left label column */
.gantt-label-col {
    flex-shrink: 0;
    width: 180px;
    min-width: 180px;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
    z-index: 2;
}

.gantt-row-label-only {
    height: 32px;
    line-height: 32px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid #eee;
    color: #2c3e50;
}

.gantt-header-spacer {
    background: #f8f9fa;
}

/* Scrollable chart area */
.gantt-scroll-area {
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
}

/* Month + day header rows */
.gantt-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    border-bottom: 2px solid #dee2e6;
}

.gantt-month-header {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 700;
    background: #2c3e50;
    color: #fff;
    border-right: 1px solid rgba(255,255,255,0.2);
    white-space: nowrap;
    overflow: hidden;
}

.gantt-day-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    font-size: 11px;
    color: #7f8c8d;
    border-right: 1px solid #eee;
    user-select: none;
}

.gantt-today-header {
    background: #e8f4f8 !important;
    color: #2980b9 !important;
    font-weight: 700;
}

/* Body rows */
.gantt-body {
    position: relative;
}

.gantt-body-row {
    height: 32px;
    border-bottom: 1px solid #eee;
    position: relative;
}

/* Gantt bar */
.gantt-bar {
    position: absolute;
    top: 5px;
    height: 22px;
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    line-height: 22px;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 6px;
    cursor: default;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: opacity .15s;
}

.gantt-bar:hover { opacity: 0.85 !important; }

.gantt-bar-label {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Today vertical line */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(231, 76, 60, 0.7);
    pointer-events: none;
    z-index: 1;
}

/* Project calendar enhancements */
.calendar-day-has-events {
    background: #f0f7ff;
}

.calendar-day-today {
    border: 2px solid #3498db !important;
}

/* ============================================================
   MOBILE NAV COMPONENTS
   ============================================================ */

/* Mobile header — hidden on desktop */
.mobile-nav-header {
    display: none;
}

/* Mobile dropdown — hidden until toggled */
.mobile-nav-dropdown {
    display: flex;
    flex-direction: column;
    background: #1a252f;
    border-top: 1px solid rgba(255,255,255,0.08);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 200;
}

.mobile-nav-dropdown.hidden {
    display: none;
}

.mobile-nav-item {
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    padding: 14px 20px;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background 0.15s;
}

.mobile-nav-item:hover,
.mobile-nav-item-active {
    background: rgba(52,152,219,0.25);
    color: #fff;
}

/* Mobile status badge — hidden on desktop, shown on mobile via media query */
.mobile-status-btn { display: none; }

/* ============================================================
   MOBILE RESPONSIVE — primary breakpoint 768px
   ============================================================ */

@media (max-width: 768px) {

    /* ── Nav: hide desktop elements, show mobile ───────────── */
    .desktop-nav-header { display: none; }
    .nav-tabs           { display: none; }

    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        gap: 8px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .mobile-nav-title {
        font-size: 15px;
        font-weight: 700;
        color: #fff;
        white-space: nowrap;
    }

    .mobile-nav-actions {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .mobile-icon-btn {
        background: rgba(255,255,255,0.1);
        border: none;
        color: #fff;
        border-radius: 6px;
        padding: 6px 10px;
        font-size: 14px;
        cursor: pointer;
        white-space: nowrap;
    }

    .mobile-menu-btn {
        background: rgba(52,152,219,0.4);
        font-weight: 600;
        gap: 4px;
    }

    /* ── Container ─────────────────────────────────────────── */
    .container { padding: 8px; }

    /* ── Shop Floor job cards ───────────────────────────────── */
    .job-content {
        overflow-x: auto;
    }
    .job-content table {
        min-width: 0;
        width: 100%;
    }

    /* ── Cards ─────────────────────────────────────────────── */
    .card { padding: 12px; margin-bottom: 10px; }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .section-header > div { display: flex; flex-wrap: wrap; gap: 6px; }

    /* ── Tables → card layout ──────────────────────────────── */
    /* Each row becomes its own card; header hidden */
    .data-table {
        display: block;
        overflow: visible;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .data-table tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        padding: 10px 12px;
        gap: 4px;
        border: 1px solid #eee;
    }

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

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 3px 0;
        border: none;
        font-size: 13px;
        gap: 8px;
    }

    /* First cell = primary identifier — make it prominent */
    .data-table td:first-child {
        font-weight: 700;
        font-size: 14px;
        padding-bottom: 6px;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 2px;
    }

    /* Last cell = actions — push to bottom, allow wrap */
    .data-table td:last-child {
        white-space: normal;
        padding-top: 6px;
        margin-top: 2px;
        border-top: 1px solid #f0f0f0;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Plain non-.data-table tables still get horizontal scroll */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table:not(.data-table) { min-width: 500px; }

    /* ── Mobile card layout for Orders, Quotes, Pending ───────── */
    /* No HTML changes — purely CSS targeting container IDs        */
    #orderList table,
    #quoteList table,
    #pendingList table {
        display: block;
        min-width: 0 !important;
        width: 100%;
    }
    #orderList table thead,
    #quoteList table thead,
    #pendingList table thead {
        display: none;
    }
    #orderList table tbody,
    #quoteList table tbody,
    #pendingList table tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    #orderList table tr,
    #quoteList table tr,
    #pendingList table tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        padding: 10px 12px;
        gap: 3px;
        border: 1px solid #eee;
        width: 100%;
        box-sizing: border-box;
    }
    #orderList table td,
    #quoteList table td,
    #pendingList table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 3px 0;
        border: none;
        font-size: 13px;
        gap: 8px;
        min-width: 0;
        box-sizing: border-box;
        width: 100%;
    }
    /* First cell = primary identifier */
    #orderList table td:first-child,
    #quoteList table td:first-child,
    #pendingList table td:first-child {
        font-weight: 700;
        font-size: 15px;
        padding-bottom: 6px;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 2px;
    }
    /* Last cell = actions */
    #orderList table td:last-child,
    #quoteList table td:last-child {
        padding-top: 6px;
        margin-top: 2px;
        border-top: 1px solid #f0f0f0;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Labels via ::before on non-hidden cells */
    #orderList table td:nth-child(2)::before  { content: "Customer"; }
    #orderList table td:nth-child(3)::before  { content: "Job"; }
    #quoteList table td:nth-child(2)::before  { content: "Customer"; }
    #quoteList table td:nth-child(3)::before  { content: "Job"; }
    #pendingList table td:nth-child(2)::before { content: "Customer"; }
    #pendingList table td:nth-child(3)::before { content: "Job"; }

    #orderList table td::before,
    #quoteList table td::before,
    #pendingList table td::before {
        color: #999;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        flex-shrink: 0;
    }

    /* Hide date, total, PO# columns */
    /* Orders: PO#=4, Date=5, Last Updated=6, Total=7, Status select=8 */
    #orderList table td:nth-child(4),
    #orderList table td:nth-child(5),
    #orderList table td:nth-child(6),
    #orderList table td:nth-child(7),
    #orderList table td:nth-child(8) { display: none; }
    /* Quotes: Date=4, Valid Until=5, Total=6, Status select=7 */
    #quoteList table td:nth-child(4),
    #quoteList table td:nth-child(5),
    #quoteList table td:nth-child(6),
    #quoteList table td:nth-child(7) { display: none; }
    /* Pending: Date=4, Last Updated=5, Total=6 */
    #pendingList table td:nth-child(4),
    #pendingList table td:nth-child(5),
    #pendingList table td:nth-child(6) { display: none; }

    /* Mobile: hide desktop select, show status badge button */
    .mobile-status-btn { display: inline-block; }

    /* ── Project detail: collapse inline grids to single column ── */
    #projectDetailTabContent .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    #projectDetailTabContent .grid {
        grid-template-columns: 1fr !important;
    }

    /* ── BOM table card layout ─────────────────────────────────── */
    .bom-table {
        display: block;
        min-width: 0 !important;
        width: 100%;
    }
    .bom-table thead { display: none; }
    .bom-table tbody { display: flex; flex-direction: column; gap: 8px; }
    .bom-table tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        padding: 10px 12px;
        gap: 3px;
        border: 1px solid #eee;
        width: 100%;
        box-sizing: border-box;
    }
    .bom-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 3px 0;
        border: none;
        font-size: 13px;
        gap: 8px;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }
    .bom-table td:first-child {
        font-weight: 700;
        font-size: 14px;
        padding-bottom: 6px;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 2px;
    }
    .bom-table td:last-child {
        padding-top: 6px;
        margin-top: 2px;
        border-top: 1px solid #f0f0f0;
        justify-content: flex-end;
    }
    /* Hide Job and Total columns — keep Type, Number, Status, Print */
    .bom-table td:nth-child(3),
    .bom-table td:nth-child(5) { display: none; }
    .bom-table td:nth-child(2)::before { content: "Number"; }
    .bom-table td:nth-child(4)::before { content: "Status"; }
    .bom-table td::before {
        color: #999;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        flex-shrink: 0;
    }

    /* ── Labor table (data-table) — fix min-width ──────────────── */
    .data-table {
        min-width: 0 !important;
        width: 100%;
    }
    .data-table td {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* ── Mobile card layout for Inventory ─────────────────────── */
    #inventoryList table {
        display: block;
        min-width: 0 !important;
        width: 100%;
    }
    #inventoryList table thead { display: none; }
    #inventoryList table tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    #inventoryList table tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        padding: 10px 12px;
        gap: 3px;
        border: 1px solid #eee;
        width: 100%;
        box-sizing: border-box;
    }
    #inventoryList table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 3px 0;
        border: none;
        font-size: 13px;
        gap: 8px;
        min-width: 0;
        box-sizing: border-box;
        width: 100%;
    }
    #inventoryList table td:first-child {
        font-weight: 700;
        font-size: 14px;
        padding-bottom: 6px;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 2px;
    }
    #inventoryList table td:last-child {
        padding-top: 6px;
        margin-top: 2px;
        border-top: 1px solid #f0f0f0;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 4px;
    }
    /* Qty label */
    #inventoryList table td:nth-child(4)::before {
        content: "Qty";
        color: #999;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        flex-shrink: 0;
    }
    /* Hide: Department, Type, Cost/Unit, Total Value, Vendor, Last Restocked */
    #inventoryList table td:nth-child(2),
    #inventoryList table td:nth-child(3),
    #inventoryList table td:nth-child(5),
    #inventoryList table td:nth-child(6),
    #inventoryList table td:nth-child(7),
    #inventoryList table td:nth-child(8) { display: none; }

    /* ── Stat cards ─────────────────────────────────────────── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    .stat-card { padding: 12px 8px; }
    .stat-value { font-size: 18px !important; }
    .stat-label { font-size: 11px; }

    /* ── Modals ─────────────────────────────────────────────── */
    .modal {
        padding: 0;
        align-items: flex-start;
    }
    .modal-content {
        padding: 14px;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        max-height: 100dvh;
        max-height: 100vh;
        border-radius: 0;
    }

    /* ── Forms ──────────────────────────────────────────────── */
    /* Prevents iOS auto-zoom on input focus */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="date"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px;
    }

    .form-group label { font-size: 13px; }

    /* ── Search ─────────────────────────────────────────────── */
    .search-box { flex-direction: column; align-items: stretch; }
    .search-box input { width: 100%; }

    /* ── Buttons ─────────────────────────────────────────────── */
    .btn    { font-size: 13px; }
    .btn-sm { font-size: 12px; padding: 4px 8px; }

    /* ── Chart ──────────────────────────────────────────────── */
    .chart-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* ── Grid inline-style overrides ────────────────────────── */
    .grid[style*="1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ── Small phones (< 480px) ─────────────────────────────────── */
@media (max-width: 480px) {

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }

    .login-box {
        padding: 24px 16px;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        padding: 12px !important;
    }
}

