/* ============================================================
   Agenda (PWA operatori) - foglio di stile mobile-first
   Tema scuro operatori, accenti blu e ambra,
   safe-area iOS, barra di navigazione inferiore fissa.
   ============================================================ */

:root {
    --kt-primary: #1f3a5f;
    --kt-primary-dark: #15294a;
    --kt-primary-soft: #e6ecf5;
    --kt-accent: #e5a000;
    --kt-accent-soft: #fff4d6;
    --kt-accent-dark: #a86f00;
    --kt-bg: #f4f6fa;
    --kt-card: #ffffff;
    --kt-text: #1b2430;
    --kt-muted: #66717f;
    --kt-border: #e1e6ee;
    --kt-success: #198754;
    --kt-success-soft: #ddf2e6;
    --kt-danger: #d83b45;
    --kt-danger-soft: #fbe2e4;
    --kt-info: #2477d4;
    --kt-info-soft: #ddeafb;
    --kt-warning-soft: #fdf0d3;
    --kt-radius: 14px;
    --kt-radius-sm: 10px;
    --kt-shadow: 0 6px 20px rgba(27, 36, 48, 0.06), 0 1px 3px rgba(27, 36, 48, 0.05);
    --kt-shadow-strong: 0 12px 30px rgba(31, 58, 95, 0.18);
    --kt-topbar-h: 56px;
    --kt-impersonation-h: 0px;
    --kt-nav-h: 64px;
    --kt-sat: env(safe-area-inset-top, 0px);
    --kt-sab: env(safe-area-inset-bottom, 0px);
    --kt-sal: env(safe-area-inset-left, 0px);
    --kt-sar: env(safe-area-inset-right, 0px);
    --kt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--kt-font);
    background: var(--kt-bg);
    color: var(--kt-text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100%;
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--kt-primary); }
a:hover { color: var(--kt-primary-dark); }
h1, h2, h3, h4, h5 { letter-spacing: -0.01em; }

