/* =============================================
   CRI Varese - Centralino
   Palette e linee guida nazionali CRI (cri.it)
   ============================================= */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Slab:wght@400;700&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --cri-red:        #CC0000;
  --cri-red-dark:   #A30000;
  --cri-red-light:  #E63939;
  --cri-dark:       #363537;
  --cri-gray:       #777777;
  --cri-gray-light: #E5E5E5;
  --cri-white:      #FEFEFE;
  --cri-black:      #1A1A1A;
  --font-sans:      'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-slab:      'Roboto Slab', Georgia, serif;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.12);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 24px rgba(0,0,0,0.14);
  --radius:         6px;
  --radius-lg:      12px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--cri-black);
  background: linear-gradient(180deg, var(--cri-white) 0%, #F5F5F5 100%);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--cri-red); text-decoration: none; }
a:hover { color: var(--cri-red-dark); text-decoration: underline; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-slab);
  font-weight: 700;
  color: var(--cri-dark);
}

/* --- Navbar / Header --- */
.cri-topbar {
  background: var(--cri-dark);
  color: #fff;
  font-size: 13px;
  padding: 6px 0;
  text-align: center;
}
.cri-topbar a { color: #ddd; }
.cri-topbar a:hover { color: #fff; text-decoration: none; }

.cri-navbar {
  background: #fff;
  border-bottom: 3px solid var(--cri-red);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}
.cri-navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cri-navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.cri-navbar-brand img {
  height: 48px;
}
.cri-navbar-brand span {
  font-family: var(--font-slab);
  font-size: 20px;
  font-weight: 700;
  color: var(--cri-red);
  line-height: 1.2;
}
.cri-navbar-brand small {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--cri-gray);
}
.cri-nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cri-nav-links a {
  color: var(--cri-dark);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.cri-nav-links a:hover {
  background: var(--cri-gray-light);
  text-decoration: none;
}

/* --- Buttons: CRI style --- */
.btn-cri {
  background: var(--cri-red);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 2px 4px rgba(204,0,0,0.20);
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-cri:hover {
  background: var(--cri-red-dark);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 8px rgba(204,0,0,0.30);
  transform: translateY(-1px);
}
.btn-cri-outline {
  background: transparent;
  color: var(--cri-red);
  border: 2px solid var(--cri-red);
  padding: 10px 26px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-cri-outline:hover {
  background: var(--cri-red);
  color: #fff;
  text-decoration: none;
}
.btn-cri-dark {
  background: var(--cri-dark);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-cri-dark:hover {
  background: #222;
  color: #fff;
  text-decoration: none;
}
.btn-cri-gray {
  background: var(--cri-gray);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-cri-gray:hover {
  background: #555;
  color: #fff;
  text-decoration: none;
}
.btn-cri-success {
  background: #2D8A4E;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-cri-success:hover {
  background: #236B3E;
  color: #fff;
  text-decoration: none;
}
.btn-block {
  display: block;
  width: 100%;
}

/* --- Section headings --- */
.section-title {
  background: var(--cri-red);
  color: #fff;
  font-family: var(--font-slab);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 24px;
  margin: 2rem 0 1rem;
  border-radius: var(--radius);
  position: relative;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 24px;
  width: 40px;
  height: 3px;
  background: var(--cri-red-light);
  border-radius: 2px;
}

/* --- Cards --- */
.cri-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 1rem;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid rgba(0,0,0,0.06);
}
.cri-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.cri-card h5 {
  font-family: var(--font-slab);
  font-size: 16px;
  color: var(--cri-dark);
  margin-bottom: 12px;
}
.cri-card .btn-cri,
.cri-card .btn-cri-outline,
.cri-card .btn-cri-dark,
.cri-card .btn-cri-gray,
.cri-card .btn-cri-success,
.cri-card .btn-cri-danger {
  width: 100%;
  margin-bottom: 8px;
}

/* --- Alert / Avvisi --- */
.cri-alert {
  background: #FFF3CD;
  border-left: 4px solid var(--cri-red);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 1rem 0;
  font-size: 16px;
}
.cri-alert strong { color: var(--cri-red); }

/* --- Tables --- */
.table { font-size: 14px; }
.table thead th {
  background: var(--cri-dark);
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 10px 14px;
}
.table tbody td,
.table tbody th {
  vertical-align: middle;
  padding: 10px 14px;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(204, 0, 0, 0.03);
}

/* --- Forms --- */
.form-control {
  border-radius: var(--radius);
  border: 1px solid #ccc;
  padding: 10px 14px;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  border-color: var(--cri-red);
  box-shadow: 0 0 0 3px rgba(204,0,0,0.12);
  outline: none;
}
select.form-control {
  height: auto !important;
}
.form-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--cri-dark);
  margin-bottom: 4px;
}

/* --- Quick links bar --- */
.cri-quicklinks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}
.cri-quicklinks a {
  flex: 1;
  min-width: 140px;
}

/* --- Route calculator widget --- */
.cri-route-widget {
  background: linear-gradient(135deg, var(--cri-dark) 0%, #4A4A4A 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: #fff;
}
.cri-route-widget .form-control {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
}
.cri-route-widget .form-control::placeholder { color: rgba(255,255,255,0.6); }
.cri-route-widget .form-control:focus {
  background: rgba(255,255,255,0.25);
  border-color: var(--cri-red-light);
}

/* --- Footer --- */
.cri-footer {
  background: var(--cri-red);
  color: #fff;
  padding: 24px 0;
  margin-top: auto;
  text-align: center;
  font-size: 14px;
}
.cri-footer img {
  height: 40px;
  margin-bottom: 8px;
}
.cri-footer a { color: #fff; text-decoration: underline; }

/* --- Login page --- */
.cri-login-container {
  max-width: 440px;
  margin: 60px auto;
  padding: 0 20px;
}
.cri-login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  text-align: center;
}
.cri-login-card img {
  height: 80px;
  margin-bottom: 16px;
}
.cri-login-card h2 {
  font-family: var(--font-slab);
  color: var(--cri-red);
  margin-bottom: 24px;
  font-size: 22px;
}

/* --- Utility --- */
.text-cri-red { color: var(--cri-red); }
.bg-cri-red { background: var(--cri-red); }
.text-cri-gray { color: var(--cri-gray); }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.gap-2 > * + * { margin-top: 0.75rem; }

/* --- Movement type toggle buttons --- */
.movement-type-btn {
  padding: 14px 12px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.movement-type-btn:hover {
  opacity: 0.85;
}

/* --- Hamburger toggle --- */
.cri-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--cri-dark);
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.cri-nav-toggle:hover { background: var(--cri-gray-light); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .cri-navbar .container { flex-wrap: wrap; }
  .cri-nav-toggle { display: block; }
  .cri-nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--cri-gray-light);
    margin-top: 8px;
  }
  .cri-nav-links.open { display: flex; }
  .cri-nav-links a { padding: 10px 14px; font-size: 15px; }
  .cri-quicklinks { flex-direction: column; }
  .section-title { font-size: 15px; padding: 12px 18px; }
  .cri-login-card { padding: 24px; }
  .cri-navbar-brand img { height: 36px; }
  .cri-navbar-brand span { font-size: 17px; }
  .cri-navbar-brand small { font-size: 11px; }
  /* Sticky submit bar */
  .checklist-progress { padding: 10px 12px; }
}

/* --- Checklist Ambulanze --- */
.btn-cri-danger {
  background: #CC0000;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-cri-danger:hover {
  background: #A30000;
  color: #fff;
  text-decoration: none;
}

.checklist-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--cri-gray-light);
  background: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.checklist-toggle:active {
  transform: scale(0.95);
}
.checklist-toggle.ok-active {
  background: #2D8A4E;
  color: #fff;
  border-color: #2D8A4E;
}
.checklist-toggle.ko-active {
  background: #CC0000;
  color: #fff;
  border-color: #CC0000;
}

