/* =====================================================================
   Payments received → Insights — iOS 26 "Liquid Glass"
   ---------------------------------------------------------------------
   The Insights tab of /invoice_payments (app/Views/invoices/
   yearly_payments_chart.php) is built out of the dashboard sheet: its
   wrapper carries `.nz-dash26`, so the KPI readouts, the stat tiles, the
   glass cards, the section headings and the chart look all come from
   assets/css/dashboard-ios26.css. This file only adds what the panel
   itself invents —

     .nz-pay-controls   the year tabs and the currency dropdown, one row
     .nz-pay-delta      a "+12.5%" pill with the growth / decline colour
     .nz-pay-periods    the two semesters as stacked readouts with a bar
     .nz-pay-quarter    the four quarter tiles (a Q-badge in the plate)
     .nz-pay-split      the payment-method ring beside its legend
     .nz-pay-list       a plain iOS list: dot, label, value, share
     .nz-pay-ranking    the top-paying clients, numbered, with a bar

   Everything is scoped to `.nz-pay-insights` so it cannot reach the
   dashboard or any other page that wears `.nz-dash26`.

   Colours come from the shared --ios26-* tokens declared in app.all.css,
   which body.color-1E202D re-declares — dark mode needs no duplicated
   rules here, except where 1E202D.css (injected at runtime) repaints a
   class this file also uses.
   ===================================================================== */

/* the panel sits inside the page card's tab pane, not on the page itself */
.nz-pay-insights {
    padding: 16px 16px 4px;
}

/* --------------------------------------------- the controls row --- */

.nz-pay-insights .nz-pay-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 var(--nz-gap, 16px);
}

.nz-pay-insights .nz-pay-years {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    border-radius: var(--ios26-radius);
}

.nz-pay-insights .nz-pay-currency {
    flex: 0 0 auto;
}

/* ------------------------------------------------- the delta pill --- */

.nz-pay-insights .nz-pay-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: var(--ios26-pill);
    background: var(--ios26-fill);
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    font-variant-numeric: tabular-nums;
    color: var(--ios26-muted);
    vertical-align: middle;
}

.nz-pay-insights .nz-pay-delta i {
    font-size: 10px;
}

/* growth and decline are the two numbers on this panel that earn a colour */
.nz-pay-insights .nz-pay-delta.is-up {
    background: rgba(1, 179, 147, 0.14);
    color: #0b6b59;
}

.nz-pay-insights .nz-pay-delta.is-down {
    background: rgba(245, 50, 92, 0.12);
    color: #b3123a;
}

body.color-1E202D .nz-pay-insights .nz-pay-delta.is-up {
    color: #57dcc0;
}

body.color-1E202D .nz-pay-insights .nz-pay-delta.is-down {
    color: #ff8aa4;
}

/* ------------------------------------------------- the semesters --- */

.nz-pay-insights .nz-pay-periods {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nz-pay-insights .nz-pay-period {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ios26-hairline);
}

.nz-pay-insights .nz-pay-period:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.nz-pay-insights .nz-pay-period-head,
.nz-pay-insights .nz-pay-period-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

/* the two facts under the bar wrap onto their own lines in a narrow
   column instead of being cut mid-word */
.nz-pay-insights .nz-pay-period-foot {
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
}

.nz-pay-insights .nz-pay-period-foot .nz-stat-sub {
    margin: 0;
    white-space: normal;
    overflow: visible;
}

.nz-pay-insights .nz-pay-period-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ios26-text);
}

.nz-pay-insights .nz-pay-period-name .nz-stat-sub {
    font-weight: 500;
}

/* the semester's own colour on its bar */
.nz-pay-insights .nz-pay-period .progress-bar {
    background: var(--nz-tint, var(--ios26-accent));
}

/* --------------------------------------------------- the quarters --- */

/* the tile's title is "Trimester 1" with the months as a lighter suffix */
.nz-pay-insights .nz-pay-quarter .nz-stat-title .nz-stat-sub {
    margin: 0 0 0 4px;
    font-weight: 500;
}

/* the plate holds "Q1" instead of a glyph */
.nz-pay-insights .nz-pay-quarter-badge {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--nz-tint, var(--ios26-accent));
}

.nz-pay-insights .nz-pay-quarter .progress-bar {
    background: var(--nz-tint, var(--ios26-accent));
}

