/* Sivis ERP - Design system */
:root {
    --primary: #0A6174;
    --primary-hover: #0d7a90;
    --primary-dark: #084d5c;
    --primary-light: rgba(10, 97, 116, 0.12);
    --danger: #dc3545;
    --danger-hover: #c82333;
    --surface: #f8fafb;
    --surface-card: #ffffff;
    --text: #1a2b33;
    --text-muted: #5f737c;
    --border: #e2e8ec;
    --sidebar-width: 280px;
    --header-height: 56px;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(10, 97, 116, 0.08);
    --shadow-lg: 0 8px 30px rgba(10, 97, 116, 0.12);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--surface);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text);
    margin-top: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

/* Main app shell: content left, sidebar right */
.app-shell {
    display: flex;
    min-height: 100vh;
    flex-direction: row;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem 2rem;
    margin-left: var(--sidebar-width);
}

/* Sidebar (left) */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.sidebar-brand {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-brand-link {
    display: block;
    border-radius: 10px;
    transition: background 0.2s, opacity 0.2s;
}

.sidebar-brand-link:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.95;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-left: 3px solid #fff;
    margin-left: 0;
    padding-left: calc(1.5rem - 3px);
}

.sidebar-nav .nav-icon {
    width: 22px;
    height: 22px;
    opacity: 0.9;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav .nav-icon svg {
    width: 20px;
    height: 20px;
}

/* Sidebar: parent item con sotto-menu */
.sidebar-nav-parent {
    margin-bottom: 0;
}

.sidebar-nav .nav-link-parent {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav .nav-link-parent:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav .nav-link-parent .nav-chevron {
    margin-left: auto;
    width: 18px;
    height: 18px;
    opacity: 0.8;
    transition: transform 0.2s;
}

.sidebar-nav .nav-link-parent.open .nav-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.sidebar-submenu.open {
    max-height: 280px;
}

.sidebar-nav .nav-link-sub {
    padding-left: calc(1.5rem + 22px + 0.75rem);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.sidebar-nav .nav-link-sub .nav-icon {
    width: 18px;
    height: 18px;
}

.sidebar-nav .nav-link-sub .nav-icon svg {
    width: 16px;
    height: 16px;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Cards */
.card-sivis {
    background: var(--surface-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

a.card-sivis {
    display: block;
    transition: box-shadow 0.2s, border-color 0.2s;
}

a.card-sivis:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* Buttons */
.btn-primary-sivis {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary-sivis:hover {
    background: var(--primary-hover);
}

.btn-primary-sivis:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary-sivis {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-secondary-sivis:hover {
    background: var(--border);
}

.btn-danger-sivis {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger-sivis:hover {
    background: #c82333;
}

/* Link-style buttons for table actions (Modifica/Elimina) */
.btn-link-sivis {
    background: transparent;
    border: 1px solid currentColor;
    color: var(--primary);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.btn-link-sivis:hover {
    background: rgba(0, 0, 0, 0.04);
}

.btn-link-sivis:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem 1.5rem;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.crud-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Full-screen popup modal */
.popup-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--surface-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.popup-fullscreen .popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.popup-fullscreen .popup-title {
    margin: 0;
    font-size: 1.25rem;
}

.popup-fullscreen .popup-close {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.popup-fullscreen .popup-close svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.5;
}

.popup-fullscreen .popup-close:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.popup-fullscreen .popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem 2rem;
}

/* Tabs */
.tabs-sivis {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tabs-sivis .tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    margin-bottom: -2px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
}

.tabs-sivis .tab-btn:hover {
    color: var(--primary);
}

.tabs-sivis .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Form inputs */
.input-sivis {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface-card);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-sivis:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-sivis::placeholder {
    color: var(--text-muted);
}

label.input-label {
    display: block;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.375rem;
    font-size: 0.9375rem;
}

/* Tables */
.table-sivis {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.table-sivis th,
.table-sivis td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table-sivis th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--surface);
}

.table-sivis.table-oda-tickets {
    font-size: calc(0.9375rem - 1px);
}

.table-sivis.table-oda-tickets th {
    font-size: calc(0.8125rem - 1px);
}

.table-sivis tbody tr:hover {
    background: var(--primary-light);
}

/* Riga contratto storico (dopo trasformazione) */
.table-sivis tbody tr.riga-storico {
    background: rgba(0, 0, 0, 0.02);
}

.table-sivis tbody tr.riga-storico:hover {
    background: var(--primary-light);
}

.table-sivis .table-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Tabella contratti – colonna Azioni con più pulsanti compatti */
.table-sivis .th-azioni {
    min-width: 320px;
    white-space: nowrap;
}

.table-sivis .td-azioni {
    vertical-align: middle;
}

.azioni-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.btn-azione {
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-azione-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-azione-secondary:hover {
    background: var(--border);
}

.btn-azione-cessazione {
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
    border-color: rgba(220, 53, 69, 0.3);
}

.btn-azione-cessazione:hover {
    background: rgba(220, 53, 69, 0.15);
}

.btn-azione-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.25);
}

.btn-azione-danger:hover {
    background: rgba(220, 53, 69, 0.2);
}

.pannello-azione-contratto {
    padding: 1rem 1.25rem;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.page-header .page-title-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

/* Dashboard – hero */
.dashboard-hero {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(10, 97, 116, 0.06) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}

.dashboard-hero-content {
    max-width: 640px;
}

.dashboard-hero-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.dashboard-hero-subtitle {
    margin: 0.35rem 0 0;
    font-size: 1rem;
    color: var(--text-muted);
}

/* Dashboard – grid layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-main {
    min-width: 0;
}

/* Dashboard – numeri chiave */
.dashboard-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.dashboard-stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    min-width: 140px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.dashboard-stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.dashboard-stat-card-muted .dashboard-stat-number {
    color: var(--text-muted);
}

.dashboard-stat-card-partial {
    border-color: #fdba74;
    background: linear-gradient(180deg, #fff7ed 0%, var(--surface-card) 100%);
}

.dashboard-stat-card-partial .dashboard-stat-number {
    color: #c2410c;
}

.dashboard-stat-card-partial .dashboard-stat-icon {
    color: #ea580c;
}

.dashboard-stat-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.dashboard-stat-icon svg {
    width: 100%;
    height: 100%;
}

.dashboard-stat-number {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.dashboard-stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Dashboard – grafici */
.dashboard-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
    .dashboard-charts-row {
        grid-template-columns: 1fr;
    }
}

.dashboard-chart-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
}

.dashboard-chart-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.dashboard-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.dashboard-bar-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-bar-label {
    font-size: 0.8125rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.dashboard-bar-track {
    height: 8px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    min-width: 60px;
}

.dashboard-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

.dashboard-bar-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 1.5rem;
    text-align: right;
}

/* Dashboard – donut */
.dashboard-donut-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.dashboard-donut {
    position: relative;
    width: 160px;
    height: 160px;
}

.dashboard-donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.dashboard-donut-bg {
    fill: none;
    stroke: var(--surface);
    stroke-width: 3.2;
}

.dashboard-donut-segment {
    fill: none;
    stroke-width: 3.2;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease-out;
}

.dashboard-donut-attuali {
    stroke: var(--primary);
}

.dashboard-donut-cessati {
    stroke: var(--text-muted);
    opacity: 0.85;
}

.dashboard-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dashboard-donut-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.dashboard-donut-total-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dashboard-donut-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.dashboard-donut-legend-item {
    font-size: 0.875rem;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dashboard-donut-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dashboard-donut-legend-dot.dashboard-donut-attuali {
    background: var(--primary);
}

.dashboard-donut-legend-dot.dashboard-donut-cessati {
    background: var(--text-muted);
}

/* Dashboard – sidebar accesso rapido */
.dashboard-sidebar {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.dashboard-sidebar-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.dashboard-quick-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dashboard-quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background 0.2s, color 0.2s;
}

.dashboard-quick-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.dashboard-quick-link-icon {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

.dashboard-quick-link-icon svg {
    width: 100%;
    height: 100%;
}

/* Users page – division switch (attuali) */
.users-division-switch-wrap {
    margin-top: 1.5rem;
}

.users-division-switch {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--surface-card);
    border: 2px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(10, 97, 116, 0.06);
}

.users-division-switch-btn {
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.users-division-switch-btn:hover {
    color: var(--text);
    background: var(--background-soft);
}

.users-division-switch-btn.active {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, white);
    box-shadow: 0 1px 4px rgba(10, 97, 116, 0.12);
}

/* Users page – search bar */
.users-search-wrap {
    margin-top: 1.5rem;
}

.users-division-switch-wrap + .users-search-wrap {
    margin-top: 1rem;
}

.users-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 520px;
    padding: 0 1rem 0 1rem;
    background: var(--surface-card);
    border: 2px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(10, 97, 116, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.users-search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.users-search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.users-search-input {
    flex: 1;
    min-width: 0;
    padding: 0.875rem 0;
    border: none;
    background: none;
    font-size: 1rem;
    color: var(--text);
    font-family: inherit;
}

.users-search-input::placeholder {
    color: var(--text-muted);
}

.users-search-input:focus {
    outline: none;
}

.users-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.users-search-clear:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.users-search-clear svg {
    width: 16px;
    height: 16px;
}

.users-search-result-hint {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Global search (layout) */
.global-search-wrap {
    position: relative;
    max-width: 560px;
    width: 100%;
    margin-bottom: 1rem;
}

.global-search-input {
    width: 100%;
    padding: 0.65rem 0.875rem 0.65rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface-card);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.global-search-input::placeholder {
    color: var(--text-muted);
}

.global-search-icon-wrap {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.global-search-icon-wrap svg {
    width: 18px;
    height: 18px;
}

.global-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
}

.global-search-result-item {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}

.global-search-result-item:last-child {
    border-bottom: none;
}

.global-search-result-item:hover {
    background: var(--primary-light);
}

.global-search-result-item .result-title {
    font-weight: 500;
    display: block;
}

.global-search-result-item .result-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.global-search-result-item .result-kind {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.2rem;
}

/* Changelog trigger icon (small, non-intrusive) */
.changelog-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.changelog-trigger:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.changelog-trigger svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 767px) {
    .global-search-wrap {
        max-width: none;
    }
}

/* Report page – filter panel */
.report-filters-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(10, 97, 116, 0.04);
}

.report-filters-panel .report-panel-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.report-type-row {
    margin-bottom: 1.5rem;
}

.report-type-row .input-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.report-type-row .input-sivis {
    max-width: 380px;
    padding: 0.625rem 2rem 0.625rem 1rem;
    font-weight: 500;
    background: var(--surface-card);
    border: 2px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.report-type-row .input-sivis:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.report-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem 1.75rem;
}

.report-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-filter-field .input-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0;
}

.report-filter-field .input-sivis {
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-card);
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.report-filter-field .input-sivis:hover {
    border-color: #c5d1d8;
}

.report-filter-field .input-sivis:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.report-filter-group {
    margin-top: 1.25rem;
}

.report-filter-group:first-child {
    margin-top: 0;
}

.report-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.report-date-presets {
    grid-column: 1 / -1;
}

.report-preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-preset-chip {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-card);
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.report-preset-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.report-preview-wrap {
    margin-top: 0.5rem;
}

.report-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.report-empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin: 0 auto 1rem;
    display: block;
}

.report-empty-title {
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
}

.report-empty-hint {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9375rem;
}

/* Report documenti: tipologie multiple (checkbox) */
.report-doc-tipologie {
    grid-column: 1 / -1;
}
.report-doc-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}
.report-doc-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
}
.report-doc-checkbox input {
    width: 1rem;
    height: 1rem;
}

/* Solo la cella Scadenza in rosso se scaduto/in scadenza */
.report-doc-cell-scaduta {
    background-color: #fef2f2;
    color: #b91c1c;
    font-weight: 600;
    border-left: 2px solid #dc2626;
}

.table-sortable .th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.table-sortable .th-sortable:hover {
    color: var(--primary);
}

.doc-scadenza-scaduto {
    color: #c53030;
    font-weight: 600;
}

.doc-scadenza-ok {
    color: var(--text-muted);
}

/* Blazor error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: #b32121;
    color: #fff;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

h1:focus {
    outline: none;
}

/* Login page */
.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    padding: 2.5rem;
}

.login-box .login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-box .login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    letter-spacing: -0.03em;
}

.login-box .login-logo p {
    margin: 0.375rem 0 0;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.login-box .form-group {
    margin-bottom: 1.25rem;
}

.login-box .btn-submit {
    width: 100%;
    padding: 0.875rem 1.5rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.login-box .btn-submit:hover {
    background: var(--primary-hover);
}

.login-box .login-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(229, 0, 0, 0.08);
    border-radius: 8px;
    color: #c00;
    font-size: 0.9375rem;
}

/* Licenza e Poligono: date inputs and displayed dates more readable */
.licenza-poligono-dates input[type="date"],
.licenza-poligono-dates input.input-sivis,
.licenza-poligono-dates .input-sivis {
    font-size: 1rem !important;
    min-width: 160px;
    padding: 0.5rem 0.6rem;
    line-height: 1.35;
}
.licenza-poligono-dates .date-range-display {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}
.licenza-poligono-dates .tiri-date-item {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}

/* ========== RESPONSIVE: tablet e telefono ========== */

/* Barra superiore mobile: hamburger + titolo (visibile solo sotto 992px) */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    z-index: 101;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.mobile-topbar .sidebar-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mobile-topbar .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.mobile-topbar .sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.mobile-topbar .mobile-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin: 0;
}

/* Overlay quando la sidebar è aperta su mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    transition: opacity 0.2s;
}

.sidebar-overlay.open {
    display: block;
}

/* Wrapper tabelle: scroll orizzontale su tutti i dispositivi */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap .table-sivis {
    min-width: 600px;
}

/* Liste lunghe (committenti, autoparco, …): scroll interno + header colonne fisso */
.list-table-scroll {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    isolation: isolate;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    margin-top: 1rem;
    max-height: clamp(14rem, calc(100dvh - 20rem), 9999px);
}

.list-table-scroll .table-sivis thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
    box-shadow: 0 1px 0 var(--border);
}

@media (max-width: 991px) {
    .list-table-scroll {
        max-height: clamp(12rem, calc(100dvh - 24rem), 9999px);
    }
}

/* Tab responsive: scroll orizzontale se molte tab */
.tabs-sivis {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}

.tabs-sivis .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 991px) {
    .app-main {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem);
    }

    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .mobile-topbar {
        display: flex;
    }
}

