/* --- GLOBAL RESPONSIVE FIXES --- */
.container-fluid,
.container-fluid *,
.container-fluid *::before,
.container-fluid *::after {
    box-sizing: border-box;
}

/* --- SCOPED CSS FOR ACKNOWLEDGEMENT CYCLE --- */
.ac-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
}

.ac-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .ac-header-text h1 {
        margin: 0;
        font-size: 24px;
        font-weight: 700;
        color: #334155;
    }

    .ac-header-text p {
        margin: 0;
        font-size: 14px;
        color: #475569;
    }

.ac-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ac-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;
}

.ac-btn-outline {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

    .ac-btn-outline:hover {
        background-color: #f8fafc;
        border-color: #94a3b8;
        color: #334155;
    }

.ac-btn-solid {
    background-color: #3b82f6;
    border: 1px solid #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

    .ac-btn-solid:hover {
        background-color: #2563eb;
    }

/* --- Filters Section --- */
.ac-filter-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
}

.ac-filter-header {
    background-color: #f8fafc;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
}

.ac-filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.ac-filter-body {
    padding: 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Collapsible filter card (desktop / tablet): the header toggles the body. */
.ac-filter-header {
    cursor: pointer;
}

.ac-filter-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ac-filter-card--collapsed .ac-filter-chevron {
    transform: rotate(-90deg);
}

.ac-filter-card--collapsed .ac-filter-header {
    border-bottom: 0;
}

.ac-filter-card--collapsed .ac-filter-body {
    display: none;
}

/* Active-filter count shown next to "Filters" while the card is collapsed. */
.ac-filter-card .ac-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
}

.ac-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 20px;
}

.ac-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.ac-form-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.ac-form-input, .ac-form-select {
    appearance: none;
    background-color: #fafafa;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #94a3b8;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

    .ac-form-input:focus, .ac-form-select:focus {
        border-color: #3b82f6;
    }

.ac-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 14px center;
    cursor: pointer;
}

.ac-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 14px center;
}

.ac-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

/* --- Statistics Grid --- */
.ac-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 24px;
}

.ac-stat-card {
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    border: 1px solid #f1f5f9;
    border-left-width: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.ac-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ac-stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ac-stat-title {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.ac-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}

.ac-stat-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 11px;
    font-weight: 600;
}

.ac-trend-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.ac-text-green {
    color: #16a34a;
}

.ac-text-purple {
    color: #8b5cf6;
}

.ac-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.04);
    flex-shrink: 0;
}

    .ac-icon-box svg {
        width: 18px;
        height: 18px;
    }

/* Themes */
.ac-theme-purple {
    border-left-color: #8b5cf6;
    background: linear-gradient(90deg, #faf5ff 0%, #ffffff 80%);
}

    .ac-theme-purple .ac-icon-box {
        color: #8b5cf6;
    }

.ac-theme-green {
    border-left-color: #16a34a;
    background: linear-gradient(90deg, #ecfdf5 0%, #ffffff 80%);
}

    .ac-theme-green .ac-icon-box {
        color: #16a34a;
    }

.ac-theme-yellow {
    border-left-color: #eab308;
    background: linear-gradient(90deg, #fefce8 0%, #ffffff 80%);
}

    .ac-theme-yellow .ac-icon-box {
        color: #eab308;
    }

.ac-theme-orange {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, #fffbeb 0%, #ffffff 80%);
}

    .ac-theme-orange .ac-icon-box {
        color: #f59e0b;
    }

.ac-theme-red {
    border-left-color: #dc2626;
    background: linear-gradient(90deg, #fef2f2 0%, #ffffff 80%);
}

    .ac-theme-red .ac-icon-box {
        color: #dc2626;
    }

/* --- CHARTS SECTION: Layout & Hover Tooltips --- */
.ac-top-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.ac-chart-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Horizontal Bar Row Hover & Tooltip */
.ac-chart-row {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    cursor: pointer;
}

.ac-row-tooltip {
    position: absolute;
    top: 32px;
    left: 35%;
    z-index: 50;
    width: 250px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 16px;
    font-family: sans-serif;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.2s ease-in-out;
    pointer-events: none;
}

.ac-chart-row:hover .ac-row-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Vertical Bar Hover & Tooltip */
.ac-chart-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 50px; /* Space for tooltip */
    margin-top: -50px; /* Visually negates padding */
    padding-bottom: 10px;
}

.ac-chart-inner {
    display: flex;
    height: 220px;
    min-width: 480px; /* CRITICAL: Forces scroll on mobile to prevent squishing */
    position: relative;
    padding-bottom: 20px;
}

.ac-v-bar-group {
    width: 30px;
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    cursor: pointer;
}

.ac-v-bar-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -10px;
    right: -10px;
    background-color: #f1f5f9;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: -1;
}

.ac-v-bar-group:hover .ac-v-bar-bg {
    opacity: 1;
}

.ac-v-chart-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 12px;
    width: 140px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    pointer-events: none;
    z-index: 50;
}

.ac-v-bar-group:hover .ac-v-chart-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* --- Table Section --- */
.ac-table-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: 'Inter', sans-serif;
    max-width: 100%;
    overflow: hidden;
}

