/* ============================================================================
   NICIM ERP — Design System 2026
   Tipografia: Inter; Iconografia: Bootstrap Icons.
   Layout: mobile-first, sidebar collapsibile, container centrato max 1400px.
   Stile: moderno con accenti blu, ombre soft, glass-morphism, transizioni fluide.
   ============================================================================ */

/* --- Variabili tema --- */
:root {
    /* Palette principale */
    --nicim-primary:        #2563eb;
    --nicim-primary-dark:   #1d4ed8;
    --nicim-primary-light:  #3b82f6;
    --nicim-primary-50:     #eff6ff;
    --nicim-primary-100:    #dbeafe;
    --nicim-primary-200:    #bfdbfe;
    --nicim-secondary:      #0f172a;

    /* Palette neutrale */
    --nicim-bg:             #f8fafc;
    --nicim-bg-soft:        #f1f5f9;
    --nicim-surface:        #ffffff;
    --nicim-border:         #e2e8f0;
    --nicim-border-light:   #f1f5f9;
    --nicim-text:           #0f172a;
    --nicim-text-muted:     #64748b;
    --nicim-text-light:     #94a3b8;

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

    /* Layout */
    --topbar-h: 64px;
    --sidebar-w: 260px;
    --container-max: 1400px;

    /* Effetti */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, .04);
    --shadow:    0 1px 3px 0 rgba(15, 23, 42, .08), 0 1px 2px -1px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, .08), 0 4px 6px -4px rgba(15, 23, 42, .05);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, .10), 0 8px 10px -6px rgba(15, 23, 42, .04);

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

/* --- Reset & base --- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body.nicim-body {
    margin: 0;
    padding-top: var(--topbar-h);
    background: var(--nicim-bg);
    color: var(--nicim-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--nicim-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--nicim-primary-dark); }

h1, h2, h3, h4, h5, h6 { color: var(--nicim-text); font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: 1.875rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; } h5 { font-size: 1rem; } h6 { font-size: .875rem; }

::selection { background: var(--nicim-primary-100); color: var(--nicim-primary-dark); }

/* ============================================================================
   TOP BAR
   ============================================================================ */
.nicim-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--nicim-border);
    z-index: 1030;
    display: flex; align-items: center;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
}

.nicim-burger {
    background: transparent; border: 0;
    color: var(--nicim-text);
    font-size: 1.25rem; padding: .5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-right: .75rem;
}
.nicim-burger:hover { background: var(--nicim-bg-soft); }

.nicim-brand {
    display: flex; align-items: center; gap: .65rem;
    text-decoration: none !important;
    color: var(--nicim-text) !important;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -.02em;
}

.nicim-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--nicim-primary), var(--nicim-primary-light));
    color: white;
    font-weight: 700; font-size: 1.05rem;
    box-shadow: 0 4px 10px -2px rgba(37, 99, 235, .35);
}

.nicim-brand-text { color: var(--nicim-text); }

.nicim-user {
    display: flex; align-items: center; gap: .65rem;
    padding: .35rem .65rem .35rem .35rem;
    border-radius: var(--radius);
    background: transparent;
    transition: var(--transition);
}
.nicim-user:hover { background: var(--nicim-bg-soft); }

.nicim-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nicim-primary), var(--nicim-primary-light));
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .9rem;
}

.nicim-user-name { font-weight: 600; font-size: .9rem; line-height: 1.1; color: var(--nicim-text); }
.nicim-user-role { font-size: .72rem; color: var(--nicim-text-muted); line-height: 1.1; }

.nicim-btn-logout {
    background: var(--nicim-bg-soft); border: 1px solid var(--nicim-border);
    color: var(--nicim-text); padding: .45rem .85rem;
    border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500;
    transition: var(--transition); display: inline-flex; align-items: center; gap: .35rem;
}
.nicim-btn-logout:hover {
    background: var(--nicim-danger-light); color: #b91c1c;
    border-color: var(--nicim-danger-light);
}

/* ============================================================================
   SHELL: sidebar + main
   ============================================================================ */
.nicim-shell {
    display: flex;
    min-height: calc(100vh - var(--topbar-h));
    width: 100%;
}

