/* ============================================================
   GioXai — Calm Tech Dashboard
   Lead UI Architect — Brutalista Dark Mode System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;800;900&display=swap');

/* ============================================================
   1. DESIGN TOKENS — CSS VARIABLES
   ============================================================ */
:root {
    /* Backgrounds */
    --bg-primary:   #0F1117;   /* Canvas principale — quasi nero */
    --bg-surface:   #1A1D27;   /* Card, panel */
    --bg-elevated:  #22263A;   /* Sidebar, modali, header */
    --bg-input:     #1E2235;   /* Input fields */
    --bg-hover:     #2A2F47;   /* Hover state su superfici */

    /* Accent — Verde Salvia luminoso */
    --accent:           #7FB37F;
    --accent-dim:       #4A6E4A;
    --accent-subtle:    rgba(127, 179, 127, 0.10);
    --accent-glow:      rgba(127, 179, 127, 0.20);

    /* Semantici */
    --danger:       #E05252;
    --danger-dim:   rgba(224, 82, 82, 0.15);
    --warning:      #D4A843;
    --warning-dim:  rgba(212, 168, 67, 0.15);
    --info:         #5A8FD4;
    --info-dim:     rgba(90, 143, 212, 0.15);
    --success:      #52A87A;
    --success-dim:  rgba(82, 168, 122, 0.15);

    /* Testo */
    --text-primary:  #E8EAF0;
    --text-secondary: #A8ABBE;
    --text-muted:    #6A6F8A;
    --text-inverse:  #0F1117;

    /* Bordi */
    --border:        rgba(255, 255, 255, 0.07);
    --border-accent: rgba(127, 179, 127, 0.30);
    --border-subtle: rgba(255, 255, 255, 0.04);

    /* Ombre */
    --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-md:  0 8px 24px rgba(0, 0, 0, 0.40);
    --shadow-lg:  0 16px 48px rgba(0, 0, 0, 0.50);

    /* Raggio angoli */
    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  20px;
    --radius-xl:  26px;

    /* Tipografia */
    --font-body: 'Nunito', sans-serif;
}

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

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
    line-height: 1.5;
}

/* ============================================================
   3. SIDEBAR
   ============================================================ */
.sidebar {
    width: 240px;
    background-color: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 28px 16px;
    flex-shrink: 0;
    overflow-y: auto;
    z-index: 10;
}

/* Logo */
.logo {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 36px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding-left: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

/* Nav menu */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--accent-dim);
}

.nav-item.active {
    background-color: var(--accent-subtle);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 900;
}

/* Nav item con badge attivo → accent border even when not active */
.nav-item.has-badge {
    border-left-color: var(--warning);
    color: var(--text-primary);
}

.nav-item.has-badge.danger-badge {
    border-left-color: var(--danger);
}

/* Separatore tra sezioni operative e sezioni di servizio */
.nav-divider {
    margin: 12px 8px;
    border: none;
    border-top: 1px solid var(--border);
}

/* Label sezione sidebar */
.nav-section-label {
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 8px 14px 4px;
}

/* Account collegati in fondo alla sidebar */
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-footer-label {
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-size: 0.68rem;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding-left: 10px;
}

#connected-accounts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Badge contatore */
.nav-badge {
    display: none;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.70rem;
    font-weight: 900;
    margin-left: auto;
    line-height: 1.4;
}

.nav-badge.warning {
    background: var(--warning);
    color: var(--text-inverse);
}

.nav-badge.danger {
    background: var(--danger);
    color: #fff;
}

/* ============================================================
   4. MAIN AREA
   ============================================================ */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 28px 36px;
    overflow-y: auto;
    min-width: 0; /* Prevent flex overflow */
}

/* ============================================================
   5. HEADER
   ============================================================ */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
}