.ac-table-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

    .ac-table-top h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #334155;
    }

.ac-search-input {
    appearance: none;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 10px 16px 10px 38px;
    font-size: 13px;
    color: #334155;
    width: 280px;
    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: 14px center;
    transition: border-color 0.2s;
    max-width: 100%;
}

    .ac-search-input:focus {
        border-color: #3b82f6;
    }

.ac-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    -webkit-overflow-scrolling: touch;
}

.ac-main-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

    .ac-main-table th {
        background-color: #f8fafc;
        color: #475569;
        font-weight: 600;
        font-size: 13px;
        padding: 14px 16px;
        text-align: center;
        white-space: nowrap;
        border-bottom: 1px solid #e2e8f0;
    }

    .ac-main-table td {
        padding: 16px;
        text-align: center;
        border-bottom: 1px solid #f1f5f9;
        font-size: 13px;
        color: #334155;
        vertical-align: middle;
    }

.ac-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;
}

    .ac-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;
    }

.ac-txt-red {
    color: #ef4444;
    font-weight: 600;
}

.ac-txt-orange {
    color: #f59e0b;
    font-weight: 600;
}

.ac-txt-yellow {
    color: #ca8a04;
    font-weight: 600;
}

.ac-txt-green {
    color: #22c55e;
    font-weight: 600;
}

.ac-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

    .ac-status .dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
    }

.ac-st-red {
    background: #fee2e2;
    color: #ef4444;
}

    .ac-st-red .dot {
        background: #ef4444;
    }

.ac-st-orange {
    background: #ffedd5;
    color: #f59e0b;
}

    .ac-st-orange .dot {
        background: #f59e0b;
    }

.ac-st-yellow {
    background: #fef9c3;
    color: #ca8a04;
}

    .ac-st-yellow .dot {
        background: #ca8a04;
    }

.ac-st-green {
    background: #dcfce7;
    color: #16a34a;
}

    .ac-st-green .dot {
        background: #16a34a;
    }

.ac-action-btn {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: opacity 0.2s;
}

    .ac-action-btn:hover {
        opacity: 0.7;
    }

.ac-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 4px;
}

.ac-page-size {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.ac-page-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ac-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;
}

    .ac-page-btn:hover:not(.dots) {
        background-color: #f8fafc;
    }

    .ac-page-btn.active {
        background-color: #f1f5f9;
        border-color: #e2e8f0;
        font-weight: 600;
        color: #1e293b;
    }

    .ac-page-btn.dots {
        border: none;
        background: transparent;
        cursor: default;
    }

/* --- Responsive Queries --- */
@media (max-width: 1280px) {
    .ac-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .ac-filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .ac-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ac-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ac-top-charts-grid {
        grid-template-columns: 1fr;
    }
    /* Stack charts */
}

@media (max-width: 768px) {
    .ac-header-container, .ac-table-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .ac-action-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

        .ac-action-buttons .ac-btn {
            justify-content: center;
            width: 100%;
        }

    .ac-search-input {
        width: 100%;
    }

    .ac-stats-grid {
        grid-template-columns: 1fr;
    }

    .ac-filter-grid {
        grid-template-columns: 1fr;
    }

    .ac-filter-actions {
        flex-direction: column;
        width: 100%;
    }

        .ac-filter-actions .ac-btn {
            width: 100%;
            justify-content: center;
        }

}

@media (max-width: 480px) {
    .ac-row-tooltip {
        left: 10%;
        width: 220px;
    }
    /* Adjust tooltip pos for very small screens */
}

