/* Version 2.0.7 - Complete Redesign */

/* ============================================
   CSS VARIABLES - Design System
   ============================================ */
:root {
    /* Primary Colors */
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-light: #e0f2fe;
    --primary-dark: #0369a1;

    /* Secondary/Accent */
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-light: #d1fae5;

    /* Neutrals */
    --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: #020617;

    /* Semantic Colors */
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: var(--primary);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;

    /* Layout */
    --header-height: 64px;
    --sidebar-width: 100px;
    --sidebar-width-expanded: 200px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

    /* Bootstrap Compatibility */
    --bs-blue: #0d6efd;
    --bs-indigo: #6610f2;
    --bs-purple: #6f42c1;
    --bs-pink: #d63384;
    --bs-red: #dc3545;
    --bs-orange: #fd7e14;
    --bs-yellow: #ffc107;
    --bs-green: #198754;
    --bs-teal: #20c997;
    --bs-cyan: #0dcaf0;
    --bs-white: #fff;
    --bs-gray: #6c757d;
    --bs-gray-dark: #343a40;
    --bs-gray-100: #f8f9fa;
    --bs-gray-200: #e9ecef;
    --bs-gray-300: #dee2e6;
    --bs-gray-400: #ced4da;
    --bs-gray-500: #adb5bd;
    --bs-gray-600: #6c757d;
    --bs-gray-700: #495057;
    --bs-gray-800: #343a40;
    --bs-gray-900: #212529;
    --bs-primary: var(--primary);
    --bs-secondary: #6c757d;
    --bs-success: var(--success);
    --bs-info: var(--info);
    --bs-warning: var(--warning);
    --bs-danger: var(--danger);
    --bs-light: #f8f9fa;
    --bs-dark: #212529;
    --bs-body-font-size: 1rem;
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.5;
    --bs-body-color: var(--gray-700);
    --bs-body-bg: var(--gray-50);
    --bs-border-width: 1px;
    --bs-border-color: var(--gray-200);
    --bs-border-radius: var(--radius);
}

/* ============================================
   BASE STYLES
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--gray-50);
}

/* ============================================
   CUSTOM SCROLLBARS - Global
   ============================================ */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gray-300), var(--gray-400));
    border-radius: 5px;
    border: 2px solid var(--gray-100);
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--gray-400), var(--gray-500));
}

::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, var(--primary), var(--primary-hover));
}

::-webkit-scrollbar-corner {
    background: var(--gray-100);
}

/* Scrollbar sottile per elementi interni */
.popup_calendar::-webkit-scrollbar,
.delete_action::-webkit-scrollbar,
textarea::-webkit-scrollbar,
.list_table::-webkit-scrollbar,
pre::-webkit-scrollbar,
code::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.popup_calendar::-webkit-scrollbar-thumb,
.delete_action::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb,
.list_table::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb,
code::-webkit-scrollbar-thumb {
    border: none;
    border-radius: 3px;
}

/* Sidebar scrollbar - dark theme */
.pannel_left::-webkit-scrollbar {
    width: 6px;
}

.pannel_left::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

.pannel_left::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 3px;
}

.pannel_left::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) var(--gray-100);
}

.pannel_left {
    scrollbar-color: var(--gray-600) var(--sidebar-bg);
}

/* ============================================
   LAYOUT - Main Structure
   ============================================ */
.pages_layout {
    display: flex;
    min-height: 100vh;
    background: var(--gray-100);
}

.pages_layout .pannel_left {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 100;
    transition: width var(--transition-slow);
    overflow: hidden;
    overflow-y: auto;
}

.pages_layout .pannel_left:hover {
    width: var(--sidebar-width-expanded);
}

.pages_layout .pannel_right {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    background: var(--gray-50);
    transition: margin-left var(--transition-slow), width var(--transition-slow);
}

/* ============================================
   HEADER
   ============================================ */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

/* Left side - icon + title */
header .c_pannel {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 11px;
    height: 42px;
}

header .c_pannel i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    color: var(--primary-dark);
    border-radius: 50%;
    font-size: 20px;
}

header .c_pannel p {
    display: inline-block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    line-height: 42px;
}

/* Header Navigation - aligned right */
header #nav_top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding: 0;
    height: 40px;
    float: right;
    list-style: none;
}

header #nav_top li {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
    list-style: none;
}

header #nav_top li:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

header #nav_top li#bg_t {
    background: transparent;
    color: var(--gray-600);
}

header #nav_top li#bg_t:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

header #nav_top li #number_act {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Dropdown Menu */
header #nav_top li ul {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    padding-top: 16px;
    z-index: 100;
}

/* Bridge invisibile per mantenere hover */
header #nav_top li ul::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

header #nav_top li:hover ul {
    display: block;
}

header #nav_top li ul li {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: auto;
    min-width: unset;
    padding: 10px 12px;
    background: transparent;
    color: var(--gray-700);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

header #nav_top li ul li:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    transform: none;
}

header #nav_top li ul li i {
    font-size: 16px;
    color: var(--gray-500);
}

/* Search Form */
header #nav_top form.research {
    display: flex;
    align-items: center;
    height: 40px;
}

