/* Customers list: one animated toolbar and portrait account cards.
   Debtors use the red tone, creditors green, settled accounts blue. */

#view-customers .cx-wrap,
.acc-cards-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 12px;
}

/* ---------- toolbar ---------- */
.cx-bar {
    position: relative;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--theme-stroke, rgba(255,255,255,.8));
    border-radius: 22px;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, #4a86e0 16%, transparent), transparent 46%),
        radial-gradient(circle at 0% 100%, color-mix(in srgb, #8a4fe0 10%, transparent), transparent 50%),
        var(--theme-glass, rgba(255,255,255,.9));
    box-shadow: 0 12px 28px rgba(40,70,130,.1), inset 0 1px 0 var(--theme-highlight, rgba(255,255,255,.7));
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    animation: cxRise .5s both;
}

/* On a narrow phone the strip scrolls inside the toolbar instead of widening the page. */
.cx-seg {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--theme-stroke, rgba(255,255,255,.8));
    border-radius: 17px;
    background: color-mix(in srgb, var(--panel, #fff) 60%, transparent);
}

.cx-pill {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 0;
    border-radius: 13px;
    background: linear-gradient(145deg, #6aa0f2, #2f5fc4);
    box-shadow: 0 8px 18px rgba(47,95,196,.34);
    transition: left .45s cubic-bezier(.3,1.2,.4,1), width .45s cubic-bezier(.3,1.2,.4,1), background .35s ease, box-shadow .35s ease;
}

.cx-pill.is-debt {
    background: linear-gradient(145deg, #f3a08c, #c8432d);
    box-shadow: 0 8px 18px rgba(200,67,45,.34);
}

.cx-pill.is-credit {
    background: linear-gradient(145deg, #6fd9ae, #17805a);
    box-shadow: 0 8px 18px rgba(23,128,90,.34);
}

.cx-seg button {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 15px;
    border: 0;
    border-radius: 13px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text2);
    background: transparent;
    cursor: pointer;
    transition: color .25s ease;
}

.cx-seg button:hover {
    color: var(--text1);
}

.cx-seg button.is-on {
    color: #fff;
}

.cx-seg button i {
    font-size: 17px;
}

.cx-seg button.is-on i {
    animation: cxFloat 2.6s ease-in-out infinite;
}

.cx-seg button em {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 99px;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    text-align: center;
    background: color-mix(in srgb, var(--text2) 16%, transparent);
}

.cx-seg button.is-on em {
    background: rgba(255,255,255,.3);
}

.cx-find {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 190px;
    max-width: 300px;
    min-width: 190px;
    height: 46px;
    padding: 0 12px;
    border: 1px solid color-mix(in srgb, #4a86e0 22%, var(--border, rgba(0,0,0,.1)));
    border-radius: 15px;
    background: color-mix(in srgb, var(--panel, #fff) 70%, transparent);
    transition: box-shadow .25s ease, border-color .25s ease;
}

.cx-find:focus-within {
    border-color: #4a86e0;
    box-shadow: 0 0 0 4px color-mix(in srgb, #4a86e0 16%, transparent);
}

.cx-find i {
    font-size: 18px;
    color: #4a86e0;
    transition: transform .3s ease;
}

.cx-find:focus-within i {
    transform: scale(1.15) rotate(-8deg);
}

#view-customers .cx-find input,
.acc-cards-wrap .cx-find input {
    flex: 1;
    width: auto;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--text1);
    background: transparent;
}

.cx-dd {
    position: relative;
    margin-inline-start: auto;
}

.cx-dd-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 12px 0 14px;
    border: 1px solid color-mix(in srgb, #8a4fe0 30%, var(--theme-stroke, #fff));
    border-radius: 15px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    color: var(--text1);
    background: linear-gradient(135deg, color-mix(in srgb, #8a4fe0 14%, transparent), transparent 80%);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.cx-dd-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(138,79,224,.2);
}

.cx-dd-chip {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    font-size: 18px;
    color: #fff;
    background: linear-gradient(145deg, #b58af2, #8a4fe0);
    box-shadow: 0 6px 14px rgba(138,79,224,.34);
}

.cx-dd-copy small {
    display: block;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text2);
}

.cx-dd-btn > i {
    font-size: 16px;
    color: var(--text2);
    transition: transform .3s ease;
}

.cx-dd.is-open .cx-dd-btn > i {
    transform: rotate(180deg);
}

.cx-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 230px;
    padding: 8px;
    border: 1px solid var(--theme-stroke, rgba(255,255,255,.8));
    border-radius: 20px;
    background: color-mix(in srgb, var(--panel, #fff) 98%, transparent);
    box-shadow: 0 22px 44px rgba(30,40,80,.22);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform-origin: top;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(.96);
    transition: opacity .22s ease, transform .3s cubic-bezier(.2,.9,.3,1.15), visibility 0s .3s;
}

.cx-dd.is-open .cx-menu {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
}

.cx-menu button {
    --c: #8a4fe0;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    text-align: start;
    color: var(--text1);
    background: transparent;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.cx-dd.is-open .cx-menu button {
    animation: cxRise .35s both;
}

.cx-menu button:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, transparent), transparent 85%);
}

.cx-menu button.is-sel {
    border-color: color-mix(in srgb, var(--c) 40%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--c) 20%, transparent), color-mix(in srgb, var(--c) 6%, transparent));
}

.cx-menu-ico {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 17px;
    color: #fff;
    background: linear-gradient(145deg, color-mix(in srgb, var(--c) 55%, #fff), var(--c));
}

.cx-menu button b {
    flex: 1;
}

.cx-menu-ok {
    font-size: 17px;
    color: var(--c);
    opacity: 0;
    transform: scale(.4);
    transition: opacity .3s ease, transform .3s cubic-bezier(.3,1.5,.4,1);
}

.cx-menu button.is-sel .cx-menu-ok {
    opacity: 1;
    transform: none;
}

.cx-tools {
    display: flex;
    gap: 8px;
}

.cx-tb {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 0 15px;
    border: 1px solid color-mix(in srgb, #17996a 30%, var(--theme-stroke, #fff));
    border-radius: 15px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text1);
    background: linear-gradient(135deg, color-mix(in srgb, #17996a 12%, transparent), transparent 80%);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.cx-tb i {
    font-size: 19px;
    color: #17996a;
}

.cx-tb:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(23,153,106,.2);
}

.cx-tb:hover i {
    animation: cxWobble .6s;
}

.cx-tb.is-primary {
    overflow: hidden;
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, #6aa0f2, #2a5db0);
    box-shadow: 0 8px 18px rgba(42,93,176,.32);
}

.cx-tb.is-primary i {
    color: #fff;
}

.cx-tb.is-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.4) 50%, transparent 65%);
    transform: translateX(120%);
    animation: cxShine 4.5s ease-in-out infinite;
}

/* ---------- cards ---------- */
.cx-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.cx-card {
    --c: #d8503a;
    --c2: #f3a08c;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--c) 32%, var(--theme-stroke, #fff));
    border-radius: 24px;
    background: linear-gradient(160deg, color-mix(in srgb, var(--c2) 38%, var(--panel, #fff)), color-mix(in srgb, var(--c) 7%, var(--panel, #fff)) 62%, var(--panel, #fff));
    box-shadow: 0 10px 26px color-mix(in srgb, var(--c) 14%, transparent);
    overflow: hidden;
    cursor: pointer;
    animation: cxRise .55s both;
    transition: transform .3s cubic-bezier(.2,.9,.3,1.1), box-shadow .3s ease;
}

.cx-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 38px color-mix(in srgb, var(--c) 26%, transparent);
}

.cx-card.is-credit {
    --c: #17996a;
    --c2: #7fd8b2;
}

.cx-card.is-settled {
    --c: #4a6fd8;
    --c2: #a6bcf3;
}

/* The till attendant's card: cash held for the station, not a debt. */
.cx-card.is-cash {
    --c: #c98410;
    --c2: #f3cf80;
}

/* Employee accounts: the summary tiles share the details-page look, in the blue of the employees section. */
.acc-stats-wrap {
    --edx-a: #6a8cf0;
    --edx-b: #3d5bd6;
    --edx-h1: #4f6fe0;
    --edx-h2: #2b3f9e;
    --edx-t: #4a66dc;
    margin-top: 6px;
}

@media (max-width: 700px) {
    .acc-stats-wrap .edx-stat.is-hero {
        grid-column: 1 / -1;
    }

    .acc-stats-wrap .edx-stat strong {
        font-size: 17px;
    }
}

.cx-glow {
    position: absolute;
    top: -60px;
    inset-inline-end: -50px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--c) 30%, transparent), transparent 70%);
    animation: cxBreathe 4.5s ease-in-out infinite;
    pointer-events: none;
}

.cx-top {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.cx-kind {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 8px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 800;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 14%, transparent);
}

.cx-kind i {
    font-size: 15px;
    animation: cxFloat 2.8s ease-in-out infinite;
}

.cx-round {
    display: flex;
    gap: 6px;
}

.cx-round button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border, rgba(0,0,0,.1));
    border-radius: 50%;
    font-size: 16px;
    color: var(--text2);
    background: var(--panel, #fff);
    cursor: pointer;
    transition: transform .25s ease, color .25s ease;
}

.cx-round button:hover {
    transform: rotate(-12deg) scale(1.1);
    color: var(--c);
}

.cx-who {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
}

.cx-ring {
    position: relative;
    width: 76px;
    height: 76px;
    flex: none;
}

.cx-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.cx-ring circle {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
}

.cx-ring .cx-tr {
    stroke: color-mix(in srgb, var(--c) 16%, transparent);
}

.cx-ring .cx-pg {
    stroke: var(--c);
    stroke-dasharray: var(--len) 999;
    animation: cxFillRing 1.2s cubic-bezier(.2,.8,.2,1) both;
    filter: drop-shadow(0 2px 4px color-mix(in srgb, var(--c) 45%, transparent));
}

.cx-av {
    position: absolute;
    inset: 11px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(145deg, color-mix(in srgb, var(--c) 55%, #fff), var(--c));
    box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 40%, transparent);
}

.cx-av img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    max-width: none !important;
}

.cx-pc {
    position: absolute;
    bottom: -4px;
    inset-inline-start: -6px;
    padding: 1px 7px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 800;
    color: var(--c);
    background: var(--panel, #fff);
    box-shadow: 0 2px 8px rgba(0,0,0,.14);
}

.cx-name {
    min-width: 0;
}

.cx-name b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
    font-weight: 800;
    color: var(--text1);
}

.cx-name small {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text2);
}

.cx-amt {
    position: relative;
    padding: 12px 14px;
    overflow: hidden;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--c2) 70%, #fff), var(--c));
    box-shadow: 0 10px 20px color-mix(in srgb, var(--c) 28%, transparent);
}

.cx-amt::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
    transform: translateX(120%);
    animation: cxShine 4.5s ease-in-out infinite;
}

.cx-wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .14;
    pointer-events: none;
}

