/* ============================================================
   AREA THEME v6 - Teal-Lime (#029f82 + #c1d100)
   Palette derivata dai colori primari #029f82 (teal) + #c1d100 (lime)
   Sidebar profonda · Glass topbar · Card elegante · Font ampio
   ============================================================ */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
    /* Teal palette (primario #029f82) */
    --tl-50:  #f0fdfa;
    --tl-100: #ccfbf1;
    --tl-200: #99f6e4;
    --tl-300: #5eead4;
    --tl-400: #2dd4bf;
    --tl-500: #029f82;
    --tl-600: #0d9488;
    --tl-700: #0f766e;
    --tl-800: #115e59;
    --tl-900: #134e4a;

    /* Lime palette (secondario #c1d100) */
    --lm-50:  #f7fee7;
    --lm-100: #ecfccb;
    --lm-200: #d9f99d;
    --lm-300: #bef264;
    --lm-400: #a3e635;
    --lm-500: #c1d100;
    --lm-600: #a3bc00;
    --lm-700: #84a600;
    --lm-800: #658700;
    --lm-900: #4f6b00;

    /* Sidebar profondo nero→teal */
    --sid-top:    #000000;
    --sid-mid:    #0d3330;
    --sid-bottom: #029f82;

    /* Slate neutro (invariato per leggibilità testo) */
    --sl-50:  #f8fafc;
    --sl-100: #f1f5f9;
    --sl-200: #e2e8f0;
    --sl-300: #cbd5e1;
    --sl-400: #94a3b8;
    --sl-500: #64748b;
    --sl-600: #475569;
    --sl-700: #334155;
    --sl-800: #1e293b;
    --sl-900: #0f172a;

    /* Semantici */
    --clr-success:    #029f82;
    --clr-success-bg: #f0fdfa;
    --clr-warning:    #d97706;
    --clr-warning-bg: #fffbeb;
    --clr-error:      #dc2626;
    --clr-error-bg:   #fef2f2;
    --clr-info:       #0284c7;
    --clr-info-bg:    #f0f9ff;

    /* Layout */
    --sidebar-width: 268px;
    --sidebar-collapsed-width: 66px;

    /* Gradienti */
    --grad-primary:       linear-gradient(135deg, #029f82 0%, #c1d100 100%);
    --grad-primary-hover: linear-gradient(135deg, #0d9488 0%, #a3bc00 100%);
    --grad-success:       linear-gradient(135deg, #2dd4bf 0%, #029f82 100%);
    --grad-warning:       linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
    --grad-danger:        linear-gradient(135deg, #f87171 0%, #b91c1c 100%);
    --grad-info:          linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
    --grad-body:          linear-gradient(160deg, #f0fdfa 0%, #ccfbf1 40%, #f7fee7 100%);
    --grad-topbar:        linear-gradient(90deg, rgba(255,255,255,.98) 0%, rgba(240,253,250,.98) 100%);

    /* Ombre con tinta teal-lime */
    --shadow-xs:          0 1px 3px rgba(2,159,130,.07);
    --shadow-sm:          0 2px 8px rgba(2,159,130,.11), 0 1px 3px rgba(0,0,0,.05);
    --shadow-md:          0 4px 18px rgba(2,159,130,.14), 0 2px 6px rgba(0,0,0,.06);
    --shadow-lg:          0 8px 36px rgba(2,159,130,.18), 0 3px 12px rgba(0,0,0,.07);
    --shadow-btn-primary: 0 4px 16px rgba(2,159,130,.45);
    --shadow-btn-success: 0 4px 14px rgba(2,159,130,.42);
    --shadow-btn-danger:  0 4px 14px rgba(185,28,28,.38);

    /* Override Bootstrap */
    --bs-primary:        #115e59;
    --bs-primary-rgb:    17,94,89;
    --bs-success:        #029f82;
    --bs-success-rgb:    2,159,130;
    --bs-info:           #0284c7;
    --bs-info-rgb:       2,132,199;
    --bs-warning:        #d97706;
    --bs-warning-rgb:    217,119,6;
    --bs-danger:         #dc2626;
    --bs-danger-rgb:     220,38,38;
    --bs-body-bg:        #f0fdfa;
    --bs-body-color:     #134e4a;
    --bs-border-color:   #99f6e4;
    --bs-border-radius:     .8rem;
    --bs-border-radius-sm:  .55rem;
    --bs-border-radius-lg:  1.1rem;
    --bs-link-color:        #0f766e;
    --bs-link-hover-color:  #134e4a;
}

/* ============================================================
   2. BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1.06rem;
    background: var(--grad-body);
    background-attachment: fixed;
    color: #134e4a;
    margin: 0;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   3. SIDEBAR
   ============================================================ */
.area-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(165deg,
        #000000  0%,
        #071a18  28%,
        #0d3330  55%,
        #029f82 100%);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
    box-shadow: 3px 0 0 0 rgba(2,159,130,.25), 5px 0 28px rgba(0,0,0,.5);
}
.area-sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 48% at 12% 10%, rgba(45,212,191,.14) 0%, transparent 62%),
        radial-gradient(ellipse 55% 42% at 85% 92%, rgba(2,159,130,.22) 0%, transparent 58%);
    pointer-events: none;
    z-index: 0;
}
.area-sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 1px; height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(45,212,191,.2) 40%,
        rgba(2,159,130,.35) 70%,
        transparent 100%);
    pointer-events: none;
}
.area-sidebar::-webkit-scrollbar { width: 4px; }
.area-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* -- Pulsante comprimi sidebar -- */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: .45rem;
    color: rgba(255,255,255,.42);
    cursor: pointer;
    transition: all .2s;
    font-size: .74rem;
    margin-left: auto;
    padding: 0;
}
.sidebar-collapse-btn:hover {
    background: rgba(2,159,130,.22);
    border-color: rgba(45,212,191,.4);
    color: rgba(255,255,255,.88);
}
.sidebar-collapse-btn i {
    transition: transform .28s cubic-bezier(.4,0,.2,1);
}