header #nav_top form.research input {
    width: 280px;
    height: 40px;
    padding: 0 16px;
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    color: var(--gray-700);
    outline: none;
    transition: all var(--transition);
}

header #nav_top form.research input:focus {
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-light);
}

header #nav_top form.research input::placeholder {
    color: var(--gray-400);
}

/* Search Dropdown */
header #nav_top form.research .search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

/* Nascondi bordo se vuoto */
header #nav_top form.research .search-dropdown:empty {
    display: none;
}

header #nav_top form.research .search-dropdown div {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: background var(--transition-fast);
}

header #nav_top form.research .search-dropdown div:hover {
    background: var(--gray-100);
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.navigation {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    gap: 4px;
}

.navigation li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    list-style: none;
}

.navigation li:first-child {
    padding: 16px 0 24px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--gray-800);
    cursor: default;
}

.navigation li:first-child img {
    width: 56px;
    height: auto;
    transition: transform var(--transition);
}

.pannel_left:hover .navigation li:first-child img {
    transform: scale(1.1);
}

.navigation li i {
    font-size: 22px;
    margin-bottom: 4px;
    transition: transform var(--transition);
}

.navigation li p,
.navigation li span {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0;
    white-space: nowrap;
    transition: opacity var(--transition);
    margin: 0;
}

.pannel_left:hover .navigation li p,
.pannel_left:hover .navigation li span {
    opacity: 1;
}

.navigation li:not(:first-child):hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.navigation li:not(:first-child):hover i {
    transform: scale(1.1);
}

.navigation li.active {
    background: var(--primary);
    color: var(--white);
}

.navigation li.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.navigation li#update_yes {
    color: var(--warning);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   SECTIONS
   ============================================ */
section {
    margin: 20px 24px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: visible;
}

section.basic {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

/* ============================================
   SECTION NAVIGATION TABS
   ============================================ */
.nav_list_section {
    display: flex;
    align-items: stretch;
    height: 56px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 8px;
    gap: 4px;
    overflow-x: auto;
}

.nav_list_section li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    min-width: max-content;
    cursor: pointer;
    color: var(--gray-500);
    font-size: 0.8125rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    list-style: none;
}

/* Solo la PRIMA voce #right spinge a destra, le successive stanno accanto */
.nav_list_section li#right {
    margin-left: 0;
}

.nav_list_section li#right:first-of-type,
.nav_list_section li:not(#right) + li#right {
    margin-left: auto;
}

.nav_list_section li i {
    font-size: 18px;
    margin-bottom: 2px;
}

.nav_list_section li p {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.nav_list_section li:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav_list_section li.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* ============================================
   TABLES
   ============================================ */
.list_table {
    width: 100%;
    border-collapse: collapse;
}

.list_table tr {
    transition: background var(--transition-fast);
}

.list_table tr:first-child td {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    padding: 14px 16px;
}

.list_table tr:not(:first-child):hover {
    background: var(--gray-50);
}

.list_table tr:nth-child(even):not(:first-child) {
    background: var(--gray-50);
}

.list_table tr:nth-child(even):not(:first-child):hover {
    background: var(--gray-100);
}

.list_table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    color: var(--gray-700);
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.list_table tr #color_tmp {
    width: 24px;
    height: 24px;
    border-radius: var(--radius);
    display: block;
    margin: 0 auto;
}

/* Table Actions */
.list_table tr .cog {
    position: relative;
    overflow: visible;
}

.list_table tr .cog .pul_edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 32px;
    padding: 0 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.list_table tr .cog .pul_edit:hover {
    background: var(--gray-200);
}

.list_table tr .cog .pul_edit i {
    font-size: 14px;
    color: var(--gray-600);
}

.list_table tr .cog .pul_edit_opn {
    display: none;
    position: absolute;
    left: 0;
    min-width: 160px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    z-index: 9999;
}

/* Posizionamento dinamico via JavaScript */
.list_table tr .cog .pul_edit_opn.open-down {
    top: 100%;
    bottom: auto;
    margin-top: 4px;
    margin-bottom: 0;
}

.list_table tr .cog .pul_edit_opn.open-up {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.list_table tr .cog .pul_edit_opn.align-right {
    left: auto;
    right: 0;
}

.list_table tr .cog .pul_edit_opn ul {
    padding: 6px;
    margin: 0;
    list-style: none;
}

.list_table tr .cog .pul_edit_opn ul li {
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.list_table tr .cog .pul_edit_opn ul li:hover {
    background: var(--gray-100);
    color: var(--primary);
}

/* Invoice Rows Override */
#invoice-rows tr {
    border: 1px solid var(--gray-200);
}

#invoice-rows tr:nth-child(odd) {
    background: transparent;
}

/* ============================================
   GRID SYSTEM
   ============================================ */
.grid {
    display: grid;
    gap: 16px;
    grid-auto-flow: dense;
    grid-auto-rows: 160px;
}

.grid_box {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative; /* necessario per overlay edit mode */
    /* flex container: il widget interno si allunga a riempire la cella */
    display: flex;
    flex-direction: column;
}

