/* APS base theme; FMD branding and search integration only. */
.crm-customer-search-results{position:fixed;z-index:1052;overflow:auto;padding:8px;background:#fff;color:#17213d;border:1px solid #dce1ee;border-radius:12px;box-shadow:0 12px 32px #10183330}
.crm-customer-search-results .crm-search-status{margin:6px 8px;font-size:12px;color:#5f6880}
.crm-customer-search-results .crm-search-result{display:flex;flex-direction:column;gap:4px;text-align:left;width:100%;padding:11px 10px;border:0;border-radius:7px;background:#fff;color:#17213d;cursor:pointer}
.crm-customer-search-results .crm-search-result:hover,.crm-customer-search-results .crm-search-result:focus{background:#f0efff;outline:2px solid #b7b1e7;outline-offset:-2px}
.crm-customer-search-results .crm-search-result span{font-size:12px;color:#626981}
.fmd-logo{width:30px;height:30px;object-fit:contain;margin-right:10px}
/* Keep the APS layout within the viewport, including wide customer tables. */
.fmd-crm #topMenu,.fmd-crm #content,.fmd-crm .content-box{min-width:0}
.fmd-crm .table-responsive{display:block;width:100%;overflow-x:auto}
.fmd-crm #webMenu{position:fixed;inset:0 auto 0 0;width:260px;max-height:100vh;max-height:100dvh;overflow-y:auto;overscroll-behavior:contain;z-index:1030}
.fmd-crm #topMenu{margin-left:260px}
.fmd-crm .top-bar .fancy-selector-w{width:auto!important;flex:1 1 auto;min-width:0}
.fmd-crm .top-bar .fs-name{white-space:normal}
.fmd-crm .top-menu-controls{flex-shrink:0}
.fmd-crm .crm-version-footer{left:272px}
@media(max-width:1024px){.fmd-crm #webMenu{display:none!important}.fmd-crm #topMenu{margin-left:0!important;width:100%!important;max-width:100vw!important}.fmd-crm .crm-version-footer{left:12px}.fmd-crm .top-bar{flex-wrap:wrap;gap:6px;padding:10px 12px!important;height:auto!important}.fmd-crm .top-menu-controls{margin-left:auto}}
.fmd-crm #mobileMenu{position:sticky;top:0;z-index:1045;width:100%}
.fmd-crm #mobileMenu .mm-logo-buttons-w{display:flex;align-items:center;justify-content:space-between;padding:10px 14px!important;min-height:54px}
.fmd-crm #mobileMenu .mm-logo{display:inline-flex;align-items:center;font-weight:700;font-size:15px}
.fmd-crm #mobileMenu .mobile-menu-trigger{display:inline-flex;align-items:center;justify-content:center;min-width:42px;min-height:42px;border-radius:8px;cursor:pointer}
.fmd-crm #mobileMenu .menu-and-user{max-height:calc(100dvh - 56px);overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;box-shadow:0 16px 36px rgba(15,23,42,.28)}
#fmdMobileNavigation{padding:10px 14px 24px}
#fmdMobileNavigation a,#fmdMobileNavigation summary{display:flex;align-items:center;gap:8px;padding:12px 10px;color:inherit;border-bottom:1px solid rgba(229,233,240,.18);cursor:pointer;text-decoration:none;font-size:14px;line-height:1.35;border-radius:6px}
#fmdMobileNavigation a:active,#fmdMobileNavigation summary:active{background:rgba(255,255,255,.1)}
#fmdMobileNavigation details>a{padding-left:28px;font-size:13.5px;opacity:.92}
#fmdMobileNavigation .icon-w{display:inline-flex;align-items:center;justify-content:center;width:22px;margin-right:4px;flex-shrink:0}
#fmdMobileNavigation summary{font-weight:600;list-style:none;justify-content:space-between}
#fmdMobileNavigation summary::-webkit-details-marker{display:none}
#fmdMobileNavigation summary::after{content:'▾';font-size:12px;opacity:.75;transition:transform .15s ease}
#fmdMobileNavigation details[open]>summary::after{transform:rotate(180deg)}

/* ===== FULL MOBILE & TABLET RESPONSIVENESS (<= 768px) ===== */
@media(max-width:768px){
  html,body.fmd-crm{max-width:100vw!important;overflow-x:hidden!important}
  .fmd-crm .all-wrapper,.fmd-crm .layout-w,.fmd-crm .content-w,.fmd-crm .content-i{max-width:100vw!important;overflow-x:hidden!important;padding:0!important}
  .fmd-crm .content-box{padding:10px 8px 28px!important;max-width:100vw!important;overflow-x:hidden!important}
  .fmd-crm .element-wrapper{padding-bottom:14px!important}
  .fmd-crm .element-box,.fmd-crm .element-box-tp{padding:12px 10px!important;border-radius:10px}
  .fmd-crm .element-wrapper .element-actions{float:none!important;position:static!important;display:flex!important;flex-wrap:wrap;gap:6px;margin-bottom:10px;width:100%}
  .fmd-crm .element-wrapper .element-actions.d-none.d-sm-block{display:flex!important}
  .fmd-crm .element-wrapper .element-actions .btn,.fmd-crm .element-wrapper .element-actions select{flex:1 1 auto}

  /* Top Bar & Fancy Selectors on Mobile */
  .fmd-crm #topMenu .top-bar{display:flex!important;flex-wrap:wrap!important;align-items:stretch!important;gap:6px!important;padding:8px!important}
  .fmd-crm #topMenu .top-bar .fancy-selector-w{flex:1 1 calc(50% - 6px)!important;min-width:calc(50% - 6px)!important;max-width:calc(50% - 3px)!important;margin:0!important}
  .fmd-crm #topMenu .top-bar .fancy-selector-current{padding:7px 10px!important;border-radius:8px!important;display:flex;align-items:center;justify-content:space-between;width:100%}
  .fmd-crm #topMenu .top-bar .fancy-selector-current .fs-img{display:none!important}
  .fmd-crm #topMenu .top-bar .fancy-selector-current .fs-main-info{padding:0!important;min-width:0;flex:1}
  .fmd-crm #topMenu .top-bar .fancy-selector-current .fs-name{font-size:11px!important;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .fmd-crm #topMenu .top-bar .fancy-selector-current .fs-sub{font-size:10px!important}
  .fmd-crm #topMenu .top-bar .fancy-selector-trigger{padding-left:6px!important}
  .fmd-crm #topMenu .top-bar .fancy-selector-options{position:fixed!important;left:8px!important;right:8px!important;top:64px!important;width:auto!important;max-width:calc(100vw - 16px)!important;max-height:70dvh!important;overflow-y:auto!important;z-index:2050!important;border-radius:12px!important;box-shadow:0 20px 50px rgba(0,0,0,.38)!important}
  .fmd-crm #topMenu #NumaraSahibiMenuBtn{flex:1 1 100%!important;width:100%!important;margin:0!important;justify-content:center!important;padding:8px 12px!important;border-radius:8px!important}
  .fmd-crm #topMenu .top-menu-controls{flex:1 1 100%!important;width:100%!important;margin:0!important;display:flex!important;align-items:center;gap:8px;justify-content:space-between}
  .fmd-crm #topMenu .top-menu-controls .element-search{flex:1 1 auto!important;width:auto!important;margin:0!important}
  .fmd-crm #topMenu .top-menu-controls .element-search input{width:100%!important;height:38px!important;font-size:15px!important;border-radius:8px!important;padding:6px 12px 6px 32px!important}

  /* Customer Search Results Dropdown */
  .crm-customer-search-results{left:8px!important;right:8px!important;width:auto!important;max-width:calc(100vw - 16px)!important;max-height:65dvh!important}

  /* DataTables & Scrollable Tables */
  .fmd-crm .table-responsive{overflow-x:auto!important;-webkit-overflow-scrolling:touch;max-width:100%!important}
  .fmd-crm .dataTables_wrapper .row{margin-left:0!important;margin-right:0!important}
  .fmd-crm .dataTables_wrapper .col-sm-12,.fmd-crm .dataTables_wrapper .col-md-6,.fmd-crm .dataTables_wrapper .col-md-5,.fmd-crm .dataTables_wrapper .col-md-7{padding-left:0!important;padding-right:0!important}
  .fmd-crm .dataTables_wrapper .dataTables_length,.fmd-crm .dataTables_wrapper .dataTables_filter,.fmd-crm .dataTables_wrapper .dataTables_info,.fmd-crm .dataTables_wrapper .dataTables_paginate{float:none!important;text-align:left!important;width:100%!important;margin-bottom:8px!important}
  .fmd-crm .dataTables_wrapper .dataTables_filter label{width:100%!important;display:flex;align-items:center;gap:8px}
  .fmd-crm .dataTables_wrapper .dataTables_filter input{flex:1 1 auto;width:auto!important;margin-left:0!important;font-size:15px!important}
  .fmd-crm .dataTables_wrapper .dataTables_paginate ul.pagination{flex-wrap:wrap;justify-content:center;gap:2px}

  /* Bootstrap Modals */
  .fmd-crm .modal{padding-left:0!important;padding-right:0!important}
  .fmd-crm .modal-dialog{width:calc(100vw - 12px)!important;max-width:calc(100vw - 12px)!important;margin:6px auto!important}
  .fmd-crm .modal-content{border-radius:12px!important}
  .fmd-crm .modal-header{padding:12px 14px!important;flex-wrap:wrap;gap:6px}
  .fmd-crm .modal-body{padding:12px 10px!important;overflow-x:hidden}
  .fmd-crm .modal-footer{padding:10px 12px!important;flex-wrap:wrap;gap:6px}

  /* jBox Modals */
  .jBox-wrapper.jBox-Modal{max-width:100vw!important;padding:6px!important;box-sizing:border-box!important}
  .jBox-Modal .jBox-container{max-width:calc(100vw - 12px)!important;width:calc(100vw - 12px)!important;max-height:calc(100dvh - 16px)!important;display:flex!important;flex-direction:column!important;border-radius:10px!important}
  .jBox-Modal .jBox-title{padding:12px 14px!important;flex-shrink:0!important}
  .jBox-Modal .jBox-content{max-width:100%!important;width:100%!important;max-height:calc(100dvh - 76px)!important;overflow-y:auto!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch;padding:12px!important;box-sizing:border-box!important}

  /* SweetAlert2 on Mobile */
  .swal2-popup{width:calc(100vw - 20px)!important;max-width:calc(100vw - 20px)!important;padding:16px 14px!important}

  /* Select2 & Datetimepicker on Mobile */
  .select2-container{max-width:100%!important}
  .datetimepicker.dropdown-menu{max-width:calc(100vw - 16px)!important;overflow-x:auto}

  /* Floating Widgets (Appointment Card, LiveChat, QuickNote, Version Footer) */
  #crmAppointmentFloatingCard{right:8px!important;left:8px!important;bottom:64px!important;width:auto!important;max-width:calc(100vw - 16px)!important}
  #lc-floating-btn{bottom:12px!important;right:12px!important;padding:9px 14px!important;font-size:12px!important}
  .crm-version-footer{bottom:10px!important;left:8px!important;font-size:10px!important;padding:4px 8px!important;max-width:55vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