/* -- Stato collassato (solo desktop) -- */
.area-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}
.area-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.25rem .5rem 1.1rem;
}
.area-sidebar.collapsed .sidebar-brand span,
.area-sidebar.collapsed .sidebar-link span,
.area-sidebar.collapsed .sidebar-link .nav-badge,
.area-sidebar.collapsed .sidebar-user span,
.area-sidebar.collapsed .btn-sidebar-logout span {
    display: none;
}
.area-sidebar.collapsed .sidebar-nav-label { display: none; }
.area-sidebar.collapsed li.sidebar-separator { display: none; }
.area-sidebar.collapsed .sidebar-collapse-btn {
    margin-left: 0;
    transform: none;
}
.area-sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}
.area-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: .64rem 0;
}
.area-sidebar.collapsed .sidebar-link i {
    width: auto;
    font-size: 1rem;
    opacity: .85;
}
.area-sidebar.collapsed .sidebar-link:hover i,
.area-sidebar.collapsed .sidebar-link.active i { opacity: 1; }
.area-sidebar.collapsed .sidebar-link.active::before { display: none; }
.area-sidebar.collapsed .sidebar-user { justify-content: center; }
.area-sidebar.collapsed .btn-sidebar-logout {
    padding: .44rem 0;
    justify-content: center;
}

/* -- Brand header -- */
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.1rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
    background: rgba(0,0,0,.18);
    position: relative;
}
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 1.1rem; right: 1.1rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(45,212,191,.38), transparent);
}

.sidebar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.12rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .7rem;
    letter-spacing: -.02em;
}
.sidebar-brand:hover { color: #fff; text-decoration: none; }

.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, rgba(45,212,191,.28), rgba(2,159,130,.14));
    border: 1px solid rgba(45,212,191,.38);
    border-radius: .75rem;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    color: #5eead4;
    flex-shrink: 0;
    transition: all .2s;
    box-shadow: 0 0 14px rgba(2,159,130,.25);
}
.sidebar-brand:hover .brand-icon {
    background: linear-gradient(135deg, rgba(45,212,191,.45), rgba(2,159,130,.28));
    box-shadow: 0 0 22px rgba(2,159,130,.5);
    border-color: rgba(45,212,191,.65);
}

/* -- Nav -- */
.sidebar-nav { flex: 1; padding: 1rem .65rem; }

.sidebar-nav-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.42);
    padding: .9rem .75rem .3rem;
    margin: 0;
}