.ai-greeting {
    background-color: var(--bg-surface);
    padding: 14px 22px;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-sm);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.account-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 800;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.account-btn:hover {
    background-color: var(--bg-hover);
    color: var(--accent);
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.account-btn .btn-label {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   6. CARDS
   ============================================================ */
.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 0.78rem;
    font-weight: 900;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

/* Card primaria — Dashboard "La tua Giornata" */
.card-primary {
    border-left: 4px solid var(--accent);
}

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

.card-primary .card-heading {
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.5px;
}

.card-primary .card-date-badge {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn-small {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: var(--font-body);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-small:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.btn-small:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Varianti semantiche */
.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}
.btn-primary:hover {
    background-color: var(--accent-dim);
    border-color: var(--accent-dim);
    color: var(--text-primary);
}

.btn-danger {
    background-color: #8A2525; /* bordeaux/rosso opaco */
    border-color: #8A2525;
    color: #ffffff;
}
.btn-danger:hover {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

.btn-warning {
    background-color: var(--warning-dim);
    border-color: var(--warning);
    color: var(--warning);
}
.btn-warning:hover {
    background-color: var(--warning);
    color: var(--text-inverse);
}

.btn-info {
    background-color: var(--info-dim);
    border-color: var(--info);
    color: var(--info);
}
.btn-info:hover {
    background-color: var(--info);
    color: #fff;
}

/* ============================================================
   8. FORM ELEMENTS
   ============================================================ */
.input-calm {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

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

.input-calm:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-calm option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ============================================================
   9. LIST UTILS
   ============================================================ */
.list-reset {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mock-content {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.mock-item {
    background-color: var(--bg-elevated);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-subtle);
    transition: border-color 0.18s ease;
}

.mock-item:hover {
    border-color: var(--border-accent);
}

/* ============================================================
   10. STATUS TEXT
   ============================================================ */
.status-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    min-height: 20px;
}

/* ============================================================
   11. DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.grid-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ============================================================
   12. DASHBOARD — TODAY APPOINTMENTS
   ============================================================ */
#today-appointments-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================================
   13. ALERT BANNER — Inbound sospette
   ============================================================ */
.alert-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--danger-dim);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: 14px 22px;
    border: 1px solid rgba(224, 82, 82, 0.25);
    font-weight: 800;
    color: var(--danger);
    margin-bottom: 20px;
}

.alert-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-banner-icon {
    font-size: 1.2rem;
}

/* ============================================================
   14. VIEW SECTIONS
   ============================================================ */
.view-section {
    display: none;
    animation: fadeIn 0.2s ease;
}

.view-section.active {
    display: block;
}

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

/* View header row — title + button */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.view-title {
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 900;
    margin: 0;
    letter-spacing: -0.3px;
}

/* ============================================================
   15. KANBAN BOARD
   ============================================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    align-items: start;
}

.kanban-column {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 16px;
    min-height: 480px;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.kanban-column-header.lead   { border-bottom: 2px solid var(--warning); }
.kanban-column-header.attivo { border-bottom: 2px solid var(--info); }
.kanban-column-header.chiuso { border-bottom: 2px solid var(--success); }

.kanban-column-title {
    font-size: 0.92rem;
    font-weight: 900;
    margin: 0;
}

.kanban-column-title.lead   { color: var(--warning); }
.kanban-column-title.attivo { color: var(--info); }
.kanban-column-title.chiuso { color: var(--success); }

.kanban-column-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Kanban Card */
.kanban-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.20s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.20s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.20s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-accent);
}

.kanban-card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.kanban-card-title:hover {
    color: var(--accent);
}

.kanban-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.kanban-badge {
    padding: 3px 9px;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kanban-badge.formazione {
    background-color: var(--info-dim);
    color: var(--info);
    border: 1px solid rgba(90, 143, 212, 0.20);
}

.kanban-badge.coaching {
    background-color: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(82, 168, 122, 0.20);
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 4px;
}

.kanban-arrow-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-secondary);
}

.kanban-arrow-btn:hover {
    background-color: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

.kanban-arrow-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    background-color: var(--bg-surface);
    color: var(--text-muted);
    border-color: var(--border);
}

/* ============================================================
   16. POSTA IN ARRIVO — Account banner
   ============================================================ */
.inbound-accounts-card {
    width: 100%;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--accent-subtle);
    border-left: 4px solid var(--accent);
    border: 1px solid var(--border-accent);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    gap: 16px;
}

.inbound-accounts-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.inbound-accounts-icon {
    font-size: 1.4rem;
}

.inbound-accounts-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}

