:root {
    --app-bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --sidebar: #08111f;
    --sidebar-soft: #15243a;
    --sidebar-active: #0f766e;
    --sidebar-active-soft: #123f42;
    --sidebar-text: #ffffff;
    --sidebar-muted: #e2e8f0;
    --line: #e5e7eb;
    --text: #111827;
    --text-soft: #6b7280;
    --brand: #0f766e;
    --brand-2: #2563eb;
    --danger: #dc2626;
    --card-shadow: 0 10px 26px rgba(15, 23, 42, .05);
    --metric-shadow: 0 12px 30px rgba(15, 23, 42, .06);
    --input-bg: #ffffff;
}

html {
    min-height: 100%;
    background: var(--app-bg);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--app-bg);
    color: var(--text);
    letter-spacing: 0;
    overflow-x: hidden;
}

body.theme-dark {
    --app-bg: #0b1120;
    --surface: #111827;
    --surface-soft: #172033;
    --sidebar: #050816;
    --sidebar-soft: #121a2d;
    --sidebar-active: #14b8a6;
    --sidebar-active-soft: #0f3736;
    --line: #263244;
    --text: #f8fafc;
    --text-soft: #aab6c8;
    --brand: #2dd4bf;
    --brand-2: #60a5fa;
    --danger: #f87171;
    --card-shadow: 0 14px 36px rgba(0, 0, 0, .28);
    --metric-shadow: 0 16px 38px rgba(0, 0, 0, .32);
    --input-bg: #0f172a;
}

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.app-shell .app-sidebar,
.app-shell .offcanvas-lg.app-sidebar {
    --bs-offcanvas-bg: var(--sidebar);
    --bs-offcanvas-color: var(--sidebar-text);
    background: var(--sidebar) !important;
    color: var(--sidebar-text) !important;
    padding: 20px 16px;
    box-shadow: 12px 0 40px rgba(2, 6, 23, .16);
}

@media (min-width: 992px) {
    .app-shell .app-sidebar,
    .app-shell .offcanvas-lg.app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
    }
}

.sidebar-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 8px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
    margin-bottom: 18px;
}

.sidebar-brand .fw-bold {
    color: #ffffff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
}

.topbar-user small,
.eyebrow {
    color: var(--text-soft);
}

.sidebar-brand small {
    color: #cbd5e1;
    font-weight: 750;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #14b8a6, #60a5fa);
    font-size: 22px;
    box-shadow: 0 10px 24px rgba(20, 184, 166, .26);
}

.brand-mark-logo {
    font-size: 16px;
    font-weight: 950;
    letter-spacing: .02em;
    color: #ffffff;
    position: relative;
}

.brand-mark-logo::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, .2);
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    color: var(--sidebar-muted) !important;
    border-radius: 8px;
    font-weight: 850;
    border: 1px solid transparent;
    position: relative;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.sidebar-nav .nav-link i {
    color: #93c5fd !important;
    font-size: 18px;
}

.sidebar-nav .nav-link:hover {
    color: #ffffff !important;
    background: var(--sidebar-soft);
    border-color: rgba(255, 255, 255, .18);
}

.sidebar-nav .nav-link.active {
    color: #ffffff !important;
    background: linear-gradient(90deg, var(--sidebar-active-soft), #172554);
    border-color: rgba(94, 234, 212, .7);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 10px 26px rgba(0, 0, 0, .22);
}

.sidebar-nav .nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 4px;
    border-radius: 999px;
    background: #2dd4bf;
}

.sidebar-nav .nav-link.active i {
    color: #5eead4 !important;
}

.sidebar-nav .nav-link.active span {
    color: #ffffff;
}

.app-main {
    min-width: 0;
}

.app-topbar {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 clamp(18px, 3vw, 36px);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    transform: translateZ(0);
}

.page-title {
    font-size: clamp(24px, 3vw, 34px);
    margin: 0;
    font-weight: 800;
}

.eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .08em;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    min-height: 48px;
}

.user-menu-button::after {
    margin-left: 2px;
}

.user-menu-name {
    display: block;
    line-height: 1.1;
    font-weight: 850;
}

.app-content {
    padding: clamp(18px, 3vw, 36px);
}

.metric-card {
    border: 0;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--metric-shadow);
}

.metric-value {
    font-size: 34px;
    line-height: 1;
    font-weight: 850;
}

.metric-subvalue {
    min-height: 34px;
    display: flex;
    align-items: flex-end;
    font-size: 20px;
    line-height: 1.08;
    font-weight: 850;
}

