/* =========================================================
   SBMS LAYOUT THEME - RESPONSIVE / MOBILE

   UNICA FONTE DELLA RESPONSIVITA DEL PROGETTO
   ---------------------------------------------------------
   Tutte le regole @media custom devono vivere in questo file.
   I fogli base e di modulo contengono esclusivamente gli stili
   desktop / component-level senza breakpoint responsive.

   ORDINE DI CASCADE
   ---------------------------------------------------------
   Questo file deve essere caricato dopo:
   - layout-theme.css
   - layout-theme-card.css
   - CSS vendor (DataTables, Select2, SweetAlert, ecc.)
   - eventuali CSS specifici di pagina / modulo

   ECCEZIONE STILI INLINE TARDIVI
   ---------------------------------------------------------
   Se un componente mantiene stili base inline nel markup,
   usare qui un selettore leggermente piu specifico (es.
   body .componente) invece di moltiplicare gli !important.

   BREAKPOINT DI RIFERIMENTO
   ---------------------------------------------------------
   >= 1700px : desktop extra-wide, solo componenti dedicati
   >= 1550px : planner annuale extra-wide
   <= 1399px : desktop compatto
   <= 1199px : desktop piccolo / tablet landscape
   <=  991px : tablet + layout mobile (sidebar off-canvas)
   <=  767px : mobile
   <=  575px : mobile piccolo
   <=  420px : mobile compatto
   <=  360px : mobile extra-compatto (azioni popup)

   Nota: i breakpoint sono scritti direttamente nelle @media
   perche le CSS custom properties non sono utilizzabili nelle
   condizioni delle media query.
========================================================= */

/* =========================================================
   1. LAYOUT / SIDEBAR - BREAKPOINT DESKTOP
   Sidebar collassata da 992px in su
========================================================= */

@media (min-width: 992px) {
  body.sidebar-collapsed #page-wrapper.layout-shell {
    grid-template-columns: var(--layout-sidebar-collapsed-width) minmax(0, 1fr) !important;
  }

  body.sidebar-collapsed .layout-navbar .layout-navbar-inner {
    grid-template-columns: var(--layout-sidebar-collapsed-width) minmax(0, 1fr) !important;
  }

  body.sidebar-collapsed .layout-navbar-left {
    flex: 0 0 var(--layout-sidebar-collapsed-width) !important;
    max-width: var(--layout-sidebar-collapsed-width) !important;
    min-width: var(--layout-sidebar-collapsed-width) !important;
    padding: 0 10px !important;
    justify-content: center;
  }

  body.sidebar-collapsed .layout-navbar-brand {
    display: none !important;
  }

  body.sidebar-collapsed .layout-sidebar #sidebar .js-sidebar-content {
    padding: 20px 12px 18px !important;
  }

  body.sidebar-collapsed #sidebar .layout-submenu,
  body.sidebar-collapsed #sidebar .layout-menu-arrow,
  body.sidebar-collapsed #sidebar .layout-menu-text,
  body.sidebar-collapsed #sidebar .layout-submenu-text,
  body.sidebar-collapsed #sidebar .layout-submenu-icon,
  body.sidebar-collapsed #sidebar .menu-text,
  body.sidebar-collapsed #sidebar .menu-label,
  body.sidebar-collapsed #sidebar .nav-text,
  body.sidebar-collapsed #sidebar .nav-label {
    display: none !important;
  }

  body.sidebar-collapsed #sidebar .layout-menu {
    padding-top: 0 !important;
  }

  body.sidebar-collapsed #sidebar .layout-menu-item {
    margin-bottom: 12px !important;
  }

  body.sidebar-collapsed #sidebar .layout-menu-link {
    min-height: 54px !important;
    width: 54px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    border-radius: 18px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  body.sidebar-collapsed #sidebar .layout-menu-icon {
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  body.sidebar-collapsed #sidebar .layout-menu-icon i {
    font-size: 24px !important;
  }
}

/* -------------------------
   Hamburger sidebar - stato mobile chiuso
   La classe is-mobile-closed viene gestita da sidebar-toggle.js
------------------------- */
body:not(.sidebar-mobile-open) .layout-navbar-sidebar-toggle.is-mobile-closed span:nth-child(1) {
  transform: translateY(-7px);
}

body:not(.sidebar-mobile-open) .layout-navbar-sidebar-toggle.is-mobile-closed span:nth-child(2) {
  opacity: 1;
  transform: translateY(0);
}

body:not(.sidebar-mobile-open) .layout-navbar-sidebar-toggle.is-mobile-closed span:nth-child(3) {
  transform: translateY(7px);
}

/* =========================================================
   2. LAYOUT GENERALE - TABLET / MOBILE
========================================================= */

@media (max-width: 991px) {
  #page-wrapper.layout-shell {
    grid-template-columns: 1fr !important;
    grid-template-rows: var(--layout-header-height) minmax(0, 1fr) !important;
    grid-template-areas:
      "header"
      "main" !important;
  }

  .layout-main {
    padding: 13px 14px;
    overflow: visible;
  }

  .layout-header {
    z-index: 10000;
  }

  .layout-header .layout-navbar>.container-fluid,
  .layout-header .page-controls .container-fluid {
    padding: 0 18px !important;
  }

  .layout-navbar .layout-navbar-inner {
    grid-template-columns: minmax(0, 1fr) auto !important;
    column-gap: 10px;
  }

  .layout-navbar-left {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    gap: 10px;
  }

  .layout-navbar-center {
    display: none;
  }

  .layout-navbar-sidebar-toggle {
    order: -1;
    flex: 0 0 var(--layout-sidebar-toggle-size);
    width: var(--layout-sidebar-toggle-size);
    height: var(--layout-sidebar-toggle-size);
  }

  .layout-navbar-brand {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .layout-navbar-brand-logo {
    width: auto;
    max-width: clamp(132px, 34vw, 178px);
    height: 52px;
  }

  .layout-navbar-right {
    flex: 0 0 auto;
    min-width: 0;
  }

  .layout-navbar-actions {
    gap: 12px;
  }

  /* Touch target mobile/tablet: 44px; la grafica dell'icona resta separata. */
  .layout-navbar-icon-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  .layout-navbar-icon-image {
    width: 24px;
    height: 24px;
  }

  .layout-navbar-user {
    min-height: 54px;
  }

  .layout-navbar-user-avatar-wrap,
  .layout-navbar-user-avatar,
  .layout-navbar-user-avatar-generated {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex-basis: 38px;
  }

  .layout-navbar-user-avatar-wrap {
    margin-right: 0;
  }

  .layout-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(var(--layout-sidebar-width), 86vw) !important;
    max-width: 86vw !important;
    height: 100dvh !important;
    z-index: 10001 !important;
    transform: translateX(calc(-100% - 24px)) !important;
    opacity: 0;
    pointer-events: none;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
    transition:
      transform var(--layout-sidebar-transition),
      opacity var(--layout-sidebar-transition);
  }

  .layout-sidebar #sidebar {
    position: absolute !important;
    top: var(--layout-header-height) !important;
    left: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    height: calc(100dvh - var(--layout-header-height)) !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: rgba(25, 31, 57, 0.98) !important;
    box-shadow: 18px 0 42px rgba(0, 0, 0, 0.32) !important;
  }

  .layout-sidebar #sidebar .js-sidebar-content {
    height: 100%;
    overflow-y: auto;
    padding: 28px 18px 18px;
  }

  body.sidebar-mobile-open .layout-sidebar {
    transform: translateX(0) !important;
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-mobile-open .layout-header {
    z-index: 10002;
  }

  body.sidebar-mobile-open .layout-navbar-sidebar-toggle {
    position: relative;
    z-index: 10003;
  }

  body.sidebar-mobile-open {
    overflow: hidden !important;
  }

  body.sidebar-mobile-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.45);
  }

  body.sidebar-collapsed #page-wrapper.layout-shell,
  body.sidebar-collapsed .layout-navbar .layout-navbar-inner {
    grid-template-columns: 1fr !important;
  }

  .layout-footer-inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .layout-footer-version {
    padding-right: 0;
    text-align: left;
    white-space: normal;
  }
}

