/* ==========================================================================
   VYTALGUARD_RESPONSIVE_PREMIUM_V1_0_5
   Global small-screen safety and premium adaptive layout layer.
   Loaded last so legacy and module-specific desktop styling remains intact.
============================================================================ */

:root {
  --vg-responsive-gutter: clamp(10px, 2.4vw, 24px);
  --vg-responsive-gap: clamp(8px, 1.8vw, 16px);
  --vg-responsive-touch: 44px;
  --vg-responsive-radius: 14px;
  --vg-responsive-viewport-height: 100vh;
  --vg-responsive-keyboard-offset: 0px;
  --vg-responsive-safe-top: env(safe-area-inset-top, 0px);
  --vg-responsive-safe-right: env(safe-area-inset-right, 0px);
  --vg-responsive-safe-bottom: env(safe-area-inset-bottom, 0px);
  --vg-responsive-safe-left: env(safe-area-inset-left, 0px);
  --vg-responsive-table-scroll-track: #edf2f7;
  --vg-responsive-table-scroll-thumb: #94a3b8;
  --vg-responsive-table-scroll-thumb-hover: #64748b;
}

[data-bs-theme="dark"],
[data-theme="dark"] {
  --vg-responsive-table-scroll-track: #172033;
  --vg-responsive-table-scroll-thumb: #64748b;
  --vg-responsive-table-scroll-thumb-hover: #94a3b8;
}

@supports (height: 100dvh) {
  :root {
    --vg-responsive-viewport-height: 100dvh;
  }
}

html,
body {
  max-width: 100%;
}

html {
  min-width: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 0 !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

img,
video,
canvas {
  height: auto;
}

:where(.page-wrapper, .main-container, .app-container, .app-body, main, section, article, form, fieldset, .card, .card-body, .content-surface) {
  min-width: 0;
}

:where(input, select, textarea, button) {
  max-width: 100%;
}

:where(input, select, textarea) {
  min-width: 0;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.34);
  outline-offset: 2px;
}