.grid_box:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* In edit mode il box non si solleva (l'overlay occupa lo spazio) */
.dash-edit-mode .grid_box:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.grid_box.square { }
.grid_box.rectangular { grid-column: span 2; }
.grid_box.vertical { grid-row: span 2; }
.grid_box.large { grid-column: span 2; grid-row: span 2; }

/* Dashboard: flow normale + righe a altezza automatica (minimo 160px) */
.dash-grid {
    grid-auto-flow: row;
    grid-auto-rows: minmax(160px, auto);
}

.grid.grid-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ============================================
   DASHBOARD CARDS
   ============================================ */
.purchase-to-renew-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

.purchase-to-renew-card .card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    transition: all var(--transition);
}

.purchase-to-renew-card .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.purchase-to-renew-card .card i {
    font-size: 48px;
    opacity: 0.3;
}

.purchase-to-renew-card .card .counter {
    flex: 1;
}

.purchase-to-renew-card .card .counter-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.purchase-to-renew-card .card .counter-label {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* Card Color Variants */
.purchase-to-renew-card .card.bg-invocie {
    background: linear-gradient(135deg, #0ea5e9, #0369a1);
}

.purchase-to-renew-card .card.bg-paid {
    background: linear-gradient(135deg, #22c55e, #15803d);
}

.purchase-to-renew-card .card.bg-wait {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.title_ds {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    text-align: center;
    padding: 24px;
}

/* ============================================
   DASHBOARD WIDGETS
   ============================================ */

.dash-widget {
    display: flex;
    flex-direction: column;
    /* flex:1 → riempie il grid_box (che ora è flex-column) */
    flex: 1;
    /* min-height:0 → fondamentale in flex per evitare overflow */
    min-height: 0;
}

.dash-widget__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0; /* header mai compresso */
}

.dash-widget__header i {
    font-size: 15px;
    color: var(--primary);
}

.dash-widget__body {
    flex: 1;
    min-height: 0;   /* evita overflow nel flex parent */
    padding: 12px;
    overflow: hidden;
}

.dash-widget__body--scroll {
    overflow-y: auto;
    padding: 0;
    /* scroll funziona solo se il parent ha altezza definita.
       Con flex:1 + min-height:0 sul parent, questo scrollerà correttamente */
}

.dash-widget__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;         /* sostituisce height:100% (più affidabile in flex) */
    min-height: 80px;
    gap: 8px;
    color: var(--gray-400);
    padding: 16px;
}

.dash-widget__empty i    { font-size: 28px; opacity: 0.4; }
.dash-widget__empty p    { font-size: 0.8125rem; text-align: center; margin: 0; }

.dash-badge {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.4;
}
.dash-badge--red { background: #fee2e2; color: #dc2626; }

/* Stat cards */
.dash-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    height: 100%;
    align-content: center;
}
.dash-stat-grid--2 { grid-template-columns: repeat(2, 1fr); }

.dash-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: var(--radius-md);
    padding: 10px 8px;
    gap: 4px;
}
.dash-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--white);
}
.dash-stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: rgba(255,255,255,0.85);
    line-height: 1.2;
}
.dash-stat-card--blue  { background: linear-gradient(135deg, #0ea5e9, #0369a1); }
.dash-stat-card--green { background: linear-gradient(135deg, #22c55e, #15803d); }
.dash-stat-card--amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dash-stat-card--teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.dash-stat-card--pink   { background: linear-gradient(135deg, #ec4899, #be185d); }
.dash-stat-card--purple { background: linear-gradient(135deg, #a855f7, #7e22ce); }

/* Appointment list */
.dash-apt-list { list-style: none; margin: 0; padding: 0; }

.dash-apt-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
}
.dash-apt-item:last-child { border-bottom: none; }
.dash-apt-item:hover      { background: var(--gray-50); }

.dash-apt-dot {
    width: 8px; height: 8px; min-width: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-apt-info {
    display: flex; flex-direction: column;
    gap: 2px; overflow: hidden;
}
.dash-apt-title {
    font-size: 0.8125rem; font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-apt-time { font-size: 0.6875rem; color: var(--gray-500); }

/* Stock reorder list */
.dash-stock-list { list-style: none; margin: 0; padding: 0; }

.dash-stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    border-bottom: 1px solid var(--gray-100);
    border-left: 3px solid transparent;
    gap: 8px;
}
.dash-stock-item:last-child      { border-bottom: none; }
.dash-stock-item--warning        { border-left-color: #f59e0b; }
.dash-stock-item--critical       { border-left-color: #dc2626; background: #fff5f5; }

.dash-stock-info {
    display: flex; flex-direction: column;
    gap: 1px; overflow: hidden;
}
.dash-stock-name {
    font-size: 0.8125rem; font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-stock-code { font-size: 0.6875rem; color: var(--gray-500); }

.dash-stock-qty {
    display: flex; align-items: baseline;
    gap: 3px; flex-shrink: 0;
}
.dash-stock-available { font-size: 0.9375rem; font-weight: 700; color: var(--gray-800); }
.dash-stock-min       { font-size: 0.75rem; color: var(--gray-400); }

/* Badge blue */
.dash-badge--blue { background: #dbeafe; color: #1d4ed8; }

/* Stat card red */
.dash-stat-card--red { background: linear-gradient(135deg, #ef4444, #b91c1c); }

/* Overdue invoices */
.dash-overdue-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 14px 6px;
    border-bottom: 1px solid var(--gray-100);
}
.dash-overdue-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: #dc2626;
}
.dash-overdue-label {
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.dash-overdue-list { list-style: none; margin: 0; padding: 0; }
.dash-overdue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    border-bottom: 1px solid var(--gray-100);
    gap: 8px;
}
.dash-overdue-item:last-child { border-bottom: none; }
.dash-overdue-info { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.dash-overdue-num    { font-size: 0.8125rem; font-weight: 600; color: var(--gray-800); }
.dash-overdue-client { font-size: 0.6875rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-overdue-right  { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex-shrink: 0; }
.dash-overdue-amount { font-size: 0.875rem; font-weight: 600; color: var(--gray-800); }
.dash-overdue-days   { font-size: 0.6875rem; color: #dc2626; font-weight: 600; }

/* Recent patients */
.dash-recent-list { list-style: none; margin: 0; padding: 0; }
.dash-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
}
.dash-recent-item:last-child { border-bottom: none; }
.dash-recent-item:hover      { background: var(--gray-50); }
.dash-recent-avatar {
    width: 32px; height: 32px; min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    color: var(--primary-dark);
    font-size: 0.875rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.dash-recent-info  { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.dash-recent-name  { font-size: 0.8125rem; font-weight: 500; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-recent-date  { font-size: 0.6875rem; color: var(--gray-500); }

/* WhatsApp bar */
.dash-wa-bar {
    position: relative;
    height: 6px;
    background: var(--gray-200);
    border-radius: 99px;
    margin: 10px 12px 4px;
    overflow: hidden;
}
.dash-wa-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #15803d);
    border-radius: 99px;
    transition: width 0.6s ease;
}
.dash-wa-bar__label {
    display: block;
    text-align: center;
    font-size: 0.6875rem;
    color: var(--gray-500);
    margin: 4px 12px 0;
}

/* Quick actions */
.dash-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    height: 100%;
    align-content: start;
}
.dash-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.dash-quick-btn i    { font-size: 22px; }
.dash-quick-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }

.dash-quick-btn--blue   { background: #dbeafe; color: #1d4ed8; }
.dash-quick-btn--teal   { background: #ccfbf1; color: #0f766e; }
.dash-quick-btn--green  { background: #dcfce7; color: #15803d; }
.dash-quick-btn--amber  { background: #fef3c7; color: #b45309; }
.dash-quick-btn--purple { background: #f3e8ff; color: #7e22ce; }
.dash-quick-btn--pink   { background: #fce7f3; color: #be185d; }
.dash-quick-btn--gray   { background: var(--gray-100); color: var(--gray-600); }

/* ============================================
   DASHBOARD – TOOLBAR & EDIT MODE
   ============================================ */

/* ── Toolbar personalizza ── */
.dash-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0 14px;
}

.dash-toolbar__edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.dash-toolbar__edit-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.dash-toolbar__edit-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.dash-toolbar__hint {
    font-size: 0.78rem;
    color: var(--gray-500);
    display: none;
}
.dash-toolbar__hint.visible {
    display: inline;
}

/* Indicatore salvataggio */
.dash-save-status {
    font-size: 0.78rem;
    font-weight: 500;
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 20px;
    transition: opacity .3s;
    opacity: 0;
    pointer-events: none;
}
.dash-save-status:not(:empty)  { opacity: 1; }
.dash-save-status--saving       { color: var(--gray-500); background: var(--gray-100); }
.dash-save-status--ok           { color: #15803d;  background: #dcfce7; }
.dash-save-status--error        { color: #b91c1c;  background: #fee2e2; }

/* ── Overlay widget in edit mode ── */
.dash-widget-ctrl {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
    border-radius: var(--radius-md);
    z-index: 10;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

/* Appare solo quando la griglia è in edit mode */
.dash-edit-mode .dash-widget-ctrl {
    display: flex;
}

.dash-widget-ctrl__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    width: 100%;
}

.dash-widget-ctrl__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ── Bottoni dimensione ── */
.dash-widget-ctrl__sizes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.dash-sz-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    cursor: pointer;
    color: rgba(255,255,255,0.8);
    font-size: 0.7rem;
    transition: all .15s;
}
.dash-sz-btn:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}
.dash-sz-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Icone forma (mini preview del layout) */
.dash-sz-shape {
    display: block;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.9;
}
.dash-sz--sq   { width: 14px; height: 14px; }
.dash-sz--rect { width: 26px; height: 14px; }
.dash-sz--vert { width: 14px; height: 26px; }
.dash-sz--lg   { width: 26px; height: 26px; }

.dash-sz-label { font-size: 0.65rem; }

/* ── Bottone nascondi ── */
.dash-widget-ctrl__hide {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: rgba(239,68,68,0.25);
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: var(--radius);
    color: #fca5a5;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all .15s;
}
.dash-widget-ctrl__hide:hover {
    background: rgba(239,68,68,0.5);
    color: #fff;
}

/* ── Drag handle (griglia puntini 2×3) ── */
.dash-drag-handle {
    display: grid;
    grid-template-columns: repeat(2, 6px);
    grid-template-rows:    repeat(3, 6px);
    gap: 4px;
    cursor: grab;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: background .15s;
}
.dash-drag-handle:hover  { background: rgba(255,255,255,0.15); }
.dash-drag-handle:active { cursor: grabbing; }

.dash-drag-handle span {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    pointer-events: none;
}

/* ── Stati SortableJS ── */
/* Fantasma: segnaposto che rimane nella posizione originale */
.dash-grid-ghost {
    opacity: 0.35;
    border: 2px dashed rgba(255,255,255,0.4) !important;
    background: rgba(99,102,241,0.2) !important;
}

/* Widget scelto (al click prima del drag) */
.dash-grid-chosen {
    box-shadow: 0 0 0 3px var(--primary), var(--shadow-md) !important;
}

/* Widget in movimento */
.dash-grid-dragging {
    opacity: 0.9;
    cursor: grabbing !important;
    box-shadow: var(--shadow-lg, 0 20px 40px rgba(0,0,0,0.2)) !important;
    transform: scale(1.02) !important;
    z-index: 100;
}

/* ── Pannello widget nascosti ── */
.dash-hidden-panel {
    margin-top: 24px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.dash-hidden-panel__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.dash-hidden-panel__list {
    padding: 8px 0;
}

.dash-hidden-panel__empty {
    padding: 16px;
    font-size: 0.83rem;
    color: var(--gray-400);
    text-align: center;
    margin: 0;
}

/* Empty state griglia (nessun widget attivo) */
.dash-empty-state {
    grid-column: 1 / -1; /* occupa tutta la larghezza della griglia */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 24px;
    color: var(--gray-400);
    text-align: center;
}
.dash-empty-state i        { font-size: 40px; opacity: 0.4; }
.dash-empty-state p        { font-size: 0.9rem; margin: 0; color: var(--gray-500); }
.dash-empty-state__sub     { font-size: 0.82rem !important; color: var(--gray-400) !important; }
.dash-empty-state__sub strong { color: var(--primary); font-weight: 600; }

.dash-hidden-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
}
.dash-hidden-item:last-child { border-bottom: none; }
.dash-hidden-item:hover { background: var(--gray-50); }

.dash-hidden-item__info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dash-hidden-item__name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
}
.dash-hidden-item__size {
    font-size: 0.73rem;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 10px;
}

.dash-hidden-item__btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 0.78rem;
    color: var(--primary);
    background: var(--white);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s;
}
.dash-hidden-item__btn:hover {
    background: var(--primary);
    color: #fff;
}

/* ============================================
   FORMS
   ============================================ */
.form_data h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    padding: 16px 0;
    margin: 0;
    border-bottom: 1px solid var(--gray-200);
}

.form_data strong,
.form_data p {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin: 8px 0;
}

.form_data p.diary-text {
    line-height: 1.8;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.form_data .pul_edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    background: var(--gray-100);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition);
}

.form_data .pul_edit:hover {
    background: var(--gray-200);
}

.form_data textarea,
.form_data input,
.form_data select.select-main {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--gray-700);
    outline: none;
    transition: all var(--transition);
    margin-bottom: 12px;
}

.form_data textarea {
    min-height: 120px;
    resize: vertical;
}

.form_data input:focus,
.form_data textarea:focus,
.form_data select.select-main:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form_data input:hover,
.form_data textarea:hover,
.form_data select.select-main:hover {
    border-color: var(--gray-400);
}

.form_data .d-none {
    display: none;
}

.form_data button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 24px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 12px;
}

.form_data button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.form_data .is-invalid {
    border-color: var(--danger) !important;
    background: var(--danger-light);
}

/* Progress Bar */
.form_data .bar-line {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 12px 0;
}

.form_data .proggress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 16px;
}

.pagination span,
.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.pagination a:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.pagination span.current {
    background: var(--primary);
    color: var(--white);
}

/* ============================================
   POPUP MESSAGES (Toast)
   ============================================ */
.popup-msg {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--gray-800);
    color: var(--white);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    animation: slideInUp 0.3s ease;
}

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

.popup-msg.success {
    background: var(--success);
}

.popup-msg.error {
    background: var(--danger);
}

.popup-msg.warning {
    background: var(--warning);
    color: var(--gray-900);
}

/* ============================================
   MODAL BASE (generico)
   ============================================ */
.delete_action,
.modal-popup {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 400px;
    max-width: 90vw;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.delete_action span,
.modal-popup > span:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    background: var(--danger);
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 600;
}

/* Modal generici - header primario invece di rosso */
.modal-popup > span:first-child,
#patient-search-popup > span:first-child {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.delete_action p,
.modal-popup p {
    padding: 24px;
    font-size: 0.9375rem;
    color: var(--gray-600);
    text-align: center;
    margin: 0;
    line-height: 1.6;
}

/* ============================================
   SEARCH POPUP (patient-search, ecc.)
   ============================================ */
#patient-search-popup {
    width: 560px;
    max-width: 95vw;
    padding: 0;
}

#patient-search-popup > span:first-child {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#patient-search-popup input[type="text"] {
    width: 70%;
    margin: 20px auto;
    display: block;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    outline: none;
    transition: all var(--transition);
}

#patient-search-popup input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

#patient-search-popup #patient-search-results {
    max-height: 320px;
    overflow-y: auto;
    margin: 0 20px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
}

#patient-search-popup #patient-search-results > div {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background var(--transition-fast);
}

#patient-search-popup #patient-search-results > div:last-child {
    border-bottom: none;
}

#patient-search-popup #patient-search-results > div:hover {
    background: var(--primary-light);
}

#patient-search-popup .btn,
#patient-search-popup button {
    display: block;
    width: calc(100% - 40px);
    margin: 20px;
    padding: 12px 20px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition);
}

#patient-search-popup .btn:hover,
#patient-search-popup button:hover {
    background: var(--gray-200);
}

/* Bottoni centrati nei popup - affiancati */
.delete_action,
.modal-popup {
    text-align: center;
}

.delete_action button,
.modal-popup button {
    display: inline-block;
    margin: 16px 8px;
}

/* ============================================
   CALENDAR EVENT VIEW MODE
   ============================================ */
.ev-view-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.ev-view-row:last-of-type {
    border-bottom: none;
}

.ev-view-label {
    flex: 0 0 120px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ev-view-value {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--gray-800);
    word-break: break-word;
}

.ev-view-value:empty::after {
    content: '-';
    color: var(--gray-400);
}

.ev-view-value a {
    color: var(--primary);
    text-decoration: none;
}

.ev-view-value a:hover {
    text-decoration: underline;
}

/* ============================================
   CALENDAR
   ============================================ */
.app {
    margin: 20px 0;
}

.fc-toolbar {
    background: var(--white);
    padding: 16px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.toolbar {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    background: var(--white);
    padding: 16px;
}

.toolbar h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
}

.toolbar h3 i {
    cursor: pointer;
    color: var(--gray-500);
    transition: color var(--transition);
}

.toolbar h3 i:hover {
    color: var(--primary);
}

.fc-view-harness.fc-view-harness-passive {
    background: var(--white);
}

.calendar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    background: var(--white);
    padding: 12px 16px;
}

.fc .fc-col-header-cell-cushion {
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
}

/* Calendar Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--gray-300);
    background: var(--white);
    cursor: pointer;
    user-select: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition);
}

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

.chip input[type="radio"],
.chip input[type="checkbox"] {
    display: none;
}

.chip:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.fc .fc-daygrid-day-top {
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
}

.day-num {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.fc-day-sat .day-num,
.fc-day-sun .day-num {
    opacity: 0.7;
}

/* Calendar Popup */
.block_bg_background {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 500;
}

.popup_calendar {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 501;
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
}

.popup_calendar span {
    display: block;
    padding: 8px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    text-align: left;
}

.popup_calendar span:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    text-align: center;
    padding: 0 0 16px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.popup_calendar input,
.popup_calendar select,
.popup_calendar textarea {
    display: block;
    width: 100%;
    margin: 0 0 12px 0;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--gray-700);
    outline: none;
    transition: all var(--transition);
    box-sizing: border-box;
}

