/* Felice Client Portal 14.6.23 - Stability fixes: modal, calendar drawer, cleanup actions */
:root{
  --fcp23-bg:#f6f8fb;
  --fcp23-surface:#fff;
  --fcp23-border:#dce7f3;
  --fcp23-text:#0f2440;
  --fcp23-muted:#667085;
  --fcp23-blue:#0b3b8f;
  --fcp23-blue2:#2563eb;
  --fcp23-green:#12b76a;
  --fcp23-red:#b42318;
  --fcp23-shadow:0 24px 80px rgba(15,35,65,.24);
}

body.fcp-app-root-page{
  min-height:100svh!important;
  overflow-x:hidden!important;
}
body.fcp-app-root-page .fcp-app-main,
body.fcp-app-root-page .fcp-mobile-native-screen,
body.fcp-app-root-page .fcp-mobile-task-panel{
  overflow:visible!important;
  min-width:0!important;
}

/* Overlay: nascosti di default. Prima erano sempre visibili e bloccavano desktop/mobile. */
body.fcp-app-root-page .fcp-mobile-sheet-backdrop,
body.fcp-app-root-page .fcp-mobile-edit-backdrop,
body.fcp-app-root-page .fcp-mobile-ai-backdrop,
body.fcp-app-root-page .fcp-mobile-lead-backdrop,
body.fcp-app-root-page .fcp-mobile-action-backdrop,
body.fcp-app-root-page .fcp-mobile-calendar-menu-backdrop,
body.fcp-app-root-page .fcp-mobile-search-backdrop,
body.fcp-app-root-page .fcp-mobile-filter-backdrop,
body.fcp-app-root-page .fcp-mobile-menu-backdrop,
body.fcp-app-root-page .fcp-14623-day-backdrop{
  display:none!important;
  position:fixed!important;
  inset:0!important;
  background:rgba(15,23,42,.48)!important;
  z-index:9990!important;
  cursor:pointer!important;
}
body.fcp-mobile-task-open .fcp-mobile-sheet-backdrop,
body.fcp-mobile-edit-open .fcp-mobile-edit-backdrop,
body.fcp-mobile-ai-open .fcp-mobile-ai-backdrop,
body.fcp-mobile-lead-open .fcp-mobile-lead-backdrop,
body.fcp-mobile-actions-open .fcp-mobile-action-backdrop,
body.fcp-mobile-calendar-menu-open .fcp-mobile-calendar-menu-backdrop,
body.fcp-mobile-search-open .fcp-mobile-search-backdrop,
body.fcp-mobile-filter-open .fcp-mobile-filter-backdrop,
body.fcp-mobile-day-open .fcp-14623-day-backdrop{
  display:block!important;
}

/* Modal centrali, usabili sia da PC che mobile */
body.fcp-app-root-page .fcp-mobile-task-sheet,
body.fcp-app-root-page .fcp-mobile-edit-sheet,
body.fcp-app-root-page .fcp-mobile-ai-sheet,
body.fcp-app-root-page .fcp-mobile-lead-sheet,
body.fcp-app-root-page .fcp-mobile-day-sheet{
  position:fixed!important;
  left:50%!important;
  top:50%!important;
  right:auto!important;
  bottom:auto!important;
  width:min(560px, calc(100vw - 28px))!important;
  max-height:min(88svh, 760px)!important;
  overflow:auto!important;
  -webkit-overflow-scrolling:touch!important;
  transform:translate(-50%, -46%) scale(.96)!important;
  opacity:0!important;
  visibility:hidden!important;
  pointer-events:none!important;
  background:#fff!important;
  border:1px solid var(--fcp23-border)!important;
  border-radius:24px!important;
  box-shadow:var(--fcp23-shadow)!important;
  z-index:9996!important;
  padding:22px!important;
}
body.fcp-mobile-task-open .fcp-mobile-task-sheet,
body.fcp-mobile-edit-open .fcp-mobile-edit-sheet,
body.fcp-mobile-ai-open .fcp-mobile-ai-sheet,
body.fcp-mobile-lead-open .fcp-mobile-lead-sheet,
body.fcp-mobile-day-open .fcp-mobile-day-sheet,
body.fcp-app-root-page .fcp-mobile-day-sheet.is-open{
  transform:translate(-50%, -50%) scale(1)!important;
  opacity:1!important;
  visibility:visible!important;
  pointer-events:auto!important;
}
body.fcp-app-root-page .fcp-mobile-task-sheet h3,
body.fcp-app-root-page .fcp-mobile-lead-sheet h3,
body.fcp-app-root-page .fcp-mobile-edit-sheet h3,
body.fcp-app-root-page .fcp-mobile-day-sheet h3{
  margin:0 48px 16px 0!important;
  color:var(--fcp23-text)!important;
  font-size:22px!important;
  line-height:1.15!important;
}
body.fcp-app-root-page .fcp-mobile-sheet-x{
  position:absolute!important;
  top:16px!important;
  right:16px!important;
  margin:0!important;
  width:40px!important;
  height:40px!important;
  min-width:40px!important;
  border-radius:14px!important;
  border:1px solid var(--fcp23-border)!important;
  background:#fff!important;
  color:var(--fcp23-text)!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  z-index:10001!important;
  cursor:pointer!important;
}

