/* Style mandiri halaman CDR Analytics. */
.ca-info-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #95691f;
    cursor: pointer;
    list-style: none;
    font-size: 15px;
    border: 0;
    background: transparent;
    position: absolute;
    top: 12px;
    right: 10px;
    z-index: 2;
}

.ca-info-toggle:hover,
.ca-stat-flipped .ca-info-toggle {
    background: #fff1d5;
}

.ca-stat-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ca-kpis .ca-stat {
    position: relative;
}

.ca-kpis .ca-stat-body > p {
    padding-right: 18px;
    line-height: 1.4;
}

.ca-kpis {
    align-items: start;
}

/* Kartu statistik memakai selector milik halaman ini. */
.ca-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0 22px;
}

.ca-stat {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 20px;
    border: 1px solid #eee8df;
    border-radius: 9px;
    background: #fffefa;
}

.ca-stat-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: #fff1d5;
    color: #b37b21;
    border-radius: 10px;
}

.ca-stat p {
    margin: 0;
    font-size: 11px;
    color: #746a5e;
}

.ca-stat strong {
    display: block;
    font-size: 28px;
    line-height: 1.5;
    font-weight: 500;
    color: #62564a;
}

.ca-stat small {
    display: block;
    font-size: 10px;
    color: #7e746c;
}

@media (max-width: 1200px) {
    .ca-stats {
        gap: 10px;
    }

    .ca-stat {
        padding: 15px 12px;
        gap: 10px;
    }

    .ca-stat-icon {
        width: 30px;
        height: 30px;
    }

    .ca-stat-icon svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 680px) {
    .ca-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

/* Dasar laporan: header, filter, panel, dan tabel. */
/* Palet dan panel mengikuti halaman Extensions / Registration. */
.ca-page {
    color: #51483f;
    padding: 4px 0 24px;
}

.ca-page [hidden] {
    display: none !important;
}

.ca-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 28px;
    margin-bottom: 18px;
    border: 1px solid #efd6a0;
    border-radius: 12px;
    background: linear-gradient(105deg, #fff3d8 0%, #fff8eb 62%, #fffdf8 100%);
}

.ca-eyebrow {
    margin: 0 0 8px;
    color: #b48336;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
}

.ca-hero h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -0.6px;
}

.ca-hero p:not(.ca-eyebrow) {
    margin: 9px 0 0;
    color: #766554;
    font-size: 12px;
}

.ca-primary,
.ca-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid #e4c27d;
    border-radius: 7px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
}

.ca-primary {
    background: #ffbd32;
    border-color: #d98b19;
    color: #291c0b;
    box-shadow: 0 3px 8px #8b5a1517;
}

.ca-primary:hover {
    background: #ffca57;
}

.ca-secondary {
    background: #fff8e8;
    color: #845711;
}

.ca-secondary:hover {
    background: #fff0d1;
}

.ca-notice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #ecdfca;
    border-radius: 8px;
    background: #fff9ed;
    color: #876a42;
    font-size: 12px;
    line-height: 1.5;
}

.ca-notice p {
    margin: 0;
}

.ca-notice i {
    color: #b48336;
    flex-shrink: 0;
}

.ca-page button:disabled {
    opacity: 0.5;
    cursor: wait;
}

.ca-panel {
    background: #fffefa;
    border: 1px solid #e9e1d6;
    border-radius: 13px;
    overflow: hidden;
    box-shadow: 0 4px 22px #49321c05;
}

.ca-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px;
    border-bottom: 1px solid #eee8df;
}

.ca-panel-head h2 {
    font-size: 14px;
    margin: 0 0 7px;
}

.ca-panel-head p,
.ca-period-note {
    color: #978a7e;
    font-size: 11px;
    margin: 0;
}

.ca-badge {
    border: 1px solid #e7dcc9;
    background: #faf5ec;
    border-radius: 20px;
    padding: 6px 10px;
    color: #9c8057;
    font-size: 10px;
    white-space: nowrap;
}

.ca-filters {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(125px, 1fr)) minmax(140px, 1fr) minmax(190px, 1.4fr)
        auto;
    gap: 12px;
    align-items: end;
    padding: 20px 22px 10px;
}

.ca-filters label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    min-width: 0;
}

.ca-filters input,
.ca-filters select {
    width: 100%;
    min-width: 0;
    height: 39px;
    box-sizing: border-box;
    border: 1px solid #e6ded3;
    border-radius: 7px;
    padding: 8px 10px;
    color: #6c5d4e;
    background: white;
    font: inherit;
    font-size: 11px;
}

.ca-period-note {
    padding: 0 22px 18px;
}

.ca-page :focus-visible {
    outline: 2px solid #bf923e;
    outline-offset: 3px;
}

.ca-table-wrap {
    max-height: 570px;
    overflow: auto;
    margin: 0 16px;
    border: 1px solid #eee8df;
    border-radius: 8px;
}

.ca-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11px;
    text-align: left;
}

