/* ═══ ARDITO PROJECT — Design System ═══════════════════════ */
/* Brand: Nero #1a1a1a + Arancione #ef6c00 | Modern UX       */

:root {
    /* Brand */
    --brand-primary: #ef6c00;
    --brand-primary-light: #fff3e0;
    --brand-primary-dark: #e65100;
    --brand-dark: #1a1a1a;
    --brand-light: #f5f5f5;
    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    /* Borders & Surfaces */
    --border-color: #e2e8f0;
    --gray-100: #f8fafc;
    --gray-200: #f1f5f9;
    --gray-300: #e2e8f0;
    --gray-400: #94a3b8;
    /* Status */
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    /* Shadows — 3 livelli */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    /* Radius */
    --radius: 10px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    /* Misc */
    --transition: 0.2s ease;
    --fs-sm: 0.85rem;
    --fs-xs: 0.75rem;
}

/* ═══ RESET ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 0.9rem; color: var(--text-primary); background: var(--brand-light); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: none; opacity: 0.85; }
img { max-width: 100%; }
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
hr { border: none; border-top: 1px solid var(--gray-200); margin: 1rem 0; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }

/* ═══ TOPBAR ═════════════════════════════════════════════ */
.topbar {
    background: var(--brand-dark);
    backdrop-filter: blur(12px);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topbar-left { flex-shrink: 0; }
.topbar-brand { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.topbar-brand:hover { text-decoration: none; color: var(--brand-primary); }
.topbar-logo { height: 32px; }

/* Hamburger: visibile solo su mobile */
.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.topbar-nav { display: flex; align-items: center; margin-left: 2rem; flex: 1; }

.topnav-item {
    padding: 0 0.85rem;
    height: 56px;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.7);
    font-size: var(--fs-sm);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
    text-decoration: none;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    white-space: nowrap;
}
.topnav-item:hover { color: #fff; text-decoration: none; border-bottom-color: rgba(255,255,255,0.3); }
.topnav-item.active { color: #fff; border-bottom-color: var(--brand-primary); }
.caret { font-size: 0.6rem; margin-left: 4px; }

.topnav-dropdown { position: relative; }
.topnav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 220px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-top: 2px solid var(--brand-primary);
    z-index: 200;
}
.topnav-dropdown.is-open .topnav-menu,
.topnav-dropdown:hover .topnav-menu { display: block; }

.topnav-menu-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: var(--fs-sm);
    text-decoration: none;
    transition: background var(--transition);
}
.topnav-menu-item:hover { background: var(--brand-primary-light); color: var(--brand-primary); text-decoration: none; }
.topnav-menu-item.active { color: var(--brand-primary); font-weight: 600; }
.topnav-separator { border-top: 1px solid var(--gray-200); margin: 4px 0; }

.topbar-right { margin-left: auto; flex-shrink: 0; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-name { font-size: var(--fs-sm); text-align: right; line-height: 1.3; }
.topbar-user-name small { display: block; font-size: var(--fs-xs); color: rgba(255,255,255,0.5); }
.topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-primary);
    color: #fff; font-weight: 700; font-size: 0.75rem;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; flex-shrink: 0;
}
.topbar-avatar:hover { background: var(--brand-primary-dark); text-decoration: none; }
.btn-logout-top {
    padding: 4px 12px; border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px; color: rgba(255,255,255,0.7); font-size: var(--fs-xs);
    text-decoration: none; transition: all var(--transition);
}
.btn-logout-top:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }

/* Icona pannello di controllo */
.topbar-icon-btn {
    background: none; border: none; color: rgba(255,255,255,0.6);
    cursor: pointer; padding: 6px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.topbar-icon-btn:hover, .topbar-icon-btn.active { color: #fff; background: rgba(255,255,255,0.1); }
.topnav-dropdown-right .topnav-menu { left: auto; right: 0; border-radius: 0 0 8px 8px; }

/* ═══ MAIN CONTENT ═══════════════════════════════════════ */
.main-topnav { padding: 1.5rem 2rem; max-width: 1200px; margin: 0 auto; }

/* ═══ CARDS ══════════════════════════════════════════════ */
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 16px; transition: box-shadow var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { font-size: 1rem; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; gap: 8px; }

/* ═══ KPI ════════════════════════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); padding: 20px; display: flex; align-items: center; gap: 16px; transition: all var(--transition); }
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.kpi-icon--orange { background: #fff3e0; color: #e65100; }
.kpi-icon--blue { background: #e3f2fd; color: #1565c0; }
.kpi-icon--green { background: #e8f5e9; color: #2e7d32; }
.kpi-icon--purple { background: #f3e5f5; color: #6a1b9a; }
.kpi-icon--red { background: #fbe9e7; color: #bf360c; }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi-label { font-size: 0.8rem; color: var(--text-secondary); }

/* ═══ BUTTONS ════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border: none; border-radius: var(--radius-sm);
    font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
    transition: all var(--transition); text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--text-secondary); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--gray-100); }
.btn-small { padding: 4px 10px; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 6px; }

/* ═══ FORMS ══════════════════════════════════════════════ */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: 4px; color: var(--text-primary); }
.form-control, select, input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="date"], input[type="time"],
input[type="url"], input[type="search"], textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); font-size: var(--fs-sm); font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: #fff;
}
.form-control:focus, select:focus, input:focus, textarea:focus {
    outline: none; border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(239, 108, 0, 0.12);
}
.form-control[readonly] { background: var(--gray-100); }
.form-row { display: flex; gap: 16px; }
.form-row > .form-group { flex: 1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--gray-200); }
.form-help { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; }

/* Autocomplete dropdown (ricerca città) */
.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    z-index: 500;
    max-height: 200px;
    overflow-y: auto;
}
.autocomplete-item {
    padding: 8px 12px;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.autocomplete-item:hover {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}
.permessi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }

/* ═══ TABLES ═════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table th { background: var(--gray-100); padding: 10px 12px; font-size: 0.8rem; font-weight: 600; text-align: left; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; border-bottom: 2px solid var(--gray-200); }
.table td { padding: 10px 12px; font-size: var(--fs-sm); border-bottom: 1px solid var(--gray-200); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table td.num { text-align: right; }
.table tbody tr:hover { background: var(--gray-100); }
.row-disabled { opacity: 0.5; }

/* ═══ BADGES ═════════════════════════════════════════════ */
.badge { display: inline-block; padding: 3px 8px; border-radius: var(--radius-xs); font-size: 0.72rem; font-weight: 600; }
.badge-success, .badge-green { background: #d4edda; color: #155724; }
.badge-danger, .badge-red { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info, .badge-blue { background: #d1ecf1; color: #0c5460; }
.badge-orange { background: #fff3e0; color: #e65100; }
.ruolo-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 600; }
.status-active { color: var(--success); font-weight: 600; font-size: var(--fs-sm); }
.status-inactive { color: var(--danger); font-weight: 600; font-size: var(--fs-sm); }

/* ═══ FLASH MESSAGES ═════════════════════════════════════ */
.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: var(--fs-sm); }
.flash-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.flash-error { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }
.flash-warning { background: #fff3cd; color: #856404; border-left: 4px solid var(--warning); }

/* ═══ MODAL ══════════════════════════════════════════════ */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.is-visible { display: flex; }
.modal-content { background: #fff; border-radius: 12px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; padding: 24px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2, .modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); padding: 0 4px; }

/* ═══ LOGIN ══════════════════════════════════════════════ */
.login-body { background: var(--brand-dark); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: #fff; border-radius: 12px; padding: 40px 32px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.login-header { text-align: center; margin-bottom: 24px; }
.login-header h1 { font-size: 1.4rem; color: var(--brand-dark); margin-bottom: 4px; }
.login-header p { color: var(--text-secondary); font-size: var(--fs-sm); }

/* ═══ DASHBOARD ══════════════════════════════════════════ */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.activity-list { max-height: 400px; overflow-y: auto; }
.activity-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gray-100); align-items: flex-start; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); flex-shrink: 0; margin-top: 6px; }
.activity-content { flex: 1; font-size: var(--fs-sm); }
.activity-time { font-size: var(--fs-xs); color: var(--text-secondary); margin-left: 4px; }

.online-users { display: flex; flex-direction: column; gap: 12px; }
.online-user { display: flex; align-items: center; gap: 12px; }
.online-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.online-info { flex: 1; }
.online-name { font-weight: 600; font-size: var(--fs-sm); }
.op-online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-link { padding: 8px 16px; background: var(--gray-100); border-radius: 6px; font-size: var(--fs-sm); color: var(--text-primary); text-decoration: none; transition: all var(--transition); }
.quick-link:hover { background: var(--brand-primary-light); color: var(--brand-primary); text-decoration: none; }

/* ═══ ACCORDION (Storico Accessi) ════════════════════════ */
.op-accordion { border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.op-accordion[open] { border-color: var(--brand-primary); }
.op-summary { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px; list-style: none; font-size: var(--fs-sm); }
.op-summary::-webkit-details-marker { display: none; }
.op-summary::before { content: '\25B6'; font-size: 0.6rem; transition: transform 0.2s; flex-shrink: 0; }
.op-accordion[open] .op-summary::before { transform: rotate(90deg); }
.op-summary-left { display: flex; align-items: center; gap: 8px; flex: 1; font-weight: 600; }
.op-summary-right { display: flex; gap: 6px; margin-left: auto; }
.op-badge { padding: 2px 8px; border-radius: 10px; font-size: var(--fs-xs); font-weight: 600; background: var(--gray-200); color: var(--text-secondary); }
.op-badge-time { background: #e3f2fd; color: #1565c0; }
.op-badge-online { background: #e8f5e9; color: #2e7d32; }
.op-sessions { padding: 0 16px 16px; }

/* ═══ TABS ═══════════════════════════════════════════════ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 16px; }
.tab { padding: 10px 20px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }

/* ═══ FLEX UTILITIES ═════════════════════════════════════ */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.section-actions { margin-top: 1rem; }

/* ═══ PIPELINE CHEVRON v4 — Track + Icons (scheda commessa) */
.pipeline-wrap {
    position: relative;
    padding: 0 4px;
}

.pipeline-chevron {
    display: flex;
    align-items: flex-start;
    padding: 12px 0 6px;
    position: relative;
}

/* Track line */
.pipeline-chevron::before {
    content: '';
    position: absolute;
    top: 32px;
    left: 28px;
    right: 28px;
    height: 2px;
    background: #e5e7eb;
    border-radius: 1px;
}

/* Step */
.chevron-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 1px;
    position: relative;
    cursor: default;
    transition: transform 0.2s ease;
    z-index: 1;
    text-align: center;
}
.chevron-step:hover { transform: translateY(-2px); }

/* Nodo con icona */
.chevron-num {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid transparent;
}

/* Icona SVG dentro il nodo */
.chevron-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.chevron-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.25s;
}

/* Numero piccolo sotto il nodo */
.chevron-step-num {
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color 0.25s;
    margin-top: -1px;
}

/* Label */
.chevron-label {
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.25;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    word-break: break-word;
    padding: 0 1px;
    transition: color 0.2s;
}

/* Connettore */
.chevron-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 21px;
    left: calc(50% + 22px);
    right: calc(-50% + 22px);
    height: 2px;
    border-radius: 1px;
    background: #e5e7eb;
    z-index: -1;
    transition: background 0.3s;
}

/* ═══ States ═══ */

/* Completato */
.chevron-step.completed .chevron-num {
    background: var(--step-color);
    border-color: var(--step-color);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--step-color) 30%, transparent);
}
.chevron-step.completed .chevron-icon svg { stroke: #fff; }
.chevron-step.completed .chevron-step-num { color: var(--step-color); }
.chevron-step.completed .chevron-label { color: var(--step-color); font-weight: 700; }
.chevron-step.completed:not(:last-child)::after { background: var(--step-color); }

/* Corrente */
.chevron-step.current .chevron-num {
    background: var(--step-color);
    border-color: var(--step-color);
    box-shadow: 0 2px 14px color-mix(in srgb, var(--step-color) 45%, transparent);
    animation: chevron-pulse 2.2s ease-in-out infinite;
}
.chevron-step.current .chevron-icon svg { stroke: #fff; }
.chevron-step.current .chevron-step-num { color: var(--step-color); font-weight: 800; }
.chevron-step.current .chevron-label { color: var(--step-color); font-weight: 700; }

/* Attenzione */
.chevron-step.attention .chevron-num {
    background: #fff3e0;
    border-color: #ffb74d;
    box-shadow: 0 2px 10px rgba(230, 81, 0, 0.2);
}
.chevron-step.attention .chevron-icon svg { stroke: #e65100; }
.chevron-step.attention .chevron-step-num { color: #e65100; }
.chevron-step.attention .chevron-label { color: #e65100; font-weight: 700; }

/* Futuro */
.chevron-step.future .chevron-num {
    background: #f3f4f6;
    border-color: #e5e7eb;
}
.chevron-step.future .chevron-icon svg { stroke: #c4c9d1; }
.chevron-step.future .chevron-step-num { color: #c4c9d1; }
.chevron-step.future .chevron-label { color: #9ca3af; }

@keyframes chevron-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); box-shadow: 0 3px 18px color-mix(in srgb, var(--step-color) 50%, transparent); }
}

/* ═══ Compact (modals) ═══ */
.pipeline-chevron.compact { padding: 8px 0 4px; }
.pipeline-chevron.compact::before { top: 22px; height: 1.5px; left: 16px; right: 16px; }
.pipeline-chevron.compact .chevron-num { width: 30px; height: 30px; border-radius: 7px; }
.pipeline-chevron.compact .chevron-icon svg { width: 14px; height: 14px; }
.pipeline-chevron.compact .chevron-step-num { font-size: 0.48rem; }
.pipeline-chevron.compact .chevron-label { font-size: 0.5rem; }
.pipeline-chevron.compact .chevron-step:not(:last-child)::after {
    top: 15px; left: calc(50% + 16px); right: calc(-50% + 16px); height: 1.5px;
}
.pipeline-chevron.compact .chevron-step { gap: 3px; }

/* ═══ PIPELINE HERO (pagina commesse) ════════════════════ */
.pipeline-hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 14px;
    padding: 20px 24px 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}
/* Texture sottile */
.pipeline-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(239,108,0,0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* Header */
.pipeline-hero-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
}
.pipeline-hero-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.85);
}
.pipeline-hero-stats {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}
.pipeline-hero-total {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--brand-primary, #ef6c00);
    font-variant-numeric: tabular-nums;
}

/* ── Pipeline track ── */
.pipeline-filter {
    display: flex;
    align-items: flex-start;
    position: relative;
}
.pipeline-filter-track {
    position: absolute;
    top: 26px;
    left: 30px;
    right: 30px;
    height: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 1px;
}
.pipeline-filter-track-glow {
    position: absolute;
    inset: -2px 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(239,108,0,0.15) 20%,
        rgba(239,108,0,0.05) 50%,
        transparent 100%);
    border-radius: 2px;
    animation: track-shimmer 4s ease-in-out infinite;
}
@keyframes track-shimmer {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ── Step ── */
.pipeline-filter-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 2px;
    position: relative;
    text-decoration: none;
    z-index: 1;
    cursor: pointer;
    animation: step-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--delay, 0s);
}
@keyframes step-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Node ── */
.pipeline-filter-node {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    backdrop-filter: blur(4px);
}