.cx-amt small {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 800;
    opacity: .92;
}

.cx-amt strong {
    position: relative;
    display: block;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.3;
}

.cx-amt strong em {
    margin-inline-start: 4px;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    opacity: .85;
}

.cx-usd {
    position: relative;
    display: inline-block;
    margin-top: 2px;
    padding: 0 9px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255,255,255,.24);
}

.cx-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.cx-mini > div {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--c) 18%, var(--border, rgba(0,0,0,.1)));
    border-radius: 14px;
    background: var(--panel, #fff);
}

.cx-mini i {
    width: 28px;
    height: 28px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: 16px;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 14%, transparent);
}

.cx-mini span {
    min-width: 0;
}

.cx-mini small {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text2);
}

.cx-mini b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text1);
}

.cx-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.cx-foot button {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border, rgba(0,0,0,.1)));
    border-radius: 13px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text1);
    background: var(--panel, #fff);
    cursor: pointer;
    transition: transform .25s ease;
}

.cx-foot button.is-primary {
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c));
    box-shadow: 0 7px 14px color-mix(in srgb, var(--c) 28%, transparent);
}

.cx-foot button:hover {
    transform: translateY(-2px);
}

.cx-foot:has(button:only-child) {
    grid-template-columns: 1fr;
}

.cx-empty {
    grid-column: 1 / -1;
    padding: 30px 10px;
    border: 1.5px dashed var(--border-strong, rgba(0,0,0,.2));
    border-radius: 20px;
    font-weight: 800;
    text-align: center;
    color: var(--text2);
}