/* Horizontal regions keep their own overflow instead of widening the page. */
.vg-responsive-table-region,
:where(.table-responsive, .table-container, .table-wrapper, .table-scroll, .responsive-table, [data-table-scroll]) {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.vg-responsive-table-region[data-vg-overflowing="true"],
:where(.table-responsive, .table-container, .table-wrapper, .table-scroll, .responsive-table, [data-table-scroll])[data-vg-overflowing="true"] {
  box-shadow: inset -12px 0 14px -16px rgba(15, 23, 42, 0.68);
}

.vg-responsive-scroll-region {
  -webkit-overflow-scrolling: touch;
}

.vg-responsive-scroll-region[data-vg-scroll-type="navigation"] {
  scrollbar-width: none;
}

.vg-responsive-scroll-region[data-vg-scroll-type="navigation"]::-webkit-scrollbar {
  display: none;
}

/* Navigation stays visually clean; data tables keep an explicit scrollbar. */
.vg-responsive-scroll-region[data-vg-scroll-type="table"] {
  overflow-x: auto !important;
  scrollbar-color: var(--vg-responsive-table-scroll-thumb) var(--vg-responsive-table-scroll-track) !important;
  scrollbar-gutter: stable;
  scrollbar-width: thin !important;
}

.vg-responsive-scroll-region[data-vg-scroll-type="table"][data-vg-overflowing="true"] {
  overflow-x: scroll !important;
}

.vg-responsive-scroll-region[data-vg-scroll-type="table"]::-webkit-scrollbar {
  display: block !important;
  width: 10px;
  height: 10px;
}

.vg-responsive-scroll-region[data-vg-scroll-type="table"]::-webkit-scrollbar-track {
  background: var(--vg-responsive-table-scroll-track);
  border-radius: 999px;
}

.vg-responsive-scroll-region[data-vg-scroll-type="table"]::-webkit-scrollbar-thumb {
  min-width: 42px;
  background: var(--vg-responsive-table-scroll-thumb);
  border: 2px solid var(--vg-responsive-table-scroll-track);
  border-radius: 999px;
}

.vg-responsive-scroll-region[data-vg-scroll-type="table"]::-webkit-scrollbar-thumb:hover {
  background: var(--vg-responsive-table-scroll-thumb-hover);
}

@media print {
  .vg-responsive-scroll-region[data-vg-scroll-type="table"] {
    overflow: visible !important;
    scrollbar-width: none !important;
  }

  .vg-responsive-scroll-region[data-vg-scroll-type="table"]::-webkit-scrollbar {
    display: none !important;
  }
}

/* Bootstrap and legacy rows must never leak outside their page container. */
:where(.app-body, .module-form-page__container, .content-surface) > .row {
  max-width: calc(100% + var(--bs-gutter-x, 1.5rem));
}

/* Dialog baseline also covers public and special pages that do not load app.js. */
:where(.modal, .form-modal, .custom-modal, .confirm-overlay, .vg-command-dialog) {
  max-width: 100vw;
}

:where(.modal-dialog, .modal-content, .confirm-box, .vg-command-dialog__panel) {
  min-width: 0;
  max-width: calc(100vw - (2 * var(--vg-responsive-gutter)));
}

:where(.modal-body, .form-modal .modal-body, .custom-modal .modal-body) {
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Toasts and floating helpers respect notches and the virtual keyboard. */
:where(.toast-container, #toastContainer, .vg-toast-stack, .ops-message) {
  max-width: calc(100vw - var(--vg-responsive-gutter) - var(--vg-responsive-gutter));
}

body.vg-keyboard-open :where(.vg-intel-launcher, .vg-intel-prompt) {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   TABLET AND SMALL LAPTOP
============================================================================ */

@media screen and (max-width: 1199.98px) {
  html,
  body {
    overflow-x: clip;
  }

  .main-container,
  .page-wrapper.pinned .main-container {
    width: 100%;
    max-width: 100%;
    padding-left: 0 !important;
  }

  :where(.container, .container-fluid, .app-body) {
    max-width: 100%;
  }

  :where(.form-grid, .module-form-grid, .filter-grid, .module-filter-grid, .smart-filter-grid)[style*="grid"] {
    min-width: 0;
  }

  :where(.modal.show, .form-modal:not([hidden]), .custom-modal:not([hidden]), .confirm-overlay:not([hidden])) {
    max-height: var(--vg-responsive-viewport-height);
  }
}

/* ==========================================================================
   TABLET
============================================================================ */

@media screen and (max-width: 991.98px) {
  :where(.app-body, .container, .container-fluid) {
    padding-right: max(16px, var(--vg-responsive-safe-right)) !important;
    padding-left: max(16px, var(--vg-responsive-safe-left)) !important;
  }

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

  :where(.filter-grid, .module-filter-grid, .smart-filter-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :where(.page-header, .module-page-header, .communications-toolbar) {
    gap: var(--vg-responsive-gap);
  }

  :where(.modal-dialog, .modal-content, .confirm-box, .vg-command-dialog__panel) {
    max-height: calc(var(--vg-responsive-viewport-height) - (2 * var(--vg-responsive-gutter)));
  }
}

/* ==========================================================================
   MOBILE
============================================================================ */

@media screen and (max-width: 767.98px) {
  :root {
    --vg-responsive-gutter: 12px;
    --vg-responsive-gap: 10px;
  }

  body {
    overflow-x: clip !important;
  }

  :where(.app-body, .container, .container-fluid) {
    width: 100%;
    padding-right: max(var(--vg-responsive-gutter), var(--vg-responsive-safe-right)) !important;
    padding-left: max(var(--vg-responsive-gutter), var(--vg-responsive-safe-left)) !important;
  }

  body:not(.vg-dashboard-page) .app-header {
    position: sticky;
    top: 0;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 56px;
    padding-right: max(12px, var(--vg-responsive-safe-right)) !important;
    padding-left: max(12px, var(--vg-responsive-safe-left)) !important;
  }

  body:not(.vg-dashboard-page) .app-header > * {
    min-width: 0;
  }

  /* The header can wrap on phones, so a fixed 59px sticky offset is unsafe. */
  .app-hero-header {
    position: relative !important;
    top: auto !important;
    display: flex;
    width: 100%;
    min-width: 0;
    padding: 8px max(12px, var(--vg-responsive-safe-right)) 8px max(12px, var(--vg-responsive-safe-left)) !important;
    overflow: visible;
  }

  .app-hero-header:has(#workspaceToolbar, #workspaceHeader, #workspaceNavigation) {
    align-items: stretch !important;
    flex-direction: column;
  }

  :where(#workspaceToolbar, #workspaceHeader, #workspaceNavigation) {
    width: 100%;
    min-width: 0;
    margin-bottom: 0 !important;
  }

  :where(.breadcrumb, .nav-tabs, .workspace-tabs, .module-tabs, .toolbar-tabs, .dashboard-tabs, [role="tablist"]) {
    display: flex;
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap !important;
    gap: 4px;
    padding-bottom: 3px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  :where(.breadcrumb, .nav-tabs, .workspace-tabs, .module-tabs, .toolbar-tabs, .dashboard-tabs, [role="tablist"])::-webkit-scrollbar {
    display: none;
  }

  :where(.breadcrumb-item, .nav-item, [role="tab"]) {
    flex: 0 0 auto;
  }

  .breadcrumb-item {
    max-width: min(62vw, 230px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :where(.page-header, .module-page-header) {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  :where(.page-actions, .module-page-actions, #pageHeaderActions, .card-header__actions, .toolbar-actions, .filter-actions, .form-actions, .form-buttons, .modal-actions) {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    gap: 8px;
  }

  :where(.module-list-card, .module-form-card, .results-card, .table-card, .data-card) > .card-header {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  :where(.module-list-card, .module-form-card, .results-card, .table-card, .data-card) > .card-header > * {
    min-width: 0;
    max-width: 100%;
  }

  :where(.form-grid, .module-form-grid, .form-grid.form-grid-smart, .filter-grid, .module-filter-grid, .smart-filter-grid) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  :where(.form-grid, .module-form-grid, .form-grid.form-grid-smart, .filter-grid, .module-filter-grid, .smart-filter-grid) > * {
    grid-column: 1 / -1 !important;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  :where(.filter-body .filter-grid .col-md-2, .filter-body .filter-grid .col-md-4) {
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  :where(.input-group, .inline-field-group, .form-inline-group) {
    min-width: 0;
    flex-wrap: wrap;
  }

  :where(.dropdown-menu, .field-selector-dropdown) {
    max-width: calc(100vw - 24px) !important;
  }

  :where(.table, .data-table, table) {
    max-width: none;
  }

  :where(.pagination, .dataTables_paginate, .pagination-controls) {
    display: flex;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  :where(.modal, .form-modal, .custom-modal, .confirm-overlay, .vg-command-dialog) {
    box-sizing: border-box;
    width: 100%;
    height: var(--vg-responsive-viewport-height) !important;
    max-height: var(--vg-responsive-viewport-height) !important;
    padding: max(10px, var(--vg-responsive-safe-top)) max(10px, var(--vg-responsive-safe-right)) max(10px, var(--vg-responsive-safe-bottom)) max(10px, var(--vg-responsive-safe-left)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  :where(.modal-dialog, .modal-content, .confirm-box, .vg-command-dialog__panel) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: calc(var(--vg-responsive-viewport-height) - 20px) !important;
    margin: auto !important;
    border-radius: var(--vg-responsive-radius) !important;
  }

  :where(.modal-body, .form-modal .modal-body, .custom-modal .modal-body) {
    min-height: 0;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  :where(.app-footer, footer) {
    padding-right: max(12px, var(--vg-responsive-safe-right)) !important;
    padding-bottom: max(10px, var(--vg-responsive-safe-bottom)) !important;
    padding-left: max(12px, var(--vg-responsive-safe-left)) !important;
  }
}

/* ==========================================================================
   DASHBOARD COMPACT PREMIUM UI
   Refines the dashboard applications workspace without changing module data,
   routes, permissions, translations, tenant scope, or touch accessibility.
============================================================================ */

.vg-dashboard-page {
  --vg-compact-control-height: 42px;
  --vg-compact-touch-height: 44px;
  --vg-compact-module-name: 15px;
}

/* Hero hierarchy: readable, premium, and no longer visually oversized. */
.vg-dashboard-page .app-hero-header {
  min-height: 0 !important;
  padding: 14px clamp(16px, 2vw, 28px) !important;
}

.vg-dashboard-page :where(.dashboard-title, #workspacePageTitle) {
  font-size: clamp(28px, 1.8vw, 32px) !important;
  font-weight: 820 !important;
  line-height: 1.12 !important;
  letter-spacing: -0.03em !important;
}

.vg-dashboard-page .dashboard-subtitle {
  margin-top: 4px !important;
  font-size: 14px !important;
  font-weight: 650 !important;
  line-height: 1.35 !important;
}

/* Compact shell actions and workspace navigation. */
.vg-dashboard-page .header-action-button {
  width: var(--vg-compact-touch-height) !important;
  height: var(--vg-compact-touch-height) !important;
  min-width: var(--vg-compact-touch-height) !important;
  min-height: var(--vg-compact-touch-height) !important;
}

.vg-dashboard-page #userSettings.account-trigger {
  min-height: var(--vg-compact-touch-height) !important;
  padding-block: 5px !important;
}

.vg-dashboard-page .workspace-nav {
  min-height: 50px !important;
  gap: 4px !important;
  margin-bottom: 12px !important;
  padding: 4px !important;
}

.vg-dashboard-page .workspace-tab {
  min-height: 40px !important;
  gap: 7px !important;
  padding: 7px 12px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

.vg-dashboard-page .workspace-tab i {
  font-size: 16px !important;
}

/* Applications header and search. Search remains 16px at every breakpoint so
   mobile browsers do not auto-zoom or change the perceived text size. */
.vg-dashboard-page #workspace-modules-content .modules-header,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-header {
  min-height: 68px !important;
  gap: 14px !important;
  padding: 11px 16px !important;
}

.vg-dashboard-page #workspace-modules-content .modules-title,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-title {
  font-size: 16px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
}

.vg-dashboard-page #workspace-modules-content .modules-description,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-description {
  margin-top: 2px !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

.vg-dashboard-page #workspace-modules-content .modules-search-input,
.vg-dashboard-page #workspace-modules-content .modules-search-input:focus,
.vg-dashboard-page #workspace-modules-content .modules-search-input::placeholder,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-search-input,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-search-input:focus,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-search-input::placeholder {
  font-size: 16px !important;
  line-height: 1.25 !important;
}

.vg-dashboard-page #workspace-modules-content .modules-search-input,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-search-input {
  min-height: 40px !important;
  padding: 7px 12px 7px 36px !important;
}

/* Category rail: compact pills with accessible 42px desktop controls. */
.vg-dashboard-page #workspace-modules-content .modules-categories,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-categories {
  gap: 7px !important;
  padding: 8px 12px 6px !important;
}

.vg-dashboard-page #workspace-modules-content .module-category-btn,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-category-btn {
  min-height: var(--vg-compact-control-height) !important;
  gap: 7px !important;
  padding: 7px 12px !important;
  font-size: 14px !important;
  font-weight: 740 !important;
}

.vg-dashboard-page #workspace-modules-content .module-category-btn > i,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-category-btn > i {
  font-size: 16px !important;
}

.vg-dashboard-page #workspace-modules-content .module-category-btn .badge,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-category-btn .badge {
  min-width: 22px !important;
  height: 22px !important;
  padding-inline: 5px !important;
  font-size: 11px !important;
}

.vg-dashboard-page #workspace-modules-content .modules-categories-more,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-categories-more {
  min-width: 106px !important;
  min-height: var(--vg-compact-control-height) !important;
  gap: 5px !important;
  padding: 7px 10px !important;
  font-size: 13px !important;
}

/* Application grid: more useful content per viewport while preserving two
   readable lines for long EN/FR module names. */
.vg-dashboard-page #workspace-modules-content .modules-grid,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)) !important;
  gap: 10px !important;
  padding: 14px !important;
}

.vg-dashboard-page #workspace-modules-content .module-tile,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-tile {
  min-height: 120px !important;
  gap: 9px !important;
  padding: 12px 10px !important;
  border-radius: 13px !important;
}

.vg-dashboard-page #workspace-modules-content .module-icon,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-icon {
  width: 52px !important;
  height: 52px !important;
  flex-basis: 52px !important;
  border-radius: 13px !important;
}

.vg-dashboard-page #workspace-modules-content .module-icon i,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-icon i {
  font-size: 21px !important;
}

.vg-dashboard-page #workspace-modules-content .module-name,
body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-name {
  display: -webkit-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 2.5em !important;
  overflow: hidden !important;
  font-size: var(--vg-compact-module-name) !important;
  font-weight: 760 !important;
  line-height: 1.25 !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  hyphens: auto !important;
  text-overflow: ellipsis !important;
  white-space: normal !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

@media screen and (max-width: 1199.98px) {
  .vg-dashboard-page :where(.dashboard-title, #workspacePageTitle) {
    font-size: 28px !important;
  }

  .vg-dashboard-page #workspace-modules-content .modules-grid,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-grid {
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)) !important;
  }
}

