/* Payment Form - Tema FLO v2 (Inter, sidebar moderna) */

/* ===== Design Tokens ===== */
:root {
    /* Sidebar */
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --sidebar-width: 260px;
    --sidebar-text: rgba(255, 255, 255, 0.55);
    --sidebar-text-hover: rgba(255, 255, 255, 0.9);
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: rgba(59, 130, 246, 0.15);
    --sidebar-active-border: #3b82f6;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-section-title: rgba(255, 255, 255, 0.3);

    /* Brand */
    --flo-blue: #2563eb;
    --flo-blue-rgb: 37, 99, 235;
    --flo-blue-dark: #1d4ed8;
    --flo-blue-light: #3b82f6;
    --flo-blue-50: #eff6ff;
    --flo-blue-100: #dbeafe;
    --flo-navy: #0f172a;
    --flo-body: #1e293b;
    --flo-bg: #f8fafc;

    /* Semantici */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    /* Grigi */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Geometria */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}

/* ===== Base ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--flo-body);
    background-color: var(--flo-bg);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

body.has-sidebar {
    padding-left: var(--sidebar-width);
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.25s ease;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.25rem 1.25rem;
}

.sidebar-brand-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-title {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.sidebar-brand-sub {
    color: var(--sidebar-text);
    font-size: 0.68rem;
    font-weight: 400;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-section-title {
    color: var(--sidebar-section-title);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 400;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    border-left: 2px solid transparent;
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link:hover {
    color: var(--sidebar-text-hover);
    background-color: var(--sidebar-hover-bg);
    text-decoration: none;
}

.sidebar-link:hover i { opacity: 1; }

.sidebar-link.active {
    color: var(--sidebar-text-active);
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
    font-weight: 500;
}

.sidebar-link.active i {
    opacity: 1;
    color: var(--flo-blue-light);
}

.sidebar-link-badge {
    margin-left: auto;
    background: rgba(239,68,68,0.2);
    color: #fca5a5;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1em 0.5em;
    border-radius: 10px;
    min-width: 1.4em;
    text-align: center;
}

/* Footer sidebar */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.55rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.sidebar-user-card:hover {
    background: var(--sidebar-hover-bg);
}

.sidebar-avatar {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
    color: rgba(255,255,255,0.88);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    color: var(--sidebar-text);
    font-size: 0.66rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-tags {
    display: flex;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    flex-wrap: wrap;
}

.sidebar-tag {
    font-size: 0.58rem;
    font-weight: 500;
    padding: 0.12em 0.5em;
    border-radius: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.sidebar-tag-blue {
    background: rgba(59,130,246,0.15);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.25);
}

.sidebar-tag-purple {
    background: rgba(139,92,246,0.15);
    color: #c4b5fd;
    border: 1px solid rgba(139,92,246,0.25);
}

.sidebar-tag-green {
    background: rgba(16,185,129,0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,0.25);
}

.sidebar-logout-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 4px;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.sidebar-logout-btn:hover {
    color: #f87171;
    background: rgba(239,68,68,0.1);
}

/* ===== Area principale ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    padding: 2rem 2.5rem;
}

/* ===== View Tabs Bar (barra top come demo) ===== */
.view-tabs-bar {
    padding: 1rem 2.5rem 0;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.view-tabs {
    display: flex;
    gap: 0;
    margin-bottom: -1px;
}

.view-tab {
    padding: 0.65rem 1.25rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.view-tab:hover {
    color: var(--gray-700);
    text-decoration: none;
}

.view-tab.active {
    color: var(--flo-blue);
    border-bottom-color: var(--flo-blue);
}

/* ===== Mobile Topbar ===== */
.mobile-topbar {
    background-color: var(--gray-900);
    color: white;
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.35rem;
    padding: 0.15rem;
    cursor: pointer;
    line-height: 1;
}

.sidebar-toggle:hover { color: rgba(255,255,255,0.8); }

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1035;
}

.sidebar-overlay.show { display: block; }

/* ===== Auth Layout (non autenticato) ===== */
.auth-topbar {
    background-color: var(--gray-900);
    padding: 0.65rem 0;
}

.auth-topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-brand:hover { color: white; text-decoration: none; }

.auth-brand-logo {
    height: 24px;
    width: auto;
    flex-shrink: 0;
}

.auth-nav {
    display: flex;
    gap: 0.2rem;
}

.auth-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: all 0.15s;
}

.auth-link:hover {
    color: white;
    background-color: rgba(255,255,255,0.1);
    text-decoration: none;
}

.auth-link.active {
    color: white;
    background-color: var(--flo-blue);
}

.auth-main { flex: 1; }

/* ===== Footer ===== */
.app-footer {
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-100);
    background-color: white;
}