.sidebar-nav ul {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .95rem;
    border-radius: .65rem;
    color: rgba(255,255,255,.78);
    font-size: .94rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    white-space: nowrap;
    position: relative;
    border: 1px solid transparent;
}
.sidebar-link i {
    font-size: .92rem; width: 1.15rem; text-align: center;
    opacity: .72; flex-shrink: 0; transition: all .2s;
}
.sidebar-link:hover {
    color: #fff;
    background: rgba(2,159,130,.18);
    border-color: rgba(45,212,191,.22);
    text-decoration: none;
    transform: translateX(3px);
}
.sidebar-link:hover i { opacity: 1; color: #5eead4; }
.sidebar-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(2,159,130,.3) 0%, rgba(2,159,130,.08) 100%);
    border-color: rgba(45,212,191,.28);
    font-weight: 600;
    box-shadow: inset 3px 0 0 #2dd4bf, 0 0 18px rgba(2,159,130,.15);
}
.sidebar-link.active i { opacity: 1; color: #5eead4; }
.sidebar-link.active::before {
    content: '';
    position: absolute;
    right: .85rem; top: 50%;
    transform: translateY(-50%);
    width: 6px; height: 6px;
    background: #2dd4bf;
    border-radius: 50%;
    box-shadow: 0 0 7px rgba(45,212,191,.8);
}

/* Badge menu */
.sidebar-link .nav-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #f59e0b, #b45309);
    color: #fff;
    font-size: .62rem; font-weight: 800;
    padding: .1rem .52rem;
    border-radius: 20px; line-height: 1.6;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(180,83,9,.5);
    letter-spacing: .02em;
}
.sidebar-link .nav-badge-danger {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    box-shadow: 0 2px 6px rgba(239,68,68,.55);
    animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* -- Footer user -- */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 1rem .9rem .95rem;
    flex-shrink: 0;
    display: flex; flex-direction: column; gap: .6rem;
    background: rgba(0,0,0,.22);
    position: relative;
}
.sidebar-footer::before {
    content: '';
    position: absolute;
    top: 0; left: .9rem; right: .9rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(45,212,191,.32), transparent);
}
.sidebar-user {
    display: flex; align-items: center; gap: .5rem;
    color: rgba(255,255,255,.72); font-size: .88rem; overflow: hidden;
}
.sidebar-user i { color: rgba(255,255,255,.50); font-size: .98rem; flex-shrink: 0; }
.sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-sidebar-logout {
    width: 100%;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.52);
    border-radius: .58rem;
    padding: .46rem .88rem;
    font-size: .88rem; font-weight: 500;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    transition: all .2s ease;
}
.btn-sidebar-logout i { font-size: .8rem; }
.btn-sidebar-logout:hover {
    background: rgba(220,38,38,.16);
    border-color: rgba(220,38,38,.32);
    color: #fca5a5;
}

/* ============================================================
   4. CONTENUTO PRINCIPALE
   ============================================================ */
.area-content {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    left: var(--sidebar-width);
    display: flex; flex-direction: column;
    overflow: hidden;
    transition: left .28s cubic-bezier(.4,0,.2,1);
}
.area-content.sidebar-collapsed {
    left: var(--sidebar-collapsed-width);
}

/* Topbar glass */
.area-topbar {
    display: flex; align-items: center; gap: .9rem;
    background: var(--grad-topbar);
    border-bottom: 1px solid rgba(163,225,209,.5);
    padding: .9rem 1.8rem;
    flex-shrink: 0;
    z-index: 100;
    backdrop-filter: blur(14px) saturate(200%);
    -webkit-backdrop-filter: blur(14px) saturate(200%);
    box-shadow: 0 1px 0 rgba(0,130,104,.08), 0 2px 14px rgba(0,0,0,.04);
}
.area-topbar::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(2,159,130,.45) 25%,
        rgba(45,212,191,.65) 50%,
        rgba(2,159,130,.45) 75%,
        transparent 100%);
    opacity: .55;
}

.sidebar-toggle-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--tl-200);
    border-radius: .55rem;
    color: var(--tl-700);
    padding: .4rem .6rem; font-size: 1.05rem;
    cursor: pointer; line-height: 1; flex-shrink: 0;
    transition: all .18s;
}
.sidebar-toggle-btn:hover {
    background: var(--tl-50);
    border-color: var(--tl-400);
    color: var(--tl-800);
}

.page-title {
    font-size: 1.35rem; font-weight: 700;
    color: var(--sl-900); margin: 0;
    display: flex; align-items: center; gap: .7rem;
    flex: 1; letter-spacing: -.03em;
}
.page-title::before {
    content: '';
    width: 4px; height: 1.15em;
    background: var(--grad-primary);
    border-radius: 4px; flex-shrink: 0;
    box-shadow: 0 0 9px rgba(0,160,126,.5);
}

.area-main {
    flex: 1;
    overflow-y: auto;
    padding: .5rem 0 2.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,104,83,.2) transparent;
}
.area-main::-webkit-scrollbar { width: 6px; }
.area-main::-webkit-scrollbar-thumb { background: rgba(0,104,83,.2); border-radius: 4px; }
.area-main::-webkit-scrollbar-thumb:hover { background: rgba(0,104,83,.35); }

