/* ════════════════════════════════════════════════════
   ServicePro PWA — Professionista
   ════════════════════════════════════════════════════ */

:root {
  --primary:      #e30613;
  --primary-dark: #b3050f;
  --accent:       #e30613;
  --bg:           #f7f8fa;
  --surface:      #ffffff;
  --text:         #1d1b1b;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --nav-h:        64px;
  --radius:       12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Ubuntu', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
}

/* ── Splash ──────────────────────────────────────── */
.splash {
  position: fixed; inset: 0;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity .4s;
}
.splash-logo  { text-align: center; color: #ffffff; }
.splash-icon  { font-size: 64px; margin-bottom: 12px; }
.splash-logo h1 { font-size: 32px; font-weight: 700; }
.splash-logo p  { opacity: .75; margin-top: 8px; }

/* ── Pagine ──────────────────────────────────────── */
.page {
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--nav-h) + 24px);
  min-height: 100vh;
}
.page.active { display: block; }

/* Auth: sempre fissa e centrata sopra tutto */
#page-auth {
  display: none;
  position: fixed; inset: 0;
  z-index: 150;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  align-items: center; justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
#page-auth.active { display: flex; }

/* ── Auth card ────────────────────────────────────── */
.auth-container {
  background: #ffffff; border-radius: 20px;
  padding: 32px 28px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.auth-logo  { text-align: center; font-size: 52px; margin-bottom: 8px; }
.auth-container h1 { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 20px; }
.auth-tabs  { display: flex; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.auth-tab   { flex: 1; padding: 10px; background: none; border: none; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-muted); transition: all .15s; }
.auth-tab.active { background: var(--primary); color: #ffffff; }
.auth-form  { display: flex; flex-direction: column; gap: 10px; }
.auth-note  { font-size: 12px; color: var(--text-muted); text-align: center; }
.auth-error { background: #fde8ea; color: #b3050f; border-radius: 8px; padding: 10px 14px; font-size: 13px; }

/* ── Barra GPS ───────────────────────────────────── */
#gps-status-bar {
  background: #1d1b1b; color: #94a3b8;
  font-size: 12px; padding: 8px 16px;
  display: none; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 50; flex-shrink: 0;
}
#gps-status-bar.active { display: flex; }

/* ── Bottom Nav (mobile) ─────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; background: none; border: none; cursor: pointer;
  font-size: 10px; color: var(--text-muted); transition: color .15s;
  padding: 6px 4px;
}
.nav-item > span:first-child { font-size: 22px; }
.nav-item.active { color: var(--primary); font-weight: 700; }

/* Sidebar header/footer — nascosti su mobile */
.sidebar-header, .sidebar-footer { display: none; }

/* ── Componenti UI ────────────────────────────────── */
.spp-input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 15px; background: var(--surface);
  transition: border-color .15s; outline: none;
}
.spp-input:focus { border-color: var(--primary); }
.spp-btn {
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s;
}
.spp-btn-primary { background: var(--primary); color: #ffffff; }
.spp-btn-primary:hover { background: var(--primary-dark); }
.spp-btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.spp-btn-ghost { background: none; color: var(--text-muted); }
.spp-btn-full { width: 100%; }
.spp-btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.spp-green { background: #f0fdf4; color: #16a34a; }

/* ── Page header ─────────────────────────────────── */
.page-header {
  padding: 12px 0 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.page-header h2 { font-size: 22px; font-weight: 700; }

/* ── Toggle switch ───────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: #cbd5e1;
  border-radius: 24px; cursor: pointer; transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #ffffff; border-radius: 50%; transition: .2s;
}
input:checked + .toggle-slider { background: var(--primary); }
input:checked + .toggle-slider::before { transform: translateX(20px); }
.online-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ── Cards incarichi ─────────────────────────────── */
.job-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  cursor: pointer; transition: border-color .15s;
}
.job-card:hover { border-color: var(--primary); }
.job-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.job-category { font-weight: 700; font-size: 16px; }
.job-distance { font-size: 13px; color: var(--text-muted); }
.job-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.job-address { font-size: 14px; margin-bottom: 12px; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.job-status-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 10px; font-size: 12px; font-weight: 700;
  background: #e2e8f0; color: #2f2c2d;
}
.status-on-the-way  { background: #fde8ea; color: #b3050f; }
.status-arrived     { background: #f0fdf4; color: #16a34a; }
.status-in-progress { background: #f1f5f9; color: #2f2c2d; }
.status-done        { background: #f1f5f9; color: #475569; }

/* ── Incarico attivo ─────────────────────────────── */
.active-job {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff; border-radius: 16px; padding: 20px; margin-bottom: 20px;
}
.active-job-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.active-job-meta { font-size: 13px; opacity: .8; margin-bottom: 4px; }
.active-job-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.job-status-steps { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ── Mappa ───────────────────────────────────────── */
#pro-map { height: 55vh; border-radius: 16px; background: #e2e8f0; }
.nav-info-card { background: var(--surface); border-radius: 16px; padding: 16px; margin-top: 16px; }

/* ── Statistiche ─────────────────────────────────── */
.earnings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.earnings-card.primary {
  background: #1d1b1b;
  color: #ffffff; border: none; grid-column: 1 / -1;
}
.earnings-value { display: block; font-size: 28px; font-weight: 800; }
.earnings-label { display: block; font-size: 12px; opacity: .75; margin-top: 4px; }

/* ── Disponibilità ───────────────────────────────── */
.avail-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.avail-day-toggle { display: flex; align-items: center; gap: 8px; padding: 8px; }
.avail-slot {
  padding: 4px 8px; border: 1.5px solid var(--border);
  border-radius: 6px; font-size: 12px; cursor: pointer; background: none; transition: all .15s;
}
.avail-slot.active { background: var(--primary); color: #ffffff; border-color: var(--primary); }
.avail-slot:disabled { opacity: .4; cursor: not-allowed; }
.avail-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ── Chat ────────────────────────────────────────── */
.spp-chat-page {
  display: none;
  padding: 0 !important;
  min-height: unset !important;
}

/* ── Barra di composizione chat (pro) ───────────────────────────── */
.pro-chat-input-area {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface, #ffffff);
  border-top: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  box-sizing: border-box;
}
.pro-chat-input-area textarea {
  flex: 1 1 auto;
  min-width: 0;          /* CRITICO: permette al textarea di restringersi sotto contenuto */
  padding: 10px 16px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 22px;
  resize: none;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color .15s;
  background: #ffffff;
  color: var(--text, #1d1b1b);
}
.pro-chat-input-area textarea:focus {
  border-color: var(--primary, #e30613);
}
.pro-chat-send-btn {
  flex: 0 0 44px;        /* dimensione fissa, non si restringe */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary, #e30613);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .15s, opacity .15s;
}
.pro-chat-send-btn:active { transform: scale(.92); }
.pro-chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }
.pro-chat-send-btn svg { display: block; }
.spp-chat-page.active {
  display: flex !important;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
/* Mobile: chat a schermo intero */
@media (max-width: 899px) {
  .spp-chat-page.active {
    position: fixed !important;
    inset: 0 !important;
    z-index: 90;
  }
}

/* ── Sezione titoli ──────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted); margin: 20px 0 10px;
}

/* ── Empty state ─────────────────────────────────── */
.empty-state { text-align: center; padding: 32px; color: var(--text-muted); }
.skeleton-loader {
  height: 80px; background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
  animation: spp-fade-in .2s ease;
}
.modal-sheet,
.modal-card {
  background: var(--surface, #ffffff);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  position: relative;
  z-index: 1;
  animation: spp-slide-up .25s ease;
}
.modal-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #1d1b1b);
}
.modal-card p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text, #475569);
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.modal-actions .spp-btn { flex: 1; min-width: 100px; }
@keyframes spp-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spp-slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Form ────────────────────────────────────────── */
.profile-form { display: flex; flex-direction: column; gap: 0; }
.spp-field    { margin-bottom: 14px; }
.form-label   { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.spp-textarea { min-height: 90px; resize: vertical; }

/* ── Toast ───────────────────────────────────────── */
#pro-toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%;
  transform: translateX(-50%);
  background: #1d1b1b; color: #ffffff;
  padding: 12px 20px; border-radius: 10px; font-size: 14px;
  z-index: 300; opacity: 0; transition: opacity .3s;
  white-space: nowrap; max-width: 90vw; pointer-events: none;
}
#pro-toast.show { opacity: 1; }

/* ── Crediti ─────────────────────────────────────── */
#subscription-box { margin: 16px; padding: 16px; border-left: 4px solid var(--primary); background: var(--surface); border-radius: var(--radius); }

/* ── Sidebar (desktop only) ──────────────────────── */
#sidebar-username { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════════════════════
   DESKTOP LAYOUT (min-width: 900px)
   Sidebar fissa + contenuto scrollabile a destra
   ════════════════════════════════════════════════════ */
@media (min-width: 900px) {

  body { background: #e2e8f0; }

  .desktop-hidden { display: none !important; }

  /* Sidebar header e footer visibili */
  .sidebar-header {
    display: flex !important;
    align-items: center; gap: 12px;
    padding: 20px 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .sidebar-footer {
    display: block !important;
    border-top: 1px solid var(--border);
    padding-top: 4px; margin-top: auto;
  }

  /* Shell: flex row */
  #app-shell {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 0 60px rgba(0,0,0,.12);
    background: var(--surface);
  }

  /* Sidebar */
  .bottom-nav {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    width: 220px !important;
    flex-shrink: 0 !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    border-top: none !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    overflow-y: auto;
    background: var(--surface) !important;
  }

  .nav-item {
    flex-direction: row !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    padding: 13px 20px !important;
    border-radius: 0 !important;
    font-size: 14px !important;
    border-left: 3px solid transparent;
    font-weight: 500;
  }
  .nav-item.active {
    color: var(--primary) !important;
    border-left-color: var(--primary) !important;
    background: rgba(227, 6, 19, .06) !important;
  }
  .nav-item > span:first-child { font-size: 20px !important; }
  .nav-item > span:last-child  { display: block !important; }

  /* Colonna destra */
  #right-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  #main-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
  }

  .page {
    min-height: unset !important;
    padding: 28px 32px 32px !important;
  }

  /* Chat su desktop */
  .spp-chat-page.active { height: 100% !important; }

  /* Griglia incarichi 2 colonne */
  #jobs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 899px) {
  .sidebar-header, .sidebar-footer { display: none !important; }
  .mobile-hidden { display: none !important; }
  .profile-quick-links { display: block !important; }
}

/* ── Fix mobile nav testo ────────────────────────── */
.nav-item > span:last-child { display: block; font-size: 10px; }

/* ── App shell base (mobile) ─────────────────────── */
#app-shell { display: block; }
#right-column { display: block; }

/* ── Desktop: sovrascrive ────────────────────────── */
@media (min-width: 900px) {
  #app-shell {
    display: flex !important;
    flex-direction: row;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 0 60px rgba(0,0,0,.12);
    overflow: hidden;
  }

  #right-column {
    flex: 1;
    min-width: 0;
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  #main-content {
    flex: 1;
    overflow-y: auto;
  }

  .bottom-nav {
    height: 100vh !important;
    width: 200px !important;
    flex-shrink: 0 !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    position: relative !important;
    bottom: auto !important;
    border-top: none !important;
    border-right: 1px solid var(--border) !important;
    padding: 0 !important;
    box-shadow: none !important;
    overflow-y: auto;
  }

  .nav-item {
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding: 12px 16px !important;
    gap: 10px !important;
    border-radius: 0 !important;
    font-size: 13px !important;
    border-left: 3px solid transparent;
    height: auto !important;
    flex: none !important;
  }
  .nav-item > span:first-child { font-size: 18px !important; }
  .nav-item > span:last-child  { font-size: 13px !important; }
  .nav-item.active {
    color: var(--primary) !important;
    border-left-color: var(--primary) !important;
    background: rgba(227, 6, 19, .07) !important;
  }

  .sidebar-header {
    display: flex !important;
    align-items: center; gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-footer {
    display: block !important;
    margin-top: auto;
    border-top: 1px solid var(--border);
  }

  .page {
    padding: 24px 28px 24px !important;
    min-height: unset !important;
  }

  .spp-chat-page.active {
    height: 100% !important;
  }
}

/* ── Categorie chip ──────────────────────────────── */
.cat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1.5px solid var(--border);
  border-radius: 20px; font-size: 13px; cursor: pointer;
  background: var(--surface); transition: all .15s; user-select: none;
}
.cat-chip.selected {
  background: var(--bg); border-color: var(--primary);
  color: var(--primary); font-weight: 600;
}
.cat-chip input { display: none; }

/* ── Price range ─────────────────────────────────── */
.price-range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }

/* ── Desktop: contenuto centrato nel main-content ─────── */
@media (min-width: 900px) {
  /* Grid 3 colonne: spazio | contenuto max 720px | spazio */
  #main-content {
    display: grid !important;
    grid-template-columns: 1fr minmax(0, 720px) 1fr !important;
    align-content: start;
    padding: 0 !important;
  }
  /* Tutte le pagine (incluso chat) vanno nella colonna centrale */
  #main-content > .page {
    grid-column: 2 !important;
    padding: 28px 32px !important;
    box-sizing: border-box;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
  }
  /* Chat: stessa colonna ma senza padding (ha il suo layout interno) */
  #main-content > .spp-chat-page {
    grid-column: 2 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }
  #main-content > .spp-chat-page.active {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }
  /* Auth sempre a tutto schermo (è position: fixed comunque) */
  #main-content > #page-auth {
    grid-column: 1 / -1 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   ▼▼▼ DESIGN V2 — BENTO VERDE (Incarichi, GPS, Statistiche, Profilo, Chat)
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  --pb-bg:        #f7f8fa;
  --pb-card:      #ffffff;
  --pb-text:      #1d1b1b;
  --pb-muted:     #64748b;
  --pb-radius:    22px;
  --pb-radius-sm: 14px;
  --pb-shadow:    0 2px 6px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.04);
  --pb-shadow-hi: 0 4px 12px rgba(15, 23, 42, 0.08), 0 14px 32px rgba(15, 23, 42, 0.08);

  --pb-green:     #e30613;
  --pb-green-dk:  #e30613;
  --pb-green-bg:  #fde8ea;
  --pb-red:       #b3050f;
  --pb-red-bg:    #fde8ea;
  --pb-amber:     #b45309;
  --pb-amber-bg:  #fef3c7;
  --pb-blue:      #2f2c2d;
  --pb-blue-bg:   #f1f5f9;
}

html, body { background: var(--pb-bg); color: var(--pb-text); }

/* ── PAGE base ──────────────────────────────────────────────────────────── */
#main-content { background: var(--pb-bg); }
.page { padding: 18px 16px calc(var(--nav-h) + 22px) !important; background: var(--pb-bg); }

/* L'intestazione della pagina Incarichi è ora .lav-barra + .lav-titolo:
   vedi il blocco del tema in fondo al file. */

/* GPS active indicator (sopra l'header) */
#gps-active-indicator,
.gps-active-indicator {
  background: var(--pb-green-dk);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(227, 6, 19, 0.25);
}

/* ── TOGGLE Disponibile (online) ────────────────────────────────────────── */
.online-toggle {
  display: flex !important;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--pb-text);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #e2e8f0;
  border-radius: 999px;
  transition: .3s;
}
.toggle-slider::before {
  position: absolute;
  content: '';
  height: 22px; width: 22px;
  left: 3px; bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--pb-green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ── ACTIVE JOB: Hero card verde gradient ──────────────────────────────── */
.active-job {
  background: linear-gradient(135deg, var(--pb-green) 0%, var(--pb-green-dk) 100%) !important;
  border-radius: var(--pb-radius) !important;
  padding: 22px !important;
  color: #ffffff !important;
  position: relative;
  overflow: hidden;
  margin-bottom: 22px !important;
  box-shadow: 0 10px 30px rgba(227, 6, 19, 0.25);
}
/* Decorazione mappa stilizzata in alto-destra */
.active-job::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 220px; height: 100%;
  background-image:
    radial-gradient(circle at 60% 30%, rgba(255, 255, 255, 0.08) 0, transparent 50px),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.06) 0, transparent 60px),
    linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
  background-size: cover;
  pointer-events: none;
}
.active-job > * { position: relative; z-index: 1; }

.active-job .job-status-badge,
#active-job-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: var(--pb-green-dk);
  font-size: 12.5px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: .2px;
}