.ca-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8f4ed;
    color: #968573;
    padding: 14px 12px;
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
    border-bottom: 1px solid #eee8df;
}

.ca-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #f0eae1;
    vertical-align: middle;
}

.ca-table tbody tr:hover {
    background: #fdf9f1;
}

.ca-table td:first-child {
    white-space: nowrap;
}

.ca-direction {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    background: #f2eee8;
    color: #887666;
    font-size: 10px;
}

.ca-direction[data-direction="inbound"] {
    color: #467a62;
    background: #edf6ef;
}

.ca-direction[data-direction="outbound"] {
    color: #9c7632;
    background: #fff3d9;
}

.ca-direction[data-direction="internal"] {
    color: #587997;
    background: #edf3f9;
}

.ca-duration {
    font-variant-numeric: tabular-nums;
}

.ca-empty {
    text-align: center;
    padding: 40px 20px;
    color: #988a7b;
}

.ca-empty > i {
    font-size: 30px;
    color: #c1ad8f;
}

.ca-empty h3 {
    font-size: 14px;
    color: #7d6e5e;
}

.ca-empty p {
    font-size: 12px;
}

.ca-sentinel {
    min-height: 48px;
    display: grid;
    place-items: center;
    color: #9a8d7e;
    font-size: 11px;
    padding: 8px 12px;
    text-align: center;
}

.ca-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
    padding: 12px 22px;
    color: #938573;
    font-size: 11px;
}

.ca-error {
    margin: 0 22px 16px;
    padding: 12px;
    border: 1px solid #e6b7b1;
    border-radius: 8px;
    background: #fff2f0;
    color: #97443b;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .ca-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ca-filters button {
        justify-self: start;
    }
}

