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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f7941d;
    border-radius: 12px;
    color: white;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.client-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
}

.client-selector label {
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.client-selector select {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    background: white;
    color: #333;
    cursor: pointer;
    min-width: 120px;
}

.btn-new {
    background: white;
    color: #f7941d;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-new:hover {
    background: #fff5e6;
    transform: translateY(-2px);
}

.btn-logout {
    background: transparent;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

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

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #f7941d;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 8px;
}

.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: #f7941d;
}

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
}

tr:hover {
    background: #fafafa;
}

.dispatch-id {
    font-family: monospace;
    font-size: 0.85rem;
    color: #666;
}

.btn-view {
    background: #f7941d;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    margin-right: 8px;
    transition: background 0.2s;
}

.btn-view:hover {
    background: #e8850f;
}

.btn-delete {
    background: #dc3545;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-download {
    background: #28a745;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    margin-right: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-download:hover {
    background: #218838;
}

.actions-cell {
    white-space: nowrap;
}

.loading,
.no-data,
.error {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    color: #dc3545;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 800px;
    }
}

/* Daily Report Section */
.report-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.report-header h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 16px;
}

.report-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-picker-group label {
    font-weight: 500;
    color: #555;
}

.date-picker-group input[type="date"] {
    padding: 10px 14px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.date-picker-group input[type="date"]:focus {
    border-color: #f7941d;
}

.btn-download-report {
    background: linear-gradient(135deg, #f7941d 0%, #e8850f 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(247, 148, 29, 0.3);
}

.btn-download-report:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(247, 148, 29, 0.4);
}

.btn-download-report:active {
    transform: translateY(0);
}

.report-preview {
    margin-top: 12px;
    min-height: 24px;
}

.preview-info {
    color: #28a745;
    font-size: 0.95rem;
    padding: 8px 12px;
    background: #e8f5e9;
    border-radius: 6px;
    display: inline-block;
}

.preview-empty {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .report-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .date-picker-group {
        flex-direction: column;
        align-items: stretch;
    }

    .date-picker-group input[type="date"] {
        width: 100%;
    }

    .btn-download-report {
        width: 100%;
        text-align: center;
    }
}

/* Checkbox Column Styles */
.checkbox-col {
    width: 40px;
    text-align: center;
}

.checkbox-col input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #f7941d;
}

.bill-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #f7941d;
}

/* Selection Section Styles */
.selection-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #17a2b8;
}

.selection-header h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 16px;
}

.selection-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.selection-count {
    font-size: 1rem;
    color: #555;
    font-weight: 500;
    padding: 8px 16px;
    background: #e3f2fd;
    border-radius: 8px;
}

.selection-count span {
    font-weight: 700;
    color: #1976d2;
    font-size: 1.2rem;
}

.selection-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-download-selected {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3);
}

.btn-download-selected:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.btn-download-selected:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-clear-selection {
    background: transparent;
    color: #6c757d;
    padding: 10px 18px;
    border: 2px solid #6c757d;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-selection:hover {
    background: #6c757d;
    color: white;
}

@media (max-width: 768px) {
    .selection-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .selection-actions {
        flex-direction: column;
    }

    .btn-download-selected,
    .btn-clear-selection {
        width: 100%;
        text-align: center;
    }
}