.work-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--card-shadow);
}

.table {
    --bs-table-bg: transparent;
}

.table th {
    color: var(--text-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.min-w-0 {
    min-width: 0;
}

.form-label {
    font-size: 13px;
    font-weight: 750;
}

.form-control,
.form-select {
    border-radius: 8px;
    min-height: 42px;
    background-color: var(--input-bg);
    border-color: var(--line);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    color: var(--text);
}

.form-control::placeholder {
    color: var(--text-soft);
}

.flatpickr-input[readonly],
.date-picker-control,
.date-picker-control + .form-control {
    background-color: var(--input-bg);
    cursor: pointer;
}

.flatpickr-calendar {
    border: 1px solid #dbe3ea;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
    overflow: hidden;
    font-family: inherit;
}

.flatpickr-months {
    background: #0f172a;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year,
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: #fff;
    fill: #fff;
}

.flatpickr-current-month {
    font-size: 15px;
    font-weight: 800;
}

.flatpickr-weekdays {
    background: #f8fafc;
}

span.flatpickr-weekday {
    color: #475569;
    font-weight: 800;
}

.flatpickr-day {
    border-radius: 8px;
    color: #0f172a;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
    background: #e0f2fe;
    border-color: #e0f2fe;
}

.flatpickr-day.today {
    border-color: #0f766e;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #0f766e;
    border-color: #0f766e;
}

.btn {
    border-radius: 8px;
    font-weight: 750;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-weight: 850;
    object-fit: cover;
    flex: 0 0 auto;
}

.profile-avatar-preview {
    width: 112px;
    height: 112px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-size: 42px;
    object-fit: cover;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
}

.avatar-character {
    --avatar-bg-a: #14b8a6;
    --avatar-bg-b: #60a5fa;
    --avatar-skin: #f6c8a9;
    --avatar-shirt: #0f766e;
    --avatar-hair: #334155;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .42), transparent 28%),
        linear-gradient(135deg, var(--avatar-bg-a), var(--avatar-bg-b));
}

.avatar-character::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 22%;
    left: 33%;
    width: 34%;
    height: 34%;
    border-radius: 999px;
    background: var(--avatar-skin);
    box-shadow: inset 0 -2px 0 rgba(15, 23, 42, .12);
}

.avatar-character::after {
    content: "";
    position: absolute;
    z-index: 1;
    left: 20%;
    bottom: 10%;
    width: 60%;
    height: 38%;
    border-radius: 999px 999px 14px 14px;
    background: var(--avatar-shirt);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .22);
}

.avatar-hair {
    position: absolute;
    z-index: 3;
    top: 18%;
    left: 33%;
    width: 34%;
    height: 18%;
    border-radius: 999px 999px 8px 8px;
    background: var(--avatar-hair);
    transform: rotate(-5deg);
}

.avatar-character-lg::before {
    top: 21%;
}

.avatar-character-lg .avatar-hair {
    top: 17%;
}

.avatar-teal {
    --avatar-bg-a: #0f766e;
    --avatar-bg-b: #67e8f9;
    --avatar-shirt: #115e59;
    --avatar-hair: #1f2937;
}

.avatar-amber {
    --avatar-bg-a: #f59e0b;
    --avatar-bg-b: #fde68a;
    --avatar-skin: #8d5524;
    --avatar-shirt: #b45309;
    --avatar-hair: #2f1b12;
}

.avatar-blue {
    --avatar-bg-a: #2563eb;
    --avatar-bg-b: #93c5fd;
    --avatar-skin: #f2b28d;
    --avatar-shirt: #1d4ed8;
    --avatar-hair: #111827;
}

.avatar-slate {
    --avatar-bg-a: #475569;
    --avatar-bg-b: #cbd5e1;
    --avatar-skin: #d6a37c;
    --avatar-shirt: #334155;
    --avatar-hair: #f8fafc;
}

.avatar-green {
    --avatar-bg-a: #16a34a;
    --avatar-bg-b: #bbf7d0;
    --avatar-skin: #f0c7a4;
    --avatar-shirt: #15803d;
    --avatar-hair: #3f2a1d;
}

.avatar-rose {
    --avatar-bg-a: #e11d48;
    --avatar-bg-b: #fda4af;
    --avatar-skin: #b06f48;
    --avatar-shirt: #be123c;
    --avatar-hair: #3b241c;
}

.avatar-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 10px;
}

