/* 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;
    --sidebar-collapsed-width: 72px;
    --sidebar-from: #084d5c;
    --sidebar-to: #0A6174;
    --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);
}

html[data-sidebar-theme="teal"] {
    --primary: #0A6174;
    --primary-hover: #0d7a90;
    --primary-dark: #084d5c;
    --primary-light: rgba(10, 97, 116, 0.12);
    --sidebar-from: #084d5c;
    --sidebar-to: #0A6174;
    --shadow: 0 2px 12px rgba(10, 97, 116, 0.08);
    --shadow-lg: 0 8px 30px rgba(10, 97, 116, 0.12);
}

html[data-sidebar-theme="black"] {
    --primary: #2f2f2f;
    --primary-hover: #454545;
    --primary-dark: #111111;
    --primary-light: rgba(17, 17, 17, 0.1);
    --sidebar-from: #111111;
    --sidebar-to: #1a1a1a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.14);
}

html[data-sidebar-theme="navy"] {
    --primary: #1a4f8a;
    --primary-hover: #2263ad;
    --primary-dark: #0b1f3a;
    --primary-light: rgba(26, 79, 138, 0.12);
    --sidebar-from: #0b1f3a;
    --sidebar-to: #163a6b;
    --shadow: 0 2px 12px rgba(26, 79, 138, 0.1);
    --shadow-lg: 0 8px 30px rgba(26, 79, 138, 0.14);
}

html[data-sidebar-theme="green"] {
    --primary: #1e7a54;
    --primary-hover: #259466;
    --primary-dark: #0d3b2e;
    --primary-light: rgba(30, 122, 84, 0.12);
    --sidebar-from: #0d3b2e;
    --sidebar-to: #1a6b4a;
    --shadow: 0 2px 12px rgba(30, 122, 84, 0.1);
    --shadow-lg: 0 8px 30px rgba(30, 122, 84, 0.14);
}

html[data-sidebar-theme="burgundy"] {
    --primary: #8b2d42;
    --primary-hover: #a53852;
    --primary-dark: #4a1520;
    --primary-light: rgba(139, 45, 66, 0.12);
    --sidebar-from: #4a1520;
    --sidebar-to: #7a2438;
    --shadow: 0 2px 12px rgba(139, 45, 66, 0.1);
    --shadow-lg: 0 8px 30px rgba(139, 45, 66, 0.14);
}

html[data-sidebar-theme="slate"] {
    --primary: #4a5d70;
    --primary-hover: #5c7288;
    --primary-dark: #2a3440;
    --primary-light: rgba(74, 93, 112, 0.12);
    --sidebar-from: #2a3440;
    --sidebar-to: #3d4d5c;
    --shadow: 0 2px 12px rgba(74, 93, 112, 0.1);
    --shadow-lg: 0 8px 30px rgba(74, 93, 112, 0.14);
}

html[data-sidebar-theme="orange"] {
    --primary: #c2410c;
    --primary-hover: #ea580c;
    --primary-dark: #7c2d12;
    --primary-light: rgba(194, 65, 12, 0.12);
    --sidebar-from: #7c2d12;
    --sidebar-to: #c2410c;
    --shadow: 0 2px 12px rgba(194, 65, 12, 0.1);
    --shadow-lg: 0 8px 30px rgba(194, 65, 12, 0.14);
}

* {
    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);
    transition: margin-left 0.2s ease;
}

/* Sidebar (left) */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: auto;
    max-height: 100dvh;
    background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: width 0.2s ease;
}