/* =========================================================
   ACKNOWLEDGEMENT CYCLE: SELECT2 + STABLE LOADING BEHAVIOUR
   ========================================================= */

.ac-page-container,
.ac-page-container *,
.ac-page-container *::before,
.ac-page-container *::after {
    box-sizing: border-box;
}

.ac-btn:disabled,
.ac-page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

    .ac-btn:disabled:hover,
    .ac-page-btn:disabled:hover {
        transform: none;
    }

/* Group-by toolbar moved out of the commented Razor style block. */
.ac-chart-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.ac-seg-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    background: #f1f5f9;
    border-radius: 8px;
}

/* Hide the expanded native multi-select until Select2 is attached. */
.ac-form-group {
    position: relative;
    min-width: 0;
}

select.ac-form-select[multiple]:not(.select2-hidden-accessible) {
    display: block !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

/* Temporary closed dropdown shown only before Select2 initialization. */
.ac-form-group:has(> select.ac-form-select[multiple]:not(.select2-hidden-accessible))::after {
    content: "Select an option";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 42px 0 14px;
    overflow: hidden;
    color: #94a3b8;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
    background-color: #fafafa;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    pointer-events: none;
}

.ac-form-group:has(> select.ac-form-select[multiple]:not(.select2-hidden-accessible))::before {
    content: "";
    position: absolute;
    right: 17px;
    bottom: 16px;
    z-index: 3;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid #94a3b8;
    border-bottom: 1.5px solid #94a3b8;
    transform: rotate(45deg);
    pointer-events: none;
}

/* Select2 appearance scoped to this page. */
.ac-filter-body .select2-container {
    width: 100% !important;
    min-width: 0 !important;
}

.ac-page-container .select2-container--default .select2-selection--multiple {
    width: 100% !important;
    min-height: 40px !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    padding: 4px 44px 4px 7px !important;
    color: #334155 !important;
    background-color: #fafafa !important;
    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") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    border: 1px solid #f1f5f9 !important;
    border-radius: 8px !important;
    outline: none !important;
}

.ac-page-container .select2-container--default.select2-container--focus .select2-selection--multiple,
.ac-page-container .select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #3b82f6 !important;
}

.ac-page-container .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 4px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.ac-page-container .select2-search--inline {
    display: block !important;
    flex: 1 1 120px !important;
    min-width: 80px !important;
    margin: 0 !important;
    padding: 0 !important;
}

    .ac-page-container .select2-search--inline .select2-search__field {
        width: 100% !important;
        min-width: 80px !important;
        height: 28px !important;
        margin: 0 !important;
        padding: 0 4px !important;
        color: #334155 !important;
        font-family: inherit !important;
        font-size: 13px !important;
        line-height: 28px !important;
        background: transparent !important;
        border: 0 !important;
        outline: none !important;
    }

/* Selected chip and its right-aligned individual cancel button. */
.ac-page-container .select2-container--default .select2-selection--multiple .select2-selection__choice {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    max-width: calc(100% - 4px);
    min-height: 26px;
    margin: 1px 0 !important;
    padding: 3px 27px 3px 8px !important;
    overflow: hidden;
    color: #334155 !important;
    font-size: 12px !important;
    line-height: 18px !important;
    background-color: #e8eef7 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 5px !important;
}

.ac-page-container .select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    display: block;
    max-width: 100%;
    padding: 0 !important;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ac-page-container .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    position: absolute !important;
    top: 50% !important;
    right: 3px !important;
    left: auto !important;
    width: 20px !important;
    height: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #64748b !important;
    font-size: 0 !important;
    line-height: 1 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 50% !important;
    transform: translateY(-50%);
    cursor: pointer !important;
    z-index: 2;
}

    .ac-page-container .select2-container--default .select2-selection--multiple .select2-selection__choice__remove::before {
        content: "\00D7";
        font-size: 16px;
        font-weight: 600;
        line-height: 1;
    }

    .ac-page-container .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
        color: #0f172a !important;
        background-color: #cbd5e1 !important;
    }

.ac-page-container .select2-container--default .select2-selection--multiple .select2-selection__clear {
    position: absolute !important;
    top: 50% !important;
    right: 34px !important;
    height: 20px !important;
    margin: 0 !important;
    color: #64748b !important;
    font-size: 16px !important;
    line-height: 20px !important;
    transform: translateY(-50%);
}