::selection { background: var(--kt-primary); color: #fff; }

/* ---------- Bootstrap: override colori ---------- */

.btn { border-radius: 12px; font-weight: 600; min-height: 48px; transition: transform .12s ease, box-shadow .12s ease; }
.btn-sm { min-height: 38px; border-radius: 10px; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn:active { transform: scale(0.985); }

.btn-primary {
    --bs-btn-bg: var(--kt-primary);
    --bs-btn-border-color: var(--kt-primary);
    --bs-btn-hover-bg: var(--kt-primary-dark);
    --bs-btn-hover-border-color: var(--kt-primary-dark);
    --bs-btn-active-bg: var(--kt-primary-dark);
    --bs-btn-active-border-color: var(--kt-primary-dark);
    --bs-btn-disabled-bg: #7d8ea6;
    --bs-btn-disabled-border-color: #7d8ea6;
    box-shadow: 0 6px 16px rgba(31, 58, 95, 0.25);
}
.btn-outline-primary {
    --bs-btn-color: var(--kt-primary);
    --bs-btn-border-color: #b9c6d8;
    --bs-btn-hover-bg: var(--kt-primary);
    --bs-btn-hover-border-color: var(--kt-primary);
    --bs-btn-active-bg: var(--kt-primary-dark);
    --bs-btn-active-border-color: var(--kt-primary-dark);
    background: #fff;
}
.btn-warning {
    --bs-btn-bg: var(--kt-accent);
    --bs-btn-border-color: var(--kt-accent);
    --bs-btn-hover-bg: #c98c00;
    --bs-btn-hover-border-color: #c98c00;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}
.btn-outline-secondary { background: #fff; border-color: var(--kt-border); color: #46515e; }
.btn-danger { --bs-btn-bg: var(--kt-danger); --bs-btn-border-color: var(--kt-danger); }
.btn-outline-danger { --bs-btn-color: var(--kt-danger); --bs-btn-border-color: #f0b8bd; background: #fff; }
.btn-light { background: #fff; border-color: var(--kt-border); }

.text-primary { color: var(--kt-primary) !important; }
.bg-primary { background-color: var(--kt-primary) !important; }
.text-accent { color: var(--kt-accent-dark) !important; }

.form-control, .form-select {
    min-height: 48px;
    border-radius: 12px;
    border-color: var(--kt-border);
    font-size: 16px; /* evita lo zoom automatico su iOS */
    background-color: #fff;
}
.form-control-lg, .input-group-lg > .form-control { min-height: 54px; }
.input-group-lg > .btn { min-height: 54px; }
.form-control:focus, .form-select:focus {
    border-color: var(--kt-primary);
    box-shadow: 0 0 0 0.22rem rgba(31, 58, 95, 0.14);
}
textarea.form-control { min-height: 120px; line-height: 1.45; }
.form-label { font-weight: 600; font-size: 13.5px; color: #3c4655; margin-bottom: 4px; }
.form-text { font-size: 12.5px; }
.form-check-input { width: 1.25em; height: 1.25em; }
.form-check-input:checked { background-color: var(--kt-primary); border-color: var(--kt-primary); }
.form-switch .form-check-input { width: 3em; height: 1.6em; }
.form-switch .form-check-input:checked { background-color: var(--kt-success); border-color: var(--kt-success); }
.input-group > .btn { border-radius: 0 12px 12px 0; }
.input-group > .form-control:first-child { border-radius: 12px 0 0 12px; }

.badge { border-radius: 8px; font-weight: 600; }
.badge.text-bg-success { background: var(--kt-success-soft) !important; color: #10693f !important; }
.badge.text-bg-danger { background: var(--kt-danger-soft) !important; color: #b02a33 !important; }
.badge.text-bg-warning { background: var(--kt-warning-soft) !important; color: #9a6b00 !important; }
.badge.text-bg-info { background: var(--kt-info-soft) !important; color: #1a5da8 !important; }
.badge.text-bg-primary { background: var(--kt-primary-soft) !important; color: var(--kt-primary) !important; }
.badge.text-bg-secondary { background: #e8edf3 !important; color: #55636c !important; }

.alert { border-radius: var(--kt-radius); border: none; font-size: 14px; }
.alert-warning { background: var(--kt-warning-soft); color: #7a5500; }
.alert-danger { background: var(--kt-danger-soft); color: #9a2830; }
.alert-info { background: var(--kt-info-soft); color: #164f8f; }
.alert-success { background: var(--kt-success-soft); color: #0f5f39; }

.card {
    border: 1px solid var(--kt-border);
    border-radius: var(--kt-radius);
    box-shadow: var(--kt-shadow);
    background: var(--kt-card);
}
.card-header { background: transparent; border-bottom: 1px solid var(--kt-border); font-weight: 700; padding: 12px 16px; }
.card-body { padding: 16px; }
.card-title { font-weight: 700; font-size: 15px; }

.modal-content { border-radius: var(--kt-radius); border: none; box-shadow: var(--kt-shadow-strong); }
.modal-header { border-bottom-color: var(--kt-border); }
.modal-title { font-weight: 700; font-size: 17px; }
.modal-footer { border-top-color: var(--kt-border); gap: 8px; }
.modal-footer > .btn { flex: 1; margin: 0; }
.modal-dialog { margin: 12px; }
@media (max-width: 575.98px) {
    .modal-dialog { max-width: none; }
}

.list-group-item { border-color: var(--kt-border); padding: 12px 14px; }
.list-group-item-action:active { background: var(--kt-primary-soft); }

/* ---------- Topbar ---------- */

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    background: linear-gradient(135deg, var(--kt-primary-dark), var(--kt-primary) 70%, #2a4a74);
    color: #fff;
    padding-top: var(--kt-sat);
    box-shadow: 0 4px 14px rgba(21, 41, 74, 0.28);
}
.topbar-inner {
    height: var(--kt-topbar-h);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 calc(12px + var(--kt-sar)) 0 calc(12px + var(--kt-sal));
}
.topbar-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.topbar-btn:active { background: rgba(255, 255, 255, 0.25); }
.topbar-status { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sync-spinner { display: inline-flex; color: #ffd86b; }
.net-status { font-size: 18px; line-height: 1; display: inline-flex; align-items: center; }
.net-status.is-online { color: #9be7b5; }
.net-status.is-offline { color: #ffb3b8; }
.topbar-badge { text-decoration: none; }

/* ---------- Banner offline / aggiornamento ---------- */

.offline-banner {
    position: fixed;
    top: calc(var(--kt-topbar-h) + var(--kt-sat) + var(--kt-impersonation-h));
    left: 0; right: 0;
    z-index: 1025;
    background: #3d4756;
    color: #fff;
    font-size: 13px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.offline-banner i { font-size: 16px; color: #ffcf5c; }
body.is-offline .app-view { padding-top: calc(var(--kt-topbar-h) + var(--kt-sat) + var(--kt-impersonation-h) + 48px); }

.update-banner {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(var(--kt-nav-h) + var(--kt-sab) + 12px);
    z-index: 1026;
    background: var(--kt-primary-dark);
    color: #fff;
    padding: 10px 14px;
    border-radius: var(--kt-radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: var(--kt-shadow-strong);
    font-size: 14px;
}
.update-banner .btn { min-height: 38px; }

/* ---------- Contenuto ---------- */

.app-view {
    padding: calc(var(--kt-topbar-h) + var(--kt-sat) + var(--kt-impersonation-h) + 14px) calc(12px + var(--kt-sar)) calc(var(--kt-nav-h) + var(--kt-sab) + 20px) calc(12px + var(--kt-sal));
    max-width: 760px;
    margin: 0 auto;
    min-height: 100vh;
}
body.no-nav .app-view { padding-bottom: calc(var(--kt-sab) + 20px); }
body.no-nav .bottomnav { display: none; }
body.no-nav .update-banner { bottom: calc(var(--kt-sab) + 12px); }

.view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.view-toolbar .btn { min-height: 40px; }
.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--kt-muted);
    font-weight: 700;
    margin: 18px 0 8px;
}

.filter-tabs { display: flex; gap: 6px; background: #e9edf4; padding: 4px; border-radius: 14px; margin-bottom: 12px; }
.filter-tabs button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--kt-muted);
    font-weight: 600;
    font-size: 14px;
    min-height: 40px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.filter-tabs button.active { background: #fff; color: var(--kt-primary); box-shadow: 0 2px 6px rgba(27, 36, 48, 0.1); }
.filter-tabs .count { font-size: 11px; background: var(--kt-primary-soft); color: var(--kt-primary); border-radius: 999px; padding: 1px 7px; }

.day-header {
    position: sticky;
    top: calc(var(--kt-topbar-h) + var(--kt-sat) + var(--kt-impersonation-h));
    z-index: 5;
    background: var(--kt-bg);
    padding: 10px 2px 6px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
body.is-offline .day-header { top: calc(var(--kt-topbar-h) + var(--kt-sat) + var(--kt-impersonation-h) + 36px); }
.day-header .day-label { font-weight: 800; font-size: 15px; color: var(--kt-primary); }
.day-header .day-label.is-today { color: var(--kt-accent-dark); }
.day-header .day-date { font-size: 12.5px; color: var(--kt-muted); }
.day-header .day-count { margin-left: auto; font-size: 12px; color: var(--kt-muted); }

/* ---------- Card servizio ---------- */

.svc-card {
    display: block;
    background: var(--kt-card);
    border: 1px solid var(--kt-border);
    border-left: 5px solid var(--kt-primary);
    border-radius: var(--kt-radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--kt-text);
    box-shadow: var(--kt-shadow);
    transition: transform .12s ease, box-shadow .12s ease;
}
.svc-card:active { transform: scale(0.99); box-shadow: none; }
.svc-card:hover { color: var(--kt-text); }
.svc-card.status-in_corso { border-left-color: var(--kt-accent); }
.svc-card.status-completato { border-left-color: var(--kt-success); }
.svc-card.status-annullato { border-left-color: #a5adb8; opacity: 0.75; }
.svc-card.has-pending { border-color: #f1d488; background: #fffdf7; }
.svc-card.is-now { box-shadow: 0 0 0 2px rgba(229, 160, 0, 0.35), var(--kt-shadow); }

.svc-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.svc-times { display: flex; flex-direction: column; gap: 2px; }
.svc-time { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-size: 14px; }
.svc-time i { width: 18px; text-align: center; font-size: 14px; }
.svc-time small { color: var(--kt-muted); font-size: 12px; }
.svc-time-op { font-weight: 700; color: var(--kt-primary); font-size: 16px; }
.svc-time-op i { color: var(--kt-primary); }
.svc-time-cl { color: #4b5665; }
.svc-time-cl i { color: var(--kt-accent-dark); }
.svc-date { font-size: 13px; color: var(--kt-muted); margin-bottom: 4px; }
.svc-case { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.svc-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: var(--kt-primary-soft);
    color: var(--kt-primary);
    padding: 2px 7px;
    border-radius: 6px;
}
.svc-case-title { font-size: 15px; }
.svc-title { font-size: 14px; color: #3c4655; margin-top: 2px; }
.svc-meta { font-size: 13px; color: var(--kt-muted); margin-top: 3px; display: flex; gap: 6px; align-items: flex-start; }
.svc-meta i { flex-shrink: 0; margin-top: 2px; }
.svc-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flag {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600;
    background: #f1f4f8; color: #5b6774;
    padding: 3px 8px; border-radius: 999px;
}
.flag-on { background: var(--kt-success-soft); color: #10693f; }
.flag-lock { background: #eceff3; color: #6c7681; }
.flag-warn { background: var(--kt-warning-soft); color: #9a6b00; }

.svc-actions { display: flex; gap: 8px; margin-top: 10px; }
.svc-actions .btn { flex: 1; min-height: 42px; font-size: 13.5px; padding: 6px 8px; }

/* ---------- Stato servizio ---------- */

.status-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11.5px; font-weight: 700;
    padding: 4px 9px; border-radius: 999px;
    white-space: nowrap; flex-shrink: 0;
}
.status-badge.status-programmato { background: var(--kt-info-soft); color: #1a5da8; }
.status-badge.status-in_corso { background: var(--kt-warning-soft); color: #9a6b00; }
.status-badge.status-completato { background: var(--kt-success-soft); color: #10693f; }
.status-badge.status-annullato { background: #e8edf3; color: #55636c; }
.status-badge.status-inserita { background: var(--kt-info-soft); color: #1a5da8; }
.status-badge.status-autorizzata { background: var(--kt-success-soft); color: #10693f; }
.status-badge.status-rifiutata { background: var(--kt-danger-soft); color: #b02a33; }

/* ---------- Badge "non sincronizzato" ---------- */

.pending-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--kt-accent);
    color: #fff;
    font-size: 12px; font-weight: 700;
    padding: 3px 9px; border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(229, 160, 0, 0.4);
}
.pending-badge i { font-size: 13px; }
.pending-badge.topbar-badge { padding: 4px 9px; }
.pending-inline { color: var(--kt-accent-dark); font-size: 12px; font-weight: 700; }

/* ---------- Bottom nav ---------- */

.bottomnav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1030;
    display: flex;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--kt-border);
    padding: 0 var(--kt-sar) var(--kt-sab) var(--kt-sal);
    box-shadow: 0 -4px 16px rgba(27, 36, 48, 0.06);
}
.bottomnav-item {
    flex: 1;
    height: var(--kt-nav-h);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--kt-muted);
    font-size: 11.5px;
    font-weight: 600;
    position: relative;
}
.bottomnav-item i { font-size: 22px; line-height: 1; transition: transform .15s ease; }
.bottomnav-item.active { color: var(--kt-primary); }
.bottomnav-item.active i { transform: translateY(-2px); }
.bottomnav-item.active::after {
    content: '';
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 28px; height: 3px; border-radius: 0 0 4px 4px;
    background: var(--kt-accent);
}
.nav-dot {
    position: absolute; top: 10px; right: calc(50% - 18px);
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--kt-accent); border: 2px solid #fff;
}

/* ---------- Toast ---------- */

.kt-toast-container {
    position: fixed;
    top: calc(var(--kt-topbar-h) + var(--kt-sat) + var(--kt-impersonation-h) + 8px);
    left: 12px; right: 12px;
    z-index: 1080;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.kt-toast {
    width: 100%; max-width: 480px; margin: 0 auto;
    border: none; border-radius: 12px;
    color: #fff; background: #2f3a48;
    box-shadow: var(--kt-shadow-strong);
    pointer-events: auto;
}
.kt-toast .toast-body { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.kt-toast .toast-body i { font-size: 18px; }
.kt-toast.toast-success { background: var(--kt-success); }
.kt-toast.toast-danger { background: var(--kt-danger); }
.kt-toast.toast-warning { background: var(--kt-accent); }
.kt-toast.toast-info { background: var(--kt-info); }

/* ---------- Skeleton (caricamento) ---------- */

.skeleton {
    position: relative;
    overflow: hidden;
    background: #e7ebf1;
    border-radius: 10px;
    color: transparent !important;
    min-height: 16px;
}
.skeleton::after {
    content: '';
    position: absolute; inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
    animation: kt-shimmer 1.2s infinite;
}
.skeleton-card { height: 112px; border-radius: var(--kt-radius); margin-bottom: 10px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 55%; margin-bottom: 12px; }
@keyframes kt-shimmer { 100% { transform: translateX(100%); } }

/* ---------- Empty state ---------- */

.empty-state { text-align: center; padding: 40px 16px; color: var(--kt-muted); }
.empty-state-icon {
    width: 84px; height: 84px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 36px; color: var(--kt-primary);
    background: radial-gradient(circle at 35% 30%, #ffffff, var(--kt-primary-soft));
    box-shadow: inset 0 0 0 1px rgba(31, 58, 95, 0.12);
    margin-bottom: 14px;
}
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--kt-text); margin-bottom: 4px; }
.empty-state p { font-size: 14px; margin-bottom: 14px; }

/* ---------- Hero "Oggi" e KPI ---------- */

.hero {
    position: relative; overflow: hidden;
    border-radius: 18px;
    background:
        radial-gradient(420px 200px at 90% -30%, rgba(229, 160, 0, 0.35), transparent 60%),
        linear-gradient(120deg, var(--kt-primary-dark), var(--kt-primary) 60%, #2c4d78);
    color: #fff;
    padding: 18px 18px 16px;
    margin-bottom: 14px;
    box-shadow: var(--kt-shadow-strong);
}
.hero-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: #ffd86b; font-weight: 700; }
.hero-title { font-size: 22px; font-weight: 800; margin: 2px 0 8px; }
.hero-sub { font-size: 13.5px; color: rgba(255, 255, 255, 0.78); }
.hero-stats { display: flex; gap: 8px; margin-top: 12px; }
.hero-stat {
    flex: 1;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 8px 10px;
}
.hero-stat .v { font-size: 20px; font-weight: 800; line-height: 1.1; }
.hero-stat .l { font-size: 11px; color: rgba(255, 255, 255, 0.75); text-transform: uppercase; letter-spacing: 0.05em; }

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.quick-action {
    background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius);
    padding: 12px 6px; text-align: center; text-decoration: none; color: var(--kt-text);
    box-shadow: var(--kt-shadow); font-size: 12.5px; font-weight: 600;
    display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative;
}
.quick-action i { font-size: 22px; color: var(--kt-primary); }
.quick-action:active { background: var(--kt-primary-soft); }
.quick-action .qa-badge {
    position: absolute; top: 6px; right: 6px;
    background: var(--kt-accent); color: #fff; font-size: 11px; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

.kpi-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi {
    background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius);
    padding: 12px 14px; box-shadow: var(--kt-shadow);
}
.kpi .kpi-value { font-size: 20px; font-weight: 800; color: var(--kt-primary); line-height: 1.1; }
.kpi .kpi-label { font-size: 12px; color: var(--kt-muted); font-weight: 600; }

/* ---------- Dettaglio: info list ---------- */

.info-list { margin: 0; }
.info-list dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--kt-muted); font-weight: 700; margin-bottom: 1px; }
.info-list dd { margin-bottom: 10px; font-size: 15px; word-break: break-word; }
.info-list dd:last-child { margin-bottom: 0; }
.info-list a { word-break: break-all; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-box { background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius-sm); padding: 10px 12px; }
.detail-box .dl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--kt-muted); font-weight: 700; }
.detail-box .dv { font-size: 16px; font-weight: 700; color: var(--kt-primary); }

.subtitle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 8px; }
.subtitle-row h2 { font-size: 16px; font-weight: 800; margin: 0; }

/* ---------- Timeline diario ---------- */

.timeline { position: relative; padding-left: 26px; margin: 8px 0; }
.timeline::before {
    content: '';
    position: absolute; left: 8px; top: 6px; bottom: 6px;
    width: 2px; background: #d3dbe6; border-radius: 2px;
}
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
    position: absolute; left: -23px; top: 5px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--kt-primary); border: 2px solid #fff;
    box-shadow: 0 0 0 2px #d3dbe6;
}
.timeline-item.is-pending .timeline-dot { background: var(--kt-accent); }
.timeline-time { font-weight: 800; font-size: 14px; color: var(--kt-primary); font-variant-numeric: tabular-nums; }
.timeline-text { font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.timeline-text a { word-break: break-all; }
.timeline-link { font-size: 13px; margin-top: 3px; display: inline-flex; align-items: center; gap: 4px; }
.timeline-actions { display: flex; gap: 6px; margin-top: 6px; }
.timeline-actions .btn { min-height: 34px; font-size: 12.5px; padding: 2px 10px; }

/* ---------- Rimborsi ---------- */

.expense-row {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius-sm);
    padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--kt-shadow);
}
.expense-icon {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    background: var(--kt-primary-soft); color: var(--kt-primary);
    display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.expense-main { flex: 1; min-width: 0; }
.expense-cat { font-weight: 700; font-size: 14px; }
.expense-note { font-size: 12.5px; color: var(--kt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-amount { font-weight: 800; font-size: 16px; color: var(--kt-primary); white-space: nowrap; }
.receipt-preview { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--kt-border); }

/* ---------- Veicolo e marker GPS ---------- */

.vehicle-stage {
    position: relative;
    background: #fff;
    border: 1px solid var(--kt-border);
    border-radius: var(--kt-radius);
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.vehicle-stage img, .vehicle-stage svg { display: block; width: 100%; height: auto; pointer-events: none; }
.marker-layer { position: absolute; inset: 0; cursor: crosshair; }
.marker-x {
    position: absolute;
    transform: translate(-50%, -50%);
    color: var(--kt-danger);
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 0 3px #fff, 0 0 6px #fff;
    pointer-events: none;
    animation: kt-pop .2s ease-out;
}
.marker-x.is-old { color: #a5adb8; font-size: 22px; opacity: 0.7; animation: none; }
.marker-x .marker-label {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    font-size: 10px; font-weight: 700; color: #3c4655; background: rgba(255, 255, 255, 0.9);
    padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}
@keyframes kt-pop { from { transform: translate(-50%, -50%) scale(0.4); } to { transform: translate(-50%, -50%) scale(1); } }
.view-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.view-tabs .btn { white-space: nowrap; min-height: 38px; font-size: 13px; }

/* ---------- Login ---------- */

.login-screen { max-width: 420px; margin: 0 auto; padding-top: 12px; }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand img { border-radius: 18px; box-shadow: var(--kt-shadow-strong); }
.login-brand h2 { font-size: 24px; font-weight: 800; margin: 14px 0 2px; color: var(--kt-primary); }
.login-card {
    background: #fff; border: 1px solid var(--kt-border);
    border-radius: 18px; padding: 22px 18px;
    box-shadow: var(--kt-shadow);
}
.login-footer { text-align: center; margin-top: 18px; }

/* ---------- Profilo ---------- */

.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar {
    width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #2d5385, var(--kt-primary-dark));
    color: #fff; font-weight: 800; font-size: 20px;
    box-shadow: 0 6px 14px rgba(31, 58, 95, 0.3);
}
.profile-name { font-size: 18px; font-weight: 800; line-height: 1.2; }
.profile-mail { font-size: 13px; color: var(--kt-muted); word-break: break-all; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--kt-border); font-size: 14px; }
.status-row:last-child { border-bottom: none; }
.status-row .k { color: var(--kt-muted); }
.status-row .v { font-weight: 600; text-align: right; }
.outbox-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--kt-border); }
.outbox-item:last-child { border-bottom: none; }
.outbox-item .oi-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--kt-accent-soft); color: var(--kt-accent-dark); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.outbox-item.has-error .oi-icon { background: var(--kt-danger-soft); color: var(--kt-danger); }
.outbox-item .oi-main { flex: 1; min-width: 0; font-size: 13.5px; }
.outbox-item .oi-error { color: var(--kt-danger); font-size: 12.5px; margin-top: 2px; }
.outbox-item .btn { min-height: 36px; }

/* ---------- Notifiche ---------- */

.notif-item {
    display: flex; gap: 12px; align-items: flex-start;
    background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius);
    padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--kt-shadow);
    text-decoration: none; color: var(--kt-text);
}
.notif-item:active { background: var(--kt-primary-soft); }
.notif-icon {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
    background: var(--kt-primary-soft); color: var(--kt-primary);
}
.notif-icon.n-warning { background: var(--kt-warning-soft); color: var(--kt-accent-dark); }
.notif-icon.n-info { background: var(--kt-info-soft); color: #1a5da8; }
.notif-icon.n-success { background: var(--kt-success-soft); color: #10693f; }
.notif-main { flex: 1; min-width: 0; }
.notif-title { font-weight: 700; font-size: 14.5px; }
.notif-body { font-size: 13.5px; color: #3c4655; }
.notif-date { font-size: 12px; color: var(--kt-muted); margin-top: 2px; }

/* ---------- Varie ---------- */

.sticky-actions {
    position: sticky;
    bottom: calc(var(--kt-nav-h) + var(--kt-sab) + 8px);
    display: flex; gap: 8px;
    padding: 8px 0;
    background: linear-gradient(to top, var(--kt-bg) 70%, transparent);
    z-index: 4;
}
.sticky-actions .btn { flex: 1; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #fff; border: 1px solid var(--kt-border); border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.divider { height: 1px; background: var(--kt-border); margin: 14px 0; }
.text-small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.fade-in { animation: kt-fade .22s ease-out; }
@keyframes kt-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.readonly-note { font-size: 13px; color: var(--kt-muted); display: flex; gap: 6px; align-items: center; }

@media (min-width: 576px) {
    .quick-actions { grid-template-columns: repeat(4, 1fr); }
    .kpi-row { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Calendario condiviso e schede leggibili. */
body { font-size: 16px; }
.text-small { font-size: .9rem; }
.calendar-days { display:grid; gap:12px; }
.calendar-day { min-width:0; padding:12px; background:#f5f7fb; border-radius:12px; }
.calendar-week { grid-template-columns:repeat(7,minmax(210px,1fr)); overflow-x:auto; padding-bottom:12px; }
.calendar-week .svc-card { padding:12px; }
.case-view .info-list .v, .case-view .fw-semibold, .case-view .list-group-item { color:#b42332; }
.bottomnav-item { min-width:0; flex:1; }
.bottomnav-item span { font-size:.75rem; }
@media(min-width:900px) { .app-view:has(.agenda-view) { max-width:1600px; } }

/* Calendario mensile con gli stessi colori degli operatori nel gestionale. */
.operator-colored { border-left:4px solid var(--operator-color); position:relative; overflow:hidden; }
.operator-colored::before { content:""; position:absolute; top:0; left:0; right:0; height:5px; background:var(--operator-stripes); }
.operator-legend { display:flex; flex-wrap:wrap; gap:8px 14px; font-size:.8rem; }
.operator-legend span { display:inline-flex; align-items:center; gap:5px; }
.operator-legend i { width:11px; height:11px; border-radius:50%; }
.month-weekdays { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); text-align:center; font-size:.8rem; font-weight:600; padding-bottom:8px; }
.calendar-month { grid-template-columns:repeat(7,minmax(0,1fr)); gap:3px; }
.calendar-month .calendar-day { border-radius:6px; padding:4px 2px; min-height:105px; background:#fff; border:1px solid #e2e7ef; }
.calendar-month .calendar-day h2 { font-size:.8rem; text-align:center; margin-bottom:8px; }
.calendar-month .calendar-day .today { background:#e7efff; border-radius:8px; }
.calendar-month .outside-month { background:#f1f3f7; }
.calendar-month .svc-card { padding:8px 3px 4px; margin:4px 0; border-radius:4px; box-shadow:none; border-left-width:3px; }
.calendar-month .svc-case-title { font-size:.67rem; line-height:1.3; overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.calendar-month .svc-card-head { font-size:.58rem; display:block; }
.calendar-month .svc-card-head .badge,.calendar-month .svc-meta,.calendar-month .svc-flags,.calendar-month .text-small { display:none; }
.service-fast-actions { display:flex; flex-wrap:wrap; gap:8px; }
.service-fast-actions .btn { flex:1; min-width:95px; }
.pin-panel { max-width:460px; margin:12px auto; }
.pin-icon { display:flex; align-items:center; justify-content:center; background:#eef3fa; color:#1f3a5f; border-radius:20px; font-size:32px; width:68px; height:68px; margin-bottom:20px; }
.pin-panel input[inputmode="numeric"] { letter-spacing:.3em; text-align:center; }
#inlineDiary .subtitle-row { display:none; }
#inlineDiary .diary-view>.section-title:first-of-type { margin-top:6px; }
@media(min-width:700px) {
    .calendar-month { gap:7px; }
    .calendar-month .calendar-day { padding:8px; min-height:150px; }
    .calendar-month .svc-card { padding:10px 7px 7px; }
    .calendar-month .svc-case-title { font-size:.85rem; }
    .calendar-month .svc-card-head { font-size:.8rem; }
}

/* Accesso temporaneo come utente: il ritorno all'admin resta sempre visibile. */
.impersonation-banner {
    position: fixed;
    top: calc(var(--kt-topbar-h) + var(--kt-sat));
    left: 0; right: 0;
    z-index: 1031;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px calc(12px + var(--kt-sar)) 8px calc(12px + var(--kt-sal));
    background: #fff1c4;
    border-bottom: 1px solid #dfbd5f;
    color: #674b0a;
    box-shadow: 0 3px 8px rgba(0,0,0,.1);
}
.impersonation-label { display: flex; flex-direction: column; min-width: 0; }
.impersonation-label span { font-size: 11px; line-height: 1.2; }
.impersonation-label strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.impersonation-banner .btn { flex-shrink: 0; white-space: nowrap; font-size: 12px; }

/* Tema operatori: superfici scure, testo leggibile e colori calendario originali. */
html[data-bs-theme="dark"] {
    color-scheme: dark;
    --kt-bg: #101317;
    --kt-card: #181d24;
    --kt-text: #edf2f7;
    --kt-muted: #a7b3c3;
    --kt-border: #303946;
    --kt-primary: #9fc8f7;
    --kt-primary-dark: #c4dfff;
    --kt-primary-soft: #223449;
    --kt-accent: #e5ad45;
    --kt-accent-dark: #f2ca7a;
    --kt-accent-soft: #3a301e;
    --kt-success: #8bd5ae;
    --kt-success-soft: #19372b;
    --kt-danger: #f09ba4;
    --kt-danger-soft: #3d242b;
    --kt-info: #a3c8f4;
    --kt-info-soft: #20354b;
    --kt-warning-soft: #3a301e;
    --kt-shadow: 0 4px 18px rgba(0,0,0,.16), 0 1px 3px rgba(0,0,0,.18);
    --kt-shadow-strong: 0 12px 30px rgba(0,0,0,.3);
    --bs-body-bg: #101317;
    --bs-body-bg-rgb: 16,19,23;
    --bs-body-color: #edf2f7;
    --bs-body-color-rgb: 237,242,247;
    --bs-emphasis-color: #f5f8fc;
    --bs-emphasis-color-rgb: 245,248,252;
    --bs-secondary-color: #a7b3c3;
    --bs-secondary-color-rgb: 167,179,195;
    --bs-secondary-bg: #222a35;
    --bs-secondary-bg-rgb: 34,42,53;
    --bs-tertiary-bg: #1a2029;
    --bs-tertiary-bg-rgb: 26,32,41;
    --bs-tertiary-color: #929faf;
    --bs-border-color: #303946;
    --bs-border-color-translucent: rgba(157,178,205,.2);
    --bs-link-color: #9fc8f7;
    --bs-link-color-rgb: 159,200,247;
    --bs-link-hover-color: #c4dfff;
    --bs-link-hover-color-rgb: 196,223,255;
    --bs-success-rgb: 139,213,174;
    --bs-danger-rgb: 240,155,164;
    --bs-warning-rgb: 242,202,122;
    --bs-info-rgb: 163,200,244;
    --bs-focus-ring-color: rgba(159,200,247,.3);
}
html[data-bs-theme="dark"] ::selection { background:#aacbef; color:#101a27; }
html[data-bs-theme="dark"] body { background:var(--kt-bg); color:var(--kt-text); }
html[data-bs-theme="dark"] .topbar { background:linear-gradient(115deg,#151c26,#202c3c); border-bottom:1px solid #303d4f; box-shadow:0 3px 14px rgba(0,0,0,.24); }
html[data-bs-theme="dark"] .bottomnav { background:rgba(20,25,33,.97); box-shadow:0 -4px 18px rgba(0,0,0,.25); }
html[data-bs-theme="dark"] .bottomnav-item.active { color:#c5defc; }
html[data-bs-theme="dark"] .nav-dot { border-color:#141921; }
html[data-bs-theme="dark"] .offline-banner { background:#34303a; color:#f1e8f2; }
html[data-bs-theme="dark"] .update-banner { background:#26364b; border:1px solid #48617e; }
html[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color:#f8fbff; --bs-btn-bg:#315e8c; --bs-btn-border-color:#4a78a8;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#3b709f; --bs-btn-hover-border-color:#6995c5;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#284e75; --bs-btn-active-border-color:#8eb6e1;
    --bs-btn-disabled-color:#b5c2d2; --bs-btn-disabled-bg:#263a50; --bs-btn-disabled-border-color:#3b4e64;
    box-shadow:0 4px 12px rgba(0,0,0,.18);
}
html[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color:#b6d7fd; --bs-btn-border-color:#46617f;
    --bs-btn-hover-color:#eff6ff; --bs-btn-hover-bg:#294664; --bs-btn-hover-border-color:#7398bf;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#345777; --bs-btn-active-border-color:#9bc1e9;
    --bs-btn-disabled-color:#8196ae; --bs-btn-disabled-border-color:#344354;
    background:#1c2735;
}
html[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color:#c8d3e1; --bs-btn-border-color:#3e4b5c;
    --bs-btn-hover-color:#f1f6fc; --bs-btn-hover-bg:#2c3745; --bs-btn-hover-border-color:#687c96;
    --bs-btn-active-color:#fff; --bs-btn-active-bg:#344354; --bs-btn-active-border-color:#8298b3;
    background:#1c232d; color:var(--bs-btn-color); border-color:var(--bs-btn-border-color);
}
html[data-bs-theme="dark"] .btn-light {
    --bs-btn-color:#e2eaf4; --bs-btn-bg:#242e3b; --bs-btn-border-color:#3a485c;
    --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#303e50; --bs-btn-hover-border-color:#607590;
    background:var(--bs-btn-bg); color:var(--bs-btn-color);
}
html[data-bs-theme="dark"] .btn-warning { --bs-btn-color:#271c08; --bs-btn-hover-color:#211704; --bs-btn-hover-bg:#f0c264; --bs-btn-hover-border-color:#f0c264; --bs-btn-active-color:#211704; }
html[data-bs-theme="dark"] .btn-danger { --bs-btn-bg:#973c4b; --bs-btn-border-color:#ba5b6b; --bs-btn-hover-bg:#ad4758; --bs-btn-hover-border-color:#d77887; }
html[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color:#f4adb6; --bs-btn-border-color:#824854; --bs-btn-hover-bg:#762d3b; --bs-btn-hover-color:#fff; --bs-btn-hover-border-color:#c47784; background:#2b2027; }
html[data-bs-theme="dark"] .btn-outline-primary:hover,
html[data-bs-theme="dark"] .btn-outline-secondary:hover,
html[data-bs-theme="dark"] .btn-outline-danger:hover,
html[data-bs-theme="dark"] .btn-light:hover { background-color:var(--bs-btn-hover-bg); color:var(--bs-btn-hover-color); border-color:var(--bs-btn-hover-border-color); }
html[data-bs-theme="dark"] .btn-outline-primary:active,
html[data-bs-theme="dark"] .btn-outline-secondary:active,
html[data-bs-theme="dark"] .btn-outline-danger:active { background-color:var(--bs-btn-active-bg); color:var(--bs-btn-active-color); border-color:var(--bs-btn-active-border-color); }
html[data-bs-theme="dark"] .btn:focus-visible { outline:2px solid #b8d9ff; outline-offset:2px; }
html[data-bs-theme="dark"] .btn-dark { --bs-btn-color:#edf2f7; --bs-btn-bg:#26313e; --bs-btn-border-color:#536477; --bs-btn-hover-bg:#344456; --bs-btn-hover-border-color:#9bb0c8; }
html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select { background-color:#131920; border-color:#3a4656; color:#edf2f7; }
html[data-bs-theme="dark"] .form-control::placeholder { color:#98a5b7; opacity:1; }
html[data-bs-theme="dark"] .form-control:disabled,
html[data-bs-theme="dark"] .form-select:disabled { background-color:#202731; color:#9cabbc; }
html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus { background-color:#171e27; border-color:#8cb9ea; color:#f4f8ff; box-shadow:0 0 0 .2rem rgba(151,191,240,.18); }
html[data-bs-theme="dark"] .form-control::file-selector-button { background:#293545; color:#e5edf7; }
html[data-bs-theme="dark"] .input-group-text { background:#232d3a; color:#ccd8e7; border-color:#3a4656; }
html[data-bs-theme="dark"] .form-label { color:#d6e0ec; }
html[data-bs-theme="dark"] .form-check-input { background-color:#151c25; border-color:#65768b; }
html[data-bs-theme="dark"] .form-check-input:checked { background-color:#4777a9; border-color:#80aad6; }
html[data-bs-theme="dark"] .form-switch .form-check-input:checked { background-color:#2c8060; border-color:#71c09e; }
html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .login-card,
html[data-bs-theme="dark"] .quick-action,
html[data-bs-theme="dark"] .kpi,
html[data-bs-theme="dark"] .detail-box,
html[data-bs-theme="dark"] .expense-row,
html[data-bs-theme="dark"] .notif-item,
html[data-bs-theme="dark"] .chip,
html[data-bs-theme="dark"] .vehicle-stage { background:var(--kt-card); color:var(--kt-text); border-color:var(--kt-border); }
html[data-bs-theme="dark"] .modal-content { background:#1b222c; color:#edf2f7; border:1px solid #3b485b; }
html[data-bs-theme="dark"] .list-group-item { background:var(--kt-card); color:var(--kt-text); }
html[data-bs-theme="dark"] .list-group-item-action:hover { background:#252f3d; color:#fff; }
html[data-bs-theme="dark"] .dropdown-menu { --bs-dropdown-bg:#202833; --bs-dropdown-color:#e7eef8; --bs-dropdown-border-color:#3c4a5e; --bs-dropdown-link-color:#e7eef8; --bs-dropdown-link-hover-color:#fff; --bs-dropdown-link-hover-bg:#2d3c50; --bs-dropdown-link-active-bg:#315e8c; }
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .bg-light { background-color:var(--kt-card)!important; color:var(--kt-text)!important; }
html[data-bs-theme="dark"] .bg-primary { background-color:#294b6e!important; color:#edf5ff; }
html[data-bs-theme="dark"] .table { --bs-table-color:#e1e9f4; --bs-table-bg:transparent; --bs-table-border-color:#303c4d; --bs-table-striped-bg:rgba(182,205,235,.04); --bs-table-striped-color:#e1e9f4; --bs-table-hover-bg:rgba(182,205,235,.07); --bs-table-hover-color:#fff; }
html[data-bs-theme="dark"] .badge.text-bg-primary { background:var(--kt-primary-soft)!important; color:#c0dcfd!important; }
html[data-bs-theme="dark"] .badge.text-bg-success { color:#a0e2bd!important; }
html[data-bs-theme="dark"] .badge.text-bg-danger { color:#ffc0c7!important; }
html[data-bs-theme="dark"] .badge.text-bg-warning { color:#f6d18a!important; }
html[data-bs-theme="dark"] .badge.text-bg-info { color:#bad9fe!important; }
html[data-bs-theme="dark"] .badge.text-bg-secondary { background:#2b3441!important; color:#c0ccdc!important; }
html[data-bs-theme="dark"] .badge.text-bg-light { background:#2b3441!important; color:#d3deec!important; }
html[data-bs-theme="dark"] .text-dark,
html[data-bs-theme="dark"] .text-black { color:var(--kt-text)!important; }
html[data-bs-theme="dark"] .alert-warning { color:#f4d48e; }
html[data-bs-theme="dark"] .alert-danger { color:#ffbbc3; }
html[data-bs-theme="dark"] .alert-info { color:#b8d9ff; }
html[data-bs-theme="dark"] .alert-success { color:#a3dfbd; }
html[data-bs-theme="dark"] .alert-light { background:#252f3b; color:#d6e0ed; }
html[data-bs-theme="dark"] .flag { background:#293340; color:#c4d0df; }
html[data-bs-theme="dark"] .flag-on,
html[data-bs-theme="dark"] .status-badge.status-completato,
html[data-bs-theme="dark"] .status-badge.status-autorizzata { background:var(--kt-success-soft); color:#a0e2bd; }
html[data-bs-theme="dark"] .flag-lock,
html[data-bs-theme="dark"] .status-badge.status-annullato { background:#29313c; color:#b7c3d2; }
html[data-bs-theme="dark"] .flag-warn,
html[data-bs-theme="dark"] .status-badge.status-in_corso { background:var(--kt-warning-soft); color:#f4d48e; }
html[data-bs-theme="dark"] .status-badge.status-programmato,
html[data-bs-theme="dark"] .status-badge.status-inserita { background:var(--kt-info-soft); color:#bad9fe; }
html[data-bs-theme="dark"] .status-badge.status-rifiutata { background:var(--kt-danger-soft); color:#ffc0c7; }
html[data-bs-theme="dark"] .pending-badge,
html[data-bs-theme="dark"] .quick-action .qa-badge { color:#241904; box-shadow:none; }
html[data-bs-theme="dark"] .svc-card.has-pending { border-color:#9a7b39; background:#28251d; }
html[data-bs-theme="dark"] .svc-time-cl,
html[data-bs-theme="dark"] .svc-title,
html[data-bs-theme="dark"] .notif-body { color:#cad5e4; }
html[data-bs-theme="dark"] .notif-icon.n-info { color:#bad9fe; }
html[data-bs-theme="dark"] .notif-icon.n-success { color:#a0e2bd; }
html[data-bs-theme="dark"] .filter-tabs { background:#1a2029; border:1px solid #2d3745; }
html[data-bs-theme="dark"] .filter-tabs button.active { background:#2b3748; color:#e8f2ff; box-shadow:0 2px 6px rgba(0,0,0,.2); }
html[data-bs-theme="dark"] .filter-tabs .count { color:#c1dcfb; }
html[data-bs-theme="dark"] .empty-state-icon { background:radial-gradient(circle at 35% 30%,#2e4056,#1d2a3b); box-shadow:inset 0 0 0 1px #3f5875; }
html[data-bs-theme="dark"] .hero { background:radial-gradient(420px 200px at 90% -30%,rgba(229,173,69,.18),transparent 60%),linear-gradient(120deg,#1a2635,#263e59); }
html[data-bs-theme="dark"] .hero-stat { background:rgba(13,22,34,.3); border-color:rgba(154,181,215,.18); }
html[data-bs-theme="dark"] .timeline::before { background:#3b4b61; }
html[data-bs-theme="dark"] .timeline-dot { border-color:var(--kt-card); box-shadow:0 0 0 2px #3b4b61; }
html[data-bs-theme="dark"] .marker-x { text-shadow:0 0 3px #111b28,0 0 6px #111b28; }
html[data-bs-theme="dark"] .marker-x .marker-label { color:#f2f6fc; background:rgba(27,37,51,.95); }
html[data-bs-theme="dark"] .avatar { background:linear-gradient(135deg,#2b4c71,#263748); color:#e3efff; box-shadow:0 6px 14px rgba(0,0,0,.22); }
html[data-bs-theme="dark"] .pin-icon { background:#25374e; color:#c1dcfc; }
html[data-bs-theme="dark"] .skeleton { background:#242d39; }
html[data-bs-theme="dark"] .skeleton::after { background:linear-gradient(90deg,transparent,rgba(165,190,224,.1),transparent); }
html[data-bs-theme="dark"] .kt-toast { background:#2d394a; color:#eff5fc; border:1px solid #4a5a70; }
html[data-bs-theme="dark"] .kt-toast.toast-success { background:#24543e; }
html[data-bs-theme="dark"] .kt-toast.toast-danger { background:#76313e; }
html[data-bs-theme="dark"] .kt-toast.toast-warning { background:#6a4d21; }
html[data-bs-theme="dark"] .kt-toast.toast-info { background:#294b70; }
html[data-bs-theme="dark"] .case-view .info-list .v,
html[data-bs-theme="dark"] .case-view .fw-semibold,
html[data-bs-theme="dark"] .case-view .list-group-item { color:#f4aab1; }
html[data-bs-theme="dark"] .login-brand img { border:1px solid #3c4b60; }
html[data-bs-theme="dark"] .calendar-day,
html[data-bs-theme="dark"] .calendar-month .calendar-day { background:#181e27; border-color:#303b4a; }
html[data-bs-theme="dark"] .calendar-month .outside-month { background:#12171f; color:#96a5b8; }
html[data-bs-theme="dark"] .calendar-month .calendar-day .today { background:#2a405e; color:#d9eaff; }
html[data-bs-theme="dark"] .calendar-timegrid { background:#151b23; border-color:#364254; }
html[data-bs-theme="dark"] .calendar-grid-corner,
html[data-bs-theme="dark"] .calendar-grid-heading { background:#202a37; color:#d2ddeb; border-color:#37465c; }
html[data-bs-theme="dark"] .calendar-grid-heading.is-today { background:#2b405d; color:#d2e7ff; }
html[data-bs-theme="dark"] .calendar-all-label,
html[data-bs-theme="dark"] .calendar-all-day { background:#1a222d; border-color:#364254; }
html[data-bs-theme="dark"] .calendar-all-label { color:#b5c5d9; }
html[data-bs-theme="dark"] .calendar-time-axis { background:#151d27; border-color:#3b4b61; }
html[data-bs-theme="dark"] .calendar-time-axis span { color:#b5c6dc; }
html[data-bs-theme="dark"] .calendar-time-day { border-color:#344255; background-color:#151b23; background-image:repeating-linear-gradient(to bottom,#3d4c61 0,#3d4c61 1px,transparent 1px,transparent var(--calendar-half-hour),#263344 var(--calendar-half-hour),#263344 calc(var(--calendar-half-hour) + 1px),transparent calc(var(--calendar-half-hour) + 1px),transparent var(--calendar-hour)); }
html[data-bs-theme="dark"] .calendar-time-event { border-color:rgba(204,222,249,.25); }
html[data-bs-theme="dark"] .calendar-now-line,
html[data-bs-theme="dark"] .calendar-now-line::before { background:#ff7e89; }
html[data-bs-theme="dark"] .calendar-range-label,
html[data-bs-theme="dark"] .calendar-search-status { color:#b4c1d2; }
html[data-bs-theme="dark"] .calendar-search-chip { background:#233952; color:#c3dfff; border-color:#526f91; }
html[data-bs-theme="dark"] .calendar-period-strip:focus-visible,
html[data-bs-theme="dark"] .calendar-period-surface:focus-visible,
html[data-bs-theme="dark"] .calendar-search-chip button:focus-visible { outline-color:#b7d8ff; }
html[data-bs-theme="dark"] .impersonation-banner { background:#f4d991; color:#33260e; border-color:#a98942; }
html[data-bs-theme="dark"] .impersonation-banner .btn-dark { --bs-btn-bg:#26313e; --bs-btn-border-color:#3a4b60; --bs-btn-color:#fff; }
