:root{
    --primary : #111cb2;
}

.page-title-box {
    background-color: var(--primary);
}

/* Nav pills personalizzati per tab verticali */
.nav-pills-custom .nav-link {
    text-align: left;
    background-color: #f8f8f8;
    color: #888;
    border: 1px solid #e8e8e8;
}
.nav-pills-custom .nav-link:hover {
    background-color: #efefef;
    color: #555;
}
.nav-pills-custom .nav-link.active {
    background-color: #f8f8f8;
    color: #556ee6;
    border: 2px solid #556ee6;
}
.nav-pills-custom .nav-link.disabled {
    cursor: default;
}

/* ═══════════════════════════════════════════════════
   BILLING PAGE
   ═══════════════════════════════════════════════════ */

/* Hero banner */
.billing-hero {
    background: linear-gradient(135deg, #111cb2 0%, #4338ca 50%, #6366f1 100%);
    border-radius: 12px;
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
}
.billing-hero::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

/* Stat icon */
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Progress bar sottile */
.progress-usage {
    height: 6px;
    border-radius: 3px;
    background-color: #f0f0f5;
}

/* Toggle wrapper */
.billing-toggle-wrapper {
    background: #f8f9fa;
    border-radius: 50px;
    padding: 8px 20px;
}
.billing-toggle-label {
    font-size: 14px;
    color: #74788d;
    transition: all .2s;
}
.billing-toggle-label.fw-semibold {
    color: #111cb2;
}
.billing-switch {
    width: 3em !important;
    height: 1.5em;
    cursor: pointer;
}

/* ─── Pricing card ─── */
.pricing-card {
    background: #fff;
    border-radius: 14px;
    border: 2px solid #eef0f7;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(17,28,178,.10);
}
.pricing-card.current {
    border-color: #f59e0b;
    border-width: 2px;
    box-shadow: 0 8px 30px rgba(245, 158, 11, .18);
    transform: scale(1.03);
    z-index: 2;
}
.pricing-card.current:hover {
    transform: scale(1.03) translateY(-4px);
    box-shadow: 0 14px 36px rgba(245, 158, 11, .22);
}

/* Badge "Attivo" — fixed top-right della card */
.pricing-current-label {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: .3px;
    box-shadow: 0 2px 6px rgba(217, 119, 6, .3);
}

/* Header per piano */
.pricing-header {
    padding: 24px 20px 16px;
    text-align: center;
}
.pricing-plan-name {
    font-size: 18px;
    font-weight: 600;
    color: #343a40;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.pricing-header-starter    { border-top: 4px solid #6c757d; }
.pricing-header-pro        { border-top: 4px solid #f59e0b; }
.pricing-header-agency     { border-top: 4px solid #111cb2; }
.pricing-header-enterprise { border-top: 4px solid #6366f1; }
.pricing-header-unlimited  { border-top: 4px solid #e11d48; background: linear-gradient(135deg, #fdf2f8 0%, #fff 100%); }

/* Body */
.pricing-body {
    padding: 0 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Prezzo */
.pricing-price {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eef0f7;
}
.pricing-amount {
    font-size: 40px;
    font-weight: 700;
    color: #111cb2;
    line-height: 1;
}
.pricing-period {
    font-size: 15px;
    color: #74788d;
    font-weight: 400;
}

/* Feature list */
.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    flex: 1;
}
.pricing-features li {
    padding: 8px 0;
    font-size: 14px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pricing-features li.disabled {
    color: #adb5bd;
    text-decoration: line-through;
}
.pricing-features li i {
    font-size: 18px;
    flex-shrink: 0;
}

/* ─── Top-up cards ─── */
.topup-card {
    background: #fff;
    border: 2px solid #eef0f7;
    border-radius: 12px;
    padding: 20px 24px;
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
}
.topup-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,.06);
}
.topup-card.best-value {
    border-color: #0dcaf0;
    background: linear-gradient(135deg, #f0fdff 0%, #fff 100%);
}
.topup-badge {
    position: absolute;
    top: -10px;
    right: 16px;
}
.topup-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ─── Upgrade cards (trial → starter) ─── */
.upgrade-card {
    position: relative;
    border-radius: 16px;
    border: 2px solid #e5e7eb;
    background: #fff;
    transition: transform .25s ease, box-shadow .25s ease;
    height: 100%;
}
.upgrade-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,.08);
}
.upgrade-card-yearly {
    border-color: transparent;
}
.upgrade-card-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 40%, #818cf8 70%, #4338ca 100%);
    background-size: 300% 300%;
    animation: upgradeGlow 6s ease infinite;
    border-radius: 18px;
    z-index: 0;
}
@keyframes upgradeGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.upgrade-card-inner {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.upgrade-cycle-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4338ca;
    font-size: 22px;
    margin: 0 auto;
}
.upgrade-card-yearly .upgrade-cycle-icon {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
}
.upgrade-save-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
    z-index: 2;
}
.upgrade-price {
    text-align: center;
}
.upgrade-price-amount {
    font-size: 36px;
    font-weight: 800;
    color: #4338ca;
    line-height: 1;
}
.upgrade-price-period {
    font-size: 15px;
    color: #6b7280;
    font-weight: 500;
}
.upgrade-features {
    text-align: left;
    margin: 0 auto 20px;
    flex-grow: 1;
}
.upgrade-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
}
.upgrade-feature:last-child {
    border-bottom: none;
}
.upgrade-feature i {
    font-size: 18px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}
.btn-upgrade-starter {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 11px 20px;
    border-radius: 10px;
    transition: transform .2s ease, box-shadow .2s ease;
    margin-top: auto;
}
.btn-upgrade-starter:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(67, 56, 202, .35);
    color: #fff;
}
.btn-upgrade-starter:active {
    transform: translateY(0);
}

