/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --whatsapp-green: #25D366;
    --whatsapp-teal: #128C7E;
    --google-blue: #4285F4;
    --google-red: #EA4335;
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.6;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* ===== HAMBURGER BUTTON ===== */
.hamburger-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    transform: scale(1.1);
}

.hamburger-btn i {
    font-size: 20px;
    color: var(--bg-gradient-start);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1002;
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-600);
    cursor: pointer;
}

.close-sidebar:hover {
    color: var(--google-red);
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--gray-50);
    color: var(--bg-gradient-start);
}

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

.sidebar-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
}

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

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 20px 30px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.header-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    overflow: hidden;
    position: relative;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.header-avatar i {
    z-index: 1;
}

.header-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 9px;
}

.header-text {
    text-align: center;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 5px;
}

.header-subtitle {
    font-size: 16px;
    color: var(--gray-600);
    font-weight: 500;
}

.header-icon-right {
    font-size: 40px;
    color: var(--whatsapp-green);
}

/* ===== GOOGLE AUTH ===== */
.google-auth {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.google-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.google-btn:hover {
    border-color: var(--google-blue);
    transform: translateY(-2px);
}

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

.user-info {
    display: none !important;
    align-items: center;
    gap: 12px;
}

.user-info[style*="display: flex"] {
    display: flex !important;
}

/* v3.4.9: regola unica (prima era duplicata più in basso; vinceva la 2ª con #10b981 + shadow) */
.user-profile-pic {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid #10b981;
    cursor: pointer;
    transition: all 0.2s;
    object-fit: cover;
    box-shadow: var(--shadow-md);
    display: block !important;
}

.user-profile-pic:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.logout-btn {
    background: var(--error-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.logout-btn:hover {
    background: #c53030;
    transform: scale(1.1);
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.user-info:hover {
    transform: scale(1.05);
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xl);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

/* ===== FORM ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
    font-size: 14px;
}

.label-hint {
    font-weight: 400;
    font-size: 12px;
    color: var(--gray-500);
    font-style: italic;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--whatsapp-green);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

/* ===== TOGGLE BUTTONS ===== */
.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-600);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    border-color: var(--whatsapp-green);
    background: var(--gray-50);
}

.toggle-btn.active {
    border-color: var(--whatsapp-green);
    background: var(--whatsapp-green);
    color: white;
}

/* ===== TIME INPUT ===== */
.time-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.time-btn {
    padding: 6px 10px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    color: var(--gray-600);
    font-size: 12px;
    white-space: nowrap;
}

.time-btn:hover {
    border-color: var(--whatsapp-green);
    background: var(--gray-50);
}

.time-input {
    width: 100px;
    text-align: center;
    font-weight: 600;
}

/* ===== DATE NAVIGATION ===== */
.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--whatsapp-green);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.date-nav-btn:hover {
    background: var(--whatsapp-green-dark);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.date-nav-prev {
    left: 8px;
}

.date-nav-next {
    right: 8px;
}

.date-picker {
    padding-left: 52px !important;
    padding-right: 52px !important;
    text-align: center;
}

/* ===== DATE NAVIGATION COMPACT (v2.2.40) ===== */
.date-input-wrapper-compact {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-picker-compact {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.date-nav-btn-compact {
    background: var(--whatsapp-green);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.date-nav-btn-compact:hover {
    background: var(--whatsapp-green-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.date-nav-btn-compact:active {
    transform: scale(0.95);
}

.date-picker-compact {
    flex: 1;
    padding: 10px 12px !important;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    min-width: 0;
}

/* ===== BUTTONS ===== */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
}

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

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

.btn-primary {
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-teal) 100%);
    color: white;
}

.btn-copy {
    padding: 8px 16px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-copy:hover {
    background: var(--whatsapp-green);
    border-color: var(--whatsapp-green);
    color: white;
}

/* ===== PREVIEW & OUTPUT ===== */
.preview-card {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
}

.message-preview {
    width: 100%;
    padding: 20px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    min-height: 150px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--gray-900);
    font-family: 'Inter', sans-serif;
    resize: vertical;
}

.message-preview:focus {
    outline: none;
    border-color: var(--whatsapp-green);
}

.message-output {
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--whatsapp-green);
    font-size: 15px;
    line-height: 1.7;
    color: var(--gray-900);
    white-space: pre-wrap;
}

.placeholder-text {
    color: var(--gray-400);
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* ===== LAST MESSAGE INDICATOR ===== */
.last-message-indicator {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #92400e;
}

/* ===== CRONOLOGIA ===== */
.cronologia-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cronologia-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px;
}

.cronologia-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cronologia-message {
    color: var(--gray-700);
    line-height: 1.6;
    font-size: 14px;
}

/* ===== CRONOLOGIA — selettore data + riga messaggio (v2.5.50) ===== */
.cronologia-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
}

.cronologia-toolbar label {
    font-weight: 600;
    color: var(--gray-700);
}

.cronologia-date-input {
    padding: 8px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--gray-800);
    background: #fff;
}

.cronologia-date-input:focus {
    outline: none;
    border-color: var(--bg-gradient-end);
}

.cronologia-today-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.cronologia-today-btn:hover {
    opacity: 0.9;
}

.cronologia-numero {
    font-size: 13px;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}

.cronologia-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.cronologia-badge-memo {
    background: #ede9fe;
    color: var(--bg-gradient-end);
}

.cronologia-badge-primo {
    background: #dcfce7;
    color: #166534;
}

.cronologia-actions {
    margin-bottom: 10px;
}

.cronologia-wa-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: var(--whatsapp-green);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.cronologia-wa-link:hover {
    background: var(--whatsapp-teal);
}

.cronologia-wa-missing {
    font-size: 12px;
    color: var(--gray-400);
    font-style: italic;
}

/* ===== LEAD (storico azioni per lead) ===== */
.lead-azioni {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== v2.5.74: REDESIGN SCHEDA LEAD — header avatar, ID discreto, blocchi puliti =====
   La card lead riusa .cronologia-item (deep-link + handler) ma con layout proprio: tutto è
   scoped a .lead-card per non toccare le card della cronologia messaggi (stessa classe base). */
.lead-card { padding: 14px 16px; }

/* Blocco 1 — header: avatar iniziali a sx, nome + ID e riga meta a dx */
.lead-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.lead-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ede9fe;            /* viola tenue, in linea col brand */
    color: var(--bg-gradient-end);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.lead-head-main { min-width: 0; flex: 1; }
.lead-head-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}
.lead-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-800);
}
.lead-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--gray-400);
    letter-spacing: 0.5px;
}
.lead-head-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 3px;
    font-size: 13px;
    color: var(--gray-500);
}
.lead-head-meta i { font-size: 12px; }
.lead-meta-sep { color: var(--gray-300); }