@media (max-width: 767px) {
    .app-main {
        padding: 0.75rem;
        padding-top: calc(var(--header-height) + 0.75rem);
    }

    .card-sivis {
        padding: 1rem;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-header h1 {
        font-size: 1.35rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .report-filters-panel {
        padding: 1rem 1.25rem;
    }

    .report-filters-grid {
        grid-template-columns: 1fr;
    }

    .report-type-row .input-sivis {
        max-width: none;
    }

    .report-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .report-actions .btn-primary-sivis,
    .report-actions .btn-secondary-sivis {
        width: 100%;
    }

    .popup-fullscreen .popup-body {
        padding: 1rem;
    }

    .popup-fullscreen .popup-header {
        padding: 0.75rem 1rem;
    }

    .crud-actions {
        flex-direction: column;
    }

    .crud-actions .btn-primary-sivis,
    .crud-actions .btn-secondary-sivis,
    .crud-actions .btn-danger-sivis {
        width: 100%;
    }

    .table-sivis th,
    .table-sivis td {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
    }

    .table-sivis .th-azioni {
        min-width: 200px;
    }

    .azioni-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-azione {
        width: 100%;
    }

    .users-search-bar {
        max-width: none;
    }

    .login-box {
        margin: 1rem;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
        padding-top: calc(var(--header-height) + 0.5rem);
    }

    .card-sivis {
        padding: 0.75rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .page-title-icon {
        width: 28px;
        height: 28px;
    }

    .btn-primary-sivis {
        width: 100%;
    }

    .report-filters-panel {
        padding: 0.75rem 1rem;
    }

    .report-preset-chips {
        flex-direction: column;
    }

    .report-preset-chip {
        width: 100%;
        text-align: center;
    }

    .table-sivis th,
    .table-sivis td {
        padding: 0.5rem 0.35rem;
        font-size: 0.8125rem;
    }
}

/* --- CRM: panoramica, contatti, form modale --- */
.crm-overview-wrap {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.crm-overview-hero {
    position: relative;
    padding: 2rem 2rem 1.75rem;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 42%, #0a8fa8 100%);
    color: #fff;
}

.crm-overview-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 100% 0%, rgba(255, 255, 255, 0.12), transparent 55%);
    pointer-events: none;
}

.crm-overview-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 720px;
}

.crm-overview-kicker {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.85;
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.crm-overview-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
}

.crm-overview-desc {
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
    opacity: 0.92;
    color: rgba(255, 255, 255, 0.95);
}

.crm-overview-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1.25rem 2rem 1.75rem;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border);
}