@media (max-width: 575px) {
  :root {
    --layout-header-height: 78px;
    --layout-shell-padding: 0;
    --layout-sidebar-toggle-size: 36px;
  }

  .layout-header .layout-navbar>.container-fluid,
  .layout-header .page-controls .container-fluid {
    padding: 0 12px !important;
  }

  .layout-navbar .layout-navbar-inner {
    column-gap: 8px;
  }

  .layout-navbar-left {
    gap: 8px;
  }

  .layout-navbar-brand-logo {
    max-width: min(100px, 27vw);
    height: 46px;
  }

  .layout-navbar-actions {
    gap: 4px;
  }

  .layout-navbar-divider {
    display: none;
  }

  .layout-navbar-icon-button {
    padding: 11px;
  }

  .layout-navbar-icon-image {
    width: 22px;
    height: 22px;
  }

  .layout-navbar-user-avatar-wrap,
  .layout-navbar-user-avatar,
  .layout-navbar-user-avatar-generated {
    width: 36px;
    height: 36px;
    min-width: 36px;
    flex-basis: 36px;
  }

  .layout-navbar-notifications-badge {
    top: -8px;
    right: -8px;
  }


  .layout-navbar-notifications-panel {
    position: fixed;
    top: calc(var(--layout-header-height) + 8px);
    left: auto;
    right: 12px;
    width: min(340px, calc(100vw - 24px));
    max-width: none;
    transform-origin: top right;
  }

  .layout-navbar-notifications-panel::before {
    right: 28px;
  }

  .layout-navbar-notifications-header {
    padding: 13px 14px;
  }

  .layout-navbar-notifications-title-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 12px;
  }

  .layout-navbar-notifications-subtitle {
    display: none;
  }

  .layout-navbar-notifications-body {
    max-height: min(285px, calc(100dvh - var(--layout-header-height) - 146px));
  }

  .layout-navbar-notification-item {
    padding: 10px 9px;
  }

  .layout-navbar-notifications-empty {
    padding: 18px 18px 20px;
  }

  .layout-navbar-notifications-empty-svg {
    width: 104px;
  }

  .layout-sidebar {
    width: min(300px, calc(100vw - 52px)) !important;
    max-width: calc(100vw - 52px) !important;
  }

  .layout-menu-link {
    min-height: 52px;
    padding: 0 16px;
  }
}

@media (max-width: 420px) {

  .layout-header .layout-navbar>.container-fluid,
  .layout-header .page-controls .container-fluid {
    padding: 0 10px !important;
  }

  .layout-navbar-actions {
    gap: 2px;
  }

  .layout-navbar-icon-button {
    padding: 11.5px;
  }

  .layout-navbar-icon-image {
    width: 21px;
    height: 21px;
  }

  /* Sui telefoni molto stretti il logo e accessibile dal menu laterale. */
  .layout-navbar-brand {
    display: none;
  }


  .layout-navbar-notifications-panel {
    left: auto;
    right: 10px;
    width: min(330px, calc(100vw - 20px));
  }

  .layout-navbar-notifications-footer-btn {
    min-height: 44px;
    padding: 0 10px;
    font-size: 12px;
  }
}

/* =========================================================
   3. LIGHT MODE - RESPONSIVE SIDEBAR
========================================================= */

@media (min-width: 992px) {
  body.theme-light .layout-sidebar {
    background: transparent !important;
    box-shadow: none !important;
  }
}

@media (max-width: 991px) {
  body.theme-light.sidebar-mobile-open .layout-sidebar {
    background: transparent !important;
    box-shadow: none !important;
  }

  body.theme-light.sidebar-mobile-open .layout-sidebar #sidebar {
    background: #f7f9fc !important;
    box-shadow: 18px 0 42px rgba(15, 23, 42, 0.16) !important;
  }
}

/* =========================================================
   4. DRAWER MEDIA - RESPONSIVE
========================================================= */

@media (max-width: 575px) {

  .drawer-media--avatar .drawer-cover-current,
  .drawer-media--avatar .drawer-cover-editor {
    min-height: 260px;
  }

  .drawer-media--boat-card .drawer-cover-current,
  .drawer-media--boat-card .drawer-cover-editor {
    min-height: 160px;
  }

  .drawer-media--boat-hero .drawer-cover-current,
  .drawer-media--boat-hero .drawer-cover-editor {
    min-height: 140px;
  }
}

/* =========================================================
   5. DRAWER - RESPONSIVE
========================================================= */

@media (max-width: 991px) {
  .drawer {
    width: min(620px, 100vw);
    border-radius: 20px 0 0 20px;
  }

  .drawer__title {
    font-size: 22px;
  }
}

@media (max-width: 767px) {
  .drawer {
    width: 100vw;
  }

  .drawer__header,
  .drawer__body,
  .drawer__footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .drawer__footer .ui-form-actions {
    gap: 12px;
  }

  .drawer__footer .btn {
    min-width: 120px;
  }
}