.app-footer .footer-brand {
    font-weight: 600;
    color: var(--gray-500);
}

.app-footer .footer-sep {
    color: var(--gray-300);
    margin: 0 0.3rem;
}

/* ===== Bootstrap Override: Card ===== */
.card {
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg) !important;
    border-color: var(--gray-200) !important;
}

.card-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-weight: 600;
    font-size: 0.88rem;
}

/* card-header con testo + icona: flex solo dove non c'e' text-center */
.card-header:not(.text-center) {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* card-header centrato (login, registrazione, reset) */
.card-header.text-center {
    text-align: center !important;
}

.card-body {
    font-size: 0.88rem;
}

.card-footer {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
    background-color: var(--gray-50);
    border-top-color: var(--gray-100);
}

/* Card header tematiche leggere - forza override testo Bootstrap */
.card-header.bg-primary,
.card-header.bg-primary.text-white {
    background: var(--flo-blue-50) !important;
    color: var(--flo-blue-dark) !important;
    border-bottom-color: var(--flo-blue-100) !important;
}

.card-header.bg-success,
.card-header.bg-success.text-white {
    background: #ecfdf5 !important;
    color: #065f46 !important;
    border-bottom-color: #d1fae5 !important;
}

.card-header.bg-warning,
.card-header.bg-warning.text-dark,
.card-header.bg-warning.text-white {
    background: #fffbeb !important;
    color: #92400e !important;
    border-bottom-color: #fef3c7 !important;
}

.card-header.bg-danger,
.card-header.bg-danger.text-white {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border-bottom-color: #fee2e2 !important;
}

.card-header.bg-info,
.card-header.bg-info.text-dark,
.card-header.bg-info.text-white {
    background: #ecfeff !important;
    color: #0e7490 !important;
    border-bottom-color: #cffafe !important;
}

.card-header.bg-dark,
.card-header.bg-dark.text-white {
    background: var(--gray-800) !important;
    color: white !important;
    border-bottom-color: var(--gray-700) !important;
}

.card-header.bg-light {
    background: var(--gray-50) !important;
    color: var(--gray-700) !important;
    border-bottom-color: var(--gray-100) !important;
}

/* Rimuovi border colorati pesanti di Bootstrap su card */
.card.border-info,
.card.border-warning,
.card.border-success,
.card.border-primary,
.card.border-danger,
.card.border-secondary {
    border-color: var(--gray-200) !important;
    border-width: 1px !important;
}

/* ===== Bootstrap Override: Buttons ===== */
.btn {
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.84rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--flo-blue);
    border-color: var(--flo-blue);
    box-shadow: 0 1px 2px rgba(var(--flo-blue-rgb),0.25);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--flo-blue-dark);
    border-color: var(--flo-blue-dark);
    box-shadow: 0 2px 4px rgba(var(--flo-blue-rgb),0.3);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    box-shadow: 0 1px 2px rgba(16,185,129,0.25);
}