.crm-stat {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
}

.crm-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.crm-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.crm-modules {
    padding: 1.75rem 2rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.crm-module-card {
    display: flex;
    flex-direction: column;
    padding: 1.35rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.crm-module-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.crm-module-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.crm-module-card:hover::before {
    opacity: 1;
}

.crm-module-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.crm-module-card h2 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

.crm-module-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.crm-module-cta {
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.crm-module-card:hover .crm-module-cta {
    color: var(--primary-hover);
}

.crm-overview-footnote {
    padding: 0 2rem 1.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* Contatti: toolbar e tabella */
.crm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin: 1.25rem 0 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.crm-toolbar-field {
    flex: 1;
    min-width: 200px;
}

.crm-toolbar-field--narrow {
    flex: 0 1 200px;
    min-width: 160px;
}

.crm-search-wrap {
    position: relative;
}

.crm-search-wrap .crm-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.crm-search-wrap input.input-sivis {
    padding-left: 2.5rem;
}

.crm-contacts-table-wrap {
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-sivis.crm-contacts-table tbody tr {
    transition: background 0.15s;
}

.table-sivis.crm-contacts-table tbody tr:hover {
    background: var(--primary-light);
}

.crm-lead-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.crm-lead--new {
    background: rgba(99, 102, 241, 0.15);
    color: #4338ca;
}

.crm-lead--contacted {
    background: rgba(14, 165, 233, 0.15);
    color: #0369a1;
}

.crm-lead--qualified {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.crm-lead--customer {
    background: rgba(34, 197, 94, 0.18);
    color: #15803d;
}

.crm-lead--lost {
    background: rgba(148, 163, 184, 0.25);
    color: #475569;
}

.crm-tag-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    margin: 0 0.2rem 0.2rem 0;
    background: color-mix(in srgb, var(--tag-bg) 16%, transparent);
    color: var(--text-muted);
    border: 1px solid color-mix(in srgb, var(--tag-bg) 32%, transparent);
}

/* Form modale contatto */
.popup-fullscreen.crm-contact-popup .popup-header {
    padding: 1.25rem 1.75rem;
    border-bottom: none;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #0d7a90 100%);
    color: #fff;
}

.popup-fullscreen.crm-contact-popup .popup-title {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.popup-fullscreen.crm-contact-popup .popup-close {
    color: rgba(255, 255, 255, 0.95);
}

.popup-fullscreen.crm-contact-popup .popup-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.crm-popup-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.crm-popup-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.crm-popup-sub {
    margin: 0.2rem 0 0;
    font-size: 0.875rem;
    opacity: 0.88;
    font-weight: 400;
}

.popup-fullscreen.crm-contact-popup .popup-body {
    padding: 1.75rem 2rem 2.5rem;
    background: linear-gradient(180deg, #f0f7f9 0%, var(--surface) 120px);
}

.crm-form-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.35rem;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(10, 97, 116, 0.06);
}

.crm-form-section:last-of-type {
    margin-bottom: 0;
}

.crm-form-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1.1rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.crm-form-section-title svg {
    flex-shrink: 0;
    color: var(--primary);
    opacity: 0.95;
}

.crm-form-section .form-grid {
    gap: 0.9rem 1.25rem;
}

.crm-form-section .input-label {
    font-size: 0.8125rem;
}

.crm-tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.crm-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.crm-tag-chip:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    color: var(--text);
}

.crm-tag-chip.is-on {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: 0 0 0 1px rgba(10, 97, 116, 0.08);
}

.crm-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.crm-form-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

@media (max-width: 640px) {
    .crm-overview-hero {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .crm-overview-stats,
    .crm-modules,
    .crm-overview-footnote {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .popup-fullscreen.crm-contact-popup .popup-body {
        padding: 1.25rem 1rem 2rem;
    }
}

/* Template email CRM */
.crm-templates-table-wrap {
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-sivis.crm-templates-table tbody tr {
    transition: background 0.15s;
}

.table-sivis.crm-templates-table tbody tr:hover {
    background: var(--primary-light);
}

.crm-template-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 980px) {
    .crm-template-editor-grid {
        grid-template-columns: 1fr;
    }
}

.crm-template-token-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.crm-template-token-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.6rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.crm-template-token-chip code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    color: var(--text);
}

.crm-email-preview-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-card);
    padding: 1rem;
}

.crm-email-preview-body {
    border: 1px dashed color-mix(in srgb, var(--primary) 25%, var(--border));
    background: color-mix(in srgb, var(--primary-light) 18%, var(--surface));
    padding: 0.75rem;
    border-radius: 8px;
}

.crm-email-preview-iframe {
    display: block;
    width: 100%;
    min-height: 420px;
    border: 0;
    border-radius: 6px;
    background: #fff;
}

.crm-email-preview-body p {
    margin: 0 0 0.5rem;
}

/* CRM email template — editor costruttore */
.crm-editor-mode-switch {
    display: inline-flex;
    padding: 4px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
    border: 1px solid var(--border);
    gap: 4px;
    margin-bottom: 1.25rem;
}

.crm-editor-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.crm-editor-mode-btn:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.crm-editor-mode-btn.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 75%, #0a1f3d) 100%);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 35%, transparent);
}

.crm-editor-mode-icon {
    font-size: 0.95rem;
    opacity: 0.9;
}

.crm-email-builder {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-card);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.crm-email-builder-toolbar {
    padding: 1rem 1rem 0.75rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary-light) 55%, var(--surface)) 0%, var(--surface-card) 100%);
    border-bottom: 1px solid var(--border);
}