/* Icona */
.pipeline-filter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pipeline-filter-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: rgba(255,255,255,0.25);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s;
}

/* Glow dietro nodi attivi */
.pipeline-filter-glow {
    position: absolute;
    inset: -4px;
    border-radius: 16px;
    background: radial-gradient(circle, color-mix(in srgb, var(--step-color) 30%, transparent) 0%, transparent 70%);
    z-index: -1;
    animation: node-glow 3s ease-in-out infinite;
}
@keyframes node-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

/* Numero sotto il nodo, fra nodo e label */
.pipeline-filter-num {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255,255,255,0.2);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin-top: -4px;
    transition: color 0.3s;
}

/* ── Hover ── */
.pipeline-filter-step:hover .pipeline-filter-node {
    border-color: color-mix(in srgb, var(--step-color) 50%, rgba(255,255,255,0.15));
    background: color-mix(in srgb, var(--step-color) 15%, rgba(255,255,255,0.06));
    transform: translateY(-3px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--step-color) 20%, transparent);
}
.pipeline-filter-step:hover .pipeline-filter-icon {
    transform: scale(1.1);
}
.pipeline-filter-step:hover .pipeline-filter-icon svg {
    stroke: color-mix(in srgb, var(--step-color) 70%, rgba(255,255,255,0.5));
}
.pipeline-filter-step:hover .pipeline-filter-num {
    color: rgba(255,255,255,0.4);
}