/* ─── Toggle Mensile/Annuale (pill globale sopra le card) ─── */
.upgrade-cycle-toggle {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
}
.upgrade-cycle-toggle button {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 22px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.upgrade-cycle-toggle button:hover {
    color: #4338ca;
}
.upgrade-cycle-toggle button.active {
    background: #fff;
    color: #4338ca;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.upgrade-cycle-save {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.4;
}

/* ─── Etichetta Piano + Badge Consigliato ─── */
.upgrade-plan-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.upgrade-card-recommended {
    border-color: #4338ca;
    box-shadow: 0 8px 32px rgba(67,56,202,.12);
}
.upgrade-recommended-badge {
    position: absolute;
    top: -11px;
    right: 16px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 3;
}

/* ─── Box riassuntivo abbonamento (uniformato a Bootstrap card) ─── */
/* Codice licenza inline in piccolo */
.sub-actions code {
    background: #f3f4f6;
    color: #6b7280;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}
/* CTA principale "Gestisci su Stripe" */
.btn-portal-cta {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    border: none;
    color: #fff;
    font-weight: 600;
    transition: transform .2s ease, box-shadow .2s ease;
}
.btn-portal-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(67, 56, 202, .25);
    color: #fff;
}
.sub-overview-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 991px) {
    .sub-overview-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575px) {
    .sub-overview-stats { grid-template-columns: 1fr; }
}
.sub-stat {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
}
.sub-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.sub-stat-body { min-width: 0; flex: 1; }
.sub-stat-label {
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: block;
    margin-bottom: 2px;
}
.sub-stat-value {
    color: #111827;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 2px 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sub-stat-detail {
    color: #6b7280;
    font-size: 12px;
    display: block;
}

/* ─── Layout 3-colonne (.billing-grid) per abbonati ─── */
/* Su lg+, le 3 sezioni (Abbonamento | Utilizzo | Crediti Extra) sono affiancate.
   Le card interne devono adattarsi alla colonna stretta (~225-310px). */
@media (min-width: 992px) {

    /* Stat-box Abbonamento: stack verticale 4x1 */
    .billing-grid .sub-overview-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .billing-grid .sub-stat {
        padding: 10px;
    }
    .billing-grid .sub-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    .billing-grid .sub-stat-value {
        font-size: 14px;
    }

    /* Top-up card dentro la colonna stretta: padding ridotto */
    .billing-grid .topup-card {
        padding: 10px;
        margin-bottom: 0;
    }
    .billing-grid .topup-card .topup-icon {
        width: 36px;
        height: 36px;
    }
    .billing-grid .topup-card h5 {
        font-size: 14px;
    }
    .billing-grid .topup-card h4 {
        font-size: 16px;
    }
}


/* ─── Cycle toggle buttons ─── */
.btn-cycle {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    background: #fff;
    transition: all .2s ease;
    text-align: center;
    line-height: 1.4;
}
.btn-cycle:hover {
    border-color: #4338ca;
    color: #4338ca;
    background: #f5f3ff;
}
.btn-cycle.active {
    border-color: #4338ca;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 56, 202, .25);
    pointer-events: none;
}
.btn-cycle.active small {
    color: rgba(255,255,255,.8);
}
.btn-cycle small {
    font-weight: 400;
    font-size: 12px;
}