@media screen and (max-width: 767.98px) {
  .vg-dashboard-page .app-hero-header {
    padding: 12px max(12px, var(--vg-responsive-safe-right)) 12px max(12px, var(--vg-responsive-safe-left)) !important;
  }

  .vg-dashboard-page :where(.dashboard-title, #workspacePageTitle) {
    font-size: 26px !important;
    white-space: normal !important;
  }

  .vg-dashboard-page .dashboard-subtitle {
    font-size: 14px !important;
    white-space: normal !important;
  }

  .vg-dashboard-page :where(.workspace-mobile-back, .workspace-section-trigger, .modules-search-toggle) {
    min-height: var(--vg-compact-touch-height) !important;
  }

  .vg-dashboard-page #workspace-modules-content .modules-header,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-header {
    min-height: 60px !important;
    padding: 9px 10px !important;
  }

  .vg-dashboard-page #workspace-modules-content .module-category-btn,
  .vg-dashboard-page #workspace-modules-content .modules-categories-more,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-category-btn,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-categories-more {
    min-height: var(--vg-compact-touch-height) !important;
  }

  .vg-dashboard-page #workspace-modules-content .modules-grid,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .vg-dashboard-page #workspace-modules-content .module-tile,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-tile {
    min-height: 112px !important;
    gap: 7px !important;
    padding: 10px 8px !important;
  }

  .vg-dashboard-page #workspace-modules-content .module-icon,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-icon {
    width: 44px !important;
    height: 44px !important;
    flex-basis: 44px !important;
    border-radius: 12px !important;
  }

  .vg-dashboard-page #workspace-modules-content .module-name,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .module-name {
    font-size: 14px !important;
  }
}

