.clients-insight {
    padding: 14px 14px 16px;
    border-bottom: 1px solid var(--ct-line, #e6edf4);
    background:
        radial-gradient(90% 80% at 0% 0%, rgba(22, 119, 255, 0.10), transparent 58%),
        radial-gradient(70% 80% at 100% 0%, rgba(18, 160, 106, 0.10), transparent 52%),
        var(--ct-surface, #fff);
}

.clients-insight__bar,
.clients-insight__form,
.clients-insight__pay,
.clients-insight__periods {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.clients-insight__bar {
    justify-content: space-between;
}

.clients-insight__form {
    margin: 0;
}

.clients-insight__periods {
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--ct-line, #e6edf4);
}

.clients-insight__period {
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--ct-muted, #5b6f67);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.clients-insight__period.is-active {
    background: #1677ff;
    color: #fff;
}

.clients-insight__date {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--ct-muted, #5b6f67);
    font-size: 13px;
    font-weight: 600;
}

.clients-insight__date input,
.clients-insight__form select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--ct-line, #d9e3dd);
    border-radius: 10px;
    background: #fff;
    color: var(--ct-ink, #10231c);
    font: inherit;
    font-size: 13px;
}

.clients-insight__date input:focus,
.clients-insight__form select:focus {
    outline: none;
    border-color: #1677ff;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.15);
}

.clients-insight__reset {
    color: var(--ct-muted, #5b6f67);
    font-size: 13px;
    font-weight: 600;
}

.clients-insight__pay {
    margin-top: 12px;
}

.clients-insight__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--ct-line, #e6edf4);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--ct-ink, #10231c);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.clients-insight__chip em {
    font-style: normal;
    color: var(--ct-muted, #5b6f67);
    font-weight: 600;
}

.clients-insight__chip.is-paid.is-active {
    background: #e9f8ef;
    border-color: #12a06a;
    color: #0d7a50;
}

.clients-insight__chip.is-unpaid.is-active {
    background: #eef3fb;
    border-color: #8aa0c8;
    color: #3d5278;
}

.clients-insight__chip.is-debt.is-active {
    background: #fff1ea;
    border-color: #ff7a3d;
    color: #c2410c;
}

.clients-insight__chip.is-all.is-active {
    background: #e8f1ff;
    border-color: #1677ff;
    color: #0958d9;
}

.clients-insight__money {
    margin-left: auto;
    padding: 7px 12px;
    border-radius: 999px;
    background: #10231c;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.clients-insight__stage {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
    gap: 12px;
    margin-top: 12px;
}

.clients-insight__card {
    margin: 0;
    padding: 14px 16px 12px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 10px 30px rgba(16, 35, 60, 0.06);
}

.clients-insight__card header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.clients-insight__card h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.clients-insight__card p {
    margin: 0;
    color: var(--ct-muted, #5b6f67);
    font-size: 12px;
}

.clients-insight__plot {
    height: 220px;
}

.clients-insight__plot canvas,
.clients-insight__donut canvas {
    display: block;
    width: 100% !important;
}

.clients-insight__donut {
    width: 168px;
    height: 168px;
    margin: 4px auto 10px;
}

.clients-insight__legend {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.clients-insight__legend li {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.clients-insight__legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.clients-insight__legend i.is-paid { background: #12a06a; }
.clients-insight__legend i.is-unpaid { background: #8aa0c8; }
.clients-insight__legend i.is-debt { background: #ff7a3d; }

.clients-insight__legend span { color: var(--ct-muted, #5b6f67); }
.clients-insight__legend strong { font-variant-numeric: tabular-nums; }

.clients-insight__empty {
    margin: 28px 0;
    text-align: center;
}

html[data-theme="dark"] .clients-insight__periods,
html[data-theme="dark"] .clients-insight__chip,
html[data-theme="dark"] .clients-insight__card,
html[data-theme="dark"] .clients-insight__date input,
html[data-theme="dark"] .clients-insight__form select {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: inherit;
}

html[data-theme="dark"] .clients-insight__period.is-active {
    background: #1677ff;
    color: #fff;
}

html[data-theme="dark"] .clients-insight__money {
    background: #1677ff;
}

@media (max-width: 860px) {
    .clients-insight__stage {
        grid-template-columns: minmax(0, 1fr);
    }

    .clients-insight__money {
        margin-left: 0;
    }

    .clients-insight__plot {
        height: 180px;
    }
}