@media (max-width: 575px) {
  .drawer .info-box-blue {
    align-items: flex-start;
    gap: 12px;
    padding: 16px 14px;
  }

  .drawer .info-box-blue .info-box-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex: 0 0 38px;
  }

  .drawer .info-box-blue .info-box-icon i {
    font-size: 18px;
  }

  .drawer .info-box-blue .info-box-content h5 {
    font-size: 16px;
  }

  .drawer .select2-container--default .select2-selection--single,
  .detail-section-card .select2-container--default .select2-selection--single {
    height: 52px;
    min-height: 52px;
  }

  .drawer .select2-container--default .select2-selection--single .select2-selection__rendered,
  .detail-section-card .select2-container--default .select2-selection--single .select2-selection__rendered {
    min-height: 50px;
    padding-left: 16px;
    padding-right: 42px;
    line-height: 50px;
  }

  .drawer .select2-container--default .select2-selection--single .select2-selection__arrow,
  .detail-section-card .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 50px;
    right: 8px;
  }

  .drawer .select2-flag-selection {
    min-height: 50px;
  }

  .select2-search--dropdown {
    padding: 10px;
  }

  .select2-search--dropdown .select2-search__field {
    height: 42px;
  }

  .select2-results__option {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* =========================================================
   6. DETTAGLIO / HERO - RESPONSIVE
========================================================= */

@media (max-width: 1199px) {
  .detail-hero-main {
    grid-template-columns: minmax(0, 1fr) 160px;
  }
}

@media (max-width: 991px) {
  .detail-hero-main {
    grid-template-columns: 1fr;
  }

  .detail-hero-media {
    border-top-right-radius: inherit;
    border-bottom-left-radius: 0;
  }

  .detail-hero-side {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-top-right-radius: 0;
  }

  .detail-hero-side-inner {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }

  .detail-hero-edit-btn {
    width: auto;
  }

  body.theme-light .detail-hero-side {
    border-top-color: #dbe4f0;
  }
}

@media (max-width: 767px) {
  .detail-hero-media {
    aspect-ratio: 16 / 6;
  }

  .detail-hero-overlay {
    padding: 18px;
  }

  .detail-hero-title {
    font-size: 28px;
  }

  .detail-hero-subtitle {
    font-size: 16px;
  }

  .detail-hero-side-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-tab-panel>.content-card.detail-section-card {
    padding: 20px 18px 24px;
  }

  .detail-form-grid {
    gap: 18px;
  }

  /* Form dettaglio / azienda: una sola colonna su smartphone. */
  .detail-form-grid.cols-2,
  .ga-form-grid--2 {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   7. HOME WELCOME / NOTIFICHE HOME - RESPONSIVE
   Ordine dei breakpoint preservato dal foglio originale
========================================================= */

@media (max-width: 991px) {
  .home-notification-card {
    max-width: min(100%, 500px);
    min-height: 54px;
    padding: 9px 12px;
    border-radius: 13px;
  }

  .home-notification-icon {
    width: 36px;
    height: 36px;
  }

  .home-notification-title {
    font-size: 14px;
  }

  .home-notification-subtitle {
    font-size: 11.5px;
  }
}

@media (max-width: 575px) {
  .home-notification-card {
    display: flex;
    width: 100%;
    max-width: 100%;
    gap: 10px;
    min-height: 52px;
    padding: 9px 11px;
    border-radius: 12px;
  }

  .home-notification-icon {
    width: 34px;
    height: 34px;
  }

  .home-notification-icon i {
    font-size: 16px;
  }

  .home-notification-title {
    font-size: 13.5px;
  }

  .home-notification-subtitle {
    font-size: 11px;
  }

  .home-notification-arrow {
    width: 20px;
  }

  .home-notification-arrow i {
    font-size: 19px;
  }
}

@media (max-width: 767px) {
  .home-dashboard-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "notice"
      "actions";
    justify-items: stretch;
    gap: 14px;
  }

  .home-dashboard-hero .home-notification-slot {
    width: 100%;
  }

  .home-dashboard-hero .home-welcome-actions {
    justify-self: center;
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .home-dashboard-hero .home-welcome-actions>* {
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* =========================================================
   8. GESTIONE DANNI - RESPONSIVE
========================================================= */

@media (max-width: 575px) {
  #drawer-add-danno .damage-reference-period {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   9. CHECK-IN / CHECK-OUT - RESPONSIVE
========================================================= */

@media (max-width: 767px) {

  body .cc-cleaning-grid,
  body .cc-image-metadata-grid,
  body .cc-cleaning-areas {
    grid-template-columns: 1fr;
  }

  body .cc-preview-form-row {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   10. CARD / GRID / TRACKING - RESPONSIVE GENERALE
========================================================= */

/* >= 1700px */

@media (min-width: 1700px) {
  .content-grid--members {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* <= 1399px */

@media (max-width: 1399px) {
  .home-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-card--member .content-card-avatar-circle {
    width: 104px;
    height: 104px;
    min-width: 104px;
    font-size: 36px;
  }

  .content-card-avatar-missing-icon {
    font-size: 38px;
  }

  .content-grid--members {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* <= 1199px */

@media (max-width: 1199px) {

  .content-grid,
  .content-grid--3,
  .content-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-card-avatars-dual {
    gap: 18px;
  }

  .content-card--member .content-card-media {
    padding: 20px 20px 26px;
  }

  .content-card-member-columns {
    gap: 16px;
  }

  /* TRACKING POSIZIONE */

  .tracking-posizione-card .detail-section-head {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .tracking-posizione-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .tracking-posizione-status-header {
    width: 100%;
    max-width: 420px;
    min-height: 56px;
    padding: 0 22px;
    font-size: 18px !important;
  }

  #tracking-posizione-status-badge {
    font-size: 18px !important;
  }

  .tracking-posizione-card .tracking-dashboard-layout {
    grid-template-columns: 1fr;
  }

  .tracking-posizione-card .tracking-info-card,
  .tracking-posizione-card .tracking-info-body {
    min-height: auto;
  }

  /* TRACKING STORICO */

  .tracking-storico-dashboard-layout {
    grid-template-columns: 1fr;
  }

  .tracking-storico-info-card,
  .tracking-storico-info-body {
    min-height: auto;
  }

  .tracking-storico-map-card,
  .tracking-storico-map,
  #trackingStoricoMap.leaflet-container {
    height: 430px !important;
    min-height: 430px;
  }

  /* TRACKING VIAGGIO */

  .tracking-viaggio-dashboard-layout {
    grid-template-columns: 1fr;
  }

  .tracking-viaggio-info-card,
  .tracking-viaggio-info-body {
    min-height: auto;
  }

  .tracking-viaggio-map-card,
  .tracking-viaggio-map,
  #trackingViaggioMap.leaflet-container {
    height: 430px !important;
    min-height: 430px;
  }
}

/* <= 991px */

@media (max-width: 991px) {

  /* Mantiene lo scroll orizzontale Bootstrap quando i due wrapper convivono. */
  .table-responsive.main-table-shell {
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .main-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .main-card-actions {
    width: 100%;
  }

  .main-btn-primary {
    width: 100%;
  }

  .home-report-grid {
    grid-template-columns: 1fr;
  }

  .home-member-report-grid {
    grid-template-columns: 1fr;
  }

  .home-member-report-row--top {
    flex-direction: column;
  }

  .home-member-report-progress {
    width: 100%;
  }

  /* TRACKING FILTERS */

  .tracking-storico-filter-row,
  .tracking-viaggio-filter-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tracking-storico-filter-export-btn {
    width: 100%;
  }
}

/* <= 767px */

@media (max-width: 767px) {
  .page-shell {
    padding-left: 0;
    padding-right: 0;
  }

  .main-card {
    padding: 20px;
  }

  .main-card-title {
    font-size: 24px;
  }

  .main-table-shell .dataTables_filter input {
    min-width: 100% !important;
    width: 100% !important;
  }

  .main-table-toolbar,
  .main-table-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .content-grid,
  .content-grid--2,
  .content-grid--3,
  .content-grid--4 {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .content-grid--members {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 18px;
  }

  .home-planner-filters {
    width: 100%;
    justify-content: stretch;
  }

  .home-planner-filter {
    width: 100%;
    min-width: 0;
  }

  .home-planner-filter-select {
    width: 100%;
  }

  .home-welcome-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .content-card-member-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .content-card-member-col--right {
    padding-left: 0;
    padding-top: 16px;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* TRACKING POSIZIONE */

  .tracking-posizione-card {
    padding: 18px;
  }

  .tracking-posizione-card .detail-section-head {
    margin-bottom: 18px;
  }

  .tracking-posizione-head-actions {
    width: 100%;
    padding-right: 0;
    justify-content: flex-start;
  }

  .tracking-posizione-status-header {
    width: 100%;
    max-width: 100%;
    min-height: 58px;
    padding: 15px 22px;
    font-size: 17px !important;
    line-height: 1.2 !important;
    font-weight: 500 !important;
    white-space: normal;
  }

  #tracking-posizione-status-badge {
    font-size: 17px !important;
    line-height: 1.2 !important;
    font-weight: 500 !important;
  }

  .tracking-posizione-card .tracking-dashboard-map,
  .tracking-posizione-card #trackingPosizioneMap,
  .tracking-posizione-card #trackingPosizioneMap.leaflet-container {
    height: 340px !important;
    min-height: 340px !important;
  }

  .tracking-posizione-card .tracking-map-overlay {
    right: 14px;
    bottom: 14px;
    left: 14px;
    min-width: 0;
    max-width: none;
  }

  .tracking-posizione-card .tracking-metrics-grid {
    grid-template-columns: 1fr;
  }

  .tracking-actions-row {
    flex-direction: column;
  }

  /* TRACKING STORICO */

  .tracking-storico-card {
    padding: 18px;
  }

  .tracking-storico-map-card,
  .tracking-storico-map,
  #trackingStoricoMap.leaflet-container {
    height: 340px !important;
    min-height: 340px;
  }

  .tracking-storico-video-bar {
    right: 10px;
    bottom: 10px;
    left: 10px;
    padding: 9px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .tracking-storico-video-range {
    order: 10;
    flex-basis: 100%;
    width: 100%;
  }

  .tracking-storico-video-time {
    min-width: auto;
    margin-left: auto;
  }

  .tracking-storico-map-empty {
    right: 14px;
    bottom: 14px;
    left: 14px;
    min-width: 0;
    max-width: none;
  }

  .tracking-storico-card .tracking-metrics-grid {
    grid-template-columns: 1fr;
  }

  /* TRACKING VIAGGIO */

  .tracking-viaggio-card {
    padding: 18px;
  }

  .tracking-viaggio-map-card,
  .tracking-viaggio-map,
  #trackingViaggioMap.leaflet-container {
    height: 340px !important;
    min-height: 340px;
  }

  .tracking-viaggio-video-bar {
    right: 10px;
    bottom: 10px;
    left: 10px;
    padding: 9px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .tracking-viaggio-video-range {
    order: 10;
    flex-basis: 100%;
    width: 100%;
  }

  .tracking-viaggio-video-time {
    min-width: auto;
    margin-left: auto;
  }

  .tracking-viaggio-map-empty {
    right: 14px;
    bottom: 14px;
    left: 14px;
    min-width: 0;
    max-width: none;
  }

  .tracking-viaggio-card .tracking-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* <= 575px */

@media (max-width: 575px) {
  .home-kpi-grid {
    grid-template-columns: 1fr;
  }

  .home-daytypes-body {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-released-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .home-released-status {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .tracking-metrics-grid {
    grid-template-columns: 1fr;
  }

  .tracking-map-overlay {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }

  .tracking-map-card,
  .tracking-dashboard-map,
  .tracking-map-card .leaflet-container {
    min-height: 360px;
  }

  .tracking-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .tracking-action-btn {
    width: 100%;
  }

  .tracking-posizione-card .tracking-dashboard-map,
  .tracking-posizione-card #trackingPosizioneMap,
  .tracking-posizione-card #trackingPosizioneMap.leaflet-container {
    height: 360px !important;
    min-height: 360px !important;
  }
}

/* =========================================================
   11. NOTIFICHE - RESPONSIVE
========================================================= */

@media (max-width: 991px) {
  .notifiche-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notifiche-detail-head-actions {
    width: 100%;
  }

  .notifiche-detail-back-btn {
    width: 100%;
  }

  .notifiche-toolbar-read-actions {
    justify-content: flex-start;
    margin-left: 0;
    flex-basis: 100%;
  }

  .notifica-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575px) {
  .notifiche-filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .notifiche-filter-card {
    min-height: 86px;
    padding: 12px;
    gap: 10px;
  }

  .notifiche-filter-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex-basis: 38px;
  }

  .notifiche-filter-icon i {
    font-size: 21px;
  }

  .notifiche-filter-value {
    margin-top: 4px;
    font-size: 22px;
  }

  .notifiche-filter-card--type {
    grid-column: 1 / -1;
  }

  .notifiche-toolbar-secondary {
    align-items: stretch;
  }

  .notifiche-toolbar-actions,
  .notifiche-toolbar-read-actions {
    width: 100%;
  }

  .notifiche-toolbar-read-actions {
    margin-left: 0;
  }

  .notifiche-toolbar-btn--primary {
    width: 100%;
  }

  .notifica-detail-card {
    padding: 18px;
  }

  .notifica-detail-hero {
    align-items: flex-start;
    gap: 13px;
  }

  .notifica-detail-icon.notification-type-icon {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    flex-basis: 48px;
  }

  .notifica-detail-title {
    font-size: 20px;
  }

  .notifica-detail-meta-card {
    min-height: 70px;
    padding: 16px;
  }

  .notifica-detail-content-head {
    align-items: flex-start;
  }

  .notifica-detail-body {
    min-height: 90px;
    padding: 18px;
  }
}

/* =========================================================
   12. IMBARCAZIONI - TABELLE / CHECKLIST / TRACKING
   Regole migrate dagli <style> dei singoli tab e dal CSS
   generato via JavaScript. La specificita con body mantiene
   la precedenza sui relativi stili base caricati nel markup.
========================================================= */

@media (max-width: 991px) {
  body .member-comember-person {
    min-width: 180px;
  }
}

@media (max-width: 767px) {
  body .ui-checklist-overlay {
    padding: 8px;
  }

  body .ui-checklist-modal {
    width: 100%;
    height: 96vh;
    border-radius: 14px;
  }

  body .ui-checklist-modal-head {
    align-items: flex-start;
    padding: 14px;
  }

  body .ui-checklist-modal-body {
    padding: 10px;
  }

  body .ui-checklist-document-viewer,
  body .ui-checklist-document-frame,
  body .ui-checklist-document-fallback {
    min-height: 430px;
  }

  body .tracking-viaggio-legend {
    margin-bottom: 72px !important;
    margin-right: 8px !important;
  }

  body .tracking-viaggio-legend-box {
    max-width: 150px;
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* =========================================================
   13. PLANNER - MONTH / YEAR / DAY / DRAWER
   Regole migrate da module/planner/assets/css/calendario.css.
========================================================= */

@media (min-width: 1550px) {
  .planner-year-calendar .fc-multimonth {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 992px) and (max-width: 1549px) {
  .planner-day-actions-panel {
    justify-content: flex-start;
  }

  .planner-day-actions-panel__info {
    width: 100%;
    flex: 0 0 100%;
    text-align: left;
  }

  .planner-day-actions-panel__buttons {
    width: 100%;
    flex: 0 0 100%;
    justify-content: center;
  }
}

@media (max-width: 991px) {

  .planner-month-title,
  .planner-day-title {
    font-size: 26px;
  }

  .planner-month-calendar-wrap {
    min-height: 640px;
    padding: 14px;
  }

  .planner-month-calendar .fc-daygrid-day {
    min-height: 98px;
  }

  .planner-day-main-grid,
  .planner-day-assignment-grid {
    grid-template-columns: 1fr;
  }

  .planner-day-empty-state,
  .planner-empty-state {
    flex-direction: column;
    text-align: center;
  }

  .planner-day-actions-panel {
    align-items: stretch;
  }

  .planner-day-actions-panel__buttons {
    width: 100%;
    justify-content: flex-start;
  }

  .planner-page-card {
    padding: 22px 20px 24px;
  }

  .planner-toolbar {
    align-items: stretch;
  }

  .planner-toolbar-left,
  .planner-toolbar-right {
    width: 100%;
  }

  .planner-toolbar-right {
    justify-content: flex-start;
  }

  .planner-filter-group {
    min-width: 160px;
  }

  .planner-view-switch-btn {
    min-width: 98px;
  }

  .planner-year-calendar .fc-daygrid-day {
    min-height: 72px;
  }

  .planner-year-legend--assignments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {

  .planner-month-headbar,
  .planner-day-headbar {
    grid-template-columns: 44px 1fr 44px;
  }

  .planner-day-headbar {
    gap: 10px;
  }

  .planner-month-nav-btn,
  .planner-day-nav-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 14px;
  }

  .planner-month-title,
  .planner-day-title {
    font-size: 22px;
  }

  .planner-month-calendar-wrap {
    min-height: 520px;
    padding: 10px;
    border-radius: 18px;
  }

  .planner-month-calendar .fc-col-header-cell-cushion {
    padding: 10px 2px !important;
    font-size: 11px !important;
  }

  .planner-month-calendar .fc-daygrid-day {
    min-height: 84px;
  }

  .planner-month-calendar .planner-event-label {
    padding: 4px 6px;
    font-size: 11px;
  }

  .planner-day-main-card,
  .planner-day-notes-card,
  .planner-day-assignment-card {
    padding: 16px;
    border-radius: 18px;
  }

  .planner-day-slot-badge {
    min-width: 78px;
    min-height: 40px;
    font-size: 19px;
  }

  .planner-day-color-chip {
    width: 46px;
    height: 40px;
  }

  .planner-day-info-card__value,
  .planner-day-assignment-item__value {
    font-size: 16px;
  }

  .planner-day-notes-card__title,
  .planner-day-assignment-card__title {
    font-size: 18px;
  }

  .planner-day-actions-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .planner-day-action-btn,
  .planner-day-notes-save-btn {
    width: 100%;
    justify-content: center;
  }

  .planner-page-card {
    padding: 18px 16px 20px;
  }

  .planner-toolbar-left {
    gap: 12px;
  }

  .planner-filter-group {
    width: 100%;
    min-width: 0;
  }

  .planner-view-switch {
    width: 100%;
    justify-content: space-between;
  }

  .planner-view-switch-btn {
    min-width: 0;
    flex: 1 1 0;
    padding: 0 10px;
  }

  .planner-section-card {
    padding: 18px;
    border-radius: 18px;
  }

  .planner-section-title {
    font-size: 22px;
  }

  .planner-placeholder-box {
    min-height: 300px;
  }

  .planner-placeholder-box--tall {
    min-height: 380px;
  }

  .planner-calendar-loader__inner {
    padding: 10px 14px;
    font-size: 13px;
  }

  .planner-year-calendar .fc-multimonth {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
  }

  .planner-year-calendar .fc-multimonth-month {
    padding: 10px;
    border-radius: 18px;
  }

  .planner-year-calendar .fc-multimonth-title {
    padding: 2px 0 10px !important;
    font-size: 15px !important;
  }

  .planner-year-calendar .fc-daygrid-day {
    min-height: 62px;
  }

  .planner-year-calendar .planner-event-label {
    font-size: 11px;
  }

  .planner-year-calendar .planner-release-badge {
    width: 28px;
    height: 28px;
    border-width: 2px;
    font-size: 17px;
  }

  .planner-month-calendar .planner-release-badge {
    width: 34px;
    height: 34px;
    border-width: 2px;
    font-size: 20px;
  }

  .planner-day-notes-card__head--with-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .drawer-form-grid--2 {
    grid-template-columns: 1fr;
  }

  .planner-drawer-table {
    min-width: 820px;
  }

  .planner-year-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 575px) {
  .planner-year-legend--assignments {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   14. PRENOTAZIONI - PUBBLICO / ADMIN
   Regole migrate da prenotazioni.css e dalla pagina pubblica.
   Le soglie legacy 980/900/800/720/480 sono ricondotte ai
   breakpoint standard 991/767/575.
========================================================= */

@media (max-width: 991px) {

  .booking-package-grid,
  .booking-checkout {
    grid-template-columns: 1fr;
  }

  .booking-package-card {
    min-height: 0;
  }

  .booking-summary__sticky {
    position: static;
  }

  .booking-admin-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .booking-calendar-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .booking-calendar-range {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .booking-calendar-nav {
    grid-row: 2;
    padding-inline: 10px;
    font-size: .76rem;
  }

  .booking-footer .booking-shell,
  .booking-footer__main {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

  .booking-footer__social {
    justify-content: center;
  }

  .booking-footer__bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .booking-footer__powered,
  .booking-footer__policies {
    white-space: normal;
  }

  .booking-footer__policies {
    margin-left: 0 !important;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 767px) {
  .booking-shell {
    width: min(100% - 22px, 1180px);
  }

  .booking-hero {
    min-height: 520px;
  }

  .booking-hero__copy {
    padding: 74px 0 110px;
  }

  .booking-hero h1 {
    font-size: clamp(3rem, 15vw, 4.6rem);
  }

  .booking-main {
    margin-top: -34px;
  }

  .booking-calendar,
  .booking-form-grid,
  .booking-success-details {
    grid-template-columns: 1fr;
  }

  .booking-field--full {
    grid-column: auto;
  }

  .booking-slot {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .booking-slot__price,
  .booking-slot__availability {
    grid-column: 2;
  }

  .booking-footer .booking-shell {
    flex-direction: column;
  }
}

@media (max-width: 575px) {
  .booking-brand__name {
    font-size: .9rem;
  }

  .booking-hero__facts {
    align-items: flex-start;
    flex-direction: column;
  }

  .booking-packages,
  .booking-checkout__main,
  .booking-summary__sticky {
    border-radius: 22px;
  }

  .booking-month {
    padding: 12px;
  }

  .booking-month__weekdays,
  .booking-month__days {
    gap: 4px;
  }

  .booking-day {
    min-height: 58px;
    border-radius: 9px;
  }

  .booking-day__status {
    font-size: .42rem;
  }

  .booking-admin-filters {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   15. LOGIN / AUTH - RESPONSIVE
   Pagina standalone: module/login/login.php
========================================================= */

@media (max-width: 1199px) {
  body.auth-login-page .auth-content {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
    padding: 28px;
    gap: 28px;
  }

  body.auth-login-page .auth-hero-title {
    font-size: clamp(38px, 4.4vw, 56px);
  }

  body.auth-login-page .auth-form-title {
    font-size: 38px;
  }
}

@media (max-width: 991px) {
  body.auth-login-page .auth-content {
    grid-template-columns: 1fr;
    align-items: stretch;
    align-content: start;
    gap: 18px;
    padding: 20px 16px calc(26px + env(safe-area-inset-bottom));
  }

  body.auth-login-page .auth-hero {
    align-items: flex-start;
    min-height: 0;
  }

  body.auth-login-page .auth-hero-inner {
    max-width: 100%;
    padding: 0;
  }

  body.auth-login-page .auth-hero-title {
    margin-bottom: 10px;
    font-size: 36px;
    line-height: 1.08;
  }

  body.auth-login-page .auth-hero-text {
    max-width: 100%;
    font-size: 17px;
    line-height: 1.4;
  }

  body.auth-login-page .auth-panel-wrap {
    align-items: flex-start;
  }

  body.auth-login-page .auth-panel-stack {
    max-width: 430px;
    margin: 0 auto;
  }

  body.auth-login-page .auth-brand-outside {
    margin-bottom: 12px;
  }

  body.auth-login-page .auth-brand-logo--full {
    width: min(100%, 270px);
    max-height: 80px;
  }

  body.auth-login-page .auth-panel {
    max-width: 100%;
    padding: 24px 20px 22px;
    border-radius: 20px;
  }

  body.auth-login-page .auth-form-title {
    margin-bottom: 20px;
    font-size: 31px;
  }

  body.auth-login-page .auth-field {
    margin-bottom: 15px;
  }

  body.auth-login-page .auth-label {
    margin-bottom: 7px;
  }

  body.auth-login-page .auth-input {
    height: 54px;
    line-height: 54px;
  }

  body.auth-login-page .auth-toggle-pass {
    right: 4px;
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  body.auth-login-page .auth-actions {
    margin-bottom: 15px;
  }

  body.auth-login-page .auth-submit {
    height: 54px;
  }
}

@media (max-width: 575px) {
  body.auth-login-page .auth-bg-overlay {
    background:
      linear-gradient(180deg,
        rgba(4, 8, 15, 0.48) 0%,
        rgba(4, 8, 15, 0.30) 45%,
        rgba(4, 8, 15, 0.48) 100%);
  }

  body.auth-login-page .auth-content {
    gap: 12px;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  }

  body.auth-login-page .auth-hero-title {
    margin-bottom: 7px;
    font-size: 31px;
  }

  body.auth-login-page .auth-hero-text {
    font-size: 15.5px;
    line-height: 1.36;
  }

  body.auth-login-page .auth-panel-stack {
    max-width: 100%;
  }

  body.auth-login-page .auth-brand-outside {
    margin-bottom: 8px;
  }

  body.auth-login-page .auth-brand-outside--logo-only {
    padding: 0 6px;
  }

  body.auth-login-page .auth-brand-logo--full {
    width: min(100%, 220px);
    max-height: 64px;
  }

  body.auth-login-page .auth-panel {
    padding: 20px 18px 18px;
    border-radius: 20px;
  }

  body.auth-login-page .auth-form-title {
    margin-bottom: 16px;
    font-size: 29px;
  }

  body.auth-login-page .auth-field {
    margin-bottom: 12px;
  }

  body.auth-login-page .auth-label {
    margin-bottom: 6px;
    font-size: 14px;
  }

  body.auth-login-page .auth-input {
    height: 52px;
    padding-left: 16px;
    padding-right: 50px;
    line-height: 52px;
    font-size: 16px;
  }

  body.auth-login-page .auth-toggle-pass {
    color: rgba(255, 255, 255, 0.55);
  }

  body.auth-login-page .auth-actions {
    margin-bottom: 12px;
  }

  body.auth-login-page .auth-forgot-link,
  body.auth-login-page .auth-secondary-link {
    font-size: 14px;
  }

  body.auth-login-page .auth-submit {
    height: 52px;
    font-size: 17px;
  }

  body.auth-login-page #authRecoverView .auth-submit {
    height: auto;
    min-height: 52px;
    padding: 11px 14px;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
  }

  body.auth-login-page .auth-info-box {
    margin-bottom: 12px;
    padding: 12px 14px;
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  body.auth-login-page .auth-content {
    gap: 10px;
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  }

  body.auth-login-page .auth-hero-title {
    margin-bottom: 6px;
    font-size: 29px;
  }

  body.auth-login-page .auth-hero-text {
    font-size: 15px;
  }

  body.auth-login-page .auth-brand-outside {
    margin-bottom: 7px;
  }

  body.auth-login-page .auth-brand-logo--full {
    width: min(100%, 205px);
    max-height: 60px;
  }

  body.auth-login-page .auth-panel {
    padding: 18px 16px 16px;
    border-radius: 18px;
  }

  body.auth-login-page .auth-form-title {
    margin-bottom: 15px;
    font-size: 28px;
  }

  body.auth-login-page #authRecoverView .auth-form-title {
    font-size: 26px;
  }
}

@media (max-width: 575px) and (max-height: 700px) {
  body.auth-login-page .auth-content {
    gap: 8px;
    padding-top: 12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  body.auth-login-page .auth-hero-title {
    margin-bottom: 5px;
    font-size: 27px;
    line-height: 1.05;
  }

  body.auth-login-page .auth-hero-text {
    font-size: 14.5px;
    line-height: 1.3;
  }

  body.auth-login-page .auth-brand-outside {
    margin-bottom: 5px;
  }

  body.auth-login-page .auth-brand-logo--full {
    width: min(100%, 190px);
    max-height: 56px;
  }

  body.auth-login-page .auth-panel {
    padding-top: 16px;
    padding-bottom: 15px;
  }

  body.auth-login-page .auth-form-title {
    margin-bottom: 13px;
    font-size: 26px;
  }

  body.auth-login-page #authRecoverView .auth-form-title {
    font-size: 24px;
  }

  body.auth-login-page .auth-field {
    margin-bottom: 10px;
  }

  body.auth-login-page .auth-actions {
    margin-bottom: 10px;
  }

  body.auth-login-page .auth-info-box {
    margin-bottom: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 1.35;
  }
}

/* =========================================================
   16. AUTH SECONDARIO - CONSENSO / MODIFICA PASSWORD
   Regole migrate dagli <style> inline delle pagine standalone.
========================================================= */

@media (max-width: 767px) {

  .consent-card__header,
  .password-card__header {
    padding: 22px 18px 18px;
  }

  .consent-card__body,
  .password-card__body {
    padding: 18px 18px 22px;
  }

  .consent-card__title,
  .password-card__title {
    font-size: 28px;
  }

  .consent-section__text {
    min-height: 220px;
  }

  .consent-actions,
  .password-actions {
    flex-direction: column;
  }

  .consent-btn,
  .password-btn {
    width: 100%;
  }

  .consent-topbar,
  .password-topbar {
    margin-bottom: 12px;
  }
}


/* =========================================================
   17. HOME / NAVBAR / SWEETALERT - MOBILE REFINEMENTS
   Rifiniture validate sugli screenshot mobile reali.
========================================================= */

@media (max-width: 575px) {

  /* Toggle tema: una sola icona deve occupare il touch target. */
  #layoutNavbarThemeToggle.layout-navbar-theme-toggle {
    position: relative !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    overflow: hidden !important;
  }

  #layoutNavbarThemeToggle .layout-navbar-theme-icon {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    width: 22px !important;
    height: 22px !important;
    transform: translate(-50%, -50%) !important;
    pointer-events: none !important;
  }

  #layoutNavbarThemeToggle .layout-navbar-theme-icon-sun {
    display: block !important;
    opacity: 1 !important;
  }

  #layoutNavbarThemeToggle .layout-navbar-theme-icon-moon {
    display: none !important;
    opacity: 0 !important;
  }

  html.theme-light #layoutNavbarThemeToggle .layout-navbar-theme-icon-sun {
    display: none !important;
    opacity: 0 !important;
  }

  html.theme-light #layoutNavbarThemeToggle .layout-navbar-theme-icon-moon {
    display: block !important;
    opacity: 1 !important;
  }

  /* CTA tracking: resta compatta ma non puo uscire dal viewport. */
  .home-dashboard-hero .home-welcome-actions .ui-btn {
    width: auto !important;
    max-width: 100% !important;
    min-height: 48px;
    height: auto !important;
    padding: 9px 18px !important;
    white-space: normal;
    text-align: center;
  }

  .home-dashboard-hero .home-welcome-actions .ui-btn>span {
    line-height: 1.18 !important;
  }

  /* Select home: rimuove la freccia nativa iOS e usa una chevron leggibile. */
  .home-planner-filter-select {
    -webkit-appearance: none !important;
    appearance: none !important;
    color-scheme: dark;
    padding-right: 46px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 8 4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 17px center !important;
    background-size: 16px 16px !important;
  }

  body.theme-light .home-planner-filter-select {
    color-scheme: light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 8 4 4 4-4'/%3E%3C/svg%3E") !important;
  }

  /* KPI: elimina le altezze desktop e conserva una riga compatta. */
  .home-kpi-card {
    min-height: 0;
    gap: 14px;
    padding: 15px 16px;
    border-radius: 18px;
  }

  .home-kpi-icon {
    width: 52px;
    height: 52px;
    font-size: 27px;
  }

  .home-kpi-content {
    grid-template-rows: auto auto auto;
    gap: 3px;
    align-items: start;
  }

  .home-kpi-label {
    min-height: 0;
    align-items: center;
    margin: 0;
    font-size: 12px;
    line-height: 1.22;
  }

  .home-kpi-value {
    font-size: 31px;
    line-height: 1;
  }

  .home-kpi-sub {
    font-size: 12.5px;
    line-height: 1.2;
  }

  /* Report: card e distribuzione giorno piu adatte alla colonna mobile. */
  .home-report-card {
    padding: 18px;
  }

  .home-daytypes-body {
    width: 100%;
    max-width: 100%;
    align-items: stretch;
    gap: 18px;
  }

  .home-daytypes-donut {
    width: 116px;
    height: 116px;
    margin: 0 auto;
  }

  .home-daytypes-donut::after {
    inset: 31px;
  }

  .home-daytypes-list {
    width: 100%;
    min-width: 0;
    gap: 9px;
  }

  .home-daytypes-row {
    width: 100%;
    grid-template-columns: 12px minmax(70px, 1fr) auto;
    gap: 8px;
    font-size: 13px;
  }

  .home-daytypes-chart {
    width: 100%;
    max-width: 100%;
    margin-top: 18px;
    padding-top: 14px;
  }

  /* Giorni rilasciati: titolo e descrizione non competono sulla stessa riga. */
  .home-report-card--released-days .home-report-card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 14px;
  }

  .home-released-empty {
    padding: 16px 14px;
  }

  .home-released-item {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px 12px;
    padding: 10px 12px;
  }

  .home-released-status-wrap {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-start;
  }

  /* Member / Comember: stesso layout, meno spazio verticale. */
  .home-member-report-grid {
    gap: 14px;
    margin-top: 16px;
  }

  .home-member-report-card {
    gap: 8px;
    padding: 8px;
    border-radius: 18px;
  }

  .home-member-report-row {
    padding: 14px;
    border-radius: 14px;
  }

  .home-member-report-row--top {
    gap: 12px;
  }

  .home-member-report-people {
    width: 100%;
    min-height: 0;
    gap: 10px;
  }

  .home-member-report-progress {
    width: 100%;
  }

  .home-member-report-circle {
    width: 86px;
    height: 86px;
    margin-bottom: 8px;
  }

  .home-member-report-circle span {
    width: 66px;
    height: 66px;
  }

  .home-member-report-section-title {
    margin-bottom: 8px;
    font-size: 15px;
  }

  .home-member-report-contract-line,
  .home-member-report-dates {
    font-size: 13px;
    line-height: 1.4;
  }

  .home-member-report-dates {
    margin-top: 6px;
    gap: 8px;
  }

  .home-member-report-credits-grid {
    gap: 8px;
    margin-top: 8px;
  }

  .home-credit-box {
    padding: 11px 6px;
    border-radius: 12px;
  }

  .home-credit-box strong {
    margin-top: 6px;
    font-size: 22px;
  }

  /* SweetAlert globale: popup piu proporzionato allo smartphone. */
  .swal2-popup.thcs-swal-popup {
    width: calc(100% - 32px) !important;
    max-width: 420px !important;
    padding: 18px 16px 16px !important;
    border-radius: 18px !important;
  }

  .swal2-popup.thcs-swal-popup .swal2-title {
    margin: 0 !important;
    padding: 0 4px !important;
    font-size: 25px !important;
    line-height: 1.15 !important;
  }

  .swal2-popup.thcs-swal-popup .swal2-html-container {
    margin: 12px 0 0 !important;
    padding: 0 4px !important;
    font-size: 14px !important;
    line-height: 1.42 !important;
    overflow: visible !important;
  }

  .swal2-popup.thcs-swal-popup lottie-player {
    width: 92px !important;
    height: 92px !important;
    margin: 0 auto !important;
  }

  .swal2-popup.thcs-swal-popup .swal2-html-container p,
  .swal2-popup.thcs-swal-popup p {
    margin: 6px 0 0 !important;
    font-size: 14px !important;
    line-height: 1.42 !important;
  }

  .swal2-popup.thcs-swal-popup .swal2-actions.thcs-swal-actions-equal {
    width: 100%;
    margin: 16px 0 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px;
  }

  .swal2-popup.thcs-swal-popup .swal2-actions .thcs-swal-btn-equal {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 44px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    font-size: 14px !important;
  }
}

@media (max-width: 420px) {

  /* Sottomenu sidebar: meno indentazione senza ridurre le voci principali. */
  .layout-submenu {
    margin: 4px 0 8px;
    padding: 4px 0 0 28px;
  }

  .layout-submenu-item {
    margin-bottom: 2px;
  }

  .layout-submenu-link {
    padding: 7px 10px;
    gap: 8px;
  }

  .layout-submenu-icon {
    width: 18px;
    min-width: 18px;
  }

  .layout-submenu-icon i {
    font-size: 16px;
  }

  /* Hero home. */
  .home-welcome-title {
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -0.2px;
  }

  .home-welcome-access {
    gap: 6px;
    font-size: 14px;
  }

  .home-dashboard-hero .home-welcome-actions .ui-btn {
    padding-left: 15px !important;
    padding-right: 15px !important;
    font-size: 14px;
  }

  .home-tracking-button-icon {
    width: 26px;
    height: 26px;
  }

  /* KPI ancora leggermente piu compatti sui telefoni stretti. */
  .home-kpi-card {
    gap: 13px;
    padding: 14px 15px;
  }

  .home-kpi-icon {
    width: 50px;
    height: 50px;
    font-size: 26px;
  }

  .home-kpi-value {
    font-size: 30px;
  }

  /* Grafico mensile: etichette e barre non devono collidere. */
  .home-daytypes-chart-line {
    gap: 3px;
  }

  .home-daytypes-chart-line span {
    width: 6px;
  }

  .home-daytypes-chart-labels {
    gap: 2px;
    font-size: 9px;
  }

  .home-daytypes-row {
    font-size: 12.5px;
  }

  .home-daytypes-row small {
    font-size: 10.5px;
  }

  .home-credit-box {
    padding: 10px 4px;
  }

  .home-credit-box span {
    font-size: 12px;
    line-height: 1.2;
  }
}

@media (max-width: 360px) {
  .swal2-popup.thcs-swal-popup .swal2-actions.thcs-swal-actions-equal {
    flex-direction: column !important;
  }

  .swal2-popup.thcs-swal-popup .swal2-actions .thcs-swal-btn-equal {
    width: 100% !important;
  }
}

/* =========================================================
   16. CHAT - RESPONSIVE
========================================================= */

@media (max-width: 991.98px) {
  .chat-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-workspace {
    grid-template-columns: 1fr;
  }

  .chat-conversation-panel {
    display: none;
  }

  .chat-list-panel {
    border-right: 0;
  }
}

@media (max-width: 767.98px) {
  .chat-active-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 575.98px) {
  .chat-page-card .main-card-head {
    padding-left: 12px;
    padding-right: 12px;
  }

  .chat-filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 12px 14px;
  }

  .chat-filter-card {
    min-height: 78px;
    padding: 12px;
  }

  .chat-filter-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .chat-filter-value {
    font-size: 21px;
  }

  .chat-workspace {
    margin: 0 12px 14px;
  }
}