/* --- SCOPED CSS FOR COMPANY SALES --- */
/* --- Header Section --- */
.cs-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cs-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .cs-header-text h1 {
        margin: 0;
        font-size: 24px;
        font-weight: 700;
        color: #334155;
    }

    .cs-header-text p {
        margin: 0;
        font-size: 14px;
        color: #475569;
    }

.cs-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cs-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.cs-btn-outline {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

    .cs-btn-outline:hover {
        background-color: #f8fafc;
        border-color: #94a3b8;
        color: #334155;
    }

.cs-btn-solid {
    background-color: #3b82f6;
    border: 1px solid #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

    .cs-btn-solid:hover {
        background-color: #2563eb;
    }

/* --- Statistics Grid --- */
.cs-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cs-stat-card {
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.cs-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.cs-stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cs-stat-title {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.cs-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #334155;
    line-height: 1.1;
}

.cs-icon-box {
    width: 38px;
    height: 38px;
    background-color: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    flex-shrink: 0;
}

    .cs-icon-box svg {
        width: 16px;
        height: 16px;
    }

.cs-card-bottom {
    display: flex;
    align-items: center;
}

.cs-bottom-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.cs-col-right {
    padding-left: 16px;
}

.cs-divider {
    width: 1px;
    height: 32px;
}

.cs-bottom-label {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
}

.cs-bottom-val {
    font-size: 16px;
    font-weight: 700;
}

.cs-text-green {
    color: #15803d;
}

.cs-text-blue {
    color: #1e3a8a;
}

/* Themes */
.cs-theme-cyan {
    border: 1px solid #cffafe;
    border-left: 4px solid #06b6d4;
    background: linear-gradient(90deg, #ecfeff 0%, #ffffff 80%);
}

    .cs-theme-cyan .cs-card-top {
        border-bottom: 1px solid #cffafe;
    }

    .cs-theme-cyan .cs-divider {
        background-color: #cffafe;
    }

    .cs-theme-cyan .cs-icon-box {
        color: #0891b2;
        border: 1px solid #e0f2fe;
    }

.cs-theme-orange {
    border: 1px solid #ffedd5;
    border-left: 4px solid #d97706;
    background: linear-gradient(90deg, #fffcf8 0%, #ffffff 80%);
}

    .cs-theme-orange .cs-card-top {
        border-bottom: 1px solid #ffedd5;
    }

    .cs-theme-orange .cs-divider {
        background-color: #ffedd5;
    }

    .cs-theme-orange .cs-icon-box {
        color: #b45309;
        border: 1px solid #ffedd5;
    }

.cs-theme-red {
    border: 1px solid #fee2e2;
    border-left: 4px solid #dc2626;
    background: linear-gradient(90deg, #fffcfc 0%, #ffffff 80%);
}

    .cs-theme-red .cs-card-top {
        border-bottom: 1px solid #fee2e2;
    }

    .cs-theme-red .cs-divider {
        background-color: #fee2e2;
    }

    .cs-theme-red .cs-icon-box {
        color: #dc2626;
        border: 1px solid #fee2e2;
    }

.cs-theme-yellow {
    border: 1px solid #fef08a;
    border-left: 4px solid #ca8a04;
    background: linear-gradient(90deg, #fffff8 0%, #ffffff 80%);
}

    .cs-theme-yellow .cs-card-top {
        border-bottom: 1px solid #fef08a;
    }

    .cs-theme-yellow .cs-divider {
        background-color: #fef08a;
    }

    .cs-theme-yellow .cs-icon-box {
        color: #a16207;
        border: 1px solid #fef08a;
    }

    .cs-theme-yellow .cs-stat-value {
        color: #854d0e;
    }


/* --- Status (By Age) Section --- */
.cs-status-section {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
}

.cs-status-header {
    margin-bottom: 20px;
}

    .cs-status-header h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #334155;
    }

.cs-status-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.cs-age-box {
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border: 1px solid transparent;
}

.cs-age-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-age-label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.cs-age-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.cs-age-icon-box {
    width: 32px;
    height: 32px;
    background-color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    flex-shrink: 0;
}

    .cs-age-icon-box svg {
        width: 16px;
        height: 16px;
    }

.cs-age-green {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

    .cs-age-green .cs-age-icon-box {
        border-color: #bbf7d0;
        color: #22c55e;
    }

.cs-age-blue {
    background-color: #eff6ff;
    border-color: #bfdbfe;
}

    .cs-age-blue .cs-age-icon-box {
        border-color: #bfdbfe;
        color: #3b82f6;
    }

.cs-age-yellow {
    background-color: #fefce8;
    border-color: #fef08a;
}

    .cs-age-yellow .cs-age-icon-box {
        border-color: #fef08a;
        color: #ca8a04;
    }

.cs-age-orange {
    background-color: #fff7ed;
    border-color: #fed7aa;
}

    .cs-age-orange .cs-age-icon-box {
        border-color: #fed7aa;
        color: #d97706;
    }

.cs-age-red {
    background-color: #fef2f2;
    border-color: #fecaca;
}

    .cs-age-red .cs-age-icon-box {
        border-color: #fecaca;
        color: #dc2626;
    }

.cs-status-banner {
    background-color: #f5f3ff;
    border: 1px solid #ede9fe;
    border-left: 4px solid #8b5cf6;
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cs-banner-icon {
    color: #8b5cf6;
    flex-shrink: 0;
}

.cs-banner-text {
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}


/* --- Filters Section --- */
.cs-filter-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
}

.cs-filter-header {
    background-color: #f4f6f8;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
}

.cs-filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.cs-filter-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cs-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 20px;
}

.cs-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cs-form-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.cs-form-input, .cs-form-select {
    appearance: none;
    background-color: #fafafa;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #94a3b8;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

    .cs-form-input:focus, .cs-form-select:focus {
        border-color: #3b82f6;
    }

.cs-form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.cs-input-calendar {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.cs-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}


/* --- Table Section (EXPANDED WITH NEW COLUMNS) --- */
.cs-table-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 20px;
}

.cs-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.cs-tabs-wrapper {
    display: inline-flex;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.cs-tab {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .cs-tab:hover:not(.active) {
        color: #334155;
    }

    .cs-tab.active {
        background-color: #ffffff;
        color: #0f172a;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

.cs-search-input {
    appearance: none;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 8px 16px 8px 36px;
    font-size: 13px;
    color: #334155;
    width: 260px;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    transition: border-color 0.2s;
}

    .cs-search-input:focus {
        border-color: #3b82f6;
    }

.cs-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.cs-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

    .cs-table th {
        background-color: #f1f5f9;
        color: #475569;
        font-weight: 600;
        font-size: 13px;
        padding: 14px 16px;
        text-align: center;
        white-space: nowrap;
    }

    .cs-table td {
        padding: 16px;
        text-align: center;
        border-bottom: 1px solid #f1f5f9;
        font-size: 13px;
        color: #334155;
        vertical-align: middle;
    }

    .cs-table tr:last-child td {
        border-bottom: none;
    }

.cs-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .cs-checkbox:checked {
        background-color: #3b82f6;
        border-color: #3b82f6;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
        background-position: center;
        background-repeat: no-repeat;
    }

/* Badges & Pills */
.cs-pill-solid {
    background-color: #ede9fe;
    color: #7c3aed;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.cs-pill-outline-purple {
    background-color: #ffffff;
    border: 1px solid #ddd6fe;
    color: #7c3aed;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.cs-pill-outline-orange {
    background-color: #ffffff;
    border: 1px solid #fed7aa;
    color: #ea580c;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.cs-pill-outline-green {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* Ack Age Status Badges */
.cs-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

    .cs-status-badge .dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
    }

.cs-badge-red {
    background: #fee2e2;
    color: #ef4444;
}

    .cs-badge-red .dot {
        background: #ef4444;
    }

.cs-badge-yellow {
    background: #fef9c3;
    color: #ca8a04;
}

    .cs-badge-yellow .dot {
        background: #ca8a04;
    }

.cs-badge-blue {
    background: #eff6ff;
    color: #3b82f6;
}

    .cs-badge-blue .dot {
        background: #3b82f6;
    }

.cs-badge-orange {
    background: #ffedd5;
    color: #ea580c;
}

    .cs-badge-orange .dot {
        background: #ea580c;
    }

.cs-badge-green {
    background: #dcfce7;
    color: #16a34a;
}

    .cs-badge-green .dot {
        background: #16a34a;
    }

/* Pending Ack Age Text Colors */
.cs-age-text-red {
    color: #ef4444;
    font-weight: 500;
}

.cs-age-text-yellow {
    color: #ca8a04;
    font-weight: 500;
}

.cs-age-text-green {
    color: #16a34a;
    font-weight: 500;
}

.cs-age-text-orange {
    color: #ea580c;
    font-weight: 500;
}

.cs-age-text-gray {
    color: #94a3b8;
    font-weight: 500;
}

/* Simple Pills for Status Column */
.cs-pill-simple {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.cs-pill-blue {
    background: #eff6ff;
    color: #3b82f6;
}

.cs-pill-purple {
    background: #f3e8ff;
    color: #9333ea;
}

.cs-pill-green {
    background: #dcfce7;
    color: #16a34a;
}

/* Action Icons */
.cs-action-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cs-action-btn-blue {
    color: #3b82f6;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.cs-action-btn-green {
    color: #16a34a;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

    .cs-action-btn-blue:hover, .cs-action-btn-green:hover {
        opacity: 0.7;
    }

/* Stacked Text (State/District) */
.cs-stacked-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cs-stacked-primary {
    font-weight: 600;
    color: #1e293b;
}

.cs-stacked-secondary {
    font-size: 11px;
    color: #94a3b8;
}

/* Pagination */
.cs-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 4px;
}

.cs-page-size {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.cs-page-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cs-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

    .cs-page-btn:hover:not(.dots) {
        background-color: #f8fafc;
    }

    .cs-page-btn.active {
        background-color: #f1f5f9;
        border-color: #e2e8f0;
        font-weight: 600;
        color: #1e293b;
    }

    .cs-page-btn.dots {
        border: none;
        background: transparent;
        cursor: default;
    }

/* --- Responsive Queries --- */
@media (max-width: 1280px) {
    .cs-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cs-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .cs-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cs-header-container, .cs-table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cs-action-buttons, .cs-search-input {
        width: 100%;
        justify-content: flex-start;
    }

    .cs-stats-grid {
        grid-template-columns: 1fr;
    }

    .cs-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .cs-filter-grid {
        grid-template-columns: 1fr;
    }

    .cs-filter-actions {
        flex-direction: column;
        width: 100%;
    }

        .cs-filter-actions .cs-btn {
            width: 100%;
            justify-content: center;
        }

    .cs-pagination {
        flex-direction: column;
        align-items: center;
    }

    .cs-page-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .cs-status-grid {
        grid-template-columns: 1fr;
    }
}

