/* --- SCOPED CSS FOR AGEING REPORT --- */
.ar-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    font-family: 'Inter', sans-serif;
}

.ar-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .ar-header-text h1 {
        margin: 0;
        font-size: 24px;
        font-weight: 700;
        color: #334155;
    }

    .ar-header-text p {
        margin: 0;
        font-size: 14px;
        color: #475569;
    }

.ar-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ar-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;
}

.ar-btn-outline {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

    .ar-btn-outline:hover {
        background-color: #f8fafc;
        border-color: #94a3b8;
        color: #334155;
    }

.ar-btn-solid {
    background-color: #3b82f6;
    border: 1px solid #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

    .ar-btn-solid:hover {
        background-color: #2563eb;
    }

/* --- Statistics Grid --- */
.ar-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 24px;
}

.ar-stat-card {
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    border: 1px solid #f1f5f9;
    border-left-width: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.ar-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ar-stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ar-stat-title {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.ar-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}

.ar-stat-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #16a34a;
}

.ar-trend-icon {
    color: #3b82f6;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.ar-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;
}

    .ar-icon-box svg {
        width: 16px;
        height: 16px;
    }

.ar-theme-green {
    border-left-color: #16a34a;
    background: linear-gradient(90deg, #ecfdf5 0%, #ffffff 80%);
}

    .ar-theme-green .ar-icon-box {
        color: #16a34a;
    }

.ar-theme-orange {
    border-left-color: #b45309;
    background: linear-gradient(90deg, #fff7ed 0%, #ffffff 80%);
}

    .ar-theme-orange .ar-icon-box {
        color: #b45309;
    }

.ar-theme-yellow {
    border-left-color: #ca8a04;
    background: linear-gradient(90deg, #fefce8 0%, #ffffff 80%);
}

    .ar-theme-yellow .ar-icon-box {
        color: #ca8a04;
    }

.ar-theme-red {
    border-left-color: #dc2626;
    background: linear-gradient(90deg, #fef2f2 0%, #ffffff 80%);
}

    .ar-theme-red .ar-icon-box {
        color: #dc2626;
    }


/* --- Charts Section --- */
.ar-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 24px;
}

.ar-chart-card {
    background-color: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
}

.ar-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

    .ar-chart-header h3 {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        color: #334155;
    }

.ar-custom-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.ar-leg-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.leg-stock {
    color: #16a34a;
}

.leg-sales {
    color: #3b82f6;
}

.ar-chart-area {
    position: relative;
    width: 100%;
    height: 260px;
}

.ar-donut-container {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 260px;
}

.ar-donut-wrapper {
    width: 45%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ar-donut-table-wrapper {
    width: 55%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-x: auto;
}

.ar-data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 280px;
}

    .ar-data-table th {
        text-align: left;
        padding: 12px 8px;
        border-bottom: 1px solid #e2e8f0;
        color: #1e293b;
        font-weight: 600;
        font-size: 13px;
        white-space: nowrap;
    }

    .ar-data-table td {
        padding: 14px 8px;
        border-bottom: 1px solid #f1f5f9;
        color: #475569;
        font-size: 13px;
        font-weight: 500;
        vertical-align: middle;
        white-space: nowrap;
    }

    .ar-data-table tr:last-child td {
        border-bottom: none;
    }

.ar-dot-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ar-table-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-dgreen {
    background-color: #047857;
}

.dot-lgreen {
    background-color: #65a30d;
}

.dot-orange {
    background-color: #ea580c;
}

.dot-red {
    background-color: #ef4444;
}


/* --- Filters Section --- */
.ar-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;
}

.ar-filter-header {
    background-color: #f1f5f9;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
}

.ar-filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.ar-filter-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ar-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 20px;
}

.ar-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ar-form-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.ar-form-input, .ar-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%;
}

    .ar-form-input:focus, .ar-form-select:focus {
        border-color: #3b82f6;
    }

.ar-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;
}

.ar-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

/* --- Table Section --- */
.ar-table-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: 'Inter', sans-serif;
    margin-bottom: 20px;
    max-width: 100%;
    overflow: hidden;
}

.ar-table-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

    .ar-table-top h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #334155;
    }

.ar-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;
    max-width: 100%;
}

    .ar-search-input:focus {
        border-color: #3b82f6;
    }

.ar-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.ar-main-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

    .ar-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;
    }

    .ar-main-table td {
        padding: 16px;
        text-align: center;
        border-bottom: 1px solid #f1f5f9;
        font-size: 13px;
        color: #334155;
        vertical-align: middle;
    }

    .ar-main-table tr:last-child td {
        border-bottom: none;
    }

.ar-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;
}

    .ar-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;
    }

/* Table Text Colors */
.ar-txt-red {
    color: #ef4444;
    font-weight: 600;
}

.ar-txt-lgreen {
    color: #65a30d;
    font-weight: 600;
}

.ar-txt-dgreen {
    color: #16a34a;
    font-weight: 600;
}

.ar-txt-orange {
    color: #ea580c;
    font-weight: 600;
}

/* Table Status Badges */
.ar-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;
}

    .ar-status .dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
    }

.ar-st-red {
    background: #fee2e2;
    color: #ef4444;
}

    .ar-st-red .dot {
        background: #ef4444;
    }

.ar-st-lgreen {
    background: #ecfccb;
    color: #65a30d;
}

    .ar-st-lgreen .dot {
        background: #65a30d;
    }

.ar-st-dgreen {
    background: #dcfce7;
    color: #16a34a;
}

    .ar-st-dgreen .dot {
        background: #16a34a;
    }

.ar-st-orange {
    background: #ffedd5;
    color: #ea580c;
}

    .ar-st-orange .dot {
        background: #ea580c;
    }

.ar-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;
}

    .ar-action-btn:hover {
        opacity: 0.7;
    }

/* Pagination */
.ar-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 4px;
}

.ar-page-size {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.ar-page-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ar-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;
}

    .ar-page-btn:hover:not(.dots) {
        background-color: #f8fafc;
    }

    .ar-page-btn.active {
        background-color: #f1f5f9;
        border-color: #e2e8f0;
        font-weight: 600;
        color: #1e293b;
    }

    .ar-page-btn.dots {
        border: none;
        background: transparent;
        cursor: default;
    }

/* --- Responsive Queries --- */
@media (max-width: 1280px) {
    .ar-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .ar-charts-grid {
        grid-template-columns: 1fr;
    }

    .ar-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ar-header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .ar-table-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .ar-action-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

        .ar-action-buttons .ar-btn {
            justify-content: center;
            width: 100%;
        }

    .ar-stats-grid {
        grid-template-columns: 1fr;
    }

    .ar-donut-container {
        flex-direction: column;
        height: auto;
        gap: 20px;
    }

    .ar-donut-wrapper, .ar-donut-table-wrapper {
        width: 100%;
    }

    .ar-donut-wrapper {
        height: 260px;
    }
}

@media (max-width: 640px) {
    .ar-action-buttons {
        grid-template-columns: 1fr;
    }

    .ar-filter-grid {
        grid-template-columns: 1fr;
    }

    .ar-filter-actions {
        flex-direction: column;
        width: 100%;
    }

        .ar-filter-actions .ar-btn {
            width: 100%;
            justify-content: center;
        }

    .ar-pagination {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .ar-page-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

