/**
 * Assignment Mode — Stili integrazione mappa + drawer + wizard
 *
 * UI v2 (2026-05-07): pannello come ESTENSIONE inferiore della card CTA.
 * Pulsanti tool disegno (polygon/rectangle/circle), stile rosso istituzionale
 * #890103, maniglie immobiliare.it (gestite via styles MapboxDraw in JS).
 *
 * Plan: docs/plans/2026-05-06-assegnazioni-mode-integrated-redesign.md
 */

:root {
  --am-color-draw: #890103;
}

/* ---------------------------------------------------------------------------
 * Card "Modalità assegnazione" (sempre visibile in drawer Gestione perizie)
 * --------------------------------------------------------------------------- */

.am-cta-card {
  margin: 14px 12px;
  padding: 16px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-secondary, #0e3b45) 0%, #134e5b 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14, 59, 69, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.am-cta-card .am-cta-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  opacity: 0.92;
}
.am-cta-card .am-cta-sub {
  font-size: 12px;
  line-height: 1.45;
  opacity: 0.82;
}
.am-cta-card .am-cta-btn {
  margin-top: 2px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-secondary, #0e3b45);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.am-cta-card .am-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.am-cta-card .am-cta-btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Stato attivo: card cambia colore + badge "● ATTIVA" pulse */
body.assignment-mode-active .am-cta-card {
  background: linear-gradient(135deg, #0a8c5a 0%, #0e6b48 100%);
  box-shadow: 0 6px 20px rgba(10, 140, 90, 0.28);
}
body.assignment-mode-active .am-cta-card .am-cta-title::before {
  content: "● ";
  color: #aaffd6;
  animation: am-pulse 1.6s ease-in-out infinite;
}
body.assignment-mode-active .am-cta-card .am-cta-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
@keyframes am-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------------------------------------------------------------------------
 * Estensione card (visibile solo quando modalità attiva)
 * --------------------------------------------------------------------------- */

.am-cta-extension { display: none; }
body.assignment-mode-active .am-cta-extension {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

/* Tools toolbar (3 pulsanti disegno) */
.am-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 4px;
}
.am-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.am-tool-btn:hover { background: rgba(255, 255, 255, 0.12); }
.am-tool-btn.active {
  background: #ecfdf5;
  color: #0a8c5a;
  border-color: #0a8c5a;
  box-shadow: 0 2px 6px rgba(10, 140, 90, 0.25);
}
.am-tool-btn.active svg { stroke: #0a8c5a; }
.am-tool-btn.active span { color: #0a8c5a; }
.am-tool-btn svg { display: block; }

/* Selection toolbar (select-all + count) */
.am-sel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}
.am-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}
.am-select-all input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.am-count {
  font-size: 11px;
  font-weight: 700;
  color: #aaffd6;
}

/* Selection body / lista */
.am-sel-body {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px;
  max-height: 180px;
  overflow-y: auto;
}
.am-sel-empty {
  margin: 0;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.45;
}
.am-sel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.am-sel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-secondary, #0e3b45);
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
}
.am-sel-remove {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.am-sel-remove:hover { background: #fee; color: #dc2626; }

/* Actions bottom */
.am-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 8px;
}
.am-btn {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.am-btn:hover { background: rgba(255, 255, 255, 0.22); }
.am-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.am-btn-primary {
  background: #fff;
  color: var(--brand-secondary, #0e3b45);
  border-color: #fff;
}
.am-btn-primary:hover { background: #f0fdf4; }
.am-btn-primary[disabled] { background: rgba(255, 255, 255, 0.5); color: rgba(14, 59, 69, 0.5); border-color: rgba(255, 255, 255, 0.5); }

/* ---------------------------------------------------------------------------
 * Drawer elenco perizie: checkbox al fianco di ogni voce
 * --------------------------------------------------------------------------- */

.am-checkbox {
  margin-right: 8px;
  width: 14px;
  height: 14px;
  cursor: pointer;
  vertical-align: middle;
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}
.am-checkbox:focus,
.am-checkbox:focus-visible,
.am-checkbox:checked,
.am-checkbox:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.am-pin-selected {
  box-shadow: 0 0 0 3px rgba(137, 1, 3, 0.6) !important;
  z-index: 10;
}

/* ---------------------------------------------------------------------------
 * Mapbox Draw: nasconde toolbar built-in (usiamo i nostri tool buttons)
 * --------------------------------------------------------------------------- */

/* Pulsanti default Mapbox Draw mai visibili (rewrite native usa source/layer
 * geojson direttamente, niente più MapboxDraw — ma il plugin resta caricato
 * in index.html per altre sezioni; questa regola è safe-guard) */
.mapboxgl-ctrl-top-right .mapbox-gl-draw_polygon,
.mapboxgl-ctrl-top-right .mapbox-gl-draw_trash,
.mapboxgl-ctrl-top-right .mapbox-gl-draw_line,
.mapboxgl-ctrl-top-right .mapbox-gl-draw_point {
  display: none !important;
}

/* ---------------------------------------------------------------------------
 * Cancel marker (X bianca su cerchio rosso, immobiliare-style)
 * --------------------------------------------------------------------------- */

.am-cancel-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--am-color-draw);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  border: 2px solid #fff;
  transition: transform 0.12s ease;
}
.am-cancel-marker:hover {
  transform: scale(1.12);
  background: #a30104;
}
.am-cancel-x {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

/* Cursori durante draw (pointer/crosshair) */
body.assignment-mode-active.mapboxgl-canvas-container,
body.assignment-mode-active .mapboxgl-canvas-container {
  cursor: crosshair;
}

/* ---------------------------------------------------------------------------
 * Wizard modal (overlay full-screen) — invariato dal v1
 * --------------------------------------------------------------------------- */

.aw-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.aw-stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
  width: 1080px;
  margin: 0 auto;
}
.aw-routes-panel {
  width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  display: none;       /* hidden default — display:none vince su [hidden] attr */
  flex-direction: column;
  height: 380px;
  transform-origin: top center;
}
/* Visibile solo quando dev ha assegnato un perito o cliccato Top-5.
 * Animazione slide-down dall'alto verso basso. */
.aw-routes-panel.aw-routes-show {
  display: flex;
  /* forwards = mantiene gli stili dell'ultima keyframe a fine animazione,
   * altrimenti il pannello "scollasserebbe" subito a max-height:0 */
  animation: aw-routes-slide-down 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes aw-routes-slide-down {
  from {
    transform: translateY(-32px) scaleY(0.6);
    opacity: 0;
    max-height: 0;
  }
  to {
    transform: translateY(0) scaleY(1);
    opacity: 1;
    max-height: 480px;
  }
}
.aw-routes-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--brand-secondary, #0e3b45);
  color: #fff;
  flex-shrink: 0;
}
.aw-routes-head strong { font-size: 13px; font-weight: 700; }
.aw-routes-sub {
  flex: 1;
  font-size: 11.5px;
  opacity: 0.85;
}
.aw-routes-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.aw-routes-close:hover { opacity: 0.7; }
.aw-routes-map {
  flex: 1;
  width: 100%;
  position: relative;
}
.aw-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.aw-dialog {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.aw-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--brand-secondary, #0e3b45);
  color: #fff;
}
.aw-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.aw-close { background: transparent; border: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 6px; }
.aw-close:hover { opacity: 0.7; }

.aw-stepper {
  display: flex;
  padding: 12px 18px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  gap: 8px;
  overflow-x: auto;
}
.aw-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
  background: #fff;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}
.aw-step .aw-step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
}
.aw-step.active { color: var(--brand-secondary, #0e3b45); border-color: var(--brand-secondary, #0e3b45); background: #fff; }
.aw-step.active .aw-step-n { background: var(--brand-secondary, #0e3b45); color: #fff; }
.aw-step.done { color: #0a8c5a; border-color: #aaffd6; background: #ecfdf5; }
.aw-step.done .aw-step-n { background: #0a8c5a; color: #fff; }

.aw-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.aw-section h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--brand-secondary, #0e3b45); }
.aw-help { font-size: 12px; color: #64748b; line-height: 1.5; margin: 0 0 14px; }

.aw-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.aw-radio-card {
  display: block;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.aw-radio-card:hover { background: #f8fafc; }
.aw-radio-card.selected {
  border-color: var(--brand-secondary, #0e3b45);
  background: #f0f9fb;
}
.aw-radio-card input[type="radio"] { display: none; }
.aw-radio-card strong { display: block; font-size: 13.5px; color: var(--brand-secondary, #0e3b45); margin-bottom: 4px; }
.aw-radio-card small { font-size: 11.5px; color: #64748b; line-height: 1.4; }

.aw-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}
.aw-form-grid-1 { grid-template-columns: 1fr; }
.aw-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.aw-form-grid label > span { color: #475569; }
.aw-form-grid select,
.aw-form-grid input[type="text"],
.aw-form-grid input[type="number"],
.aw-form-grid input[type="datetime-local"] {
  padding: 8px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.aw-form-grid select:disabled { opacity: 0.5; }

.aw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 10px;
}
.aw-table th, .aw-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
}
.aw-table th { font-weight: 700; color: var(--brand-secondary, #0e3b45); background: #f8fafc; }
.aw-table input.aw-cost-override { width: 110px; padding: 5px 8px; border: 1px solid #cbd5e0; border-radius: 4px; font-size: 12.5px; }

.aw-summary { display: grid; grid-template-columns: 160px 1fr; gap: 6px 18px; margin: 0 0 12px; }
.aw-summary dt { font-weight: 700; color: #64748b; font-size: 12px; }
.aw-summary dd { margin: 0; font-size: 13px; color: #0f172a; }

.aw-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.aw-foot-spacer { flex: 1; }
.aw-btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid #cbd5e0;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.aw-btn:hover { background: #f1f5f9; }
.aw-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.aw-btn-ghost { color: #64748b; }
.aw-btn-primary {
  background: var(--brand-secondary, #0e3b45);
  color: #fff;
  border-color: var(--brand-secondary, #0e3b45);
  padding-left: 22px;
  padding-right: 22px;
}
.aw-btn-primary:hover { background: #134e5b; }
.aw-btn-primary[disabled] { background: #cbd5e0; border-color: #cbd5e0; color: #fff; }

/* Wizard v3 (2026-05-07): tabella per-row + bulk actions + sub-modal */
.aw-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  background: #f1f5f9;
  border-radius: 8px;
  align-items: center;
}
.aw-bulk-actions select {
  padding: 6px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
}
.aw-table-rows {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
/* PATCH 2026-05-08: ottimizzazione spazi colonne dopo introduzione Tipologia+Listino per riga.
   Step sopralluoghi: Perizia | Coordinate | Tipologia | Tecnico | Listino | Costo | Cons.tec | Cons.cli (+ ckbox).
   Step perizie:     Perizia | Tipologia | Perito redaz. | Listino | Costo | Cons.cli (+ ckbox). */
/* Sopralluoghi col 1: Perizia */
.aw-table-sop th:nth-child(1):not(.aw-row-check-cell), .aw-table-sop td:nth-child(1):not(.aw-row-check-cell) { width: 9%; }
.aw-table-sop th.aw-row-check-cell + th, .aw-table-sop td.aw-row-check-cell + td { width: 9%; }
/* col 2: Coordinate */
.aw-table-sop th:nth-child(2):not(.aw-row-check-cell), .aw-table-sop td:nth-child(2):not(.aw-row-check-cell) { width: 13%; }
.aw-table-sop th.aw-row-check-cell ~ th:nth-child(3), .aw-table-sop td.aw-row-check-cell ~ td:nth-child(3) { width: 13%; }
/* col 3: Tipologia (Drive-by/Full/Desktop, breve) */
.aw-table-sop th:nth-child(3):not(.aw-row-check-cell), .aw-table-sop td:nth-child(3):not(.aw-row-check-cell) { width: 9%; }
.aw-table-sop th.aw-row-check-cell ~ th:nth-child(4), .aw-table-sop td.aw-row-check-cell ~ td:nth-child(4) { width: 9%; }
/* col 4: Tecnico (nome + km + eye) */
.aw-table-sop th:nth-child(4):not(.aw-row-check-cell), .aw-table-sop td:nth-child(4):not(.aw-row-check-cell) { width: 18%; }
.aw-table-sop th.aw-row-check-cell ~ th:nth-child(5), .aw-table-sop td.aw-row-check-cell ~ td:nth-child(5) { width: 18%; }
/* col 5: Listino (nome template) */
.aw-table-sop th:nth-child(5):not(.aw-row-check-cell), .aw-table-sop td:nth-child(5):not(.aw-row-check-cell) { width: 14%; }
.aw-table-sop th.aw-row-check-cell ~ th:nth-child(6), .aw-table-sop td.aw-row-check-cell ~ td:nth-child(6) { width: 14%; }
/* col 6: Costo */
.aw-table-sop th:nth-child(6):not(.aw-row-check-cell), .aw-table-sop td:nth-child(6):not(.aw-row-check-cell) { width: 9%; }
.aw-table-sop th.aw-row-check-cell ~ th:nth-child(7), .aw-table-sop td.aw-row-check-cell ~ td:nth-child(7) { width: 9%; }
/* col 7-8: Consegna tec / Consegna cli */
.aw-table-sop th:nth-child(7):not(.aw-row-check-cell), .aw-table-sop td:nth-child(7):not(.aw-row-check-cell),
.aw-table-sop th:nth-child(8):not(.aw-row-check-cell), .aw-table-sop td:nth-child(8):not(.aw-row-check-cell) { width: 14%; }
.aw-table-sop th.aw-row-check-cell ~ th:nth-child(8), .aw-table-sop td.aw-row-check-cell ~ td:nth-child(8),
.aw-table-sop th.aw-row-check-cell ~ th:nth-child(9), .aw-table-sop td.aw-row-check-cell ~ td:nth-child(9) { width: 14%; }
/* Step perizie */
/* col 1: Perizia */
.aw-table-per th:nth-child(1):not(.aw-row-check-cell), .aw-table-per td:nth-child(1):not(.aw-row-check-cell) { width: 11%; }
.aw-table-per th.aw-row-check-cell + th, .aw-table-per td.aw-row-check-cell + td { width: 11%; }
/* col 2: Tipologia */
.aw-table-per th:nth-child(2):not(.aw-row-check-cell), .aw-table-per td:nth-child(2):not(.aw-row-check-cell) { width: 9%; }
.aw-table-per th.aw-row-check-cell ~ th:nth-child(3), .aw-table-per td.aw-row-check-cell ~ td:nth-child(3) { width: 9%; }
/* col 3: Perito redazione */
.aw-table-per th:nth-child(3):not(.aw-row-check-cell), .aw-table-per td:nth-child(3):not(.aw-row-check-cell) { width: 30%; }
.aw-table-per th.aw-row-check-cell ~ th:nth-child(4), .aw-table-per td.aw-row-check-cell ~ td:nth-child(4) { width: 30%; }
/* col 4: Listino */
.aw-table-per th:nth-child(4):not(.aw-row-check-cell), .aw-table-per td:nth-child(4):not(.aw-row-check-cell) { width: 18%; }
.aw-table-per th.aw-row-check-cell ~ th:nth-child(5), .aw-table-per td.aw-row-check-cell ~ td:nth-child(5) { width: 18%; }
/* col 5: Costo */
.aw-table-per th:nth-child(5):not(.aw-row-check-cell), .aw-table-per td:nth-child(5):not(.aw-row-check-cell) { width: 11%; }
.aw-table-per th.aw-row-check-cell ~ th:nth-child(6), .aw-table-per td.aw-row-check-cell ~ td:nth-child(6) { width: 11%; }
/* col 6: Consegna vs Cliente */
.aw-table-per th:nth-child(6):not(.aw-row-check-cell), .aw-table-per td:nth-child(6):not(.aw-row-check-cell) { width: 21%; }
.aw-table-per th.aw-row-check-cell ~ th:nth-child(7), .aw-table-per td.aw-row-check-cell ~ td:nth-child(7) { width: 21%; }
.aw-table-rows th, .aw-table-rows td {
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-table-rows th {
  font-weight: 700;
  color: var(--brand-secondary, #0e3b45);
  background: #f8fafc;
  white-space: nowrap;
}
.aw-table-rows select,
.aw-table-rows input[type="number"],
.aw-table-rows input[type="datetime-local"] {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 11.5px;
  box-sizing: border-box;
}
.aw-table-rows select { min-width: 0; }
.aw-table-rows input[type="datetime-local"] { font-size: 11px; }

/* Cella costo: valore + bottone modifica (richiesta dev: no input diretto) */
.aw-cost-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.aw-cost-value {
  font-weight: 600;
  color: var(--brand-secondary, #0e3b45);
}
.aw-cost-edit-btn {
  background: transparent;
  border: 1px solid #cbd5e0;
  color: #64748b;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Wizard v3.1 (2026-05-07 sera): bottoni bulk attivi + modalità manuale + eye row + textarea nota */
.aw-bulk-actions .aw-btn-active {
  background: #e0f2fe !important;
  border-color: #0e3b45 !important;
  color: #0e3b45 !important;
  font-weight: 700;
}
.aw-bulk-actions .aw-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cella checkbox sx (modalità manuale, multi-perizia) */
.aw-table-rows th.aw-row-check-cell,
.aw-table-rows td.aw-row-check-cell {
  width: 28px;
  text-align: center;
}
.aw-row-check {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--brand-secondary, #0e3b45);
}
.aw-table-rows tr.aw-row-selected {
  background: #ecfdf5;
}
.aw-table-rows tr.aw-row-selected td {
  border-bottom-color: #a7f3d0;
}

/* Cella perito: dropdown + eye button */
.aw-row-perito-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.aw-row-perito-cell select { flex: 1; min-width: 0; }
.aw-row-eye {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid #cbd5e0;
  color: #475569;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.aw-row-eye:hover {
  background: #f0fdfa;
  border-color: #0e3b45;
  color: #0e3b45;
}

/* Modal modifica costo: textarea nota */
#aw-cost-editor textarea#aw-cost-note {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12.5px;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}
#aw-cost-editor textarea#aw-cost-note:focus {
  outline: none;
  border-color: var(--brand-secondary, #0e3b45);
  box-shadow: 0 0 0 2px rgba(14, 59, 69, 0.12);
}
.aw-cost-edit-btn:hover { background: #ecfdf5; color: #0a8c5a; border-color: #0a8c5a; }
.aw-btn-mini {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--brand-secondary, #0e3b45);
  background: #fff;
  color: var(--brand-secondary, #0e3b45);
  border-radius: 4px;
  cursor: pointer;
}
.aw-btn-mini:hover { background: var(--brand-secondary, #0e3b45); color: #fff; }
.aw-btn-top5 {
  background: #ecfdf5;
  border-color: #0a8c5a;
  color: #0a8c5a;
}
.aw-btn-top5:hover { background: #0a8c5a; color: #fff; }

/* Sub-modal (Top-5, Manual picker) */
.aw-sub-modal {
  position: fixed;
  inset: 0;
  z-index: 9700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.aw-sub-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}
.aw-sub-dialog {
  position: relative;
  z-index: 1;
  width: 520px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.aw-sub-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--brand-secondary, #0e3b45);
  color: #fff;
}
.aw-sub-dialog header strong { font-size: 14px; font-weight: 700; }
.aw-sub-dialog header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.aw-sub-body { padding: 16px; max-height: 60vh; overflow-y: auto; }
.aw-sub-body select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
}
.aw-top5-map {
  width: 100%;
  height: 360px;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 12px;
  background: #f1f5f9;
}

/* Manual picker — lista ordinata per distanza */
.aw-manual-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
}
.aw-manual-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.aw-manual-item:hover { background: #f8fafc; }
.aw-manual-item.top {
  border-color: #890103;
  background: #fff5f5;
}
.aw-manual-item.selected {
  border-color: #0a8c5a;
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(10, 140, 90, 0.18);
}
.aw-manual-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.aw-manual-item.top .aw-manual-rank { background: #890103; color: #fff; }
.aw-manual-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-secondary, #0e3b45);
}
.aw-manual-meta {
  font-size: 11.5px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.aw-sub-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