.popup_calendar input:focus,
.popup_calendar select:focus,
.popup_calendar textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Date/Time row - side by side */
.popup_calendar .row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.popup_calendar .row input {
    flex: 1;
    margin: 0;
}

.popup_calendar input#ev-start,
.popup_calendar input#ev-end {
    display: block;
    width: auto;
    flex: 1;
    margin: 0;
}

/* Color inputs side by side */
.popup_calendar input#cl-color,
.popup_calendar input#cl-color-picker {
    display: inline-block;
    width: calc(50% - 6px);
    margin: 0 0 12px 0;
    vertical-align: middle;
}

.popup_calendar input#cl-color-picker {
    height: 44px;
    padding: 4px;
    cursor: pointer;
}

.popup_calendar select.select-main {
    min-height: 44px;
}

.popup_calendar textarea {
    min-height: 80px;
    resize: vertical;
}

/* Checkbox label inside popup */
.popup_calendar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin: 8px 0;
    cursor: pointer;
}

.popup_calendar label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Actions buttons */
.popup_calendar .actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.popup_calendar .actions button {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

/* Ricorrenza fine wrap */
.popup_calendar #ev-ricorrenza-fine-wrap {
    margin: 8px 0 12px 0;
}

.popup_calendar #ev-ricorrenza-fine-wrap label {
    display: block;
    margin-bottom: 6px;
}