.sidebar-brand {
    position: relative;
    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-collapse-btn {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.sidebar-collapse-btn svg {
    width: 18px;
    height: 18px;
}

.sidebar-collapse-icon--expand {
    display: none;
}

html.nav-collapsed .sidebar-collapse-icon--collapse {
    display: none;
}

html.nav-collapsed .sidebar-collapse-icon--expand {
    display: block;
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-logout:hover {
    color: #fff;
}

.sidebar-logout-icon {
    display: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.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;
    box-shadow: inset 3px 0 0 #fff;
}

.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: 52rem;
    overflow-y: auto;
}

.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-nav .nav-link-sub-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem 0.5rem calc(1.5rem + 22px + 0.75rem);
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.9375rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav .nav-link-sub-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav .nav-link-sub-toggle .nav-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    opacity: 0.8;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.sidebar-nav .nav-link-sub-toggle.open .nav-chevron {
    transform: rotate(180deg);
}

.sidebar-nav .nav-link-sub-toggle .nav-icon {
    width: 18px;
    height: 18px;
}

.sidebar-nav .nav-link-sub-toggle .nav-icon svg {
    width: 16px;
    height: 16px;
}

.sidebar-submenu-nested.open {
    max-height: 24rem;
}

.sidebar-nav .nav-link-sub-nested {
    padding-left: calc(1.5rem + 22px + 0.75rem + 22px + 0.5rem);
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-theme-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.sidebar-theme-swatch {
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    background: linear-gradient(180deg, var(--swatch-from) 0%, var(--swatch-to) 100%);
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.sidebar-theme-swatch:hover {
    transform: scale(1.12);
    border-color: rgba(255, 255, 255, 0.85);
}

.sidebar-theme-swatch.is-active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.sidebar-theme-swatch[data-theme="teal"] { --swatch-from: #084d5c; --swatch-to: #0A6174; }
.sidebar-theme-swatch[data-theme="black"] { --swatch-from: #111111; --swatch-to: #1a1a1a; }
.sidebar-theme-swatch[data-theme="navy"] { --swatch-from: #0b1f3a; --swatch-to: #163a6b; }
.sidebar-theme-swatch[data-theme="green"] { --swatch-from: #0d3b2e; --swatch-to: #1a6b4a; }
.sidebar-theme-swatch[data-theme="burgundy"] { --swatch-from: #4a1520; --swatch-to: #7a2438; }
.sidebar-theme-swatch[data-theme="slate"] { --swatch-from: #2a3440; --swatch-to: #3d4d5c; }
.sidebar-theme-swatch[data-theme="orange"] { --swatch-from: #7c2d12; --swatch-to: #c2410c; }

/* 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;
}

.form-grid .contract-committente-sede-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
}

.emergency-contact-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.form-grid .materiale-radio-gap-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.form-grid .materiale-targhe-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.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: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    transition: color 0.2s, background 0.2s, font-weight 0.2s;
}

.tabs-sivis .tab-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.tabs-sivis .tab-btn.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 700;
    border-bottom-color: var(--primary);
    padding-left: 1.45rem;
}

.tabs-sivis .tab-btn.active::before {
    content: "";
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.hiring-stepper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.hiring-step {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-muted);
    font-weight: 600;
    border: 1px solid var(--border);
}

.hiring-step.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.hiring-step.done {
    color: var(--primary);
}

.hiring-step-num {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid currentColor;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* 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);
}

.vehicle-plate {
    font-weight: 700;
}

.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 tbody tr.riga-contratto-in-attesa-firma-legale,
.table-sivis tbody tr.riga-contratto-in-attesa-firma-legale td {
    background: #fff3bf;
}

.table-sivis tbody tr.riga-contratto-in-attesa-firma-legale:hover,
.table-sivis tbody tr.riga-contratto-in-attesa-firma-legale:hover td {
    background: #ffd43b;
}

.contract-date-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.45rem;
    flex-wrap: wrap;
}

.contract-date-actions button {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    padding: 0.38rem 0.55rem;
}

.input-with-euro {
    position: relative;
}

.input-with-euro .input-sivis {
    padding-right: 2.35rem;
}

.input-with-euro-symbol {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-weight: 600;
}

.contract-doc-folder {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface, #fff);
}

h3 + .contract-doc-folder {
    margin-top: 0;
}

.contract-doc-folder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.contract-doc-folder-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 650;
}

.contract-doc-add {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    box-shadow: 0 1px 2px rgba(10, 97, 116, 0.18);
}

.contract-doc-add:hover {
    background: var(--primary-hover);
}

.contract-doc-add.is-disabled {
    opacity: 0.55;
    pointer-events: none;
    cursor: default;
}

.contract-doc-add input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.contract-doc-add span {
    pointer-events: none;
}

.contract-doc-add-busy {
    width: 0.85rem;
    height: 0.85rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: contract-doc-spin 0.7s linear infinite;
}

@keyframes contract-doc-spin {
    to { transform: rotate(360deg); }
}

.table-sivis tbody tr.riga-contratto-in-scadenza {
    background: #fff3bf;
}

.table-sivis tbody tr.riga-contratto-in-scadenza:hover {
    background: #ffe066;
}

.table-sivis tbody tr.riga-doc-mancanti {
    background: #fff8eb;
}

.table-sivis tbody tr.riga-doc-mancanti:hover {
    background: #ffe0b2;
}

.table-sivis tbody tr.riga-contratto-cliente-in-scadenza {
    background: #fdecea;
}

.table-sivis tbody tr.riga-contratto-cliente-in-scadenza:hover {
    background: #f8d7da;
}

.table-sivis tbody tr.riga-contratto-cliente-in-scadenza td:not(:last-child) {
    color: var(--danger);
    font-weight: 600;
}

.contratto-cliente-scadenza-bang {
    display: inline-block;
    margin-right: 0.35rem;
    font-weight: 800;
    color: var(--danger);
}

.contratto-scadenza-bang {
    display: inline-block;
    margin-right: 0.35rem;
    font-weight: 800;
    color: #b45309;
}

.doc-scaduto-bang {
    display: inline-block;
    margin-right: 0.35rem;
    font-weight: 800;
    color: #c53030;
}

.doc-in-scadenza-bang {
    display: inline-block;
    margin-right: 0.35rem;
    font-weight: 800;
    color: #ca8a04;
}

.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 home styles live in dashboard.css */


/* 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-filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

.users-resp-filter {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 220px;
    max-width: 280px;
    flex: 0 1 280px;
}

.users-resp-filter .input-label {
    margin: 0;
}

.users-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 280px;
    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;
}

@media (max-width: 767px) {
    .global-search-wrap {
        max-width: none;
    }
}

/* Report page – filter panel */
.report-embed {
    margin: 0;
}

.report-export {
    display: inline-flex;
    align-items: center;
}

.popup-fullscreen .report-embed .report-filters-panel {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 1rem;
}

.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-catalog-search {
    max-width: 420px;
    margin-bottom: 1rem;
}

.report-catalog {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.report-catalog-group-title {
    margin: 0 0 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.report-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.65rem;
}

.report-type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    text-align: left;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-card);
    cursor: pointer;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.report-type-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(10, 97, 116, 0.08);
}

.report-type-card.is-active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.report-type-card-title {
    font-weight: 650;
    font-size: 0.9rem;
}

.report-type-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.report-catalog-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.site-pick.is-disabled {
    opacity: 0.7;
}

.site-pick-search {
    margin-bottom: 0.65rem;
}

.site-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
}

.site-pick-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    text-align: left;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-card);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.site-pick-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 10%, transparent);
}

.site-pick-card.is-selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.site-pick-mark {
    flex: 0 0 1.15rem;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--surface-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.12rem;
}

.site-pick-mark::after {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: transparent;
}

.site-pick-card.is-selected .site-pick-mark {
    border-color: var(--primary);
    background: var(--surface-card);
}

.site-pick-card.is-selected .site-pick-mark::after {
    background: var(--primary);
}

.site-pick-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.site-pick-name {
    font-weight: 650;
    font-size: 0.9rem;
    line-height: 1.3;
}

.site-pick-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.site-pick-empty,
.site-pick-hint {
    margin: 0.55rem 0 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.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);
}

.veicolo-scadenza-scaduto {
    color: #c53030 !important;
    font-weight: 700;
    background: #fdecea;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.veicolo-scadenza-in-scadenza {
    color: #c2410c !important;
    font-weight: 700;
    background: #fff3e0;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.table-sivis tbody tr.riga-veicolo-scaduto {
    background: #fdecea;
}

.table-sivis tbody tr.riga-veicolo-scaduto:hover {
    background: #f8d7da;
}

.table-sivis tbody tr.riga-veicolo-in-scadenza {
    background: #fff8eb;
}

.table-sivis tbody tr.riga-veicolo-in-scadenza:hover {
    background: #fff3e0;
}

/* 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,
.input-sivis.invalid {
    outline: 1px solid #e50000;
    border-color: #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: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
    color: #fff;
    align-items: center;
    gap: 0.75rem;
    padding: env(safe-area-inset-top, 0px) max(1rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    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;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}

.tabs-sivis .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .sidebar-collapse-btn {
        display: inline-flex;
    }

    html.nav-collapsed {
        --sidebar-width: var(--sidebar-collapsed-width);
    }

    html.nav-collapsed .sidebar-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.35rem;
        padding: 0.7rem 0.4rem 0.85rem;
    }

    html.nav-collapsed .sidebar-collapse-btn {
        position: static;
        margin: 0;
    }

    html.nav-collapsed .sidebar-brand-link img {
        max-width: 36px !important;
    }

    html.nav-collapsed .sidebar-nav {
        padding: 0.5rem 0;
    }

    html.nav-collapsed .sidebar-nav a,
    html.nav-collapsed .sidebar-nav .nav-link-parent,
    html.nav-collapsed .sidebar-nav .nav-link-sub-toggle {
        justify-content: center;
        gap: 0;
        padding: 0.7rem 0.4rem;
        position: relative;
    }

    html.nav-collapsed .sidebar-nav a.active {
        border-left: none;
        padding-left: 0.4rem;
        box-shadow: inset 3px 0 0 #fff;
    }

    html.nav-collapsed .sidebar-nav .nav-link-sub,
    html.nav-collapsed .sidebar-nav .nav-link-sub-nested,
    html.nav-collapsed .sidebar-nav .nav-link-sub-toggle {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }

    html.nav-collapsed .sidebar-nav a > span:not(.nav-icon):not(.nav-sector-badge),
    html.nav-collapsed .sidebar-nav .nav-link-parent > span:not(.nav-icon):not(.nav-sector-badge):not(.nav-chevron),
    html.nav-collapsed .sidebar-nav .nav-link-sub-toggle > span:not(.nav-icon):not(.nav-chevron) {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    html.nav-collapsed .sidebar-nav .nav-chevron {
        display: none;
    }

    html.nav-collapsed .nav-sector-badge {
        position: absolute;
        top: 4px;
        right: 6px;
        margin: 0;
        min-width: 1rem;
        height: 1rem;
        font-size: 0.6rem;
    }

    html.nav-collapsed .sidebar-submenu.open {
        max-height: none;
    }

    html.nav-collapsed .sidebar-notification-bell {
        margin: 0.5rem 0.35rem 0.35rem;
    }

    html.nav-collapsed .sidebar-notification-bell-link {
        justify-content: center;
        padding: 0.55rem 0.35rem;
        gap: 0;
        position: relative;
    }

    html.nav-collapsed .sidebar-notification-bell-label {
        display: none;
    }

    html.nav-collapsed .sidebar-notification-bell-badge {
        position: absolute;
        top: 2px;
        right: 2px;
        min-width: 1rem;
        padding: 0.1rem 0.28rem;
        font-size: 0.65rem;
    }

    html.nav-collapsed .sidebar-footer {
        padding: 0.65rem 0.4rem;
    }

    html.nav-collapsed .sidebar-footer > div,
    html.nav-collapsed .sidebar-footer-actions {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.45rem;
    }

    html.nav-collapsed .sidebar-theme-picker {
        justify-content: center;
        margin-bottom: 0.35rem;
        gap: 0.25rem;
    }

    html.nav-collapsed .sidebar-theme-swatch {
        width: 12px;
        height: 12px;
    }

    html.nav-collapsed .sidebar-logout-text {
        display: none;
    }

    html.nav-collapsed .sidebar-logout-icon {
        display: block;
    }
}

@media (max-width: 991px) {
    .app-main {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 1rem);
    }

    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
        padding-top: env(safe-area-inset-top, 0px);
        width: min(var(--sidebar-width), 100vw);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .mobile-topbar {
        display: flex;
    }

    .mobile-topbar .mobile-notification-btn {
        color: #fff;
    }

    .sidebar-theme-picker {
        gap: 0.4rem;
        overflow: visible;
    }

    .sidebar-theme-swatch {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }
}

@media (max-width: 767px) {
    .app-main {
        padding: 0.75rem;
        padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 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;
    }

    .form-grid .contract-committente-sede-row {
        grid-template-columns: 1fr;
    }

    .emergency-contact-row {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid .materiale-radio-gap-row,
    .form-grid .materiale-targhe-row {
        grid-template-columns: 1fr 1fr;
    }

    .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;
    }

    .users-resp-filter {
        max-width: none;
        flex: 1 1 100%;
    }

    .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;
    }

    .form-grid .materiale-radio-gap-row,
    .form-grid .materiale-targhe-row {
        grid-template-columns: 1fr;
    }
}

/* --- 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: 0.75rem;
    z-index: 10031;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: none;
    max-height: none;
    margin: 0;
}

.modulo-pdf-preview-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0.75rem 1rem 0 !important;
}

.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;
}

.pdf-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.45);
}

.pdf-viewer-modal.popup-fullscreen {
    position: fixed;
    inset: 0.75rem;
    z-index: 10051;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: none;
    max-height: none;
    margin: 0;
}

.pdf-viewer-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden;
    background: #4a4f55;
}

.pdf-viewer-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    flex: 1;
    min-height: 0;
    background: #4a4f55;
}

.pdf-viewer-status {
    margin: auto;
    padding: 1.5rem;
    color: #e8eaed;
}

.pdf-viewer-error {
    margin: 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--error, #c0392b) 35%, var(--border));
    background: var(--surface);
    color: var(--error, #c0392b);
}

.pdf-viewer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.ds-sign-modal {
    display: flex;
    flex-direction: column;
}

.ds-sign-body {
    position: relative;
}

.ds-sign-hint {
    margin: 0;
    padding: 0.55rem 1rem;
    color: #e8eaed;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.ds-sign-stage-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0.75rem 1rem 1rem;
}

.ds-sign-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    touch-action: none;
    user-select: none;
    cursor: crosshair;
}

.ds-sign-page {
    display: block;
    max-width: 100%;
    height: auto;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    background: #fff;
}

.ds-sign-box {
    position: absolute;
    box-sizing: border-box;
    border: 1px solid #2e2e2e;
    border-left: 4px solid #1f5a9e;
    background: rgba(247, 247, 247, 0.94);
    color: #2e2e2e;
    padding: 0.2rem 0.4rem 0.15rem 0.45rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: grab;
    line-height: 1.15;
    overflow: hidden;
    pointer-events: none;
}

.ds-sign-box-kicker {
    font-size: 0.62rem;
    font-weight: 700;
    color: #1f5a9e;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ds-sign-box-name {
    font-size: 0.78rem;
    font-weight: 700;
}

.ds-sign-box-date {
    font-size: 0.68rem;
}

.ds-sign-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem 1rem;
    align-items: end;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.ds-sign-pager {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ds-sign-pager-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ds-sign-error {
    grid-column: 1 / -1;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 8rem;
    overflow: auto;
}

.ds-sign-buttons {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

@media (max-width: 800px) {
    .ds-sign-actions {
        grid-template-columns: 1fr;
    }
}

.modulo-pdf-preview-frame {
    flex: 1;
    min-height: 0;
    width: 100%;
    border: 0;
    background: #4a4f55;
}

.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-kind-switch-wrap {
    margin-bottom: 0.75rem;
}

.giri-kind-switch-wrap .giri-chip-count {
    margin-left: 0.15rem;
}

.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-date-range {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-end;
    flex-shrink: 0;
}

.giri-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 9.5rem;
}

.giri-date-field .input-label {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.2;
}

.giri-date-input {
    min-width: 9.5rem;
}

@media (max-width: 959px) {
    .giri-date-range {
        width: 100%;
    }

    .giri-date-field {
        flex: 1;
        min-width: 0;
    }

    .giri-date-input {
        width: 100%;
        min-width: 0;
    }
}

.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-show-photo-btn {
    margin-top: 0.5rem;
    width: auto;
}

.giri-photo-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.giri-photo-dialog {
    background: var(--surface-card);
    border-radius: 14px;
    border: 1px solid var(--border);
    max-width: min(92vw, 880px);
    max-height: 92vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
}

.giri-photo-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.giri-photo-dialog-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.giri-photo-dialog-body {
    padding: 0.75rem 1rem;
    overflow: auto;
    display: flex;
    justify-content: center;
    background: color-mix(in srgb, var(--surface-muted, #f1f5f9) 70%, var(--surface-card));
}

.giri-photo-img {
    max-width: 100%;
    max-height: min(70vh, 720px);
    object-fit: contain;
    border-radius: 8px;
}

.giri-photo-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
}

.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;
}

.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;
}

/* Tabella notifiche stile Excel */
.notification-excel-table-wrap {
	overflow: auto;
	max-height: calc(100vh - 280px);
}

.notification-excel-table th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--surface, #fff);
	white-space: nowrap;
}

.notification-excel-table .notification-col-priorita,
.notification-excel-table .notification-col-data {
	white-space: nowrap;
}

.excel-th {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.excel-th-sort {
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	color: inherit;
}

.excel-col-filter {
	position: relative;
	display: inline-flex;
}

.excel-col-filter-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.4rem;
	height: 1.4rem;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 0.25rem;
	background: transparent;
	color: var(--text-muted, #64748b);
	cursor: pointer;
}

.excel-col-filter-btn:hover,
.excel-col-filter-btn--active {
	background: #e2e8f0;
	border-color: #cbd5e1;
	color: #0f172a;
}

.excel-col-filter-btn--active {
	background: #dbeafe;
	border-color: #93c5fd;
	color: #1d4ed8;
}

.excel-col-filter-panel {
	/* top/left impostati via JS (position:fixed) per non essere tagliati da overflow/sticky.
	   Sopra popup-fullscreen (1000) e popup innestati (1200). */
	position: fixed;
	z-index: 1400;
	width: 280px;
	padding: 0.6rem;
	border-radius: 0.45rem;
	border: 1px solid var(--border, #cbd5e1);
	background: #fff;
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
	box-sizing: border-box;
}

.excel-col-filter-actions {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.4rem;
}

.excel-col-filter-search {
	margin-bottom: 0.4rem;
}

.excel-col-filter-list {
	max-height: 180px;
	overflow: auto;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	margin-bottom: 0.5rem;
}

.excel-col-filter-item {
	display: flex;
	align-items: flex-start;
	gap: 0.4rem;
	font-weight: normal;
	font-size: 0.85rem;
}

.excel-col-filter-item span {
	overflow-wrap: anywhere;
	word-break: break-word;
	min-width: 0;
}

.excel-col-filter-footer {
	display: flex;
	gap: 0.4rem;
}

.notification-row--unread td {
	font-weight: 500;
}

.notification-row--read td {
	color: var(--text-muted, #64748b);
}

.notification-target-row td {
	background: #eff6ff;
}

.notification-target-item {
	background: #eff6ff;
	outline: 2px solid #3b82f6;
	border-radius: 4px;
}

.notification-excel-message {
	max-width: 320px;
	white-space: normal;
	font-size: 0.85rem;
}

.nav-sector-badge {
	margin-left: auto;
	margin-right: 0.25rem;
	min-width: 1.35rem;
	height: 1.35rem;
	padding: 0 0.35rem;
	border-radius: 999px;
	background: #dc2626;
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.sidebar-nav .nav-link-parent:has(.nav-sector-badge) .nav-chevron {
	margin-left: 0;
}

.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-badge--normal { background: #f1f5f9; color: #475569; }

.notification-status-cell {
	text-align: center;
	width: 3rem;
}

.notification-select-cell {
	width: 2.25rem;
	text-align: center;
	vertical-align: middle;
}

.notification-status-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	border-radius: 999px;
}

.notification-status-icon:hover:not(:disabled) {
	opacity: 0.8;
}

.notification-status-icon:disabled {
	cursor: wait;
	opacity: 0.55;
}

.notification-status-icon:focus-visible {
	outline: 2px solid #1d4ed8;
	outline-offset: 2px;
}

.notification-status-icon svg {
	width: 1.25rem;
	height: 1.25rem;
}

.notification-status-icon--unread {
	color: #1d4ed8;
}

.notification-status-icon--unread svg {
	stroke-width: 2.4;
}

.notification-status-icon--read {
	color: #94a3b8;
}

.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;
	}
}

/* ===== Notifiche in tempo reale (toast "alla WhatsApp") ===== */
.sivis-toast-container {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 2000;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	max-width: 360px;
	width: calc(100% - 2rem);
	pointer-events: none;
}

.sivis-toast {
	pointer-events: auto;
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
	background: var(--surface-card);
	border: 1px solid var(--border);
	border-left: 4px solid var(--primary);
	border-radius: var(--radius);
	box-shadow: var(--shadow-lg);
	padding: 0.8rem 0.9rem;
	animation: sivis-toast-in 0.28s ease;
}

@keyframes sivis-toast-in {
	from { opacity: 0; transform: translateX(24px); }
	to { opacity: 1; transform: translateX(0); }
}

.sivis-toast--critical { border-left-color: var(--danger); }
.sivis-toast--high { border-left-color: #e8a33d; }
.sivis-toast--medium { border-left-color: var(--primary); }
.sivis-toast--low { border-left-color: #6c8a94; }

.sivis-toast-icon {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	color: var(--primary);
	margin-top: 2px;
}

.sivis-toast-icon svg { width: 20px; height: 20px; }
.sivis-toast--critical .sivis-toast-icon { color: var(--danger); }

.sivis-toast-body { flex: 1 1 auto; min-width: 0; }

.sivis-toast-title {
	font-weight: 600;
	font-size: 0.92rem;
	color: var(--text);
	margin-bottom: 0.15rem;
}

.sivis-toast-message {
	font-size: 0.85rem;
	color: var(--text-muted);
	white-space: pre-wrap;
	word-break: break-word;
}

.sivis-toast-link {
	display: inline-block;
	margin-top: 0.35rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--primary);
	text-decoration: none;
}

.sivis-toast-close {
	flex: 0 0 auto;
	background: none;
	border: none;
	color: var(--text-muted);
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 0.15rem;
}

.sivis-toast-close:hover { color: var(--text); }

.sivis-notif-prompt {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	z-index: 2000;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	max-width: 360px;
	background: var(--surface-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-lg);
	padding: 0.7rem 0.85rem;
}

.sivis-notif-prompt-text {
	flex: 1 1 auto;
	font-size: 0.82rem;
	color: var(--text-muted);
}

.sivis-notif-prompt-close {
	background: none;
	border: none;
	color: var(--text-muted);
	font-size: 1.15rem;
	line-height: 1;
	cursor: pointer;
}

/* Configurazione — menu laterale raggruppato */
.config-layout {
	display: grid;
	grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
	gap: 1.5rem;
	align-items: start;
}

.config-side-nav {
	position: sticky;
	top: 0.75rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 0.5rem;
	box-shadow: var(--shadow);
}

.config-side-nav-group + .config-side-nav-group {
	margin-top: 0.35rem;
	padding-top: 0.35rem;
	border-top: 1px solid var(--border);
}

.config-side-nav-group-label {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-muted);
	padding: 0.55rem 0.7rem 0.3rem;
}

.config-side-nav-btn {
	display: block;
	width: 100%;
	text-align: left;
	border: none;
	background: transparent;
	padding: 0.55rem 0.7rem;
	border-radius: 8px;
	color: var(--text);
	font-size: 0.9rem;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.config-side-nav-btn:hover {
	background: rgba(10, 97, 116, 0.06);
	color: var(--primary);
}

.config-side-nav-btn.active {
	background: var(--primary-light);
	color: var(--primary);
	font-weight: 600;
}

.config-content-title {
	margin: 0 0 1.1rem;
	font-size: 1.2rem;
	font-weight: 600;
}

.config-mobile-select-label,
.config-mobile-select {
	display: none;
}

@media (max-width: 960px) {
	.config-layout {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.config-side-nav {
		position: static;
		padding: 0.85rem 1rem;
	}

	.config-side-nav-group {
		display: none;
	}

	.config-mobile-select-label {
		display: block;
		margin-bottom: 0.35rem;
		font-size: 0.8rem;
		font-weight: 600;
		color: var(--text-muted);
	}

	.config-mobile-select {
		display: block;
	}
}

/* Autoparco — mappa flotta Geotab */
.ap-zone-label {
	background: #fff;
	border: 1px solid #0A6174;
	color: #0A6174;
	font-weight: 650;
	font-size: 12px;
	padding: 2px 6px;
	border-radius: 4px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.ap-map-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.4rem 0.75rem;
	border-radius: 999px;
	background: var(--primary-light, #e8f4f6);
	border: 1px solid var(--border);
	font-size: 1rem;
}

.ap-map-chip button {
	border: 0;
	background: transparent;
	cursor: pointer;
	color: var(--text-muted);
	line-height: 1;
	padding: 0;
}

.ap-map-page {
	display: flex;
	flex-direction: column;
	margin: -0.15rem -2rem -2rem;
	height: calc(100vh - 6.75rem);
	min-height: 540px;
	background: #e8eef0;
	border-top: 1px solid var(--border);
	overflow: hidden;
}

.ap-map-toolbar {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.65rem;
	padding: 0.7rem 1rem;
	background: #fff;
	border-bottom: 1px solid var(--border);
	z-index: 2;
}

.ap-map-toolbar-main {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.85rem;
	flex-wrap: wrap;
}

.ap-map-toolbar-left,
.ap-map-toolbar-right {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	min-width: 0;
}

.ap-map-search {
	position: relative;
	min-width: 220px;
	width: min(320px, 100%);
}

.ap-map-search svg {
	position: absolute;
	left: 0.75rem;
	top: 50%;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	color: var(--text-muted);
	pointer-events: none;
}

.ap-map-search input,
.ap-map-filter,
.ap-map-date,
.ap-map-time,
.ap-map-device {
	height: 38px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.875rem;
}

.ap-map-search input {
	width: 100%;
	padding: 0 0.75rem 0 2.15rem;
}

.ap-map-search input:focus,
.ap-map-filter:focus,
.ap-map-date:focus,
.ap-map-time:focus,
.ap-map-device:focus,
.ap-map-zone-toggle:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-light);
}

.ap-map-filter,
.ap-map-date,
.ap-map-time,
.ap-map-device,
.ap-map-zone-toggle {
	padding: 0 0.7rem;
}

.ap-map-time-range {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	color: var(--text-muted);
	font-size: 0.8rem;
	font-weight: 600;
}

.ap-map-time-range label {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

.ap-map-filters-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	height: 38px;
	padding: 0 0.8rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	cursor: pointer;
}

.ap-map-filters-btn svg {
	width: 16px;
	height: 16px;
}

.ap-map-filters-btn.is-open,
.ap-map-filters-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
}

.ap-map-export-details {
	position: relative;
}

.ap-map-export-details summary {
	list-style: none;
}

.ap-map-export-details summary::-webkit-details-marker {
	display: none;
}

.ap-map-export-summary::after {
	content: " ▾";
	font-size: 0.75em;
	opacity: 0.75;
}

.ap-map-export-details[open] > .ap-map-export-summary {
	border-color: var(--primary);
	color: var(--primary);
}

.ap-map-export-menu {
	position: absolute;
	top: calc(100% + 0.35rem);
	right: 0;
	z-index: 40;
	min-width: 220px;
	padding: 0.35rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
	display: grid;
	gap: 0.15rem;
}

.ap-map-export-menu button {
	appearance: none;
	display: grid;
	gap: 0.1rem;
	width: 100%;
	text-align: left;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--text);
	font: inherit;
	padding: 0.55rem 0.7rem;
	cursor: pointer;
}

.ap-map-export-menu button strong {
	font-size: 0.84rem;
	font-weight: 700;
}

.ap-map-export-menu button span {
	font-size: 0.72rem;
	color: var(--text-muted);
}

.ap-map-export-menu button:hover:not(:disabled) {
	background: var(--background-soft, #f4f8f9);
	color: var(--primary);
}

.ap-map-export-menu button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.ap-map-export-menu button.ap-map-export-secondary {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--text-muted);
	padding: 0.4rem 0.7rem;
}

.ap-map-filters-badge {
	min-width: 1.15rem;
	height: 1.15rem;
	padding: 0 0.3rem;
	border-radius: 999px;
	background: var(--primary);
	color: #fff;
	font-size: 0.7rem;
	line-height: 1.15rem;
	text-align: center;
}

.ap-map-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.ap-map-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	border: 0;
	border-radius: 999px;
	background: var(--primary-light);
	color: var(--primary);
	font: inherit;
	font-size: 1rem;
	font-weight: 700;
	padding: 0.4rem 0.75rem;
	cursor: pointer;
}

.ap-map-chip.is-locked {
	cursor: default;
}

.ap-map-chip span {
	font-size: 1.05rem;
	line-height: 1.15;
	letter-spacing: 0.02em;
}

.ap-filter-layer {
	position: absolute;
	inset: 0;
	z-index: 40;
	display: flex;
	justify-content: flex-end;
	outline: none;
}

.ap-filter-backdrop {
	position: absolute;
	inset: 0;
	border: 0;
	background: rgba(15, 23, 42, 0.38);
	cursor: pointer;
}

.ap-filter-drawer {
	position: relative;
	z-index: 1;
	width: min(380px, 100%);
	height: 100%;
	background: #fff;
	box-shadow: -12px 0 32px rgba(15, 23, 42, 0.16);
	display: flex;
	flex-direction: column;
	animation: ap-filter-in 0.22s ease;
}

@keyframes ap-filter-in {
	from { transform: translateX(28px); }
	to { transform: none; }
}

.ap-filter-head,
.ap-filter-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.9rem 1rem;
	border-bottom: 1px solid var(--border);
}

.ap-filter-foot {
	border-bottom: 0;
	border-top: 1px solid var(--border);
}

.ap-filter-head h2 {
	margin: 0;
	font-size: 1.05rem;
}

.ap-filter-head p,
.ap-filter-foot span {
	margin: 0.15rem 0 0;
	color: var(--text-muted);
	font-size: 0.8rem;
}

.ap-filter-close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--text);
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
}

.ap-filter-close:hover {
	background: #eef3f4;
}

.ap-filter-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 0.35rem 1rem 1rem;
}