.active-job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.active-job-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  margin-bottom: 6px;
  opacity: .9;
}
#active-job-address {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.4;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ── STATUS STEPS: pillole orizzontali wrappable ───────────────────────── */
.job-status-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.job-status-steps .step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
}
.job-status-steps .step.done {
  background: #ffffff;
  color: var(--pb-green-dk);
}
.job-status-steps .step.active {
  background: #ffffff;
  color: var(--pb-green-dk);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.job-status-steps .step-dot { display: none; }
.job-status-steps .step.done::before {
  content: ''; width: 8px; height: 8px;
  border-radius: 50%; background: currentColor;
}
.job-status-steps .step.active::before {
  content: ''; width: 8px; height: 8px;
  border-radius: 50%; background: var(--pb-green-dk);
  animation: pb-pulse 1.4s infinite;
}
@keyframes pb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(1.3); }
}

/* ── ACTIVE JOB next-action button ────────────────────────────────────── */
.active-job-actions { margin-top: 14px; }
.active-job-actions > .spp-btn,
.active-job-actions > button {
  background: #ffffff !important;
  color: var(--pb-green-dk) !important;
  font-weight: 800 !important;
  font-size: 16px !important;
  padding: 16px !important;
  border-radius: var(--pb-radius-sm) !important;
  border: none !important;
  width: 100% !important;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  transition: transform .15s;
}
.active-job-actions .spp-btn:active { transform: scale(.98); }

