.bill {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: opacity .2s ease;
}

.bill-loading {
    opacity: .6;
}

.bill-minus {
    color: var(--danger);
}

.bill-filters {
    margin-bottom: 1rem;
    padding: .95rem 1.1rem;
}

.bill-filter-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
    align-items: end;
    gap: .75rem;
}

.bill-show {
    height: 38px;
}

.bill-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .75rem;
}

.bill-kpis {
    display: grid;
    grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.bill-kpi {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
    padding: .8rem .95rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.bill-kpi-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
}

.bill-kpi-value {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.bill-kpi-value.bill-minus {
    color: var(--danger);
}

.bill-kpi-sub {
    font-size: .74rem;
    color: var(--muted);
}

.bill-kpi-hero {
    border-color: transparent;
    background:
        radial-gradient(110% 120% at 100% 0%, rgba(125, 114, 242, .9) 0%, rgba(125, 114, 242, 0) 58%),
        linear-gradient(140deg, #4D41DA 0%, #3F34BF 52%, #2B2480 100%);
    box-shadow: var(--shadow-primary);
}

.bill-kpi-hero .bill-kpi-label,
.bill-kpi-hero .bill-kpi-sub {
    color: rgba(255, 255, 255, .82);
}

.bill-kpi-hero .bill-kpi-value {
    font-size: 1.3rem;
    color: #fff;
}

.bill-notice {
    display: flex;
    gap: .75rem;
    padding: .8rem .95rem;
    border-radius: var(--radius-lg);
    background: var(--warning-bg);
    border: 1px solid #F6D9A8;
    color: #6B4304;
}

.bill-notice-icon {
    color: #B5630A;
    flex-shrink: 0;
    margin-top: .1rem;
}

.bill-notice strong {
    font-size: .84rem;
}

.bill-notice p {
    margin-top: .3rem;
    font-size: .78rem;
    line-height: 1.65;
}

.bill-notice-help {
    color: #8A5A10;
}

.bill-city-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: 0 .25rem .15rem 0;
    padding: .05rem .5rem;
    border-radius: 999px;
    background: #FFFFFF;
    border: 1px solid #F1CF96;
    font-size: .72rem;
    font-weight: 600;
}

.bill-city-chip b {
    color: #B5630A;
}

.bill-notice-body {
    flex: 1;
    min-width: 0;
}

.bill-issues {
    list-style: none;
    margin: .55rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.bill-issues li {
    padding: .55rem .7rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, .65);
    border: 1px solid #F6D9A8;
}

.bill-issue-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
    font-size: .82rem;
}

.bill-issue-count {
    padding: .02rem .5rem;
    border-radius: 999px;
    background: #B5630A;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
}

.bill-issue-items {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .35rem;
}

.bill-issue-items .bill-city-chip {
    margin: 0;
}

.bill-issue-more {
    font-size: .74rem;
    color: #8A5A10;
    align-self: center;
}

.bill-issues .bill-notice-help {
    margin-top: .3rem;
    line-height: 1.5;
}

.bill-vendors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: .75rem;
}

.bill-vendor {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
    padding: .9rem .95rem .95rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s, transform .15s;
    font: inherit;
    color: inherit;
}

.bill-vendor::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-400));
    opacity: .85;
}

.bill-vendor:hover {
    border-color: var(--primary-200);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.bill-vendor-head {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .15rem;
}

.bill-vendor-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-50);
    color: var(--primary);
}

.bill-vendor-name {
    flex: 1;
    min-width: 0;
    font-weight: 700;
    font-size: .88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bill-vendor-go {
    color: var(--muted);
}

.bill-vendor:hover .bill-vendor-go {
    color: var(--primary);
}

.bill-vendor-label {
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.bill-vendor-amount {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.bill-vendor-split {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem .9rem;
    padding: .4rem .55rem;
    border-radius: var(--radius-sm);
    background: #FAFAFD;
    border: 1px solid var(--border);
    font-size: .74rem;
    color: var(--text-2);
}

.bill-vendor-split b {
    font-variant-numeric: tabular-nums;
}

.bill-vendor-meta {
    font-size: .76rem;
    color: var(--muted);
}

.bill-vendor-warns {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.bill-share {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.bill-share-bar {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: var(--primary-100);
    overflow: hidden;
}

.bill-share-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
}

.bill-share-text {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-2);
    min-width: 40px;
    text-align: right;
}

.bill-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    padding: 2rem 1rem;
    text-align: center;
}

.bill-empty p {
    font-size: .82rem;
    color: var(--muted);
}

.bill-back {
    align-self: flex-start;
}

.bill-card-title {
    font-size: .95rem;
    font-weight: 700;
}

.bill-issue {
    white-space: normal;
    text-align: left;
    max-width: 320px;
    line-height: 1.35;
}

.stmt {
    border-radius: var(--radius-lg);
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(90% 140% at 100% 0%, rgba(125, 114, 242, .85) 0%, rgba(125, 114, 242, 0) 60%),
        linear-gradient(135deg, #4D41DA 0%, #3F34BF 50%, #2B2480 100%);
    box-shadow: var(--shadow-primary);
}

.stmt-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .9rem 1.5rem;
    padding: .9rem 1.1rem;
}

.stmt-who {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
}

.stmt-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .22);
}