.inbound-accounts-sub {
    margin: 2px 0 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Posta in arrivo — layout a due colonne */
.inbound-columns {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
}

.inbound-triage-col {
    flex: 1;
    min-width: 300px;
}

.inbound-mail-col {
    flex: 1.5;
    min-width: 360px;
}

/* ============================================================
   17. SCHEDA CLIENTE — Sezioni interne
   ============================================================ */
.scheda-impegno {
    font-size: 1rem;
    font-weight: 800;
    color: var(--info);
    margin-top: -10px;
    margin-bottom: 18px;
    display: none;
}

.scheda-impegno-valore {
    background: var(--info-dim);
    color: var(--info);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 900;
}

.scheda-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
}

/* Memoria Semantica (RAG) */
.rag-section {
    background: var(--bg-elevated);
    padding: 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 22px;
    border: 1px solid var(--border);
}

.rag-section-title {
    font-size: 0.82rem;
    color: var(--accent);
    margin-bottom: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.rag-input-row {
    display: flex;
    gap: 8px;
}

.rag-results {
    display: none;
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    border: 1px solid var(--border);
}

.rag-results-title {
    font-size: 0.92rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 800;
}

/* Briefing container */
.briefing-container {
    display: none;
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    border: 1px solid var(--border);
}

.briefing-title {
    font-size: 0.92rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 800;
}

/* Profilo e storico */
.scheda-profilo-box {
    display: none;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-xl);
    margin-bottom: 22px;
}

.scheda-profilo-title {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 800;
}

.scheda-profilo-content {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* Diario di Bordo */
.diario-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-xl);
    margin-bottom: 22px;
}

.diario-title {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.diario-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.diario-textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
}

.diario-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.diario-status {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ============================================================
   18. CONTABILITÀ — layout finanze
   ============================================================ */
.finance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.finance-kpi-row {
    display: flex;
    gap: 24px;
}

.finance-kpi {
    flex: 1;
}

.finance-kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.finance-kpi-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-top: 2px;
}

/* ============================================================
   19. MODALI
   ============================================================ */
.overlay-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.70);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-creazione {
    background: var(--bg-elevated);
    padding: 32px;
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 22px;
}

.modal-field-group {
    margin-bottom: 16px;
}

.modal-email-preview {
    background: var(--bg-surface);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 22px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-actions {
    display: flex;
    gap: 12px;
}

/* ============================================================
   20. TOAST NOTIFICATION
   ============================================================ */
.toast-calm {
    position: fixed;
    top: 24px; right: 24px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 14px 22px;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
    z-index: 1000;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-8px);
    max-width: 360px;
}