/* ── SECTION TITLE ─────────────────────────────────────────────────────── */
.section-title {
  font-size: 12px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .5px !important;
  color: var(--pb-muted) !important;
  margin: 22px 4px 14px !important;
}

/* ── PENDING JOB CARD (bento) ──────────────────────────────────────────── */
#pending-jobs-list .job-card,
#history-jobs-list .job-card,
.job-card {
  background: var(--pb-card);
  border-radius: var(--pb-radius);
  padding: 16px !important;
  margin-bottom: 12px;
  box-shadow: var(--pb-shadow);
  position: relative;
  border: none !important;
  display: block;
  transition: box-shadow .15s, transform .15s;
}
.job-card:active { transform: scale(.99); }
@media (hover:hover) { .job-card:hover { box-shadow: var(--pb-shadow-hi); } }

.job-card.history { opacity: .92; }

/* Card layout: icona categoria + corpo + amount */
.job-card-inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.job-card-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.job-card-body { flex: 1; min-width: 0; }
.job-category {
  display: block;
  font-size: 17px !important;
  font-weight: 800;
  color: var(--pb-text);
  text-transform: capitalize;
  margin-bottom: 6px;
  letter-spacing: -.2px;
}
.job-address,
.job-card .job-address {
  font-size: 13.5px;
  color: var(--pb-muted);
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.45;
}
.job-meta { font-size: 12px; color: var(--pb-muted); margin: 4px 0 0; }