.crm-email-builder-toolbar-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.crm-email-builder-add-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.crm-mini-btn {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.8125rem !important;
}

.crm-email-builder-empty {
    margin: 0;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.crm-email-builder-list {
    list-style: none;
    margin: 0;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.crm-email-builder-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--border) 80%, transparent);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.crm-email-builder-card:hover {
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 12%, transparent);
}

.crm-email-builder-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary-light) 35%, var(--surface));
}

.crm-email-builder-drag {
    cursor: grab;
    user-select: none;
    color: var(--text-muted);
    font-weight: 800;
    letter-spacing: -2px;
    padding: 0 0.15rem;
}

.crm-email-builder-kind {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary);
}

.crm-email-builder-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
}

.crm-email-builder-remove {
    color: var(--danger) !important;
}

.crm-email-builder-card-body {
    padding: 0.85rem 0.75rem 1rem;
}

.crm-bgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.65rem;
}

.crm-bgrid .full-width {
    grid-column: 1 / -1;
}

.crm-email-builder-textarea {
    min-height: 88px;
    resize: vertical;
    font-family: inherit;
}

.crm-align-row {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.crm-email-builder-muted {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.crm-input-file {
    font-size: 0.875rem;
}

.crm-input-file-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.crm-color-input {
    width: 100%;
    max-width: 120px;
    height: 40px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--surface);
}

.crm-multi-cta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crm-multi-cta-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

@media (max-width: 640px) {
    .crm-multi-cta-row {
        grid-template-columns: 1fr;
    }
}

.crm-html-editor-wrap {
    margin-top: 0.5rem;
}

.crm-html-monospace {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.crm-html-editor-hint {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.crm-token-copy {
    cursor: pointer;
    border: none;
    background: var(--surface);
}

.crm-token-copy:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.popup-fullscreen.crm-email-template-popup .popup-body {
    max-width: 1100px;
    margin: 0 auto;
}

/* CRM email — Quill (editor stile Word) */
.crm-quill-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow);
}

.crm-quill-host .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary-light) 40%, var(--surface));
    font-family: inherit;
}

.crm-quill-host .ql-container.ql-snow {
    border: none;
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    font-size: 1rem;
    min-height: 280px;
}

.crm-quill-host .ql-editor {
    min-height: 260px;
    line-height: 1.55;
    color: #1e293b;
}

.crm-quill-host .ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
}

.crm-quill-host .ql-snow .ql-picker.ql-expanded .ql-picker-options {
    border-radius: 8px;
    border-color: var(--border);
    box-shadow: var(--shadow);
}

/* GrapesJS visual builder (riusa host crm-quill-host) */
.crm-quill-host .gjs-editor {
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

.crm-quill-host .gjs-cv-canvas {
    background: #f3f7f9;
}

.crm-quill-host .gjs-pn-btn.gjs-pn-active {
    background: var(--primary);
    color: #fff;
}

.crm-quill-host .gjs-block {
    min-height: 70px;
}

.crm-quill-hint {
    margin: 0;
    padding: 0.5rem 0.75rem 0.65rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--primary-light) 22%, var(--surface));
    border-top: 1px solid var(--border);
}

.signature-pad-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10040;
}

.modulo-pdf-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10030;
    background: rgba(0, 0, 0, 0.35);
}

.modulo-pdf-preview-modal.popup-fullscreen {
    position: fixed;
    inset: 1.25rem;
    z-index: 10031;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: min(1100px, calc(100vw - 2.5rem));
    max-height: calc(100vh - 2.5rem);
    margin: auto;
}