.btn-success:hover { background-color: #059669; border-color: #059669; }

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover { background-color: #dc2626; border-color: #dc2626; }

.btn-warning {
    background-color: var(--warning);
    border-color: var(--warning);
    color: white;
    box-shadow: 0 1px 2px rgba(245,158,11,0.25);
}

.btn-warning:hover {
    background-color: #d97706;
    border-color: #d97706;
    color: white;
}

.btn-secondary {
    background-color: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

.btn-outline-primary {
    border-color: var(--flo-blue-100);
    color: var(--flo-blue);
}

.btn-outline-primary:hover {
    background-color: var(--flo-blue-50);
    border-color: var(--flo-blue-light);
    color: var(--flo-blue-dark);
}

.btn-outline-success {
    border-color: #d1fae5;
    color: var(--success);
}

.btn-outline-success:hover {
    background-color: #ecfdf5;
    border-color: var(--success);
    color: #059669;
}

.btn-outline-warning {
    border-color: #fef3c7;
    color: #d97706;
}

.btn-outline-warning:hover {
    background-color: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.btn-outline-danger {
    border-color: #fee2e2;
    color: var(--danger);
}

.btn-outline-danger:hover {
    background-color: #fef2f2;
    border-color: var(--danger);
    color: #dc2626;
}

.btn-outline-secondary {
    border-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-outline-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-800);
}

.btn-outline-dark {
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-outline-dark:hover {
    background: var(--gray-800);
    border-color: var(--gray-800);
    color: white;
}

/* ===== Bootstrap Override: Table ===== */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--gray-700);
    font-size: 0.84rem;
}

.table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500) !important;
    font-weight: 600;
    padding: 0.7rem 1rem;
    background: var(--gray-50) !important;
    border-bottom: 1px solid var(--gray-200) !important;
}

.table td {
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    --bs-table-hover-bg: var(--gray-50);
    background-color: var(--gray-50) !important;
}

/* Thead dark/light -> grigio chiaro come demo */
.table-dark,
.table-dark th,
thead.table-dark,
thead.table-dark th,
thead.table-dark td {
    --bs-table-bg: var(--gray-50) !important;
    --bs-table-color: var(--gray-500) !important;
    background-color: var(--gray-50) !important;
    color: var(--gray-500) !important;
    border-color: var(--gray-200) !important;
}

thead.table-light th,
thead.table-light td,
.table-light th,
.table-light td {
    background-color: var(--gray-50) !important;
    color: var(--gray-500) !important;
    border-color: var(--gray-200) !important;
}

/* table-striped -> alternanza molto sottile */
.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-striped-bg: rgba(248, 250, 252, 0.5);
}

/* table-success/warning/info -> versioni pastello soft */
.table-success,
.table-success > th,
.table-success > td {
    --bs-table-bg: #ecfdf5 !important;
    background-color: #ecfdf5 !important;
    color: #065f46 !important;
}

tr.table-warning > td,
.table-warning {
    --bs-table-bg: #fffbeb !important;
    background-color: #fffbeb !important;
    color: #92400e !important;
}

/* table-bordered -> bordi piu' soft */
.table-bordered > :not(caption) > * > * {
    border-color: var(--gray-100) !important;
}

/* Rimuovi ombra e stili pesanti dal card che contiene la tabella */
.card .table {
    margin-bottom: 0;
}

.card .table th:first-child { border-top-left-radius: 0; }
.card .table th:last-child { border-top-right-radius: 0; }

/* ===== Bootstrap Override: Form ===== */
.form-label {
    font-weight: 500;
    font-size: 0.84rem;
    color: var(--gray-700);
}