.job-amount {
  display: inline-block;
  background: var(--pb-green-bg);
  color: var(--pb-green-dk);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  margin: 0 !important;
  flex-shrink: 0;
  white-space: nowrap;
}

.job-distance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: var(--pb-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 0 12px !important;
}

/* ── ACTION BUTTONS in pending jobs ─────────────────────────────────────── */
.job-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 6px !important;
}
.job-card-actions .spp-btn {
  font-size: 14px !important;
  padding: 11px 8px !important;
  border-radius: 12px !important;
  font-weight: 700 !important;
  border: none !important;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, opacity .12s;
}
.job-card-actions .spp-btn:active { transform: scale(.95); }
.job-card-actions .spp-btn-primary {
  background: var(--pb-green) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(227, 6, 19, 0.3);
}
.job-card-actions .spp-btn-ghost {
  background: var(--pb-red-bg) !important;
  color: var(--pb-red) !important;
  border: 1px solid #f8bcc2 !important;
}
.job-card-actions .spp-btn-secondary {
  background: var(--pb-card) !important;
  color: var(--pb-text) !important;
  border: 1px solid #e2e8f0 !important;
}

/* ── HISTORY JOB CARD ─────────────────────────────────────────────────── */
#history-jobs-list .job-card { padding: 14px !important; }
#history-jobs-list .job-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
#history-jobs-list .job-card-header > span:first-child {
  font-size: 14.5px;
  font-weight: 700;
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 8px;
}
#history-jobs-list .job-amount {
  font-size: 13.5px;
  background: #f1f5f9;
  color: var(--pb-text);
}

/* History action buttons (archivia / elimina / ripristina) */
.history-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.history-actions button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--pb-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background .12s, color .12s;
}
.history-actions button:hover { background: #f7f8fa; }
.history-actions button.danger:hover {
  background: var(--pb-red-bg);
  color: var(--pb-red);
}
.history-actions button.archive:hover {
  background: var(--pb-amber-bg);
  color: var(--pb-amber);
}

/* ── EMPTY STATE ──────────────────────────────────────────────────────── */
.empty-jobs,
#pending-jobs-list .empty-jobs,
#history-jobs-list .empty-jobs {
  background: var(--pb-card);
  border-radius: var(--pb-radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--pb-muted);
  font-size: 14px;
  box-shadow: var(--pb-shadow);
}

/* Skeleton loader */
.skeleton-loader {
  height: 130px;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  border-radius: var(--pb-radius);
  animation: pb-skeleton 1.4s infinite;
}
@keyframes pb-skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── BOTTOM NAV verde primary ─────────────────────────────────────────── */
@media (max-width: 899px) {
  .bottom-nav {
    background: var(--pb-card) !important;
    border-top: none !important;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08) !important;
    border-top-left-radius: 22px !important;
    border-top-right-radius: 22px !important;
    height: var(--nav-h) !important;
    padding: 8px 6px !important;
  }
  .bottom-nav .nav-item {
    flex-direction: column;
    gap: 3px !important;
    color: var(--pb-muted) !important;
    border-radius: 14px !important;
    margin: 0 2px !important;
    padding: 6px 4px !important;
    font-size: 22px !important;
  }
  .bottom-nav .nav-item span {
    font-size: 10px !important;
    font-weight: 600;
  }
  .bottom-nav .nav-item.active {
    color: var(--pb-green-dk) !important;
    background: var(--pb-green-bg);
  }
  .bottom-nav .nav-item.active span { font-weight: 700; }
}

/* ── HISTORY archived/deleted indicator ────────────────────────────────── */
.job-card.archived { opacity: .65; }
.job-card.archived::after {
  content: 'Archiviato';
  position: absolute;
  top: 12px; right: 12px;
  background: var(--pb-amber-bg);
  color: var(--pb-amber);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

/* ── Status chip in storico ───────────────────────────────────────────── */
.history-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.history-status-chip.done {
  background: var(--pb-green-bg);
  color: var(--pb-green-dk);
}
.history-status-chip.cancelled {
  background: var(--pb-red-bg);
  color: var(--pb-red);
}
.history-status-chip.in_progress {
  background: var(--pb-blue-bg);
  color: var(--pb-blue);
}

/* Tabs filtro storico (Attivi / Archiviati) */
.pb-tabs {
  display: flex;
  gap: 8px;
  margin: 8px 4px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pb-tab {
  flex-shrink: 0;
  background: var(--pb-card);
  color: var(--pb-muted);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--pb-shadow);
  transition: all .15s;
}
.pb-tab.active {
  background: #1d1b1b;
  color: #ffffff;
  box-shadow: none;
}

/* ── Timer countdown su pending card ─────────────────────────────────── */
.job-card.pending { position: relative; }
.job-timer {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--pb-amber-bg);
  color: var(--pb-amber);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(227, 6, 19, 0.15);
  letter-spacing: .3px;
  z-index: 2;
  font-variant-numeric: tabular-nums;
}
.job-timer.urgent {
  background: var(--pb-red-bg);
  color: var(--pb-red);
  animation: pb-pulse-urgent 1s infinite;
}
.job-timer.expired {
  background: #e2e8f0;
  color: #64748b;
  animation: none !important;
}
@keyframes pb-pulse-urgent {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* Riga chip (distanza + costo) sotto la card */
.job-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.job-chips-row .job-distance,
.job-chips-row .job-credit-cost {
  margin: 0 !important;
}

/* Chip costo crediti */
.job-credit-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  color: var(--pb-green-dk);
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #f1f5f9;
}