/* Datalist styling */
.popup_calendar datalist {
    display: none;
}

/* ============================================
   SETTINGS BOX
   ============================================ */
.box_act {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
}

.box_rct {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    padding: 24px;
    background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    cursor: pointer;
}

.box_rct:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.box_rct span {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    text-align: center;
    margin-bottom: 8px;
}

.box_rct p {
    font-size: 0.8125rem;
    color: var(--gray-500);
    text-align: center;
    line-height: 1.5;
    margin: 0;
}

.box_rct button.d-none,
.box_rct p b.d-none {
    display: none;
}

/* ============================================
   CHATBOT
   ============================================ */
.lm-chatbot-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 900;
    transition: all var(--transition);
    border: none;
}

.lm-chatbot-toggle:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 28px rgba(14, 165, 233, 0.4);
}

.lm-chatbot-toggle-icon {
    font-size: 24px;
    color: var(--white);
}

.lm-chatbot-toggle.is-open {
    background: var(--danger);
}

.lm-chatbot {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 360px;
    max-height: 520px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    z-index: 901;
    overflow: hidden;
}

.lm-chatbot--hidden {
    display: none;
}

.lm-chatbot-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.lm-chatbot-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.lm-chatbot-subtitle {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 4px;
}

.lm-chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--gray-50);
}