.modulo-pdf-preview-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modulo-pdf-preview-hint {
    margin: 0 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.modulo-pdf-preview-status {
    margin: 1rem 0;
    color: var(--text-muted);
}

.modulo-pdf-preview-error {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--error, #c0392b) 35%, var(--border));
    background: color-mix(in srgb, var(--error, #c0392b) 8%, var(--surface));
    color: var(--error, #c0392b);
}

.modulo-pdf-preview-ready {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 12rem;
    padding: 2rem 1.5rem;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--primary, #2563eb) 4%, var(--surface));
}

.modulo-pdf-preview-ready-icon {
    color: var(--primary, #2563eb);
    margin-bottom: 0.75rem;
}

.modulo-pdf-preview-ready-title {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.modulo-pdf-preview-ready-text {
    margin: 0 0 1.25rem;
    max-width: 28rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.modulo-pdf-preview-open-btn {
    min-width: 12rem;
}

.modulo-pdf-preview-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.signature-pad-dialog {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10041;
    max-width: min(92vw, 760px);
    width: 100%;
    padding: 1.25rem 1.5rem 1.5rem;
    box-shadow: var(--shadow-lg);
}

.signature-pad-canvas {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    touch-action: none;
}

/* —— Giri incasso ATM (elenco /incasso-atm/giri) —— */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.giri-incasso {
    margin-top: 1rem;
}

.giri-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 960px) {
    .giri-toolbar {
        flex-direction: row;
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .giri-search-wrap {
        flex: 1;
        min-width: 280px;
        max-width: 480px;
    }
}

.giri-search-input {
    width: 100%;
}

.giri-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.giri-toolbar-export {
    margin-left: auto;
    flex-shrink: 0;
}

@media (max-width: 959px) {
    .giri-toolbar-export {
        width: 100%;
        margin-left: 0;
        margin-top: 0.35rem;
    }

    .giri-export-btn {
        width: 100%;
    }
}

.giri-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-card, var(--surface));
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.giri-chip:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: var(--primary-light);
}

.giri-chip:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.giri-chip-active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary-light) 50%, var(--surface));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
}

.giri-chip-count {
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text) 8%, transparent);
}

.giri-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
    background: var(--surface-card, var(--surface));
}

.giri-rounds-table {
    min-width: 920px;
}

.giri-rounds-table .th-azioni {
    min-width: 200px;
}

.giri-col-narrow {
    max-width: 11rem;
}

.giri-cell-date-main {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.giri-cell-date-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-top: 0.2rem;
    line-height: 1.3;
}

.giri-cell-id {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.giri-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1.2;
}

.giri-status-draft {
    background: #e2e8f0;
    color: #334155;
}

.giri-status-confirmed {
    background: #dbeafe;
    color: #1e40af;
}

.giri-status-progress {
    background: #e0f2fe;
    color: #0369a1;
}

.giri-status-completed {
    background: #d1fae5;
    color: #065f46;
}

.giri-status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.giri-status-unknown {
    background: #f1f5f9;
    color: #475569;
}

.giri-rounds-table tbody tr.giri-row td:first-child {
    border-left: 4px solid transparent;
}

.giri-rounds-table tbody tr.giri-row-draft td:first-child {
    border-left-color: #64748b;
}

.giri-rounds-table tbody tr.giri-row-confirmed td:first-child {
    border-left-color: #2563eb;
}

.giri-rounds-table tbody tr.giri-row-progress td:first-child {
    border-left-color: #0284c7;
}

.giri-rounds-table tbody tr.giri-row-completed td:first-child {
    border-left-color: #059669;
}

.giri-rounds-table tbody tr.giri-row-cancelled td:first-child {
    border-left-color: #dc2626;
}

.giri-vehicle-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
}

.giri-vehicle-plate {
    font-weight: 600;
}

.giri-vehicle-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.giri-col-points {
    text-align: center;
    vertical-align: middle;
}

.giri-points-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.giri-points-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
}

.giri-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
    align-items: center;
}

.giri-action-confirm {
    color: #15803d !important;
    font-weight: 600;
}

.giri-action-danger {
    font-weight: 600;
}

.giri-empty-cell {
    text-align: center;
    padding: 2.25rem 1.25rem !important;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* Ordinamento colonne (desktop) */
.giri-th-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.8125rem;
    cursor: pointer;
    text-align: left;
    max-width: 100%;
}

.giri-th-sort:hover {
    color: var(--primary);
}

.giri-sort-ind {
    font-size: 0.7rem;
    opacity: 0.75;
    font-weight: 700;
}

.giri-table-desktop {
    display: block;
}

.giri-cards-mobile {
    display: none;
}

@media (max-width: 768px) {
    .giri-table-desktop {
        display: none !important;
    }

    .giri-cards-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .giri-mobile-sort-hint {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
        padding: 0.65rem 0.75rem;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--surface-card, var(--surface));
        margin-bottom: 0.25rem;
    }

    .giri-mobile-sort-label {
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--text-muted);
    }

    .giri-mobile-sort-select {
        flex: 1;
        min-width: 140px;
    }

    .giri-mobile-sort-dir {
        font-size: 0.8125rem;
        padding: 0.4rem 0.65rem;
    }
}

.giri-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1rem 0.85rem;
    background: var(--surface-card, var(--surface));
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    border-left-width: 4px;
    border-left-color: var(--border);
}

.giri-card.giri-row-draft {
    border-left-color: #64748b;
}

.giri-card.giri-row-confirmed {
    border-left-color: #2563eb;
}

.giri-card.giri-row-progress {
    border-left-color: #0284c7;
}

.giri-card.giri-row-completed {
    border-left-color: #059669;
}

.giri-card.giri-row-cancelled {
    border-left-color: #dc2626;
}

.giri-card-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem 1rem;
}

.giri-card-empty p {
    margin: 0;
}

.giri-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.giri-card-date-main {
    font-weight: 700;
    font-size: 1.05rem;
}

.giri-card-date-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-top: 0.15rem;
}

.giri-card-dl {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.giri-card-dl > div {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0.5rem;
    align-items: baseline;
}

.giri-card-dl dt {
    margin: 0;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.giri-card-dl dd {
    margin: 0;
    word-break: break-word;
}

.giri-card-inline {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.giri-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    align-items: center;
}

/* Modifica giro — layout e registro attività */
.popup-fullscreen.giri-popup-edit {
    background: linear-gradient(165deg, color-mix(in srgb, var(--primary) 6%, var(--surface-card)) 0%, var(--surface-card) 42%, var(--surface) 100%);
}

.giri-edit-popup-header {
    border-bottom: none;
    background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 12%, transparent), transparent);
    padding-block: 1.1rem;
}

.giri-edit-popup-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.giri-edit-popup-kicker {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 36rem;
    line-height: 1.45;
}

.giri-edit-id-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.5rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    background: color-mix(in srgb, var(--primary) 18%, var(--surface));
    color: var(--primary);
}

.giri-edit-popup-body {
    padding-top: 1rem;
}

.giri-form-shell {
    display: block;
}

.giri-form-shell--split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(340px, 34vw);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .giri-form-shell--split {
        grid-template-columns: 1fr;
    }
}

.giri-edit-form-grid {
    gap: 1rem 1.25rem;
}

.giri-edit-section-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 1.5rem 0 0.6rem;
    letter-spacing: -0.01em;
}

.giri-point-search-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.giri-point-search-input {
    flex: 1;
    min-width: 200px;
}

