.lpbc-budget-widget {
    background: #ffffff;
    border: 0.5px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
    font-family: inherit;
}

.lpbc-budget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.lpbc-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #1d2327;
}

.lpbc-role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f5f5f5;
    border: 0.5px solid #ddd;
    color: #666;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.lpbc-budget-bar-wrap {
    background: #ebebeb;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 6px;
}

.lpbc-budget-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .4s ease;
}

.lpbc-bar-ok      { background: #43a047; }
.lpbc-bar-warning { background: #fb8c00; }
.lpbc-bar-danger  { background: #e53935; }

.lpbc-bar-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.lpbc-bar-meta span {
    font-size: 12px;
    color: #999;
}

.lpbc-budget-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.lpbc-budget-cell {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px 12px;
}

.lpbc-budget-cell.lpbc-remaining {
    background: #e8f5e9;
}

.lpbc-cell-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #999;
    margin-bottom: 6px;
}

.lpbc-cell-value {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: #1d2327;
}

.lpbc-remaining .lpbc-cell-label { color: #388e3c; }
.lpbc-remaining .lpbc-cell-value { color: #2e7d32; }

@media (max-width: 520px) {
    .lpbc-budget-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LPBC Frontend CSS additions – Budget Widget + History Popup
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Widget ─────────────────────────────────────────────────────────────── */
.lpbc-budget-widget {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px 20px 14px;
    font-family: inherit;
    max-width: 420px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

.lpbc-budget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.lpbc-title {
    font-size: 14px;
    font-weight: 600;
    color: #111;
}

.lpbc-role-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.lpbc-badge-vip {
    background: #fff8e1;
    color: #b45309;
    border: 1px solid #fde68a;
}

.lpbc-badge-normal {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* ── Progress bar ───────────────────────────────────────────────────────── */
.lpbc-budget-bar-wrap {
    background: #f1f5f9;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 6px;
}

.lpbc-budget-bar {
    height: 100%;
    border-radius: 6px;
    transition: width .4s ease;
}

.lpbc-bar-ok {
    background: #22c55e;
}

.lpbc-bar-warning {
    background: #f59e0b;
}

.lpbc-bar-danger {
    background: #ef4444;
}

.lpbc-bar-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 14px;
}

/* ── Grid cells ─────────────────────────────────────────────────────────── */
.lpbc-budget-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.lpbc-budget-cell {
    text-align: center;
}

.lpbc-cell-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #9ca3af;
    margin-bottom: 3px;
}

.lpbc-cell-value {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #111;
}

.lpbc-remaining .lpbc-cell-value {
    color: #16a34a;
}

/* ── Widget footer: reset info + history button ─────────────────────────── */
.lpbc-widget-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    gap: 10px;
    flex-wrap: wrap;
}

.lpbc-reset-info {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lpbc-reset-info .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}

/* ── History trigger button ─────────────────────────────────────────────── */
.lpbc-history-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1;
    font-family: inherit;
}

.lpbc-history-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.lpbc-history-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.lpbc-history-count {
    background: #e2e8f0;
    color: #475569;
    border-radius: 20px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
}

.lpbc-history-btn:hover .lpbc-history-count {
    background: #bfdbfe;
    color: #1d4ed8;
}

/* ── Normal user widget ─────────────────────────────────────────────────── */
.lpbc-normal-user .lpbc-no-limit-msg {
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0 0;
}

/* ── Popup overlay ──────────────────────────────────────────────────────── */
.lpbc-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.lpbc-popup-overlay.lpbc-popup-open {
    display: flex;
    animation: lpbc-fade-in .18s ease;
}

@keyframes lpbc-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Popup card ─────────────────────────────────────────────────────────── */
.lpbc-popup {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: lpbc-slide-up .2s ease;
    overflow: hidden;
}

@keyframes lpbc-slide-up {
    from {
        transform: translateY(16px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ── Popup header ───────────────────────────────────────────────────────── */
.lpbc-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.lpbc-popup-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 700;
    color: #111;
}

.lpbc-popup-title .dashicons {
    color: #6b7280;
    font-size: 17px;
    width: 17px;
    height: 17px;
}

.lpbc-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #9ca3af;
    line-height: 1;
    padding: 0 4px;
    transition: color .15s;
    font-family: inherit;
}

.lpbc-popup-close:hover {
    color: #111;
}

/* ── Popup body (scrollable) ────────────────────────────────────────────── */
.lpbc-popup-body {
    overflow-y: auto;
    flex: 1;
    padding: 0;
}

/* ── History table ──────────────────────────────────────────────────────── */
.lpbc-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.lpbc-history-table thead {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
}

.lpbc-history-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #9ca3af;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.lpbc-history-table td {
    padding: 11px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.lpbc-history-table tr:last-child td {
    border-bottom: none;
}

.lpbc-history-table tbody tr:hover td {
    background: #fafafa;
}

/* Refunded row dimming */
.lpbc-tx-refunded td {
    opacity: .65;
}

.lpbc-tx-service {
    font-weight: 500;
    color: #111;
}

.lpbc-tx-date {
    color: #9ca3af;
    white-space: nowrap;
    font-size: 12px;
}

.lpbc-tx-amount {
    font-weight: 700;
    white-space: nowrap;
    color: #111;
}

.lpbc-amount-refunded {
    color: #16a34a !important;
}

.lpbc-sign {
    font-size: 11px;
    margin-right: 1px;
}

.lpbc-sign--minus {
    color: #ef4444;
}

.lpbc-sign--plus {
    color: #16a34a;
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.lpbc-tx-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.lpbc-tx-badge--approved {
    background: #dcfce7;
    color: #15803d;
}

.lpbc-tx-badge--refunded {
    background: #fff7ed;
    color: #c2410c;
}

.lpbc-tx-badge--pending {
    background: #fef9c3;
    color: #92400e;
}

/* ── Body scroll lock ───────────────────────────────────────────────────── */
body.lpbc-body-lock {
    overflow: hidden;
}

/* ── Mobile: bottom sheet style ─────────────────────────────────────────── */
@media (max-width: 480px) {
    .lpbc-budget-widget {
        padding: 14px 14px 12px;
    }

    .lpbc-popup-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .lpbc-popup {
        max-height: 90vh;
        border-radius: 12px 12px 0 0;
        max-width: 100%;
    }

    .lpbc-history-table th,
    .lpbc-history-table td {
        padding: 9px 12px;
    }
}