.nicim-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--nicim-surface);
    border-right: 1px solid var(--nicim-border);
    padding: 1rem .75rem;
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    position: sticky;
    top: var(--topbar-h);
    scrollbar-width: thin;
    scrollbar-color: var(--nicim-border) transparent;
}
.nicim-sidebar::-webkit-scrollbar { width: 6px; }
.nicim-sidebar::-webkit-scrollbar-track { background: transparent; }
.nicim-sidebar::-webkit-scrollbar-thumb { background: var(--nicim-border); border-radius: 3px; }

.nicim-nav { list-style: none; padding: 0; margin: 0; }
.nicim-nav .nav-item { margin-bottom: 2px; }

.nicim-nav .nav-link {
    display: flex; align-items: center; gap: .65rem;
    color: var(--nicim-text);
    padding: .55rem .85rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.nicim-nav .nav-link:hover {
    background: var(--nicim-primary-50);
    color: var(--nicim-primary-dark);
}

.nicim-nav .nav-link.active {
    background: linear-gradient(90deg, var(--nicim-primary), var(--nicim-primary-light));
    color: white;
    box-shadow: 0 4px 8px -2px rgba(37, 99, 235, .3);
}

.nicim-nav-section {
    padding: 1rem .85rem .35rem .85rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--nicim-text-light);
    font-weight: 700;
    pointer-events: none;
}

.nicim-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 7px;
    color: white;
    font-size: .85rem;
    flex-shrink: 0;
    background: var(--nicim-primary);
}

/* ============================================================================
   MAIN CONTENT — centrato
   ============================================================================ */
.nicim-main {
    flex: 1;
    min-width: 0;
    padding: 1.75rem;
    background: var(--nicim-bg);
}

.nicim-container {
    max-width: var(--container-max);
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 767.98px) {
    .nicim-main { padding: 1rem .85rem; }
}

/* ============================================================================
   PAGE HEADER
   ============================================================================ */
.nicim-page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--nicim-border);
}

.nicim-page-title {
    font-size: 1.625rem;
    font-weight: 700;
    margin: 0;
    color: var(--nicim-text);
    letter-spacing: -.02em;
    display: flex; align-items: center; gap: .65rem;
}

.nicim-page-subtitle {
    color: var(--nicim-text-muted);
    font-size: .9rem;
    margin: .25rem 0 0 0;
}

.nicim-page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ============================================================================
   CARD
   ============================================================================ */