.giri-search-results {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-card, var(--surface));
}

.giri-search-result-row {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.giri-search-result-row:last-child {
    border-bottom: none;
}

.giri-edit-empty-hint {
    color: var(--text-muted);
    margin: 0.5rem 0 0;
}

.giri-stops-list {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.giri-stop-card {
    border: 1px solid color-mix(in srgb, var(--border) 80%, var(--primary) 8%);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    background: var(--surface-card, var(--surface));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.giri-stop-card-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}

.giri-stop-field-status {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8125rem;
    line-height: 1;
    user-select: none;
}

.giri-stop-field-status--done {
    background: #d3f9d8;
    color: #2b8a3e;
    border: 1px solid #8ce99a;
}

.giri-stop-field-status--todo {
    background: #ffe3e3;
    color: #c92a2a;
    border: 1px solid #ffa8a8;
}

.giri-stop-field-status--pending {
    background: #fff3bf;
    color: #e67700;
    border: 1px solid #ffd43b;
}

.giri-stop-field-status--unsaved {
    background: var(--surface-muted, #f1f3f5);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
}

.giri-stop-card-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.giri-stop-atm-code {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
}

.giri-stop-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    align-items: center;
}

.giri-stop-remove {
    color: var(--danger) !important;
}

.giri-stop-fields {
    display: grid;
    gap: 0.55rem;
    max-width: 520px;
}

.giri-intervention-textarea {
    min-height: 4rem;
}

.giri-intervention-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0.25rem 0 0;
}

.giri-form-error {
    margin-top: 1rem;
}

.giri-form-actions {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.giri-field-log {
    position: sticky;
    top: 0.5rem;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, var(--surface-card)), var(--surface-card));
    padding: 1rem 1rem 0.85rem;
    max-height: min(72vh, 640px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

@media (max-width: 1100px) {
    .giri-field-log {
        position: static;
        max-height: none;
    }
}

.giri-field-log-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}

.giri-field-log-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.giri-field-log-desc {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.giri-field-log-empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.giri-field-log-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.giri-field-log-item {
    padding: 0.55rem 0.6rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--text) 4%, transparent);
    border-left: 3px solid var(--border);
}

.giri-field-log-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.giri-field-log-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    background: color-mix(in srgb, var(--text) 6%, var(--surface));
    color: var(--text);
}

.giri-field-log-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.giri-field-log-summary {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.4;
    word-break: break-word;
}