.stmt-eyebrow {
    display: block;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
}

.stmt-who h2 {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.25;
}

.stmt-who p {
    font-size: .74rem;
    color: rgba(255, 255, 255, .78);
}

.stmt-sum {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}

.stmt-part {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    min-width: 120px;
    padding: .45rem .75rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .16);
}

.stmt-part span {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .75);
}

.stmt-part b {
    font-size: .92rem;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.stmt-op {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .65);
}

.stmt-net {
    background: #fff;
    border-color: #fff;
}

.stmt-net span {
    color: var(--primary);
}

.stmt-net b {
    font-size: 1rem;
    color: var(--text);
}

.bill-card-sub {
    display: block;
    font-size: .76rem;
    color: var(--muted);
}

.bill-paid {
    color: var(--success);
}

.bill-kpi-value.bill-paid {
    color: var(--success);
}

.stmt-pay {
    margin-left: .6rem;
    background: #fff;
    color: var(--primary-700);
    border: 1px solid #fff;
    font-weight: 700;
}

.stmt-pay:hover:not(:disabled) {
    background: var(--primary-50);
    border-color: var(--primary-50);
}

.pay-log td {
    vertical-align: top;
}

.pay-plus {
    font-weight: 700;
    color: var(--success);
}

.pay-log .bill-minus {
    font-weight: 700;
}

.pay-note {
    min-width: 160px;
    max-width: 320px;
    white-space: normal;
    color: var(--text-2);
}

.pay-row-reversal td {
    background: #FFF8F8;
}

.pay-row-undone .pay-plus {
    color: var(--muted);
    text-decoration: line-through;
}

.led-table td.num {
    font-variant-numeric: tabular-nums;
}

.led-table .batch-from {
    max-width: 220px;
}

.led-balance {
    font-weight: 700;
    color: var(--primary-700);
}

.led-table tr.row-open td {
    border-bottom-color: transparent;
}

.led-detail {
    contain: inline-size;
    padding: .2rem .9rem .9rem 2.6rem;
}

.led-cns-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.led-table .led-cns {
    font-size: .8rem;
}

.led-cns th {
    position: static;
    font-size: .66rem;
    padding: .5rem .7rem;
}

.led-cns td {
    padding: .5rem .7rem;
    vertical-align: top;
}

.led-cns .cell-sub {
    font-size: .7rem;
}

.led-shop {
    min-width: 140px;
}

.led-cns td.led-cn-toggle {
    width: 26px;
    padding-right: 0;
    color: var(--primary);
}

.led-cns tr.row-click:hover td {
    background: #FBFAFF;
}

.led-return {
    color: var(--primary);
    font-weight: 600;
}

.led-within {
    color: #0B7A6B;
    font-weight: 600;
}

.led-norate {
    font-weight: 600;
    color: var(--warning);
}

.led-cns tr.row-open td {
    border-bottom: 0;
    background: #FBFAFF;
}

.led-claim-row td {
    padding: 0 .7rem .7rem;
    background: #FBFAFF;
}

.led-claims {
    margin-left: 26px;
    border: 1px solid #F3D2D3;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.led-claims-title {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .7rem;
    background: #FFF5F5;
    border-bottom: 1px solid #F6DCDD;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #9E2A2F;
}

.led-claims-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .76rem;
}

.led-claims-table th {
    padding: .4rem .7rem;
    text-align: left;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.led-claims-table td {
    padding: .45rem .7rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    background: #fff;
}

.led-claims-table tr:last-child td {
    border-bottom: 0;
}

.led-claims-table .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.led-claim-remarks {
    min-width: 140px;
    max-width: 260px;
    white-space: normal;
}

.led-table tfoot td {
    padding: .65rem .8rem;
    border-top: 2px solid var(--primary-100);
    background: var(--primary-50);
    font-weight: 700;
    color: var(--text);
}

@media (max-width: 1100px) {
    .bill-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bill-kpi-hero {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .bill-kpis {
        grid-template-columns: minmax(0, 1fr);
    }

    .bill-filter-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .bill-vendor-field,
    .bill-show {
        grid-column: 1 / -1;
    }

    .stmt-sum {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stmt-part {
        min-width: 0;
    }

    .stmt-net {
        grid-column: 1 / -1;
    }

    .stmt-op {
        display: none;
    }

    .led-detail {
        padding: .2rem .6rem .8rem;
    }
}
