/* ============================================
   WORKTRACKER PRO — Stile Principale
   Estetica: Industrial-Refined / Dark Accent
   ============================================ */

:root {
    --bg-main: #0F1117;
    --bg-card: #181B24;
    --bg-card-2: #1E2130;
    --bg-sidebar: #0A0D14;
    --border: rgba(255,255,255,0.07);
    --border-hover: rgba(255,255,255,0.15);
    --accent: #6366F1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --accent-2: #EC4899;
    --text-primary: #F1F5F9;
    --text-secondary: #8892A4;
    --text-muted: #4A5568;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --sidebar-w: 240px;
    --topbar-h: 60px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --font-display: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: var(--font-body);
    background: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-mark {
    width: 36px; height: 36px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    box-shadow: 0 0 20px var(--accent-glow);
    flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-main { font-family: var(--font-display); font-weight: 700; font-size: .95rem; color: var(--text-primary); }
.logo-accent { font-family: var(--font-display); font-weight: 700; font-size: .95rem; color: var(--accent); }
.logo-sub { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 1px; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-separator { height: 1px; background: var(--border); margin: 8px 16px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
    border-left-color: rgba(99,102,241,0.5);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(99,102,241,0.1);
    border-left-color: var(--accent);
}

.nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    background: var(--accent-2);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 100px;
    min-width: 20px;
    text-align: center;
}

.nav-logout { color: var(--danger) !important; }
.nav-logout:hover { background: rgba(239,68,68,0.08) !important; border-left-color: var(--danger) !important; }

/* ══════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.topbar {
    height: var(--topbar-h);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.burger {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    display: none;
}

.page-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    flex: 1;
}

.topbar-notif {
    background: rgba(236,72,153,0.15);
    border: 1px solid rgba(236,72,153,0.3);
    color: var(--accent-2);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all var(--transition);
}
.topbar-notif:hover { background: rgba(236,72,153,0.25); }

.page-content { padding: 28px; flex: 1; }

/* ══════════════════════════════════════════
   CARDS & PANELS
══════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }

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

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-info { overflow: hidden; }
.stat-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

/* ══════════════════════════════════════════
   GRIDS & LAYOUTS
══════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.flex-row { display: flex; gap: 12px; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flex-center { display: flex; align-items: center; gap: 8px; }

/* ══════════════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.form-required { color: var(--accent-2); }

.form-control {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Color picker */
.color-picker-wrap { display: flex; align-items: center; gap: 10px; }
.form-color { width: 48px; height: 40px; padding: 2px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-main); cursor: pointer; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:hover { background: #4F52C9; box-shadow: 0 0 30px var(--accent-glow); transform: translateY(-1px); }

.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.12); }

.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-print { background: rgba(99,102,241,0.1); color: var(--accent); border: 1px solid var(--accent-glow); }
.btn-print:hover { background: rgba(99,102,241,0.2); }

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-aperto     { background: rgba(59,130,246,0.15); color: #60A5FA; border: 1px solid rgba(59,130,246,0.3); }
.badge-in-corso   { background: rgba(99,102,241,0.15); color: #818CF8; border: 1px solid rgba(99,102,241,0.3); }
.badge-sospeso    { background: rgba(245,158,11,0.15); color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.badge-completato { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.badge-annullato  { background: rgba(239,68,68,0.15);  color: #F87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-bassa      { background: rgba(100,116,139,0.15); color: #94A3B8; border: 1px solid rgba(100,116,139,0.3); }
.badge-normale    { background: rgba(59,130,246,0.15);  color: #60A5FA; border: 1px solid rgba(59,130,246,0.3); }
.badge-alta       { background: rgba(245,158,11,0.15);  color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.badge-urgente    { background: rgba(239,68,68,0.15);   color: #F87171; border: 1px solid rgba(239,68,68,0.3); }

/* ══════════════════════════════════════════
   TABELLA
══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
    background: var(--bg-card-2);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:hover td:first-child { border-left: 3px solid var(--accent); padding-left: 13px; }

/* ══════════════════════════════════════════
   TIMELINE
══════════════════════════════════════════ */
.timeline { position: relative; padding: 8px 0; }

.timeline::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-item {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    position: relative;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.timeline-dot {
    width: 58px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

.timeline-dot-inner {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    border: 2px solid var(--bg-main);
    z-index: 1;
    position: relative;
    box-shadow: 0 0 12px rgba(0,0,0,0.4);
}

.timeline-body { flex: 1; min-width: 0; }

.timeline-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    background: var(--bg-card);
}
.timeline-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow); }

.timeline-card-header {
    padding: 14px 18px 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.timeline-card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeline-meta .meta-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-secondary);
}

.meta-avatar {
    width: 20px; height: 20px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.timeline-card-body {
    padding: 0 18px 14px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.timeline-card-footer {
    padding: 10px 18px;
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip {
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-actions { display: flex; gap: 6px; }
.timeline-actions .btn { padding: 4px 10px; font-size: 0.75rem; }

.badge-privato {
    background: rgba(245,158,11,0.15);
    color: #FBBF24;
    border: 1px solid rgba(245,158,11,0.3);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 700;
}

/* Tipo badge nella timeline */
.tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* ══════════════════════════════════════════
   MODALE
══════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal.modal-lg { max-width: 820px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ══════════════════════════════════════════
   FILTRI E RICERCA
══════════════════════════════════════════ */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.search-wrap .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem; }
.search-wrap .form-control { padding-left: 36px; }

.filter-select { width: auto; min-width: 150px; }

/* ══════════════════════════════════════════
   COLORE LAVORO (barra sinistra)
══════════════════════════════════════════ */
.lavoro-row td:first-child { border-left: 4px solid transparent; }

/* ══════════════════════════════════════════
   AVANZAMENTO / PROGRESS
══════════════════════════════════════════ */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════ */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }

.toast {
    background: var(--bg-card-2);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: 0.88rem;
    max-width: 320px;
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

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

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 6px; }

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    background-image: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 60%),
                      radial-gradient(ellipse at 80% 20%, rgba(236,72,153,0.06) 0%, transparent 50%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-mark {
    width: 56px; height: 56px;
    font-size: 1.8rem;
    margin: 0 auto 12px;
}

.login-logo h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #F87171; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34D399; }

/* ══════════════════════════════════════════
   LAVORO DETAIL
══════════════════════════════════════════ */
.lavoro-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.lavoro-color-bar {
    width: 6px;
    min-height: 60px;
    border-radius: 3px;
    flex-shrink: 0;
}

.lavoro-header-info { flex: 1; }
.lavoro-codice { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.lavoro-titolo { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; margin-bottom: 10px; }
.lavoro-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.lavoro-meta { display: flex; gap: 20px; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-muted); }
.lavoro-meta strong { color: var(--text-secondary); }

/* ══════════════════════════════════════════
   STAMPA
══════════════════════════════════════════ */
@media print {
    .sidebar, .topbar, .filters-bar, .modal-overlay,
    .btn:not(.btn-noprint), .timeline-actions, .topbar-actions,
    #toast-container, .burger { display: none !important; }

    .main-content { margin-left: 0 !important; }
    body { background: white !important; color: black !important; }

    .card, .timeline-card, .lavoro-header {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .timeline-card-title, .card-title, .lavoro-titolo { color: black !important; }
    .timeline-card-body, .timeline-meta { color: #444 !important; }
    .timeline::before { background: #999 !important; }
    .badge, .tipo-badge { border: 1px solid #ccc !important; }

    .print-header {
        display: block !important;
        text-align: center;
        border-bottom: 2px solid #333;
        padding-bottom: 16px;
        margin-bottom: 24px;
    }
    .print-header h1 { font-size: 1.5rem; }
    .print-header p { color: #666; font-size: 0.85rem; }

    .no-print { display: none !important; }
    .print-only { display: block !important; }
}

.print-header { display: none; }
.print-only { display: none; }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .burger { display: flex; }
    .grid-2, .grid-3, .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
}

@media (max-width: 500px) {
    .stats-grid { grid-template-columns: 1fr; }
    .timeline::before { left: 20px; }
    .timeline-dot { width: 44px; }
    .filters-bar { flex-direction: column; }
    .filter-select { width: 100%; }
}

/* ══════════════════════════════════════════
   CONDIVISIONE
══════════════════════════════════════════ */
.badge-condiviso {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(16,185,129,0.12);
    color: #34D399;
    border: 1px solid rgba(16,185,129,0.3);
}

.condivisione-banner {
    background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(16,185,129,0.08) 100%);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.condivisione-banner strong { color: var(--accent); }

/* ══════════════════════════════════════════
   TEMA LIGHT
══════════════════════════════════════════ */
body.light {
    --bg-main:      #F0F2F5;
    --bg-card:      #FFFFFF;
    --bg-card-2:    #F8F9FB;
    --bg-sidebar:   #FFFFFF;
    --border:       rgba(0,0,0,0.09);
    --border-hover: rgba(0,0,0,0.18);
    --accent:       #6366F1;
    --accent-glow:  rgba(99,102,241,0.15);
    --accent-2:     #EC4899;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted:   #94A3B8;
    --success:      #059669;
    --warning:      #D97706;
    --danger:       #DC2626;
    --info:         #2563EB;
    --shadow:       0 4px 24px rgba(0,0,0,0.08);
}

body.light .sidebar          { box-shadow: 2px 0 12px rgba(0,0,0,0.06); }
body.light .topbar           { background: #FFFFFF; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
body.light .card:hover       { border-color: var(--border-hover); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
body.light .nav-item:hover   { background: rgba(0,0,0,0.04); }
body.light .nav-item.active  { background: rgba(99,102,241,0.08); }
body.light .form-control     { background: #F8F9FB; border-color: rgba(0,0,0,0.12); color: #0F172A; }
body.light .form-control:focus { background: #fff; border-color: var(--accent); }
body.light .btn              { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
body.light .modal-overlay    { background: rgba(0,0,0,0.35); }
body.light .modal            { background: #FFFFFF; }
body.light .toast            { background: #FFFFFF; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
body.light .stat-card        { box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
body.light ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
body.light .badge            { border: 1px solid rgba(0,0,0,0.06); }

/* Switch tema nella sidebar */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    margin: 4px 0;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    user-select: none;
    transition: color var(--transition);
}
.theme-toggle:hover { color: var(--text-primary); }

.toggle-track {
    width: 36px;
    height: 20px;
    background: var(--border-hover);
    border-radius: 10px;
    position: relative;
    transition: background var(--transition);
    flex-shrink: 0;
}
.toggle-track.on { background: var(--accent); }
.toggle-thumb {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px; left: 3px;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-track.on .toggle-thumb { transform: translateX(16px); }

/* ── TEMA LIGHT: fix select e email sidebar ── */
body.light .email-row { background: #fff; }
body.light .email-row:hover { background: #F0F2F5; }
body.light .email-row.attiva { background: rgba(99,102,241,0.1) !important; }
body.light .email-sidebar { background: #fff; border-right: 1px solid rgba(0,0,0,0.09); }
body.light .email-detail  { background: #F8F9FB; }
body.light .email-detail-header { background: #fff; }
body.light .top-bar { background: #fff; border-bottom: 1px solid rgba(0,0,0,0.09); }
body.light select { background: #fff; color: #0F172A; border-color: rgba(0,0,0,0.15); }
body.light select option { background: #fff; color: #0F172A; }

/* ── TABELLA RIGHE COMPATTE ── */
table th { padding: 10px 10px; font-size: 0.72rem; }
table td { padding: 7px 10px; }
.lavoro-row td { vertical-align: middle; }
