/* =========================================================
   site-mobile.css
   Purpose: Mobile-first fixes for Power Pages portals
   Applies only to smaller screens (phones) unless noted.
   ========================================================= */
  
  
   .instructions {
    margin-bottom: 1vh;
}

/* -------------------------
   Global: phone breakpoint
   ------------------------- */
@media (max-width: 767px) {

  /* Base text sizing */
  body {
    font-size: 15px;
  }

  /* Prevent common overflow issues */
  img,
  video,
  iframe {
    max-width: 100%;
    height: auto;
  }

  /* -------------------------
     Navigation (Bootstrap)
     ------------------------- */
  .navbar-brand {
    font-size: 18px;
    line-height: 1.2;
  }

  /* If your theme uses the classic toggle button */
  .navbar-toggle {
    display: block;
  }

  /* -------------------------
     Forms (Basic Form / Entity Form)
     ------------------------- */
  .entity-form,
  .form-horizontal,
  form {
    margin: 0;
  }

  /* Make inputs full-width and prevent iOS zoom on focus */
  input,
  select,
  textarea,
  .form-control {
    width: 100%;
    max-width: 100%;
    font-size: 16px; /* iOS Safari zoom prevention */
    box-sizing: border-box;
  }


  /* -------------------------
     Entity Lists / Grids
     ------------------------- */
  .entity-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* =========================================================
   MODERN RESPONSIVE ENHANCEMENTS
   =========================================================
   This entire section can be commented out if issues arise.
   To disable: Wrap everything below in comment blocks.
   
   Note: CSS Variables are defined in template.css
   ========================================================= */

/* -------------------------
   Modern Typography System
   ------------------------- */
  h3.table-info.form-subgrid-heading {
    border-bottom: none !important;
  }
  
  /* Fix Flatpickr month/year header alignment */
  .flatpickr-months .flatpickr-month {
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: normal !important;
  }

  .flatpickr-current-month {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
  }

  .flatpickr-current-month .numInputWrapper {
    width: 8ch !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Flatpickr Time Section - Minimal fixes to prevent our CSS from interfering */
  /* Only override what's necessary to maintain proper spacing */
  .flatpickr-time {
    padding: 0 !important;
    margin: 0 !important;
  }

  .flatpickr-time input {
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  .flatpickr-time .numInputWrapper {
    margin: 0 !important;
  }

  .flatpickr-time .flatpickr-time-separator,
  .flatpickr-time .flatpickr-am-pm {
    margin: 0 !important;
  }

input#InsertButton {
  margin-left: 2ch;
}

input#UpdateButton{
  margin-left: 2ch;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Responsive Heading Sizes */
h1, .h1 {
  font-size: clamp(1.75rem, 4vw + 1rem, 2.5rem);
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
}

h2, .h2 {
  font-size: clamp(1.5rem, 3vw + 0.75rem, 2rem);
  line-height: 1.3;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

h3, .h3 {
  font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
  line-height: 1.4;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

h4, .h4 {
  font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.25rem);
  line-height: 1.4;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

p {
  margin-bottom: var(--spacing-md);
  line-height: 1.7;
}

/* -------------------------
   Enhanced Container & Layout
   ------------------------- */
.container,
.container-fluid {
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
}

@media (min-width: 768px) {
  .container,
  .container-fluid {
    padding-left: var(--spacing-lg);
    padding-right: var(--spacing-lg);
  }
}

.sectionBlockLayout {
  padding-top: var(--spacing-xl);
  padding-bottom: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

@media (min-width: 768px) {
  .sectionBlockLayout {
    margin-bottom: var(--spacing-2xl);
  }
}

.columnBlockLayout {
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  margin-top: 0px !important;
}

@media (min-width: 768px) {
  .columnBlockLayout {
    padding: var(--spacing-lg);
    margin-bottom: 0;
  }
}

/* -------------------------
   Modern Navigation Enhancements
   ------------------------- */
.navbar {
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.navbar-dark.static-top {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar-nav > li > a,
.navbar-nav > li.dropdown > a {
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  margin: 0 var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md) !important;
}

.navbar-nav > li > a:hover,
.navbar-nav > li.dropdown > a:hover {
  color: #000000 !important; /* Black text when orange background appears */
}

.navbar-toggler {
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  transition: all var(--transition-fast);
}



.navbar-toggler:hover {
  filter: brightness(0.95);
      background-color: #FF8400;
    border-color: #FF8400;
}

.navbar-toggler:focus {
  outline: 2px solid var(--portalThemeColor1, #407EC9);
  outline-offset: 2px;
  background-color: #FF8400;
  border-color: #FF8400;
}

/* Mobile Navigation Improvements */
@media (max-width: 991px) {
  .navbar-collapse {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .navbar-nav {
    gap: var(--spacing-xs);
  }
  
  .navbar-nav > li > a {
    padding: var(--spacing-md) var(--spacing-lg) !important;
    margin: var(--spacing-xs) 0;
    display: block;
    text-align: left;
  }
  
  /* Only navbar dropdowns should use static positioning on mobile */
  .navbar-nav .dropdown-menu {
    position: static !important;
    float: none;
    width: 100%;
    margin-top: var(--spacing-xs);
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: var(--shadow-md);
  }
}

/* -------------------------
   Enhanced Button Styles
   ------------------------- */
.btn,
.button1,
.button2 {
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-weight: 600;
  transition: all var(--transition-base);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  min-height: 44px; /* Touch-friendly */
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn:hover,
.button1:hover,
.button2:hover {
  box-shadow: var(--shadow-md);
  filter: brightness(0.95);
}

.btn:active,
.button1:active,
.button2:active {
  box-shadow: var(--shadow-sm);
  filter: brightness(0.9);
}

.btn:focus,
.button1:focus,
.button2:focus {
  outline: 2px solid var(--portalThemeColor1, #407EC9);
  outline-offset: 2px;
}

.btn-primary,
.button1 {
  background: linear-gradient(135deg, var(--portalThemeColor4, #FF8400) 0%, #ff9500 100%);
  border: none;
}

.btn-primary:hover,
.button1:hover {
  background: linear-gradient(135deg, #ff9500 0%, var(--portalThemeColor4, #FF8400) 100%);
}

.btn-secondary,
.button2 {
  border-width: 2px;
}

/* -------------------------
   Modern Form Enhancements
   ------------------------- */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
  border-radius: var(--radius-md);
  border: 2px solid #e0e0e0;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 1rem;
  transition: all var(--transition-fast);
  background-color: #fff;
  min-height: 44px; /* Touch-friendly */
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--portalThemeColor1, #407EC9);
  box-shadow: 0 0 0 3px rgba(64, 126, 201, 0.1);
}

.form-control:hover,
input:hover,
select:hover,
textarea:hover {
  border-color: #b0b0b0;
}

  .form-group {
  margin-bottom: var(--spacing-lg);
}

label {
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  display: block;
  color: #333;
}

/* -------------------------
   Enhanced Card & Container Styles
   ------------------------- */
.card,
.crmEntityFormView,
.entitylist {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid #e8e8e8;
  overflow: hidden;
  transition: all var(--transition-base);
  background-color: #fff;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: var(--spacing-lg);
  background-color: #f8f9fa;
  border-bottom: 1px solid #e8e8e8;
  font-weight: 600;
}

.card-body {
  padding: var(--spacing-lg);
}

/* -------------------------
   Responsive Tables & Entity Lists
   ------------------------- */
.table-responsive {
  overflow-x: visible !important;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table > thead > tr > th {
  background-color: #f8f9fa;
  font-weight: 600;
  padding: var(--spacing-md);
  border-bottom: 2px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table > tbody > tr > td {
  padding: var(--spacing-md);
  border-bottom: 1px solid #f0f0f0;
}

.table > tbody > tr:hover {
  background-color: #f8f9fa;
}

/* Mobile: Convert tables to cards with column headers */
@media (max-width: 767px) {
  .table-responsive {
    display: block;
  }
  
  html[dir=ltr] .crmEntityFormView .tab .tab-column {
    padding-left: 0 !important;
  }

  html[dir=ltr] .crmEntityFormView .actions .btn:first-child {
    margin-right: 5px;
    margin-left: 10px;
}

  .table,
  .table thead,
  .table tbody,
  .table th,
  .table td,
  .table tr {
    display: block;
  }
  
  .table thead {
    display: none;
  }
  
  .table tr {
    margin-bottom: var(--spacing-lg);
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    padding: var(--spacing-md) !important;
    background-color: #fff;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
  }
  
  /* Table cells with column headers on left */
  .table td {
    border: none;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    text-align: left;
    display: flex;
    align-items: flex-start;
    min-height: 2rem;
  }
  
  /* Column header label on the left */
  .table td:before {
    content: attr(data-label);
    font-weight: 600;
    color: #333;
    min-width: 120px;
    margin-right: var(--spacing-md);
    flex-shrink: 0;
  }
  
  /* Ensure cell content wraps properly */
  .table td > * {
    flex: 1;
    text-align: left;
  }
}

/* -------------------------
   Enhanced Image & Media
   ------------------------- */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
}

.columnBlockLayout img {
  margin-bottom: var(--spacing-md);
}

/* -------------------------
   Better Link Styles
   ------------------------- */
a:not(.btn):not(.button1):not(.button2) {
  color: var(--portalThemeColor1, #407EC9);
  text-decoration: none;

  transition: all var(--transition-fast);
}

a:not(.btn):not(.button1):not(.button2):hover {
  color: var(--portalThemeColor1, #407EC9); /* Keep blue on hover for visibility */
  border-bottom-color: currentColor;
  text-decoration: underline;
}

/* Fix: Link Text Disappearing on Click */
a:not(.btn):not(.button1):not(.button2):active,
a:not(.btn):not(.button1):not(.button2):visited,
a:not(.btn):not(.button1):not(.button2):focus {
  color: var(--portalThemeColor1, #407EC9);
}

a:not(.btn):not(.button1):not(.button2):active:hover,
a:not(.btn):not(.button1):not(.button2):visited:hover {
  color: var(--portalThemeColor1, #407EC9); /* Keep blue for visibility */
  text-decoration: underline;
}

.a.anchor-inherit-styles.anchor-text-decoration-underline.anchor-hover-color-color4 {
  color: var(--portalThemeColor4, #FF8400) !important;
}

.a.anchor-inherit-styles.anchor-text-decoration-underline.anchor-hover-color-color4:hover, 
.a.anchor-inherit-styles.anchor-text-decoration-underline.anchor-hover-color-color4:active, 
.a.anchor-inherit-styles.anchor-text-decoration-underline.anchor-hover-color-color4:focus,
.a.anchor-inherit-styles.anchor-text-decoration-underline.anchor-hover-color-color4:visited {
  color: var(--portalThemeColor4, #FF8400) !important;
}

/* Ensure links in cards maintain visibility */
.card a,
.table a,
.entitylist a {
  color: var(--portalThemeColor1, #407EC9) !important;
}

.card a:active,
.table a:active,
.entitylist a:active {
  color: var(--portalThemeColor1, #407EC9) !important;
}

/* -------------------------
   Enhanced Breadcrumbs
   ------------------------- */
.breadcrumb-container {
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-md);
  background-color: #f8f9fa;
  border-radius: var(--radius-md);
  border-bottom: 1px solid #e8e8e8;
}

.breadcrumb,
.pagesBreadcrumb {
  padding: var(--spacing-xs) 0;
  margin-bottom: 0;
  background-color: transparent;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.breadcrumb-item,
.breadcrumb > li {
  display: inline-flex;
  align-items: center;
}

.breadcrumb > li + li:before,
.pagesBreadcrumb > li + li:before {
  content: "›";
  padding: 0 var(--spacing-sm);
  color: #999;
}

.breadcrumb > li > a,
.breadcrumb-item > a,
.pagesBreadcrumb a {
  color: var(--portalThemeColor1, #407EC9) !important;
  text-decoration: none;
}

.breadcrumb > li > a:hover,
.breadcrumb-item > a:hover,
.pagesBreadcrumb a:hover {
  text-decoration: underline;
  color: var(--portalThemeColor4, #FF8400) !important;
}

.breadcrumb-item.active,
.breadcrumb > .active {
  color: #666666;
  font-weight: 500;
}

/* Mobile breadcrumbs */
@media (max-width: 767px) {
  .breadcrumb-container {
    padding: var(--spacing-sm) var(--spacing-md) !important;
    margin: var(--spacing-sm) var(--spacing-xs) !important;
    border-radius: var(--radius-md) !important;
  }
  
  .breadcrumb,
  .pagesBreadcrumb {
    font-size: 0.85rem !important;
    padding: var(--spacing-xs) 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    line-height: 1.5 !important;
  }
  
  .breadcrumb-item,
  .breadcrumb > li {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .breadcrumb-item + .breadcrumb-item::before,
  .breadcrumb > li + li:before,
  .pagesBreadcrumb > li + li:before {
    content: "/" !important;
    padding: 0 var(--spacing-xs) !important;
    color: #999 !important;
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
  }
  
  .breadcrumb > li > a,
  .breadcrumb-item > a,
  .breadcrumb-item.active,
  .breadcrumb > .active,
  .pagesBreadcrumb a {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    line-height: 1.5 !important;
    padding: 2px 0 !important;
    margin: 0 !important;
    justify-content: center;
  }
  
  /* Ensure proper spacing between items */
  .breadcrumb-item:not(:last-child),
  .breadcrumb > li:not(:last-child) {
    margin-right: 0 !important;
  }
}

/* -------------------------
   Enhanced Dropdown Menus (Consolidated)
   ------------------------- */

/* Basic dropdown styling - let Bootstrap handle positioning */
.dropdown-menu {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid #e8e8e8;
  padding: var(--spacing-xs) 0;
  background-color: #ffffff;
  min-width: 160px;
}

/* Dropdown items styling */
.dropdown-item,
.dropdown-menu > li > a {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
  color: var(--portalThemeColor1, #407EC9);
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background-color: #f0f0f0;
  color: var(--portalThemeColor1, #407EC9);
}

/* Fix dropdown list items */
.dropdown-menu > li {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* =========================================================
   FIX: Action Dropdown Menus - Prevent Clipping
   ========================================================= */

/* Ensure dropdown menus have proper positioning and z-index to overflow containers */
.entitylist .dropdown-menu,
.entitylist table .dropdown-menu,
.entitylist .btn-group .dropdown-menu,
table .dropdown-menu,
.entitylist .action + .dropdown-menu {
  position: absolute !important;
  z-index: 1050 !important; /* Higher than Bootstrap default */
  overflow: visible !important;
}

/* Ensure dropdown toggle buttons maintain proper alignment */
.entitylist .action,
.entitylist table .action,
table .action {
  vertical-align: middle !important;
}

/* Action button containers in table cells */
.entitylist table td .btn-group,
.entitylist table td .dropdown,
table td .btn-group,
table td .dropdown {
  vertical-align: middle !important;
  display: inline-block !important;
}

/* -------------------------
   Responsive Grid Improvements
   ------------------------- */
.row.sectionBlockLayout {
  gap: var(--spacing-md);
}

@media (min-width: 768px) {
  .row.sectionBlockLayout {
    gap: var(--spacing-lg);
  }
}


/* -------------------------
   Enhanced Home Page Sections
   ------------------------- */
.home-section-1 {
  padding: var(--spacing-xl) var(--spacing-md);
}

@media (min-width: 768px) {
  .home-section-1 {
    padding: var(--spacing-3xl) var(--spacing-lg);
  }
}

/* -------------------------
   Better Mobile Experience
   ------------------------- */
@media (max-width: 767px) {
  /* Ensure touch targets are adequate */
  a, button, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-group.entity-action-button {
    margin-left: 1vw;
}
  
  input.query.form-control {
    border-radius: 0 !important;
  }
  
  /* Improve spacing on mobile */
  .sectionBlockLayout {
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
  }
  
  /* Buttons - auto width by default, not full width */
  .btn,
  .button1,
  .button2 {
    width: auto;
    margin-bottom: var(--spacing-sm);
  }
  
  .col-lg-4,
  .col-lg-3,
  .col-md-4,
  .col-md-3 {
    margin-bottom: var(--spacing-lg);
  }
  
  /* Improve form layout on mobile */
  .form-horizontal .form-group {
    margin-bottom: var(--spacing-lg);
  }
  
  /* Better text alignment on mobile */
  h1, h2, h3 {
    text-align: center;
  }
  
  /* Improve entity list cards on mobile */
  .entitylist .card {
    margin-bottom: var(--spacing-lg);
  }
  }

  /* -------------------------
   Fix: Search Padding on Top
     ------------------------- */
.form-search,
.search,
input[type="search"],
.search-bar,
.search-control,
.toolbar-actions {
  padding-top: var(--spacing-lg) !important;
  margin-top: var(--spacing-lg) !important;
  padding-bottom: var(--spacing-md) !important;
}

.entitylist .search,
.entitylist .form-search,
.entitylist .toolbar-actions {
  padding-top: var(--spacing-xl) !important;
  margin-top: var(--spacing-xl) !important;
  margin-bottom: var(--spacing-md) !important;
}

/* Specific fix for float-end toolbar actions */
.float-end.toolbar-actions {
  padding-top: var(--spacing-sm) !important;
  margin-top: var(--spacing-sm) !important;
  margin-bottom: var(--spacing-sm) !important;
  padding-right: var(--spacing-sm) !important;
}

/* Search container padding */
.search-container,
.search-wrapper,
.toolbar {
  padding-top: var(--spacing-lg) !important;
  margin-top: var(--spacing-lg) !important;
}

/* -------------------------
   Tablet Optimizations
   ------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
  .container {
    max-width: 720px;
  }
  
  .col-md-6 {
    margin-bottom: var(--spacing-lg);
  }
}

/* -------------------------
   Accessibility Improvements
   ------------------------- */
*:focus-visible {
  outline: 2px solid var(--portalThemeColor1, #407EC9);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-to-content a {
  position: absolute;
  left: -9999px;
  z-index: 999;
}

.skip-to-content a:focus {
  left: var(--spacing-md);
  top: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--portalThemeColor1, #407EC9);
  color: #fff;
  border-radius: var(--radius-md);
}

/* -------------------------
   Smooth Scrolling
   ------------------------- */
html {
  scroll-behavior: smooth;
}

/* -------------------------
   Loading States (for future use)
   ------------------------- */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* -------------------------
   Fix: Remove Striped Background on Mobile Cards
   ------------------------- */
@media (max-width: 767px) {
  /* Remove striped table alternating backgrounds */
  .table-striped > tbody > tr:nth-of-type(odd),
  .table-striped > tbody > tr:nth-of-type(even),
  .table-striped > tbody > tr:nth-of-type(odd) > *,
  .table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: #fff !important;
  }
  
  /* Ensure all card rows have white background */
  .table tr,
  .table tbody tr {
    background-color: #fff !important;
  }
  
  /* Ensure table cells also have white background */
  .table td,
  .table tbody tr td {
    background-color: transparent !important;
  }
}

/* -------------------------
   Pagination (Consolidated)
   ------------------------- */
.pagination {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  flex-wrap: nowrap;
  margin: var(--spacing-xl) 0;
  padding: var(--spacing-lg) 0;
}

.pagination > li {
  margin: 0 var(--spacing-xs);
}

.pagination > li > a,
.pagination > li > span {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid #e0e0e0;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  text-align: center;
}

.pagination > li > a:hover,
.pagination > li > span:hover {
  background-color: #f8f9fa;
  border-color: var(--portalThemeColor1, #407EC9);
}

.pagination > .active > a,
.pagination > .active > span {
  background-color: var(--portalThemeColor1, #407EC9);
  border-color: var(--portalThemeColor1, #407EC9);
  color: #fff;
}

/* Better spacing between pagination items on mobile */
@media (max-width: 767px) {
  .pagination {
    gap: var(--spacing-md);
    padding: var(--spacing-xl) var(--spacing-md);
  }
  
  .pagination > li > a,
  .pagination > li > span {
    padding: var(--spacing-md);
    min-width: 44px;
    min-height: 44px;
  }
}

/* =========================================================
   FIX: Pagination Styling - Better Visibility
   ========================================================= */

/* Non-active pagination links - dark text for visibility */
.pagination > li > a,
.pagination > li > span {
  color: #333333 !important;
  background-color: #ffffff;
  font-weight: 500;
  text-decoration: none !important;
}

/* Hover state */
.pagination > li > a:hover,
.pagination > li > span:hover {
  color: var(--portalThemeColor1, #407EC9) !important;
  background-color: #f0f0f0;
  border-color: var(--portalThemeColor1, #407EC9);
}

/* Active page - white text on blue, ensure text fits */
.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
  color: #ffffff !important;
  background-color: var(--portalThemeColor1, #407EC9) !important;
  border-color: var(--portalThemeColor1, #407EC9) !important;
  border-radius: var(--radius-md) !important;
  overflow: visible !important;
}

/* Disabled pagination (prev/next when at start/end) */
.pagination > .disabled > a,
.pagination > .disabled > span {
  color: #999999 !important;
  background-color: #f5f5f5;
  cursor: not-allowed;
}

/* Ensure all pagination items have consistent sizing */
.pagination > li > a,
.pagination > li > span {
  min-width: 44px;
  min-height: 44px;
  line-height: 1;
  overflow: visible;
}

/* =========================================================
   FIX: Search Bar Padding & Icon Stability
   ========================================================= */

/* Search input - add right padding */
.search input,
.form-search input,
input[type="search"],
.entitylist .search input {
  padding-right: var(--spacing-lg) !important;
  margin-right: var(--spacing-sm);
}

/* Search button/icon - prevent movement on hover */
.search button,
.form-search button,
.input-group-btn .btn,
.input-group-append .btn,
button[type="submit"].btn {
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

/* Input group styling fix */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  flex: 1;
  padding-right: var(--spacing-lg) !important;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group .btn,
.input-group-btn .btn,
.input-group-append .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  height: 100%;
}

/* =========================================================
   FIX: Form Section Headers & Spacing
   ========================================================= */

/* Main form section containers */
fieldset,
.tab-pane,
.form-section,
.section {
  margin-bottom: var(--spacing-xs);
  padding-bottom: var(--spacing-xs);
}

/* Section titles/legends */
fieldset > legend,
.tab-title,
h2.section-header,
h3.section-header,
.entity-form h2,
.entity-form h3,
.form-section-title,
.tab-pane > h2:first-child,
.tab-pane > h3:first-child {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--portalThemeColor1, #407EC9);
  border-bottom: 3px solid var(--portalThemeColor4, #FF8400) !important;
  padding-bottom: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

/* Tab navigation headers - match section header styling */
.nav-tabs,
.nav-pills,
ul.nav-tabs,
ul.nav-pills {
  border-bottom: 3px solid var(--portalThemeColor4, #FF8400);
  margin-bottom: var(--spacing-lg);
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
}

.nav-tabs > li > a,
.nav-pills > li > a,
.nav-tabs .nav-link,
.nav-pills .nav-link {
  font-size: 1.1rem;
  font-weight: 600;
  color: #666;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-bottom: 3px solid transparent;
  margin-right: var(--spacing-sm);
  transition: all var(--transition-fast);
}

.nav-tabs > li > a:hover,
.nav-pills > li > a:hover,
.nav-tabs .nav-link:hover,
.nav-pills .nav-link:hover {
  color: var(--portalThemeColor1, #407EC9);
  border-bottom-color: var(--portalThemeColor1, #407EC9);
  background-color: transparent;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus,
.nav-pills > li.active > a,
.nav-pills > li.active > a:hover,
.nav-pills > li.active > a:focus,
.nav-tabs .nav-link.active,
.nav-pills .nav-link.active {
  color: var(--portalThemeColor1, #407EC9);
  border-bottom: 3px solid var(--portalThemeColor4, #FF8400);
  background-color: transparent;
  font-weight: 700;
}

/* First heading doesn't need top margin */
fieldset:first-child > legend,
.tab-pane > h2:first-child,
.tab-pane > h3:first-child,
.entity-form > fieldset:first-of-type > legend {
  margin-top: 0;
}

/* Labels styling */
.control-label,
.info-label {
  font-weight: 600;
  color: #333333;
  margin-bottom: var(--spacing-xs);
  display: block;
  font-size: 0.9rem;
}

/* Required field indicator */
.required .control-label:after,
label .required {
  color: #dc3545;
}

/* Two-column form layout improvements */
@media (min-width: 768px) {
  .form-horizontal .control-label {
    text-align: right;
    padding-top: var(--spacing-sm);
  }
}

/* =========================================================
   FIX: Read-Only Form Styling
   ========================================================= */

/* Read-only info display (label + value pairs) */
.info,
.info-group,
.readonly-field,
.form-control-static,
.form-control[readonly],
.form-control:disabled,
input[readonly] {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: var(--radius-md) !important;
  padding: var(--spacing-sm) var(--spacing-md);
  color: #333333;
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* Read-only form layout */
.readonly-form .form-group,
.view-form .form-group,
.info-row {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid #f0f0f0;
}

.readonly-form .form-group:last-child,
.view-form .form-group:last-child,
.info-row:last-child {
  border-bottom: none;
}

/* Info label in read-only forms */
.readonly-form label,
.view-form label,
.readonly-form .control-label {
  font-weight: 600;
  color: #555555;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: var(--spacing-xs);
}

/* Info value in read-only forms */
.info-value,
.readonly-form .form-control-static,
.view-form .form-control-static,
.readonly-form .controls,
.view-form .controls {
  font-size: 1rem;
  color: #1a1a1a;
  font-weight: 500;
  padding: var(--spacing-xs) 0;
}

/* Empty value placeholder */
.info-value:empty:before,
.form-control-static:empty:before {
  content: "—";
  color: #999999;
}

/* Card-style read-only sections */
.readonly-section,
.info-section,
.detail-section {
  background-color: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.readonly-section h2,
.readonly-section h3,
.info-section h2,
.info-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--portalThemeColor1, #407EC9);
  border-bottom: 2px solid var(--portalThemeColor4, #FF8400);
  padding-bottom: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  margin-top: 0;
}

/* Two-column read-only layout on desktop */
@media (min-width: 768px) {
  .readonly-form .row,
  .view-form .row,
  .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md) var(--spacing-xl);
  }

  html[dir=ltr] .crmEntityFormView .actions .btn:first-child {
    margin-right: 5px;
    margin-left: 10px;
}
  
  .readonly-form .form-group,
  .view-form .form-group {
    border-bottom: none;
    padding: var(--spacing-sm);
    background-color: #fafafa;
    border-radius: var(--radius-sm);
  }
}

/* Mobile read-only form improvements */
@media (max-width: 767px) {
  .readonly-form .form-group,
  .view-form .form-group,
  .info-row {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background-color: #fafafa;
    border-radius: var(--radius-md);
    border-bottom: none;
  }
  
  .readonly-form label {
    font-size: 0.8rem;
  }
  
  .readonly-form .form-control-static {
    font-size: 1rem;
  }
}

/* Sub-grid/table within forms (like Notifications table) */
.entitylist.subgrid,
.subgrid-container {
  margin-top: var(--spacing-lg);
  border: 1px solid #e8e8e8;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.entitylist.subgrid .view-toolbar,
.subgrid-container .view-toolbar {
  background-color: #f8f9fa;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid #e8e8e8;
}

/* =========================================================
   FIX: Subgrid Headers - No Orange Underline
   ========================================================= */

/* Remove orange underline from subgrid/entitylist headings */
.entitylist h2,
.entitylist h3,
.entitylist h4,
.subgrid h2,
.subgrid h3,
.subgrid h4,
.entitylist.subgrid h2,
.entitylist.subgrid h3,
.entitylist.subgrid h4,
.view-grid h2,
.view-grid h3 {
  border-bottom: none !important;
  margin-top: 0;
  padding-left: var(--spacing-md);
}

/* =========================================================
   FIX: Section Headers - Better Padding
   ========================================================= */

/* Hide section titles */
.section-title {
  display: none !important;
}

/* Add horizontal padding to section titles */
fieldset > legend,
.tab-title,
h2.section-header,
h3.section-header,
.entity-form h2,
.entity-form h3,
.form-section-title {
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
  margin-left: 0;
  margin-right: 0;
}

/* Fieldset itself needs padding */
fieldset {
  padding: var(--spacing-md);
}

/* =========================================================
   FIX: Download Button - White Text
   ========================================================= */

/* Download button and info buttons need white text */
.btn-info,
.btn-info:hover,
.btn-info:focus,
.btn-info:active,
a.btn-info,
a.entitylist-download,
.entitylist-download.btn {
  color: #ffffff !important;
  text-decoration: none !important;
}

.btn-info:hover,
.btn-info:focus {
  color: #ffffff !important;
  filter: brightness(1.1);
}

/* =========================================================
   FIX: View Record Button - White Text on Hover
   ========================================================= */

/* Outline buttons need visible text on hover/focus */
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.pp-link-btn:hover,
.pp-link-btn:focus,
.pp-link-btn:active {
  color: #ffffff !important;
  background-color: var(--portalThemeColor1, #407EC9) !important;
  border-color: var(--portalThemeColor1, #407EC9) !important;
}

/* Ensure default state is visible */
.btn-outline-primary,
.pp-link-btn {
  color: var(--portalThemeColor1, #407EC9);
  border-color: var(--portalThemeColor1, #407EC9);
  background-color: transparent;
}

/* =========================================================
   FIX: Footer - Condensed & Visible Text
   ========================================================= */

/* Make footer much more compact */
footer {
  padding-bottom: var(--spacing-sm) !important;
}

footer .container {
  padding-top: var(--spacing-sm) !important;
  padding-bottom: var(--spacing-sm) !important;
}

.footer-bottom {
  padding: var(--spacing-xs) 0 !important;
  min-height: auto !important;
}

footer p,
footer h3,
footer h4,
footer a,
footer span,
footer li {
  margin-bottom: var(--spacing-xs) !important;
  margin-top: 0 !important;
  font-size: 0.875rem !important;
  line-height: 1.4 !important;
}

/* =========================================================
   Footer Link Class - Always White, Bold when Visited
   ========================================================= */

/* Footer link - always white text on blue background (high specificity) */
footer a.footer-link,
footer a.footer-link:link,
footer a.footer-link:active,
footer a.footer-link:focus,
footer p a.footer-link,
footer .smallText a.footer-link {
  color: #ffffff !important;
  text-decoration: underline !important;
  font-weight: 400 !important;
  border-bottom: none !important;
}

/* Footer link - bold when visited */
footer a.footer-link:visited,
footer p a.footer-link:visited,
footer .smallText a.footer-link:visited {
  color: #ffffff !important;
  text-decoration: underline !important;
  font-weight: 700 !important;
  border-bottom: none !important;
}

/* Footer link - orange on hover */
footer a.footer-link:hover,
footer p a.footer-link:hover,
footer .smallText a.footer-link:hover {
  color: var(--portalThemeColor4, #FF8400) !important;
  text-decoration: underline !important;
  border-bottom: none !important;
}

/* Footer row spacing */
footer .row {
  margin-bottom: 0 !important;
  gap: var(--spacing-sm);
}

/* Footer columns */
footer .col-md-4,
footer .col-lg-4,
footer [class*="col-"] {
  padding: var(--spacing-xs) var(--spacing-sm) !important;
}

/* Contact info styling */
footer ul {
  padding-left: 0;
  margin-bottom: var(--spacing-xs) !important;
  list-style: none;
}

footer ul li {
  padding: 2px 0;
}

/* Reduce any large section blocks in footer */
footer .sectionBlockLayout {
  padding-top: var(--spacing-sm) !important;
  padding-bottom: var(--spacing-sm) !important;
  margin-bottom: 0 !important;
}

/* =========================================================
   FIX: Mobile Button Sizing - Not Full Width
   ========================================================= */

@media (max-width: 767px) {
  /* Only primary action buttons should be full width */
  .btn-block,
  form .btn-primary[type="submit"],
  .modal-footer .btn-primary {
    width: 100% !important;
  }
  
  /* Inline buttons in input groups - keep compact */
  .input-group .btn,
  .input-group-btn .btn,
  .input-group-append .btn,
  .lookup .btn,
  .clearlookupfield,
  .launchentitylookup,
  button.clearlookupfield,
  button.launchentitylookup {
    width: auto !important;
    min-width: 44px !important;
    max-width: 200px !important;
    padding: var(--spacing-xs) var(--spacing-sm) !important;
    margin-bottom: 0 !important;
  }
  
  /* Action buttons (Create, Add Products, etc.) - reasonable width */
  .action.create-action,
  .btn.create-action,
  a.create-action,
  .entitylist .action,
  .float-end.action {
    width: auto !important;
    min-width: 120px;
    max-width: 200px;
    padding: var(--spacing-sm) var(--spacing-lg) !important;
  }
}

/* =========================================================
   FIX: Mobile Form Fields - Better Spacing & Padding
   ========================================================= */

@media (max-width: 767px) {
  /* Form groups with better spacing */
  .form-group,
  .control-group {
    margin-bottom: var(--spacing-md) !important;
    padding: 0 var(--spacing-sm);
  }
  
  /* Labels */
  .form-group > label,
  .control-label {
    margin-bottom: var(--spacing-xs);
    font-size: 0.85rem;
  }
  
  /* Input fields - proper sizing */
  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    padding: var(--spacing-sm) var(--spacing-md) !important;
    font-size: 1rem !important;
    min-height: 44px !important;
  }
  
  /* Lookup fields - fix the inline button layout */
  .lookup,
  .input-group.lookup-input-group {
    display: block !important;
    align-items: stretch !important;
  }
  
  .lookup .form-control,
  .lookup-input-group .form-control {
    flex: 1 !important;
    min-width: 0 !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
  }
  
  .lookup .input-group-btn,
  .lookup-input-group .input-group-btn,
  .lookup .input-group-append {
    display: flex !important;
    flex-wrap: nowrap !important;
  }
  
  .lookup .input-group-btn .btn,
  .lookup-input-group .input-group-btn .btn {
    border-radius: 0 !important;
  }
  
  .lookup .input-group-btn .btn:last-child,
  .lookup-input-group .input-group-btn .btn:last-child {
    border-top-right-radius: var(--radius-md) !important;
    border-bottom-right-radius: var(--radius-md) !important;
  }
  
  /* Currency/money fields with prefix */
  .input-group-addon,
  .input-group-text {
    padding: var(--spacing-sm) var(--spacing-md) !important;
    min-height: 44px !important;

    align-items: center !important;
  }
  
  /* Fieldset sections */
  fieldset {
    padding: var(--spacing-sm) !important;
    margin-bottom: var(--spacing-md) !important;
  }
  
  /* Section headings */
  fieldset > legend,
  .entity-form h2,
  .entity-form h3 {
    padding-left: var(--spacing-sm) !important;
    font-size: 1.25rem !important;
  }
}

/* =========================================================
   FIX: Subgrid Tables - Column Headers & Better Layout
   ========================================================= */

@media (max-width: 767px) {
  /* Subgrid container styling */
  .subgrid,
  .entitylist.subgrid,
  .entity-subgrid,
  .view-grid.subgrid {
    margin: var(--spacing-sm) 0 !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden !important;
  }
  
  /* Ensure dropdowns in mobile tables can overflow */
  .entitylist table .dropdown-menu,
  .subgrid table .dropdown-menu {
    position: absolute !important;
    z-index: 1050 !important;
    overflow: visible !important;
  }
  
  /* Subgrid header with title */
  .subgrid h2,
  .subgrid h3,
  .subgrid h4,
  .entitylist.subgrid h2,
  .entitylist.subgrid h3 {
    font-size: 1.1rem !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    margin-bottom: var(--spacing-sm) !important;
  }
  
  /* Subgrid action buttons (Add Products, etc.) */
  .subgrid .action,
  .subgrid .create-action,
  .entitylist.subgrid .action,
  .entity-subgrid .action {
    width: auto !important;
    margin: var(--spacing-sm) !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    font-size: 0.875rem !important;
  }
  
  /* Subgrid table - convert to cards like main tables */
  .subgrid .table,
  .subgrid table,
  .entity-subgrid .table,
  .view-grid.subgrid table {
    display: block !important;
  }
  
  .subgrid .table thead,
  .subgrid table thead,
  .entity-subgrid .table thead {
    display: none !important;
  }
  
  .subgrid .table tbody,
  .subgrid table tbody {
    display: block !important;
  }
  
  /* Subgrid rows - better spacing and alignment */
  .subgrid .table tr,
  .subgrid table tr,
  .entity-subgrid .table tr {
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: var(--spacing-md) !important;
    padding: var(--spacing-md) !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: var(--radius-md) !important;
    background-color: #ffffff !important;
    box-shadow: var(--shadow-sm) !important;
    gap: var(--spacing-xs) !important;
  }
  
  /* Subgrid table cells - improved alignment */
  .subgrid .table td,
  .subgrid table td,
  .entity-subgrid .table td {
    display: flex !important;
    align-items: flex-start !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border: none !important;
    text-align: left !important;
    min-height: 2rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Column headers for subgrid cells - better alignment */
  .subgrid .table td:before,
  .subgrid table td:before,
  .entity-subgrid .table td:before {
    content: attr(data-label);
    font-weight: 600;
    color: #333;
    min-width: 120px;
    max-width: 40%;
    margin-right: var(--spacing-md);
    flex-shrink: 0;
    font-size: 0.875rem;
    text-align: left;
    padding-top: 2px; /* Align with content baseline */
  }
  
  /* Cell content alignment */
  .subgrid .table td > *,
  .subgrid table td > *,
  .entity-subgrid .table td > * {
    flex: 1;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
  }
  
  /* Ensure proper alignment for different content types */
  .subgrid .table td input[type="checkbox"],
  .subgrid .table td input[type="radio"],
  .subgrid table td input[type="checkbox"],
  .subgrid table td input[type="radio"],
  .entity-subgrid .table td input[type="checkbox"],
  .entity-subgrid .table td input[type="radio"] {
    margin-right: var(--spacing-xs);
    margin-top: 2px;
    flex-shrink: 0;
  }
  
  /* Action buttons in subgrid cells */
  .subgrid .table td .btn,
  .subgrid .table td .button1,
  .subgrid .table td .button2,
  .subgrid table td .btn,
  .subgrid table td .button1,
  .subgrid table td .button2,
  .entity-subgrid .table td .btn {
    margin-left: auto;
    flex-shrink: 0;
  }
  
  /* Remove alternating backgrounds in subgrid cards */
  .subgrid .table-striped tr,
  .subgrid .table tr:nth-child(odd),
  .subgrid .table tr:nth-child(even) {
    background-color: #ffffff !important;
  }
  
  /* View grid specific (like Products) - remove blue background */
  .view-grid {
    background-color: transparent !important;
  }
  
  .view-grid.table-responsive {
    background-color: transparent !important;
    overflow: visible !important;
  }
}

/* =========================================================
   FIX: Lookup Fields - Not Inline with Label
   ========================================================= */

/* Lookup fields should be block level, not inline with label */
.lookup,
.input-group.lookup-input-group,
.form-group .lookup,
.control-group .lookup {
  width: 100% !important;
}

/* Ensure lookup container is on its own line */
.form-group .lookup,
.control-group .lookup,
.form-horizontal .lookup {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}

/* Fix lookup input border radius - all corners rounded */
.lookup .form-control,
.lookup-input-group .form-control,
.lookup input[type="text"] {
  border-radius: var(--radius-md) !important;
}

/* Fix lookup buttons - rounded on the right side */
.lookup .input-group-btn:last-child .btn:last-child,
.lookup-input-group .input-group-btn:last-child .btn:last-child,
.lookup .btn:last-child {
  border-top-right-radius: var(--radius-md) !important;
  border-bottom-right-radius: var(--radius-md) !important;
}

/* =========================================================
   FIX: Subgrid Add Button - Proper Sizing & Rounded Corners
   ========================================================= */

/* Subgrid action buttons - consistent styling */
.btn-primary.float-end.action.create-action,
.subgrid .btn-primary.create-action,
.entitylist .btn-primary.create-action,
.entity-subgrid .btn-primary.create-action,
a.btn-primary.float-end.action.create-action {
  border-radius: var(--radius-md) !important;
  padding: var(--spacing-sm) var(--spacing-lg) !important;
  min-width: 100px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Ensure all action buttons have consistent rounded corners */
.action.create-action,
.btn.action,
.entitylist .action {
  border-radius: var(--radius-md) !important;
}

/* =========================================================
   FIX: Grid/Subgrid Rows - Vertical Align Middle on Desktop
   ========================================================= */

/* Desktop only - vertical align middle for table rows */
@media (min-width: 768px) {
  .table > tbody > tr > td,
  .table > thead > tr > th,
  .entitylist .table td,
  .entitylist .table th,
  .subgrid .table td,
  .subgrid .table th,
  .view-grid td,
  .view-grid th {
    vertical-align: middle !important;
  }
  
  /* Entity list rows */
  .entitylist tr,
  .subgrid tr,
  .view-grid tr {
    vertical-align: middle;
  }
}

/* =========================================================
   FIX: List Group Borders - Override Bootstrap
   ========================================================= */

/* Restore border between list group items */
.list-group-item + .list-group-item {
  border-top-width: 1px !important;
  border-top-style: solid !important;
  border-top-color: rgba(0, 0, 0, 0.125) !important;
}

/* Ensure all list group items have borders */
.list-group-item {
  border: 1px solid rgba(0, 0, 0, 0.125) !important;
}

/* =========================================================
   Knowledge Article Styling
   ========================================================= */

/* Knowledge Article Container */
.knowledge-article {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

/* KB Header */
.kb-header {
  box-shadow: var(--shadow-md);
}

.kb-header h1 {
  font-weight: 700;
  line-height: 1.2;
}

.kb-header button {
  transition: all var(--transition-fast);
}

.kb-header button:hover {
  background: rgba(255,255,255,0.3) !important;
  transform: none;
}

/* KB Summary */
.kb-summary {
  box-shadow: var(--shadow-sm);
}

/* KB Content */
.kb-content {
  color: #333;
}

.kb-content h1,
.kb-content h2,
.kb-content h3,
.kb-content h4 {
  color: var(--portalThemeColor1, #407EC9);
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.kb-content p {
  margin-bottom: var(--spacing-md);
}

.kb-content ul,
.kb-content ol {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
}

.kb-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: var(--spacing-md) 0;
  box-shadow: var(--shadow-sm);
}

.kb-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-md) 0;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.kb-content table th {
  background-color: var(--portalThemeColor1, #407EC9);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  font-weight: 600;
}

.kb-content table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid #e0e0e0;
}

.kb-content table tr:last-child td {
  border-bottom: none;
}

.kb-content blockquote {
  border-left: 4px solid var(--portalThemeColor4, #FF8400);
  padding-left: var(--spacing-md);
  margin: var(--spacing-md) 0;
  font-style: italic;
  color: #666;
}

.kb-content code {
  background-color: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.kb-content pre {
  background-color: #f4f4f4;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--spacing-md) 0;
}

.kb-content pre code {
  background: none;
  padding: 0;
}

/* KB Keywords */
.kb-keywords {
  box-shadow: var(--shadow-sm);
}

.kb-keywords span {
  transition: all var(--transition-fast);
  cursor: default;
}

.kb-keywords span:hover {
  background: var(--portalThemeColor4, #FF8400) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* KB Related Articles */
.kb-related {
  border-top: 2px solid #e0e0e0;
  padding-top: var(--spacing-lg);
}

.kb-related h3 {
  color: var(--portalThemeColor1, #407EC9);
  font-size: 1.5rem;
  margin-bottom: var(--spacing-md);
  border-bottom: 3px solid var(--portalThemeColor4, #FF8400);
  padding-bottom: var(--spacing-sm);
}

/* Knowledge Article Widgets */
.kb-widget-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--portalThemeColor1, #407EC9);
  margin: var(--spacing-md) 0;
  padding-bottom: var(--spacing-sm);
  border-bottom: 3px solid var(--portalThemeColor4, #FF8400);
}

/* Article List Links */
.kb-article-list {
  padding: var(--spacing-md) 0;
}

.kb-article-link {
  display: flex;
  align-items: flex-start;
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  text-decoration: none;
  color: #333;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.kb-article-link:hover {
  background-color: #f8f9fa;
  border-color: var(--portalThemeColor1, #407EC9);
  color: var(--portalThemeColor1, #407EC9);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.kb-article-icon {
  color: var(--portalThemeColor1, #407EC9);
  margin-right: var(--spacing-md);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.kb-article-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.kb-article-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: var(--spacing-xs);
  color: inherit;
}

.kb-article-date {
  font-size: 0.875rem;
  color: #666;
  font-weight: 400;
}

.kb-article-divider {
  border-width: 1px;
  border-color: #e0e0e0;
  margin: var(--spacing-sm) 0;
}

/* Popular Articles Widget */
.kb-popular-articles {
  margin-bottom: var(--spacing-lg);
}

.kb-popular-container {
  background: #f8f9fa;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-md);
}

.kb-popular-item {
  padding: var(--spacing-sm);
}

.kb-popular-link {
  text-decoration: none;
  display: block;
  height: 100%;
}

.kb-popular-title {
  text-align: center;
  font-weight: 600;
  color: var(--portalThemeColor1, #407EC9);
  padding: var(--spacing-md);
  background-color: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #e0e0e0;
  transition: all var(--transition-fast);
  margin: 0;
}

.kb-popular-title:hover {
  background-color: var(--portalThemeColor1, #407EC9);
  color: #ffffff;
  border-color: var(--portalThemeColor1, #407EC9);
  box-shadow: var(--shadow-md);
}

.kb-popular-title i {
  margin-right: var(--spacing-xs);
}

/* Alternating background for popular articles */
.kb-popular-container .kb-popular-item:nth-child(even) .kb-popular-title {
  background-color: #f0f0f0;
}

/* Knowledge Base Home */
.list-group.unstyled {
  list-style: none;
  padding: 0;
}

.list-group.unstyled .list-group-item {
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
}

.list-group.unstyled .list-group-item:hover {
  background-color: #f8f9fa;
  border-color: var(--portalThemeColor1, #407EC9);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* Mobile Knowledge Article Styles */
@media (max-width: 767px) {
  .knowledge-article {
    padding: var(--spacing-md);
  }
  
  .kb-header {
    padding: var(--spacing-lg) !important;
  }
  
  .kb-header h1 {
    font-size: 1.5rem !important;
  }
  
  .kb-header button {
    width: 100%;
    margin-top: var(--spacing-md) !important;
  }
  
  .kb-content {
    padding: 0 !important;
  }
  
  .kb-content table {
    font-size: 0.875rem;
  }
  
  .kb-content table th,
  .kb-content table td {
    padding: var(--spacing-xs) var(--spacing-sm);
  }
  
  .kb-keywords span {
    font-size: 0.75rem;
    padding: 3px 8px;
  }
  
  .populararticle .col-md-4 {
    margin-bottom: var(--spacing-sm);
  }
  
  .kb-widget-title {
    font-size: 1.25rem;
    margin: var(--spacing-sm) 0;
  }
  
  .kb-article-link {
    padding: var(--spacing-sm);
  }
  
  .kb-article-title {
    font-size: 0.9rem;
  }
  
  .kb-article-date {
    font-size: 0.8rem;
  }
  
  .kb-popular-container {
    padding: var(--spacing-sm);
  }
  
  .kb-popular-title {
    padding: var(--spacing-sm);
    font-size: 0.9rem;
  }
}

/* Print Styles for Knowledge Articles */
@media print {
  .kb-header button,
  .kb-related,
  .kb-keywords {
    display: none;
  }
  
  .kb-header {
    background: #f0f0f0 !important;
    color: #000 !important;
    padding: 1rem !important;
  }
  
  .kb-content {
    padding: 0 !important;
  }
  
  .kb-content img {
    max-width: 100%;
    page-break-inside: avoid;
  }
  
  .kb-content table {
    page-break-inside: avoid;
  }
}

/* =========================================================
   Hero Video Section - Homepage for Non-Logged-In Users
   ========================================================= */

.hero-video-section {
  position: relative;
  width: 100%;
  height: 80vh;
  min-height: 600px;
  overflow: hidden;
}

.hero-video-section video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
  z-index: 1;
}

.hero-video-section .video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.70);
  z-index: 2;
}

.hero-top-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 2rem 4rem;
}

.hero-top-content h1 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
}

.hero-bottom-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #000000;
  color: #ffffff;
  padding: 4rem;
  text-align: left;
  z-index: 4;
}

.hero-bottom-overlay .container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Legacy support for old class names */
.hero-bottom-section {
  background-color: #000000;
  color: #ffffff;
  padding: 4rem 2rem;
  text-align: center;
}

.hero-bottom-section .container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .hero-video-section {
    min-height: 500px;
    height: 100vh;
  }
  
  .hero-top-content {
    height: 45%;
    padding: 1.5rem;
    justify-content: flex-start;
    text-align: left;
  }
  
  .hero-top-content h1 {
    font-size: 2rem;
  }
  
  .hero-bottom-overlay {
    padding: 2.5rem 1.5rem;
    height: auto;
    text-align: left;
  }
  
  .hero-bottom-overlay p {
    font-size: 1rem;
    margin-bottom: 1rem;
  }
  
  .hero-bottom-overlay div {
    font-size: 1.5rem;
  }
}

.pva-embedded-web-chat {
  display: none !important;
}
/* Video styling - playsinline is set as HTML attribute */

/* =========================================================
   Modal Popup Grid - Mobile-Friendly Lookup Dialogs
   Apply class "pp-modal-grid" via Power Pages metadata
   ========================================================= */

/* Modal dialog container adjustments */
.modal .pp-modal-grid,
.ui-dialog .pp-modal-grid,
.ms-crm-Dialog .pp-modal-grid {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Ensure modal content doesn't overflow */
.modal-body .pp-modal-grid,
.ui-dialog-content .pp-modal-grid,
.ms-crm-Dialog-Content .pp-modal-grid {
  padding: var(--spacing-sm);
  max-width: 100%;
  box-sizing: border-box;
}

/* Desktop: Normal table layout */
.pp-modal-grid table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.pp-modal-grid table thead th {
  background-color: #f8f9fa;
  font-weight: 600;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 2px solid #e0e0e0;
  text-align: left;
  font-size: 0.875rem;
}

.pp-modal-grid table tbody td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.pp-modal-grid table tbody tr:hover {
  background-color: #f8f9fa;
}

/* Mobile: Convert to cards with column headers */
@media (max-width: 767px) {
  /* Modal dialog full width on mobile */
  .modal-dialog,
  .ui-dialog,
  .ms-crm-Dialog {
    max-width: 100vw !important;
    margin: 0 !important;
    width: 100% !important;
  }

  input[type="checkbox"] {
    width: auto !important;
    margin-right: var(--spacing-xs) !important;
    scale: 1.2 !important;
    min-height: auto !important;
  }
  

  button.cancel.btn.btn-default {
    width: 100% !important;
  }
  
  .modal-content,
  .ui-dialog-content,
  .ms-crm-Dialog-Content {
    border-radius: 0 !important;
    max-height: 100vh !important;
    height: 75vh !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  .modal-body,
  .ui-dialog-content,
  .ms-crm-Dialog-Content {
    overflow-y: auto !important;
    flex: 1 1 auto !important;
    padding: var(--spacing-sm) !important;
  }
  
  /* =========================================================
     Mobile Lookup Modal Improvements
     ========================================================= */
  
  /* Lookup modal container - full screen on mobile */
  .modal-lookup,
  .entity-lookup .modal,
  #customerid_lookupmodal .modal,
  [id*="_lookupmodal"] .modal {
    padding: 0 !important;
  }
  
  .modal-lookup .modal-dialog,
  .entity-lookup .modal-dialog,
  #customerid_lookupmodal .modal-dialog,
  [id*="_lookupmodal"] .modal-dialog {
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }
  
  .modal-lookup .modal-content,
  .entity-lookup .modal-content,
  #customerid_lookupmodal .modal-content,
  [id*="_lookupmodal"] .modal-content {
    border-radius: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    border: none !important;
  }
  
  /* Modal header - compact and fixed */
  .modal-lookup .modal-header,
  .entity-lookup .modal-header,
  #customerid_lookupmodal .modal-header,
  [id*="_lookupmodal"] .modal-header {
    flex-shrink: 0 !important;
    padding: var(--spacing-md) !important;
    border-bottom: 1px solid #e0e0e0 !important;
    background-color: #f8f9fa !important;
  }
  
  .modal-lookup .modal-title,
  .entity-lookup .modal-title,
  #customerid_lookupmodal .modal-title,
  [id*="_lookupmodal"] .modal-title {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    padding-right: var(--spacing-md) !important;
  }
  
  .modal-lookup .close,
  .entity-lookup .close,
  #customerid_lookupmodal .close,
  [id*="_lookupmodal"] .close {
    font-size: 1.5rem !important;
    padding: var(--spacing-xs) !important;
    margin: 0 !important;
    opacity: 0.7;
  }
  
  /* Modal body - scrollable content area */
  .modal-lookup .modal-body,
  .entity-lookup .modal-body,
  #customerid_lookupmodal .modal-body,
  [id*="_lookupmodal"] .modal-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: var(--spacing-md) !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Lookup view dropdown */
  .modal-lookup select,
  .entity-lookup select,
  #customerid_lookupmodal select,
  [id*="_lookupmodal"] select {
    width: 100% !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    font-size: 1rem !important;
    min-height: 44px !important;
    margin-bottom: var(--spacing-md) !important;
    border-radius: var(--radius-md) !important;
  }
  
  /* Search input and button */
  .modal-lookup .input-group,
  .entity-lookup .input-group,
  #customerid_lookupmodal .input-group,
  [id*="_lookupmodal"] .input-group {
    display: flex !important;
    width: 100% !important;
    margin-bottom: var(--spacing-md) !important;
  }
  
  .modal-lookup input[type="text"],
  .modal-lookup input[type="search"],
  .entity-lookup input[type="text"],
  .entity-lookup input[type="search"],
  #customerid_lookupmodal input[type="text"],
  #customerid_lookupmodal input[type="search"],
  [id*="_lookupmodal"] input[type="text"],
  [id*="_lookupmodal"] input[type="search"] {
    flex: 1 !important;
    min-width: 0 !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    font-size: 1rem !important;
    min-height: 44px !important;
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
  }
  
  .modal-lookup .input-group-btn,
  .modal-lookup .input-group-append,
  .entity-lookup .input-group-btn,
  .entity-lookup .input-group-append,
  #customerid_lookupmodal .input-group-btn,
  #customerid_lookupmodal .input-group-append,
  [id*="_lookupmodal"] .input-group-btn,
  [id*="_lookupmodal"] .input-group-append {
    flex-shrink: 0 !important;
  }
  
  .modal-lookup .input-group-btn .btn,
  .modal-lookup .input-group-append .btn,
  .entity-lookup .input-group-btn .btn,
  .entity-lookup .input-group-append .btn,
  #customerid_lookupmodal .input-group-btn .btn,
  #customerid_lookupmodal .input-group-append .btn,
  [id*="_lookupmodal"] .input-group-btn .btn,
  [id*="_lookupmodal"] .input-group-append .btn {
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
    min-height: 44px !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
  }
  
  /* Instructions text */
  .modal-lookup .modal-body > p,
  .entity-lookup .modal-body > p,
  #customerid_lookupmodal .modal-body > p,
  [id*="_lookupmodal"] .modal-body > p {
    font-size: 0.875rem !important;
    color: #666 !important;
    margin-bottom: var(--spacing-md) !important;
    padding: 0 !important;
  }
  
  /* Record list container */
  .modal-lookup .table-responsive,
  .modal-lookup table,
  .entity-lookup .table-responsive,
  .entity-lookup table,
  #customerid_lookupmodal .table-responsive,
  #customerid_lookupmodal table,
  [id*="_lookupmodal"] .table-responsive,
  [id*="_lookupmodal"] table {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
  
  /* Convert lookup modal tables to card layout */
  .modal-lookup table,
  .entity-lookup table,
  #customerid_lookupmodal table,
  [id*="_lookupmodal"] table {
    display: block !important;
  }
  
  .modal-lookup table thead,
  .entity-lookup table thead,
  #customerid_lookupmodal table thead,
  [id*="_lookupmodal"] table thead {
    display: none !important;
  }
  
  .modal-lookup table tbody,
  .entity-lookup table tbody,
  #customerid_lookupmodal table tbody,
  [id*="_lookupmodal"] table tbody {
    display: block !important;
  }
  
  /* Style each row as a card */
  .modal-lookup table tbody tr,
  .entity-lookup table tbody tr,
  #customerid_lookupmodal table tbody tr,
  [id*="_lookupmodal"] table tbody tr {
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: var(--spacing-md) !important;
    padding: var(--spacing-md) !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: var(--radius-md) !important;
    background-color: #ffffff !important;
    box-shadow: var(--shadow-sm) !important;
    gap: var(--spacing-xs) !important;
  }
  
  /* Table cells with column headers - prevent centering */
  .modal-lookup table tbody td,
  .entity-lookup table tbody td,
  #customerid_lookupmodal table tbody td,
  [id*="_lookupmodal"] table tbody td {
    display: flex !important;
    align-items: flex-start !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border: none !important;
    text-align: left !important;
    min-height: 2rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Column header label on the left */
  .modal-lookup table tbody td:before,
  .entity-lookup table tbody td:before,
  #customerid_lookupmodal table tbody td:before,
  [id*="_lookupmodal"] table tbody td:before {
    content: attr(data-label);
    font-weight: 600;
    color: #333;
    min-width: 120px;
    max-width: 40%;
    margin-right: var(--spacing-md);
    flex-shrink: 0;
    font-size: 0.875rem;
    text-align: left;
    padding-top: 2px;
  }
  
  /* Fallback for checkbox column if data-label is missing */
  .modal-lookup table tbody td:first-child:not([data-label]):before,
  .entity-lookup table tbody td:first-child:not([data-label]):before,
  #customerid_lookupmodal table tbody td:first-child:not([data-label]):before,
  [id*="_lookupmodal"] table tbody td:first-child:not([data-label]):before {
    content: "Select";
  }
  
  /* Cell content - ensure left alignment */
  .modal-lookup table tbody td > *,
  .entity-lookup table tbody td > *,
  #customerid_lookupmodal table tbody td > *,
  [id*="_lookupmodal"] table tbody td > * {
    flex: 1;
    text-align: left !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
  }
  
  /* Prevent centering on selection */
  .modal-lookup table tbody tr.selected,
  .entity-lookup table tbody tr.selected,
  #customerid_lookupmodal table tbody tr.selected,
  [id*="_lookupmodal"] table tbody tr.selected {
    text-align: left !important;
  }
  
  .modal-lookup table tbody tr.selected td,
  .entity-lookup table tbody tr.selected td,
  #customerid_lookupmodal table tbody tr.selected td,
  [id*="_lookupmodal"] table tbody tr.selected td {
    text-align: left !important;
    justify-content: flex-start !important;
  }
  
  /* Checkbox styling - standard size, no stretching */
  .modal-lookup table tbody td input[type="checkbox"],
  .entity-lookup table tbody td input[type="checkbox"],
  #customerid_lookupmodal table tbody td input[type="checkbox"],
  [id*="_lookupmodal"] table tbody td input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    margin-right: var(--spacing-sm) !important;
    margin-top: 2px !important;
    flex-shrink: 0 !important;
    flex: 0 0 18px !important;
    align-self: flex-start !important;
    padding: 0 !important;
    transform: none !important;
    scale: 1 !important;
    box-sizing: border-box !important;
  }
  
  /* =========================================================
     FIX: Mobile Lookup Modal - Prevent Shrinking on Selection
     ========================================================= */
  
  /* Selected rows should maintain EXACT same layout as unselected */
  .modal-lookup table tbody tr.selected,
  .modal-lookup table tbody tr[class*="selected"],
  .entity-lookup table tbody tr.selected,
  .entity-lookup table tbody tr[class*="selected"],
  #customerid_lookupmodal table tbody tr.selected,
  #customerid_lookupmodal table tbody tr[class*="selected"],
  [id*="_lookupmodal"] table tbody tr.selected,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: var(--spacing-md) !important;
    padding: var(--spacing-md) !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: var(--radius-md) !important;
    background-color: #ffffff !important;
    box-shadow: var(--shadow-sm) !important;
    gap: var(--spacing-xs) !important;
    /* Override any Power Pages styles that might shrink */
    min-width: 100% !important;
    flex-shrink: 0 !important;
  }
  
  /* Selected cells should match unselected cells exactly */
  .modal-lookup table tbody tr.selected td,
  .modal-lookup table tbody tr[class*="selected"] td,
  .entity-lookup table tbody tr.selected td,
  .entity-lookup table tbody tr[class*="selected"] td,
  #customerid_lookupmodal table tbody tr.selected td,
  #customerid_lookupmodal table tbody tr[class*="selected"] td,
  [id*="_lookupmodal"] table tbody tr.selected td,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td {
    display: flex !important;
    align-items: flex-start !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border: none !important;
    text-align: left !important;
    min-height: 2rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    /* Prevent any shrinking */
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  
  /* Checkbox column - standard sizing, no stretching */
  .modal-lookup table tbody tr.selected td:first-child,
  .modal-lookup table tbody tr[class*="selected"] td:first-child,
  .entity-lookup table tbody tr.selected td:first-child,
  .entity-lookup table tbody tr[class*="selected"] td:first-child,
  #customerid_lookupmodal table tbody tr.selected td:first-child,
  #customerid_lookupmodal table tbody tr[class*="selected"] td:first-child,
  [id*="_lookupmodal"] table tbody tr.selected td:first-child,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td:first-child {
    display: flex !important;
    align-items: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-direction: row !important;
  }
  
  /* Standard checkbox - no stretching, proper size */
  .modal-lookup table tbody tr.selected td:first-child input[type="checkbox"],
  .modal-lookup table tbody tr[class*="selected"] td:first-child input[type="checkbox"],
  .entity-lookup table tbody tr.selected td:first-child input[type="checkbox"],
  .entity-lookup table tbody tr[class*="selected"] td:first-child input[type="checkbox"],
  #customerid_lookupmodal table tbody tr.selected td:first-child input[type="checkbox"],
  #customerid_lookupmodal table tbody tr[class*="selected"] td:first-child input[type="checkbox"],
  [id*="_lookupmodal"] table tbody tr.selected td:first-child input[type="checkbox"],
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td:first-child input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    flex: 0 0 18px !important;
    margin-right: var(--spacing-sm) !important;
    margin-top: 2px !important;
    padding: 0 !important;
    /* Remove scale that might cause stretching */
    transform: none !important;
    scale: 1 !important;
    /* Ensure it doesn't stretch */
    box-sizing: border-box !important;
  }
  
  /* Column header for checkbox column */
  .modal-lookup table tbody tr.selected td:first-child:before,
  .modal-lookup table tbody tr[class*="selected"] td:first-child:before,
  .entity-lookup table tbody tr.selected td:first-child:before,
  .entity-lookup table tbody tr[class*="selected"] td:first-child:before,
  #customerid_lookupmodal table tbody tr.selected td:first-child:before,
  #customerid_lookupmodal table tbody tr[class*="selected"] td:first-child:before,
  [id*="_lookupmodal"] table tbody tr.selected td:first-child:before,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td:first-child:before {
    content: attr(data-label) !important;
    display: block !important;
    visibility: visible !important;
    min-width: 120px !important;
    max-width: 40% !important;
    flex-shrink: 0 !important;
    margin-right: var(--spacing-md) !important;
    font-weight: 600;
    color: #333;
    font-size: 0.875rem;
    text-align: left;
    padding-top: 2px;
  }
  
  /* Other cells maintain layout */
  .modal-lookup table tbody tr.selected td:not(:first-child),
  .modal-lookup table tbody tr[class*="selected"] td:not(:first-child),
  .entity-lookup table tbody tr.selected td:not(:first-child),
  .entity-lookup table tbody tr[class*="selected"] td:not(:first-child),
  #customerid_lookupmodal table tbody tr.selected td:not(:first-child),
  #customerid_lookupmodal table tbody tr[class*="selected"] td:not(:first-child),
  [id*="_lookupmodal"] table tbody tr.selected td:not(:first-child),
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td:not(:first-child) {
    display: flex !important;
    align-items: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-direction: row !important;
  }
  
  /* Column headers stay visible */
  .modal-lookup table tbody tr.selected td:not(:first-child):before,
  .modal-lookup table tbody tr[class*="selected"] td:not(:first-child):before,
  .entity-lookup table tbody tr.selected td:not(:first-child):before,
  .entity-lookup table tbody tr[class*="selected"] td:not(:first-child):before,
  #customerid_lookupmodal table tbody tr.selected td:not(:first-child):before,
  #customerid_lookupmodal table tbody tr[class*="selected"] td:not(:first-child):before,
  [id*="_lookupmodal"] table tbody tr.selected td:not(:first-child):before,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td:not(:first-child):before {
    content: attr(data-label) !important;
    display: block !important;
    visibility: visible !important;
    min-width: 120px !important;
    max-width: 40% !important;
    flex-shrink: 0 !important;
    margin-right: var(--spacing-md) !important;
    font-weight: 600;
    color: #333;
    font-size: 0.875rem;
    text-align: left;
    padding-top: 2px;
  }
  
  /* Cell content stays in place */
  .modal-lookup table tbody tr.selected td > *,
  .modal-lookup table tbody tr[class*="selected"] td > *,
  .entity-lookup table tbody tr.selected td > *,
  .entity-lookup table tbody tr[class*="selected"] td > *,
  #customerid_lookupmodal table tbody tr.selected td > *,
  #customerid_lookupmodal table tbody tr[class*="selected"] td > *,
  [id*="_lookupmodal"] table tbody tr.selected td > *,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td > * {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    text-align: left !important;
  }
  
  /* Modal footer - fixed at bottom */
  .modal-lookup .modal-footer,
  .entity-lookup .modal-footer,
  #customerid_lookupmodal .modal-footer,
  [id*="_lookupmodal"] .modal-footer {
    flex-shrink: 0 !important;
    padding: var(--spacing-md) !important;
    border-top: 1px solid #e0e0e0 !important;
    background-color: #f8f9fa !important;
    display: flex !important;
    flex-direction: column !important;
    gap: var(--spacing-sm) !important;
  }
  
  /* Footer buttons - full width on mobile */
  .modal-lookup .modal-footer .btn,
  .entity-lookup .modal-footer .btn,
  #customerid_lookupmodal .modal-footer .btn,
  [id*="_lookupmodal"] .modal-footer .btn {
    width: 100% !important;
    margin: 0 !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    font-size: 1rem !important;
    min-height: 44px !important;
    border-radius: var(--radius-md) !important;
  }
  
  /* Primary button (Select) */
  .modal-lookup .modal-footer .btn-primary,
  .entity-lookup .modal-footer .btn-primary,
  #customerid_lookupmodal .modal-footer .btn-primary,
  [id*="_lookupmodal"] .modal-footer .btn-primary {
    order: 1 !important;
    background-color: var(--portalThemeColor1, #407EC9) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
  }
  
  /* Secondary buttons (Cancel, Remove value) */
  .modal-lookup .modal-footer .btn-default,
  .modal-lookup .modal-footer .btn-secondary,
  .entity-lookup .modal-footer .btn-default,
  .entity-lookup .modal-footer .btn-secondary,
  #customerid_lookupmodal .modal-footer .btn-default,
  #customerid_lookupmodal .modal-footer .btn-secondary,
  [id*="_lookupmodal"] .modal-footer .btn-default,
  [id*="_lookupmodal"] .modal-footer .btn-secondary {
    order: 2 !important;
    background-color: #ffffff !important;
    color: #333 !important;
    border: 1px solid #e0e0e0 !important;
  }
  
  /* Empty state or loading */
  .modal-lookup .modal-body .text-muted,
  .entity-lookup .modal-body .text-muted,
  #customerid_lookupmodal .modal-body .text-muted,
  [id*="_lookupmodal"] .modal-body .text-muted {
    text-align: center !important;
    padding: var(--spacing-xl) !important;
    color: #999 !important;
  }
  
  /* Grid container - prevent overflow */
  .pp-modal-grid {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  
  /* Table wrapper */
  .pp-modal-grid .table-responsive,
  .pp-modal-grid .table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
  
  /* Convert table to card layout */
  .pp-modal-grid table,
  .pp-modal-grid table thead,
  .pp-modal-grid table tbody,
  .pp-modal-grid table th,
  .pp-modal-grid table td,
  .pp-modal-grid table tr {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Hide table header on mobile */
  .pp-modal-grid table thead {
    display: none;
  }
  
  /* Style each row as a card */
  .pp-modal-grid table tbody tr {
    display: block !important;
    margin-bottom: var(--spacing-md) !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: var(--radius-md) !important;
    padding: var(--spacing-md) !important;
    background-color: #fff !important;
    box-shadow: var(--shadow-sm) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Table cells with column headers */
  .pp-modal-grid table tbody td {
    display: flex !important;
    align-items: flex-start !important;
    padding: var(--spacing-xs) var(--spacing-sm) !important;
    border: none !important;
    text-align: left !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Column header label on the left */
  .pp-modal-grid table tbody td:before {
    content: attr(data-label);
    font-weight: 600;
    color: #333;
    min-width: 100px;
    max-width: 40%;
    margin-right: var(--spacing-sm);
    flex-shrink: 0;
    font-size: 0.85rem;
    text-align: left;
  }
  
  /* Cell content on the right */
  .pp-modal-grid table tbody td > * {
    flex: 1;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  
  /* Ensure no horizontal overflow */
  .pp-modal-grid table tbody td,
  .pp-modal-grid table tbody td:before,
  .pp-modal-grid table tbody td > * {
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Remove alternating row backgrounds */
  .pp-modal-grid table tbody tr:nth-child(odd),
  .pp-modal-grid table tbody tr:nth-child(even) {
    background-color: #ffffff !important;
  }
  
  /* Checkbox/radio button alignment */
  .pp-modal-grid table tbody td input[type="checkbox"],
  .pp-modal-grid table tbody td input[type="radio"] {
    margin-right: var(--spacing-xs);
    flex-shrink: 0;
  }
  
  /* Links in cells */
  .pp-modal-grid table tbody td a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    display: inline-block;
  }
}

/* =========================================================
   FIX: Lookup Modal - Prevent Content Collapse on Selection (Desktop)
   ========================================================= */

@media (min-width: 768px) {
  /* Ensure selected rows maintain layout on desktop */
  .modal-lookup table tbody tr.selected,
  .modal-lookup table tbody tr[class*="selected"],
  .entity-lookup table tbody tr.selected,
  .entity-lookup table tbody tr[class*="selected"],
  #customerid_lookupmodal table tbody tr.selected,
  #customerid_lookupmodal table tbody tr[class*="selected"],
  [id*="_lookupmodal"] table tbody tr.selected,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] {
    display: table-row !important;
  }

  /* Ensure all cells maintain their width when row is selected on desktop */
  .modal-lookup table tbody tr.selected td,
  .modal-lookup table tbody tr[class*="selected"] td,
  .entity-lookup table tbody tr.selected td,
  .entity-lookup table tbody tr[class*="selected"] td,
  #customerid_lookupmodal table tbody tr.selected td,
  #customerid_lookupmodal table tbody tr[class*="selected"] td,
  [id*="_lookupmodal"] table tbody tr.selected td,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td {
    display: table-cell !important;
    width: auto !important;
    max-width: none !important;
    white-space: normal !important;
  }

  /* Prevent checkbox column from collapsing on desktop - maintain proper width */
  .modal-lookup table tbody tr.selected td:first-child,
  .modal-lookup table tbody tr[class*="selected"] td:first-child,
  .entity-lookup table tbody tr.selected td:first-child,
  .entity-lookup table tbody tr[class*="selected"] td:first-child,
  #customerid_lookupmodal table tbody tr.selected td:first-child,
  #customerid_lookupmodal table tbody tr[class*="selected"] td:first-child,
  [id*="_lookupmodal"] table tbody tr.selected td:first-child,
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td:first-child {
    width: 50px !important; /* Fixed width instead of auto to prevent shrinking */
    min-width: 50px !important;
    max-width: 50px !important;
    text-align: center !important;
  }

  /* Ensure checkbox stays properly sized on desktop */
  .modal-lookup table tbody tr.selected td:first-child input[type="checkbox"],
  .modal-lookup table tbody tr[class*="selected"] td:first-child input[type="checkbox"],
  .entity-lookup table tbody tr.selected td:first-child input[type="checkbox"],
  .entity-lookup table tbody tr[class*="selected"] td:first-child input[type="checkbox"],
  #customerid_lookupmodal table tbody tr.selected td:first-child input[type="checkbox"],
  #customerid_lookupmodal table tbody tr[class*="selected"] td:first-child input[type="checkbox"],
  [id*="_lookupmodal"] table tbody tr.selected td:first-child input[type="checkbox"],
  [id*="_lookupmodal"] table tbody tr[class*="selected"] td:first-child input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    margin: 0 auto !important; /* Center the checkbox in the cell */
  }
}

/* =========================================================
   FIX: Calendar Page - Mobile Button Sizing & Layout
   ========================================================= */

@media (max-width: 767px) {
  /* Calendar container - better mobile spacing */
  #salesorder-calendar {
    margin: var(--spacing-sm) auto !important;
    padding: var(--spacing-sm) !important;
  }
  
  /* FullCalendar toolbar - stack on mobile */
  .fc .fc-toolbar {
    flex-direction: column !important;
    gap: var(--spacing-sm) !important;
    padding: var(--spacing-sm) 0 !important;
  }
  
  /* Toolbar sections - full width on mobile */
  .fc .fc-toolbar-chunk {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: var(--spacing-xs) !important;
  }
  
  /* Left toolbar (prev/next/today) */
  .fc .fc-toolbar-chunk:first-child {
    order: 2 !important;
    justify-content: center !important;
  }
  
  /* Center toolbar (title) */
  .fc .fc-toolbar-chunk:nth-child(2) {
    order: 1 !important;
    width: 100% !important;
  }
  
  /* Right toolbar (view buttons) */
  .fc .fc-toolbar-chunk:last-child {
    order: 3 !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
  
  /* Calendar title - responsive sizing */
  .fc .fc-toolbar-title {
    font-size: clamp(1.25rem, 4vw, 1.75rem) !important;
    text-align: center !important;
    margin: var(--spacing-xs) 0 !important;
  }
  
  /* All FullCalendar buttons - touch-friendly */
  .fc .fc-button,
  .fc .fc-button-primary {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    font-size: 0.9rem !important;
    border-radius: var(--radius-md) !important;
    margin: 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Navigation buttons (prev/next) */
  .fc .fc-prev-button,
  .fc .fc-next-button {
    min-width: 44px !important;
    width: 44px !important;
    padding: var(--spacing-sm) !important;
  }
  
  /* Today button */
  .fc .fc-today-button {
    min-width: 80px !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
  }
  
  /* View toggle buttons (Month/Week/Day) */
  .fc .fc-dayGridMonth-button,
  .fc .fc-timeGridWeek-button,
  .fc .fc-timeGridDay-button {
    min-width: 60px !important;
    padding: var(--spacing-sm) var(--spacing-sm) !important;
    font-size: 0.85rem !important;
  }
  
  /* Download button */
  .fc .fc-downloadIcs-button {
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: var(--spacing-sm) !important;
    margin-left: var(--spacing-xs) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Download button icon */
  .fc .fc-downloadIcs-button .fa,
  .fc .fc-downloadIcs-button span {
    font-size: 1.1rem !important;
  }
  
  /* Button group - better spacing */
  .fc .fc-button-group {
    display: flex !important;
    gap: var(--spacing-xs) !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
  
  /* Calendar grid - better mobile spacing */
  .fc .fc-daygrid-day {
    min-height: 80px !important;
  }
  
  .fc .fc-daygrid-day-frame {
    padding: var(--spacing-xs) !important;
  }
  
  /* Calendar events - better mobile display */
  .fc .fc-daygrid-event {
    font-size: 0.75rem !important;
    padding: 2px 4px !important;
    margin: 1px 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  /* Day numbers - better sizing */
  .fc .fc-daygrid-day-number {
    font-size: 0.9rem !important;
    padding: var(--spacing-xs) !important;
  }
  
  /* Day headers - better mobile */
  .fc .fc-col-header-cell {
    padding: var(--spacing-xs) !important;
  }
  
  .fc .fc-col-header-cell-cushion {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
  }
  
  /* Calendar modal - compact size with space around for clicking */
  #orderEventModal .modal-dialog {
    margin: var(--spacing-xl) var(--spacing-md) !important;
    max-width: calc(100% - var(--spacing-lg)) !important;
    max-height: calc(100vh - var(--spacing-2xl)) !important;
    display: flex !important;
    align-items: center !important;
    min-height: auto !important;
  }
  
  #orderEventModal .modal-content {
    border-radius: var(--radius-lg) !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Modal header - compact */
  #orderEventModal .modal-header {
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm) !important;
    flex-wrap: wrap !important;
    flex-shrink: 0 !important;
    border-bottom: 1px solid #e0e0e0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
  
  /* Ensure close button is visible and accessible */
  #orderEventModal .btn-close {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0.7 !important;
    position: absolute !important;
    top: var(--spacing-sm) !important;
    right: var(--spacing-sm) !important;
    z-index: 10 !important;
    background-size: 1.2rem !important;
  }
  
  #orderEventModal .btn-close:hover,
  #orderEventModal .btn-close:focus {
    opacity: 1 !important;
  }
  
  /* Modal title - centered */
  #orderEventModal .modal-title {
    font-size: 1.1rem !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
  
  /* Modal body - compact with scroll if needed */
  #orderEventModal .modal-body {
    padding: var(--spacing-md) !important;
    font-size: 0.95rem !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    max-height: calc(80vh - 120px) !important;
  }
  
  /* Event title link in modal */
  #orderEventTitleLink {
    font-size: 1.3rem !important;
    word-wrap: break-word !important;
    display: block !important;
    line-height: 2 !important;
  }
  
  /* Paragraph spacing in modal */
  #orderEventModal .modal-body p {
    margin-bottom: var(--spacing-sm) !important;
    line-height: 1.5 !important;
  }
  
  /* Telephone link - inherit font size from paragraph */
  #orderEventCityManagerMobile a {
    font-size: inherit !important;
  }
  
  /* Modal backdrop - ensure it's clickable */
  #orderEventModal.modal.show .modal-backdrop {
    opacity: 0.5 !important;
  }
}

/* Tablet improvements */
@media (min-width: 768px) and (max-width: 991px) {
  .fc .fc-toolbar {
    flex-wrap: wrap !important;
    gap: var(--spacing-sm) !important;
  }
  
  .fc .fc-button {
    min-height: 40px !important;
    padding: var(--spacing-sm) var(--spacing-md) !important;
  }
}

/* Desktop - Calendar Modal Improvements */
@media (min-width: 768px) {
  #orderEventModal .modal-dialog {
    max-width: 500px !important;
    margin: var(--spacing-xl) auto !important;
  }
  
  #orderEventModal .modal-content {
    max-height: 85vh !important;
    overflow-y: auto !important;
  }
  
  #orderEventModal .modal-body {
    max-height: calc(85vh - 150px) !important;
    overflow-y: auto !important;
  }
  
  /* Modal header - centered on desktop */
  #orderEventModal .modal-header {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
  
  /* Modal title - centered on desktop */
  #orderEventModal .modal-title {
    width: 100% !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
}

/* =========================================================
   END OF MODERN RESPONSIVE ENHANCEMENTS
   ========================================================= */

   .columnBlockLayout {
    margin-top: 0px;
    margin-bottom: 40px;
    padding: 16px;
}

a.add-file.btn.btn-primary.action {
  color: var(--portalThemeColor6, #3c3c3c 0) ! IMPORTANT;
}