:root {
    --bg: #f5f7fb;
    --bg-accent: #eef2f8;
    --bg-warm: #fff6ee;
    --bg-mint: #ecfdf3;
    --brand: #1d4ed8;
    --brand-strong: #1e40af;
    --brand-soft: #dbeafe;
    --brand-2: #38bdf8;
    --accent-amber: #f59e0b;
    --accent-teal: #14b8a6;
    --card: #ffffff;
    --shadow: 0 18px 30px rgba(15, 23, 42, 0.08);
    --muted: #64748b;
    --bs-body-font-family: "Space Grotesk", sans-serif;
    --bs-body-bg: #f6f8fc;
    --bs-body-color: #0f172a;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-border-radius: 1rem;
}
.stat-card {
    position: relative;
    overflow: hidden;
    border: none;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), transparent 60%);
    pointer-events: none;
}

.stat-card .card-body {
    position: relative;
    z-index: 1;
}

.stat-blue {
    background: linear-gradient(135deg, #e0f2fe, #dbeafe 55%, #ffffff 100%);
    border: 1px solid rgba(29, 78, 216, 0.2);
}

.stat-teal {
    background: linear-gradient(135deg, #dcfce7, #ccfbf1 55%, #ffffff 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.stat-indigo {
    background: linear-gradient(135deg, #e0e7ff, #dbeafe 55%, #ffffff 100%);
    border: 1px solid rgba(79, 70, 229, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--bs-body-font-family);
    background:
        radial-gradient(circle at 10% 10%, rgba(37, 99, 235, 0.12), transparent 45%),
        radial-gradient(circle at 90% 0%, rgba(29, 78, 216, 0.18), transparent 40%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 45%, var(--bg-accent) 100%);
    min-height: 100vh;
    color: var(--bs-body-color);
}

body.page-dashboard {
    background:
        radial-gradient(circle at 10% 10%, rgba(37, 99, 235, 0.12), transparent 45%),
        radial-gradient(circle at 90% 0%, rgba(29, 78, 216, 0.2), transparent 40%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 45%, var(--bg-accent) 100%);
}

body.page-incassi {
    background:
        radial-gradient(circle at 12% 0%, rgba(245, 158, 11, 0.18), transparent 45%),
        radial-gradient(circle at 85% 12%, rgba(56, 189, 248, 0.2), transparent 45%),
        linear-gradient(180deg, #fffaf2 0%, var(--bg-warm) 40%, #eef7ff 100%);
}

body.page-dipendenti {
    background:
        radial-gradient(circle at 8% 0%, rgba(20, 184, 166, 0.18), transparent 45%),
        radial-gradient(circle at 90% 8%, rgba(59, 130, 246, 0.16), transparent 45%),
        linear-gradient(180deg, #f2fffb 0%, var(--bg-mint) 45%, var(--bg-accent) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(120deg, rgba(29, 78, 216, 0.12), transparent 55%);
    pointer-events: none;
    z-index: -1;
}

.hero {
    position: relative;
}

.hero-shell {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(29, 78, 216, 0.9));
    border-radius: 28px;
    color: #f8fafc;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}

.hero-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.4), transparent 40%),
        radial-gradient(circle at 80% 10%, rgba(34, 211, 238, 0.35), transparent 45%);
    opacity: 0.8;
    pointer-events: none;
}

.hero-shell > * {
    position: relative;
    z-index: 1;
}

.hero-kpi {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 18px;
    padding: 18px;
}

.hero-kpi .kpi-label {
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.85rem;
}

.hero-kpi .kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.stat-tile {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.08);
}

.stat-tile .icon-pill {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: #0f172a;
    background: rgba(59, 130, 246, 0.15);
}

.icon-pill.teal {
    background: rgba(20, 184, 166, 0.18);
}

.icon-pill.indigo {
    background: rgba(99, 102, 241, 0.2);
}

.glass-card {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

main.page {
    position: relative;
    z-index: 1;
}

.navbar {
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.9) !important;
}

.navbar-brand .brand-mark {
    box-shadow: 0 10px 24px rgba(29, 78, 216, 0.35);
}

.navbar .nav-link.active {
    color: var(--brand-strong);
    font-weight: 600;
}

.card {
    border: 1px solid rgba(29, 78, 216, 0.08);
    border-radius: var(--bs-border-radius);
}

.card.shadow-sm {
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.card-header .badge {
    font-weight: 500;
}

.card h2,
.card .h5,
.card .h6 {
    color: #0f172a;
}

.table thead th {
    color: #0f172a;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(59, 130, 246, 0.04);
}

.progress-bar {
    background-image: linear-gradient(90deg, var(--brand), #38bdf8);
}

.btn-primary {
    background-image: linear-gradient(90deg, var(--brand), #2563eb);
    border: none;
}

.btn-light {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.btn-primary:hover {
    filter: brightness(0.95);
}

.btn-outline-secondary {
    color: #1e3a8a;
    border-color: rgba(30, 58, 138, 0.3);
}

.btn-outline-secondary:hover {
    background: rgba(30, 58, 138, 0.1);
    color: #1e3a8a;
}

.badge.text-bg-success {
    background: linear-gradient(90deg, #16a34a, #22c55e) !important;
}

.badge.text-bg-secondary {
    background: linear-gradient(90deg, #64748b, #94a3b8) !important;
}

.list-group-item {
    border-color: rgba(29, 78, 216, 0.08);
}

.alert-warning {
    border-color: rgba(245, 158, 11, 0.4);
}

.table-responsive {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(29, 78, 216, 0.1);
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 0.75rem;
}

.form-control,
.form-select {
    border-radius: 0.85rem;
}

.btn,
.badge {
    border-radius: 999px;
}

a {
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0d6efd, #20c997);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 1px;
}

.page {
    padding: 24px 8vw 64px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease;
}

.page.is-ready {
    opacity: 1;
    transform: translateY(0);
}

.quick-actions-bar {
    position: sticky;
    top: 72px;
    z-index: 1030;
    margin-top: -16px;
    margin-bottom: 24px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(12px);
}

.quick-actions .action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.quick-actions .action-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(29, 78, 216, 0.2);
    background: linear-gradient(135deg, #ffffff, #e0f2fe);
    color: #0f172a;
    font-weight: 600;
    font-size: 0.9rem;
}

.quick-actions .action-chip.secondary {
    border-color: rgba(20, 184, 166, 0.25);
    background: linear-gradient(135deg, #ffffff, #dcfce7);
}

.quick-actions .action-meta {
    color: var(--muted);
    font-size: 0.85rem;
}

.quick-card {
    border-radius: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(226, 232, 240, 0.6));
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

.quick-card .quick-title {
    font-weight: 600;
    color: #0f172a;
}

.quick-card .quick-subtitle {
    color: var(--muted);
    font-size: 0.85rem;
}

.pill-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}


.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
}

.auth-card {
    width: min(420px, 100%);
    background: var(--card);
    padding: 28px;
    border-radius: 22px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 16px;
}

.auth-brand details > summary {
    list-style: none;
    cursor: pointer;
}

.auth-brand details > summary::-webkit-details-marker {
    display: none;
}

.compare-item span {
    color: var(--muted);
    font-size: 0.85rem;
}

.compare-item strong {
    display: block;
    margin: 6px 0 10px;
    font-size: 1.1rem;
}

.compare-bar {
    width: 100%;
    height: 10px;
    background: #f0ece6;
    border-radius: 999px;
    overflow: hidden;
}

.compare-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.compare-fill.is-muted {
    background: linear-gradient(90deg, #aab5c5, #8a94a3);
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8f7f5;
}

.list-row span {
    color: var(--muted);
    display: block;
}

.amount {
    font-weight: 700;
}

.badge {
    padding: 6px 10px;
    font-size: 0.8rem;
    text-align: center;
    display: inline-block;
    width: fit-content;
}

.badge.is-on {
    background: #daf2e5;
    color: #116149;
}

.badge.is-off {
    background: #fde3e3;
    color: #8f1b1b;
}

@media (max-width: 768px) {
    .navbar-brand small {
        display: none;
    }
    .stat-card .h4 {
        font-size: 1.3rem;
    }
    .card-body {
        padding: 1rem;
    }
    .hero-shell {
        padding: 24px !important;
    }
    .topbar {
        padding: 20px 6vw 12px;
    }

    .page {
        padding: 16px 6vw 120px;
    }

    .quick-actions-bar {
        position: fixed;
        top: auto;
        bottom: 16px;
        left: 0;
        right: 0;
        padding: 0 6vw;
        margin: 0;
    }

    .quick-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .section-header h1 {
        font-size: 1.8rem;
    }
}