/* ─── Payment card icon ─── */
.payment-card-icon {
    width: 48px;
    height: 48px;
    background: #eef2ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Soft bg helpers (se non già nel tema) */
.bg-soft-primary { background-color: rgba(17,28,178,.1) !important; }
.bg-soft-info    { background-color: rgba(13,202,240,.1) !important; }
.bg-soft-warning { background-color: rgba(245,158,11,.1) !important; }
.bg-soft-success { background-color: rgba(34,197,94,.1) !important; }

/* ─── Billing History sidebar ─── */
.billing-history-card {
    position: sticky;
    top: 90px;
}
.billing-history-list {
    max-height: 600px;
    overflow-y: auto;
}
.billing-history-item {
    padding: 14px 0;
    border-bottom: 1px solid #d5d9e2;
}
.billing-history-item:last-child {
    border-bottom: none;
}
.billing-history-item.history-failed {
    opacity: .6;
}

/* ═══════════════════════════════════════════════════
   SWEETALERT2 → BOOTSTRAP STYLE OVERRIDE
   ═══════════════════════════════════════════════════ */

/* Popup — stile modal Bootstrap */
.swal2-popup {
    border-radius: 0.4rem !important;
    border: 1px solid #eaedf1 !important;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15) !important;
    padding: 0 0 1rem !important;
    font-family: inherit !important;
}

/* Titolo — stile modal-header Bootstrap */
.swal2-title {
    padding: 1rem 1.25rem !important;
    margin: 0 !important;
    border-bottom: 1px solid #edf1f5 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #343a40 !important;
    text-align: left !important;
}

/* Icona — margini ridotti */
.swal2-icon {
    margin: 1.25rem auto 0.5rem !important;
}

/* Body — stile modal-body Bootstrap */
.swal2-html-container {
    padding: 1rem 1.25rem !important;
    margin: 0 !important;
    font-size: 0.875rem !important;
    color: #495057 !important;
    text-align: left !important;
    line-height: 1.6 !important;
}

/* Input dentro Swal */
.swal2-input, .swal2-textarea, .swal2-select {
    margin: 0.5rem 1.25rem !important;
    width: calc(100% - 2.5rem) !important;
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    font-size: 0.875rem !important;
    padding: 0.47rem 0.75rem !important;
}
.swal2-input:focus, .swal2-textarea:focus {
    border-color: #556ee6 !important;
    box-shadow: 0 0 0 0.15rem rgba(85,110,230,.25) !important;
}

/* Validation message */
.swal2-validation-message {
    margin: 0 !important;
    padding: 0.5rem 1.25rem !important;
    background: #fff3cd !important;
    color: #856404 !important;
    font-size: 0.82rem !important;
}

/* Azioni — stile modal-footer Bootstrap */
.swal2-actions {
    padding: 0.75rem 1.25rem !important;
    margin: 0 !important;
    border-top: 1px solid #edf1f5 !important;
    gap: 0.5rem !important;
    justify-content: flex-end !important;
}

/* Bottoni — stile btn Bootstrap */
.swal2-styled {
    padding: 0.47rem 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border-radius: 0.25rem !important;
    box-shadow: none !important;
    transition: all 0.15s ease-in-out !important;
}
.swal2-styled:focus { box-shadow: none !important; }

.swal2-confirm {
    background-color: #556ee6 !important;
    border: 1px solid #556ee6 !important;
    color: #fff !important;
}
.swal2-confirm:hover { background-color: #4458c9 !important; border-color: #4458c9 !important; }

.swal2-cancel {
    background-color: #6c757d !important;
    border: 1px solid #6c757d !important;
    color: #fff !important;
}
.swal2-cancel:hover { background-color: #5a6268 !important; border-color: #545b62 !important; }

.swal2-deny {
    background-color: #f46a6a !important;
    border: 1px solid #f46a6a !important;
    color: #fff !important;
}
.swal2-deny:hover { background-color: #e05454 !important; border-color: #d84a4a !important; }

/* Close button — stile btn-close Bootstrap */
.swal2-close {
    font-size: 1.5rem !important;
    color: #74788d !important;
    opacity: 0.5 !important;
    position: absolute !important;
    top: 0.75rem !important;
    right: 0.75rem !important;
}
.swal2-close:hover { opacity: 1 !important; color: #343a40 !important; }

/* Backdrop */
.swal2-container { backdrop-filter: blur(2px); }

/* ── Toast — compatto e Bootstrap-friendly ── */
.swal2-popup.swal2-toast {
    border-radius: 0.25rem !important;
    padding: 0.5rem 0.75rem !important;
    box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,.1) !important;
    border: 1px solid #eaedf1 !important;
}
.swal2-popup.swal2-toast .swal2-title {
    padding: 0 !important;
    border: none !important;
    font-size: 0.85rem !important;
    text-align: left !important;
}
.swal2-popup.swal2-toast .swal2-icon {
    margin: 0 0.5rem 0 0 !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
    border-width: 2px !important;
}
.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content { font-size: 1rem !important; }
.swal2-popup.swal2-toast .swal2-actions { border: none !important; padding: 0 !important; }

/* ── Loading spinner ── */
.swal2-loading .swal2-styled.swal2-confirm {
    background-color: transparent !important;
    border: none !important;
    color: #556ee6 !important;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR — Locked menu items
   ═══════════════════════════════════════════════════ */
.sidebar-locked {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}
.sidebar-locked .mdi-lock-outline {
    font-size: 14px;
    opacity: 0.7;
    margin-left: 12px;
}