/* Initial skeleton and later background-refresh behaviour. */
.ac-dashboard-skeleton,
.ac-dashboard-content {
    position: relative;
    min-height: 520px;
}

.ac-loading-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px 2px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.ac-inline-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid #dbeafe;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: ac-spin 0.75s linear infinite;
}

.ac-refresh-indicator {
    position: sticky;
    top: 12px;
    z-index: 40;
    width: max-content;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px auto;
    padding: 7px 12px;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    background: rgba(239, 246, 255, 0.96);
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.ac-dashboard-warning,
.ac-empty-state {
    padding: 14px 16px;
    color: #b45309;
    font-size: 13px;
    text-align: center;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.ac-empty-state {
    margin-top: 8px;
    padding: 48px 20px;
    color: #64748b;
    background: #ffffff;
    border-color: #e2e8f0;
}

.ac-dashboard-warning {
    margin-bottom: 16px;
}

.ac-dashboard-content.is-refreshing > :not(.ac-refresh-indicator):not(.ac-dashboard-warning) {
    opacity: 0.62;
    filter: grayscale(12%);
    pointer-events: none;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

/* Skeleton shimmer. */
.ac-skeleton-block {
    position: relative;
    display: block;
    overflow: hidden;
    background: #e8edf3;
    border-radius: 6px;
}

    .ac-skeleton-block::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.72) 48%, transparent 100%);
        transform: translateX(-100%);
        animation: ac-skeleton-shimmer 1.35s ease-in-out infinite;
    }

.ac-skeleton-stat-card {
    min-height: 112px;
    background: #ffffff;
    border-color: #e2e8f0;
}