.lm-chatbot-message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    line-height: 1.5;
    font-size: 0.875rem;
    max-width: 85%;
}

.lm-chatbot-message.bot {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
}

.lm-chatbot-message.user {
    background: var(--primary);
    color: var(--white);
    margin-left: auto;
    border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}

.lm-chatbot-message small {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray-400);
    margin-top: 6px;
}

.lm-chatbot-message.user small {
    color: rgba(255, 255, 255, 0.7);
}

.lm-chatbot-form {
    display: flex;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.lm-chatbot-form input {
    flex: 1;
    border: none;
    padding: 14px 16px;
    font-size: 0.9375rem;
    outline: none;
    background: transparent;
}

.lm-chatbot-form button {
    padding: 0 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}

.lm-chatbot-form button:hover {
    background: var(--primary-hover);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
body#login.cf-split {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--gray-800);
    background: var(--gray-900);
    display: grid;
    place-items: stretch;
}

.cf-shell {
    display: grid;
    grid-template-columns: minmax(400px, 50%) 1fr;
    min-height: 100vh;
}

.cf-brand {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-rows: 1fr auto;
    background: linear-gradient(135deg, var(--gray-900), var(--gray-800));
    color: var(--white);
}

.cf-brand .cf-mesh {
    position: absolute;
    inset: -20% -10%;
    filter: blur(60px) saturate(150%);
    background:
        radial-gradient(40% 35% at 25% 40%, rgba(14, 165, 233, 0.6) 0%, transparent 60%),
        radial-gradient(45% 40% at 70% 60%, rgba(16, 185, 129, 0.6) 0%, transparent 60%);
    animation: meshMove 20s ease-in-out infinite alternate;
}

@keyframes meshMove {
    0% { transform: translate3d(-2%, -2%, 0) scale(1); }
    50% { transform: translate3d(3%, 1%, 0) scale(1.05); }
    100% { transform: translate3d(-1%, 3%, 0) scale(1); }
}

.cf-brand-content {
    z-index: 1;
    align-self: center;
    justify-self: center;
    text-align: center;
    padding: 48px 24px;
}

.cf-logo {
    height: 180px;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
    margin-bottom: 24px;
}

.cf-foot {
    z-index: 1;
    padding: 20px 32px;
    font-size: 0.75rem;
    color: var(--gray-400);
}

.cf-foot a {
    color: var(--gray-400);
    text-decoration: none;
    transition: color var(--transition);
}

.cf-foot a:hover {
    color: var(--primary);
}

.cf-form-pane {
    display: grid;
    place-items: center;
    padding: clamp(24px, 5vw, 64px);
    background: linear-gradient(135deg, var(--gray-50), var(--white));
}

.login-container.cf-card {
    width: 100%;
    max-width: 440px;
    padding: 3px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    position: relative;
}

.login-box {
    background: var(--white);
    border-radius: calc(var(--radius-xl) - 2px);
    padding: 48px 40px;
}

.cf-form-title {
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--gray-900);
}

