/* Meterlab — stile applicativo (nessuno stile inline: CSP style-src 'self') */
:root {
  --ml-sidebar-w: 15.5rem;
  --ml-focus: #ffbf47;
}

html, body { height: 100%; }
body { background: #f4f6f9; }

/* Focus sempre visibile per la navigazione da tastiera */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, .tabulator-row:focus-visible {
  outline: 3px solid var(--ml-focus) !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 .2rem rgba(0, 0, 0, .55) !important;
}

.ml-skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; }

.ml-header { min-height: 3.5rem; }
.ml-header .navbar-brand { font-weight: 700; letter-spacing: .02em; }
.ml-user { color: #fff; font-size: .9rem; }

.ml-shell { display: flex; min-height: calc(100vh - 3.5rem); }
.ml-sidebar { background: #fff; border-right: 1px solid #dee2e6; }
@media (min-width: 768px) {
  .ml-sidebar { width: var(--ml-sidebar-w); flex: 0 0 var(--ml-sidebar-w); }
}
.ml-sidebar .ml-menu-group { font-size: .75rem; text-transform: uppercase; color: #5c636a; padding: .75rem 1rem .25rem; margin: 0; }
.ml-sidebar .nav-link { color: #212529; border-left: 3px solid transparent; padding: .5rem 1rem; }
.ml-sidebar .nav-link:hover { background: #eef2f7; }
.ml-sidebar .nav-link[aria-current="page"] { border-left-color: #0d6efd; background: #e7f1ff; font-weight: 600; }

.ml-main { flex: 1 1 auto; min-width: 0; padding: 1rem; }
@media (min-width: 992px) { .ml-main { padding: 1.5rem 2rem; } }
.ml-main:focus { outline: none; }

.ml-card { background: #fff; border: 1px solid #dee2e6; border-radius: .5rem; padding: 1rem; margin-bottom: 1rem; }
.ml-card > h2, .ml-card > h3 { font-size: 1.15rem; margin-bottom: .75rem; }

.ml-required::after { content: " *"; color: #b02a37; }

.ml-error-summary:focus { outline: 3px solid #b02a37; }

.ml-counter { font-size: 1.8rem; font-weight: 700; }
.ml-bar { height: .9rem; background: #0d6efd; border-radius: .25rem; min-width: 2px; }
.ml-bar-alt { background: #198754; }
.ml-bar-track { background: #e9ecef; border-radius: .25rem; }

.ml-preview { position: sticky; top: 1rem; }
.ml-kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
.ml-kv dt { font-weight: 600; color: #495057; }
.ml-kv dd { margin: 0; overflow-wrap: anywhere; }

.ml-money { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ml-totals { font-size: 1.05rem; }
.ml-totals dd { text-align: right; font-variant-numeric: tabular-nums; }

/* Tabelle */
.tabulator { font-size: .9rem; }
.tabulator .tabulator-row.tabulator-selected { background: #cfe2ff; }
.ml-table-wrap { min-height: 6rem; }

/* Calendario */
.ml-cal-day { border: 1px solid #dee2e6; border-radius: .5rem; background: #fff; margin-bottom: .75rem; }
.ml-cal-day > h3 { font-size: 1rem; background: #f1f3f5; margin: 0; padding: .5rem .75rem; border-radius: .5rem .5rem 0 0; }
.ml-cal-day.ml-today > h3 { background: #e7f1ff; }
.ml-cal-day ul { list-style: none; margin: 0; padding: .5rem .75rem; }
.ml-cal-day li { padding: .35rem 0; border-bottom: 1px dashed #dee2e6; }
.ml-cal-day li:last-child { border-bottom: 0; }

/* Mappa locale SVG */
.ml-map { width: 100%; height: auto; background: #eaf3fb; border: 1px solid #b6d4fe; border-radius: .5rem; }
.ml-map .ml-grid { stroke: #c9dff5; stroke-width: 1; }
.ml-map .ml-pin { fill: #dc3545; stroke: #fff; stroke-width: 2; cursor: pointer; }
.ml-map .ml-pin.ml-st-done { fill: #198754; }
.ml-map .ml-pin.ml-st-planned { fill: #0d6efd; }
.ml-map .ml-pin:focus { stroke: #000; stroke-width: 4; outline: none; }
.ml-map .ml-label { font-size: 11px; fill: #212529; pointer-events: none; }

/* Wizard raccolta dati (tablet-first) */
.ml-wizard .btn { min-height: 3rem; font-size: 1.1rem; }
.ml-wizard .form-control, .ml-wizard .form-select { min-height: 3rem; font-size: 1.1rem; }
.ml-steps { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; }
.ml-steps button { min-height: 2.5rem; }
.ml-step-panel h2 { font-size: 1.4rem; }
.ml-signature { width: 100%; max-width: 640px; height: 220px; background: #fff; border: 2px dashed #6c757d; border-radius: .5rem; touch-action: none; display: block; }
.ml-offline-banner { border-left: 6px solid #fd7e14; }

.ml-progress { height: 1.25rem; }
.ml-progress .progress-bar { transition: width .2s; }

.ml-photo-thumb { max-width: 100%; max-height: 220px; border-radius: .25rem; border: 1px solid #dee2e6; }

@media (max-width: 575.98px) {
  .ml-main { padding: .75rem; }
  h1 { font-size: 1.5rem; }
}