.area-content > footer {
    flex-shrink: 0;
    background: var(--tl-50);
    border-top: 1px solid rgba(163,225,209,.45);
    padding: .65rem 1.5rem;
    color: var(--sl-500);
    font-size: .84rem;
}
.area-content > footer a.tp { opacity: .75; transition: opacity .18s; }
.area-content > footer a.tp:hover { opacity: 1; }

.area-content > .alert { margin: 1rem 1.75rem 0; border-radius: .8rem; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(8,7,20,.6);
    z-index: 1039;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   5. CARD
   ============================================================ */
.card {
    background: #fff;
    border: 1px solid rgba(163,225,209,.6);
    border-radius: 1.1rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: linear-gradient(90deg, var(--tl-50) 0%, #fff 100%);
    border-bottom: 1px solid rgba(163,225,209,.6);
    font-weight: 600;
    font-size: 1rem;
    padding: 1.05rem 1.5rem;
    display: flex; align-items: center; gap: .55rem;
    color: #134e4a;
}
.card-header::before {
    content: '';
    width: 3px; height: 1.1em;
    background: var(--grad-primary);
    border-radius: 4px; flex-shrink: 0;
    box-shadow: 0 0 6px rgba(2,159,130,.35);
}
.card-header h4, .card-header h5 { color: #134e4a; margin: 0; }
.card-body { padding: 1.5rem; }
.card-body.p-0 { overflow: hidden; }
.card.border-danger { border-color: rgba(220,38,38,.3); }
.card.border-danger .card-header.bg-danger {
    background: linear-gradient(90deg, #b91c1c, #991b1b) !important;
    color: #fff !important;
}
.card.border-danger .card-header.bg-danger::before { display: none; }

/* ============================================================
   6. BUTTONS
   ============================================================ */
.btn {
    font-weight: 600; border-radius: .7rem; border: none;
    transition: all .22s cubic-bezier(.4,0,.2,1);
    letter-spacing: .01em; position: relative; overflow: hidden;
    font-size: 1rem;
}
.btn::before {
    content: ''; position: absolute; inset: 0;
    background: rgba(255,255,255,0); transition: background .18s;
}
.btn:hover::before { background: rgba(255,255,255,.1); }
.btn:active { transform: scale(.97); }

.btn-primary {
    background: var(--grad-primary); color: #fff;
    box-shadow: var(--shadow-btn-primary);
}
.btn-primary:hover {
    background: var(--grad-primary-hover);
    color: #fff;
    box-shadow: 0 6px 22px rgba(0,130,104,.5);
    transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible { outline: 3px solid rgba(0,160,126,.4); outline-offset: 2px; }

.btn-success {
    background: var(--grad-success); color: #fff;
    box-shadow: var(--shadow-btn-success);
}
.btn-success:hover {
    background: linear-gradient(135deg, #2dd4bf, #029f82);
    color: #fff; box-shadow: 0 6px 22px rgba(2,159,130,.5);
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--grad-warning); color: #fff;
    box-shadow: 0 4px 14px rgba(180,83,9,.38);
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #92400e);
    color: #fff; box-shadow: 0 6px 20px rgba(180,83,9,.5);
    transform: translateY(-2px);
}

.btn-info {
    background: var(--grad-info); color: #fff;
    box-shadow: 0 4px 14px rgba(2,132,199,.4);
}
.btn-info:hover {
    background: linear-gradient(135deg, #0284c7, #075985);
    color: #fff; box-shadow: 0 6px 20px rgba(2,132,199,.5);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--grad-danger); color: #fff;
    box-shadow: var(--shadow-btn-danger);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    color: #fff; box-shadow: 0 6px 20px rgba(185,28,28,.5);
    transform: translateY(-2px);
}

.btn-outline-secondary {
    background: transparent;
    border: 1.5px solid var(--sl-300); color: var(--sl-600);
}
.btn-outline-secondary:hover {
    background: var(--tl-50);
    border-color: var(--tl-400); color: var(--tl-800);
}

.btn-sm { border-radius: .58rem; font-size: .87rem; padding: .32rem .75rem; }
.btn-sm::before { display: none; }
.btn-sm:hover { transform: translateY(-1px); }
.btn-sm:active { transform: translateY(0); }

.btn-group > .btn { border-radius: .7rem; box-shadow: none !important; transform: none !important; }
.btn-group > .btn::before { display: none; }
.btn-group > .btn:not(:last-child)  { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .btn { transform: none !important; box-shadow: none !important; }

/* ============================================================
   7. TABLE
   ============================================================ */
.table { font-size: .97rem; border-collapse: separate; border-spacing: 0; }
.table > thead { border-bottom: none; }

.table-dark > *, .table-dark {
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(255,255,255,.07);
    --bs-table-color: rgba(255,255,255,.9);
}
thead.table-dark {
    background: linear-gradient(90deg, #134e4a 0%, #0f766e 100%);
}
.table-dark th {
    font-weight: 700; font-size: .8rem;
    text-transform: uppercase; letter-spacing: .07em;
    padding: 1rem 1.15rem; border-bottom: none;
}
.table > thead:not(.table-dark) th {
    background: linear-gradient(90deg, var(--tl-50) 0%, #fff 100%);
    color: var(--tl-800); font-weight: 700; font-size: .8rem;
    text-transform: uppercase; letter-spacing: .07em;
    border-bottom: 2px solid var(--tl-100); padding: 1rem 1.15rem;
}
.table > tbody > tr > td {
    padding: .88rem 1.15rem; vertical-align: middle;
    border-bottom-color: var(--tl-50);
}
.table > tbody > tr { transition: background .12s; }
.table-hover > tbody > tr:hover > td { background: var(--tl-50); }

/* ============================================================
   8. FORM CONTROLS
   ============================================================ */
.form-control, .form-select {
    border: 1.5px solid var(--tl-200); border-radius: .7rem;
    font-size: 1rem; padding: .58rem .95rem;
    background: #fff; color: #1a2e2a;
    transition: border-color .18s, box-shadow .18s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--tl-600);
    box-shadow: 0 0 0 3px rgba(2,159,130,.18); outline: none;
}
.form-label { font-weight: 600; font-size: .93rem; color: #134e4a; margin-bottom: .4rem; }
.form-text { font-size: .86rem; color: var(--sl-400); }
.form-check-input:checked { background-color: var(--tl-700); border-color: var(--tl-700); }
.form-check-input:focus { border-color: var(--tl-500); box-shadow: 0 0 0 3px rgba(2,159,130,.2); }
.form-select-sm { border-radius: .58rem; }

/* ============================================================
   9. ALERTS
   ============================================================ */
.alert { border: none; border-radius: .85rem; font-size: .93rem; padding: .9rem 1.2rem; }
.alert-success {
    background: linear-gradient(90deg, var(--clr-success-bg) 0%, #f0fdfa 100%);
    color: #134e4a; border-left: 3px solid var(--clr-success);
    box-shadow: 0 2px 10px rgba(2,159,130,.08);
}
.alert-danger {
    background: linear-gradient(90deg, var(--clr-error-bg) 0%, #fff5f5 100%);
    color: #7f1d1d; border-left: 3px solid var(--clr-error);
    box-shadow: 0 2px 10px rgba(244,67,54,.08);
}
.alert-warning {
    background: linear-gradient(90deg, var(--clr-warning-bg) 0%, #fffbeb 100%);
    color: #78350f; border-left: 3px solid var(--clr-warning);
    box-shadow: 0 2px 10px rgba(255,152,0,.08);
}
.alert-info {
    background: linear-gradient(90deg, var(--clr-info-bg) 0%, #f0f9ff 100%);
    color: #0c4a6e; border-left: 3px solid var(--clr-info);
    box-shadow: 0 2px 10px rgba(33,150,243,.08);
}

/* ============================================================
   10. BADGES
   ============================================================ */
.badge { font-weight: 600; font-size: .75rem; border-radius: .55rem; padding: .3em .7em; }
.badge.bg-success   { background: #d1f0e8 !important; color: #029f82 !important; }
.badge.bg-warning   { background: #fef3c7 !important; color: #78350f !important; }
.badge.bg-danger    { background: #fee2e2 !important; color: #7f1d1d !important; }
.badge.bg-info      { background: #e0f2fe !important; color: #075985 !important; }
.badge.bg-primary   { background: var(--tl-100) !important; color: var(--tl-900) !important; }
.badge.bg-secondary { background: var(--sl-100) !important; color: var(--sl-600) !important; }
.badge.bg-dark      { background: var(--sl-800) !important; color: #fff !important; }

/* ============================================================
   11. PAGINATION
   ============================================================ */
.pagination { gap: 3px; }
.page-link {
    color: var(--tl-800); border: 1.5px solid var(--tl-200);
    border-radius: .65rem !important; font-size: .88rem; font-weight: 600;
    padding: .4rem .76rem; transition: all .18s;
}
.page-link:hover {
    background: var(--tl-50); border-color: var(--tl-400); color: var(--tl-800);
    transform: translateY(-1px); box-shadow: var(--shadow-xs);
}
.page-item.active .page-link {
    background: var(--grad-primary); border-color: transparent; color: #fff;
    box-shadow: var(--shadow-btn-primary); transform: translateY(-1px);
}
.page-item.disabled .page-link { opacity: .45; }

/* ============================================================
   12. SPINNER
   ============================================================ */
.spinner-border.text-primary { color: var(--tl-600) !important; }

/* ============================================================
   13. HEADINGS
   ============================================================ */
.container h2, .container-fluid h2 {
    font-size: 1.32rem; font-weight: 700;
    color: #134e4a; letter-spacing: -.028em;
}
.container h2 i, .container-fluid h2 i { color: var(--tl-600); }

/* ============================================================
   14. SWEETALERT2
   ============================================================ */
.swal2-popup { border-radius: 1.2rem !important; box-shadow: var(--shadow-lg) !important; }
.swal2-title { color: #134e4a !important; }
.swal2-confirm {
    background: var(--grad-primary) !important; border: none !important;
    border-radius: .75rem !important; box-shadow: var(--shadow-btn-primary) !important;
    font-weight: 700 !important;
}
.swal2-confirm:focus { box-shadow: 0 0 0 3px rgba(0,160,126,.35) !important; }
.swal2-cancel {
    background: var(--sl-100) !important; color: var(--sl-700) !important;
    border-radius: .75rem !important; border: 1.5px solid var(--sl-200) !important;
    font-weight: 600 !important;
}

/* ============================================================
   15. DATATABLES
   ============================================================ */
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid var(--tl-200); border-radius: .7rem;
    padding: .42rem .85rem; background: #fff; font-size: .97rem;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--tl-600); box-shadow: 0 0 0 3px rgba(2,159,130,.15); outline: none;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--grad-primary) !important; border-color: transparent !important;
    color: #fff !important; border-radius: .65rem !important;
    box-shadow: var(--shadow-btn-primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--tl-50) !important; border-color: var(--tl-200) !important;
    color: var(--tl-800) !important; border-radius: .65rem !important;
}

/* ============================================================
   16. MUDBLAZOR BRIDGE
   ============================================================ */

/* Rimuovi padding duplicato */
.area-main .mud-container { padding-top: 0 !important; }

/* MudPaper */
.area-main .mud-paper { border-radius: 1.1rem !important; box-shadow: var(--shadow-sm) !important; }
.area-main .mud-paper-elevation1 { box-shadow: var(--shadow-sm) !important; }
.area-main .mud-paper-elevation2 { box-shadow: var(--shadow-md) !important; }

/* MudTable header */
.area-main .mud-table-head .mud-table-cell {
    background: linear-gradient(90deg, #134e4a 0%, #0f766e 100%) !important;
    color: rgba(255,255,255,.88) !important;
    font-size: .8rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
}
.area-main .mud-table-row:hover { background: var(--tl-50) !important; }

/* MudTabs accent */
.area-main .mud-tab.mud-tab-active { color: var(--tl-700) !important; }
.area-main .mud-tab-slider { background-color: var(--tl-700) !important; }

/* MudButton Filled Primary */
.area-main .mud-button-filled-primary { box-shadow: var(--shadow-btn-primary) !important; }
.area-main .mud-button-filled-primary:hover { box-shadow: 0 6px 22px rgba(2,159,130,.5) !important; }

/* MudChip Primary */
.area-main .mud-chip-color-primary {
    background-color: var(--tl-100) !important;
    color: var(--tl-900) !important;
}

/* MudProgressLinear */
.area-main .mud-progress-linear-bar { background-color: var(--tl-600) !important; }

/* MudDatePicker focus */
.area-main .mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: var(--tl-600) !important;
}

/* ============================================================
   17. CLASSI CUSTOM
   ============================================================ */
.page-header-index {
    background: linear-gradient(125deg, #0f766e 0%, #134e4a 50%, #029f82 100%);
    border-radius: 1.1rem; padding: 1.3rem 1.7rem; margin: 0 1rem 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 4px 22px rgba(2,159,130,.32);
    position: relative; overflow: hidden;
}
.page-header-index::before {
    content: '';
    position: absolute; top: -50%; left: -5%;
    width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(193,209,0,.15) 0%, transparent 65%);
    pointer-events: none;
}
.page-header-index::after {
    content: '';
    position: absolute; top: -40%; right: -4%;
    width: 220px; height: 220px;
    background: rgba(255,255,255,.03); border-radius: 50%;
    pointer-events: none;
}
.page-header-index h1 {
    color: #fff; font-size: 1.38rem; font-weight: 700; margin: 0;
    display: flex; align-items: center; gap: .55rem;
    text-shadow: 0 1px 5px rgba(0,0,0,.22);
}
.page-header-btn-create {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.28);
    border-radius: .75rem; padding: .52rem 1.2rem;
    color: #fff; font-weight: 700; font-size: .93rem;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: .48rem;
    transition: all .2s; backdrop-filter: blur(6px);
}
.page-header-btn-create:hover {
    background: rgba(255,255,255,.24); color: #fff; text-decoration: none;
    transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

/* ============================================================
   17b. FILTER TOGGLES
   ============================================================ */
.filter-toggle {
    display: inline-flex; align-items: center; gap: .35rem;
    border: 1.5px solid var(--tl-200);
    background: #fff;
    color: var(--sl-500);
    border-radius: 2rem;
    padding: .32rem .9rem;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
}
.filter-toggle:hover {
    border-color: var(--tl-400);
    color: var(--sl-700);
    background: var(--tl-50);
}
.filter-toggle.active {
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.filter-toggle.active.toggle-teal {
    background: var(--tl-600);
    border-color: var(--tl-600);
}
.filter-toggle.active.toggle-warning {
    background: var(--clr-warning);
    border-color: var(--clr-warning);
}
.filter-toggle.active.toggle-info {
    background: var(--clr-info);
    border-color: var(--clr-info);
}
.filter-toggle.active.toggle-danger {
    background: var(--clr-error);
    border-color: var(--clr-error);
}

/* ============================================================
   17c. BOOKING CALENDAR
   ============================================================ */

/* Header / navigation */
.cal-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .75rem;
    margin-bottom: 1rem;
}
.cal-nav {
    display: flex; align-items: center; gap: .6rem;
}
.cal-nav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #fff; border: 1px solid var(--tl-200);
    color: var(--tl-700);
    text-decoration: none;
    transition: all .18s;
}
.cal-nav-btn:hover {
    background: var(--tl-50); border-color: var(--tl-400);
    color: var(--tl-900);
}
.cal-month-title {
    font-size: 1.35rem; font-weight: 700;
    color: var(--sl-800); margin: 0;
    text-transform: capitalize;
    min-width: 200px; text-align: center;
}
.cal-actions {
    display: flex; align-items: center; gap: .6rem;
}
.cal-today-btn {
    display: inline-flex; align-items: center;
    padding: .35rem .85rem;
    border: 1px solid var(--tl-200); border-radius: 2rem;
    background: #fff; color: var(--tl-700);
    font-size: .82rem; font-weight: 600;
    text-decoration: none; transition: all .18s;
}
.cal-today-btn:hover {
    background: var(--tl-50); border-color: var(--tl-400); color: var(--tl-900);
}
.cal-filter-form { display: flex; align-items: center; }
.cal-filter-form .form-select { min-width: 200px; font-size: .85rem; }

/* Legend */
.cal-legend {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
    padding: .55rem 1rem;
    background: var(--tl-50);
    border: 1px solid var(--tl-100);
    border-radius: .65rem;
    font-size: .78rem; color: var(--sl-600);
    margin-bottom: 1.2rem;
}
.cal-legend-item {
    display: inline-flex; align-items: center; gap: .35rem;
}
.cal-legend-dot {
    width: 12px; height: 12px; border-radius: 3px;
}
.cal-dot-occupato  { background: var(--tl-200); }
.cal-dot-checkin   { background: #34d399; }
.cal-dot-checkout  { background: #fbbf24; }
.cal-legend-icon   { font-size: .85rem; }
.cal-legend-badge  { font-size: .68rem; padding: .1rem .35rem; }

/* Accommodation card */
.cal-accommodation-card {
    background: #fff;
    border: 1px solid var(--tl-100);
    border-radius: .85rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.cal-accommodation-header {
    display: flex; align-items: center; gap: .4rem;
    padding: .7rem 1.1rem;
    background: linear-gradient(135deg, var(--tl-800) 0%, var(--tl-600) 100%);
    color: #fff;
    font-weight: 700; font-size: .95rem;
}
.cal-booking-count {
    margin-left: auto;
    font-weight: 400; font-size: .78rem;
    opacity: .75;
}

/* Grid wrapper */
.cal-grid-wrapper { overflow-x: auto; }

/* Calendar grid */
.cal-grid {
    width: 100%; border-collapse: collapse;
    table-layout: fixed;
}
.cal-day-header {
    text-align: center;
    padding: .45rem .3rem;
    font-size: .78rem; font-weight: 700;
    color: var(--sl-500);
    background: var(--sl-50);
    border-bottom: 2px solid var(--tl-100);
}
.cal-day-header.cal-weekend { color: var(--tl-600); }

/* Cell */
.cal-cell {
    vertical-align: top;
    height: 72px;
    border: 1px solid #e8eeec;
    padding: .2rem;
    position: relative;
    transition: background .15s;
}
.cal-cell:hover:not(.cal-empty) {
    box-shadow: inset 0 0 0 2px var(--tl-300);
}
.cal-empty { background: var(--sl-50); }
.cal-weekend:not(.cal-empty) { background: rgba(0,130,104,.02); }

/* Today */
.cal-today {
    box-shadow: inset 0 0 0 2px var(--tl-500) !important;
}
.cal-today .cal-day-number {
    background: var(--tl-600); color: #fff;
    border-radius: 50%; width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .72rem;
}

/* State backgrounds */
.cal-occupied  { background: var(--tl-50); }
.cal-checkin   { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); }
.cal-checkout  { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); }
.cal-checkout-checkin {
    background: linear-gradient(135deg, #fef3c7 0%, #d1fae5 100%);
}

/* Cell content */
.cal-cell-content {
    display: flex; flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    height: 100%;
}
.cal-day-number {
    font-size: .75rem; font-weight: 600;
    color: var(--sl-600); line-height: 1;
}

/* Checkout icon (broom) */
.cal-icon-checkout {
    font-size: .7rem; color: #b45309;
    line-height: 1;
}

/* Gap badge: giorni liberi dopo checkout */
.cal-gap-badge {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .6rem; font-weight: 700;
    padding: .05rem .3rem;
    border-radius: .8rem;
    line-height: 1.2;
    color: #fff;
}
.cal-gap-0     { background: #dc2626; font-size: .55rem; }       /* stesso giorno */
.cal-gap-1     { background: #ea580c; }                          /* 1 giorno */
.cal-gap-2     { background: #d97706; }                          /* 2 giorni */
.cal-gap-3     { background: #65a30d; }                          /* 3 giorni */
.cal-gap-4     { background: #059669; }                          /* 4 giorni */
.cal-gap-5     { background: #0284c7; }                          /* 5 giorni */
.cal-gap-many  { background: var(--sl-400); }                    /* 6+ giorni */

/* Guest name tag inside check-in cell */
.cal-guest-name {
    font-size: .6rem; line-height: 1.1;
    color: var(--tl-800); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; max-width: 100%;
}

/* ============================================================
   18. LAYOUT HELPERS
   ============================================================ */
.area-main > .container,
.area-main > .container-fluid { margin-top: 1.3rem; }

.text-danger { color: #b91c1c !important; font-size: .93rem; }
.col-md-8.offset-md-2 > .card { box-shadow: var(--shadow-lg); }

/* ============================================================
   19. RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .area-sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); box-shadow: none; }
    .area-sidebar.show { transform: translateX(0); box-shadow: 6px 0 32px rgba(0,0,0,.5); }
    .area-sidebar.collapsed { width: var(--sidebar-width); }
    .area-content { left: 0; }
    .area-content.sidebar-collapsed { left: 0; }
    .sidebar-toggle-btn { display: inline-flex; align-items: center; }
    .sidebar-collapse-btn { display: none; }
    .area-topbar { padding: .8rem 1.1rem; }
    .page-title { font-size: 1.18rem; }
    .area-content > .alert { margin-left: 1rem; margin-right: 1rem; }
    .page-header-index { margin: 0 .5rem 1.25rem; }
}

@media (max-width: 767.98px) {
    .container h2, .container-fluid h2 { font-size: 1.18rem; }
    .card-body { padding: 1.15rem; }
    .page-header-index {
        flex-direction: column; gap: .9rem;
        padding: 1rem 1.15rem; text-align: center;
    }
    .page-header-index::before,
    .page-header-index::after { display: none; }

    /* Calendar responsive */
    .cal-header { flex-direction: column; align-items: stretch; }
    .cal-nav { justify-content: center; }
    .cal-actions { justify-content: center; flex-wrap: wrap; }
    .cal-filter-form .form-select { min-width: 0; width: 100%; }
    .cal-legend { font-size: .7rem; gap: .6rem; }
    .cal-cell { height: 56px; }
    .cal-month-title { font-size: 1.1rem; min-width: 160px; }
    .cal-guest-name { display: none; }
}