.cf-form-sub {
    margin: 0 0 28px;
    color: var(--gray-500);
    font-size: 0.9375rem;
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    margin-bottom: 20px;
}

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

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    height: 52px;
    padding: 0 18px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--white);
    outline: none;
    transition: all var(--transition);
}

.login-form input:hover {
    border-color: var(--gray-400);
}

.login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.input-with-toggle {
    position: relative;
}

.input-with-toggle input {
    padding-right: 50px;
}

.pw-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 18px;
    color: var(--gray-400);
    transition: color var(--transition);
}

.pw-toggle:hover {
    color: var(--gray-600);
}

.pw-toggle.on {
    color: var(--primary);
}

.btn-login {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    color: var(--white);
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
    transition: all var(--transition);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.45);
}

.btn-login:active {
    transform: translateY(0);
}

.info-text {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin-top: 20px;
}

/* ============================================
   FULL PAGE LOADER
   ============================================ */
.app-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
}

.app-loader.is-visible {
    display: flex;
}

.app-loader__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 40px;
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-xl);
}

.app-loader__spinner {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

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

.app-loader__text {
    font-size: 0.9375rem;
    color: var(--gray-600);
    font-weight: 500;
}

html.is-locked,
body.is-locked {
    overflow: hidden !important;
}

/* ============================================
   FOOTER
   ============================================ */
.footer_push {
    min-height: calc(100vh - 80px);
}

.footer {
    margin-top: 20px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 20px 24px;
}

.footer .size_cloud {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 12px 0;
}

.footer .size_cloud #bar_prog {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--warning), var(--danger));
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    font-size: 0;
}

