/**
 * CertiSource - Main Stylesheet
 * Design: Clean, Professional, Modern
 */

/* ═══════════════════════════════════════════════════════════════════════════
   CSS VARIABLES
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    /* Colors - Primary */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;

    /* Colors - Secondary */
    --secondary: #64748b;
    --secondary-dark: #475569;
    --secondary-light: #94a3b8;

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

    /* Colors - Neutral */
    --white: #ffffff;
    --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;
    --black: #000000;

    /* UI Colors - Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    /* Spacing */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-10: 2.5rem;
    --spacing-12: 3rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* Prevent horizontal scroll on Android */
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

img {
    max-width: 100%;
    height: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

.text-muted { color: var(--gray-500); }
.text-small { font-size: var(--font-size-sm); }
.text-center { text-align: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-4);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--spacing-2); }
.gap-4 { gap: var(--spacing-4); }
.gap-6 { gap: var(--spacing-6); }

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-6);
}

.card-header {
    padding-bottom: var(--spacing-4);
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--spacing-4);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: 0;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    margin-top: var(--spacing-1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-5);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 1;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-lg {
    padding: var(--spacing-4) var(--spacing-6);
    font-size: var(--font-size-base);
}

.btn-sm {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-xs);
}

.btn-block {
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: var(--spacing-4);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--spacing-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--gray-800);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.form-input.error,
.form-select.error {
    border-color: var(--danger);
}

.form-error {
    font-size: var(--font-size-sm);
    color: var(--danger);
    margin-top: var(--spacing-1);
}

.form-hint {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    margin-top: var(--spacing-1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════════ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--spacing-3) var(--spacing-4);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-50);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-1) var(--spacing-2);
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
}

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

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

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