/* Blocco 2 — contatto: telefono a sx, WhatsApp (verde tenue) a dx, divider sopra */
.lead-card-contact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 0.5px solid var(--gray-200);
}
.lead-contact-phone {
    font-size: 13px;
    color: var(--gray-600);
}
.lead-contact-phone i { color: var(--gray-400); margin-right: 4px; }
.lead-card-contact .lead-wa-btn {
    margin-left: 0;
    padding: 5px 10px;
    font-size: 12px;
    background: #e1f5ee;
    color: #0f6e56;
}
.lead-card-contact .lead-wa-btn:hover { background: #cdeee1; }

/* v2.5.53: bottone WhatsApp diretto sulla card di ogni lead */
.lead-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
    padding: 3px 10px;
    background: var(--whatsapp-green);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.lead-wa-btn:hover {
    background: var(--whatsapp-teal);
}

.lead-azione {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    background: var(--gray-100);
    border-radius: 8px;
}

.lead-tipo-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #dcfce7;
    color: #166534;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.lead-azione-meta {
    font-size: 13px;
    color: var(--gray-600);
}

/* ===== FUNNEL CONFERMA LEAD — checklist 5 step (v2.5.55) ===== */
.lead-checklist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    padding: 12px;
    background: #eff6ff;            /* azzurrino: distingue il funnel dallo storico */
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}

.lead-checklist-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #1d4ed8;
    margin-bottom: 2px;
}

.lead-checklist-hint {
    padding: 1px 7px;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    cursor: help;
}

.lead-check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 8px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.lead-check-row input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #2563eb;
}

.lead-check-row .lc-label {
    flex: 1;
    font-size: 14px;
    color: var(--gray-700);
}