.avatar-preset-option {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    position: relative;
    min-height: 72px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 750;
    background: var(--surface);
    text-align: center;
    overflow: hidden;
}

.avatar-preset-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.avatar-choice {
    width: 46px;
    height: 46px;
}

.avatar-preset-option:has(input:checked) {
    border-color: #0f766e;
    box-shadow: inset 0 0 0 2px rgba(15, 118, 110, .2);
    background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}

.preference-toggle {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 750;
    background: var(--surface);
    height: 100%;
}

.device-push-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: color-mix(in srgb, var(--brand) 14%, var(--surface));
    color: var(--brand);
}

.icon-action-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    flex: 0 0 auto;
}

.vehicle-thumb {
    width: 54px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    flex: 0 0 auto;
    background: var(--surface-soft);
}

.image-lightbox-trigger {
    display: inline-flex;
    flex: 0 0 auto;
    border-radius: 8px;
    cursor: zoom-in;
}

.image-lightbox-trigger:hover img {
    filter: brightness(.95);
}

.vehicle-thumb-empty {
    display: inline-grid;
    place-items: center;
    color: var(--text-soft);
}

.vehicle-history-photo {
    width: 124px;
    height: 86px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    flex: 0 0 auto;
}

.history-mini-row {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.validation-list {
    display: grid;
}

.validation-item {
    display: grid;
    grid-template-columns: minmax(280px, 1.4fr) minmax(300px, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
}

.validation-item:last-child {
    border-bottom: 0;
}

.validation-main {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.validation-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.validation-icon-ok {
    background: #dcfce7;
    color: #166534;
}

.validation-icon-danger {
    background: #fee2e2;
    color: #991b1b;
}

.validation-title {
    font-size: 1rem;
    font-weight: 850;
}

.validation-note {
    margin-top: 8px;
    color: var(--text);
}

.validation-numbers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.validation-numbers > div {
    min-height: 66px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.validation-label {
    display: block;
    color: var(--text-soft);
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.validation-numbers strong {
    display: block;
    margin-top: 4px;
    font-size: 1.03rem;
    line-height: 1.1;
}

.validation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-state {
    min-height: 190px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 28px;
    color: var(--text-soft);
    text-align: center;
}

.empty-state i {
    font-size: 32px;
    color: #16a34a;
}

.empty-state strong {
    color: var(--text);
    font-size: 1.05rem;
}

.fleet-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.fleet-status-item {
    display: flex;
    align-items: stretch;
    gap: 12px;
    min-height: 132px;
    padding: 18px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
}

.fleet-status-item:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.fleet-status-signal {
    width: 16px;
    min-height: 74px;
    border-radius: 999px;
    flex: 0 0 auto;
    align-self: stretch;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32);
}

.fleet-status-verde { background: #16a34a; }
.fleet-status-arancione { background: #f59e0b; }
.fleet-status-rosso { background: #dc2626; }

.fleet-status-content {
    min-width: 0;
    flex: 1 1 auto;
    display: grid;
    gap: 12px;
}

.fleet-status-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.fleet-status-main {
    min-width: 0;
    flex: 1 1 auto;
}

.fleet-status-main strong,
.fleet-status-main small,
.fleet-status-label,
.fleet-info-chip {
    display: block;
}

.fleet-status-main strong {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.12;
}

.fleet-status-main small {
    color: var(--text-soft);
    margin-top: 6px;
}

.fleet-status-label {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 850;
    line-height: 1;
}

.fleet-status-label-verde {
    background: #dcfce7;
    color: #166534;
}

.fleet-status-label-arancione {
    background: #fef3c7;
    color: #92400e;
}

.fleet-status-label-rosso {
    background: #fee2e2;
    color: #991b1b;
}

.fleet-status-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fleet-info-chip {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--line);
    font-size: .82rem;
    font-weight: 760;
    line-height: 1;
    white-space: nowrap;
}

.fleet-info-chip i {
    font-size: .88rem;
}

.fleet-info-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.fleet-info-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.fleet-info-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.issue-description-cell {
    max-width: 360px;
}

.issue-photo-thumb {
    width: 54px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.issue-photo-preview {
    max-width: min(100%, 520px);
    max-height: 260px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.image-lightbox-content .modal-body {
    min-height: min(72vh, 720px);
    display: grid;
    place-items: center;
    padding: 0;
    background: #020617;
}

.image-lightbox-img {
    max-width: 100%;
    max-height: min(72vh, 720px);
    object-fit: contain;
}

.live-badge {
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: .74rem;
    font-weight: 850;
    line-height: 1;
    box-shadow: 0 6px 16px rgba(220, 38, 38, .28);
}

.live-badge[hidden] {
    display: none !important;
}

.theme-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.theme-choice-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 86px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.theme-choice-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-choice-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 18px;
}

.theme-choice-light {
    background: #fef3c7;
    color: #92400e;
}

.theme-choice-dark {
    background: #1e293b;
    color: #bfdbfe;
}

.theme-choice-option strong,
.theme-choice-option small {
    display: block;
}

.theme-choice-option small {
    color: var(--text-soft);
    line-height: 1.25;
}

.theme-choice-option:has(input:checked) {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent);
    background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}

.type-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 7px;
}

.type-summary span {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-soft);
    border: 1px solid var(--line);
    font-size: .78rem;
    font-weight: 720;
}

.reminder-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
    gap: 9px;
}

.reminder-choice {
    position: relative;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
    text-align: center;
}

.reminder-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.reminder-choice:has(input:checked) {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 13%, var(--surface));
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 24%, transparent);
    color: var(--brand);
}

.density-compact .app-content {
    padding: 16px;
}

.density-compact .card-body {
    padding: 1rem !important;
}

.density-compact .table > :not(caption) > * > * {
    padding: .55rem .65rem;
}

.operator-shell .app-topbar {
    min-height: 68px;
}

.operator-shell .page-title {
    font-size: 24px;
}

.operator-shell .work-card,
.operator-shell .metric-card {
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.operator-shell .btn,
.operator-shell .form-control,
.operator-shell .form-select {
    min-height: 46px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.status-dot.verde { background: #16a34a; }
.status-dot.arancione { background: #f59e0b; }
.status-dot.rosso { background: #dc2626; }

.mobile-operator {
    max-width: 920px;
    margin: 0 auto;
}

.operator-vehicle-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.operator-vehicle-pill {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.operator-vehicle-pill img,
.operator-vehicle-pill span {
    width: 54px;
    height: 42px;
    border-radius: 8px;
    flex: 0 0 auto;
}

.operator-vehicle-pill .image-lightbox-trigger {
    flex: 0 0 auto;
}

.operator-vehicle-pill img {
    object-fit: cover;
}

.operator-vehicle-pill span {
    display: grid;
    place-items: center;
    background: var(--surface);
    color: var(--text-soft);
    border: 1px solid var(--line);
}

.operator-vehicle-pill strong {
    min-width: 0;
    line-height: 1.18;
}

.operator-document-card {
    min-height: 82px;
}

.operator-status-pill {
    min-width: 104px;
    padding: 7px 10px;
    border-radius: 999px;
    text-align: center;
    font-size: .78rem;
    font-weight: 850;
}

.operator-status-verde {
    background: #dcfce7;
    color: #166534;
}

.operator-status-arancione {
    background: #fef3c7;
    color: #92400e;
}

.operator-status-rosso {
    background: #fee2e2;
    color: #991b1b;
}

.quick-action {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 17px;
}

code {
    color: var(--text);
    background: color-mix(in srgb, #f59e0b 16%, var(--surface));
    padding: 2px 6px;
    border-radius: 6px;
}

.generated-credential-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    margin-top: 4px;
}

.generated-credential-row code {
    word-break: break-all;
}

.pwa-install-card {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 560px;
    margin: 0 auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    color: var(--text);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
    backdrop-filter: blur(14px);
}

.pwa-install-card[hidden] {
    display: none !important;
}

.pwa-install-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    overflow: hidden;
    flex: 0 0 auto;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .16);
}

.pwa-install-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.pwa-install-copy {
    min-width: 0;
    flex: 1;
}

.pwa-install-copy strong,
.pwa-install-copy span {
    display: block;
}

.pwa-install-copy span {
    color: var(--text-soft);
    line-height: 1.25;
}

.pwa-install-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.modal-icon-soft {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 13%, var(--surface-soft));
    color: var(--primary);
    font-size: 1.25rem;
}

.app-toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1090;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 36px));
}

.app-toast {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 16px 42px rgba(15, 23, 42, .22);
    transform: translateY(0);
    opacity: 1;
    transition: opacity .22s ease, transform .22s ease;
}

.app-toast-success {
    border-color: color-mix(in srgb, #16a34a 30%, var(--line));
}

.app-toast-danger {
    border-color: color-mix(in srgb, #dc2626 38%, var(--line));
}

.app-toast.is-hiding {
    opacity: 0;
    transform: translateY(8px);
}

.debug-context {
    max-width: 520px;
    max-height: 220px;
    overflow: auto;
    margin: 8px 0 0;
    padding: 10px;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: .78rem;
    white-space: pre-wrap;
}

body.theme-dark .text-secondary,
body.theme-dark .form-text,
body.theme-dark .topbar-user small,
body.theme-dark .eyebrow {
    color: var(--text-soft) !important;
}

body.theme-dark .card,
body.theme-dark .dropdown-menu,
body.theme-dark .modal-content,
body.theme-dark .list-group-item {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

body.theme-dark .dropdown-item {
    color: var(--text);
}

body.theme-dark .dropdown-item:hover,
body.theme-dark .dropdown-item:focus {
    background: var(--surface-soft);
    color: var(--text);
}

body.theme-dark .btn-light {
    background: var(--surface-soft);
    border-color: var(--line);
    color: var(--text);
}

body.theme-dark .table {
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line);
}

body.theme-dark .table th {
    color: var(--text-soft);
}

body.theme-dark .alert-info {
    background: #0c2f4a;
    color: #dbeafe;
}

body.theme-dark .alert-warning {
    background: #422006;
    color: #fde68a;
}

body.theme-dark .alert-success {
    background: #063b2b;
    color: #bbf7d0;
}

body.theme-dark .alert-danger {
    background: #450a0a;
    color: #fecaca;
}

body.theme-dark .modal-header,
body.theme-dark .modal-footer {
    border-color: var(--line);
}

body.theme-dark .fleet-status-item,
body.theme-dark .operator-vehicle-pill,
body.theme-dark .operator-vehicle-pill span {
    background: var(--surface);
    border-color: var(--line);
}

body.theme-dark .fleet-status-item:hover {
    background: var(--surface-soft);
}

body.theme-dark .operator-status-verde {
    background: #064e3b;
    color: #bbf7d0;
}

body.theme-dark .operator-status-arancione {
    background: #422006;
    color: #fde68a;
}

body.theme-dark .operator-status-rosso {
    background: #450a0a;
    color: #fecaca;
}

body.theme-dark .fleet-status-label-verde,
body.theme-dark .fleet-info-success {
    background: #064e3b;
    color: #bbf7d0;
    border-color: #065f46;
}

body.theme-dark .fleet-status-label-arancione,
body.theme-dark .fleet-info-warning {
    background: #422006;
    color: #fde68a;
    border-color: #78350f;
}

body.theme-dark .fleet-status-label-rosso,
body.theme-dark .fleet-info-danger {
    background: #450a0a;
    color: #fecaca;
    border-color: #7f1d1d;
}

body.theme-dark .fleet-info-chip:not(.fleet-info-success):not(.fleet-info-warning):not(.fleet-info-danger) {
    background: var(--surface-soft);
    border-color: var(--line);
}

body.theme-dark .btn-close {
    filter: invert(1) grayscale(100%);
}

body.theme-dark .flatpickr-calendar {
    background: #111827;
    border-color: var(--line);
    color: var(--text);
}

body.theme-dark .flatpickr-weekdays {
    background: #0f172a;
}

body.theme-dark span.flatpickr-weekday,
body.theme-dark .flatpickr-day {
    color: var(--text);
}

body.theme-dark .flatpickr-day:hover,
body.theme-dark .flatpickr-day:focus {
    background: #1e3a5f;
    border-color: #1e3a5f;
}

body.theme-dark .flatpickr-day.prevMonthDay,
body.theme-dark .flatpickr-day.nextMonthDay {
    color: #64748b;
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .app-shell .app-sidebar,
    .app-shell .offcanvas-lg.app-sidebar {
        position: fixed !important;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(86vw, 320px);
        height: 100vh;
        height: 100dvh;
        padding: calc(20px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
        overflow-y: auto;
        box-shadow: 14px 0 40px rgba(2, 6, 23, .28);
    }

    .app-topbar {
        height: auto;
        min-height: 74px;
        top: 0;
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-bottom: 10px;
        align-items: flex-start;
        isolation: isolate;
    }

    .app-main {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .validation-item {
        grid-template-columns: 1fr;
    }

    .validation-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 575.98px) {
    .validation-item {
        padding: 16px;
    }

    .validation-numbers {
        grid-template-columns: 1fr;
    }

    .theme-choice-grid {
        grid-template-columns: 1fr;
    }

    .pwa-install-card {
        align-items: flex-start;
    }

    .pwa-install-actions {
        flex-direction: column;
    }
}