/* Spazio extra in alto sulla card per evitare collisioni col timer */
.job-card.pending {
  padding-top: 44px !important;
}

/* ── Pulsante "Altre opzioni" sull'active card ────────────────────────── */
.active-job-cancel-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.18) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: var(--pb-radius-sm) !important;
  padding: 10px !important;
  font-size: 13px !important;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  backdrop-filter: blur(6px);
}
.active-job-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.28) !important;
}

/* ── Note cliente sulla card pending ─────────────────────────────────── */
.job-client-notes {
  background: #f7f8fa;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 11px 14px;
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--pb-text);
}
.job-client-notes strong {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--pb-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.job-client-budget {
  display: inline-block;
  background: var(--pb-blue-bg);
  color: var(--pb-blue);
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 0 10px;
}

/* ── Info cliente sulla active job card ──────────────────────────────── */
.active-job-client {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
  color: #ffffff;
}
.active-job-client-name {
  font-size: 15px;
  margin-bottom: 10px;
  font-weight: 600;
}
.active-job-client-name strong { font-weight: 800; }
.active-job-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.active-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--pb-green-dk) !important;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none !important;
  transition: transform .12s;
}
.active-pill:hover { transform: translateY(-1px); }
.active-pill.wa    { background: #16a34a; color: #ffffff !important; }
.active-pill.email { background: rgba(255, 255, 255, 0.85); }

.active-job-notes {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--pb-text);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 8px 0 6px;
}
.active-job-notes strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--pb-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.active-job-budget {
  background: rgba(255, 255, 255, 0.18);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  display: inline-block;
  margin-top: 6px;
  color: #ffffff;
}
.active-job-budget strong { font-weight: 800; }

/* ── Bottone navigazione su pending card ──────────────────────────────── */
.job-nav-btn {
  width: 100%;
  background: var(--pb-blue-bg) !important;
  color: var(--pb-blue) !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  padding: 11px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  cursor: pointer;
  margin-bottom: 10px;
  transition: all .15s;
}
.job-nav-btn:hover {
  background: #e2e8f0 !important;
  transform: translateY(-1px);
}
.job-nav-btn:active { transform: scale(.98); }

/* ── Bottone navigazione sull'active card (sfondo verde) ────────────── */
.active-job-nav-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.96) !important;
  color: var(--pb-blue) !important;
  border: none !important;
  border-radius: var(--pb-radius-sm) !important;
  padding: 13px !important;
  font-size: 15px !important;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform .15s;
}
.active-job-nav-btn:hover { transform: translateY(-1px); }
.active-job-nav-btn:active { transform: scale(.98); }

/* ── Password input con icona occhio ──────────────────────────────────── */
.spp-pwd-wrap {
  position: relative;
  margin-bottom: 12px;
}
.spp-pwd-wrap .spp-input {
  margin-bottom: 0 !important;
  padding-right: 48px !important;
}
.spp-pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  padding: 0;
}
.spp-pwd-toggle:hover { background: rgba(0,0,0,.05); }
.spp-pwd-toggle:active { transform: translateY(-50%) scale(.9); }

/* ── Disponibilità Diurno/Notturno chip ─────────────────────────────── */
.avail-shift {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.avail-shift:not(:disabled):hover {
  border-color: var(--pb-green) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(227, 6, 19, 0.15);
}
.avail-shift:not(:disabled):active {
  transform: scale(.97);
}

/* ── Banner CONFERMA post-accept con countdown ─────────────────────── */
.confirm-banner {
  background: linear-gradient(135deg, #ffffff, #fde8ea);
  border: 2px solid #e30613;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.18);
  animation: confirmPulse 2s ease-in-out infinite;
}
@keyframes confirmPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(234, 88, 12, 0.18); }
  50%      { box-shadow: 0 4px 22px rgba(234, 88, 12, 0.4); }
}
.confirm-banner-icon {
  font-size: 34px;
  text-align: center;
  line-height: 1;
}
.confirm-banner-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}
.confirm-banner-text strong {
  font-size: 16px;
  color: #1d1b1b;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.confirm-countdown {
  display: inline-block;
  background: #e30613;
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 10px;
  font-family: 'SF Mono', 'Roboto Mono', Menlo, monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1.5px;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.35);
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  min-width: 76px;
  text-align: center;
}
.confirm-banner-text span {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  font-weight: 500;
}
.confirm-banner-btn {
  background: #e30613;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 4px 12px rgba(227, 6, 19, 0.35);
  flex: 1;
}
.confirm-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(227, 6, 19, 0.45);
}
.confirm-banner-btn:active { transform: scale(.98); }