body.fcp-app-root-page .fcp-mobile-task-sheet form,
body.fcp-app-root-page .fcp-mobile-lead-sheet form,
body.fcp-app-root-page .fcp-mobile-edit-sheet form{
  display:grid!important;
  gap:12px!important;
}
body.fcp-app-root-page .fcp-mobile-task-sheet label,
body.fcp-app-root-page .fcp-mobile-lead-sheet label,
body.fcp-app-root-page .fcp-mobile-edit-sheet label{
  margin:0!important;
  font-size:13px!important;
  color:var(--fcp23-muted)!important;
  font-weight:800!important;
}
body.fcp-app-root-page .fcp-mobile-task-sheet input,
body.fcp-app-root-page .fcp-mobile-task-sheet select,
body.fcp-app-root-page .fcp-mobile-task-sheet textarea,
body.fcp-app-root-page .fcp-mobile-lead-sheet input,
body.fcp-app-root-page .fcp-mobile-lead-sheet select,
body.fcp-app-root-page .fcp-mobile-lead-sheet textarea,
body.fcp-app-root-page .fcp-mobile-edit-sheet input,
body.fcp-app-root-page .fcp-mobile-edit-sheet select,
body.fcp-app-root-page .fcp-mobile-edit-sheet textarea{
  margin-top:6px!important;
  border-radius:14px!important;
  min-height:46px!important;
  padding:12px 14px!important;
  border:1px solid #cddbeb!important;
  background:#fff!important;
  color:var(--fcp23-text)!important;
}
body.fcp-app-root-page .fcp-mobile-date-actions{
  display:flex!important;
  gap:8px!important;
  flex-wrap:wrap!important;
}
body.fcp-app-root-page .fcp-mobile-date-actions button{
  flex:1 1 92px!important;
  min-height:42px!important;
  border-radius:13px!important;
  border:1px solid #cddbeb!important;
  background:#f8fbff!important;
  color:var(--fcp23-blue)!important;
  font-weight:900!important;
}

/* Drawer giorno: mostra anche 20+ task con scroll interno */
body.fcp-app-root-page .fcp-mobile-day-sheet{
  width:min(720px, calc(100vw - 28px))!important;
}
body.fcp-app-root-page .fcp-mobile-day-sheet-body{
  max-height:calc(88svh - 92px)!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding:2px 2px 18px!important;
  display:grid!important;
  gap:10px!important;
}
body.fcp-app-root-page .fcp-mobile-day-sheet-body .fcp-mobile-task-card{
  margin:0!important;
}

/* Calendario: click facile, task visibili e niente contenitore bloccato */
body.fcp-app-root-page .fcp-mobile-month-title{
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  margin:12px 0!important;
}
body.fcp-app-root-page .fcp-mobile-month-title strong{
  flex:1!important;
  font-size:24px!important;
  line-height:1.1!important;
  color:var(--fcp23-text)!important;
}
body.fcp-app-root-page .fcp-mobile-month-day,
body.fcp-app-root-page .fcp-mobile-schedule-cell{
  cursor:pointer!important;
  touch-action:manipulation!important;
}
body.fcp-app-root-page .fcp-mobile-month-day{
  overflow:hidden!important;
}
body.fcp-app-root-page .fcp-mobile-month-day span{
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  max-width:100%!important;
}
body.fcp-app-root-page .fcp-mobile-month-day em,
body.fcp-app-root-page .fcp-mobile-schedule-more{
  pointer-events:auto!important;
  position:relative!important;
  z-index:3!important;
}
body.fcp-app-root-page .fcp-mobile-schedule{
  max-width:100%!important;
  overflow:auto!important;
  touch-action:auto!important;
}
body.fcp-app-root-page .fcp-mobile-schedule-body{
  min-height:720px!important;
}