.nz-pay-insights .nz-pay-quarter-deltas {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nz-pay-insights .nz-pay-quarter-deltas .nz-stat-sub {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* a quarter that has not started yet is on the page so the row stays
   whole, but it says nothing — so it fades back */
.nz-pay-insights .nz-pay-quarter.is-future {
    opacity: 0.55;
}

/* ------------------------------------------- the payment methods --- */

/* the ring sits above its legend: side by side, a five-column card at
   laptop width left the labels 0px wide */
.nz-pay-insights .nz-pay-split {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nz-pay-insights .nz-pay-split-chart {
    position: relative;
    width: 100%;
    max-width: 300px;
    min-height: 170px;
    margin: 0 auto;
}

/* ----------------------------------------------------- the iOS list --- */

.nz-pay-insights .nz-pay-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nz-pay-insights .nz-pay-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--ios26-hairline);
    font-size: 13px;
    line-height: 1.35;
}

.nz-pay-insights .nz-pay-list li:last-child {
    border-bottom: 0;
}

.nz-pay-insights .nz-pay-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.nz-pay-insights .nz-pay-list-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ios26-muted);
}

.nz-pay-insights a.nz-pay-list-label {
    color: var(--ios26-text);
    font-weight: 600;
}

.nz-pay-insights .nz-pay-list-value {
    flex: 0 0 auto;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    color: var(--ios26-text);
}

.nz-pay-insights .nz-pay-list-sub {
    flex: 0 0 34px;
    text-align: right;
    font-size: 12px;
    color: var(--ios26-muted);
    font-variant-numeric: tabular-nums;
}

/* the ageing legend under its chart: a wrapping row of small items */
.nz-pay-insights .nz-pay-list-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-top: 10px;
}

.nz-pay-insights .nz-pay-list-inline li {
    flex: 0 0 auto;
    padding: 2px 0;
    border-bottom: 0;
    font-size: 12px;
}

.nz-pay-insights .nz-pay-list-inline .nz-pay-list-label {
    flex: 0 0 auto;
}

/* ------------------------------------------------ the top clients --- */

.nz-pay-insights .nz-pay-ranking {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nz-pay-insights .nz-pay-ranking li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--ios26-hairline);
}

.nz-pay-insights .nz-pay-ranking li:last-child {
    border-bottom: 0;
}

.nz-pay-insights .nz-pay-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    margin-top: 1px;
    border-radius: 9px;
    background: var(--nz-tint-soft, var(--ios26-accent-soft));
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--nz-tint, var(--ios26-accent));
}

.nz-pay-insights .nz-pay-rank-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.nz-pay-insights .nz-pay-rank-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}

.nz-pay-insights .nz-pay-ranking .progress-bar {
    background: var(--nz-tint, var(--ios26-accent));
}

.nz-pay-insights .nz-pay-warn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #b45309;
    font-weight: 600;
}

body.color-1E202D .nz-pay-insights .nz-pay-warn {
    color: #fbbf24;
}

/* ------------------------------------------------------- the charts --- */

 /* dashboard-ios26.css (loaded after this file) sets .nz-chart-box at
   230px with the same specificity, so these carry the sheet class too */
.nz-dash26.nz-pay-insights .nz-pay-chart-box {
    height: 260px;
}

.nz-dash26.nz-pay-insights .nz-pay-ageing-box {
    height: 190px;
}

.nz-pay-insights .nz-stat-figure small {
    font-size: 60%;
    font-weight: 600;
    color: var(--ios26-muted);
}

/* --------------------------------------------------------- dark theme --- */

/* 1E202D.css repaints `.nav-tabs.bg-white` and the card after this file loads */
body.color-1E202D .nz-pay-insights .nz-pay-dot {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

body.color-1E202D .nz-pay-insights .nz-pay-list li,
body.color-1E202D .nz-pay-insights .nz-pay-ranking li,
body.color-1E202D .nz-pay-insights .nz-pay-period {
    border-bottom-color: var(--ios26-hairline) !important;
}

/* -------------------------------------------------------- small screens --- */

@media (max-width: 767px) {
    .nz-pay-insights {
        padding: 10px 8px 2px;
    }

    .nz-pay-insights .nz-pay-controls {
        flex-wrap: wrap;
    }

    .nz-pay-insights .nz-pay-currency {
        flex: 1 1 100%;
    }

    .nz-dash26.nz-pay-insights .nz-pay-chart-box {
        height: 220px;
    }

    .nz-pay-insights .nz-pay-period-foot,
    .nz-pay-insights .nz-pay-quarter-deltas .nz-stat-sub {
        white-space: normal;
    }
}