.nicim-card {
    background: var(--nicim-surface);
    border: 1px solid var(--nicim-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.nicim-card-titolo {
    color: var(--nicim-text);
    font-weight: 600;
    font-size: 1rem;
    margin: 0 0 1rem 0;
    letter-spacing: -.01em;
    display: flex; align-items: center; gap: .5rem;
}

.nicim-card-sub {
    color: var(--nicim-text-muted);
    font-size: .85rem;
    margin-bottom: 1rem;
}

/* Card statistica (KPI) */
.nicim-stat-card {
    background: var(--nicim-surface);
    border: 1px solid var(--nicim-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
}
.nicim-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.nicim-stat-icon {
    width: 44px; height: 44px;
    border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    color: white; font-size: 1.1rem;
    margin-bottom: .85rem;
}
.nicim-stat-icon.bg-primary-grad { background: linear-gradient(135deg, var(--nicim-primary), var(--nicim-primary-light)); }
.nicim-stat-icon.bg-success-grad { background: linear-gradient(135deg, #059669, #10b981); }
.nicim-stat-icon.bg-warning-grad { background: linear-gradient(135deg, #d97706, #f59e0b); }
.nicim-stat-icon.bg-danger-grad  { background: linear-gradient(135deg, #dc2626, #ef4444); }
.nicim-stat-icon.bg-info-grad    { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.nicim-stat-icon.bg-purple-grad  { background: linear-gradient(135deg, #7e22ce, #a855f7); }

.nicim-stat-label {
    font-size: .8rem;
    color: var(--nicim-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
    margin: 0;
}
.nicim-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--nicim-text);
    letter-spacing: -.02em;
    margin: .15rem 0 0 0;
    line-height: 1.2;
}

/* Card scorciatoia (sul cruscotto) */
.nicim-shortcut {
    display: block;
    text-decoration: none !important;
    color: inherit !important;
    background: var(--nicim-surface);
    border: 1px solid var(--nicim-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    position: relative;
    overflow: hidden;
}
.nicim-shortcut::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--nicim-primary), var(--nicim-primary-light));
    opacity: 0;
    transition: var(--transition);
}
.nicim-shortcut:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--nicim-primary-200);
}
.nicim-shortcut:hover::before { opacity: 1; }

.nicim-shortcut-icona {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    color: white; font-size: 1.25rem;
    margin-bottom: .85rem;
    box-shadow: 0 6px 12px -4px rgba(0,0,0, .15);
}

.nicim-shortcut-titolo {
    font-weight: 600;
    font-size: .98rem;
    color: var(--nicim-text);
    margin: 0 0 .25rem 0;
}
.nicim-shortcut-sottotitolo {
    color: var(--nicim-text-muted);
    font-size: .82rem;
    margin: 0;
    line-height: 1.4;
}
.nicim-shortcut-badge {
    display: inline-block;
    margin-top: .5rem;
    font-size: .68rem;
    padding: .15rem .5rem;
    border-radius: 4px;
    background: var(--nicim-primary-50);
    color: var(--nicim-primary-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Sezione titolo */
.nicim-sezione-titolo {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--nicim-text);
    margin: 1.5rem 0 1rem 0;
    display: flex; align-items: center; gap: .5rem;
    letter-spacing: -.01em;
}
.nicim-sezione-titolo::after {
    content: '';
    flex: 1; height: 1px;
    background: linear-gradient(90deg, var(--nicim-border), transparent);
}

/* ============================================================================
   FORM CONTROLS — moderni con focus migliorato
   ============================================================================ */
.form-label {
    font-weight: 500;
    color: var(--nicim-text);
    font-size: .85rem;
    margin-bottom: .35rem;
}

.form-control, .form-select {
    border: 1px solid var(--nicim-border);
    border-radius: var(--radius-sm);
    padding: .55rem .85rem;
    font-size: .9rem;
    color: var(--nicim-text);
    background: var(--nicim-surface);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.form-control:hover:not(:disabled):not([readonly]),
.form-select:hover:not(:disabled) { border-color: var(--nicim-text-light); }

.form-control:focus, .form-select:focus {
    border-color: var(--nicim-primary);
    box-shadow: 0 0 0 3px var(--nicim-primary-100);
    outline: none;
}

.form-control::placeholder { color: var(--nicim-text-light); }

.form-control[readonly], .form-control:disabled, .form-select:disabled {
    background: var(--nicim-bg-soft);
    color: var(--nicim-text-muted);
}

.form-control-color {
    height: calc(1.5em + 1.1rem + 2px);
    padding: .25rem;
}

.form-check-input {
    border: 1.5px solid var(--nicim-border);
    cursor: pointer;
    transition: var(--transition);
}
.form-check-input:checked {
    background-color: var(--nicim-primary);
    border-color: var(--nicim-primary);
}
.form-check-input:focus {
    border-color: var(--nicim-primary);
    box-shadow: 0 0 0 3px var(--nicim-primary-100);
}

/* Input con icona prefix */
.nicim-input-icon {
    position: relative;
}
.nicim-input-icon > .bi {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--nicim-text-light); pointer-events: none;
}
.nicim-input-icon > .form-control { padding-left: 2.25rem; }

/* ============================================================================
   BUTTONS — moderni
   ============================================================================ */
.btn {
    font-weight: 500;
    font-size: .9rem;
    padding: .55rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    text-decoration: none !important;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: .35rem .7rem;
    font-size: .82rem;
    border-radius: var(--radius-sm);
}
.btn-lg {
    padding: .75rem 1.25rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-primary {
    background: linear-gradient(135deg, var(--nicim-primary), var(--nicim-primary-light));
    color: white;
    border: 0;
    box-shadow: 0 2px 4px -1px rgba(37, 99, 235, .25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--nicim-primary-dark), var(--nicim-primary));
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -3px rgba(37, 99, 235, .35);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline-primary {
    background: var(--nicim-surface);
    color: var(--nicim-primary);
    border-color: var(--nicim-border);
}
.btn-outline-primary:hover {
    background: var(--nicim-primary-50);
    color: var(--nicim-primary-dark);
    border-color: var(--nicim-primary-200);
}

.btn-secondary, .btn-outline-secondary {
    background: var(--nicim-surface);
    color: var(--nicim-text);
    border-color: var(--nicim-border);
}
.btn-secondary:hover, .btn-outline-secondary:hover {
    background: var(--nicim-bg-soft);
    color: var(--nicim-text);
    border-color: var(--nicim-border);
}

.btn-success {
    background: var(--nicim-success);
    color: white; border: 0;
}
.btn-success:hover { background: #059669; color: white; transform: translateY(-1px); }

.btn-danger {
    background: var(--nicim-danger); color: white; border: 0;
}
.btn-outline-danger {
    background: var(--nicim-surface); color: var(--nicim-danger); border-color: var(--nicim-border);
}
.btn-outline-danger:hover, .btn-danger:hover {
    background: var(--nicim-danger);
    color: white;
    border-color: var(--nicim-danger);
}

.btn-warning {
    background: var(--nicim-warning);
    color: white; border: 0;
}
.btn-warning:hover { background: #d97706; color: white; }

.btn-link {
    background: transparent; box-shadow: none; color: var(--nicim-primary);
    border: 0; padding: .4rem .65rem;
}
.btn-link:hover { background: var(--nicim-primary-50); color: var(--nicim-primary-dark); }

.btn-info {
    background: var(--nicim-info); color: white; border: 0;
}

/* ============================================================================
   TABELLE moderne
   ============================================================================ */
.table {
    color: var(--nicim-text);
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 0;
}
.table thead th {
    background: var(--nicim-bg-soft);
    color: var(--nicim-text-muted);
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--nicim-border);
    border-top: 0;
    text-align: left;
}

.table tbody td {
    padding: .75rem .85rem;
    border-bottom: 1px solid var(--nicim-border-light);
    font-size: .88rem;
    vertical-align: middle;
}

.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:hover { background: var(--nicim-primary-50); }
.table tbody tr:last-child td { border-bottom: 0; }

.table-sm thead th { padding: .5rem .65rem; }
.table-sm tbody td { padding: .55rem .65rem; }

.table-responsive { border-radius: var(--radius); }

/* ============================================================================
   BADGES
   ============================================================================ */
.badge {
    font-weight: 600;
    font-size: .72rem;
    padding: .3rem .55rem;
    border-radius: 6px;
    letter-spacing: .02em;
}
.badge.bg-primary { background: var(--nicim-primary-100) !important; color: var(--nicim-primary-dark) !important; }
.badge.bg-success { background: var(--nicim-success-light) !important; color: #047857 !important; }
.badge.bg-warning { background: var(--nicim-warning-light) !important; color: #b45309 !important; }
.badge.bg-danger  { background: var(--nicim-danger-light) !important; color: #b91c1c !important; }
.badge.bg-info    { background: var(--nicim-info-light) !important; color: #0e7490 !important; }
.badge.bg-secondary { background: var(--nicim-bg-soft) !important; color: var(--nicim-text-muted) !important; }

/* ============================================================================
   ALERT moderni
   ============================================================================ */
.alert {
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: .85rem 1rem;
    font-size: .88rem;
    display: flex; align-items: flex-start; gap: .65rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.alert-success { background: var(--nicim-success-light); color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: var(--nicim-danger-light); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--nicim-warning-light); color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--nicim-info-light); color: #155e75; border-color: #a5f3fc; }

/* ============================================================================
   MODAL moderni
   ============================================================================ */
.modal-content {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid var(--nicim-border);
    padding: 1.1rem 1.5rem;
    background: var(--nicim-surface);
}
.modal-title {
    font-weight: 600;
    color: var(--nicim-text);
    font-size: 1.05rem;
    letter-spacing: -.01em;
}
.modal-body { padding: 1.5rem; }
.modal-footer {
    border-top: 1px solid var(--nicim-border);
    padding: 1rem 1.5rem;
    background: var(--nicim-bg);
    gap: .5rem;
}
.modal-backdrop.show { opacity: .35; }

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.nicim-toast-container {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    right: 16px;
    z-index: 1100;
    display: flex; flex-direction: column; gap: .5rem;
    max-width: 380px;
}

.nicim-toast {
    background: var(--nicim-surface);
    border: 1px solid var(--nicim-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: .85rem 1rem;
    display: flex; align-items: flex-start; gap: .75rem;
    animation: slideInRight .25s ease-out;
    min-width: 280px;
    border-left-width: 4px;
}
.nicim-toast.toast-success { border-left-color: var(--nicim-success); }
.nicim-toast.toast-danger  { border-left-color: var(--nicim-danger); }
.nicim-toast.toast-warning { border-left-color: var(--nicim-warning); }
.nicim-toast.toast-info    { border-left-color: var(--nicim-info); }

.nicim-toast-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    color: white; font-size: .9rem; flex-shrink: 0;
}
.toast-success .nicim-toast-icon { background: var(--nicim-success); }
.toast-danger .nicim-toast-icon  { background: var(--nicim-danger); }
.toast-warning .nicim-toast-icon { background: var(--nicim-warning); }
.toast-info .nicim-toast-icon    { background: var(--nicim-info); }

.nicim-toast-body { flex: 1; font-size: .88rem; color: var(--nicim-text); }
.nicim-toast-close {
    background: transparent; border: 0; color: var(--nicim-text-light);
    cursor: pointer; padding: .15rem .35rem; border-radius: 4px;
    line-height: 1;
}
.nicim-toast-close:hover { background: var(--nicim-bg-soft); color: var(--nicim-text); }

@keyframes slideInRight {
    from { transform: translateX(40px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* ============================================================================
   NAV TABS moderni
   ============================================================================ */
.nav-tabs {
    border-bottom: 1px solid var(--nicim-border);
    gap: .25rem;
    margin-bottom: 1rem;
}
.nav-tabs .nav-link {
    color: var(--nicim-text-muted);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: .65rem 1rem;
    font-weight: 500;
    font-size: .9rem;
    background: transparent !important;
    transition: var(--transition);
    margin-bottom: -1px;
}
.nav-tabs .nav-link:hover {
    color: var(--nicim-primary);
    border-bottom-color: var(--nicim-primary-200);
}
.nav-tabs .nav-link.active {
    color: var(--nicim-primary);
    border-bottom-color: var(--nicim-primary);
    background: transparent;
    font-weight: 600;
}

/* ============================================================================
   PAGINE WIZARD (login, setup, ecc.) — centrate verticalmente
   ============================================================================ */
.nicim-wizard {
    min-height: calc(100vh - var(--topbar-h));
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(circle at 20% 0%, var(--nicim-primary-50) 0%, transparent 50%),
        radial-gradient(circle at 80% 100%, #e9d5ff 0%, transparent 50%),
        var(--nicim-bg);
}

.nicim-wizard-card {
    width: 100%; max-width: 480px;
    background: var(--nicim-surface);
    border: 1px solid var(--nicim-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2.25rem;
    box-shadow: var(--shadow-xl);
}

.nicim-wizard-titolo {
    color: var(--nicim-text);
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 0 .5rem 0;
    letter-spacing: -.02em;
    text-align: center;
}
.nicim-wizard-sottotitolo {
    color: var(--nicim-text-muted);
    font-size: .92rem;
    margin: 0 0 1.75rem 0;
    text-align: center;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 991.98px) {
    .nicim-sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform .25s ease-out;
        z-index: 1020;
        box-shadow: var(--shadow-xl);
    }
    .nicim-sidebar.show { transform: translateX(0); }
    .nicim-sidebar-backdrop {
        position: fixed;
        top: var(--topbar-h);
        left: 0; right: 0; bottom: 0;
        background: rgba(15, 23, 42, .4);
        z-index: 1015;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    .nicim-sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
}

@media (max-width: 767.98px) {
    .nicim-page-header { flex-direction: column; align-items: stretch; }
    .nicim-page-actions { width: 100%; }
    .nicim-page-actions .btn { flex: 1; min-width: 0; }
    .nicim-card { padding: 1rem; border-radius: var(--radius); }
    .nicim-toast-container { left: 12px; right: 12px; max-width: none; }
    .nicim-topbar { padding: 0 .85rem; }
    .nicim-user-name, .nicim-user-role { display: none; }
    .nicim-wizard-card { padding: 1.75rem 1.25rem; border-radius: var(--radius-lg); }
}

/* Scroll smooth */
html { scroll-behavior: smooth; }

/* Utility helpers */
.text-primary { color: var(--nicim-primary) !important; }
.text-muted   { color: var(--nicim-text-muted) !important; }
.bg-soft      { background: var(--nicim-bg-soft) !important; }

.gap-2 { gap: .5rem !important; }
.gap-3 { gap: 1rem !important; }