/* Pulsanti pulizia task */
body.fcp-app-root-page .fcp-mobile-task-cleanup,
.fcp-crm-cleanup-card .fcp-crm-cleanup-actions{
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  flex-wrap:wrap!important;
  margin:12px 0 16px!important;
}
body.fcp-app-root-page .fcp-mobile-task-cleanup{
  background:#fff!important;
  border:1px solid var(--fcp23-border)!important;
  border-radius:18px!important;
  padding:12px!important;
  box-shadow:0 8px 22px rgba(16,32,51,.06)!important;
}
body.fcp-app-root-page .fcp-mobile-task-cleanup strong{
  color:var(--fcp23-text)!important;
  margin-right:auto!important;
}
body.fcp-app-root-page .fcp-mobile-task-cleanup button{
  border:1px solid #cddbeb!important;
  background:#f8fbff!important;
  color:var(--fcp23-blue)!important;
  border-radius:12px!important;
  padding:9px 12px!important;
  font-weight:900!important;
  cursor:pointer!important;
}
body.fcp-app-root-page .fcp-mobile-task-cleanup button.danger{
  border-color:#fecaca!important;
  background:#fff5f5!important;
  color:var(--fcp23-red)!important;
}

/* Mobile: più spazio sotto per poter scorrere oltre navbar */
@media (max-width:960px){
  body.fcp-app-root-page .fcp-app-main{
    padding-bottom:128px!important;
    min-height:calc(100svh + 120px)!important;
  }
  body.fcp-app-root-page .fcp-mobile-native-screen{
    padding-bottom:112px!important;
  }
  body.fcp-app-root-page .fcp-mobile-task-cleanup{
    align-items:flex-start!important;
  }
  body.fcp-app-root-page .fcp-mobile-task-cleanup strong{
    flex:0 0 100%!important;
  }
  body.fcp-app-root-page .fcp-mobile-task-cleanup button{
    flex:1 1 140px!important;
  }
  body.fcp-app-root-page .fcp-mobile-task-sheet,
  body.fcp-app-root-page .fcp-mobile-edit-sheet,
  body.fcp-app-root-page .fcp-mobile-ai-sheet,
  body.fcp-app-root-page .fcp-mobile-lead-sheet,
  body.fcp-app-root-page .fcp-mobile-day-sheet{
    width:calc(100vw - 22px)!important;
    max-height:86svh!important;
    border-radius:22px!important;
    padding:18px!important;
  }
}

@media (max-width:430px){
  body.fcp-app-root-page .fcp-mobile-calendar-viewbar{
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch!important;
    padding-bottom:4px!important;
  }
  body.fcp-app-root-page .fcp-mobile-month-grid{
    gap:4px!important;
  }
  body.fcp-app-root-page .fcp-mobile-month-day{
    min-height:82px!important;
    padding:5px!important;
  }
  body.fcp-app-root-page .fcp-mobile-month-day span{
    font-size:9px!important;
  }
  body.fcp-app-root-page .fcp-mobile-schedule[data-days="3"],
  body.fcp-app-root-page .fcp-mobile-schedule[data-days="7"]{
    min-width:640px!important;
  }
}

/* 14.6.24 FTC Sync UI */
.fcp-task-people-tags{background:#f8fbff!important;border:1px solid #dbeafe!important;border-radius:16px!important;padding:12px!important;display:grid!important;gap:8px!important}.fcp-task-people-tags strong{font-size:12px!important;text-transform:uppercase!important;letter-spacing:.04em!important;color:#475569!important}.fcp-task-people-tags>div{display:flex!important;flex-wrap:wrap!important;gap:8px!important}.fcp-task-people-tags label{display:inline-flex!important;align-items:center!important;gap:6px!important;border:1px solid #bfdbfe!important;background:#eff6ff!important;color:#0f4fb8!important;border-radius:999px!important;padding:8px 10px!important;font-size:12px!important;font-weight:800!important;text-transform:none!important;letter-spacing:0!important}.fcp-task-people-tags input{width:14px!important;height:14px!important;min-height:0!important;padding:0!important;accent-color:#2563eb!important}button[data-fcp-ftc-sync-now]{background:#eff6ff!important;color:#155eef!important;border:1px solid #bfdbfe!important}.fcp-mobile-task-cleanup button[data-fcp-ftc-sync-now]{font-weight:900!important}