.footer small {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.footer small a {
    color: var(--primary);
    text-decoration: none;
}

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

.footer p {
    padding: 12px 0;
    font-size: 0.75rem;
    color: var(--gray-400);
    text-align: right;
    margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .cf-shell {
        grid-template-columns: 1fr;
    }

    .cf-brand {
        display: none;
    }

    .pages_layout .pannel_left {
        width: 60px;
    }

    .pages_layout .pannel_left:hover {
        width: 180px;
    }

    .pages_layout .pannel_right {
        margin-left: 60px;
        width: calc(100% - 60px);
    }

    header #nav_top form.research input {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .pages_layout .pannel_left {
        position: fixed;
        left: -200px;
        width: 200px;
        transition: left var(--transition-slow);
    }

    .pages_layout .pannel_left.is-open {
        left: 0;
    }

    .pages_layout .pannel_right {
        margin-left: 0;
        width: 100%;
    }

    header {
        padding: 0 16px;
    }

    header #nav_top form.research {
        display: none;
    }

    section {
        margin: 12px 16px;
        border-radius: var(--radius-md);
    }

    .lm-chatbot {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 80px;
    }

    .lm-chatbot-toggle {
        right: 16px;
        bottom: 16px;
        width: 52px;
        height: 52px;
    }

    .purchase-to-renew-card {
        grid-template-columns: 1fr;
        padding: 16px;
    }

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

    .popup_calendar {
        width: 95vw;
    }

    .delete_action {
        width: 90vw;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 32px 24px;
    }

    .cf-form-title {
        font-size: 1.5rem;
    }

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

    .nav_list_section li {
        padding: 0 12px;
    }

    .nav_list_section li p {
        display: none;
    }
}

/* ============================================
   LICENSE / UPGRADE PAGE
   ============================================ */
.box-upgrade {
    max-width: 700px;
    margin: 0 auto;
    padding: 32px;
    background: var(--white);
}

.box-upgrade h2 {
    margin: 0 0 24px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 12px;
}

.box-upgrade h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 2px;
}

/* Alert messaggi */
.update-alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.9375rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.update-alert::before {
    font-family: 'icomoon', sans-serif;
    font-size: 1.125rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.update-alert.success {
    background: var(--success-light);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.update-alert.success::before {
    content: '\e909';
    color: var(--success);
}

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

.update-alert.error::before {
    content: '\e90a';
    color: var(--danger);
}

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

.update-alert.warning::before {
    content: '\e90b';
    color: var(--warning);
}

.update-alert ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.update-alert ul li {
    margin: 4px 0;
}

/* Badge stato licenza */
.badge-ok,
.badge-warn,
.badge-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-ok {
    background: var(--success-light);
    color: #166534;
}

.badge-ok::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

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

.badge-warn::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
}

.badge-info {
    background: var(--info-light);
    color: #1e40af;
}

.badge-info::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--info);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Grid licenza */
.license-grid {
    margin: 24px 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.license-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
    padding: 16px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

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

.license-row:nth-child(odd) {
    background: var(--gray-50);
}

.license-k {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.license-v {
    font-size: 0.9375rem;
    color: var(--gray-800);
    word-break: break-word;
    font-family: var(--font-mono);
}

.license-note {
    grid-column: 1 / -1;
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--gray-200);
}

/* Bug Log */
.bug-log {
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.bug-log-box {
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.bug-log-box pre {
    margin: 0;
    padding: 20px 24px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-color: var(--gray-600) var(--gray-800);
}

/* Scrollbar dark theme per bug-log */
.bug-log-box pre::-webkit-scrollbar-track {
    background: var(--gray-800);
}

.bug-log-box pre::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-color: var(--gray-800);
}

.bug-log-box pre::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Bottone upgrade/verifica */
.btn-upgrade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
    transition: all var(--transition);
}

.btn-upgrade:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.45);
}

.btn-upgrade:active:not(:disabled) {
    transform: translateY(0);
}

.btn-upgrade:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Usage bars (opzionale per mostrare utilizzo) */
.usage-bar {
    margin-top: 8px;
}

.usage-bar-track {
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.usage-bar-fill.ok {
    background: var(--success);
}

.usage-bar-fill.warning {
    background: var(--warning);
}

.usage-bar-fill.danger {
    background: var(--danger);
}

.usage-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden { display: none !important; }
/* ============================================
   TOGGLE SWITCH  (.lm-toggle)
   Utilizzo:
     <label class="lm-toggle">
       <input type="checkbox" name="..." value="1">
       <span class="lm-toggle-track"></span>
       <span class="lm-toggle-label">Testo</span>
     </label>
   ============================================ */
.lm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin-top: 6px;
    padding: 2px 0;
}
.lm-toggle input[type="checkbox"] {
    display: none;
}
.lm-toggle-track {
    position: relative;
    width: 42px;
    height: 24px;
    background: var(--gray-300, #ced4da);
    border-radius: 12px;
    transition: background 0.22s ease;
    flex-shrink: 0;
}
.lm-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--white, #fff);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    transition: transform 0.22s ease;
}
.lm-toggle input[type="checkbox"]:checked + .lm-toggle-track {
    background: var(--primary, #007bff);
}
.lm-toggle input[type="checkbox"]:checked + .lm-toggle-track::after {
    transform: translateX(18px);
}
.lm-toggle-label {
    font-size: 13px;
    color: var(--text-color, #555);
    line-height: 1.3;
}

.d-none { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