.giri-field-log-user {
    margin: 0.25rem 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.giri-field-log-item.giri-log-row-bolgetta {
    border-left-color: #7c3aed;
    background: color-mix(in srgb, #7c3aed 9%, var(--surface-card, var(--surface)));
}

.giri-field-log-item.giri-log-row-plico {
    border-left-color: #0d9488;
    background: color-mix(in srgb, #14b8a6 9%, var(--surface-card, var(--surface)));
}

.giri-field-log-item.giri-log-row-stop {
    border-left-color: #2563eb;
    background: color-mix(in srgb, #3b82f6 9%, var(--surface-card, var(--surface)));
}

.giri-field-log-item.giri-log-row-warn {
    border-left-color: #ea580c;
    background: color-mix(in srgb, #f97316 10%, var(--surface-card, var(--surface)));
}

.giri-field-log-item.giri-log-row-done {
    border-left-color: #059669;
    background: color-mix(in srgb, #10b981 11%, var(--surface-card, var(--surface)));
}

.giri-field-log-item.giri-log-row-photo {
    border-left-color: #db2777;
    background: color-mix(in srgb, #ec4899 9%, var(--surface-card, var(--surface)));
}

.giri-field-log-item.giri-log-row-default {
    border-left-color: var(--border);
}

/* Searchable dropdown (Giri form: GPG, veicoli) */
.sivis-searchable-select {
    position: relative;
    width: 100%;
}

.sivis-searchable-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.sivis-searchable-select-trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sivis-searchable-select-placeholder {
    color: var(--text-muted);
}

.sivis-searchable-select-chevron {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1;
}

.sivis-searchable-select-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--surface-card, var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
}

.sivis-searchable-select-search {
    width: 100%;
    flex-shrink: 0;
}

.sivis-searchable-select-list {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    max-height: min(220px, 36vh);
}

.sivis-searchable-select-option {
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.35;
}

.sivis-searchable-select-option:hover {
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.sivis-searchable-select-option-selected {
    background: color-mix(in srgb, var(--primary) 18%, var(--surface));
    font-weight: 600;
}

.sivis-searchable-select-empty {
    padding: 0.5rem 0.35rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.workflow-analytics-filters {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}

.workflow-analytics-kpis {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: .8rem;
	margin-top: 1rem;
}

.workflow-analytics-kpi {
	background: #fff;
	border: 1px solid var(--border-color);
	border-radius: 12px;
	padding: .85rem 1rem;
}

.workflow-analytics-kpi-title {
	margin: 0;
	font-size: .84rem;
	color: var(--text-muted);
}

.workflow-analytics-kpi-value {
	margin: .25rem 0 0;
	font-size: 1.55rem;
	font-weight: 700;
}

.workflow-analytics-kpi-sub {
	margin: .15rem 0 0;
	font-size: .88rem;
	color: var(--text-muted);
}

.workflow-analytics-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}

.workflow-analytics-card {
	background: #fff;
	border: 1px solid var(--border-color);
	border-radius: 12px;
	padding: .9rem;
}

.workflow-analytics-card h3 {
	margin: 0 0 .65rem 0;
	font-size: 1rem;
}

.workflow-chart-svg {
	width: 100%;
	height: 240px;
}

.workflow-chart-axis {
	stroke: #98a5b3;
	stroke-width: 1.2;
}

.workflow-chart-grid {
	stroke: #e8edf2;
	stroke-width: 1;
}

.workflow-chart-line {
	fill: none;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.workflow-chart-line-sent { stroke: var(--primary); }
.workflow-chart-line-open { stroke: #2f9e44; }
.workflow-chart-line-click { stroke: #f08c00; }

.workflow-chart-legend {
	display: flex;
	gap: .9rem;
	font-size: .84rem;
	color: var(--text-muted);
}

.workflow-chart-legend .dot {
	width: 9px;
	height: 9px;
	border-radius: 999px;
	display: inline-block;
	margin-right: .35rem;
}

.workflow-chart-legend .dot.sent { background: var(--primary); }
.workflow-chart-legend .dot.open { background: #2f9e44; }
.workflow-chart-legend .dot.click { background: #f08c00; }

.workflow-rates-wrap {
	display: grid;
	grid-template-columns: 84px 1fr;
	gap: .8rem;
	align-items: center;
	margin-bottom: .7rem;
}

.workflow-rate-ring {
	width: 78px;
	height: 78px;
	border-radius: 999px;
	display: grid;
	place-items: center;
}

.workflow-rate-ring-inner {
	width: 56px;
	height: 56px;
	background: #fff;
	border-radius: 999px;
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: .84rem;
}

.workflow-bar-row {
	display: grid;
	grid-template-columns: 36px 1fr auto;
	gap: .6rem;
	align-items: center;
	margin-bottom: .45rem;
}

.workflow-bar-track {
	height: 12px;
	background: #edf2f7;
	border-radius: 999px;
	overflow: hidden;
}

.workflow-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--primary), #35a0bb);
}

.workflow-heatmap-wrap {
	display: grid;
	grid-template-columns: 42px repeat(24, 1fr);
	gap: 4px;
}

.workflow-heatmap-axis {
	font-size: .68rem;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 18px;
}

.workflow-heatmap-cell {
	height: 16px;
	border-radius: 3px;
	background: rgba(10, 97, 116, .12);
}

.workflow-top-link-row {
	display: flex;
	justify-content: space-between;
	gap: .7rem;
	padding: .45rem 0;
	border-top: 1px solid var(--border-color);
}

.workflow-top-link-row span {
	color: var(--text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.workflow-analytics-detail-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}

.workflow-analytics-table-wrap {
	overflow: auto;
	max-height: 420px;
	border: 1px solid var(--border-color);
	border-radius: 10px;
}

.workflow-analytics-detail-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.workflow-analytics-detail-table th,
.workflow-analytics-detail-table td {
	padding: 0.45rem 0.55rem;
	text-align: left;
	border-bottom: 1px solid var(--border-color);
	vertical-align: top;
}

.workflow-analytics-detail-table th {
	position: sticky;
	top: 0;
	background: #f6f8fb;
	z-index: 1;
	font-weight: 600;
	color: var(--text-muted);
}

.workflow-analytics-detail-table tr:last-child td {
	border-bottom: none;
}

.workflow-analytics-kpi.workflow-analytics-kpi--bounce-hard .workflow-analytics-kpi-value {
	color: #c92a2a;
}

.workflow-analytics-kpi.workflow-analytics-kpi--bounce-soft .workflow-analytics-kpi-value {
	color: #e67700;
}

.crm-contact-analytics-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 0.75rem;
	margin: 0 0 1rem;
}

.crm-contact-analytics-stat {
	background: var(--surface, #f6f8fb);
	border: 1px solid var(--border-color);
	border-radius: 10px;
	padding: 0.65rem 0.85rem;
}

.crm-contact-analytics-stat strong {
	display: block;
	font-size: 1.25rem;
	margin-top: 0.15rem;
}

.oda-order-status-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.32rem 0.7rem;
	border-radius: 999px;
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
	line-height: 1.2;
}

.oda-order-status-draft {
	background: #fef3c7;
	color: #92400e;
}

.oda-order-status-sent {
	background: #dbeafe;
	color: #1e40af;
}

.oda-order-status-partial {
	background: #ffedd5;
	color: #c2410c;
}

.oda-order-status-completed {
	background: #d1fae5;
	color: #065f46;
}

.oda-order-status-cancelled {
	background: #fee2e2;
	color: #991b1b;
}

.skill-check-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	margin-top: 0.35rem;
}

.skill-check-item {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.9rem;
}

/* Centro notifiche — campanella sidebar */
.sidebar-notification-bell {
	margin: 0 0.65rem 0.85rem;
	padding: 0;
}

.sidebar-notification-bell--active .sidebar-notification-bell-link {
	background: linear-gradient(135deg, rgba(220, 38, 38, 0.22), rgba(234, 88, 12, 0.18));
	border-color: rgba(252, 165, 165, 0.55);
	box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.15);
}

.sidebar-notification-bell-link {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.7rem 0.85rem;
	border-radius: 0.65rem;
	border: 1px solid rgba(255, 255, 255, 0.14);
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.sidebar-notification-bell-link:hover,
.sidebar-notification-bell-link.active {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.28);
	color: #fff;
}

.sidebar-notification-bell-icon-wrap {
	position: relative;
	flex-shrink: 0;
	width: 2.1rem;
	height: 2.1rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sidebar-notification-bell-icon {
	width: 1.45rem;
	height: 1.45rem;
}

.sidebar-notification-bell-label {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
	line-height: 1.2;
}

.sidebar-notification-bell-title {
	font-weight: 700;
	font-size: 0.95rem;
}

.sidebar-notification-bell-sub {
	font-size: 0.78rem;
	opacity: 0.88;
	margin-top: 0.12rem;
}

.sidebar-notification-bell--active .sidebar-notification-bell-sub {
	color: #fecaca;
	font-weight: 600;
}

.sidebar-notification-bell-badge {
	flex-shrink: 0;
	min-width: 1.5rem;
	padding: 0.2rem 0.45rem;
	border-radius: 999px;
	background: #dc2626;
	color: #fff;
	font-size: 0.78rem;
	font-weight: 800;
	text-align: center;
	line-height: 1.1;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.app-main-toolbar {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}

.app-main-toolbar .global-search-wrap {
	flex: 1;
	min-width: 200px;
	margin-bottom: 0;
}

.notification-center-toolbar-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.55rem 0.9rem;
	border-radius: 0.5rem;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	font-weight: 600;
	font-size: 0.9rem;
	text-decoration: none;
	flex-shrink: 0;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.notification-center-toolbar-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
}

.notification-center-toolbar-btn svg {
	width: 1.15rem;
	height: 1.15rem;
}

.notification-toolbar-badge {
	min-width: 1.25rem;
	padding: 0.08rem 0.38rem;
	border-radius: 999px;
	background: #dc2626;
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
}

.mobile-notification-btn {
	position: relative;
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	color: var(--text);
	text-decoration: none;
}

.mobile-notification-badge {
	position: absolute;
	top: -2px;
	right: -4px;
	min-width: 1rem;
	padding: 0 0.25rem;
	border-radius: 999px;
	background: #dc2626;
	color: #fff;
	font-size: 0.65rem;
	font-weight: 700;
	line-height: 1.1rem;
	text-align: center;
}

.notification-center-page {
	padding: 1.25rem;
}

.notification-center-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.notification-center-subtitle {
	color: var(--text-muted);
	margin: 0.35rem 0 0;
	font-size: 0.9375rem;
}

.notification-center-banner {
	padding: 0.75rem 1rem;
	border-radius: 0.5rem;
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.notification-center-banner--warn {
	background: #fffbeb;
	border: 1px solid #fcd34d;
	color: #92400e;
}

.notification-center-summary {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.notification-summary-card {
	display: flex;
	flex-direction: column;
	padding: 0.75rem 1.1rem;
	border-radius: 0.5rem;
	border: 1px solid var(--border);
	background: var(--surface);
	min-width: 6rem;
}

.notification-summary-card--critical {
	border-color: #fecaca;
	background: #fef2f2;
}

.notification-summary-card--unread {
	border-color: #bfdbfe;
	background: #eff6ff;
}

.notification-card--unread {
	border-left-width: 5px;
	background: #f8fafc;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.notification-card--read {
	opacity: 0.88;
	border-left-color: #cbd5e1 !important;
	background: #f1f5f9;
	box-shadow: none;
}

.notification-card--read .notification-card-title {
	color: var(--text-muted);
	text-decoration: line-through;
	text-decoration-color: #94a3b8;
}

.notification-card-read-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.15rem 0.5rem;
	border-radius: 999px;
	background: #e2e8f0;
	color: #475569;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.notification-card-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.65rem;
	margin-top: 0.35rem;
}

.notification-summary-value {
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.1;
}

.notification-summary-label {
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-top: 0.2rem;
}

.notification-center-filters {
	max-width: 280px;
	margin-bottom: 1rem;
}

.notification-center-empty {
	padding: 2rem 1rem;
	text-align: center;
	color: var(--text-muted);
}

.notification-center-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.notification-card {
	padding: 1rem 1.1rem;
	border-radius: 0.5rem;
	border: 1px solid var(--border);
	background: var(--surface);
	border-left-width: 4px;
}

.notification-card--critical { border-left-color: #dc2626; }
.notification-card--high { border-left-color: #ea580c; }
.notification-card--medium { border-left-color: #ca8a04; }
.notification-card--low { border-left-color: #64748b; }

.notification-card-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.notification-badge {
	font-size: 0.72rem;
	font-weight: 700;
	padding: 0.12rem 0.45rem;
	border-radius: 999px;
}

.notification-badge--critical { background: #fee2e2; color: #991b1b; }
.notification-badge--high { background: #ffedd5; color: #9a3412; }
.notification-badge--medium { background: #fef9c3; color: #854d0e; }
.notification-badge--low { background: #f1f5f9; color: #475569; }

.notification-category,
.notification-milestone {
	font-size: 0.78rem;
	color: var(--text-muted);
}

.notification-milestone {
	font-weight: 600;
}

.notification-card-title {
	margin: 0 0 0.35rem;
	font-size: 1rem;
}

.notification-card-message {
	margin: 0 0 0.5rem;
	color: var(--text-muted);
	font-size: 0.9rem;
	line-height: 1.45;
}

.notification-card-link {
	font-size: 0.875rem;
}

/* Autoparco — Spese e Multe */
.asm-tabs {
	margin-top: 1.25rem;
}

.asm-tab-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.35rem;
	height: 1.35rem;
	margin-left: 0.4rem;
	padding: 0 0.4rem;
	border-radius: 999px;
	background: var(--primary-light);
	color: var(--primary);
	font-size: 0.72rem;
	font-weight: 700;
}

.tabs-sivis .tab-btn.active .asm-tab-badge {
	background: var(--primary);
	color: #fff;
}

.asm-section {
	margin-top: 0.5rem;
}

.asm-section-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.asm-section-title {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 600;
}

.asm-section-desc {
	margin: 0.35rem 0 0;
	color: var(--text-muted);
	font-size: 0.9rem;
	max-width: 42rem;
}

.asm-section-actions {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	flex-shrink: 0;
}

.asm-summary {
	display: flex;
	gap: 0.85rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.asm-summary-card {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 8.5rem;
	padding: 0.85rem 1.1rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface-card);
	box-shadow: 0 1px 2px rgba(10, 97, 116, 0.04);
}

.asm-summary-card--accent {
	border-color: rgba(10, 97, 116, 0.25);
	background: linear-gradient(180deg, rgba(10, 97, 116, 0.06) 0%, var(--surface-card) 100%);
}

.asm-summary-label {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-muted);
}

.asm-summary-value {
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--text);
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
}

.asm-summary-sub {
	font-size: 0.78rem;
	color: var(--text-muted);
}

.asm-filters-panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.1rem 1.25rem 1.25rem;
	margin-bottom: 1.25rem;
	box-shadow: 0 1px 3px rgba(10, 97, 116, 0.04);
}

.asm-filters-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.85rem;
	padding-bottom: 0.65rem;
	border-bottom: 1px solid var(--border);
}

.asm-filters-title {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.asm-search-wrap {
	margin-top: 0 !important;
	margin-bottom: 1rem;
}

.asm-search-bar {
	max-width: none;
}

.asm-filters-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1rem 1.25rem;
}

.asm-filter-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.asm-filter-field .input-label {
	margin-bottom: 0;
	font-size: 0.8125rem;
}

.asm-table-wrap {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface-card);
}

.asm-table {
	margin: 0;
	min-width: 960px;
}

.asm-table thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--surface);
	white-space: nowrap;
}

.asm-col-amount {
	text-align: right;
	white-space: nowrap;
}

.asm-col-narrow {
	white-space: nowrap;
}

.asm-col-note {
	max-width: 14rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.asm-empty-cell {
	padding: 2.5rem 1rem !important;
	text-align: center;
	color: var(--text-muted);
}

.asm-plate {
	display: inline-block;
	padding: 0.15rem 0.45rem;
	border-radius: 6px;
	background: var(--primary-light);
	color: var(--primary);
	font-weight: 700;
	font-size: 0.875rem;
	letter-spacing: 0.03em;
}

.asm-tipologia-badge {
	display: inline-block;
	padding: 0.15rem 0.5rem;
	border-radius: 999px;
	background: var(--surface);
	border: 1px solid var(--border);
	font-size: 0.8125rem;
	color: var(--text);
}

.asm-tipologia-badge--fuel {
	background: rgba(234, 179, 8, 0.12);
	border-color: rgba(234, 179, 8, 0.35);
	color: #92400e;
}

.asm-col-litri {
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.asm-summary-card--fuel {
	border-color: rgba(234, 179, 8, 0.35);
	background: linear-gradient(180deg, rgba(234, 179, 8, 0.08) 0%, var(--surface-card) 100%);
}

.asm-rifornimento-field {
	grid-column: span 1;
}

.asm-litri-input {
	max-width: 100%;
}

.asm-field-hint {
	margin: 0.35rem 0 0;
	font-size: 0.8125rem;
	color: var(--text-muted);
}

.asm-amount {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.asm-row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.65rem;
	white-space: nowrap;
}

.asm-action-danger {
	color: var(--danger) !important;
}

@media (max-width: 767px) {
	.asm-section-head {
		flex-direction: column;
	}

	.asm-section-actions {
		width: 100%;
	}

	.asm-section-actions .btn-primary-sivis,
	.asm-section-actions .btn-secondary-sivis {
		flex: 1;
	}
}