@media screen and (max-width: 359.98px) {
  .vg-dashboard-page #workspace-modules-content .modules-grid,
  body.vg-dashboard-page[data-dashboard-experience="adaptive"] #workspace-modules-content .modules-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* iOS and other mobile browsers auto-zoom controls below 16px. Pinch zoom stays enabled. */
@media screen and (max-width: 1024px) {
  :root body input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  :root body select,
  :root body textarea,
  :root body [contenteditable]:not([contenteditable="false"]),
  :root body .ts-control > input,
  :root body .ts-dropdown input,
  :root body .choices__input,
  :root body .select2-search__field {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   GLOBAL SEARCH FOCUS STABILITY
   Prevent legacy width expansion, focus scaling, and text-size jumps.
============================================================================ */

@media screen and (max-width: 1024px) {
  :where(
    .search-container,
    .dashboard-toolbar-control--search,
    .vg-toolbar-search,
    .toolbar-search,
    .global-search,
    .app-search,
    .header-search,
    .communications-search,
    .message-search,
    .ticket-search
  ) {
    width: min(100%, 420px);
    min-width: 0 !important;
    max-width: 100% !important;
    transform: none !important;
    scale: 1 !important;
    zoom: 1 !important;
  }

  :where(
    input[type="search"],
    .search-container .form-control,
    .dashboard-search-input,
    .modules-search-input,
    .vg-toolbar-search-input,
    .communications-search input,
    .message-search input,
    .ticket-search input
  ) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
    transform: none !important;
    transform-origin: center !important;
    scale: 1 !important;
    zoom: 1 !important;
    touch-action: manipulation;
    transition:
      color 0.16s ease,
      background-color 0.16s ease,
      border-color 0.16s ease,
      box-shadow 0.16s ease !important;
  }

  :where(
    input[type="search"],
    .search-container .form-control,
    .dashboard-search-input,
    .modules-search-input,
    .vg-toolbar-search-input,
    .communications-search input,
    .message-search input,
    .ticket-search input
  ):focus {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 16px !important;
    transform: none !important;
    scale: 1 !important;
    zoom: 1 !important;
  }

  :where(
    input[type="search"],
    .search-container .form-control,
    .dashboard-search-input,
    .modules-search-input,
    .vg-toolbar-search-input
  )::placeholder {
    font-size: 16px !important;
    line-height: 1.25 !important;
    transform: none !important;
    opacity: 1;
  }

  /* Explicit authority is required because several legacy search rules use
     class-level !important declarations. */
  html body input[type="search"],
  html body .search-container .form-control,
  html body .dashboard-search-input,
  html body .modules-search-input,
  html body .vg-toolbar-search-input,
  html body .communications-search input,
  html body .message-search input,
  html body .ticket-search input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
    transform: none !important;
    scale: 1 !important;
    zoom: 1 !important;
  }

  html body input[type="search"]:focus,
  html body .search-container .form-control:focus,
  html body .dashboard-search-input:focus,
  html body .modules-search-input:focus,
  html body .vg-toolbar-search-input:focus,
  html body .communications-search input:focus,
  html body .message-search input:focus,
  html body .ticket-search input:focus {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 16px !important;
    transform: none !important;
    scale: 1 !important;
    zoom: 1 !important;
  }

  html body input[type="search"]::placeholder,
  html body .search-container .form-control::placeholder,
  html body .dashboard-search-input::placeholder,
  html body .modules-search-input::placeholder,
  html body .vg-toolbar-search-input::placeholder {
    font-size: 16px !important;
    line-height: 1.25 !important;
    transform: none !important;
  }
}

@media screen and (max-width: 767.98px) {
  :where(
    .search-container,
    .dashboard-toolbar-control--search,
    .vg-toolbar-search,
    .toolbar-search,
    .global-search,
    .app-search,
    .header-search,
    .communications-search,
    .message-search,
    .ticket-search
  ) {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ==========================================================================
   SMALL PHONES
============================================================================ */

@media screen and (max-width: 479.98px) {
  :root {
    --vg-responsive-gutter: 10px;
    --vg-responsive-radius: 12px;
  }

  :where(.app-body, .container, .container-fluid) {
    padding-right: max(10px, var(--vg-responsive-safe-right)) !important;
    padding-left: max(10px, var(--vg-responsive-safe-left)) !important;
  }

  :where(.card, .content-surface, .form-container, .filter-panel) {
    max-width: 100%;
    border-radius: 10px;
  }

  :where(.card-body, .content-surface, .form-container, .filter-body) {
    padding-right: 10px;
    padding-left: 10px;
  }

  :where(.page-title, .module-form-header__title, .card-title) {
    overflow-wrap: anywhere;
  }

  :where(.page-actions, .module-page-actions, #pageHeaderActions, .card-header__actions, .toolbar-actions, .filter-actions) > :where(.btn, button, a.btn) {
    flex: 1 1 auto;
    min-width: min(132px, 100%);
  }

  :where(.toast-container, #toastContainer, .vg-toast-stack, .ops-message) {
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-width: none !important;
  }
}

/* ==========================================================================
   TOUCH, MOTION, CONTRAST, AND PRINT
============================================================================ */

@media (hover: none) and (pointer: coarse) {
  :where(button, .btn, [role="button"], .nav-link, .page-link, summary) {
    min-height: var(--vg-responsive-touch);
  }

  :where(input[type="checkbox"], input[type="radio"]) {
    min-width: 20px;
    min-height: 20px;
  }

  :where(.table-responsive, .table-container, .table-wrapper, .vg-responsive-table-region) {
    scroll-snap-type: x proximity;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :where(.card, .content-surface, input, select, textarea, button, .btn) {
    border-width: 2px;
  }
}

@media print {
  .vg-responsive-scroll-region,
  .vg-responsive-table-region,
  :where(.table-responsive, .table-container, .table-wrapper) {
    max-width: none !important;
    overflow: visible !important;
    box-shadow: none !important;
  }

  body {
    overflow: visible !important;
  }
}

/* ==========================================================================
   COMMUNICATIONS WORKSPACE PREMIUM STRUCTURE
   Corrects the messages-list desktop/mobile composition while preserving its
   list, chat, context, support-ticket, permission, tenant, and i18n behavior.
============================================================================ */

/* The page ships an intentionally empty legacy header. Do not reserve a large
   blue bar for content that does not exist. */
body.communications-page .app-header:empty {
  display: none !important;
  min-height: 0 !important;
  padding: 0 !important;
}

body.communications-page .app-hero-header {
  top: 0 !important;
  min-height: 56px !important;
  padding: 10px clamp(16px, 2vw, 28px) !important;
  border-top: 0 !important;
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.2), 0 8px 24px rgba(15, 23, 42, 0.04) !important;
}

body.communications-page .app-hero-header .breadcrumb {
  min-width: 0;
  gap: 2px;
}

body.communications-page .app-hero-header .breadcrumb-item {
  min-width: 0;
  font-size: 14px !important;
}

body.communications-page .app-hero-header .breadcrumb-item i {
  font-size: 20px !important;
}

body.communications-page .communications-body {
  width: 100%;
  max-width: 1680px;
  min-height: 0 !important;
  margin-inline: auto;
  padding: 16px clamp(16px, 2vw, 28px) 24px !important;
}

body.communications-page .communications-card {
  max-width: 100%;
  border-radius: 16px !important;
  box-shadow: 0 14px 36px rgba(15, 35, 55, 0.075) !important;
}

body.communications-page .communications-toolbar {
  gap: 18px !important;
  padding: 16px 18px !important;
}

body.communications-page .communications-heading h1 {
  font-size: clamp(22px, 1.7vw, 26px) !important;
  font-weight: 800 !important;
  line-height: 1.18 !important;
}

body.communications-page .communications-heading p {
  margin-top: 4px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
}

body.communications-page :where(
  .communications-primary-action,
  .communications-icon-button,
  .connection-status
) {
  min-height: 42px !important;
}

body.communications-page .communications-icon-button {
  width: 42px !important;
  height: 42px !important;
}

body.communications-page .communications-overview {
  min-width: 0;
}

body.communications-page .overview-stat {
  min-width: 0 !important;
  min-height: 64px !important;
  padding: 10px 14px !important;
}

body.communications-page .overview-stat-icon {
  width: 36px !important;
  height: 36px !important;
}

body.communications-page .overview-stat strong {
  font-size: 16px !important;
}

body.communications-page .overview-stat small {
  font-size: 11px !important;
}

/* Keep filters aligned with the master filter rhythm. Inline help remains in
   Vee but is suppressed here because an icon appended after a select creates
   the detached purple row visible in the current page. */
body.communications-page .communications-filters {
  align-items: center !important;
  grid-template-columns: minmax(280px, 1.5fr) repeat(3, minmax(150px, 0.75fr)) auto !important;
  gap: 9px !important;
  padding: 10px 14px !important;
  overflow: visible !important;
}

body.communications-page .communications-filters :where(.communications-search, .filter-field) {
  min-width: 0 !important;
  width: 100% !important;
}

body.communications-page .communications-filters :where(.form-control, .form-select, .filter-clear-button) {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 42px !important;
}

body.communications-page .communications-filters .vg-help-inline,
body.communications-page .message-search .vg-help-inline,
body.communications-page .ticket-search .vg-help-inline {
  display: none !important;
}

body.communications-page .messages-layout {
  min-width: 0 !important;
  height: min(720px, max(590px, calc(100dvh - 260px))) !important;
  min-height: 590px !important;
  grid-template-columns: minmax(290px, 330px) minmax(420px, 1fr) minmax(285px, 325px) !important;
}

body.communications-page :where(.messages-sidebar, .messages-chat, .ticket-context) {
  min-width: 0 !important;
  min-height: 0 !important;
}

body.communications-page .chat-header {
  min-width: 0;
  min-height: 72px !important;
  padding: 10px 14px !important;
}

body.communications-page .chat-identity,
body.communications-page .chat-heading-copy,
body.communications-page .chat-header-actions {
  min-width: 0;
}

body.communications-page .message-search {
  min-width: 0 !important;
}

body.communications-page .message-search .form-control,
body.communications-page .message-search .form-control:focus,
body.communications-page .message-search .form-control::placeholder {
  font-size: 16px !important;
  transform: none !important;
  zoom: 1 !important;
}

body.communications-page .chat-composer textarea,
body.communications-page .chat-composer textarea:focus,
body.communications-page .chat-composer textarea::placeholder {
  font-size: 16px !important;
}

@media screen and (min-width: 768px) and (max-width: 1199.98px) {
  body.communications-page .communications-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.communications-page .communications-search {
    grid-column: 1 / -1;
  }

  body.communications-page .filter-field:nth-of-type(4) {
    display: block !important;
  }

  body.communications-page .messages-layout {
    min-height: 560px !important;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) !important;
  }
}

@media screen and (max-width: 767.98px) {
  body.communications-page {
    background: #eef4f8 !important;
  }

  body.communications-page .app-hero-header {
    min-height: 50px !important;
    padding: 8px max(12px, var(--vg-responsive-safe-right)) 8px max(12px, var(--vg-responsive-safe-left)) !important;
  }

  body.communications-page .app-hero-header .breadcrumb {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow: hidden;
  }

  body.communications-page .app-hero-header .breadcrumb-item {
    overflow: hidden;
    font-size: 13px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.communications-page .communications-body {
    padding: 10px max(10px, var(--vg-responsive-safe-right)) max(16px, var(--vg-responsive-safe-bottom)) max(10px, var(--vg-responsive-safe-left)) !important;
  }

  body.communications-page .communications-card {
    overflow: hidden !important;
    border: 1px solid rgba(203, 216, 228, 0.95) !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 30px rgba(15, 35, 55, 0.08) !important;
  }

  body.communications-page .communications-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 13px 14px !important;
  }

  body.communications-page .communications-kicker {
    display: block !important;
    margin-bottom: 4px !important;
    font-size: 10px !important;
  }

  body.communications-page .communications-heading h1 {
    max-width: 13ch;
    overflow-wrap: normal;
    font-size: 22px !important;
    line-height: 1.16 !important;
  }

  body.communications-page .communications-heading p {
    display: none !important;
  }

  body.communications-page .communications-toolbar-actions {
    gap: 7px !important;
  }

  body.communications-page :where(
    .communications-primary-action,
    .communications-icon-button,
    .connection-status
  ) {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  body.communications-page .communications-overview {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    overflow: visible !important;
  }

  body.communications-page .overview-stat {
    width: auto !important;
    min-width: 0 !important;
    min-height: 58px !important;
    gap: 9px !important;
    padding: 9px 10px !important;
  }

  body.communications-page .overview-stat-icon {
    width: 34px !important;
    height: 34px !important;
  }

  body.communications-page .overview-stat strong {
    font-size: 15px !important;
  }

  body.communications-page .overview-stat small {
    overflow: visible !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  body.communications-page .communications-filters {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
    overflow: visible !important;
  }

  body.communications-page .communications-search {
    grid-column: 1 / -1;
    min-width: 0 !important;
  }

  body.communications-page .filter-field {
    display: block !important;
    min-width: 0 !important;
  }

  body.communications-page .communications-filters :where(.form-control, .form-select, .filter-clear-button) {
    min-height: 44px !important;
    font-size: 16px !important;
  }

  body.communications-page .filter-clear-button {
    padding-inline: 10px !important;
  }

  body.communications-page .messages-layout {
    display: block !important;
    height: min(720px, max(540px, calc(100dvh - 220px))) !important;
    min-height: 540px !important;
    overflow: hidden !important;
  }

  body.communications-page .messages-layout .messages-sidebar,
  body.communications-page .messages-layout .messages-chat,
  body.communications-page .messages-layout .ticket-context {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  body.communications-page .chat-header {
    display: grid !important;
    min-height: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 9px !important;
    padding: 10px !important;
  }

  body.communications-page .chat-identity {
    width: 100%;
    min-width: 0;
    gap: 9px !important;
  }

  body.communications-page .mobile-back-button,
  body.communications-page .chat-avatar,
  body.communications-page .context-toggle {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  body.communications-page .chat-heading-copy {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.communications-page .chat-heading-copy h2 {
    font-size: 15px !important;
  }

  body.communications-page .chat-header-actions {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: minmax(0, 1fr) 44px !important;
    gap: 8px !important;
  }

  body.communications-page .chat-presence {
    display: none !important;
  }

  body.communications-page .message-search {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.communications-page .message-search > i {
    top: 50% !important;
    left: 12px !important;
    transform: translateY(-50%) !important;
  }

  body.communications-page .message-search .form-control,
  body.communications-page .message-search .form-control:focus {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    padding: 8px 12px 8px 36px !important;
    color: var(--vg-ink) !important;
    background: #f9fbfc !important;
    cursor: text !important;
    transform: none !important;
  }

  body.communications-page .chat-content {
    min-height: 0 !important;
  }

  body.communications-page .chat-messages {
    padding: 14px 10px !important;
  }

  body.communications-page .chat-empty-state,
  body.communications-page .chat-loading-state {
    padding: 20px 14px !important;
  }

  body.communications-page .message-bubble {
    max-width: 92% !important;
  }

  body.communications-page .chat-composer {
    position: relative;
    z-index: 6;
    grid-template-columns: 44px minmax(0, 1fr) 44px !important;
    gap: 7px !important;
    padding: 9px 9px max(9px, var(--vg-responsive-safe-bottom)) !important;
  }

  body.communications-page .composer-icon-button,
  body.communications-page .composer-send-button {
    width: 44px !important;
    height: 44px !important;
  }

  body.communications-page .composer-input-wrap {
    min-width: 0;
  }

  body.communications-page .chat-composer textarea {
    min-height: 44px !important;
    padding: 9px 10px 5px !important;
  }

  body.communications-page .communications-mobile-nav {
    position: sticky !important;
    z-index: 18;
    bottom: 0;
    padding-bottom: var(--vg-responsive-safe-bottom);
    box-shadow: 0 -8px 22px rgba(15, 35, 55, 0.08);
  }

  body.communications-page .communications-mobile-nav button {
    min-height: 56px !important;
    font-size: 11px !important;
  }

  /* Keep Vee available without covering the message composer. */
  body.communications-page .vg-intel-launcher {
    right: max(10px, var(--vg-responsive-safe-right)) !important;
    bottom: calc(122px + var(--vg-responsive-safe-bottom)) !important;
    width: 50px !important;
    height: 50px !important;
  }

  body.communications-page:has(.chat-composer:focus-within) .vg-intel-launcher {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

@media screen and (max-width: 379.98px) {
  body.communications-page .communications-toolbar {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.communications-page .communications-toolbar-actions {
    justify-content: flex-start;
  }

  body.communications-page .communications-filters {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.communications-page .communications-search {
    grid-column: auto;
  }
}

/* ==========================================================================
   COMMUNICATIONS STANDARD PAGE CONTAINER v1.0.4
   Matches the normal page-wrapper/app-container/app-body rhythm and restores
   comfortable reading density without changing Communications behavior.
============================================================================ */

body.communications-page .page-wrapper,
body.communications-page .app-container {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
}

/* Regular application pages retain the 59px blue shell band. */
body.communications-page .app-header:empty {
  display: flex !important;
  width: 100% !important;
  height: 59px !important;
  min-height: 59px !important;
  padding: 0 1.5rem !important;
}

body.communications-page .app-hero-header {
  position: sticky !important;
  top: 59px !important;
  min-height: 0 !important;
  padding: .5rem 1.5rem !important;
}

/* Use the same 1.5rem body gutter as normal list and form pages. */
body.communications-page .communications-body {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 1.5rem !important;
}

body.communications-page .communications-card {
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 18px !important;
  box-shadow: 0 18px 45px rgba(15, 35, 55, .08) !important;
}

body.communications-page .communications-toolbar {
  gap: 24px !important;
  padding: 22px 24px 18px !important;
}

body.communications-page .communications-kicker {
  margin-bottom: 5px !important;
  font-size: .7rem !important;
}

body.communications-page .communications-heading h1 {
  max-width: none;
  font-size: clamp(1.45rem, 2vw, 1.8rem) !important;
  line-height: 1.22 !important;
}

body.communications-page .communications-heading p {
  display: block !important;
  margin-top: 6px !important;
  font-size: .9rem !important;
  line-height: 1.5 !important;
}

body.communications-page :where(
  .communications-primary-action,
  .communications-secondary-action,
  .communications-warning-action,
  .communications-icon-button,
  .connection-status
) {
  min-height: 44px !important;
  font-size: .84rem !important;
}

body.communications-page .communications-primary-action {
  width: auto !important;
  min-width: 0 !important;
  padding-inline: 16px !important;
}

body.communications-page .communications-primary-action span {
  display: inline !important;
}

body.communications-page .communications-icon-button {
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
}

body.communications-page .overview-stat {
  min-height: 74px !important;
  gap: 12px !important;
  padding: 13px 17px !important;
}

body.communications-page .overview-stat-icon {
  width: 40px !important;
  height: 40px !important;
  font-size: 1.08rem !important;
}

body.communications-page .overview-stat strong {
  font-size: 1.08rem !important;
}

body.communications-page .overview-stat small {
  font-size: .72rem !important;
  line-height: 1.35 !important;
}

body.communications-page .communications-filters {
  align-items: center !important;
  grid-template-columns: minmax(300px, 1.5fr) repeat(3, minmax(160px, .75fr)) auto !important;
  gap: 12px !important;
  padding: 14px 16px !important;
}

body.communications-page .communications-filters :where(
  .form-control,
  .form-select,
  .filter-clear-button
) {
  min-height: 44px !important;
  font-size: .875rem !important;
}

body.communications-page .messages-layout {
  height: min(74vh, 830px) !important;
  min-height: 620px !important;
  grid-template-columns: minmax(300px, 350px) minmax(430px, 1fr) minmax(300px, 340px) !important;
}

body.communications-page .sidebar-mode-tabs {
  gap: 7px !important;
  padding: 10px !important;
}

body.communications-page .sidebar-mode-tab {
  min-height: 42px !important;
  padding: 8px 10px !important;
  font-size: .8rem !important;
}

body.communications-page .sidebar-heading {
  min-height: 66px !important;
  padding: 13px 17px !important;
}

body.communications-page .sidebar-title {
  font-size: .95rem !important;
}

body.communications-page .sidebar-count {
  font-size: .76rem !important;
}

body.communications-page .conversation-item {
  grid-template-columns: 48px minmax(0, 1fr) !important;
  gap: 12px !important;
  padding: 14px 16px !important;
}

body.communications-page .conversation-avatar {
  width: 48px !important;
  height: 48px !important;
  font-size: .88rem !important;
}

body.communications-page .conversation-name {
  font-size: .9rem !important;
}

body.communications-page .conversation-message {
  font-size: .8rem !important;
  line-height: 1.5 !important;
}

body.communications-page .conversation-time {
  font-size: .72rem !important;
}

body.communications-page .conversation-tag,
body.communications-page .mode-count,
body.communications-page .ticket-source-badge,
body.communications-page .ticket-status-badge,
body.communications-page .ticket-priority-badge {
  font-size: .65rem !important;
}

body.communications-page .chat-header {
  min-height: 84px !important;
  gap: 16px !important;
  padding: 13px 18px !important;
}

body.communications-page .chat-avatar {
  width: 48px !important;
  height: 48px !important;
  font-size: .88rem !important;
}

body.communications-page .chat-heading-copy h2 {
  font-size: 1rem !important;
}

body.communications-page .chat-heading-copy > p,
body.communications-page .chat-presence {
  font-size: .76rem !important;
}

body.communications-page .message-search {
  width: min(250px, 24vw) !important;
}

body.communications-page .message-search .form-control,
body.communications-page .message-search .form-control:focus {
  height: 42px !important;
  font-size: 16px !important;
}

body.communications-page .context-toggle {
  min-height: 42px !important;
  font-size: .76rem !important;
}

body.communications-page .message-text {
  font-size: .9rem !important;
  line-height: 1.55 !important;
}

body.communications-page .message-sender,
body.communications-page .message-meta,
body.communications-page .message-time {
  font-size: .72rem !important;
}

body.communications-page .chat-composer {
  gap: 9px !important;
  padding: 12px 14px !important;
}

body.communications-page .chat-composer textarea {
  min-height: 48px !important;
  font-size: 16px !important;
  line-height: 1.45 !important;
}

body.communications-page .composer-icon-button,
body.communications-page .composer-send-button {
  width: 46px !important;
  height: 46px !important;
}

body.communications-page .ticket-context-header {
  min-height: 74px !important;
  padding: 13px 16px !important;
}

body.communications-page .ticket-context-header h2 {
  font-size: .98rem !important;
}

body.communications-page .ticket-context-content {
  padding: 16px !important;
}

body.communications-page .ticket-identity-card h3 {
  font-size: .95rem !important;
}

body.communications-page .ticket-facts dt,
body.communications-page .ticket-facts dd {
  padding: 9px 10px !important;
  font-size: .72rem !important;
}

@media screen and (min-width: 768px) and (max-width: 1199.98px) {
  body.communications-page .communications-body {
    padding: 1.25rem !important;
  }

  body.communications-page .communications-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.communications-page .communications-search {
    grid-column: 1 / -1;
  }

  body.communications-page .messages-layout {
    min-height: 600px !important;
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) !important;
  }
}

@media screen and (max-width: 767.98px) {
  body.communications-page .app-header:empty {
    height: 56px !important;
    min-height: 56px !important;
    padding-right: max(12px, var(--vg-responsive-safe-right)) !important;
    padding-left: max(12px, var(--vg-responsive-safe-left)) !important;
  }

  body.communications-page .app-hero-header {
    position: relative !important;
    top: auto !important;
    min-height: 50px !important;
    padding: 10px max(16px, var(--vg-responsive-safe-right)) 10px max(16px, var(--vg-responsive-safe-left)) !important;
  }

  body.communications-page .communications-body {
    padding: 16px max(14px, var(--vg-responsive-safe-right)) max(20px, var(--vg-responsive-safe-bottom)) max(14px, var(--vg-responsive-safe-left)) !important;
  }

  body.communications-page .communications-card {
    border-radius: 16px !important;
  }

  body.communications-page .communications-toolbar {
    display: flex !important;
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 14px !important;
    padding: 18px !important;
  }

  body.communications-page .communications-heading h1 {
    max-width: none !important;
    font-size: 1.45rem !important;
    line-height: 1.22 !important;
  }

  body.communications-page .communications-heading p {
    display: block !important;
    font-size: .875rem !important;
  }

  body.communications-page .communications-toolbar-actions {
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 9px !important;
  }

  body.communications-page .communications-primary-action,
  body.communications-page .connection-status {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 46px !important;
    padding: 9px 14px !important;
  }

  body.communications-page .communications-primary-action span,
  body.communications-page .connection-status span {
    display: inline !important;
  }

  body.communications-page .communications-icon-button {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
  }

  body.communications-page .communications-overview {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.communications-page .overview-stat {
    min-height: 72px !important;
    gap: 11px !important;
    padding: 12px !important;
  }

  body.communications-page .overview-stat-icon {
    width: 40px !important;
    height: 40px !important;
  }

  body.communications-page .overview-stat strong {
    font-size: 1rem !important;
  }

  body.communications-page .overview-stat small {
    font-size: .72rem !important;
    white-space: normal !important;
  }

  body.communications-page .communications-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 14px !important;
  }

  body.communications-page .communications-search {
    grid-column: 1 / -1;
  }

  body.communications-page .communications-filters :where(
    .form-control,
    .form-select,
    .filter-clear-button
  ) {
    min-height: 46px !important;
    font-size: 16px !important;
  }

  body.communications-page .messages-layout {
    display: block !important;
    height: clamp(620px, 72dvh, 780px) !important;
    min-height: 620px !important;
  }

  body.communications-page .sidebar-mode-tabs {
    padding: 12px !important;
  }

  body.communications-page .sidebar-mode-tab {
    min-height: 46px !important;
    font-size: .84rem !important;
  }

  body.communications-page .conversation-item {
    padding: 15px 16px !important;
  }

  body.communications-page .chat-header {
    gap: 12px !important;
    padding: 14px !important;
  }

  body.communications-page .mobile-back-button,
  body.communications-page .chat-avatar {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
  }

  body.communications-page .chat-header-actions {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 10px !important;
  }

  body.communications-page .message-search {
    width: 100% !important;
  }

  body.communications-page .message-search .form-control,
  body.communications-page .message-search .form-control:focus {
    height: 46px !important;
  }

  body.communications-page .context-toggle {
    width: auto !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding-inline: 12px !important;
  }

  body.communications-page .context-toggle span {
    display: inline !important;
  }

  body.communications-page .chat-messages {
    padding: 18px 14px !important;
  }

  body.communications-page .message-bubble {
    max-width: 90% !important;
  }

  body.communications-page .chat-composer {
    grid-template-columns: 46px minmax(0, 1fr) 46px !important;
    gap: 9px !important;
    padding: 12px 12px max(12px, var(--vg-responsive-safe-bottom)) !important;
  }

  body.communications-page .chat-composer textarea {
    min-height: 48px !important;
    padding: 10px 12px 7px !important;
  }

  body.communications-page .communications-mobile-nav button {
    min-height: 60px !important;
    font-size: .72rem !important;
  }

  body.communications-page .vg-intel-launcher {
    bottom: calc(132px + var(--vg-responsive-safe-bottom)) !important;
  }
}

@media screen and (max-width: 575.98px) {
  body.communications-page .communications-filters {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.communications-page .communications-search {
    grid-column: auto;
  }

  body.communications-page .filter-clear-button {
    width: 100% !important;
  }
}

@media screen and (max-width: 379.98px) {
  body.communications-page .communications-body {
    padding-right: max(10px, var(--vg-responsive-safe-right)) !important;
    padding-left: max(10px, var(--vg-responsive-safe-left)) !important;
  }

  body.communications-page .communications-toolbar {
    padding: 16px !important;
  }

  body.communications-page .communications-overview {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.communications-page .communications-primary-action {
    flex: 1 1 auto;
  }

  body.communications-page .connection-status {
    max-width: 100%;
  }
}