.lead-check-row .lc-time {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 13px;
    color: #1d4ed8;
    white-space: nowrap;
}

.lead-check-row.done {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

/* v2.5.59: riga "noshow" con bottone WhatsApp affiancato (verso il Gruppo NoShow) */
.lead-check-noshow {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.lead-check-noshow .lead-check-row {
    flex: 1;
}
.lead-noshow-wa {
    margin-left: 0;        /* annulla il margin di .lead-wa-btn: qui c'è già il gap */
    flex-shrink: 0;
    padding: 0 14px;       /* alta quanto la riga della checklist */
}

.lead-check-row.done .lc-label {
    color: #166534;
    text-decoration: line-through;
    text-decoration-color: #86efac;
}

/* v2.5.88: ORIGINE della spunta — VERDE = MANUALE (click dell'utente), BLU = AUTOMATICA (spuntata
   dal programma all'invio messaggio, autoCheckFunnelStepOnSend). Si applica SOLO agli step completati
   (.done) e li distingue via accent-color della checkbox + bordo-sinistra colorato. NON tocca lo sfondo
   verde "done" né lo stato .lead-funnel-frozen (resta read-only e coerente). Le righe legacy senza
   origine registrata ricadono su .lc-manual (verde) → nessun cambio d'aspetto a sorpresa.
   (v2.5.86 → v2.5.88: scambiati i colori, prima manuale=blu/auto=viola.) */
.lead-check-row.done.lc-manual {
    border-left: 3px solid #16a34a;   /* verde: spunta manuale (utente) */
}
.lead-check-row.done.lc-manual input[type="checkbox"] {
    accent-color: #16a34a;
}
.lead-check-row.done.lc-auto {
    border-left: 3px solid #2563eb;   /* blu: spunta automatica (programma) */
}
.lead-check-row.done.lc-auto input[type="checkbox"] {
    accent-color: #2563eb;
}

/* v2.5.88: mini-legenda sotto il titolo "Funnel conferma" (pallino verde = manuale, blu = automatico). */
.lead-check-legend {
    display: flex;
    gap: 14px;
    margin: -2px 0 2px;
    font-size: 11px;
    color: var(--gray-500);
}
.lead-check-legend .lc-leg {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.lead-check-legend .lc-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lead-check-legend .lc-leg-auto .lc-dot { background: #2563eb; }   /* blu = automatico */
.lead-check-legend .lc-leg-manual .lc-dot { background: #16a34a; } /* verde = manuale */

/* ===== FUNNEL: conferma/aggancio manuale evento (v2.5.57) ===== */
.lead-checklist-title {
    justify-content: space-between; /* titolo a sx, link "cambia" a dx */
}

.lead-checklist-tag {
    padding: 1px 7px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.lead-change-link {
    background: none;
    border: none;
    padding: 0;
    color: #2563eb;
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    text-decoration: underline;
    white-space: nowrap;
}
.lead-change-link:hover { color: #1e40af; }

.lead-suggest {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.lead-suggest-q { font-size: 13px; color: #92400e; }

.lead-suggest-actions { display: inline-flex; gap: 6px; }

.lead-btn {
    padding: 4px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 7px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.lead-btn:hover { background: var(--gray-50); }
.lead-btn-yes { background: #16a34a; border-color: #16a34a; color: #fff; }
.lead-btn-yes:hover { background: #15803d; }
.lead-btn-no { background: #fff; border-color: #fca5a5; color: #b91c1c; }
.lead-btn-no:hover { background: #fef2f2; }

.lead-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border: 1px dashed #93c5fd;
    border-radius: 8px;
}
.lead-picker[hidden] { display: none; }

.lead-picker-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.lead-picker-select {
    flex: 1;
    min-width: 180px;
    padding: 5px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 7px;
    font-size: 13px;
}

.lead-picker-dt {
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 7px;
    font-size: 13px;
}

.lead-picker-or { font-size: 12px; color: var(--gray-600); }

.lead-picker-foot { justify-content: flex-end; }

.lead-link-muted {
    background: none;
    border: none;
    padding: 0;
    color: var(--gray-500);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}
.lead-link-muted:hover { color: var(--gray-700); }

/* ===== LEAD: stato conferma a 3 valori + filtro/contatore + log azioni funnel (v2.5.67) ===== */

/* Controllo segmentato a 3 stati (Confermato / Pending / No) nell'header della card.
   Sostituisce la vecchia checkbox "Appuntamento confermato" (v2.5.61). Solo "Pending" tiene
   il funnel attivo (e fa partire le mail); Confermato e No lo congelano. */
/* v2.5.74: Blocco 3 — stato conferma. 3 bottoni piccoli inline a larghezza uguale, divider sopra. */
.lead-card .lead-status-control {
    display: flex;
    flex-wrap: wrap; /* v2.5.80: il bottone "Riavvia funnel" va a capo su riga propria */
    gap: 6px;
    margin: 12px 0;
    padding-top: 12px;
    border-top: 0.5px solid var(--gray-200);
}
.lead-card .lead-status-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    user-select: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.lead-card .lead-status-btn:hover { background: var(--gray-50); }

/* Stato attivo: sfondo tenue + bordo colorato, semantico per ciascuno dei 3 valori */
.lead-card .lead-status-btn.lead-status-confermato.active {
    background: #f0fdf4; color: #15803d; border-color: #86efac;
}
.lead-card .lead-status-btn.lead-status-pending.active {
    background: #fffbeb; color: #b45309; border-color: #fcd34d;
}
.lead-card .lead-status-btn.lead-status-no.active {
    background: #fef2f2; color: #b91c1c; border-color: #fca5a5;
}

/* v2.5.80: "🔄 Riavvia funnel" — riga propria sotto i 3 stati (compare solo a funnel congelato).
   Neutro/tratteggiato per distinguerlo dai bottoni di stato; in hover vira al blu (azione "riparti"). */
.lead-card .lead-status-btn.lead-funnel-restart {
    flex: 1 0 100%;
    color: var(--gray-600);
    border-style: dashed;
}
.lead-card .lead-status-btn.lead-funnel-restart:hover {
    background: #eff6ff; color: #1d4ed8; border-color: #93c5fd;
}

/* Tag accanto al titolo del funnel: verde "Confermato" / grigio "Non confermato" */
.lead-checklist-tag.lead-tag-confirmed {
    background: #dcfce7;
    color: #166534;
}
.lead-checklist-tag.lead-tag-no {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Funnel congelato (Confermato/No): step READ-ONLY ma ben leggibili.
   v2.5.71: niente più opacity:0.55 (che ingrigiva e "spegneva" tutto) e niente attributo `disabled`
   lato HTML. Gli step COMPLETATI restano blu (spunta bianca su blu via accent-color), quelli non
   completati restano neutri. Read-only = pointer-events:none (nessun toggle col mouse) + cursor
   default. Lo strikethrough sull'orario resta come indicatore "congelato". */
.lead-check-row.lead-funnel-frozen {
    cursor: default;
    pointer-events: none;
}
.lead-check-row.lead-funnel-frozen input[type="checkbox"] {
    cursor: default;
}
.lead-check-row.lead-funnel-frozen .lc-time {
    text-decoration: line-through;
    text-decoration-color: #9ca3af;
}

/* Barra contatore + filtro in cima alla sezione Lead */
.lead-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.lead-filter-bar:empty { display: none; }   /* nascosta finché non popolata (no login / no lead) */
.lead-filter-counts {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}
.lead-filter-sep { color: #9ca3af; }
.lead-filter-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lead-filter-btn {
    padding: 5px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
}
.lead-filter-btn:hover { background: var(--gray-50); }
.lead-filter-btn.active {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    border-color: transparent;
    color: #fff;
}

/* v2.5.73: archivio collassabile (confermati + no) sotto i pending. Sobrio/muted. */
.lead-archive {
    margin-top: 18px;
    border-top: 1px solid var(--gray-200);
    padding-top: 12px;
}
.lead-archive-summary {
    cursor: pointer;
    list-style: none;            /* via il triangolino di default */
    outline: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--gray-50);
    user-select: none;
}
.lead-archive-summary::-webkit-details-marker { display: none; }
.lead-archive-summary::before {
    content: '▸ ';
    color: var(--gray-400);
}
.lead-archive[open] > .lead-archive-summary::before { content: '▾ '; }
.lead-archive-summary:hover { color: var(--gray-700); background: var(--gray-100); }
.lead-archive-body { margin-top: 10px; }

/* Righe-azione del log generate dalle spunte del funnel (distinte dai messaggi del form) */
.lead-azione-funnel { background: #faf5ff; }
.lead-tipo-badge.lead-badge-funnel {
    background: #ede9fe;
    color: #6d28d9;
}

/* ===== IMPORTANTE ===== */
.importante-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
}

.importante-text {
    font-size: 18px;
    color: #92400e;
    text-align: center;
    font-weight: 600;
    margin-bottom: 20px;
}

.iban-copy-group {
    display: flex;
    gap: 12px;
}

.iban-field {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-600);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
}

.variabili-help {
    margin-top: 10px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.var-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.var-btn:hover {
    background: var(--whatsapp-green);
    color: white;
    border-color: var(--whatsapp-green);
}

/* ===== NOTIFICATION ===== */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    /* v2.5.75 FIX CLICK: il toast è fixed/z-index 3000 e resta SEMPRE nel DOM (opacity:0 da
       nascosto). Senza questo intercettava i click di QUALSIASI cosa gli scorresse sotto
       nell'angolo basso-destra ("alcune volte non clicco"). Un toast non si clicca mai → off. */
    pointer-events: none;
    background: var(--whatsapp-green);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 3000;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.contact-info {
    margin-top: 15px;
    padding: 12px 16px;
    background: #e8f5e9;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--whatsapp-green);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--gray-700);
}

.contact-info.error {
    background: #ffebee;
    border-left-color: var(--google-red);
}

/* ===== CALENDAR VIEW ===== */
.calendar-days {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calendar-day-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.calendar-day-header {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: white;
    padding: 16px 20px;
}

.calendar-day-header h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    text-transform: capitalize;
}

.calendar-day-stats {
    display: flex;
    gap: 15px;
    font-size: 13px;
}

.stat-pending,
.stat-contacted {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.calendar-events-list {
    padding: 10px;
}

.calendar-event-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    transition: all 0.2s;
}

.calendar-event-item:hover {
    background: var(--gray-100);
    transform: translateX(2px);
}

.calendar-event-item.contacted {
    background: #e8f5e9;
    border-left: 3px solid var(--whatsapp-green);
}

.calendar-event-item.pending {
    background: #fff3e0;
    border-left: 3px solid #ff9800;
}

.event-time {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.event-time i {
    color: var(--gray-500);
    margin-right: 4px;
}

.event-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
}

.event-name i {
    color: var(--gray-500);
    margin-right: 6px;
}

.event-status {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.calendar-event-item.contacted .event-status {
    color: #2e7d32;
}

.calendar-event-item.pending .event-status {
    color: #f57c00;
}

.event-status i {
    margin-right: 4px;
}

.calendar-selection {
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 14px;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--bg-gradient-start);
    transform: rotate(180deg);
}

.card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    body {
        padding: 15px;
    }
    
    .toggle-group {
        grid-template-columns: 1fr;
    }
    
    .time-input-group {
        justify-content: center;
    }
    
    .calendar-event-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .event-status {
        text-align: left;
    }
}

/* ===== DATE PICKER ===== */
.date-picker {
    cursor: pointer;
    padding: 12px;
    font-size: 16px;
}

.date-picker::-webkit-calendar-picker-indicator {
    cursor: pointer;
    font-size: 18px;
}

/* ===== CALENDAR CHECKBOXES ===== */
.calendar-checkboxes {
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.calendar-checkboxes label {
    font-size: 14px;
    transition: all 0.2s;
}

.calendar-checkboxes label:hover {
    background: var(--gray-100);
    padding: 4px 8px;
    border-radius: 4px;
}

.calendar-checkboxes input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* ===== CALENDAR FILTER DROPDOWN (home, v2.5.54) — multi-select compatto a riga singola ===== */
.cal-dropdown {
    position: relative;
}

.cal-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: var(--gray-700);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.cal-dropdown-trigger:hover {
    border-color: var(--gray-300, #d1d5db);
}

.cal-dropdown-trigger .fa-calendar-alt {
    color: var(--whatsapp-green);
}

.cal-dropdown-trigger .cal-dropdown-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-dropdown-chevron {
    font-size: 12px;
    color: var(--gray-500, #6b7280);
    transition: transform 0.2s;
}

.cal-dropdown-trigger.open .cal-dropdown-chevron {
    transform: rotate(180deg);
}

.cal-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    max-height: 280px;
    overflow-y: auto;
}

.cal-dropdown-menu[hidden] {
    display: none;
}

.cal-dropdown-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 8px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 4px;
}

.cal-dropdown-action {
    background: none;
    border: none;
    color: var(--whatsapp-green);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    padding: 2px 4px;
}

.cal-dropdown-action:hover {
    text-decoration: underline;
}

.cal-dropdown-sep {
    color: var(--gray-300, #d1d5db);
}

.cal-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700);
}

.cal-dropdown-item:hover {
    background: var(--gray-100);
}

.cal-dropdown-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}


/* ===== DOLCE PARANOIA - LISTA SCROLLABILE ===== */
#dolceParanoiaList {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

.dp-lead-item {
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #8b5cf6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.dp-lead-item:hover {
    background: #f9fafb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dp-lead-info {
    flex: 1;
}

.dp-lead-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.dp-lead-date {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 2px;
}

.dp-lead-meta {
    font-size: 13px;
    color: #9ca3af;
}

.btn-select-dp {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-select-dp:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.dp-empty {
    text-align: center;
    padding: 30px;
    color: #9ca3af;
    font-style: italic;
}

/* ===== 🆕 v2.5.26: GOOGLE MEET LINK ===== */
.google-meet-link {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #0f9d58 0%, #0b8043 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(15, 157, 88, 0.3);
}

.btn-meet {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    color: #0f9d58;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-meet:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 157, 88, 0.4);
    color: #0b8043;
}

.btn-meet i {
    font-size: 16px;
}

/* Link Google Meet nella HOME (calendar view) */
.event-meet {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
}

.event-meet a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0f9d58 0%, #0b8043 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(15, 157, 88, 0.3);
}

.event-meet a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 157, 88, 0.5);
}

.event-meet i {
    font-size: 14px;
}

/* ===== v2.5.29: BOTTONE + AGGIUNGI MEET (BLU) ===== */
.btn-meet-add {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    border: none;
    cursor: pointer;
}

.btn-meet-add:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

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

/* ===== v2.5.77: BOTTONE "COPIA LINK MEET" (INDACO) ===== */
/* Distinto dal verde "Apri Meet": copia SOLO l'URL nudo per il cliente. */
.btn-meet-copy {
    background: linear-gradient(135deg, #667eea 0%, #5563d6 100%) !important;
    color: white !important;
    border: none;
    cursor: pointer;
    margin-left: 8px;
}
.btn-meet-copy:hover {
    background: linear-gradient(135deg, #5563d6 0%, #4453c0 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    color: white !important;
}

/* Variante compatta nella lista eventi (Home) — è un <button>, non un <a> */
.event-meet button.event-meet-btn--copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #5563d6 100%);
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    margin-left: 8px;
}
.event-meet button.event-meet-btn--copy:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

/* ===== v2.5.64: CODICE ID LEAD + DEEP-LINK SCHEDA ===== */
/* v2.5.74: il vecchio .lead-code-badge (badge gradiente gigante, troppo invasivo) è stato
   sostituito dall'ID discreto .lead-code accanto al nome (vedi "REDESIGN SCHEDA LEAD"). */

/* Evidenziazione temporanea della card aperta da deep-link (?id=Lxxxx) */
.lead-card-highlight {
    animation: leadCardGlow 2.5s ease-out;
    box-shadow: 0 0 0 3px #667eea, 0 0 18px rgba(102, 126, 234, 0.55);
    border-radius: 12px;
}
@keyframes leadCardGlow {
    0%   { box-shadow: 0 0 0 4px #667eea, 0 0 26px rgba(102, 126, 234, 0.85); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

/* Toast leggero (es. "Lead Lxxxx non trovato") */
.lead-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(20px);
    background: var(--gray-800);
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 99999;
    max-width: 90vw;
    text-align: center;
}
.lead-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== v3.0: HOME PROSSIMI LEAD UPCOMING ===== */
.upcoming-lead-row:hover {
    background-color: var(--gray-50, #f9fafb) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgba(0,0,0,0.05));
}
.lead-list-home-wrapper .lead-card {
    margin-top: 10px;
    border: 1px solid var(--gray-200, #e5e7eb) !important;
    background: #fff !important;
    border-radius: var(--radius-lg, 0.75rem) !important;
    padding: 15px !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Accordion Prossimi Lead */
.upcoming-leads-accordion {
    background: #ffffff;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.upcoming-leads-accordion:hover {
    box-shadow: var(--shadow-md);
}
.upcoming-leads-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    font-weight: 700;
    color: #1e3a8a;
    cursor: pointer;
    user-select: none;
    outline: none;
}
/* Rimuove freccia nativa del browser */
.upcoming-leads-summary::-webkit-details-marker {
    display: none;
}
.upcoming-leads-summary {
    list-style: none;
}
.summary-arrow {
    font-size: 14px;
    color: var(--gray-400, #9ca3af);
    transition: transform 0.2s ease, color 0.2s;
}
.upcoming-leads-accordion[open] .summary-arrow {
    transform: rotate(180deg);
    color: #1e3a8a;
}
.upcoming-leads-accordion[open] {
    border-bottom-width: 1px;
}
.upcoming-leads-content {
    border-top: 1px dashed var(--gray-200, #e5e7eb);
    background-color: var(--gray-50, #f9fafb);
}

/* Weekly Date Picker (v3.0) */
.weekly-date-picker-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}
.weekly-day-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 6px 4px;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}
.weekly-day-item:hover {
    background-color: var(--gray-100, #f3f4f6);
    border-color: var(--gray-300, #d1d5db);
}
.weekly-day-active {
    background-color: var(--google-blue, #4285F4) !important;
    border-color: var(--google-blue, #4285F4) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(66, 133, 244, 0.35);
}
.weekly-day-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray-500, #6b7280);
    margin-bottom: 2px;
}
.weekly-day-active .weekly-day-label {
    color: rgba(255, 255, 255, 0.85) !important;
}
.weekly-day-num {
    font-size: 14px;
    font-weight: 700;
}

/* Compact overrides for selectors on Home Page (v3.0) */
.date-input-wrapper-compact {
    height: 38px !important;
}
.date-picker-compact {
    height: 34px !important;
    padding: 4px 6px !important;
    font-size: 14px !important;
}
.date-nav-btn-compact {
    height: 34px !important;
    width: 34px !important;
}
.cal-dropdown-trigger {
    padding: 8px 12px !important;
    font-size: 14px !important;
    height: 38px !important;
    border-width: 1px !important;
}

/* ===== GATE ACCESSO FULLSCREEN ===== */
.auth-gate-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

body.gate-active {
    overflow: hidden;
}

body.gate-active .hamburger-btn,
body.gate-active .sidebar,
body.gate-active .sidebar-overlay,
body.gate-active .container,
body.gate-active #toggleDebugBtn,
body.gate-active #authDebugPanel {
    display: none !important;
}

body.gate-active #authGateScreen {
    display: flex !important;
}

.gate-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.4s ease-out;
}

.gate-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 10px rgba(18, 140, 126, 0.3));
}

.gate-title {
    font-size: 26px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.gate-title.error-title {
    color: #ef4444;
}

.gate-version {
    font-size: 14px;
    color: #0d9488;
    font-weight: 600;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gate-description {
    font-size: 15px;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 30px;
}

.gate-description strong {
    color: white;
    word-break: break-all;
}

.gate-card .google-btn {
    margin: 0 auto;
    width: 100%;
    max-width: 280px;
    justify-content: center;
    background: white;
    color: #1e293b;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 14px 28px;
    font-size: 16px;
}

.gate-card .google-btn:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Error State / Kittens */
.gate-error-icon {
    font-size: 48px;
    color: #ef4444;
    margin-bottom: 16px;
}

.kitten-container {
    margin: 20px 0;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(239, 68, 68, 0.2);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    background: #0f172a;
    aspect-ratio: 4 / 3;
    display: flex;
    justify-content: center;
    align-items: center;
}

.kitten-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.kitten-image:hover {
    transform: scale(1.05);
}

.gate-joke {
    font-size: 13px;
    font-style: italic;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 24px;
}

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