.checklist-note {
  display: none;
  margin-top: 6px;
}
.checklist-note.visible {
  display: block;
}
.checklist-note textarea {
  width: 100%;
  border: 1px solid #CC0000;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 14px;
  resize: vertical;
  min-height: 40px;
}
.checklist-note textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(204,0,0,0.12);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.checklist-item:last-child {
  border-bottom: none;
}
.checklist-item-label {
  flex: 1;
  font-size: 14px;
  line-height: 1.3;
}
.checklist-item-number {
  font-weight: 700;
  color: var(--cri-gray);
  min-width: 28px;
}
.checklist-item-qty {
  min-width: 36px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--cri-dark);
  background: #f0f0f0;
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.checklist-item-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.checklist-progress {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 2px solid var(--cri-gray-light);
  padding: 12px 16px;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
.checklist-progress-bar {
  height: 8px;
  background: var(--cri-gray-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.checklist-progress-fill {
  height: 100%;
  background: #2D8A4E;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.checklist-progress-text {
  font-size: 13px;
  color: var(--cri-gray);
  margin-bottom: 8px;
}

.checklist-section-header {
  background: var(--cri-dark);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-family: var(--font-slab);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.checklist-section-header .badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.checklist-section-header .badge-ok { background: #2D8A4E; }
.checklist-section-header .badge-ko { background: #CC0000; }
.checklist-section-header .badge-pending { background: var(--cri-gray); }

/* Viewer cards */
.checklist-card {
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  margin-bottom: 8px;
}
.checklist-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.checklist-card-ok {
  background: #E8F5E9;
  border-color: #2D8A4E;
}
.checklist-card-ko {
  background: #FFEBEE;
  border-color: #CC0000;
}
.checklist-card-pending {
  background: #F5F5F5;
  border-color: var(--cri-gray-light);
  color: var(--cri-gray);
}
.checklist-card h6 {
  font-family: var(--font-slab);
  font-size: 16px;
  margin-bottom: 4px;
}
.checklist-card .card-meta {
  font-size: 13px;
  color: var(--cri-gray);
}

.checklist-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}
.checklist-detail-item.ko {
  color: #CC0000;
  font-weight: 600;
}
.checklist-detail-item .status-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* --- Segnalazione Danni Mezzi --- */
.damage-svg-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.damage-svg-tab {
  padding: 8px 14px;
  border: 2px solid var(--cri-gray-light);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.damage-svg-tab.active {
  background: var(--cri-dark);
  color: #fff;
  border-color: var(--cri-dark);
}
.damage-svg-tab .tab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--cri-red);
  color: #fff;
  font-size: 11px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.damage-svg-container {
  border: 1px solid var(--cri-gray-light);
  border-radius: var(--radius);
  padding: 8px;
  background: #FAFAFA;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.damage-svg-view {
  display: block;
}
/* Image-based damage schema */
.damage-img-container {
  position: relative;
  border: 1px solid var(--cri-gray-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: #FAFAFA;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}
.damage-img-container img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}
.damage-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.damage-marker-dot {
  position: absolute;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  background: var(--cri-red);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(204,0,0,0.3), var(--shadow-sm);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.15s;
  z-index: 2;
}
.damage-marker-dot:hover {
  transform: scale(1.3);
}
/* Read-only markers (viewer) */
.damage-marker-dot.readonly {
  cursor: default;
  pointer-events: none;
}
.damage-img-container.readonly {
  cursor: default;
}
.damage-type-buttons,
.damage-severity-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.severity-moderato-active {
  background: #E6A817 !important;
  color: #fff !important;
  border-color: #E6A817 !important;
}
.damage-photo-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.damage-photo-thumb {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--cri-gray-light);
}
.damage-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.damage-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(204,0,0,0.85);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.damage-report-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid var(--cri-gray-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}
.damage-report-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.damage-report-card h6 {
  font-family: var(--font-slab);
  font-size: 16px;
  margin-bottom: 2px;
}
.damage-severity-badge,
.damage-status-badge {
  display: inline-block;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

/* --- Address autocomplete --- */
.address-suggestions {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--cri-gray-light);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}
.address-suggestion-item {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.address-suggestion-item:last-child { border-bottom: none; }
.address-suggestion-item:hover {
  background: var(--cri-red-light);
  color: var(--cri-red);
}

/* --- Bootstrap compat --- */
.sr-only, .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;
}
.dropdown-menu {
  width: 100%;
  text-align: center;
  font-size: 15px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 1050;
}

/* Ensure cards with dropdowns don't clip open menus */
.cri-card .dropdown { position: relative; }
.cri-card:has(.dropdown-menu.show) {
  z-index: 20;
  overflow: visible;
}

/* --- Navbar dropdown --- */
.cri-nav-dropdown {
  position: relative;
  display: inline-block;
}
.cri-nav-dropdown > a {
  color: var(--cri-dark);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: background 0.2s;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.cri-nav-dropdown > a:hover {
  background: var(--cri-gray-light);
  text-decoration: none;
}
.cri-nav-dropdown .cri-nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--cri-gray-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 1050;
  padding: 4px 0;
}
.cri-nav-dropdown:hover .cri-nav-dropdown-menu,
.cri-nav-dropdown.show .cri-nav-dropdown-menu {
  display: block;
}
.cri-nav-dropdown .cri-nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  color: var(--cri-dark);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  transition: background 0.15s;
}
.cri-nav-dropdown .cri-nav-dropdown-menu a:hover {
  background: var(--cri-gray-light);
  text-decoration: none;
}

/* --- User dropdown (top-right) --- */
.cri-nav-user {
  margin-left: auto;
}
.cri-nav-user > a {
  background: var(--cri-gray-light);
}
.cri-nav-user .cri-nav-dropdown-menu {
  left: auto;
  right: 0;
  min-width: 180px;
}

/* --- Scadenze Mezzi --- */
.deadline-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  margin-bottom: 10px;
  border-left: 4px solid var(--cri-gray-light);
  transition: box-shadow 0.2s;
}
.deadline-card:hover {
  box-shadow: var(--shadow-md);
}
.deadline-card h6 {
  font-family: var(--font-slab);
  font-size: 16px;
  margin-bottom: 8px;
}
.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
.deadline-badge:hover {
  opacity: 0.85;
}
.deadline-badge.missing {
  background: var(--cri-gray-light);
  color: var(--cri-gray);
}
.deadline-badge .days-label {
  font-weight: 400;
  font-size: 12px;
  opacity: 0.9;
}

/* --- Manutenzioni Mezzi --- */
.maintenance-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid var(--cri-gray-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}
.maintenance-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.maintenance-card h6 {
  font-family: var(--font-slab);
  font-size: 16px;
  margin-bottom: 2px;
}
.maintenance-card.breakdown {
  border-left-color: var(--cri-red);
}
.breakdown-badge {
  display: inline-block;
  background: var(--cri-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.parts-table {
  width: 100%;
  font-size: 14px;
  border-collapse: collapse;
  margin-top: 8px;
}
.parts-table th {
  background: var(--cri-dark);
  color: #fff;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
}
.parts-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--cri-gray-light);
}
.parts-table tr:last-child td {
  border-bottom: none;
}
.parts-row-add {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 8px;
  background: #F9F9F9;
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.parts-row-add .form-control {
  font-size: 13px;
  padding: 6px 10px;
}
.parts-row-add .btn-remove-part {
  background: var(--cri-red);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Inline edit form for deadlines */
.deadline-inline-form {
  display: none;
  background: #F9F9F9;
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 8px;
}
.deadline-inline-form.visible {
  display: block;
}

/* --- Panoramica flotta --- */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.fleet-card {
  background: #fff;
  cursor: pointer;
  padding: 16px;
  border-left: 4px solid var(--cri-gray-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.fleet-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
.fleet-card .fleet-code {
  font-family: var(--font-slab);
  font-size: 16px;
  font-weight: 700;
}
.fleet-card .fleet-plate {
  font-size: 13px;
  color: var(--cri-gray);
}
.fleet-card .fleet-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}
.fleet-card .fleet-indicators {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.fleet-indicator {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.fleet-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 16px;
}
.fleet-filters .form-control {
  max-width: 200px;
  font-size: 14px;
  padding: 8px 12px;
}
.fleet-filters input[type="text"] {
  max-width: 240px;
}

/* --- Scheda veicolo --- */
.vehicle-header {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid rgba(0,0,0,0.06);
}
.vehicle-header .vehicle-code {
  font-family: var(--font-slab);
  font-size: 24px;
  font-weight: 700;
  color: var(--cri-dark);
}
.vehicle-header .vehicle-plate {
  font-size: 16px;
  color: var(--cri-gray);
  margin-left: 8px;
}
.vehicle-header .vehicle-type {
  font-size: 14px;
  color: var(--cri-gray);
  margin-top: 2px;
}
.vehicle-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}
.vehicle-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-bottom: 12px;
  border: 1px solid rgba(0,0,0,0.06);
}
.vehicle-section h6 {
  font-family: var(--font-slab);
  font-size: 15px;
  font-weight: 700;
  color: var(--cri-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--cri-gray-light);
}
.vehicle-section-link {
  font-size: 13px;
  color: var(--cri-gray);
  display: inline-block;
  margin-top: 10px;
}
.vehicle-section-link:hover {
  color: var(--cri-red);
}
.vehicle-edit-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.vehicle-edit-row .form-control,
.vehicle-edit-row select {
  font-size: 14px;
  padding: 8px 12px;
}
.vehicle-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--cri-gray);
  margin-bottom: 16px;
}
.vehicle-back-link:hover {
  color: var(--cri-red);
  text-decoration: none;
}
.mini-checklist-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.mini-checklist-badge:hover {
  opacity: 0.85;
}
.mini-checklist-badge.ok {
  background: #E8F5E9;
  color: #2D8A4E;
  border: 1px solid #2D8A4E;
}
.mini-checklist-badge.ko {
  background: #FFEBEE;
  color: #CC0000;
  border: 1px solid #CC0000;
}

@media (max-width: 768px) {
  .cri-nav-dropdown .cri-nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 16px;
  }
  .cri-nav-dropdown > a { padding: 10px 14px; }
  .parts-row-add {
    flex-direction: column;
  }
  .parts-row-add .form-control {
    width: 100%;
  }
  .fleet-grid {
    grid-template-columns: 1fr;
  }
  .vehicle-header .vehicle-code {
    font-size: 20px;
  }
  .vehicle-edit-row {
    flex-direction: column;
    align-items: stretch;
  }
  .fleet-filters {
    flex-direction: column;
  }
  .fleet-filters .form-control,
  .fleet-filters input[type="text"] {
    max-width: 100%;
  }
  /* Tables: smaller font on mobile */
  .table { font-size: 13px; }
  .table th, .table td { padding: 6px 8px; }
  /* Buttons in tables: bigger touch targets */
  .table .btn-sm { padding: 6px 10px; font-size: 13px; }
}

/* --- Extra small screens (phones < 480px) --- */
@media (max-width: 480px) {
  .container { padding-left: 10px; padding-right: 10px; }
  .cri-card { padding: 12px; }
  .cri-navbar { padding: 8px 0; }
  .cri-navbar-brand span { font-size: 15px; }
  .cri-navbar-brand small { display: none; }
  .cri-navbar-brand img { height: 32px; }
  .section-title { font-size: 14px; padding: 10px 14px; }
  .modal-dialog { margin: 8px; }
}

/* --- Bolla stampa radio --- */
.bolla-print-only { display: none; }

.bolla-header-address {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
  line-height: 1.5;
}

.bolla-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 24px;
  font-size: 13px;
  margin: 14px 0;
}

.bolla-footer {
  margin-top: 30px;
  text-align: center;
  font-size: 11px;
  color: #999;
  border-top: 1px solid #ddd;
  padding-top: 8px;
}

@media print {
  @page { size: A4 portrait; margin: 15mm 20mm; }
  body > *:not(#bollaContainer) { display: none !important; }
  #bollaContainer {
    display: block !important;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    background: #fff;
  }
  .bolla-content {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 13px;
    color: #000;
  }
  .bolla-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #CC0000;
  }
  .bolla-header h2 {
    font-size: 18px;
    color: #CC0000;
    margin: 4px 0 0;
  }
  .bolla-header h3 {
    font-size: 15px;
    color: #333;
    margin: 8px 0 4px;
  }
  .bolla-header-address {
    font-size: 11px;
    color: #555;
    margin-top: 2px;
    line-height: 1.4;
  }
  .bolla-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 20px;
    font-size: 12px;
    margin: 12px 0;
  }
  .bolla-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 12px;
  }
  .bolla-table th {
    background: #363537 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: #fff;
    padding: 5px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
  }
  .bolla-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #ddd;
  }
  .bolla-section {
    margin: 12px 0;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
  .bolla-section h4 {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 6px;
  }
  .bolla-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 6px;
  }
  .bolla-section table th {
    background: #f5f5f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 4px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    border-bottom: 1px solid #ccc;
  }
  .bolla-section table td {
    padding: 4px 8px;
    border-bottom: 1px solid #eee;
  }
  .bolla-signatures {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
  }
  .bolla-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 10px;
    color: #999;
    border-top: 1px solid #ddd;
    padding-top: 8px;
  }
  .no-print { display: none !important; }
}