.badge-info {
    background: var(--info-light);
    color: #0e7490;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */
.alert {
    padding: var(--spacing-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-4);
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: var(--info-light);
    color: #0e7490;
    border: 1px solid #67e8f9;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-4) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-6);
    list-style: none;
}

.navbar-link {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
    transition: color var(--transition-fast);
}

.navbar-link:hover,
.navbar-link.active {
    color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR (Dashboard)
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 200;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: var(--spacing-6);
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-nav {
    padding: var(--spacing-4);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-1);
    min-height: 44px; /* Touch target */
}

.sidebar-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.sidebar-link.active {
    background: var(--primary);
    color: var(--white);
}

.sidebar-user {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.sidebar-user-details {
    overflow: hidden;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-credit {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.main-content {
    margin-left: 260px;
    padding: var(--spacing-8);
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS - REVOLUT STYLE (Light Theme)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Modal Overlay */
.modal-overlay,
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active,
.modal.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content - Light Theme */
.modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: modalRevolutIn 0.3s ease forwards;
}

@keyframes modalRevolutIn {
    from {
        transform: translateY(20px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-overlay.active .modal-content,
.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

/* Modal Header - Light */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 16px 16px 0 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* Modal Body - Light */
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    background: #ffffff;
}

/* Modal Footer - Light */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REVOLUT FORM STYLES (Light Theme for Modals)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Form Inputs in Modals - Light Theme */
.modal .form-input,
.modal .form-control,
.modal .form-select,
.modal .form-textarea,
.modal-content .form-input,
.modal-content .form-control,
.modal-content .form-select,
.modal-content .form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px;
    color: #1e293b !important;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.modal .form-input::placeholder,
.modal .form-control::placeholder,
.modal .form-textarea::placeholder,
.modal-content .form-input::placeholder,
.modal-content .form-control::placeholder,
.modal-content .form-textarea::placeholder {
    color: #94a3b8 !important;
}

.modal .form-input:hover,
.modal .form-control:hover,
.modal .form-select:hover,
.modal-content .form-input:hover,
.modal-content .form-control:hover,
.modal-content .form-select:hover {
    border-color: #cbd5e1 !important;
    background: #f1f5f9 !important;
}

.modal .form-input:focus,
.modal .form-control:focus,
.modal .form-select:focus,
.modal .form-textarea:focus,
.modal-content .form-input:focus,
.modal-content .form-control:focus,
.modal-content .form-select:focus,
.modal-content .form-textarea:focus {
    outline: none;
    border-color: #3b82f6 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Select dropdown arrow - Light */
.modal .form-select,
.modal-content .form-select {
    cursor: pointer;
    appearance: none;
    background-image: 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='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 40px !important;
}

/* Form Labels - Light */
.modal .form-label,
.modal-content .form-label,
.modal .form-group label,
.modal-content .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    color: #64748b !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Required field indicator */
.modal .required,
.modal-content .required {
    color: #ef4444;
}

/* Form Hints - Light */
.modal .form-hint,
.modal-content .form-hint {
    font-size: 0.75rem;
    color: #94a3b8 !important;
    margin-top: 6px;
}

/* Form Section Titles - Light */
.modal .form-section-title,
.modal-content .form-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b82f6 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 24px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
    border-radius: 10px;
    border-left: 3px solid #3b82f6;
}

.modal .form-section-title:first-child,
.modal-content .form-section-title:first-child {
    margin-top: 0;
}

/* Checkbox styling - Light */
.modal .form-checkbox,
.modal-content .form-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal .form-checkbox:hover,
.modal-content .form-checkbox:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.modal .form-checkbox input,
.modal-content .form-checkbox input {
    width: 20px;
    height: 20px;
    accent-color: #10b981;
}

.modal .form-checkbox span,
.modal-content .form-checkbox span {
    color: #1e293b !important;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REVOLUT TABS STYLE (Light Theme)
   ═══════════════════════════════════════════════════════════════════════════ */

.modal .tabs,
.modal-content .tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
    gap: 4px;
    border: 1px solid #e2e8f0;
}

.modal .tab-btn,
.modal-content .tab-btn {
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal .tab-btn:hover,
.modal-content .tab-btn:hover {
    color: #1e293b;
    background: rgba(255, 255, 255, 0.5);
}

.modal .tab-btn.active,
.modal-content .tab-btn.active {
    color: #ffffff;
    background: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.modal .tab-content,
.modal-content .tab-content {
    display: none;
    animation: tabRevolutFadeIn 0.3s ease;
}

.modal .tab-content.active,
.modal-content .tab-content.active {
    display: block;
}

@keyframes tabRevolutFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   REVOLUT BUTTONS STYLE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Primary Button - Revolut Style */
.btn-primary,
.modal .btn-primary,
.modal-content .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover,
.modal .btn-primary:hover,
.modal-content .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-primary:active,
.modal .btn-primary:active,
.modal-content .btn-primary:active {
    transform: translateY(0);
}

/* Outline Button - Revolut Style */
.modal .btn-outline,
.modal-content .btn-outline {
    background: #ffffff;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal .btn-outline:hover,
.modal-content .btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REVOLUT SEARCH BOX (Light Theme)
   ═══════════════════════════════════════════════════════════════════════════ */

.modal .search-box,
.modal-content .search-box {
    position: relative;
    margin-bottom: 24px;
}

.modal .search-box input,
.modal-content .search-box input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px;
    color: #1e293b !important;
    font-size: 0.95rem;
}

.modal .search-box input:focus,
.modal-content .search-box input:focus {
    background: #ffffff !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal .search-box .search-icon,
.modal-content .search-box .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #3b82f6;
    font-size: 1.1rem;
}

.modal .search-results,
.modal-content .search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modal .search-results.active,
.modal-content .search-results.active {
    display: block;
}

.modal .search-result-item,
.modal-content .search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.modal .search-result-item:last-child,
.modal-content .search-result-item:last-child {
    border-bottom: none;
}

.modal .search-result-item:hover,
.modal-content .search-result-item:hover {
    background: #f8fafc;
}

.modal .search-result-item .company-name,
.modal-content .search-result-item .company-name {
    font-weight: 500;
    color: #1e293b;
}

.modal .search-result-item .company-vat,
.modal-content .search-result-item .company-vat {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REVOLUT LOGO UPLOAD (Light Theme)
   ═══════════════════════════════════════════════════════════════════════════ */

.modal .logo-upload,
.modal-content .logo-upload {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.modal .logo-preview,
.modal-content .logo-preview {
    width: 100px;
    height: 100px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffffff;
    transition: all 0.2s ease;
}

.modal .logo-preview:hover,
.modal-content .logo-preview:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.modal .logo-preview img,
.modal-content .logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal .logo-preview .placeholder,
.modal-content .logo-preview .placeholder {
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
}

.modal .upload-btn,
.modal-content .upload-btn {
    padding: 12px 24px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    color: #3b82f6;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal .upload-btn:hover,
.modal-content .upload-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN PANEL - REVOLUT LIGHT THEME
   Standard grafico per tutto il pannello amministrazione
   ═══════════════════════════════════════════════════════════════════════════ */

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Admin Sidebar */
.admin-sidebar {
    width: 260px;
    background: #0f172a;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
}

.admin-sidebar .sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar .sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.admin-sidebar .sidebar-logo span {
    color: #3b82f6;
}

.admin-sidebar .sidebar-badge {
    display: inline-block;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
}

.admin-sidebar .nav-section {
    padding: 0 16px;
    margin-bottom: 24px;
}

.admin-sidebar .nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 8px 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    margin: 2px 0;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.admin-sidebar .nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #fff;
}

.admin-sidebar .nav-item.active {
    background: #3b82f6;
    color: #fff;
}

.admin-sidebar .nav-item .icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Admin Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    background: #f8fafc;
    min-height: 100vh;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Admin Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-card.highlight {
    border-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.stat-card.success {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.stat-card.warning {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.1) 100%);
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-value.primary { color: #3b82f6; }
.stat-value.success { color: #10b981; }
.stat-value.warning { color: #f59e0b; }

.stat-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 6px;
}

/* Admin Cards */
.admin-main .card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: none;
}

.admin-main .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-main .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* Admin Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.data-table th {
    font-weight: 600;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8fafc;
}

.data-table tbody tr {
    transition: all 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

.data-table .text-right {
    text-align: right;
}

/* Admin Form Inputs - Revolut Light */
.admin-main .form-input,
.admin-main .form-control,
.admin-main .form-select,
.admin-main .form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #1e293b;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.admin-main .form-input:hover,
.admin-main .form-control:hover,
.admin-main .form-select:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.admin-main .form-input:focus,
.admin-main .form-control:focus,
.admin-main .form-select:focus,
.admin-main .form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.admin-main .form-input::placeholder,
.admin-main .form-control::placeholder,
.admin-main .form-textarea::placeholder {
    color: #94a3b8;
}

.admin-main .form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-main .form-hint {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* Admin Filters */
.admin-main .filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}

.admin-main .filters .form-input,
.admin-main .filters .form-select {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-width: 140px;
}

.admin-main .filters .btn {
    padding: 8px 16px;
}

/* Admin Tabs */
.admin-main .tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0;
    overflow-x: auto;
}

.admin-main .tab {
    padding: 12px 16px;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
}

.admin-main .tab:hover {
    color: #1e293b;
}

.admin-main .tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* Status Badges - Revolut Style */
.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status.active, .status.completed, .status.paid, .status.matched {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status.pending, .status.processing, .status.draft {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status.failed, .status.cancelled, .status.unmatched, .status.expired, .status.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status.refunded, .status.partial {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.status.ignored {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

/* Amount - Monospace */
.amount {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-weight: 600;
}

.amount.positive { color: #10b981; }
.amount.negative { color: #ef4444; }

/* Direction badge */
.direction {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.direction.in {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.direction.out {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Admin Loading */
.admin-main .loading {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

/* Admin Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 0.85rem;
    color: #64748b;
}

/* Admin Sidebar Nav Container */
.admin-sidebar .sidebar-nav {
    padding: 16px 0;
}

/* Admin Nav Item Badge (notification count) */
.admin-sidebar .nav-item .badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Admin Header Actions */
.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Admin User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1e293b;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
}

/* Logout Button */
.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.85rem;
}

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

/* Stat Card Sub-elements */
.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card-title {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card-icon.blue { background: rgba(59, 130, 246, 0.12); }
.stat-card-icon.green { background: rgba(16, 185, 129, 0.12); }
.stat-card-icon.yellow { background: rgba(245, 158, 11, 0.12); }
.stat-card-icon.red { background: rgba(239, 68, 68, 0.12); }
.stat-card-icon.purple { background: rgba(168, 85, 247, 0.12); }

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.stat-card-detail {
    font-size: 0.8rem;
    color: #64748b;
}

.stat-card-detail .positive { color: #10b981; }
.stat-card-detail .negative { color: #ef4444; }

/* Data Grid (2-column layout) */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

/* Data Cards */
.data-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.data-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.data-card-body {
    padding: 0;
}

/* Table User Element */
.table-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 32px;
    height: 32px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}

.table-user-info .name {
    font-weight: 500;
    color: #1e293b;
}

.table-user-info .email {
    font-size: 0.8rem;
    color: #64748b;
}

.table-time {
    font-size: 0.85rem;
    color: #64748b;
}

/* Table Badges */
.table-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.table-badge.success { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.table-badge.warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.table-badge.danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.table-badge.info { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.quick-action-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.03);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

/* Data table last row */
.data-table tr:last-child td {
    border-bottom: none;
}

/* Financial Stats (Dashboard) */
.financial-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 24px;
}

.financial-card {
    background: rgba(59, 130, 246, 0.04);
    border-radius: 10px;
    padding: 20px;
}

.financial-card h4 {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.financial-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.financial-row:last-child {
    border-bottom: none;
}

.financial-label {
    color: #64748b;
    font-size: 0.85rem;
}

.financial-value {
    font-weight: 600;
}

.financial-value.positive { color: #10b981; }
.financial-value.negative { color: #ef4444; }

/* Financial Totals */
.financial-totals {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, rgba(16, 185, 129, 0.06) 100%);
    border-radius: 10px;
    padding: 20px;
    margin: 0 24px 24px;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    text-align: center;
}

.total-item {
    padding: 12px;
}

.total-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.total-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.total-value.cost { color: #ef4444; }
.total-value.revenue { color: #10b981; }
.total-value.margin { color: #3b82f6; }

/* Progress Bar */
.progress-bar-container {
    background: #e2e8f0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

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

.progress-bar.success {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.progress-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* Provider Stats Table */
.provider-stats-table {
    width: calc(100% - 48px);
    border-collapse: collapse;
    margin: 0 24px;
}

.provider-stats-table th,
.provider-stats-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.provider-stats-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.provider-stats-table tr:last-child td {
    border-bottom: none;
}

.provider-name {
    font-weight: 600;
    color: #1e293b;
}

/* Success Rate Badge */
.success-rate {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.success-rate.high { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.success-rate.medium { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.success-rate.low { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

/* Admin Badges (role, plan, status) */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.badge-user { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.badge-trial { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.badge-starter { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.badge-professional { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.badge-enterprise { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.badge-active { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.badge-inactive { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.badge-expired { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.badge-exhausted { background: rgba(107, 114, 128, 0.12); color: #9ca3af; }

/* Admin Action Buttons */
.actions-cell {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-icon.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Admin Header User (alternative layout) */
.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-user .user-name {
    font-weight: 500;
    color: #1e293b;
}

.header-avatar {
    width: 36px;
    height: 36px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Admin Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Admin Filters Bar */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

/* Admin User Cell (table) */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Admin Table Container */
.table-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

/* Admin Pagination (extended) */
.pagination-info {
    color: #64748b;
    font-size: 0.85rem;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

/* Stats Summary / Row */
.stats-summary,
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 24px;
    flex: 1;
    min-width: 120px;
}

.stat-box .label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 6px;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-box.pending .value { color: #f59e0b; }
.stat-box.paid .value { color: #10b981; }
.stat-box.completed .value { color: #10b981; }
.stat-box.failed .value { color: #ef4444; }

/* Price styling */
.price {
    font-weight: 600;
    color: #10b981;
}

/* Btn-icon success variant */
.btn-icon.success:hover {
    border-color: #10b981;
    color: #10b981;
}

/* Action Badges (audit) */
.action-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.action-badge.login { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.action-badge.logout { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.action-badge.create { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.action-badge.update { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.action-badge.delete { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.action-badge.admin { background: rgba(236, 72, 153, 0.1); color: #ec4899; }

/* Badge variants (contextual) */
.badge-success { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.badge-info { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }

/* Table Card (container for data-table) */
.table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.table-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* Tab Buttons (alternative tab style) */
.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: #64748b;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

.tab-btn:hover {
    color: #1e293b;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Cards Grid (catalog, etc.) */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* Cost/Price cell */
.price-cell {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-weight: 600;
}

.price-cell.cost { color: #ef4444; }
.price-cell.sell { color: #10b981; }
.price-cell.margin { color: #3b82f6; }

.cost-value {
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* Filter group */
.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Admin Responsive */
@media (max-width: 1200px) {
    .data-grid {
        grid-template-columns: 1fr;
    }

    .financial-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Admin sidebar mobile: gestito da admin-common.css (slide-in) */

    .admin-main {
        margin-left: 0;
        padding: 16px;
    }

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

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-main .filters {
        flex-direction: column;
    }

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

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════════════════════════════════════ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-4);
    z-index: 9999;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.mt-4 { margin-top: var(--spacing-4); }
.mt-6 { margin-top: var(--spacing-6); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-6 { margin-bottom: var(--spacing-6); }
.p-4 { padding: var(--spacing-4); }
.p-6 { padding: var(--spacing-6); }

/* ═══════════════════════════════════════════════════════════════════════════
   CLIENT PAGES - REVOLUT LIGHT THEME
   Design ultra-pulito, bianco puro, ombre minime, navigazione top-bar
   ═══════════════════════════════════════════════════════════════════════════ */

/* Color overrides for client pages */
.cl {
    --cl-primary: #0075EB;
    --cl-primary-dark: #0062C4;
    --cl-primary-light: #e8f4fd;
    --cl-bg: #FFFFFF;
    --cl-bg-subtle: #FAFBFC;
    --cl-text: #191C20;
    --cl-text-secondary: #6B7280;
    --cl-text-muted: #9CA3AF;
    --cl-border: #F0F0F0;
    --cl-border-hover: #D4D4D4;
    --cl-success: #00B86B;
    --cl-warning: #F5A623;
    --cl-danger: #E5484D;
    --cl-radius: 12px;
}

/* Client Layout - full page wrapper */
.cl {
    background: var(--cl-bg);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--cl-text);
    -webkit-font-smoothing: antialiased;
}

/* ── CLIENT TOP NAVIGATION ────────────────────────────────────────────── */
.cl-topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--cl-border);
    padding: 0 max(32px, calc((100% - 960px) / 2 + 32px));
    height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.cl-topnav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cl-text);
    text-decoration: none;
    letter-spacing: -0.3px;
}

.cl-topnav-brand span {
    color: var(--cl-primary);
}

.cl-topnav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cl-topnav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cl-text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
    min-height: 44px; /* Touch target */
}

.cl-topnav-link:hover {
    color: var(--cl-text);
    background: var(--cl-bg-subtle);
}

.cl-topnav-link.active {
    color: var(--cl-primary);
    background: var(--cl-primary-light);
}

.cl-topnav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.cl-topnav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cl-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.cl-topnav-avatar:hover {
    opacity: 0.85;
}

.cl-topnav-avatar-wrapper {
    position: relative;
}

.cl-avatar-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid var(--cl-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.cl-avatar-dropdown.open {
    display: block;
}

.cl-avatar-dropdown a,
.cl-avatar-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--cl-text);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.1s ease;
    text-align: left;
}

.cl-avatar-dropdown a:hover,
.cl-avatar-dropdown button:hover {
    background: var(--cl-bg-subtle);
}

.cl-avatar-dropdown hr {
    margin: 0;
    border: none;
    border-top: 1px solid var(--cl-border);
}

.cl-topnav-help {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--cl-border);
    background: var(--cl-bg);
    color: var(--cl-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.cl-topnav-help:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
    background: rgba(0, 117, 235, 0.05);
}

.cl-topnav-username {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cl-text);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .cl-topnav-username {
        display: none;
    }
}

.cl-topnav-credit {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--cl-bg-subtle);
    border: 1px solid var(--cl-border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cl-text);
    text-decoration: none;
    transition: all 0.15s ease;
}

.cl-topnav-credit:hover {
    border-color: var(--cl-primary);
    color: var(--cl-primary);
}

.cl-topnav-credit .credit-amount {
    color: var(--cl-success);
    font-weight: 700;
}

/* Mobile menu toggle */
.cl-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--cl-text);
    font-size: 1.5rem;
}

/* ── CLIENT PAGE CONTENT ──────────────────────────────────────────────── */
.cl-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 32px 80px;
}

.cl-content-wide {
    max-width: 1120px;
}

/* ── CLIENT PAGE HEADER ───────────────────────────────────────────────── */
.cl-page-header {
    margin-bottom: 32px;
}

.cl-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--cl-text);
    margin: 0 0 4px;
    letter-spacing: -0.3px;
}

.cl-page-header p {
    font-size: 0.9rem;
    color: var(--cl-text-secondary);
    margin: 0;
}

.cl-page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cl-page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* ── CLIENT CARDS ─────────────────────────────────────────────────────── */
.cl-card {
    background: var(--cl-bg);
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    padding: 24px;
    transition: border-color 0.15s ease;
}

.cl-card:hover {
    border-color: var(--cl-border-hover);
}

.cl-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cl-border);
}

.cl-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0;
}

.cl-card-flat {
    border: none;
    padding: 0;
}

.cl-card-flat:hover {
    border-color: transparent;
}

/* ── CLIENT BUTTONS ───────────────────────────────────────────────────── */
.cl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    min-height: 44px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.cl-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cl-btn-primary {
    background: var(--cl-primary);
    color: #fff;
}

.cl-btn-primary:hover:not(:disabled) {
    background: var(--cl-primary-dark);
}

.cl-btn-secondary {
    background: var(--cl-bg-subtle);
    border: 1px solid var(--cl-border);
    color: var(--cl-text);
}

.cl-btn-secondary:hover:not(:disabled) {
    background: #F3F4F6;
    border-color: var(--cl-border-hover);
}

.cl-btn-ghost {
    background: transparent;
    color: var(--cl-text-secondary);
    padding: 8px 12px;
}

.cl-btn-ghost:hover:not(:disabled) {
    color: var(--cl-text);
    background: var(--cl-bg-subtle);
}

.cl-btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 12px;
}

.cl-btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.cl-btn-block {
    width: 100%;
}

/* ── CLIENT INVESTIGATION LIST ────────────────────────────────────────── */
.cl-inv-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cl-inv-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--cl-bg);
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
    cursor: pointer;
}

.cl-inv-item:hover {
    border-color: var(--cl-primary);
    box-shadow: 0 2px 8px rgba(0, 117, 235, 0.06);
}

.cl-inv-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.cl-inv-icon.company { background: #EEF2FF; }
.cl-inv-icon.person { background: #FFF7ED; }
.cl-inv-icon.network { background: #F0FDF4; }

.cl-inv-info {
    flex: 1;
    min-width: 0;
}

.cl-inv-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--cl-text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cl-inv-meta {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cl-inv-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.cl-inv-progress {
    text-align: right;
}

.cl-inv-progress-label {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
    margin-bottom: 4px;
}

.cl-inv-progress-bar {
    width: 80px;
    height: 4px;
    background: var(--cl-border);
    border-radius: 2px;
    overflow: hidden;
}

.cl-inv-progress-fill {
    height: 100%;
    background: var(--cl-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.cl-inv-progress-fill.complete {
    background: var(--cl-success);
}

/* ── CLIENT STATUS BADGES ─────────────────────────────────────────────── */
.cl-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.cl-status-completed { background: rgba(0, 184, 107, 0.1); color: #00875A; }
.cl-status-processing { background: rgba(0, 117, 235, 0.1); color: var(--cl-primary); }
.cl-status-pending { background: rgba(245, 166, 35, 0.1); color: #B8860B; }
.cl-status-draft { background: rgba(107, 114, 128, 0.08); color: #6B7280; }
.cl-status-failed { background: rgba(229, 72, 77, 0.1); color: #C43D42; }
.cl-status-partial { background: rgba(168, 85, 247, 0.1); color: #7C3AED; }
.cl-status-cancelled { background: rgba(107, 114, 128, 0.08); color: #9CA3AF; }

/* ── CLIENT STAT CARDS ────────────────────────────────────────────────── */
.cl-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.cl-stat {
    padding: 20px;
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    background: var(--cl-bg);
}

.cl-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--cl-text);
    margin-bottom: 2px;
    letter-spacing: -0.5px;
}

.cl-stat-value.primary { color: var(--cl-primary); }
.cl-stat-value.success { color: var(--cl-success); }
.cl-stat-value.warning { color: var(--cl-warning); }

.cl-stat-label {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    font-weight: 500;
}

/* ── CLIENT EMPTY STATE ───────────────────────────────────────────────── */
.cl-empty {
    text-align: center;
    padding: 64px 32px;
}

.cl-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.cl-empty h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0 0 8px;
}

.cl-empty p {
    font-size: 0.9rem;
    color: var(--cl-text-muted);
    margin: 0 0 24px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ── CLIENT CREDIT WIDGET ─────────────────────────────────────────────── */
.cl-credit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    margin-bottom: 24px;
}

.cl-credit-balance {
    font-size: 2rem;
    font-weight: 700;
    color: var(--cl-success);
    letter-spacing: -0.5px;
}

.cl-credit-label {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ── CLIENT VOUCHER FORM ──────────────────────────────────────────────── */
.cl-voucher-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.cl-voucher-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--cl-border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--cl-text);
    background: var(--cl-bg-subtle);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.15s ease;
}

.cl-voucher-form input:focus {
    outline: none;
    border-color: var(--cl-primary);
    background: var(--cl-bg);
    box-shadow: 0 0 0 3px rgba(0, 117, 235, 0.08);
}

.cl-voucher-form input::placeholder {
    color: var(--cl-text-muted);
    text-transform: none;
    letter-spacing: normal;
}

/* ── CLIENT RECHARGE OPTIONS ──────────────────────────────────────────── */
.cl-recharge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.cl-recharge-option {
    padding: 16px 12px;
    border: 1px solid var(--cl-border);
    border-radius: 10px;
    background: var(--cl-bg);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    position: relative;
    font-family: inherit;
}

.cl-recharge-option:hover {
    border-color: var(--cl-primary);
}

.cl-recharge-option.selected {
    border-color: var(--cl-primary);
    background: var(--cl-primary-light);
}

.cl-recharge-option .amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cl-text);
}

.cl-recharge-option .bonus-tag {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--cl-success);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.cl-recharge-option .sub {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
    margin-top: 4px;
}

.cl-recharge-option.selected .sub {
    color: var(--cl-primary);
}

/* ── CLIENT FORM INPUTS ───────────────────────────────────────────────── */
.cl-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--cl-border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--cl-text);
    background: var(--cl-bg-subtle);
    transition: all 0.15s ease;
}

.cl-input:hover {
    border-color: var(--cl-border-hover);
}

.cl-input:focus {
    outline: none;
    border-color: var(--cl-primary);
    background: var(--cl-bg);
    box-shadow: 0 0 0 3px rgba(0, 117, 235, 0.08);
}

.cl-input::placeholder {
    color: var(--cl-text-muted);
}

.cl-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cl-text-secondary);
    margin-bottom: 6px;
}

.cl-form-group {
    margin-bottom: 20px;
}

.cl-form-hint {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
    margin-top: 4px;
}

/* ── CLIENT ALERTS ────────────────────────────────────────────────────── */
.cl-alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cl-alert-success {
    background: rgba(0, 184, 107, 0.08);
    color: #00875A;
    border: 1px solid rgba(0, 184, 107, 0.15);
}

.cl-alert-danger {
    background: rgba(229, 72, 77, 0.08);
    color: #C4342C;
    border: 1px solid rgba(229, 72, 77, 0.15);
}

.cl-alert-info {
    background: rgba(0, 117, 235, 0.06);
    color: var(--cl-primary);
    border: 1px solid rgba(0, 117, 235, 0.12);
}

.cl-alert-warning {
    background: rgba(245, 158, 11, 0.08);
    color: #B45309;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* ── CLIENT MODAL / OVERLAY ──────────────────────────────────────────── */
.cl-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.cl-overlay.active { display: block; }

.cl-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--cl-bg);
    border-radius: var(--cl-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    padding: 28px;
    width: 90%;
    max-width: 480px;
    z-index: 1001;
    max-height: 80vh;
    overflow-y: auto;
}

.cl-modal.active { display: block; }

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

.cl-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cl-text);
}

.cl-modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--cl-text-muted);
    padding: 4px;
}

.cl-modal-close:hover { color: var(--cl-text); }

.cl-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--cl-border);
}

/* ── CLIENT AUTH PAGES ────────────────────────────────────────────────── */
.cl-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cl-bg);
    padding: 32px;
}

.cl-auth-card {
    width: 100%;
    max-width: 400px;
}

.cl-auth-logo {
    text-align: center;
    margin-bottom: 36px;
}

.cl-auth-logo a {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--cl-text);
    text-decoration: none;
}

.cl-auth-logo a span {
    color: var(--cl-primary);
}

.cl-auth-logo p {
    font-size: 0.9rem;
    color: var(--cl-text-muted);
    margin-top: 6px;
}

.cl-auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--cl-border);
    font-size: 0.85rem;
    color: var(--cl-text-muted);
}

.cl-auth-footer a {
    color: var(--cl-primary);
    font-weight: 500;
    text-decoration: none;
}

.cl-auth-footer a:hover {
    text-decoration: underline;
}

/* ── CLIENT INVESTIGATION DETAIL ──────────────────────────────────────── */
.cl-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.cl-detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cl-text);
    margin: 0 0 4px;
    letter-spacing: -0.3px;
}

.cl-detail-subtitle {
    font-size: 0.875rem;
    color: var(--cl-text-secondary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cl-detail-actions {
    display: flex;
    gap: 10px;
}

/* Progress overview */
.cl-progress-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.cl-progress-item {
    padding: 16px;
    border: 1px solid var(--cl-border);
    border-radius: 10px;
    text-align: center;
}

.cl-progress-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cl-text);
}

.cl-progress-desc {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
    margin-top: 2px;
}

/* Dossier tree */
.cl-dossier-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cl-dossier {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border: 1px solid var(--cl-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.cl-dossier:hover {
    border-color: var(--cl-primary);
    background: var(--cl-primary-light);
}

.cl-dossier.depth-1 { margin-left: 24px; }
.cl-dossier.depth-2 { margin-left: 48px; }
.cl-dossier.depth-3 { margin-left: 72px; }

.cl-dossier-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.cl-dossier-icon.company { background: #EEF2FF; }
.cl-dossier-icon.person { background: #FFF7ED; }

.cl-dossier-info {
    flex: 1;
    min-width: 0;
}

.cl-dossier-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--cl-text);
}

.cl-dossier-role {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
}

.cl-dossier-docs {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    text-align: right;
    flex-shrink: 0;
}

/* ── DOSSIER TREE (Expandable Hierarchy) ─────────────────────────────── */
.cl-dossier-group {
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    margin-bottom: 8px;
    background: var(--cl-bg);
}

.cl-dossier-group .cl-dossier-group {
    margin-left: 20px;
    border-color: var(--cl-border-light, #e5e7eb);
}

.cl-dossier-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.cl-dossier-header:hover {
    background: var(--cl-primary-light, #f0f5ff);
}

.cl-dossier-toggle {
    font-size: 0.75rem;
    color: var(--cl-text-muted);
    transition: transform 0.2s;
}

.cl-dossier-group.expanded > .cl-dossier-header .cl-dossier-toggle {
    transform: rotate(180deg);
}

.cl-dossier-body {
    display: none;
    padding: 0 16px 16px 16px;
    border-top: 1px solid var(--cl-border-light, #e5e7eb);
}

.cl-dossier-group.expanded > .cl-dossier-body {
    display: block;
}

.cl-dossier-children-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cl-text-muted);
    margin: 16px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--cl-border-light, #e5e7eb);
}

.cl-dossier-children {
    margin-left: 0;
}

/* ── CLIENT ANALYSIS / REPORT SECTION ─────────────────────────────────── */
.cl-analysis {
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    padding: 24px;
    margin-bottom: 24px;
}

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

.cl-analysis-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0;
}

.cl-anomaly-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.cl-anomaly {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.cl-anomaly.high {
    background: rgba(229, 72, 77, 0.06);
    border: 1px solid rgba(229, 72, 77, 0.12);
    color: #9B2C2C;
}

.cl-anomaly.medium {
    background: rgba(245, 166, 35, 0.06);
    border: 1px solid rgba(245, 166, 35, 0.12);
    color: #92400E;
}

.cl-anomaly.low {
    background: rgba(0, 117, 235, 0.04);
    border: 1px solid rgba(0, 117, 235, 0.08);
    color: #1E40AF;
}

.cl-anomaly-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.cl-anomaly-text {
    flex: 1;
}

.cl-anomaly-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.cl-narrative {
    padding: 20px 24px;
    background: var(--cl-bg-subtle);
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--cl-text);
    white-space: pre-wrap;
}

/* ── CLIENT SECTION DIVIDER ───────────────────────────────────────────── */
.cl-divider {
    border: none;
    border-top: 1px solid var(--cl-border);
    margin: 24px 0;
}

/* ── CLIENT TABS ──────────────────────────────────────────────────────── */
.cl-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--cl-border);
    margin-bottom: 24px;
    overflow-x: auto;
}

.cl-tab {
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cl-text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
}

.cl-tab:hover {
    color: var(--cl-text);
}

.cl-tab.active {
    color: var(--cl-primary);
    border-bottom-color: var(--cl-primary);
}

.cl-tab-content,
.view-content {
    display: none;
}

.cl-tab-content.active,
.view-content.active {
    display: block;
    animation: clFadeIn 0.2s ease;
}

@keyframes clFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── CLIENT LANDING PAGE ──────────────────────────────────────────────── */
.cl-hero {
    text-align: center;
    padding: 80px 32px 60px;
    max-width: 720px;
    margin: 0 auto;
}

.cl-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cl-text);
    letter-spacing: -0.5px;
    margin: 0 0 16px;
    line-height: 1.2;
}

.cl-hero p {
    font-size: 1.1rem;
    color: var(--cl-text-secondary);
    margin: 0 0 32px;
    line-height: 1.6;
}

.cl-hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.cl-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 40px 32px 80px;
    max-width: 960px;
    margin: 0 auto;
}

.cl-feature {
    padding: 28px 24px;
    border: 1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    text-align: center;
}

.cl-feature-icon {
    font-size: 2rem;
    margin-bottom: 16px;
}

.cl-feature h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cl-text);
    margin: 0 0 8px;
}

.cl-feature p {
    font-size: 0.875rem;
    color: var(--cl-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ── CLIENT PROFILE ───────────────────────────────────────────────────── */
.cl-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cl-profile-field {
    margin-bottom: 20px;
}

.cl-profile-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cl-text-muted);
    margin-bottom: 4px;
}

.cl-profile-field .value {
    font-size: 0.95rem;
    color: var(--cl-text);
    font-weight: 500;
}

/* ── CLIENT TRANSACTION LIST ──────────────────────────────────────────── */
.cl-tx-list {
    display: flex;
    flex-direction: column;
}

.cl-tx-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--cl-border);
}

.cl-tx-item:last-child {
    border-bottom: none;
}

.cl-tx-desc {
    font-size: 0.875rem;
    color: var(--cl-text);
    font-weight: 500;
}

.cl-tx-date {
    font-size: 0.8rem;
    color: var(--cl-text-muted);
    margin-top: 2px;
}

.cl-tx-amount {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.cl-tx-amount.positive { color: var(--cl-success); }
.cl-tx-amount.negative { color: var(--cl-danger); }

/* ── CLIENT PASSWORD TOGGLE ───────────────────────────────────────────── */
.cl-password-wrapper {
    position: relative;
}

.cl-password-wrapper .cl-input {
    padding-right: 44px;
}

.cl-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--cl-text-muted);
    display: flex;
    align-items: center;
}

.cl-password-toggle:hover {
    color: var(--cl-primary);
}

.cl-password-toggle svg {
    width: 20px;
    height: 20px;
}

/* ── CLIENT RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cl-topnav {
        padding: 0 16px;
        height: 56px;
    }

    .cl-topnav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--cl-bg);
        border-bottom: 1px solid var(--cl-border);
        flex-direction: column;
        padding: 12px 16px;
        gap: 4px;
    }

    .cl-topnav-links.open {
        display: flex;
    }

    .cl-menu-toggle {
        display: block;
    }

    .cl-content {
        padding: 24px 16px 60px;
    }

    .cl-page-header h1 {
        font-size: 1.4rem;
    }

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

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

    .cl-hero h1 {
        font-size: 1.75rem;
    }

    .cl-hero p {
        font-size: 0.95rem;
    }

    .cl-profile-grid {
        grid-template-columns: 1fr;
    }

    .cl-detail-header {
        flex-direction: column;
    }

    .cl-dossier.depth-1 { margin-left: 16px; }
    .cl-dossier.depth-2 { margin-left: 32px; }
    .cl-dossier.depth-3 { margin-left: 48px; }

    .cl-inv-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .cl-inv-right {
        width: 100%;
        justify-content: space-between;
    }

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

@media (max-width: 480px) {
    .cl-stats {
        grid-template-columns: 1fr;
    }

    .cl-recharge-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cl-hero {
        padding: 48px 16px 40px;
    }

    .cl-features {
        padding: 24px 16px 48px;
        grid-template-columns: 1fr;
    }

    /* B: Topnav overflow fix — hide help button, reduce credit pill */
    .cl-topnav-help {
        display: none;
    }

    .cl-topnav-credit {
        padding: 5px 8px;
        font-size: 0; /* zero-out bare text node (colon) */
        gap: 4px;
    }

    .cl-topnav-credit span[data-i18n] {
        display: none; /* hide "Credito" label, show only the amount */
    }

    .cl-topnav-credit .credit-amount {
        font-size: 0.75rem; /* restore font size for the amount */
    }

    /* C: Reduce lateral padding on small phones */
    .cl-content {
        padding: 16px 12px 60px;
    }

    /* G: Reduce heading size */
    .cl-page-header h1 {
        font-size: 1.2rem;
    }

    /* Topnav gap reduction */
    .cl-topnav-right {
        gap: 8px;
    }

    /* Topnav height consistent */
    .cl-topnav {
        gap: 8px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE (Legacy sidebar - client pages)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

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

    .main-content {
        margin-left: 0;
        padding: var(--spacing-4);
        padding-top: 64px; /* Clear the fixed hamburger button (44px + 12px top + 8px gap) */
    }

    .navbar-nav {
        gap: var(--spacing-4);
    }

    .table th,
    .table td {
        padding: var(--spacing-2) var(--spacing-3);
    }

    /* Table scrollable wrapper for sidebar pages */
    .main-content .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESSIVE PROFILING R3.1
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── LANGUAGE SWITCHER (auth pages) ──────────────────────────── */
.cl-auth-lang {
    position: absolute;
    top: 16px;
    right: 16px;
}

.cl-auth-lang select {
    background: transparent;
    border: 1px solid var(--cl-border, #E2E8F0);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--cl-text-secondary, #64748B);
}

.cl-auth-card {
    position: relative;
}

/* ── PROFILE COMPLETION RING ─────────────────────────────────── */
.cl-profile-ring {
    display: inline-block;
    margin-top: 8px;
    text-decoration: none;
    transition: transform 0.2s;
}

.cl-profile-ring:hover {
    transform: scale(1.1);
}

/* ── SMART BANNER ────────────────────────────────────────────── */
.cl-profile-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.cl-profile-banner-info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

.cl-profile-banner-blocking {
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    color: #92400E;
}

.cl-banner-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

.cl-banner-dismiss:hover {
    opacity: 1;
}

/* ── INLINE GATE ─────────────────────────────────────────────── */
.cl-inline-gate {
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.cl-inline-gate p {
    margin: 0 0 12px;
    font-weight: 500;
    color: #0C4A6E;
}

.cl-inline-gate small {
    display: block;
    margin-top: 8px;
    color: #64748B;
    font-size: 0.8rem;
}

/* ── ONBOARDING CHECKLIST ────────────────────────────────────── */
.cl-onboarding-checklist {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

.cl-checklist-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cl-checklist-title h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.cl-checklist-progress {
    font-size: 0.8rem;
    color: var(--cl-text-muted, #94A3B8);
    background: #F1F5F9;
    padding: 2px 8px;
    border-radius: 10px;
}

.cl-checklist-dismiss {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--cl-text-muted, #94A3B8);
    padding: 4px;
}

.cl-checklist-progress-bar {
    height: 4px;
    background: #E2E8F0;
    border-radius: 2px;
    margin-bottom: 16px;
    overflow: hidden;
}

.cl-checklist-progress-fill {
    height: 100%;
    background: var(--cl-primary, #2563EB);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.cl-checklist-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cl-checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid #F1F5F9;
    cursor: pointer;
    transition: background 0.15s;
}

.cl-checklist-item:last-child {
    border-bottom: none;
}

.cl-checklist-item:hover {
    background: #F8FAFC;
    border-radius: 8px;
}

.cl-checklist-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.cl-checklist-text {
    flex: 1;
    min-width: 0;
}

.cl-checklist-text strong {
    display: block;
    font-size: 0.9rem;
    color: var(--cl-text-primary, #1E293B);
}

.cl-checklist-text small {
    display: block;
    font-size: 0.8rem;
    color: var(--cl-text-muted, #94A3B8);
    margin-top: 2px;
}

.cl-checklist-skip {
    background: none;
    border: none;
    color: var(--cl-text-muted, #94A3B8);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    opacity: 0;
    transition: opacity 0.15s;
}

.cl-checklist-item:hover .cl-checklist-skip {
    opacity: 1;
}

/* ── QUICK BILLING MODAL ─────────────────────────────────────── */
.cl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.cl-modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN DESIGN SYSTEM (Allineato al design cliente)
   Fase 0.2 - Step migrazione admin UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── ADMIN TOPNAV ─────────────────────────────────────────────────────────── */
.cl-topnav-admin {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
}

.cl-topnav-admin .cl-topnav-brand {
    color: #F8FAFC;
}

.cl-topnav-admin .cl-topnav-brand span {
    color: #60A5FA;
}

.cl-topnav-admin .cl-topnav-link {
    color: #CBD5E1;
}

.cl-topnav-admin .cl-topnav-link:hover,
.cl-topnav-admin .cl-topnav-link.active {
    color: #F8FAFC;
}

/* ── ADMIN BADGE ──────────────────────────────────────────────────────────── */
.cl-badge-admin {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    color: #FFF;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* ── DROPDOWN MENU NAVIGAZIONE ────────────────────────────────────────────── */
.cl-nav-dropdown {
    position: relative;
    list-style: none;
}

.cl-nav-dropdown > .cl-topnav-link {
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cl-nav-dropdown > .cl-topnav-link::after {
    content: '';
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    display: inline-block;
    padding: 2px;
    transform: rotate(45deg);
    transition: transform 0.2s;
    margin-left: 4px;
}

.cl-nav-dropdown.open > .cl-topnav-link::after {
    transform: rotate(-135deg);
}

.cl-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #FFF;
    border: 1px solid var(--cl-border, #E2E8F0);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    min-width: 200px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 1000;
    list-style: none;
    margin: 0;
}

.cl-nav-dropdown.open .cl-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cl-dropdown-menu li {
    margin: 0;
}

.cl-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--cl-text, #334155);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.cl-dropdown-menu a:hover {
    background: var(--cl-bg-subtle, #F8FAFC);
}

.cl-dropdown-menu a.active {
    color: var(--cl-primary, #2563EB);
    background: rgba(37, 99, 235, 0.05);
    font-weight: 500;
}

/* ── ADMIN PAGE HEADER ────────────────────────────────────────────────────── */
.cl-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.cl-page-header-text h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--cl-text, #1E293B);
    margin: 0 0 4px 0;
}

.cl-page-header-text p {
    font-size: 0.9rem;
    color: var(--cl-text-secondary, #64748B);
    margin: 0;
}

.cl-page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── ADMIN FILTERS BAR ────────────────────────────────────────────────────── */
.cl-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
    background: var(--cl-bg, #FFF);
    padding: 16px;
    border-radius: var(--cl-radius, 8px);
    border: 1px solid var(--cl-border, #E2E8F0);
}

.cl-filters .cl-input {
    min-width: 150px;
}

.cl-filters .cl-input-search {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

/* ── ADMIN TABLE ──────────────────────────────────────────────────────────── */
.cl-table-container {
    background: var(--cl-bg, #FFF);
    border: 1px solid var(--cl-border, #E2E8F0);
    border-radius: var(--cl-radius, 8px);
    overflow: hidden;
}

.cl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.cl-table th,
.cl-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--cl-border-light, #F1F5F9);
}

.cl-table th {
    background: var(--cl-bg-subtle, #F8FAFC);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--cl-text-secondary, #64748B);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cl-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.02);
}

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

/* ── ADMIN TABLE CELLS ────────────────────────────────────────────────────── */
.cl-table-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cl-table-avatar {
    width: 36px;
    height: 36px;
    background: var(--cl-primary, #2563EB);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #FFF;
    flex-shrink: 0;
}

.cl-table-user-info .name {
    font-weight: 500;
    color: var(--cl-text, #1E293B);
}

.cl-table-user-info .email {
    font-size: 0.8rem;
    color: var(--cl-text-secondary, #64748B);
}

.cl-table-actions {
    display: flex;
    gap: 4px;
}

.cl-table-actions .cl-btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
}

.cl-table-actions .cl-btn-icon:hover {
    background: var(--cl-bg-subtle, #F1F5F9);
}

.cl-table-actions .cl-btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ── ADMIN PAGINATION ─────────────────────────────────────────────────────── */
.cl-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-top: 1px solid var(--cl-border-light, #F1F5F9);
    font-size: 0.85rem;
    color: var(--cl-text-secondary, #64748B);
}

.cl-pagination-info {
    flex: 1;
}

.cl-pagination-buttons {
    display: flex;
    gap: 8px;
}

/* ── ADMIN MODAL ──────────────────────────────────────────────────────────── */
.cl-modal-admin {
    max-width: 600px;
}

.cl-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cl-border, #E2E8F0);
    margin-bottom: 20px;
}

.cl-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cl-text, #1E293B);
    margin: 0;
}

.cl-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--cl-text-secondary, #64748B);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.cl-modal-close:hover {
    color: var(--cl-text, #1E293B);
}

.cl-modal-body {
    margin-bottom: 20px;
}

.cl-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--cl-border, #E2E8F0);
}

/* ── FORM ROW (2 colonne) ─────────────────────────────────────────────────── */
.cl-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .cl-form-row {
        grid-template-columns: 1fr;
    }
}

/* ── RESPONSIVE ADMIN TOPNAV ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cl-topnav-admin .cl-topnav-links {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: #1E293B;
        flex-direction: column;
        padding: 16px;
        display: none;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .cl-topnav-admin .cl-topnav-links.open {
        display: flex;
    }

    .cl-nav-dropdown {
        width: 100%;
    }

    .cl-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: rgba(255,255,255,0.05);
        border-radius: 8px;
        margin-top: 8px;
        display: none;
    }

    .cl-nav-dropdown.open .cl-dropdown-menu {
        display: block;
    }

    .cl-dropdown-menu a {
        color: #CBD5E1;
        padding: 10px 20px;
    }

    .cl-dropdown-menu a:hover {
        background: rgba(255,255,255,0.1);
    }

    .cl-dropdown-menu a.active {
        color: #60A5FA;
        background: rgba(96, 165, 250, 0.1);
    }
}

/* ── ADMIN TABLE RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cl-table-container {
        overflow-x: auto;
    }

    .cl-table th,
    .cl-table td {
        padding: 10px 12px;
        white-space: nowrap;
    }

    .cl-pagination {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* ── UTILITY: TABLE RESPONSIVE ────────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── NOTIFICATION CENTER ──────────────────────────────────────────────────── */
.cl-notification-bell {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F5F6F8;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    min-height: unset;
    padding: 0;
    transition: background 0.15s;
}
.cl-notification-bell:hover {
    background: #E5E7EB;
}
.cl-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #EF4444;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.cl-notification-badge.hidden {
    display: none;
}
.cl-notification-wrap {
    position: relative;
}
.cl-notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: -100px;
    width: 340px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 1001;
    max-height: 440px;
    overflow-y: auto;
    display: none;
}
.cl-notification-dropdown.open {
    display: block;
}
.cl-notification-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid #F3F4F6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #fff;
}
.cl-notif-mark-all {
    font-size: 0.75rem;
    color: #0075EB;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.cl-notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background 0.1s;
}
.cl-notification-item:last-child {
    border-bottom: none;
}
.cl-notification-item.unread {
    background: #EFF6FF;
}
.cl-notification-item:hover {
    background: #F9FAFB;
}
.cl-notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0075EB;
    flex-shrink: 0;
    margin-top: 5px;
}
.cl-notification-dot-empty {
    width: 8px;
    flex-shrink: 0;
}
.cl-notification-title {
    font-size: 0.875rem;
    line-height: 1.4;
}
.cl-notification-msg {
    font-size: 0.8rem;
    color: #6B7280;
    margin-top: 2px;
    line-height: 1.4;
}
.cl-notification-time {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 4px;
}
.cl-notification-empty {
    padding: 32px 16px;
    text-align: center;
    color: #9CA3AF;
    font-size: 0.875rem;
}
@media (max-width: 480px) {
    .cl-notification-dropdown {
        right: 0;
        width: min(340px, calc(100vw - 32px));
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE SIDEBAR HAMBURGER (pages with .sidebar, no topnav)
   ═══════════════════════════════════════════════════════════════════════════ */
.cl-sidebar-hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 300;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--cl-border, #E5E7EB);
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #191C20;
    transition: background 0.15s;
}
.cl-sidebar-hamburger:hover { background: #F5F6F8; }

@media (max-width: 768px) {
    .cl-sidebar-hamburger { display: flex; }
}

/* Overlay scuro dietro la sidebar aperta */
.cl-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.40);
    z-index: 199;
    animation: cl-fade-in 0.2s ease;
}
.cl-sidebar-overlay.active { display: block; }
@keyframes cl-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE AUDIT FIXES — Android Chrome responsive corrections
   ═══════════════════════════════════════════════════════════════════════════ */

/* Global: ensure images never overflow */
img, svg, video {
    max-width: 100%;
    height: auto;
}

/* Global: all table containers scrollable */
.table-container,
.table-responsive,
.admin-table-wrap,
.cl-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ─── 768px: Tablet and below ──────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Sidebar: shadow only when open on mobile */
    .sidebar.open {
        box-shadow: 2px 0 16px rgba(0, 0, 0, 0.18);
    }

    /* Topnav: ensure avatar touch target */
    .cl-topnav-avatar {
        min-width: 36px;
        flex-shrink: 0;
    }

    /* Notification bell: ensure touch target */
    .cl-notification-bell {
        flex-shrink: 0;
    }

    /* Card overflow: cards on sidebar pages should scroll if content overflows */
    .card {
        overflow-x: auto;
    }

    /* Prevent any fixed-width containers from breaking layout */
    .container,
    .container-sm,
    .container-md,
    .container-lg {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ─── 480px: Small phones (360px–480px) ────────────────────────────────── */
@media (max-width: 480px) {

    /* Topnav: ensure no horizontal overflow */
    .cl-topnav {
        overflow: hidden;
    }

    /* Modals: full width on small phones */
    .modal-content,
    .cl-modal,
    .admin-modal {
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        margin: auto 0 0 0;
        align-self: flex-end;
    }

    /* Buttons on small phones: allow wrap in flex containers */
    .cl-page-header-actions {
        flex-wrap: wrap;
    }

    /* Pagination: stack vertically */
    .admin-pagination {
        flex-direction: column;
        gap: 8px;
    }
}

/* ─── 360px: Very small phones ─────────────────────────────────────────── */
@media (max-width: 360px) {

    /* Topnav: absolute minimum spacing */
    .cl-topnav {
        padding: 0 8px;
        gap: 4px;
    }

    .cl-topnav-brand {
        font-size: 1rem;
    }

    /* Credit: hide entirely on very small screens */
    .cl-topnav-credit {
        display: none;
    }

    /* Content */
    .cl-content {
        padding: 12px 8px 60px;
    }

    .main-content {
        padding: 60px 10px 16px;
    }
}

/* ─── Auth form: top-align on mobile to avoid large empty space ─────────── */
@media (max-width: 768px) {
    .cl-auth {
        align-items: flex-start;
        padding-top: 48px;
        padding-bottom: 48px;
    }
    .cl-auth-card {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .cl-auth {
        padding: 32px 20px 40px;
    }
}