/* ── Con commesse ── */
.pipeline-filter-step.has-items .pipeline-filter-node {
    background: var(--step-color);
    border-color: transparent;
    box-shadow: 0 2px 12px color-mix(in srgb, var(--step-color) 40%, transparent);
}
.pipeline-filter-step.has-items .pipeline-filter-icon svg {
    stroke: rgba(255,255,255,0.95);
}
.pipeline-filter-step.has-items .pipeline-filter-num {
    color: rgba(255,255,255,0.5);
}
.pipeline-filter-step.has-items:hover .pipeline-filter-node {
    box-shadow: 0 6px 24px color-mix(in srgb, var(--step-color) 50%, transparent);
    transform: translateY(-4px) scale(1.05);
}
.pipeline-filter-step.has-items:hover .pipeline-filter-icon svg {
    stroke: #fff;
}

/* ── Attivo ── */
.pipeline-filter-step.active .pipeline-filter-node {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 3px;
}

/* Badge */
.pipeline-filter-badge {
    position: absolute;
    top: -4px;
    right: calc(50% - 32px);
    background: var(--brand-primary, #ef6c00);
    color: #fff;
    font-size: 0.58rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(239,108,0,0.35);
}

/* Label */
.pipeline-filter-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255,255,255,0.35);
    text-align: center;
    line-height: 1.3;
    letter-spacing: 0.01em;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    word-break: break-word;
    padding: 0 1px;
    transition: color 0.3s;
}
.pipeline-filter-step:hover .pipeline-filter-label {
    color: rgba(255,255,255,0.6);
}
.pipeline-filter-step.has-items .pipeline-filter-label {
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}
.pipeline-filter-step.active .pipeline-filter-label {
    color: #fff;
    font-weight: 700;
}

/* ── Filtro attivo bar ── */
.pipeline-filter-active {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}
.pipeline-filter-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: dot-pulse 2s ease-in-out infinite;
}
@keyframes dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.pipeline-filter-active-count {
    color: rgba(255,255,255,0.35);
    font-size: 0.78rem;
}
.pipeline-filter-reset {
    margin-left: auto;
    font-size: 0.75rem;
    color: rgba(239,68,68,0.8);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}
.pipeline-filter-reset:hover {
    color: #ef4444;
}