.toast-calm.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-calm.success { background: var(--success); border-color: var(--success); color: #ffffff; }
.toast-calm.error   { background: var(--danger);  border-color: var(--danger);  color: #ffffff; }
.toast-calm.warning { background: var(--warning); border-color: var(--warning); color: var(--text-inverse); }

/* ============================================================
   21. GOOGLE CALENDAR GRID STYLES
   ============================================================ */
.gcal-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.gcal-header {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.gcal-time-col {
    width: 60px;
    flex-shrink: 0;
}

.gcal-day {
    flex: 1;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.gcal-day.current-day .day-num {
    background-color: var(--info);
    color: #fff;
}

.gcal-day.current-day .day-name {
    color: var(--info);
}

.day-name {
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.day-num {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.gcal-body {
    display: flex;
    height: 400px;
    overflow-y: auto;
    position: relative;
}

.gcal-time-axis {
    width: 60px;
    flex-shrink: 0;
    position: relative;
}

.time-tick {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 700;
    position: absolute;
    right: 8px;
    transform: translateY(-50%);
}

.gcal-grid {
    flex: 1;
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(9, 60px);
    border-left: 1px solid var(--border);
    background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
    background-size: calc(100% / 7) 100%;
}

.gcal-grid-lines {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.grid-line {
    height: 60px;
    border-bottom: 1px solid var(--border-subtle);
    width: 100%;
}

.gcal-event {
    margin: 2px;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.72rem;
    color: #fff;
    overflow: hidden;
    position: absolute;
    z-index: 2;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    transition: width 0.15s ease, z-index 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.gcal-event:hover {
    width: 240px !important;
    z-index: 100 !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: visible;
}

.gcal-event:hover .event-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.event-title {
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.event-time {
    font-size: 0.66rem;
    opacity: 0.85;
}

.gcal-event.blue-dark  { background-color: #1a73e8; border-left-color: #1052a5; }
.gcal-event.blue-light { background-color: #4285f4; border-left-color: #1a5ac5; }
.gcal-event.blue       { background-color: #1a73e8; border-left-color: #1052a5; }
.gcal-event.green      { background-color: #0f9d58; border-left-color: #0b7240; }
.gcal-event.light-blue {
    background-color: rgba(26, 115, 232, 0.20);
    color: #4a90d9;
    border: 1px solid rgba(26, 115, 232, 0.30);
    border-left: 4px solid #1a73e8;
}

/* ============================================================
   22. EMAIL COLLAPSIBLE CONTENT
   ============================================================ */
.email-content-wrapper {
    transition: max-height 0.3s ease-out;
    position: relative;
}

.email-content-wrapper.collapsed {
    max-height: 110px;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

/* ============================================================
   23. REGISTRAZIONE VOCALE
   ============================================================ */
@keyframes recordPulse {
    0%   { transform: scale(1);   opacity: 1;   }
    50%  { transform: scale(1.35); opacity: 0.4; }
    100% { transform: scale(1);   opacity: 1;   }
}

.record-pulse-icon {
    width: 10px;
    height: 10px;
    background-color: var(--danger);
    border-radius: 50%;
    display: inline-block;
    animation: recordPulse 1.2s infinite ease-in-out;
}

.recording-box-active {
    border: 2px dashed var(--danger) !important;
    background-color: var(--danger-dim) !important;
}

/* ============================================================
   24. NUOVA SESSIONE FORM
   ============================================================ */
.nuova-sessione-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.submit-btn-wrap {
    align-self: flex-start;
}

/* ============================================================
   25. MODAL EVENTO CALENDARIO — label
   ============================================================ */
.form-label {
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-row-inline {
    display: flex;
    gap: 12px;
}

.form-field {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* ============================================================
   26. MARKDOWN CONTENT (RAG / Briefing / Diario)
   ============================================================ */
.md-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.md-content h1, .md-content h2, .md-content h3 {
    color: var(--text-primary);
    margin: 12px 0 6px;
    font-weight: 800;
}

.md-content p    { margin-bottom: 8px; }
.md-content ul   { padding-left: 18px; margin-bottom: 8px; }
.md-content li   { margin-bottom: 4px; }
.md-content code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}

/* ============================================================
   27. SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   28. RESPONSIVITÀ
   ============================================================ */

/* Tablet — 1024px */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        padding: 22px 12px;
    }

    .logo {
        font-size: 1.3rem;
        margin-bottom: 28px;
    }

    .nav-item {
        font-size: 0.88rem;
        padding: 10px 12px;
    }

    .main-area {
        padding: 22px 22px;
    }

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

    .grid-row-2 {
        grid-template-columns: 1fr;
    }
}

/* Mobile/iPad portrait — 768px */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        height: auto;
        overflow: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 14px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        gap: 8px;
    }

    .logo {
        width: 100%;
        margin-bottom: 8px;
        padding-bottom: 8px;
        font-size: 1.2rem;
    }

    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        flex: 1;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 0.82rem;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--accent);
    }

    .nav-divider, .nav-section-label, .sidebar-footer {
        display: none;
    }

    .main-area {
        padding: 16px;
        height: auto;
        overflow: visible;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .inbound-columns {
        flex-direction: column;
    }

    .grid-row-2 {
        grid-template-columns: 1fr;
    }

    .finance-kpi-row {
        flex-direction: column;
        gap: 12px;
    }

    .modal-creazione {
        padding: 22px;
    }
}

/* Small phones — 480px */
@media (max-width: 480px) {
    .ai-greeting {
        font-size: 0.88rem;
        padding: 10px 14px;
    }

    .card-primary .card-heading {
        font-size: 1.3rem;
    }

    .view-title {
        font-size: 1.1rem;
    }
}