.form-control, .form-select {
    border-radius: var(--radius);
    border-color: var(--gray-300);
    font-size: 0.84rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--flo-blue-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-text {
    font-size: 0.72rem;
    color: var(--gray-400);
}

/* ===== Bootstrap Override: Badge ===== */
.badge {
    font-weight: 500;
    letter-spacing: 0.2px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Badge pastello come demo (override colori pieni Bootstrap) */
.badge.bg-info,
.badge.bg-info.text-dark {
    background-color: var(--info-light) !important;
    color: #0e7490 !important;
}

.badge.bg-success {
    background-color: var(--success-light) !important;
    color: #065f46 !important;
}

.badge.bg-warning,
.badge.bg-warning.text-dark {
    background-color: var(--warning-light) !important;
    color: #92400e !important;
}

.badge.bg-danger {
    background-color: var(--danger-light) !important;
    color: #991b1b !important;
}

.badge.bg-primary {
    background-color: var(--flo-blue-100) !important;
    color: #1e40af !important;
}

.badge.bg-secondary {
    background-color: var(--gray-100) !important;
    color: var(--gray-600) !important;
}

.badge.bg-dark {
    background-color: var(--gray-800) !important;
    color: white !important;
}

/* Badge con dot indicator (come demo) */
.badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.badge.bg-info .badge-dot { background: var(--info); }
.badge.bg-success .badge-dot { background: var(--success); }
.badge.bg-warning .badge-dot { background: var(--warning); }
.badge.bg-danger .badge-dot { background: var(--danger); }
.badge.bg-primary .badge-dot { background: var(--flo-blue); }
.badge.bg-secondary .badge-dot { background: var(--gray-400); }

/* ===== Search Bar (demo style) ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.45rem 0.75rem;
    min-width: 240px;
    transition: all 0.15s;
}

.search-bar:focus-within {
    background: white;
    border-color: var(--flo-blue-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-bar i {
    color: var(--gray-400);
    font-size: 0.9rem;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.82rem;
    color: var(--gray-700);
    width: 100%;
    font-family: inherit;
}

.search-bar input::placeholder {
    color: var(--gray-400);
}

/* ===== Panel (tabella come demo) ===== */
.panel {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}

.panel-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title i {
    color: var(--gray-400);
}

.panel-body {
    padding: 0;
}

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-bar-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ===== Row Actions (tabella) ===== */
.row-actions {
    display: flex;
    gap: 0.3rem;
}

/* ===== User Cell Avatar Colors ===== */
.user-cell-avatar.uc-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.user-cell-avatar.uc-green { background: linear-gradient(135deg, #10b981, #059669); }
.user-cell-avatar.uc-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.user-cell-avatar.uc-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.user-cell-avatar.uc-pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.user-cell-avatar.uc-teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }

/* ===== Societa Cell ===== */
.societa-cell-name {
    font-size: 0.82rem;
    font-weight: 500;
}

.societa-cell-dept {
    font-size: 0.7rem;
    color: var(--gray-400);
}

/* ===== ID Cell ===== */
.id-cell {
    font-weight: 600;
    color: var(--gray-500);
}

/* ===== Date Cell ===== */
.date-cell {
    font-size: 0.78rem;
    color: var(--gray-500);
}

/* ===== Bootstrap Override: Alert ===== */
.alert {
    border-radius: var(--radius);
}

/* ===== Bootstrap Override: Nav Tabs ===== */
.nav-tabs .nav-link {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--gray-500);
}

.nav-tabs .nav-link.active {
    color: var(--flo-blue);
    border-color: var(--gray-200) var(--gray-200) white;
}

.nav-tabs .nav-link:hover:not(.active) {
    color: var(--gray-700);
    border-color: transparent;
}

/* ===== Bootstrap Override: Modal ===== */
.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ===== Bootstrap Override: Accordion ===== */
.accordion-button {
    font-weight: 500;
    font-size: 0.88rem;
}

.accordion-button:not(.collapsed) {
    color: var(--flo-blue);
    background-color: var(--flo-blue-50);
}

.accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ===== Bootstrap Override: Input Group ===== */
.input-group-text {
    border-color: var(--gray-300);
    background-color: var(--gray-50);
    color: var(--gray-500);
    font-size: 0.84rem;
    border-radius: var(--radius);
}

/* ===== Bootstrap Override: List Group ===== */
.list-group-item {
    border-color: var(--gray-100);
    font-size: 0.84rem;
    transition: background 0.15s;
}

.list-group-item-action:hover {
    background-color: var(--gray-50);
}

/* ===== Bootstrap Override: Form Check ===== */
.form-check-input:checked {
    background-color: var(--flo-blue);
    border-color: var(--flo-blue);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
    border-color: var(--flo-blue-light);
}

/* ===== Bootstrap Override: Progress ===== */
.progress {
    border-radius: var(--radius);
    background-color: var(--gray-100);
}

/* ===== Bootstrap Override: Varie ===== */
.text-muted {
    color: var(--gray-400) !important;
}

.text-primary {
    color: var(--flo-blue) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-info {
    color: var(--info) !important;
}

.border-top-0.rounded-top-0 {
    border-top: none !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

/* bg-white override per input-group */
.input-group-text.bg-white {
    background-color: white !important;
}

/* Sortable columns */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background-color: var(--gray-100) !important;
}

.sort-icon {
    font-size: 0.65rem;
    margin-left: 0.25rem;
}

/* ===== Stat Cards (Dashboard) ===== */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
    color: inherit;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.stat-card.active {
    border-color: transparent;
    box-shadow: var(--shadow-lg);
}

.stat-card-info::before { background: var(--info); }
.stat-card-info.active { border-color: var(--info); background: linear-gradient(to bottom, #ecfeff, white 60%); }

.stat-card-warning::before { background: var(--warning); }
.stat-card-warning.active { border-color: var(--warning); background: linear-gradient(to bottom, #fffbeb, white 60%); }

.stat-card-success::before { background: var(--success); }
.stat-card-success.active { border-color: var(--success); background: linear-gradient(to bottom, #ecfdf5, white 60%); }

.stat-card-primary::before { background: var(--flo-blue); }
.stat-card-primary.active { border-color: var(--flo-blue); background: linear-gradient(to bottom, var(--flo-blue-50), white 60%); }

.stat-card-danger::before { background: var(--danger); }
.stat-card-danger.active { border-color: var(--danger); background: linear-gradient(to bottom, #fef2f2, white 60%); }

.stat-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.stat-icon-info { background: var(--info-light); color: var(--info); }
.stat-icon-warning { background: var(--warning-light); color: var(--warning); }
.stat-icon-success { background: var(--success-light); color: var(--success); }
.stat-icon-primary { background: var(--flo-blue-100); color: var(--flo-blue); }
.stat-icon-danger { background: var(--danger-light); color: var(--danger); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.76rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* ===== Form Section (nuova_richiesta) ===== */
.form-section {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.form-section-header {
    padding: 0.85rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.fsh-blue { background: var(--flo-blue-50); color: var(--flo-blue-dark); border-bottom-color: var(--flo-blue-100); }
.fsh-green { background: #ecfdf5; color: #065f46; border-bottom-color: #d1fae5; }
.fsh-amber { background: #fffbeb; color: #92400e; border-bottom-color: #fef3c7; }
.fsh-red { background: #fef2f2; color: #991b1b; border-bottom-color: #fee2e2; }
.fsh-cyan { background: #ecfeff; color: #0e7490; border-bottom-color: #cffafe; }
.fsh-dark { background: var(--gray-800); color: white; border-bottom-color: var(--gray-700); }

.form-section-body {
    padding: 1.25rem;
}

/* ===== File Upload Area ===== */
.file-upload-area {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.15s;
    cursor: pointer;
    background: var(--gray-50);
}

.file-upload-area:hover {
    border-color: var(--flo-blue-light);
    background: var(--flo-blue-50);
}

/* ===== User Cell (tabella) ===== */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-cell-avatar {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--flo-blue-light), var(--flo-blue));
}

.user-cell-name {
    font-weight: 500;
    font-size: 0.82rem;
}

.user-cell-email {
    font-size: 0.7rem;
    color: var(--gray-400);
}

/* ===== Priority Badge ===== */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.priority-badge i { font-size: 0.7rem; }
.priority-imm { color: var(--danger); }
.priority-norm { color: var(--gray-500); }

/* ===== Amount ===== */
.amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--gray-800);
}

.amount-currency {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 0.78em;
    margin-left: 0.15em;
}

/* ===== Row Actions ===== */
.row-action {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px;
    border: none;
    background: none;
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.9rem;
    padding: 0;
}

.row-action:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* ===== Filter Chips ===== */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.filter-chip:hover {
    border-color: var(--gray-300);
    color: var(--gray-700);
    text-decoration: none;
}

.filter-chip.active {
    background: var(--flo-blue-50);
    color: var(--flo-blue);
    border-color: var(--flo-blue-light);
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.3px;
    margin-bottom: 0;
}

.page-header-sub {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Pulsante icona quadrato (export) */
.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

/* ===== Section Nav (tab navigation stile demo) ===== */
.section-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
    width: fit-content;
}

.section-nav-btn {
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    border: none;
    background: none;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
}

.section-nav-btn:hover {
    color: var(--gray-700);
    text-decoration: none;
}

.section-nav-btn.active {
    background: white;
    color: var(--gray-800);
    box-shadow: var(--shadow-sm);
}

.section-nav-btn .badge {
    font-size: 0.65rem;
    padding: 0.15em 0.45em;
}

/* ===== Filter Select (selects stilizzati come chips) ===== */
.filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.3rem 1.8rem 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--gray-100) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 0.6rem center;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.filter-select:hover {
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.filter-select:focus {
    outline: none;
    border-color: var(--flo-blue-light);
    background-color: var(--flo-blue-50);
    color: var(--flo-blue);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

/* ===== Panel Footer ===== */
.panel-footer {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== Data Table (identico al demo, ZERO Bootstrap) ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tbody tr {
    transition: background 0.1s;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Celle nowrap per evitare compressione */
.data-table .id-cell,
.data-table .date-cell,
.data-table .amount,
.data-table .badge,
.data-table .row-actions {
    white-space: nowrap;
}

.data-table .user-cell-name,
.data-table .societa-cell-name {
    white-space: nowrap;
}

/* Celle troncate con ellipsis */
.data-table .cell-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

/* Sort icon nel data-table */
.data-table .sort-icon {
    font-size: 0.55rem;
    opacity: 0.35;
    margin-left: 0.15rem;
}

/* ===== Badge Custom (come demo, senza prefisso bg- di Bootstrap) ===== */
.badge-info { background: var(--info-light) !important; color: #0e7490 !important; }
.badge-info .badge-dot { background: var(--info); }

.badge-warning { background: var(--warning-light) !important; color: #92400e !important; }
.badge-warning .badge-dot { background: var(--warning); }

.badge-success { background: var(--success-light) !important; color: #065f46 !important; }
.badge-success .badge-dot { background: var(--success); }

.badge-danger { background: var(--danger-light) !important; color: #991b1b !important; }
.badge-danger .badge-dot { background: var(--danger); }

.badge-primary { background: var(--flo-blue-100) !important; color: #1e40af !important; }
.badge-primary .badge-dot { background: var(--flo-blue); }

.badge-neutral { background: var(--gray-100) !important; color: var(--gray-600) !important; }

/* ===== Typography refinements ===== */
h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.3px;
}

h4, h5, h6 {
    color: var(--gray-800);
    font-weight: 600;
}

code {
    color: var(--flo-blue);
    font-size: 0.85em;
    background: var(--flo-blue-50);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

/* strong/bold dentro tabelle */
.table strong {
    font-weight: 600;
    color: var(--gray-800);
}

/* Links */
a {
    color: var(--flo-blue);
}

a:hover {
    color: var(--flo-blue-dark);
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    body.has-sidebar {
        padding-left: 0;
    }

    .view-tabs-bar {
        padding: 0.75rem 1rem 0;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    .content-wrapper {
        padding: 0.75rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