/* ── Card OPERAIO ASSEGNATO ──────────────────────────────────────── */
.worker-assigned-card {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  border: 1.5px solid #94a3b8;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
}
.worker-assigned-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: #2f2c2d;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  flex-shrink: 0;
}
.worker-assigned-info {
  flex: 1 1 140px;
  min-width: 0;
  overflow: hidden;
}
.worker-assigned-label {
  font-size: 11px;
  font-weight: 700;
  color: #2f2c2d;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.worker-assigned-name {
  font-size: 15px;
  font-weight: 800;
  color: #1d1b1b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.worker-assigned-status {
  font-size: 12px;
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.worker-assigned-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.worker-action-btn {
  background: #ffffff;
  border: 1.5px solid #94a3b8;
  color: #2f2c2d;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 1px 3px rgba(29,78,216,.15);
}
.worker-action-btn:hover { background: #2f2c2d; color: #ffffff; box-shadow: 0 4px 12px rgba(29,78,216,.3); }
.worker-action-btn:active { transform: scale(.94); }
.worker-action-btn svg { display: block; width: 16px; height: 16px; }
.worker-reassign-btn:hover svg { animation: sppSpin .5s ease; }
.worker-map-btn { background: #2f2c2d; color: #ffffff; border-color: #2f2c2d; }
.worker-map-btn:hover { background: #2f2c2d; transform: scale(1.05); }
@keyframes sppSpin { from { transform: rotate(0) } to { transform: rotate(180deg) } }

/* Mobile: card più compatta, le azioni possono andare a capo se serve */
@media (max-width: 400px) {
  .worker-assigned-card {
    padding: 12px;
    gap: 10px;
  }
  .worker-assigned-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 17px;
  }
  .worker-action-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }
  .worker-action-btn svg { width: 15px; height: 15px; }
  .worker-assigned-name { font-size: 14px; }
  .worker-assigned-actions { gap: 5px; }
}

.worker-info-note {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  background: #f7f8fa;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  text-align: center;
  line-height: 1.4;
}

/* Bottone "Assegna a un operaio" sulla active card (accento blu) */
.active-job-actions > .active-job-assign-btn {
  color: #2f2c2d !important;
  margin-top: 2px;
}

/* Card operaio in attesa di conferma (richiesta inviata, non ancora accettata) */
.worker-assigned-card.worker-pending {
  background: linear-gradient(135deg, #ffffff, #fde8ea);
  border-color: #e30613;
}
.worker-assigned-card.worker-pending .worker-assigned-icon { background: #b3050f; }
.worker-assigned-card.worker-pending .worker-assigned-label { color: #b3050f; }
.worker-assigned-card.worker-pending .worker-action-btn { border-color: #e30613; color: #b3050f; }
.worker-assigned-card.worker-pending .worker-action-btn:hover { background: #b3050f; color: #ffffff; }

/* Modal animations (centered modals) */
@keyframes sppFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes sppScaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Allineamento al tema — Serrature Online Palermo

   Questo blocco sta in fondo perché deve vincere sulle regole sopra, molte
   delle quali hanno !important.

   La differenza sostanziale rispetto a prima: la scheda dell'incarico attivo
   era un blocco pieno a tinta unita. Nel tema è una card bianca su fondo
   chiaro, e il rosso compare solo sull'azione da fare adesso. Un pannello
   tutto rosso non distingue più niente: se è rosso tutto, non è rosso niente.
   ═══════════════════════════════════════════════════════════════════════════ */

body { background: #f7f8fa; }

/* ── Scheda dell'incarico attivo ─────────────────────────────────────────── */

.active-job {
  background: #ffffff !important;
  color: #1d1b1b !important;
  border: 1px solid #e2e8f0;
  border-radius: 18px !important;
  padding: 18px !important;
  box-shadow: 0 1px 2px rgba(29,27,27,.06), 0 8px 24px rgba(29,27,27,.05) !important;
}
/* La decorazione a bolle serviva a spezzare il campo pieno: su bianco è rumore. */
.active-job::after { display: none !important; }

.active-job-header { color: #1d1b1b; margin-bottom: 12px !important; }

.active-job-meta,
.active-job .job-meta { color: #64748b !important; opacity: 1 !important; font-size: 13px; }

#active-job-address {
  color: #1d1b1b !important;
  font-size: 19px !important; font-weight: 700 !important;
  line-height: 1.25 !important;
}

/* Lo stato è un'etichetta, non un blocco: piccola e in tinta tenue. */
.active-job .job-status-badge,
#active-job-status {
  background: #fde8ea !important;
  color: #e30613 !important;
  border: 0 !important;
  font-size: 12px !important; font-weight: 600 !important;
  padding: 4px 10px !important; border-radius: 999px !important;
}

/* Riquadri interni: grigio chiaro, come i box "Servizio" e "Appuntamento". */
.active-job-client,
.active-job-notes,
.active-job-budget {
  background: #f1f5f9 !important;
  color: #1d1b1b !important;
  border: 0 !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
}
.active-job-client-name,
.active-job-notes strong,
.active-job-budget strong { color: #1d1b1b !important; }
.active-job-notes { font-size: 13.5px; }

.active-job-contacts a,
.active-job-contacts button {
  background: #1d1b1b !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 999px !important;
  height: 40px; padding: 0 14px;
  font-weight: 600 !important;
}

/* ── Azioni ──────────────────────────────────────────────────────────────
   La prima è quella che il professionista deve premere adesso, ed è l'unica
   rossa. Le altre sono alternative, quindi bianche col bordo. */

.active-job-actions > .spp-btn,
.active-job-actions > button,
.active-job-nav-btn {
  background: #ffffff !important;
  color: #1d1b1b !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

.active-job-actions > .spp-btn:first-child,
.active-job-actions > button:first-child {
  background: #e30613 !important;
  color: #ffffff !important;
  border: 0 !important;
  font-weight: 700 !important;
}

.active-job-cancel-btn {
  background: transparent !important;
  color: #e30613 !important;
  border: 0 !important;
  font-weight: 600 !important;
}

/* ── Barra in basso ──────────────────────────────────────────────────────
   Scura come nel tema: chiude la schermata e stacca dai contenuti chiari. */

.bottom-nav {
  background: #1d1b1b !important;
  border-top: 0 !important;
  border-radius: 20px 20px 0 0;
}
.bottom-nav .nav-item { color: #9b9597 !important; }
.bottom-nav .nav-item.active { color: #ffffff !important; font-weight: 700 !important; }

/* ── Interruttore disponibilità ──────────────────────────────────────────
   Resta l'unico verde: dice "sei acceso", non è un'azione da fare. */
.toggle-switch input:checked + .toggle-slider { background: #16a34a !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   Incarichi — impianto della grafica 1c

   In cima si legge lo stato del lavoro di adesso; sotto, la scheda con
   destinazione e distanza; poi la linea del tempo; infine i pulsanti, con
   uno solo in rosso — quello che si deve premere adesso.
   ═══════════════════════════════════════════════════════════════════════════ */

.spp-icona { flex: none; display: inline-block; vertical-align: -.18em; }
.riga-icona, .riquadro-titolo, .guida-titolo {
  display: inline-flex; align-items: center; gap: 8px;
}
.guida-titolo, .riquadro-titolo { display: flex; }

/* ── Riga di servizio ────────────────────────────────────────────────────── */

.lav-barra {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.lav-gps {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: #f1f5f9; color: #64748b;
  font-size: 12px; font-weight: 600;
}
.lav-gps-pallino {
  width: 6px; height: 6px; border-radius: 50%;
  background: #94a3b8; flex: none;
}
.lav-gps[data-attivo="1"] { background: #fde8ea; color: #e30613; }
.lav-gps[data-attivo="1"] .lav-gps-pallino { background: #e30613; }

.online-toggle { font-size: 13px !important; color: #475569 !important; }

/* ── Titolo ──────────────────────────────────────────────────────────────── */

.lav-titolo { margin: 0 0 14px; padding: 0 2px; }
.lav-occhiello {
  font-size: 13px; font-weight: 600; color: #64748b; margin: 0;
}
.lav-stato {
  font-size: 30px; font-weight: 800; letter-spacing: -.03em;
  line-height: 1.1; color: #1d1b1b; margin: 0;
}

/* ── Scheda dell'incarico attivo ─────────────────────────────────────────── */

.active-job { margin-bottom: 12px !important; }

.active-job-testa {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
.lav-eti {
  font-size: 12px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: .08em;
  margin: 0 0 4px;
}
.active-job-indirizzo {
  font-size: 19px; font-weight: 700; line-height: 1.25; margin: 0;
}
.active-job-citta { font-size: 14px; color: #475569; margin: 0; }

.active-job-distanza { text-align: right; flex: none; }
.active-job-distanza > span {
  display: block;
  font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.active-job-distanza small {
  font-size: 14px; font-weight: 600; color: #64748b;
}
.active-job-distanza > small {
  display: block; margin-top: 4px;
  font-size: 12px; font-weight: 400; color: #64748b;
}

/* Due fatti che si guardano di sfuggita: servizio e appuntamento. */
.active-job-fatti {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.lav-fatto {
  background: #f1f5f9; border-radius: 10px; padding: 10px 12px;
  min-width: 0;
}
.lav-fatto span {
  display: block; font-size: 11px; font-weight: 600; color: #64748b;
}
.lav-fatto strong {
  display: block; margin-top: 2px;
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Solo la prima lettera: "capitalize" trasformava anche la data in
   "9 Set Alle 10:00". */
.lav-fatto strong::first-letter { text-transform: uppercase; }

/* Il cliente: chi è a sinistra, come raggiungerlo a destra. */
.active-job-client {
  background: transparent !important;
  padding: 14px 0 0 !important;
  border-top: 1px solid #e2e8f0 !important;
  border-radius: 0 !important;
}
.active-job-riga {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.active-job-nome { font-size: 15px; font-weight: 600; }
.active-job-tel  { font-size: 13px; color: #64748b; }
.active-job-contatti { display: flex; gap: 8px; flex: none; }

.active-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border-radius: 999px;
  background: #1d1b1b; color: #ffffff;
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.active-pill.tonda {
  width: 40px; padding: 0; justify-content: center;
  background: #f1f5f9; color: #1d1b1b;
}

/* La richiesta del cliente, con le sue parole. */
.active-job-notes {
  background: transparent !important;
  border-left: 2px solid #e30613 !important;
  border-radius: 0 !important;
  padding: 0 0 0 12px !important;
  margin-top: 14px;
  font-size: 14px; line-height: 1.5; color: #334155 !important;
}
.active-job-budget {
  background: transparent !important;
  padding: 10px 0 0 !important;
  font-size: 13px; color: #475569 !important;
}

/* ── Linea del tempo ─────────────────────────────────────────────────────── */

.lav-timeline {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.lav-timeline .job-status-steps {
  display: flex !important; flex-wrap: nowrap !important;
  gap: 0 !important; margin: 0 !important;
  align-items: flex-start;
}
.lav-timeline .step {
  flex: 1; min-width: 0;
  display: flex !important; flex-direction: column; align-items: center;
  gap: 6px;
  background: transparent !important; backdrop-filter: none !important;
  padding: 0 !important; border-radius: 0 !important;
  box-shadow: none !important;
  font-size: 10px !important; font-weight: 600 !important;
  color: #94a3b8 !important;
  text-align: center;
}
/* Il pallino della tappa: pieno se fatta, cerchio vuoto se è quella di adesso. */
.lav-timeline .step::before {
  content: '' !important;
  width: 22px !important; height: 22px !important;
  border-radius: 50%;
  background: #e2e8f0;
  animation: none !important;
  flex: none;
}
.lav-timeline .step.done::before {
  /* La spunta è un SVG incorporato: nessun carattere, nessun font da caricare. */
  background: #e30613 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}
.lav-timeline .step.active::before {
  background: #ffffff;
  border: 3px solid #e30613;
}
.lav-timeline .step.done  { color: #64748b !important; }
.lav-timeline .step.active { color: #e30613 !important; font-weight: 700 !important; }
.lav-timeline .step span { display: block; }
.lav-timeline .step-dot { display: none; }

/* ── Azioni ──────────────────────────────────────────────────────────────── */

.active-job-actions {
  display: flex !important; flex-direction: column; gap: 8px;
  margin: 0 0 8px !important;
}
.active-job-actions > .spp-btn,
.active-job-actions > button,
.active-job-nav-btn,
.active-job-assign-btn {
  display: inline-flex !important;
  align-items: center; justify-content: center; gap: 10px;
  width: 100% !important;
  min-height: 50px;
  padding: 12px 16px !important;
  font-size: 14px !important;
}
.active-job-actions > .spp-btn:first-child,
.active-job-actions > button:first-child {
  min-height: 56px;
  font-size: 16px !important;
  box-shadow: 0 8px 20px rgba(227,6,19,.3) !important;
}
.active-job-assign-btn {
  justify-content: space-between !important;
  background: #ffffff !important; color: #1d1b1b !important;
  border: 1px solid #e2e8f0 !important; border-radius: 12px !important;
  font-weight: 600 !important;
}
.active-job-cancel-btn { min-height: 44px; font-size: 13px !important; }

/* ── Barra in basso: pillola scura staccata dal fondo ────────────────────── */

@media (max-width: 899px) {
  .bottom-nav {
    left: 16px !important; right: 16px !important; bottom: 16px !important;
    height: auto !important;
    border-radius: 22px !important;
    padding: 12px 8px calc(12px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 12px 30px rgba(29,27,27,.3) !important;
  }
  .bottom-nav .nav-item {
    background: none !important;
    font-size: 10px !important;
  }
  .bottom-nav .nav-item.active { background: none !important; }
  .page { padding-bottom: calc(var(--nav-h) + 44px) !important; }
}
.nav-esci { color: #ff8087 !important; }

/* ── Dettagli con icona al posto dell'emoji ──────────────────────────────── */

.splash-icon, .auth-logo {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 16px;
  background: #e30613; color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0;
}
.splash { background: #1d1b1b !important; }
#page-auth { background: #1d1b1b !important; }
.auth-icona-tonda, .stato-vuoto-icona, .banner-icona {
  width: 56px; height: 56px; margin: 0 auto 14px;
  /* riquadro a sé sopra un testo centrato: deve stare al centro */
  border-radius: 16px;
  background: #f1f5f9; color: #475569;
  display: flex; align-items: center; justify-content: center;
}
.auth-icona-tonda { background: rgba(255,255,255,.12); color: #ffffff; }
.sidebar-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: #e30613; color: #ffffff;
  display: flex; align-items: center; justify-content: center;
}
.pro-avatar {
  width: 72px; height: 72px; margin: 0 auto 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.15); color: #ffffff;
  display: flex; align-items: center; justify-content: center;
}
.voce-icona {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  background: #f1f5f9; color: #475569;
  display: inline-flex; align-items: center; justify-content: center;
}
.fascia-icona {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  background: #f1f5f9; color: #475569;
  display: inline-flex; align-items: center; justify-content: center;
}
.crediti-filigrana { opacity: .3; display: flex; }
.job-card-icon { font-size: 0 !important; color: #1d1b1b; }
.job-distance, .job-credit-cost, .job-timer, .job-address, .job-meta {
  display: inline-flex; align-items: center; gap: 6px;
}
.job-address, .job-meta { display: flex; }

/* La pillola dei crediti e quella del timer erano bianche su bianco. */
.job-credit-cost {
  background: #f1f5f9 !important;
  color: #475569 !important;
}
.job-timer {
  background: #fde8ea !important;
  color: #b3050f !important;
  box-shadow: none !important;
}
.job-amount {
  background: #f1f5f9 !important;
  color: #1d1b1b !important;
}
.history-status-chip.done { background: #f0fdf4; color: #16a34a; }
.job-card-actions .spp-btn-primary {
  box-shadow: 0 6px 16px rgba(227,6,19,.28) !important;
}
.job-status-badge { background: #f1f5f9; color: #475569; }
.status-on-the-way  { background: #fde8ea; color: #b3050f; }
.status-arrived     { background: #f0fdf4; color: #16a34a; }
.spp-green          { background: #f0fdf4; color: #16a34a; }

/* ── Rifiniture della schermata Incarichi ────────────────────────────────── */

/* Il pulsante "Chiama" è scuro pieno: l'icona dentro va in bianco, non in
   rosso (era la tinta ereditata dalla vecchia pillola). */
.active-job-contatti .active-pill.phone,
.active-job-contatti .active-pill.wa,
.active-job-contatti .active-pill.email {
  background: #1d1b1b !important;
  color: #ffffff !important;
}
.active-job-contatti .active-pill.tonda {
  background: #f1f5f9 !important;
  color: #1d1b1b !important;
}

/* Annullare non è un'azione da mettere in evidenza: è testo, non un pulsante. */
.active-job-actions > .active-job-cancel-btn,
.active-job-cancel-btn {
  background: transparent !important;
  border: 0 !important;
  color: #e30613 !important;
  box-shadow: none !important;
  min-height: 44px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

/* La linea che unisce le tappe: rossa fin dove il lavoro è arrivato. */
.lav-timeline .step { position: relative; }
.lav-timeline .step::after {
  content: '';
  position: absolute; top: 10px;
  left: calc(50% + 15px); right: calc(-50% + 15px);
  height: 2px; background: #e2e8f0;
}
.lav-timeline .step.done::after { background: #e30613; }
.lav-timeline .step:last-child::after { display: none; }

/* Stesso principio del cliente: le fasce piene sono nero caldo, non rosse. */
#page-auth, .profile-hero { background: #1d1b1b !important; }

/* L'etichetta di stato dentro la scheda e' ridondante (lo stato e' gia' il
   titolo della pagina): resta nel markup per il codice che la legge, ma
   nascosta. Senza questa riga la regola con l'id vinceva su [hidden]. */
#active-job-status[hidden] { display: none !important; }

.active-job-assign-btn .spp-icona:last-child { color: #94a3b8; }
.active-job-assign-btn .riga-icona { color: #1d1b1b; }
.active-job-assign-btn .riga-icona .spp-icona { color: #e30613; }

/* L'indirizzo era un blocco flex con 16px sotto: la citta' finiva staccata
   dalla via a cui appartiene. */
#active-job-address, .active-job-indirizzo {
  display: block !important;
  margin: 0 !important;
}

/* ── Registrazione dentro l'app ──────────────────────────────────────────────
   Prima questa linguetta rimandava al sito WordPress: adesso la richiesta si
   manda da qui, e la scheda bianca dell'accesso vuole testo scuro. */

.reg-intro {
  font-size: 13px; line-height: 1.55; color: #475569;
  margin: 0 0 4px; text-align: center;
}
.reg-due { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reg-nota {
  font-size: 12px; line-height: 1.5; color: #94a3b8;
  margin: 4px 0 0; text-align: center;
}
.reg-fatto {
  font-size: 19px; font-weight: 700; text-align: center;
  color: #1d1b1b; margin: 0 0 6px;
}
#auth-inviata .auth-icona-tonda { background: #f0fdf4; color: #16a34a; }
#auth-register .auth-icona-tonda { background: #fde8ea; color: #e30613; }

/* Il menu a tendina deve somigliare agli altri campi, non al menu di sistema. */
select.spp-input {
  appearance: none; -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  color: #1d1b1b;
}
select.spp-input:invalid, select.spp-input option[value=""] { color: #94a3b8; }

/* ── Avvisi in fondo allo schermo ────────────────────────────────────────────
   Il foglio vestiva #pro-toast, ma l'elemento nel markup è #spp-toast con
   classe .toast: ogni messaggio dell'app usciva senza uno stile, e sopra la
   schermata d'accesso non si vedeva proprio. */

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 20px); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1d1b1b; color: #ffffff;
  padding: 12px 20px; border-radius: 24px;
  font-size: 14px; font-weight: 500; line-height: 1.4;
  max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 12px 30px rgba(29,27,27,.35);
  opacity: 0; transition: opacity .25s, transform .25s;
  pointer-events: none;
  /* sopra la schermata d'accesso, che sta a 150 */
  z-index: 9998;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