.ac-skeleton-stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.ac-skeleton-stat-copy {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ac-skeleton-title {
    width: 64%;
    height: 12px;
}

.ac-skeleton-value {
    width: 36%;
    height: 22px;
}

.ac-skeleton-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.ac-skeleton-trend {
    width: 52%;
    height: 11px;
    margin-top: 16px;
}

.ac-skeleton-toolbar .ac-skeleton-block {
    width: min(620px, 100%);
    height: 38px;
    border-radius: 8px;
}

.ac-skeleton-chart-card {
    min-height: 392px;
}

.ac-skeleton-chart-title {
    width: 58%;
    height: 17px;
    margin-bottom: 8px;
}

.ac-skeleton-chart-subtitle {
    width: 72%;
    height: 12px;
    margin-bottom: 28px;
}

.ac-skeleton-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ac-skeleton-ranking-row {
    display: grid;
    grid-template-columns: 28px 80px minmax(100px, 1fr) 42px;
    align-items: center;
    gap: 16px;
}

.ac-skeleton-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.ac-skeleton-label {
    width: 76px;
    height: 12px;
}

.ac-skeleton-bar {
    width: 100%;
    height: 16px;
    border-radius: 4px;
}

.ac-skeleton-rate {
    width: 38px;
    height: 12px;
}

.ac-skeleton-ranking-row:nth-child(2) .ac-skeleton-bar {
    width: 84%;
}

.ac-skeleton-ranking-row:nth-child(3) .ac-skeleton-bar {
    width: 72%;
}

.ac-skeleton-ranking-row:nth-child(4) .ac-skeleton-bar {
    width: 91%;
}

.ac-skeleton-ranking-row:nth-child(5) .ac-skeleton-bar {
    width: 64%;
}

.ac-skeleton-axis {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 20px 51px 0 120px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

    .ac-skeleton-axis .ac-skeleton-block {
        width: 24px;
        height: 9px;
    }

.ac-skeleton-table-card {
    overflow: hidden;
}

.ac-skeleton-table-title {
    width: 220px;
    height: 18px;
}

.ac-skeleton-search {
    width: 280px;
    max-width: 42%;
    height: 38px;
}

.ac-skeleton-table-scroll {
    width: 100%;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
}

.ac-skeleton-table-head,
.ac-skeleton-table-row {
    min-width: 1000px;
    display: grid;
    grid-template-columns: 55px 1.35fr 1fr 1fr 1fr 1fr 1fr 1fr 70px;
    gap: 16px;
    padding: 14px 16px;
}

.ac-skeleton-table-head {
    background: #f8fafc;
}

    .ac-skeleton-table-head .ac-skeleton-block,
    .ac-skeleton-table-row .ac-skeleton-block {
        height: 12px;
    }

.ac-skeleton-table-row {
    border-bottom: 1px solid #f1f5f9;
}

.ac-skeleton-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
}

    .ac-skeleton-pagination .ac-skeleton-block:first-child {
        width: 155px;
        height: 32px;
    }

    .ac-skeleton-pagination .ac-skeleton-block:last-child {
        width: 205px;
        height: 32px;
    }

@keyframes ac-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ac-skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (max-width: 768px) {
    .ac-refresh-indicator {
        position: static;
        margin-left: auto;
    }

    .ac-skeleton-search {
        width: 100%;
        max-width: 100%;
    }

    .ac-skeleton-chart-card {
        overflow-x: auto;
    }

    .ac-skeleton-ranking-list,
    .ac-skeleton-axis {
        min-width: 620px;
    }
}

/* ========================================================
   PageHeader adoption: keep the desktop title row exactly as
   the old .ac-header-container looked (24px title, 14px subtitle).
   ======================================================== */
.ac-page-container .shell-page-header.ac-header-container {
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0 0 24px;
    font-family: 'Inter', sans-serif;
}

    .ac-page-container .shell-page-header.ac-header-container .shell-page-title {
        margin: 0;
        font-size: 24px;
        font-weight: 700;
        line-height: 1.2;
        color: #334155;
    }

    .ac-page-container .shell-page-header.ac-header-container .shell-page-subtitle {
        margin: 4px 0 0;
        font-size: 14px;
        color: #475569;
    }

    .ac-page-container .shell-page-header.ac-header-container .shell-page-actions {
        gap: 10px;
        flex-wrap: wrap;
    }

/* "View" label next to the row action icon: phone only */
.ac-action-text {
    display: none;
}

.ac-empty-state .spic-empty {
    width: 100%;
}

/* native: phone */
@media (max-width: 767.98px) {
    .ac-page-container {
        padding-top: 12px !important;
        padding-bottom: calc(16px + var(--safe-bottom, 0px)) !important;
    }

    /* Header: title row, then the four actions as a 2 x 2 grid */
    .ac-page-container .shell-page-header.ac-header-container {
        gap: 8px;
        margin-bottom: 16px;
    }

        .ac-page-container .shell-page-header.ac-header-container .shell-page-title {
            font-size: 1.15rem;
        }

        .ac-page-container .shell-page-header.ac-header-container .shell-page-subtitle {
            font-size: 0.8rem;
            margin-top: 2px;
        }

        .ac-page-container .shell-page-header.ac-header-container .shell-page-actions {
            flex-basis: 100%;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

    .ac-page-container .ac-btn {
        min-height: var(--tap-min, 44px);
        width: 100%;
        justify-content: center;
    }

    /* Filters trigger (opens the BottomSheet) */
    .ac-filter-trigger {
        width: 100%;
        min-height: var(--tap-min, 44px);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        margin-bottom: 16px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        color: #1e293b;
        font-family: 'Inter', sans-serif;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        text-align: left;
    }

        .ac-filter-trigger:disabled {
            opacity: 0.6;
        }

    .ac-filter-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 7px;
        margin-left: 6px;
        border-radius: 999px;
        background: #3b82f6;
        color: #ffffff;
        font-size: 12px;
        font-weight: 600;
    }

    /* Filter fields inside the sheet: one column, native multi-selects visible */
    .ac-page-container .ac-filter-sheet .ac-filter-body {
        padding: 0;
        gap: 0;
    }

    .ac-page-container .ac-filter-sheet .ac-filter-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Select2 runs inside the sheet; each dropdown is attached to its field's form
       group (dropdownParent), which is its positioning context. The open field is
       lifted above the fields that follow so the list is not painted under them. */
    .ac-filter-sheet .ac-form-group {
        position: relative;
    }

    .ac-filter-sheet .ac-form-group:has(.select2-container--open) {
        z-index: 5;
    }

    .ac-filter-sheet .select2-container {
        width: 100% !important;
        min-width: 0 !important;
    }

    .ac-filter-sheet .select2-dropdown {
        font-size: 14px;
    }

    .ac-filter-sheet .select2-results__options {
        max-height: 220px;
    }

    /* Fallback only: a native multi-select that Select2 has not (yet) taken over. */
    .ac-page-container .ac-filter-sheet select.ac-form-select[multiple]:not(.select2-hidden-accessible) {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: var(--tap-min, 44px) !important;
        max-height: 168px;
        margin: 0 !important;
        padding: 6px 8px !important;
        visibility: visible !important;
        opacity: 1 !important;
        overflow: auto !important;
        pointer-events: auto !important;
        appearance: auto !important;
        -webkit-appearance: auto !important;
        background-image: none;
        color: #334155;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

        .ac-page-container .ac-filter-sheet select.ac-form-select[multiple] option {
            padding: 8px 6px;
        }

    .ac-page-container .ac-filter-sheet .ac-form-group::after,
    .ac-page-container .ac-filter-sheet .ac-form-group::before {
        content: none !important;
    }

    .ac-page-container .ac-filter-sheet .ac-form-input {
        min-height: var(--tap-min, 44px);
        color: #334155;
        font-size: 16px;
    }

    .ac-page-container .ac-filter-sheet .ac-btn {
        width: auto;
    }

    /* KPI tiles: two per row */
    .ac-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .ac-stat-card {
        padding: 14px;
    }

    .ac-stat-title {
        font-size: 12px;
    }

    .ac-stat-value {
        font-size: 18px;
    }

    .ac-stat-trend {
        font-size: 11px;
    }

    .ac-icon-box {
        width: 30px;
        height: 30px;
    }

    /* Group-by toolbar scrolls sideways instead of wrapping into three lines */
    .ac-chart-toolbar {
        justify-content: flex-start;
    }

    .ac-seg-group {
        flex-wrap: nowrap;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

        .ac-seg-group button {
            min-height: 36px;
            flex: 0 0 auto;
        }

    /* Chart cards: tighter, tooltips are hover-only so hide them on touch */
    .ac-chart-card {
        padding: 16px;
    }

    .ac-row-tooltip {
        display: none;
    }

    /* Table: one card per row, labels from data-label */
    .ac-table-card {
        padding: 16px;
        gap: 14px;
    }

    .ac-table-top {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .ac-search-input {
        width: 100%;
        min-height: var(--tap-min, 44px);
        font-size: 16px;
    }

    .ac-table-wrapper {
        overflow-x: hidden;
        border: 0;
    }

    .ac-main-table {
        min-width: 0;
    }

        .ac-main-table thead {
            display: none;
        }

        .ac-main-table tbody,
        .ac-main-table tr,
        .ac-main-table td {
            display: block;
            width: 100%;
        }

        .ac-main-table tr {
            padding: 6px 12px;
            margin-bottom: 10px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            background: #ffffff;
        }

        .ac-main-table td {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            padding: 8px 0;
            border-bottom: 1px solid #f1f5f9;
            font-size: 13px;
            text-align: right !important;
        }

            .ac-main-table td::before {
                content: attr(data-label);
                flex: 0 0 42%;
                color: #64748b;
                font-weight: 500;
                text-align: left;
            }

            .ac-main-table td:last-child {
                border-bottom: 0;
            }

            .ac-main-table td[data-label="S.No"] {
                display: none;
            }

        .ac-main-table tr.ac-empty-row td {
            display: block;
            text-align: center !important;
        }

            .ac-main-table tr.ac-empty-row td::before {
                content: none;
            }

    .ac-action-btn {
        min-height: var(--tap-min, 44px);
        min-width: var(--tap-min, 44px);
        margin: 0;
        gap: 6px;
        padding: 0 8px;
        font-size: 13px;
        font-weight: 600;
    }

    .ac-action-text {
        display: inline;
    }

    /* Pagination: one row - Items Per Page left, pager right - same as the
       other list pages. Only prev / current / next stay visible. */
    .ac-pagination {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .ac-page-controls {
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .ac-page-btn {
        min-width: 28px;
        height: 28px;
        flex: 0 0 auto;
    }

    .ac-page-controls .ac-page-btn:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
}

/* Phone: the page's legacy header rule turned the shared PageHeader into a column, which put the
   back arrow on its own centred row above the title. Keep the shell's row layout (arrow left of
   the title, actions wrapping underneath); the repeated class only raises specificity. */
@media (max-width: 767.98px) {
    .shell-page-header.ac-header-container.ac-header-container {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}