@media (max-width: 600px) {
    .ca-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .ca-panel-head {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .ca-filters {
        padding: 18px 16px 10px;
        gap: 14px 10px;
    }

    .ca-filters button {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .ca-table-wrap {
        margin: 0 10px;
        max-height: 65vh;
    }

    .ca-period-note {
        padding-inline: 16px;
        line-height: 1.5;
    }
}

.ca-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ca-filters {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
}

.ca-call-status {
    display: inline-block;
    white-space: nowrap;
    border-radius: 20px;
    padding: 5px 9px;
    background: #fff0e9;
    color: #a46147;
    font-size: 10px;
}

.ca-call-status[data-status="ANSWERED"] {
    background: #edf6ef;
    color: #467a62;
}

.ca-call-status[data-status="BUSY"] {
    background: #fff3d9;
    color: #9c7632;
}

.ca-details {
    min-width: 140px;
}

.ca-details summary {
    cursor: pointer;
    color: #9c7632;
}

.ca-details dl {
    min-width: 260px;
    max-width: 420px;
    margin: 12px 0 0;
}

.ca-details dt {
    font-size: 10px;
    color: #978a7e;
    margin-top: 8px;
}

.ca-details dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
    .ca-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ca-list-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ca-answered {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    white-space: nowrap;
    cursor: pointer;
}

.ca-answered input {
    margin: 0;
    accent-color: #b7883d;
    width: 14px;
    height: 14px;
}

.ca-search {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 11px;
}

@media (max-width: 600px) {
    .ca-list-actions {
        gap: 10px;
    }
}

/* Kontrol header memakai tinggi yang sama dengan tombol Cari. */
.ca-list-actions > .ca-badge,
.ca-list-actions > .ca-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
}

.ca-list-actions > .ca-answered {
    gap: 7px;
}

/* Pengaturan khusus halaman dan responsif, setelah style dasar. */
.ca-page .ca-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ca-page .ca-period-note {
    line-height: 1.5;
    padding: 3px 22px;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.ca-page .ca-period-note i {
    flex-shrink: 0;
    color: #b48336;
}

.ca-state {
    margin: 0;
}

.ca-export-chart {
    min-height: 28px;
    padding: 4px 9px;
    margin-bottom: 12px;
    font-size: 10px;
}

.ca-state {
    padding: 8px 22px 16px;
    color: #887864;
    font-size: 12px;
}

.ca-kpis {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.ca-kpis .ca-stat {
    grid-column: span 3;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 20px;
    border: 1px solid #e7e0d6;
    border-radius: 12px;
    background: #fffefa;
    min-width: 0;
    height: 132px;
    box-sizing: border-box;
    perspective: 900px;
    overflow: hidden;
}

.ca-kpis .ca-stat:nth-child(n + 5) {
    grid-column: span 4;
}

.ca-stat-front,
.ca-stat-back {
    position: absolute;
    inset: 0;
    padding: 20px;
    box-sizing: border-box;
    backface-visibility: hidden;
    transition: transform 320ms ease;
}

.ca-stat-front {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ca-stat-back {
    display: flex;
    flex-direction: column;
    transform: rotateY(180deg);
    background: #fff8e8;
}

.ca-stat-flipped .ca-stat-front {
    transform: rotateY(-180deg);
}

.ca-stat-flipped .ca-stat-back {
    transform: rotateY(0);
}

.ca-kpis .ca-stat .ca-info-title {
    font-weight: 600;
    padding-right: 26px;
    margin-bottom: 8px;
    flex-shrink: 0;
    line-height: 1.4;
}

.ca-info-scroll {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.ca-kpis .ca-info-scroll p {
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
    .ca-stat-front,
    .ca-stat-back {
        transition: none;
    }
}

.ca-kpis .ca-stat-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 72px;
    flex-shrink: 0;
    background: #fff1d5;
    color: #b37b21;
    border-radius: 12px;
}

.ca-kpis .ca-stat-icon i {
    font-size: 24px;
}

.ca-kpis .ca-stat p {
    margin: 0;
    font-size: 12px;
    color: #746a5e;
}

.ca-kpis .ca-stat strong {
    display: block;
    font-size: 32px;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    color: #62564a;
    overflow-wrap: anywhere;
}

.ca-kpis .ca-stat small {
    display: block;
    font-size: 10px;
    color: #978a7e;
}

.ca-charts {
    margin-top: 18px;
}

.ca-chart-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    padding: 22px;
}

.ca-chart-grid figure {
    min-width: 0;
    margin: 0;
}

.ca-chart-grid figcaption {
    font-size: 12px;
    margin-bottom: 16px;
}

.ca-canvas {
    position: relative;
    height: 280px;
}

@media (max-width: 1100px) {
    .ca-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ca-kpis .ca-stat,
    .ca-kpis .ca-stat:nth-child(n + 5) {
        grid-column: auto;
    }

    .ca-kpis .ca-stat:last-child {
        grid-column: 1 / -1;
    }

    .ca-chart-grid {
        grid-template-columns: 1fr 1fr;
    }

    .ca-chart-grid figure:first-child {
        grid-column: 1 / -1;
    }

    .ca-page .ca-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .ca-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ca-kpis .ca-stat {
        height: 124px;
        padding: 18px;
    }

    .ca-stat-front,
    .ca-stat-back {
        padding: 18px;
    }

    .ca-stat-front {
        gap: 14px;
    }

    .ca-chart-grid {
        grid-template-columns: 1fr;
    }

    .ca-kpis .ca-stat strong {
        font-size: 30px;
    }

    .ca-kpis .ca-stat-icon {
        width: 50px;
        height: 68px;
    }
}

@media (max-width: 600px) {
    .ca-kpis {
        grid-template-columns: 1fr;
    }

    .ca-page .ca-period-note {
        padding-inline: 16px;
    }
}

/* Header dua tingkat dan scroll horizontal untuk breakdown setiap arah. */
.ca-page .ca-panel,
.ca-page [data-ca-results] {
    min-width: 0;
}

.ca-page [data-ca-scroll] {
    max-width: 100%;
    overflow: auto;
}

.ca-daily-table {
    width: max-content;
    min-width: 100%;
}

.ca-daily-table th,
.ca-daily-table td {
    white-space: nowrap;
    min-width: 72px;
}

.ca-daily-table thead tr:first-child th {
    height: 42px;
    box-sizing: border-box;
    padding-block: 12px;
}

.ca-daily-table thead tr:nth-child(2) th {
    top: 42px;
}

.ca-daily-table .ca-direction-head {
    text-align: center;
    border-right: 1px solid #e4d8c6;
}

.ca-daily-table .ca-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ca-daily-table .ca-direction-total {
    background: #fcf6e9;
    font-weight: 650;
}

.ca-daily-table .ca-group-end {
    border-right: 1px solid #e4d8c6;
}

.ca-daily-table .ca-date {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fffefa;
    min-width: 108px;
    border-right: 1px solid #e4d8c6;
}

.ca-daily-table thead .ca-date {
    z-index: 4;
    background: #f8f4ed;
}

.ca-page .ca-filters .ca-merge {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.ca-page .ca-merge input {
    width: 14px;
    height: 14px;
    min-height: 0;
    margin: 0;
    accent-color: #b7883d;
}

.ca-daily-table th,
.ca-daily-table td {
    border-right: 1px solid #e5dccf;
    border-bottom: 1px solid #e5dccf;
}

.ca-daily-table .ca-direction-head,
.ca-daily-table .ca-group-end,
.ca-daily-table .ca-date {
    border-right: 2px solid #b9a68b;
}

.ca-daily-table thead tr:first-child th {
    border-bottom: 2px solid #b9a68b;
}

.ca-daily-table thead tr:nth-child(2) th {
    border-bottom: 2px solid #b9a68b;
}

.ca-page .ca-period-note + .ca-period-note {
    padding-bottom: 16px;
}

/* Ukuran canvas dan ruang legenda kedua donut dibuat sama. */
.ca-chart-grid figure:not(:first-child) .ca-canvas {
    width: 100%;
    max-width: 260px;
    height: 320px;
    margin-inline: auto;
}