/* ═══ SECTION ACCORDION (scheda commessa) ════════════════ */
.section-accordion { border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.section-accordion[open] { border-color: var(--section-color, var(--brand-primary)); }
.section-summary {
    padding: 14px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px;
    list-style: none; font-size: 0.9rem; font-weight: 600; background: #fff;
}
.section-summary::-webkit-details-marker { display: none; }
.section-summary::before { content: '\25B6'; font-size: 0.55rem; transition: transform 0.2s; color: var(--section-color, #999); }
.section-accordion[open] .section-summary::before { transform: rotate(90deg); }
.section-num {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--section-color, #999); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}
.section-body { padding: 16px; background: #fff; border-top: 1px solid var(--gray-200); }

/* ═══ SCHEDA COMMESSA — Layout Sidebar + Contenuto ═══════ */
.commessa-layout { display: flex; gap: 0; min-height: calc(100vh - 80px); margin: -1.5rem -2rem; }
.commessa-sidebar {
    width: 180px; min-width: 180px; background: #fff; border-right: 1px solid var(--gray-200);
    padding: 24px 0; flex-shrink: 0;
}
.commessa-main { flex: 1; padding: 20px 28px; overflow-x: hidden; }

.sidebar-area {
    display: block; padding: 11px 20px; font-size: 0.88rem; color: #666;
    text-decoration: none; border-left: 3px solid transparent;
    transition: all 0.15s; cursor: pointer;
}
.sidebar-area:hover { color: #333; background: var(--gray-100); text-decoration: none; }
.sidebar-area.active { font-weight: 700; border-left-color: var(--area-color, #ef6c00); color: var(--area-color, #ef6c00); background: color-mix(in srgb, var(--area-color, #ef6c00) 6%, #fff); }

/* Commessa info bar — come nel mockup */
.commessa-info-bar {
    display: flex; flex-wrap: wrap; padding: 14px 20px;
    background: #fafafa; border: 1px solid var(--gray-200); border-radius: 8px;
    font-size: 0.88rem; margin-bottom: 16px;
}
.commessa-info-bar .info-item { display: flex; gap: 6px; padding-right: 24px; margin-right: 24px; border-right: 1px solid var(--gray-200); }
.commessa-info-bar .info-item:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.commessa-info-bar .info-label { color: var(--text-secondary); }
.commessa-info-bar .info-value { font-weight: 700; }

/* Pipeline pillole (rettangoli arrotondati) */
.pipeline-pills { display: flex; gap: 6px; padding: 12px 0; flex-wrap: wrap; }
.pill {
    min-width: 58px; height: 44px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff;
    cursor: pointer; transition: all 0.2s; padding: 0 6px;
    border: 3px solid transparent;
}
/* Completato = verde */
.pill.completed { background: #66bb6a; }
.pill.completed:hover { background: #43a047; }
/* Corrente della commessa = colore step con glow */
.pill.current { background: var(--pill-color, #42a5f5); animation: pill-pulse 2s infinite; }
/* Visualizzato = bordo arancione grosso */
.pill.viewed { border-color: #ef6c00; box-shadow: 0 0 0 2px rgba(239,108,0,0.3); }
/* Futuro vicino = grigio */
.pill.future { background: #e0e0e0; color: #bbb; cursor: default; }
/* Futuro lontano con colore proprio (step 7-12) */
.pill.future-colored { color: #fff; cursor: default; opacity: 0.85; }

@keyframes pill-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }

/* Sezione commessa — accordion come nel mockup */
.comm-section { margin-bottom: 10px; border-radius: 10px; overflow: hidden; border: 1px solid var(--gray-200); background: #fff; }
.comm-section[open] { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.comm-section-header {
    padding: 16px 20px; display: flex; align-items: center; gap: 12px;
    font-size: 0.95rem; font-weight: 700; cursor: pointer; list-style: none;
    background: color-mix(in srgb, var(--section-color, #999) 8%, #fff);
    border-left: 4px solid var(--section-color, #999);
    color: var(--section-color, #333);
}
.comm-section-header::-webkit-details-marker { display: none; }
.comm-section-header .section-icon { font-size: 1.1rem; }
.comm-section-header .section-arrow { margin-left: auto; font-size: 0.65rem; color: var(--text-secondary); transition: transform 0.2s; }
.comm-section[open] .comm-section-header .section-arrow { transform: rotate(180deg); }
.comm-section[open] .comm-section-header { border-bottom: 1px solid var(--gray-200); }
.comm-section-body { padding: 20px; }

/* Due colonne nella sezione */
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Alert urgente */
.alert-urgente {
    background: #ef6c00; color: #fff; padding: 14px 20px; border-radius: 8px;
    font-weight: 700; font-size: 0.95rem; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

/* Banner blocco */
.blocco-banner {
    background: #e0e0e0; padding: 12px 20px; border-radius: 8px;
    display: flex; align-items: center; gap: 8px; color: #666;
    font-weight: 600; font-size: 0.88rem; margin-top: 16px;
}

/* Prerequisiti check */
.prereq-list { display: flex; gap: 16px; margin-bottom: 12px; }
.prereq-item { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.prereq-ok { color: #43a047; }
.prereq-no { color: #bbb; }

/* Allegati griglia */
.allegati-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.allegato-box {
    width: 72px; text-align: center; padding: 10px 6px; border: 1px dashed var(--gray-300);
    border-radius: 8px; font-size: 0.7rem; color: var(--text-secondary); cursor: pointer;
    transition: all 0.15s;
}
.allegato-box:hover { border-color: var(--brand-primary); background: var(--brand-primary-light); }
.allegato-icon { font-size: 1.8rem; margin-bottom: 4px; display: block; }

/* Sblocca button */
.btn-sblocca {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; background: #43a047; color: #fff;
    border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 700;
    cursor: pointer; transition: background 0.2s; margin-top: 12px;
}
.btn-sblocca:hover { background: #388e3c; }

/* ═══ MINI PIPELINE (tabella riga) ═══════════════════════ */
.mini-pipeline { display: flex; gap: 2px; margin-bottom: 2px; }
.mini-step { width: 8px; height: 8px; border-radius: 2px; }
.mini-step.current { animation: pulse 2s infinite; }

/* ═══ RESPONSIVE ═════════════════════════════════════════ */
@media (max-width: 1024px) {
    .topbar { height: 48px; padding: 0 1rem; }
    .topnav-item { padding: 0 0.6rem; height: 48px; font-size: 0.8rem; }
    .topbar-user-name { display: none; }
    .main-topnav { padding: 1rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .topbar-hamburger { display: block; }
    .topbar-nav { overflow-x: auto; }
    .topbar-right { display: none; }
    .form-row { flex-direction: column; gap: 0; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .permessi-grid { grid-template-columns: 1fr; }
}

/* ═══ Topbar icone (sole keepalive + richieste) ═══ */
.topbar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0 4px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #e0e0e0;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.topbar-icon-btn:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
.topbar-icon-btn.active { color: #ef6c00; }

.topbar-sun { color: #6b6b6b; }
.topbar-sun.is-on {
    color: #ffb020;
    filter: drop-shadow(0 0 6px rgba(255, 176, 32, .6));
}

.topbar-icon-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef6c00;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px #1a1a1a;
}

.topbar-richieste.active { color: #ef6c00; }

/* ═══ Pagina richieste ═══ */
.richieste-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.richiesta-card {
    display: block;
    padding: 16px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left: 4px solid #999;
    border-radius: 6px;
    text-decoration: none;
    color: #1a1a1a;
    transition: box-shadow .15s, transform .15s;
}
.richiesta-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    transform: translateY(-1px);
}
.richiesta-card.prio-alta  { border-left-color: #d32f2f; }
.richiesta-card.prio-media { border-left-color: #ef6c00; }
.richiesta-card.prio-bassa { border-left-color: #6b6b6b; }
.richiesta-head {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}
.richiesta-prio { font-weight: 700; letter-spacing: .5px; }
.richiesta-titolo { font-size: 15px; margin: 0 0 6px 0; line-height: 1.3; }
.richiesta-autore { font-size: 12px; color: #666; margin: 0 0 8px 0; }
.richiesta-meta { display: flex; gap: 12px; font-size: 12px; color: #666; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid #e5e5e5; margin-top: 16px; }
.tab {
    padding: 10px 18px;
    border-bottom: 2px solid transparent;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab.active { color: #ef6c00; border-bottom-color: #ef6c00; }
.tab-badge {
    background: #e5e5e5;
    color: #666;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}
.tab.active .tab-badge { background: #ef6c00; color: #fff; }

.empty-state { padding: 48px; text-align: center; color: #999; }

/* ═══ Form richieste ═══ */
.form-card {
    max-width: 720px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 24px;
}
.form-card .form-row { margin-bottom: 16px; display: flex; flex-direction: column; }
.form-card .form-row label { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #333; }
.form-card .form-row input[type="text"],
.form-card .form-row select,
.form-card .form-row textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
.form-card .form-row input:focus,
.form-card .form-row select:focus,
.form-card .form-row textarea:focus {
    outline: none;
    border-color: #ef6c00;
    box-shadow: 0 0 0 2px rgba(239, 108, 0, .15);
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.dropzone {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 24px;
    text-align: center;
    color: #666;
    background: #fafafa;
    transition: background .15s, border-color .15s;
}
.dropzone.dragover { border-color: #ef6c00; background: rgba(239,108,0,.05); }
.dropzone a { color: #ef6c00; font-weight: 600; }
.file-list { margin: 10px 0 0 0; padding: 0; list-style: none; font-size: 13px; text-align: left; }
.file-list li { padding: 4px 0; }

/* ═══ Dettaglio richiesta ═══ */
.richiesta-show {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    margin-top: 16px;
}
@media (max-width: 900px) {
    .richiesta-show { grid-template-columns: 1fr; }
}
.richiesta-body { background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; padding: 20px; }
.richiesta-testata { border-bottom: 1px solid #e5e5e5; padding-bottom: 16px; margin-bottom: 16px; }
.richiesta-descrizione { color: #333; line-height: 1.5; margin-top: 8px; }
.commenti-list { list-style: none; padding: 0; margin: 0 0 16px 0; }
.commenti-list li { padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.commento-head { display: flex; justify-content: space-between; font-size: 12px; color: #666; margin-bottom: 6px; }
.commento-body { color: #333; line-height: 1.4; }
.commento-form { margin-top: 16px; }
.commento-form textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; resize: vertical; font-family: inherit; }
.commento-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.file-inline { font-size: 12px; color: #666; flex: 1; }

.allegati-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.allegato-item {
    display: inline-flex; align-items: center; gap: 4px;
    background: #f5f5f5; padding: 6px 10px;
    border-radius: 4px; font-size: 13px;
    color: #1a1a1a; text-decoration: none;
}
.allegato-item:hover { background: #eaeaea; }
.allegato-item small { color: #999; }

.richiesta-aside { display: flex; flex-direction: column; gap: 12px; }
.aside-card { background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; padding: 16px; }
.aside-card h4 { margin: 0 0 10px 0; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: #666; }
.stato-form { display: flex; flex-direction: column; gap: 8px; }
.aside-card .stato-form + .stato-form { margin-top: 8px; }
.aside-card .btn-block { padding: 10px 16px; font-size: 14px; font-weight: 600; line-height: 1.2; }
.btn-block { width: 100%; }
.btn-success { background: #2e7d32; color: #fff; border: none; }
.btn-danger  { background: #d32f2f; color: #fff; border: none; }
.btn-sm      { padding: 6px 12px; font-size: 13px; }

.richiesta-badges { display: flex; gap: 8px; }
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
}
.badge.stato-aperta         { background: #ffebee; color: #c62828; }
.badge.stato-in_lavorazione { background: #fff3e0; color: #e65100; }
.badge.stato-risolta        { background: #e8f5e9; color: #2e7d32; }
.badge.prio-alta  { background: #ffcdd2; color: #b71c1c; }
.badge.prio-media { background: #ffe0b2; color: #e65100; }
.badge.prio-bassa { background: #e0e0e0; color: #555; }

.back-link { display: inline-block; color: #666; text-decoration: none; font-size: 13px; margin-bottom: 4px; }
.back-link:hover { color: #ef6c00; }

.empty-inline { color: #999; font-style: italic; }

.topbar-logo { height: 32px; width: auto; display: block; }