.ap-filter-section {
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--border);
}

.ap-filter-section h3 {
	margin: 0;
	font-size: 0.92rem;
}

.ap-filter-note,
.ap-filter-empty,
.ap-filter-lock {
	margin: 0.3rem 0 0.7rem;
	color: var(--text-muted);
	font-size: 0.8rem;
	line-height: 1.4;
}

.ap-filter-lock {
	margin: 0.4rem 0 0.2rem;
	font-weight: 700;
	color: var(--text);
}

.ap-filter-statuses,
.ap-filter-vehicles {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.ap-filter-vehicles {
	max-height: 220px;
	overflow: auto;
}

.ap-filter-status,
.ap-filter-vehicle {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	width: 100%;
	text-align: left;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 650;
	padding: 0.55rem 0.7rem;
	cursor: pointer;
}

.ap-filter-status strong {
	margin-left: auto;
	color: var(--text-muted);
	font-size: 0.8rem;
}

.ap-filter-status i {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

.ap-filter-status i.all { background: #cbd5e1; }
.ap-filter-status i.driving { background: #0A6174; }
.ap-filter-status i.stopped { background: #d97706; }
.ap-filter-status i.offline { background: #94a3b8; }

.ap-filter-status.is-selected,
.ap-filter-vehicle.is-selected,
.ap-filter-presets button.is-selected {
	border-color: var(--primary);
	background: var(--primary-light);
	color: var(--primary);
}

.ap-filter-vehicle.is-locked {
	cursor: default;
}

.ap-filter-presets,
.ap-filter-export,
.ap-filter-dates {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.ap-filter-presets button,
.ap-filter-reset {
	border: 1px solid var(--border);
	border-radius: 999px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.8rem;
	font-weight: 700;
	padding: 0.4rem 0.7rem;
	cursor: pointer;
}

.ap-filter-dates label {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	color: var(--text-muted);
	font-size: 0.75rem;
	font-weight: 700;
}

.ap-filter-rest {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.ap-filter-rest:disabled {
	opacity: 0.55;
}

.ap-filter-reset:disabled {
	opacity: 0.5;
	cursor: default;
}

.ap-map-time {
	width: 7.1rem;
}

.ap-filter-address {
	position: relative;
	margin-bottom: 0.5rem;
}

.ap-filter-address input[type="search"] {
	width: 100%;
	box-sizing: border-box;
}

.ap-filter-suggest {
	list-style: none;
	margin: 0.3rem 0 0;
	padding: 0.2rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: #fff;
	max-height: 180px;
	overflow: auto;
}

.ap-filter-suggest button {
	display: block;
	width: 100%;
	text-align: left;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--text);
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.35;
	padding: 0.45rem 0.5rem;
	cursor: pointer;
}

.ap-filter-suggest button:hover,
.ap-filter-suggest button.is-active {
	background: var(--primary-light);
	color: var(--primary);
}

.ap-filter-passages {
	list-style: none;
	margin: 0.55rem 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.ap-filter-passages button {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	width: 100%;
	text-align: left;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.8rem;
	font-weight: 650;
	padding: 0.4rem 0.55rem;
	cursor: pointer;
}

.ap-filter-passages button:hover {
	border-color: #b45309;
}

.ap-filter-fleet-passages button {
	flex-wrap: wrap;
	align-items: baseline;
}

.ap-filter-fleet-plate {
	flex: 1 1 auto;
	min-width: 4.5rem;
	font-weight: 800;
	letter-spacing: 0.04em;
}

.ap-map-zone-toggle {
	height: 38px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	white-space: nowrap;
}

.ap-map-zone-toggle i {
	width: 10px;
	height: 10px;
	border-radius: 3px;
	background: #c4b5fd;
	border: 1.5px solid #7c3aed;
	display: inline-block;
}

.ap-map-zone-toggle.is-on {
	border-color: #7c3aed;
	background: #f5f3ff;
	color: #6d28d9;
}

.ap-map-zone-toggle:hover {
	border-color: #7c3aed;
}

.ap-map-device {
	min-width: 160px;
	max-width: 220px;
}

.ap-map-switch {
	display: inline-flex;
	padding: 3px;
	border-radius: 10px;
	background: #eef3f4;
	border: 1px solid var(--border);
}

.ap-map-switch button {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--text-muted);
	font: inherit;
	font-size: 0.82rem;
	font-weight: 600;
	padding: 0.4rem 0.85rem;
	border-radius: 8px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	white-space: nowrap;
}

.ap-map-switch button.active {
	background: var(--primary);
	color: #fff;
	box-shadow: 0 4px 12px rgba(10, 97, 116, 0.22);
}

.ap-map-live {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--primary);
}

.ap-map-live-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #16a34a;
	box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
	animation: ap-map-pulse 1.6s ease-out infinite;
}

.ap-map-live.is-paused .ap-map-live-dot {
	background: var(--text-muted);
	animation: none;
	box-shadow: none;
}

@keyframes ap-map-pulse {
	0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
	70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
	100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.ap-map-updated {
	font-size: 0.78rem;
	color: var(--text-muted);
	white-space: nowrap;
}

.ap-map-refresh {
	height: 38px;
	padding: 0 0.85rem;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
}

.ap-map-refresh:hover:not(:disabled) {
	border-color: var(--primary);
	color: var(--primary);
}

.ap-map-refresh:disabled {
	opacity: 0.55;
	cursor: default;
}

.ap-map-body {
	position: relative;
	flex: 1;
	display: grid;
	grid-template-columns: 380px minmax(0, 1fr);
	min-height: 0;
}

.ap-map-sidebar {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: #fff;
	border-right: 1px solid var(--border);
}

.ap-map-sidebar-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.85rem 1rem 0.55rem;
}

.ap-map-sidebar-head h2 {
	margin: 0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.ap-map-count {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.ap-map-sort {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0 0.7rem 0.55rem;
}

.ap-map-sort-select,
.ap-map-sort-dir {
	height: 32px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.78rem;
	font-weight: 600;
}

.ap-map-sort-select {
	flex: 1;
	min-width: 0;
	padding: 0 0.55rem;
}

.ap-map-sort-dir {
	flex: 0 0 auto;
	min-width: 36px;
	padding: 0 0.45rem;
	color: var(--primary);
	cursor: pointer;
}

.ap-map-sort-dir:hover:not(:disabled) {
	border-color: var(--primary);
	background: var(--primary-light);
}

.ap-map-sort-dir:disabled {
	opacity: 0.45;
	cursor: default;
}

.ap-map-card-top {
	display: flex;
	align-items: flex-start;
	gap: 0.2rem;
}

.ap-map-card-top .ap-map-card-main {
	flex: 1;
	min-width: 0;
	width: auto;
}

.ap-map-drag {
	flex: 0 0 auto;
	width: 22px;
	height: 28px;
	margin-top: 0.2rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	cursor: grab;
	touch-action: none;
}

.ap-map-drag svg {
	width: 14px;
	height: 14px;
}

.ap-map-drag:active {
	cursor: grabbing;
}

.ap-map-drag.is-disabled {
	opacity: 0.35;
	pointer-events: none;
	cursor: default;
}

.ap-map-card-ghost {
	opacity: 0.55;
	background: var(--primary-light);
	border-color: var(--primary);
}

.ap-trip-day {
	display: block;
	width: calc(100% - 1.4rem);
	margin: 0 0.7rem 0.45rem;
	padding: 0.4rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	color: var(--primary);
	font: inherit;
	font-size: 0.82rem;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
}

.ap-trip-day:hover:not(:disabled),
.ap-trip-day.is-selected {
	border-color: var(--primary);
	background: var(--primary-light);
}

.ap-trip-day:disabled {
	opacity: 0.55;
	cursor: default;
}

.ap-map-list {
	flex: 1;
	overflow: auto;
	padding: 0.15rem 0.7rem 0.9rem;
	-webkit-overflow-scrolling: touch;
}

.ap-map-card {
	width: 100%;
	text-align: left;
	border: 1px solid var(--border);
	background: #fff;
	border-radius: 12px;
	padding: 0.85rem 0.9rem;
	margin-bottom: 0.55rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	box-shadow: 0 1px 2px rgba(10, 97, 116, 0.04);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ap-map-card-main {
	appearance: none;
	border: 0;
	background: transparent;
	padding: 0;
	margin: 0;
	width: 100%;
	text-align: left;
	cursor: pointer;
	display: grid;
	grid-template-columns: 36px minmax(0, 1fr);
	gap: 0.75rem;
	color: inherit;
	font: inherit;
}

.ap-map-card-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.4rem;
}

.ap-map-card-actions--single {
	grid-template-columns: 1fr;
}

.ap-map-maint-btn {
	appearance: none;
	align-self: stretch;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	border: 1px solid var(--border);
	background: #f4f8f9;
	color: var(--primary);
	font: inherit;
	font-size: 0.78rem;
	font-weight: 700;
	padding: 0.42rem 0.7rem;
	border-radius: 8px;
	cursor: pointer;
}

.ap-map-maint-btn svg {
	width: 14px;
	height: 14px;
}

.ap-map-maint-btn:hover {
	border-color: var(--primary);
	background: var(--primary-light);
}

.ap-map-card:hover {
	border-color: rgba(10, 97, 116, 0.35);
}

.ap-map-card.is-selected {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-light), 0 8px 20px rgba(10, 97, 116, 0.08);
}

.ap-map-card.is-search-match {
	border-color: #d97706;
	animation: ap-map-search-blink 1.1s ease-in-out infinite;
}

@keyframes ap-map-search-blink {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.45);
		background: #fff;
	}
	50% {
		box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.28);
		background: #fff7ed;
	}
}

.ap-map-card-status {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	color: #fff;
	flex-shrink: 0;
}

.ap-map-card-status.driving { background: #0A6174; }
.ap-map-card-status.stopped { background: #d97706; }
.ap-map-card-status.offline { background: #94a3b8; }

.ap-map-card-status svg {
	width: 18px;
	height: 18px;
}

.ap-map-card-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.15rem;
}

.ap-map-plate {
	font-weight: 700;
	font-size: 0.95rem;
	letter-spacing: 0.02em;
}

.ap-map-title-badges {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	flex-shrink: 0;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.ap-map-speed,
.ap-map-odo,
.ap-map-fuel {
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--primary);
	background: var(--primary-light);
	padding: 0.12rem 0.45rem;
	border-radius: 999px;
	white-space: nowrap;
}

.ap-map-odo {
	color: var(--text);
	background: #eef3f4;
}

.ap-map-fuel {
	color: #0f766e;
	background: #ccfbf1;
}

.ap-map-card-sub,
.ap-map-card-meta {
	margin: 0;
	font-size: 0.78rem;
	color: var(--text-muted);
	line-height: 1.35;
}

.ap-map-card-meta {
	display: flex;
	align-items: flex-start;
	gap: 0.35rem;
	margin-top: 0.28rem;
}

.ap-map-card-meta svg {
	width: 13px;
	height: 13px;
	flex-shrink: 0;
	margin-top: 0.12rem;
}

.ap-map-empty,
.ap-map-error {
	margin: 0.5rem 1rem 1rem;
	padding: 0.85rem 0.95rem;
	border-radius: 10px;
	font-size: 0.88rem;
	line-height: 1.4;
}

.ap-map-empty {
	background: var(--surface);
	color: var(--text-muted);
}

.ap-map-error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.ap-map-canvas {
	position: relative;
	z-index: 0;
	min-width: 0;
	min-height: 0;
}

.ap-map-canvas .leaflet-container {
	width: 100%;
	height: 100%;
	background: #dbe4e8;
	font-family: inherit;
}

.ap-map-pin-wrap {
	background: transparent;
	border: 0;
}

.ap-map-pin {
	display: flex;
	flex-direction: column;
	align-items: center;
	transform: translateY(-6px);
}

.ap-map-pin-dot {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
	display: grid;
	place-items: center;
}

.ap-map-pin-dot--driving { background: #0A6174; }
.ap-map-pin-dot--stopped { background: #d97706; }
.ap-map-pin-dot--offline { background: #94a3b8; }

.ap-map-pin.is-selected .ap-map-pin-dot {
	box-shadow: 0 0 0 4px rgba(10, 97, 116, 0.28), 0 2px 8px rgba(0, 0, 0, 0.28);
}

.ap-map-pin.is-search-match {
	animation: ap-map-search-pin-pulse 1.1s ease-in-out infinite;
}

.ap-map-pin.is-search-match .ap-map-pin-dot {
	animation: ap-map-search-pin-blink 1.1s ease-in-out infinite;
}

.ap-map-pin.is-search-match .ap-map-pin-label {
	animation: ap-map-search-label-blink 1.1s ease-in-out infinite;
}

@keyframes ap-map-search-pin-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.55; }
}

@keyframes ap-map-search-pin-blink {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.55), 0 2px 8px rgba(0, 0, 0, 0.28);
	}
	50% {
		box-shadow: 0 0 0 8px rgba(217, 119, 6, 0), 0 2px 8px rgba(0, 0, 0, 0.28);
	}
}

@keyframes ap-map-search-label-blink {
	0%, 100% { background: #111; }
	50% { background: #d97706; }
}

.ap-map-pin-arrow {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-bottom: 7px solid #fff;
	margin-bottom: 1px;
}

.ap-map-pin-label {
	margin-top: 4px;
	padding: 1px 6px;
	border-radius: 4px;
	background: #111;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.03em;
	white-space: nowrap;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.ap-map-popup .leaflet-popup-content-wrapper {
	border-radius: 10px;
	box-shadow: var(--shadow-lg);
}

.ap-map-popup-body {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	font-size: 0.85rem;
}

.ap-map-popup-meta {
	color: var(--text-muted);
	font-size: 0.78rem;
}

.ap-map-popup-street {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	margin-top: 0.45rem;
	padding: 0.4rem 0.65rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	color: var(--primary);
	font-size: 0.78rem;
	font-weight: 700;
	text-decoration: none;
	line-height: 1.2;
}

.ap-map-popup-street svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

.ap-map-popup-street:hover {
	border-color: var(--primary);
	background: var(--primary-light);
}

.ap-map-legend {
	position: absolute;
	left: 12px;
	bottom: 12px;
	z-index: 400;
	display: flex;
	gap: 0.55rem;
	padding: 0.4rem 0.6rem;
	background: rgba(255, 255, 255, 0.94);
	border: 1px solid var(--border);
	border-radius: 999px;
	box-shadow: var(--shadow);
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--text-muted);
}

.ap-map-legend span {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

.ap-map-legend i {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
}

.ap-map-legend i.driving { background: #0A6174; }
.ap-map-legend i.stopped { background: #d97706; }
.ap-map-legend i.offline { background: #94a3b8; }
.ap-map-legend i.mike4 {
	border-radius: 2px;
	background: rgba(124, 58, 237, 0.35);
	border: 1.5px solid #7c3aed;
	box-sizing: border-box;
}
.ap-map-legend i.mike4-path { background: #7c3aed; }
.ap-map-legend i.mike4-enter { background: #16a34a; }
.ap-map-legend i.mike4-exit { background: #dc2626; }

.ap-map-legend--mike4 {
	top: 12px;
	bottom: auto;
	flex-wrap: wrap;
	max-width: calc(100% - 24px);
	border-radius: 12px;
}

.ap-mike4-badge {
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 0.12rem 0.42rem;
	border-radius: 999px;
	white-space: nowrap;
}

.ap-mike4-badge--entra {
	color: #166534;
	background: #dcfce7;
}

.ap-mike4-badge--esce {
	color: #991b1b;
	background: #fee2e2;
}

.ap-mike4-badge--interno {
	color: #6d28d9;
	background: #ede9fe;
}

.ap-mike4-cross-wrap {
	background: transparent;
	border: 0;
}

.ap-mike4-cross {
	font: 700 11px/1.1 inherit;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #fff;
	padding: 0.22rem 0.45rem;
	border-radius: 999px;
	border: 2px solid #fff;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
	white-space: nowrap;
}

.ap-mike4-cross--entra { background: #16a34a; }
.ap-mike4-cross--esce { background: #dc2626; }

.ap-trip-card {
	position: relative;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 0.4rem 0.6rem;
	margin-bottom: 0.4rem;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ap-trip-compact-row {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.ap-trip-compact {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	flex: 1;
	min-width: 0;
	flex-wrap: wrap;
	border: 0;
	background: none;
	padding: 0.15rem 0;
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.ap-trip-times {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ap-trip-times strong {
	font-size: 0.9rem;
}

.ap-trip-times span {
	color: var(--text-muted);
	font-weight: 600;
}

.ap-trip-card:hover {
	border-color: rgba(10, 97, 116, 0.28);
}

.ap-trip-card.is-selected {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-light), 0 8px 20px rgba(10, 97, 116, 0.08);
}

.ap-trip-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.35rem;
}

.ap-trip-date {
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--text);
}

.ap-trip-head-right {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	flex-shrink: 1;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.ap-trip-km {
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--text);
	background: #eef3f4;
	padding: 0.12rem 0.45rem;
	border-radius: 999px;
	white-space: nowrap;
}

.ap-trip-details {
	appearance: none;
	border: 0;
	background: none;
	padding: 0;
	color: var(--primary);
	font: inherit;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.ap-trip-details:hover {
	text-decoration: underline;
}

.ap-trip-idrow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0;
}

.ap-trip-idtext {
	font-size: 0.8rem;
	color: #6b7c86;
	min-width: 0;
	line-height: 1.35;
}

.ap-trip-sep {
	margin: 0 0.35rem;
	color: #c0c9ce;
}

.ap-trip-warn-wrap {
	position: relative;
	flex-shrink: 0;
}

.ap-trip-warn {
	display: inline-flex;
	align-items: center;
	gap: 0.28rem;
	height: 24px;
	padding: 0 0.45rem;
	border-radius: 999px;
	border: 1px solid #f1b4b4;
	background: #fdecec;
	color: #c24141;
	font: inherit;
	font-size: 0.75rem;
	font-weight: 700;
	cursor: pointer;
}

.ap-trip-warn.is-open,
.ap-trip-warn:hover {
	border-color: #e08989;
	background: #fadada;
}

.ap-trip-warn svg {
	width: 13px;
	height: 13px;
}

.ap-trip-events {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 20;
	min-width: 220px;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
	overflow: hidden;
}

.ap-trip-events-head {
	padding: 0.45rem 0.75rem;
	background: #f3f5f6;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--text-muted);
}

.ap-trip-event-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	padding: 0.55rem 0.75rem;
	font-size: 0.8rem;
	border-top: 1px solid var(--border);
}

.ap-trip-event-count {
	color: var(--text-muted);
	font-weight: 600;
}

.ap-trip-route {
	display: flex;
	flex-direction: column;
	gap: 0;
	width: 100%;
	text-align: left;
	border: 0;
	background: none;
	padding: 0;
	cursor: pointer;
	font: inherit;
	color: inherit;
}

.ap-trip-leg {
	display: grid;
	grid-template-columns: 16px minmax(0, 1fr);
	gap: 0.65rem;
	align-items: start;
}

.ap-trip-dot {
	width: 14px;
	height: 14px;
	margin-top: 0.2rem;
	border: 2px solid #8aa0aa;
	background: #fff;
	box-sizing: border-box;
}

.ap-trip-dot--start {
	border-radius: 50%;
}

.ap-trip-dot--end {
	border-radius: 3px;
	display: grid;
	place-items: center;
	font-size: 0.55rem;
	font-weight: 700;
	color: #5f737c;
	line-height: 1;
}

.ap-trip-leg-text {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

.ap-trip-leg-text strong {
	font-size: 0.88rem;
}

.ap-trip-leg-text span {
	font-size: 0.78rem;
	color: var(--text-muted);
	line-height: 1.35;
}

.ap-trip-line {
	width: 2px;
	height: 14px;
	margin: 0.15rem 0 0.15rem 6px;
	background: #d5dee2;
}

.ap-playbar {
	position: absolute;
	left: 12px;
	right: 58px;
	bottom: 12px;
	z-index: 500;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 0.85rem 2.1rem 0.75rem 0.75rem;
	background: #0A6174;
	color: #fff;
	border-radius: 10px;
	box-shadow: 0 10px 28px rgba(10, 97, 116, 0.35);
	overflow: hidden;
}

.ap-playbar-progress {
	position: absolute;
	top: 0;
	left: 0;
	height: 3px;
	background: #7ad0e0;
	pointer-events: none;
}

.ap-playbar-close {
	position: absolute;
	top: 4px;
	right: 8px;
	appearance: none;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 1.15rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.8;
}

.ap-playbar-close:hover {
	opacity: 1;
}

.ap-playbar-play {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	flex-shrink: 0;
}

.ap-playbar-play svg {
	width: 16px;
	height: 16px;
}

.ap-playbar-timeline {
	flex: 1;
	min-width: 180px;
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 0.45rem;
	align-items: center;
	font-size: 0.78rem;
	font-weight: 600;
}

.ap-playbar-timeline input[type="range"] {
	width: 100%;
	accent-color: #7ad0e0;
}

.ap-playbar-clock {
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	opacity: 0.92;
	white-space: nowrap;
}

.ap-playbar-speed {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.78rem;
	white-space: nowrap;
}

.ap-playbar-speed select {
	height: 28px;
	border: 0;
	border-radius: 6px;
	padding: 0 0.4rem;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.78rem;
	font-weight: 700;
}

.ap-maint-overlay {
	position: fixed;
	inset: 0;
	z-index: 1200;
	background: rgba(15, 23, 42, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.ap-maint-modal {
	width: min(720px, 100%);
	max-height: min(88vh, 860px);
	overflow: auto;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
	padding: 1.15rem 1.2rem 1.3rem;
}

.ap-maint-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.95rem;
}

.ap-maint-kicker {
	margin: 0;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.ap-maint-head h3 {
	margin: 0.12rem 0 0.1rem;
	font-size: 1.2rem;
}

.ap-maint-head p {
	margin: 0;
	font-size: 0.82rem;
	color: var(--text-muted);
}

.ap-maint-close {
	appearance: none;
	border: 0;
	background: transparent;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: var(--text-muted);
}

.ap-maint-banner {
	border-radius: 10px;
	padding: 0.75rem 0.9rem;
	margin-bottom: 0.9rem;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.ap-maint-banner.is-ok {
	background: #ecfdf3;
	color: #166534;
}

.ap-maint-banner.is-alert {
	background: #fef2f2;
	color: #991b1b;
}

.ap-maint-banner span {
	font-size: 0.82rem;
}

.ap-maint-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
	gap: 0.85rem;
}

.ap-maint-card {
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 0.85rem 0.95rem;
	background: #fafcfc;
}

.ap-maint-card h4 {
	margin: 0 0 0.7rem;
	font-size: 0.92rem;
}

.ap-maint-metrics {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
}

.ap-maint-metrics li {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.25rem 0.75rem;
	align-items: center;
	font-size: 0.84rem;
}

.ap-maint-metrics li span:first-child {
	color: var(--text-muted);
}

.ap-maint-metrics strong {
	font-size: 0.95rem;
}

.ap-maint-bar {
	grid-column: 1 / -1;
	height: 7px;
	border-radius: 999px;
	background: #e6eef0;
	overflow: hidden;
}

.ap-maint-bar i {
	display: block;
	height: 100%;
	background: #2563eb;
	border-radius: inherit;
}

.ap-maint-bar i.ok { background: #16a34a; }
.ap-maint-bar i.warn { background: #d97706; }
.ap-maint-bar i.bad { background: #dc2626; }

.ap-maint-issue-stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.55rem;
	margin-bottom: 0.7rem;
}

.ap-maint-issue-stats div {
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 0.55rem 0.7rem;
}

.ap-maint-issue-stats span {
	display: block;
	font-size: 0.72rem;
	color: var(--text-muted);
}

.ap-maint-issue-stats strong {
	font-size: 1.25rem;
}

.ap-maint-empty {
	margin: 0;
	font-size: 0.84rem;
	color: var(--text-muted);
}

.ap-maint-issues {
	margin: 0;
	padding-left: 1.1rem;
	font-size: 0.82rem;
	color: var(--text);
}

.ap-stats-modal {
	width: min(860px, 100%);
}

.ap-diag-period {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.85rem;
	color: var(--text-muted);
}

.ap-diag-period .input-sivis {
	width: auto;
	min-width: 9.5rem;
}

.ap-diag-table th,
.ap-diag-table td {
	white-space: nowrap;
	vertical-align: middle;
}

.ap-diag-table .ap-maint-bar {
	display: block;
	margin-top: 0.25rem;
	min-width: 4.5rem;
}

.ap-diag-row {
	cursor: pointer;
}

.ap-diag-row:hover {
	background: #f8fafc;
}

.ap-diag-row-selected {
	background: color-mix(in srgb, var(--primary, #2563eb) 8%, transparent);
}

.ap-diag-row-warn td:first-child strong {
	color: #b45309;
}

.ap-diag-badge {
	display: inline-block;
	margin-left: 0.35rem;
	padding: 0.1rem 0.4rem;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 600;
	background: #e2e8f0;
	color: #334155;
}

.ap-diag-badge-alert {
	background: #fee2e2;
	color: #b91c1c;
}

.ap-diag-badge-muted {
	background: #f1f5f9;
	color: #64748b;
}

.ap-diag-muted,
.ap-diag-error {
	font-size: 0.9rem;
}

.ap-diag-muted { color: var(--text-muted); }
.ap-diag-error { color: #b91c1c; }
.ap-diag-text-alert { color: #b91c1c; }

.ap-diag-fs {
	position: fixed;
	inset: 0;
	z-index: 1300;
	background: var(--bg, #f8fafc);
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}

.ap-diag-fs-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--border);
	background: #fff;
	flex-shrink: 0;
}

.ap-diag-fs-head-left {
	display: flex;
	align-items: flex-start;
	gap: 0.9rem;
	min-width: 0;
}

.ap-diag-fs-back {
	flex-shrink: 0;
	margin-top: 0.15rem;
}

.ap-diag-fs-kicker {
	margin: 0;
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.ap-diag-fs-title {
	margin: 0.1rem 0 0;
	font-size: 1.45rem;
	line-height: 1.2;
	display: flex;
	align-items: center;
	gap: 0.45rem;
	flex-wrap: wrap;
}

.ap-diag-fs-sub {
	margin: 0.25rem 0 0;
	color: var(--text-muted);
	font-size: 0.88rem;
}

.ap-diag-fs-close {
	border: none;
	background: transparent;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	color: var(--text-muted);
	padding: 0.15rem 0.4rem;
	border-radius: 8px;
}

.ap-diag-fs-close:hover {
	background: #f1f5f9;
	color: var(--text);
}

.ap-diag-fs-loading,
.ap-diag-fs-empty {
	margin: 0;
	padding: 2rem 1.25rem;
	color: var(--text-muted);
	font-size: 0.95rem;
}

.ap-diag-kpi {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 0.75rem;
	padding: 1rem 1.25rem 0.5rem;
	flex-shrink: 0;
}

.ap-diag-kpi-card {
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 0.85rem 0.95rem;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
}

.ap-diag-kpi-card.is-alert {
	border-color: #fecaca;
	background: #fff7f7;
}

.ap-diag-kpi-card > span {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.ap-diag-kpi-card > strong {
	font-size: 1.45rem;
	line-height: 1.15;
	font-variant-numeric: tabular-nums;
}

.ap-diag-kpi-card > em {
	font-style: normal;
	font-size: 0.78rem;
	color: var(--text-muted);
}

.ap-diag-kpi-card .ap-maint-bar {
	margin-top: 0.35rem;
}

.ap-diag-kpi-triple {
	display: flex;
	align-items: baseline;
	gap: 0.25rem;
	flex-wrap: wrap;
}

.ap-diag-kpi-triple small {
	font-size: 0.9rem;
	color: var(--text-muted);
	font-weight: 500;
}

.ap-diag-fs-tabs {
	padding: 0.5rem 1.25rem 0;
	flex-shrink: 0;
	overflow-x: auto;
}

.ap-diag-fs-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 0.75rem 1.25rem 1.5rem;
}

.ap-diag-detail-table {
	width: 100%;
	background: #fff;
}

.ap-diag-detail-table th:first-child,
.ap-diag-detail-table td:first-child {
	white-space: nowrap;
}

@media (max-width: 1200px) {
	.ap-diag-kpi {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 720px) {
	.ap-diag-kpi {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ap-diag-fs-head-left {
		flex-direction: column;
		gap: 0.5rem;
	}
}

.ap-stats-period {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.65rem;
	margin-bottom: 0.95rem;
}

.ap-stats-presets {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.3rem;
}

.ap-stats-presets button {
	appearance: none;
	border: 1px solid var(--border);
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 0.78rem;
	font-weight: 700;
	padding: 0.32rem 0.65rem;
	border-radius: 999px;
	cursor: pointer;
}

.ap-stats-presets button.active {
	border-color: var(--primary);
	background: var(--primary-light);
	color: var(--primary);
}

.ap-stats-dates {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.82rem;
	color: var(--text-muted);
}

.ap-stats-dates input[type="date"] {
	height: 32px;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0 0.45rem;
	font: inherit;
	font-size: 0.8rem;
}

.ap-map-switch-short {
	display: none;
}

.ap-map-mobile-panes {
	display: none;
}

@media (max-width: 991px) {
	.ap-map-page {
		margin: 0 -1rem -1rem;
		height: calc(100dvh - var(--header-height) - 1rem);
		min-height: 0;
	}

	.ap-map-toolbar {
		align-items: stretch;
		gap: 0.5rem;
		padding: 0.55rem 0.75rem;
	}

	.ap-map-mobile-panes {
		display: flex;
		width: 100%;
		padding: 3px;
		border-radius: 10px;
		background: #eef3f4;
		border: 1px solid var(--border);
	}

	.ap-map-mobile-panes button {
		appearance: none;
		flex: 1;
		border: 0;
		background: transparent;
		color: var(--text-muted);
		font: inherit;
		font-size: 0.82rem;
		font-weight: 700;
		padding: 0.48rem 0.6rem;
		min-height: 40px;
		border-radius: 8px;
		cursor: pointer;
	}

	.ap-map-mobile-panes button.active {
		background: var(--primary);
		color: #fff;
		box-shadow: 0 4px 12px rgba(10, 97, 116, 0.22);
	}

	.ap-map-toolbar-left,
	.ap-map-toolbar-right {
		width: 100%;
		gap: 0.45rem;
	}

	.ap-map-search {
		width: 100%;
		min-width: 0;
		flex: 1 1 100%;
	}

	.ap-map-filter,
	.ap-map-date,
	.ap-map-time,
	.ap-map-device,
	.ap-map-zone-toggle,
	.ap-map-refresh {
		flex: 1 1 auto;
		min-width: 0;
		min-height: 40px;
	}

	.ap-filter-drawer {
		width: 100%;
	}

	.ap-map-device {
		max-width: none;
		min-width: 0;
		flex: 1 1 140px;
	}

	.ap-map-switch {
		flex: 1 1 auto;
	}

	.ap-map-switch button {
		flex: 1;
		justify-content: center;
		min-height: 36px;
		padding: 0.4rem 0.55rem;
	}

	.ap-map-switch-full {
		display: none;
	}

	.ap-map-switch-short {
		display: inline;
	}

	.ap-map-live,
	.ap-map-updated {
		display: none;
	}

	.ap-map-body {
		grid-template-columns: 1fr;
		grid-template-rows: minmax(0, 1fr);
		position: relative;
	}

	.ap-map-page.is-map .ap-map-sidebar {
		display: none;
	}

	.ap-map-page.is-list .ap-map-canvas {
		position: absolute;
		inset: 0;
		opacity: 0;
		pointer-events: none;
		z-index: 0;
	}

	.ap-map-page.is-list .ap-map-sidebar {
		z-index: 1;
		height: 100%;
		border-right: 0;
	}

	.ap-map-legend {
		left: 8px;
		bottom: 8px;
		max-width: calc(100% - 58px);
		flex-wrap: wrap;
		border-radius: 12px;
		font-size: 0.68rem;
		padding: 0.35rem 0.5rem;
	}

	.ap-map-legend--mike4 {
		top: 8px;
		bottom: auto;
		max-width: calc(100% - 16px);
	}

	.ap-playbar {
		left: 8px;
		right: 8px;
		bottom: 8px;
		flex-direction: column;
		align-items: stretch;
		gap: 0.45rem;
		padding: 0.7rem 2rem 0.7rem 0.7rem;
	}

	.ap-playbar-timeline {
		width: 100%;
		min-width: 0;
	}

	.ap-playbar-clock,
	.ap-playbar-speed {
		font-size: 0.75rem;
	}

	.ap-map-canvas.has-playbar .leaflet-bottom {
		margin-bottom: 7.25rem;
	}

	.ap-maint-overlay {
		padding: 0.5rem;
		align-items: stretch;
	}

	.ap-maint-modal,
	.ap-stats-modal {
		width: 100%;
		max-height: calc(100dvh - var(--header-height) - 1rem);
		border-radius: 14px;
	}
}

@media (max-width: 767px) {
	.ap-map-page {
		margin: 0 -0.75rem -0.75rem;
		height: calc(100dvh - var(--header-height) - 0.75rem);
		min-height: 0;
	}

	.ap-map-toolbar {
		padding: 0.5rem 0.65rem 0.55rem;
	}

	.ap-map-card-title {
		flex-wrap: wrap;
		align-items: flex-start;
	}

	.ap-trip-details {
		font-size: 0.78rem;
	}
}

@media (max-width: 480px) {
	.ap-map-page {
		margin: 0 -0.5rem -0.5rem;
		height: calc(100dvh - var(--header-height) - 0.5rem);
	}
}

@media (max-width: 720px) {
	.ap-maint-grid {
		grid-template-columns: 1fr;
	}

	.ap-stats-period {
		flex-direction: column;
		align-items: stretch;
	}

	.ap-stats-dates {
		flex-wrap: wrap;
	}
}

/* Dipendenti — tab Permessi */
.perm-tab {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.perm-oda-referent {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin: 0;
	padding: 0.9rem 1rem;
	border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
	border-radius: 12px;
	background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, white), var(--surface-card));
	cursor: pointer;
}

.perm-oda-referent input {
	width: 1.15rem;
	height: 1.15rem;
	margin-top: 0.15rem;
	accent-color: var(--primary);
	flex-shrink: 0;
}

.perm-oda-referent-copy {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.perm-oda-referent-copy strong {
	font-size: 0.9375rem;
	color: var(--text);
}

.perm-oda-referent-copy span {
	font-size: 0.8125rem;
	color: var(--text-muted);
	line-height: 1.4;
}

.perm-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0.75rem 1rem;
}

.perm-search-bar {
	max-width: none;
	flex: 1 1 280px;
}

.perm-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.35rem 0.55rem;
	padding: 0.7rem 1rem;
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--surface);
	min-width: 200px;
}

.perm-summary-value {
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--primary);
	line-height: 1;
}

.perm-summary-label {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--text);
}

.perm-summary-split {
	width: 100%;
	font-size: 0.75rem;
	color: var(--text-muted);
}

.perm-cat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
}

.perm-cat-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.4rem 0.8rem;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--surface-card);
	color: var(--text);
	font-size: 0.8125rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.perm-cat-chip:hover {
	border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
	background: var(--primary-light);
	color: var(--primary);
}

.perm-cat-chip.is-active {
	border-color: var(--primary);
	background: var(--primary);
	color: #fff;
	box-shadow: 0 1px 6px rgba(10, 97, 116, 0.22);
}

.perm-cat-chip-count {
	font-size: 0.7rem;
	font-weight: 700;
	min-width: 1.15rem;
	padding: 0.08rem 0.38rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--text) 8%, transparent);
}

.perm-cat-chip.is-active .perm-cat-chip-count {
	background: rgba(255, 255, 255, 0.22);
	color: #fff;
}

.perm-hint {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.8125rem;
}

.perm-empty {
	padding: 2rem 1rem;
	text-align: center;
	border: 1px dashed var(--border);
	border-radius: 12px;
	background: var(--surface);
	color: var(--text-muted);
}

.perm-empty p {
	margin: 0;
}

.perm-groups {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
	gap: 1rem;
}

.perm-group {
	background: var(--surface-card);
	border: 1px solid var(--border);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: var(--shadow);
}

.perm-group-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 7%, white), var(--surface));
	border-bottom: 1px solid var(--border);
}

.perm-group-icon {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--primary-light);
	color: var(--primary);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.perm-group-icon svg {
	width: 20px;
	height: 20px;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.perm-group-heading h3 {
	margin: 0;
	font-size: 0.975rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.perm-group-heading p {
	margin: 0.15rem 0 0;
	font-size: 0.75rem;
	color: var(--text-muted);
}

.perm-rows {
	list-style: none;
	margin: 0;
	padding: 0;
}

.perm-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.7rem 1rem;
	border-bottom: 1px solid var(--border);
	transition: background 0.15s ease;
}

.perm-row:last-child {
	border-bottom: none;
}

.perm-row.is-lettura {
	background: color-mix(in srgb, #0ea5e9 7%, white);
}

.perm-row.is-completo {
	background: color-mix(in srgb, var(--primary) 8%, white);
}

.perm-name {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--text);
	line-height: 1.35;
	min-width: 0;
}

.perm-level-switch {
	display: inline-flex;
	flex-shrink: 0;
	padding: 3px;
	gap: 2px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 9px;
}

.perm-level-readonly {
	flex-shrink: 0;
	padding: 0.32rem 0.62rem;
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--text-muted);
}

.perm-level-btn {
	padding: 0.32rem 0.62rem;
	border: none;
	background: transparent;
	border-radius: 6px;
	font-size: 0.72rem;
	font-weight: 600;
	font-family: inherit;
	color: var(--text-muted);
	cursor: pointer;
	line-height: 1.2;
	transition: background 0.15s ease, color 0.15s ease;
}

.perm-level-btn:hover {
	background: color-mix(in srgb, var(--text) 6%, transparent);
	color: var(--text);
}

.perm-level-btn.is-none {
	background: color-mix(in srgb, var(--text) 8%, white);
	color: var(--text-muted);
}

.perm-level-btn.is-lettura {
	background: #e0f2fe;
	color: #0369a1;
}

.perm-level-btn.is-completo {
	background: var(--primary);
	color: #fff;
}

@media (max-width: 720px) {
	.perm-groups {
		grid-template-columns: 1fr;
	}

	.perm-row {
		flex-direction: column;
		align-items: stretch;
		gap: 0.5rem;
	}

	.perm-level-switch {
		width: 100%;
	}

	.perm-level-btn {
		flex: 1;
	}
}

.doc-capture-actions {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: center;
}

.doc-capture-btn {
	padding: 0.25rem 0.5rem;
	font-size: 0.875rem;
}

.doc-capture-photo-disabled {
	opacity: 0.55;
	pointer-events: none;
}

.doc-capture-file {
	font-size: 0.875rem;
}

.doc-scan-root {
	position: fixed;
	inset: 0;
	z-index: 11000;
	background: #000;
	color: #fff;
	display: flex;
	flex-direction: column;
}

.doc-scan-view {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.doc-scan-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.doc-scan-live {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
	z-index: 1;
}

.doc-scan-photo .doc-scan-handle,
.doc-scan-photo .doc-scan-quad {
	display: none;
}

.doc-capture-photo {
	position: relative;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.doc-capture-photo-caption {
	position: relative;
	z-index: 1;
	pointer-events: none;
}

.doc-capture-photo-input {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0.02;
	font-size: 1rem;
	cursor: pointer;
}

.doc-scan-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
}

.doc-scan-bar-top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 4;
	padding-top: calc(0.75rem + env(safe-area-inset-top));
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}

.doc-scan-bar-bottom {
	position: relative;
	z-index: 4;
	justify-content: center;
}

.doc-scan-hint {
	position: absolute;
	left: 1rem;
	right: 1rem;
	bottom: 6.5rem;
	z-index: 4;
	margin: 0;
	text-align: center;
	font-size: 0.95rem;
	text-shadow: 0 1px 2px #000;
}

.doc-scan-count {
	font-size: 0.95rem;
	font-weight: 600;
}

.doc-scan-textbtn {
	background: transparent;
	color: #fff;
	border: 0;
	font-size: 1rem;
	font-weight: 600;
	padding: 0.6rem 0.8rem;
}

.doc-scan-textbtn-primary {
	color: #f5c518;
}

.doc-scan-shutter {
	width: 68px;
	height: 68px;
	border-radius: 50%;
	border: 4px solid #fff;
	background: #f5c518;
	padding: 0;
}

.doc-scan-shutter:disabled {
	opacity: 0.35;
}

.doc-scan-review,
.doc-scan-gallery {
	position: absolute;
	inset: 0;
	z-index: 3;
	background: #000;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding-top: calc(4.5rem + env(safe-area-inset-top));
}

.doc-scan-live-controls[hidden],
.doc-scan-review[hidden],
.doc-scan-gallery[hidden],
.doc-scan-fallback[hidden] {
	display: none;
}

.doc-scan-plain .doc-scan-quad,
.doc-scan-plain .doc-scan-handle {
	display: none;
}

.doc-scan-fallback {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	padding: calc(5rem + env(safe-area-inset-top)) 1.5rem calc(2rem + env(safe-area-inset-bottom));
	text-align: center;
	background: #111;
}

.doc-scan-fallback-msg {
	margin: 0;
	max-width: 28rem;
	font-size: 1.05rem;
	line-height: 1.4;
}

.doc-scan-photo-btn {
	position: relative;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #f5c518;
	color: #111;
	border: 0;
	border-radius: 999px;
	font-size: 1.05rem;
	font-weight: 700;
	padding: 0.9rem 1.5rem;
}

.doc-scan-file {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0.02;
	font-size: 1rem;
	cursor: pointer;
}

.doc-scan-fit {
	position: relative;
	max-width: calc(100% - 1.5rem);
}

.doc-scan-review .doc-scan-bar-bottom,
.doc-scan-gallery .doc-scan-bar-bottom {
	margin-top: auto;
	width: 100%;
}

.doc-scan-fit img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 11rem);
	width: auto;
	height: auto;
	margin: 0 auto;
}

.doc-scan-quad {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.doc-scan-quad polygon {
	fill: transparent;
	stroke: #f5c518;
	stroke-width: 2;
	vector-effect: non-scaling-stroke;
}

.doc-scan-handle {
	position: absolute;
	width: 28px;
	height: 28px;
	margin-left: -14px;
	margin-top: -14px;
	border-radius: 50%;
	border: 3px solid #fff;
	background: #f5c518;
	padding: 0;
	touch-action: none;
}

.doc-scan-gallery {
	align-items: stretch;
}

.doc-scan-thumbs {
	flex: 1;
	width: 100%;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-content: flex-start;
	padding: 0 1rem 1rem;
	overflow: auto;
}

.doc-scan-thumb {
	position: relative;
	margin: 0;
	width: 96px;
}

.doc-scan-thumb img {
	width: 96px;
	height: 128px;
	object-fit: cover;
	border-radius: 6px;
	background: #222;
}

.doc-scan-thumb-remove {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 26px;
	height: 26px;
	border: 0;
	border-radius: 50%;
	background: #dc3545;
	color: #fff;
	font-size: 1rem;
	line-height: 1;
}

/* Agenda */
.agenda-page {
	height: calc(100vh - 7.25rem);
	min-height: 560px;
	color: var(--text);
}

.agenda-shell {
	display: grid;
	grid-template-columns: 268px minmax(0, 1fr);
	height: 100%;
	background: #fff;
	border: 1px solid #e6eef2;
	border-radius: 16px;
	box-shadow: 0 10px 30px rgba(15, 40, 50, 0.05);
	overflow: hidden;
}

.agenda-side {
	border-right: 1px solid #eef3f6;
	padding: 1.15rem 1rem 1.25rem;
	background: linear-gradient(180deg, #fbfcfd 0%, #fff 120px);
	overflow: auto;
}

.agenda-new {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	width: 100%;
	margin-bottom: 1.15rem;
	padding: 0.7rem 1rem;
	border: 1px solid #d5e3e8;
	border-radius: 999px;
	background: #fff;
	color: var(--primary-dark);
	font-weight: 650;
	font-size: 0.95rem;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(10, 97, 116, 0.06);
}

.agenda-new svg { width: 18px; height: 18px; }
.agenda-new:hover { background: var(--primary-light); border-color: transparent; }

.agenda-mini-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.65rem;
	font-weight: 650;
	font-size: 0.95rem;
	letter-spacing: -0.01em;
}

.agenda-mini-nav button,
.agenda-nav-btn,
.agenda-today {
	border: 1px solid #e2eaee;
	background: #fff;
	border-radius: 10px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	color: var(--text);
	transition: background 0.15s, border-color 0.15s;
}

.agenda-mini-nav button:hover,
.agenda-nav-btn:hover,
.agenda-today:hover { background: #f4f8f9; border-color: #d5e0e5; }

.agenda-today {
	width: auto;
	padding: 0 0.9rem;
	font-weight: 650;
	font-size: 0.875rem;
}

.agenda-mini-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
	text-align: center;
}

.agenda-mini-dow {
	font-size: 0.68rem;
	color: var(--text-muted);
	text-transform: uppercase;
	padding: 0.2rem 0;
}

.agenda-mini-day {
	border: 0;
	background: transparent;
	border-radius: 999px;
	height: 30px;
	cursor: pointer;
	color: var(--text);
	font-size: 0.8rem;
}

.agenda-mini-day:hover { background: #f1f6f8; }
.agenda-mini-day.is-out { color: #c3ced4; }
.agenda-mini-day.is-today { box-shadow: inset 0 0 0 1.5px var(--primary); color: var(--primary); font-weight: 700; }
.agenda-mini-day.is-on,
.agenda-mini-day.is-on.is-today { background: var(--primary); color: #fff; box-shadow: none; font-weight: 700; }

.agenda-main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
}

.agenda-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1.1rem;
	border-bottom: 1px solid #eef3f6;
	flex-wrap: wrap;
	background: #fff;
}

.agenda-toolbar-left {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	min-width: 0;
}

.agenda-toolbar h1 {
	margin: 0 0 0 0.45rem;
	font-size: 1.35rem;
	font-weight: 650;
	letter-spacing: -0.02em;
}

.agenda-views {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border-radius: 12px;
	background: #f3f6f8;
}

.agenda-views button {
	border: 0;
	background: transparent;
	padding: 0.4rem 0.75rem;
	border-radius: 9px;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 0.82rem;
	font-weight: 600;
}

.agenda-views button:hover { color: var(--text); }
.agenda-views button.is-on { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 2px rgba(16, 40, 50, 0.08); }

.agenda-status {
	margin: 0.4rem 1rem;
	color: var(--text-muted);
	font-size: 0.875rem;
}

.agenda-weekhead,
.agenda-allday {
	display: grid;
	border-bottom: 1px solid var(--border);
}

.agenda-gutter { width: 64px; }

.agenda-head-day,
.agenda-allday-cell {
	min-width: 0;
	border-left: 1px solid #eef3f6;
	padding: 0.25rem;
}

.agenda-head-day {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	padding: 0.45rem 0.25rem;
	font-size: 0.75rem;
	color: var(--text-muted);
	text-transform: uppercase;
}

.agenda-head-day button {
	border: 0;
	background: transparent;
	width: 36px;
	height: 36px;
	border-radius: 999px;
	cursor: pointer;
	font-size: 1.15rem;
	font-weight: 650;
	color: var(--text);
}

.agenda-head-day button:hover { background: #f1f6f8; }
.agenda-head-day.is-today span { color: var(--primary); font-weight: 700; }
.agenda-head-day.is-today button {
	background: var(--primary);
	color: #fff;
}
.agenda-head-day.is-today button:hover { background: var(--primary-hover); }

.agenda-allday-label {
	font-size: 0.68rem;
	color: var(--text-muted);
	padding: 0.35rem 0.4rem;
	text-align: right;
}

.agenda-allday-cell { min-height: 34px; }

.agenda-scroll {
	flex: 1;
	overflow: auto;
	min-height: 0;
}

.agenda-timegrid {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr);
	position: relative;
}

.agenda-hours { position: relative; }

.agenda-hour {
	height: 48px;
	position: relative;
	border-top: 1px solid transparent;
}

.agenda-hour span {
	position: absolute;
	top: -0.55rem;
	right: 10px;
	font-size: 0.72rem;
	font-weight: 600;
	color: #8aa0a8;
	background: #fff;
	padding: 0 0.2rem;
}

.agenda-days {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	position: relative;
}

.agenda-day {
	position: relative;
	border-left: 1px solid #eef3f6;
}

.agenda-day.is-today { background: rgba(10, 97, 116, 0.035); }

.agenda-slot {
	display: block;
	width: 100%;
	height: 12px;
	padding: 0;
	border: 0;
	border-top: 1px solid transparent;
	background: transparent;
	cursor: pointer;
}

.agenda-slot.is-hour { border-top-color: #e7eef2; }
.agenda-slot.is-half { border-top-color: #f3f7f9; }
.agenda-slot:hover { background: rgba(10, 97, 116, 0.045); }

.agenda-event {
	position: absolute;
	z-index: 2;
	overflow: hidden;
	border: 0;
	border-radius: 6px;
	padding: 3px 8px 3px 9px;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
}

.agenda-event:hover { filter: saturate(1.05) brightness(0.98); }
.agenda-event.is-dim { opacity: 0.35; }
.agenda-event-ghost { z-index: 4; outline: 2px dashed currentColor; outline-offset: -2px; }
.agenda-event-title, .agenda-event-time { display: block; font-size: 0.75rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-event-title { font-weight: 700; }
.agenda-event-time { opacity: 0.8; font-weight: 500; }
.agenda-resize {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 6px;
	cursor: ns-resize;
}

.agenda-now {
	position: absolute;
	left: 0;
	right: 0;
	height: 2px;
	background: #d13438;
	z-index: 3;
	pointer-events: none;
}

.agenda-now::before {
	content: "";
	position: absolute;
	left: -4px;
	top: -3px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #d13438;
}

.agenda-event.agenda-cat-blue,
.agenda-chip.agenda-cat-blue { background: #e7e8fb; color: #3a3d8f; box-shadow: inset 3px 0 0 #5b5fc7; }
.agenda-event.agenda-cat-purple,
.agenda-chip.agenda-cat-purple { background: #f1e9f8; color: #5c3d82; box-shadow: inset 3px 0 0 #8764b8; }
.agenda-event.agenda-cat-green,
.agenda-chip.agenda-cat-green { background: #e5f6ea; color: #0d5c32; box-shadow: inset 3px 0 0 #107c41; }
.agenda-event.agenda-cat-orange,
.agenda-chip.agenda-cat-orange { background: #fdecdc; color: #8a3b12; box-shadow: inset 3px 0 0 #ca5010; }
.agenda-event.agenda-cat-red,
.agenda-chip.agenda-cat-red { background: #fbe7e8; color: #8f242b; box-shadow: inset 3px 0 0 #d13438; }
.agenda-event.agenda-cat-gray,
.agenda-chip.agenda-cat-gray { background: #eef2f4; color: #3d4c54; box-shadow: inset 3px 0 0 #69797e; }

.agenda-cat-swatch span.agenda-cat-blue { background: #5b5fc7; }
.agenda-cat-swatch span.agenda-cat-purple { background: #8764b8; }
.agenda-cat-swatch span.agenda-cat-green { background: #107c41; }
.agenda-cat-swatch span.agenda-cat-orange { background: #ca5010; }
.agenda-cat-swatch span.agenda-cat-red { background: #d13438; }
.agenda-cat-swatch span.agenda-cat-gray { background: #69797e; }

.agenda-chip {
	display: block;
	width: 100%;
	margin-top: 3px;
	border: 0;
	border-radius: 4px;
	text-align: left;
	font-size: 0.72rem;
	font-weight: 650;
	padding: 2px 6px 2px 8px;
	cursor: pointer;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.agenda-more {
	border: 0;
	background: transparent;
	color: var(--text-muted);
	font-size: 0.72rem;
	cursor: pointer;
	padding: 0;
}

.agenda-month { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.agenda-month-dow, .agenda-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.agenda-month-dow span {
	padding: 0.35rem;
	text-align: center;
	font-size: 0.72rem;
	text-transform: uppercase;
	color: var(--text-muted);
	border-bottom: 1px solid var(--border);
}
.agenda-month-grid { flex: 1; }
.agenda-month-cell {
	min-height: 108px;
	border-right: 1px solid #eef3f6;
	border-bottom: 1px solid #eef3f6;
	padding: 0.35rem 0.4rem 0.45rem;
	cursor: pointer;
}
.agenda-month-cell:hover { background: #fbfcfd; }
.agenda-month-cell.is-out { background: #f8fafb; color: #b7c4cb; }
.agenda-month-cell.is-today .agenda-month-num { background: var(--primary); color: #fff; }
.agenda-month-num {
	border: 0;
	background: transparent;
	width: 28px;
	height: 28px;
	border-radius: 999px;
	cursor: pointer;
	font-weight: 700;
}
.agenda-month-num:hover { background: #f1f6f8; }
.agenda-month-cell.is-today .agenda-month-num:hover { background: var(--primary-hover); }

.agenda-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 28, 0.45);
	z-index: 1000;
	display: flex;
	justify-content: flex-end;
}

.agenda-modal {
	width: min(480px, 100%);
	height: 100%;
	background: #fff;
	box-shadow: -12px 0 40px rgba(15, 40, 50, 0.12);
	display: flex;
	flex-direction: column;
}

.agenda-modal-header, .agenda-modal-footer {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.9rem 1rem;
	border-bottom: 1px solid var(--border);
}

.agenda-modal-footer { border-bottom: 0; border-top: 1px solid var(--border); }
.agenda-modal-header h2 { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; flex: 1; }
.agenda-modal .form-grid { gap: 0.9rem 0.8rem; }
.agenda-title-input { font-size: 1.05rem; font-weight: 650; padding: 0.85rem 1rem; }
.agenda-modal-close {
	border: 0;
	background: transparent;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: var(--text-muted);
}
.agenda-modal-body { flex: 1; overflow: auto; padding: 1rem; }
.agenda-footer-spacer { flex: 1; }
.agenda-hint { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 0.875rem; }
.agenda-form-error { margin: 0 0 0.75rem; color: var(--danger); }
.agenda-allday-toggle { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.agenda-allday-toggle label { display: flex; align-items: center; gap: 0.4rem; }
.agenda-cats { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.agenda-cat-swatch {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	border: 1px solid #e2eaee;
	background: #fff;
	border-radius: 999px;
	padding: 0.28rem 0.65rem 0.28rem 0.35rem;
	cursor: pointer;
	color: var(--text);
	font-size: 0.78rem;
	font-weight: 650;
}
.agenda-cat-swatch span {
	width: 14px;
	height: 14px;
	border-radius: 999px;
	display: inline-block;
}
.agenda-cat-swatch.is-on { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.agenda-cat-swatch:disabled { cursor: default; opacity: 0.7; }
.agenda-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.4rem; }
.agenda-person-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	background: var(--primary-light);
	color: var(--primary-dark);
	border-radius: 999px;
	padding: 0.2rem 0.55rem;
	font-size: 0.82rem;
}
.agenda-person-chip button {
	border: 0;
	background: transparent;
	cursor: pointer;
	color: inherit;
	font-size: 1rem;
	line-height: 1;
}
.agenda-people { position: relative; }
.agenda-people-results {
	list-style: none;
	margin: 0.25rem 0 0;
	padding: 0.25rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	box-shadow: var(--shadow);
	max-height: 220px;
	overflow: auto;
}
.agenda-people-results button {
	width: 100%;
	text-align: left;
	border: 0;
	background: transparent;
	padding: 0.4rem 0.5rem;
	cursor: pointer;
	border-radius: 6px;
}
.agenda-people-results button:hover { background: var(--primary-light); }
.agenda-people-empty { padding: 0.4rem 0.5rem; color: var(--text-muted); }
.agenda-conflict {
	margin-top: 0.9rem;
	padding: 0.75rem 0.9rem;
	border-radius: 8px;
	background: #fff4e5;
	border: 1px solid #f3c27a;
	color: #7a4b00;
}
.agenda-conflict p { margin: 0.35rem 0 0; font-size: 0.875rem; }

@media (max-width: 900px) {
	.agenda-page { height: auto; min-height: 0; }
	.agenda-shell { grid-template-columns: 1fr; height: auto; }
	.agenda-side { border-right: 0; border-bottom: 1px solid var(--border); }
	.agenda-scroll { max-height: 70vh; }
	.agenda-modal { width: 100%; }
}




/* ===== Controllo mezzo form ===== */
.inspection-section {
	margin-top: 1.25rem;
}
.inspection-section-title {
	margin: 0 0 0.35rem;
	font-size: 1rem;
	font-weight: 700;
	color: var(--text);
}
.inspection-section-hint {
	margin: 0 0 0.75rem;
	color: var(--text-muted);
	font-size: 0.875rem;
}
.inspection-check-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 0.75rem;
}
.inspection-check-card {
	border: 1px solid var(--border);
	border-radius: var(--radius, 10px);
	padding: 0.85rem 0.9rem;
	background: var(--surface-card, #fff);
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.inspection-check-card.is-ok {
	border-color: color-mix(in srgb, var(--primary, #0A6174) 55%, #2e7d32);
	background: color-mix(in srgb, #e8f5e9 70%, var(--surface-card, #fff));
	box-shadow: inset 3px 0 0 #2e7d32;
}
.inspection-check-card.is-ko {
	border-color: color-mix(in srgb, var(--danger, #c62828) 50%, var(--border));
	background: color-mix(in srgb, #fdecea 65%, var(--surface-card, #fff));
	box-shadow: inset 3px 0 0 var(--danger, #c62828);
}
.inspection-check-card.is-unset {
	border-color: var(--border);
}
.inspection-check-label {
	font-weight: 650;
	margin-bottom: 0.55rem;
	font-size: 0.95rem;
}
.inspection-check-actions {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	flex-wrap: wrap;
}
.inspection-choice {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 2.25rem;
	padding: 0.35rem 0.75rem;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--surface-card, #fff);
	cursor: pointer;
	font-weight: 600;
	font-size: 0.9rem;
	user-select: none;
}
.inspection-choice input {
	width: 1.1rem;
	height: 1.1rem;
	accent-color: var(--primary, #0A6174);
}
.inspection-choice-ok:has(input:checked) {
	border-color: #2e7d32;
	background: #e8f5e9;
	color: #1b5e20;
}
.inspection-choice-ko:has(input:checked) {
	border-color: var(--danger, #c62828);
	background: #fdecea;
	color: #8e1b1b;
	accent-color: var(--danger, #c62828);
}
.inspection-choice-ko input {
	accent-color: var(--danger, #c62828);
}
.inspection-clear {
	padding: 0.25rem 0.35rem;
	font-size: 0.85rem;
}
.inspection-upload-btn {
	display: inline-block;
	cursor: pointer;
	margin-bottom: 0.75rem;
}
.inspection-doc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}
.inspection-doc-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface-card, #fff);
}
.inspection-doc-date {
	color: var(--text-muted);
	font-size: 0.8rem;
}

/* ===== Lavaggi form (tablet-friendly) ===== */
.wash-form-popup .input-sivis,
.wash-form-popup select.input-sivis,
.wash-form-popup textarea.input-sivis {
	min-height: 2.75rem;
	font-size: 1rem;
}
.wash-form-popup .btn-primary-sivis,
.wash-form-popup .btn-secondary-sivis {
	min-height: 2.75rem;
	padding: 0.65rem 1.1rem;
}
.wash-year-group {
	margin: 0.65rem 0 0.25rem;
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.vehicle-doc-year-group {
	margin: 0.75rem 0 0.35rem;
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--primary, #0A6174);
}