.cx-empty i {
    display: block;
    margin-bottom: 6px;
    font-size: 28px;
}

/* ---------- Pashto sizes ---------- */
html[lang="ps"] .cx-seg button,
html[lang="ps"] .cx-tb,
html[lang="ps"] .cx-dd-btn,
html[lang="ps"] .cx-foot button {
    font-size: 15px;
}

html[lang="ps"] .cx-name small,
html[lang="ps"] .cx-mini small,
html[lang="ps"] .cx-amt small,
html[lang="ps"] .cx-kind {
    font-size: 13.5px;
}

html[lang="ps"] .cx-name b {
    font-size: 19.5px;
}

@keyframes cxRise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@keyframes cxFloat {
    50% { transform: translateY(-2px); }
}

@keyframes cxBreathe {
    50% {
        transform: scale(1.25);
        opacity: .7;
    }
}

@keyframes cxFillRing {
    from { stroke-dasharray: 0 999; }
}

@keyframes cxShine {
    60%, 100% { transform: translateX(-120%); }
}

@keyframes cxWobble {
    25% { transform: rotate(-14deg); }
    75% { transform: rotate(14deg); }
}

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

@media (max-width: 720px) {
    .cx-list {
        grid-template-columns: 1fr;
    }

    .cx-find {
        max-width: none;
        flex-basis: 100%;
    }

    .cx-dd {
        margin-inline-start: 0;
        flex: 1;
    }

    .cx-dd-btn {
        width: 100%;
    }

    .cx-tools {
        width: 100%;
        flex-direction: column;
    }

    .cx-tb {
        flex: 1;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cx-card,
    .cx-bar,
    .cx-glow,
    .cx-amt::after,
    .cx-tb.is-primary::after,
    .cx-ring .cx-pg {
        animation: none !important;
    }
}
