.page-header .profile-media img {
  width: 37px;
  height: 37px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Chat avatars: never let user photos or UniCeramic stubs render at native size */
.chats-user .chat-time img,
.contact-wrapper .chat-time img,
.left-sidebar-wrapper .chat-time img,
.left-sidebar-wrapper .active-profile img,
.active-profile img,
.right-sidebar-title .chat-time-chat img,
.create-group-members img {
  width: 42px;
  height: 42px;
  max-width: 42px;
  object-fit: cover;
  flex-shrink: 0;
}

.right-sidebar-title .active-profile-chat img {
  width: 40px;
  height: 40px;
  max-width: 40px;
}

.right-sidebar-title .chat-time-chat.group-chat img {
  width: 38px;
  height: 38px;
  max-width: 38px;
}

/* Recent chats stay at the top of the left pane (UniCeramic centers all .advance-options ul) */
.left-sidebar-wrapper .advance-options ul.chats-user,
.left-sidebar-wrapper .advance-options .contact-wrapper ul {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
  align-content: flex-start;
}

.msger-chat {
  background-image: linear-gradient(0deg, #F5F6FA, #F5F6FA), linear-gradient(0deg, #FFFFFF, #FFFFFF) !important;
}

.msger-inputarea {
  flex-wrap: wrap;
  position: relative;
}

.msger-inputarea .chat-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  padding: 0 !important;
  overflow: hidden;
  pointer-events: none;
}

.msger-attach {
  margin-right: 8px;
  margin-bottom: 0;
  cursor: pointer;
}

.msger-attach i {
  font-size: 18px;
  color: var(--theme-default);
}

.chat-attach-chip {
  width: 100%;
  order: -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px 10px !important;
  background: var(--white);
  border-radius: 6px;
  font-size: 13px;
  color: var(--body-font-color);
}

.chat-attach-chip .chat-attach-clear {
  margin-left: auto;
  padding: 0 6px !important;
  background: transparent;
  border: 0;
  color: var(--chart-text-color);
  cursor: pointer;
}

.chat-msg-thumb {
  display: block;
  max-width: 220px;
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}

.chat-thumb-btn,
.chat-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-file-btn {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  max-width: 100%;
}

.left-msg .chat-file-btn {
  background: rgba(0, 0, 0, 0.06);
}

.chat-file-btn i {
  font-size: 18px;
  flex-shrink: 0;
}

.chat-file-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.chat-preview-image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.chat-preview-frame {
  width: 100%;
  min-height: 70vh;
  border: 0;
}

.msg-img {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  background-image: none !important;
  overflow: hidden;
  flex-shrink: 0;
}

.msg-img img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

html[dir="rtl"] body,
html.rtl body,
body.rtl {
  font-family: 'Cairo', 'Rubik', sans-serif;
}

html[dir="rtl"] .page-wrapper .page-header .header-wrapper .nav-right,
html[dir="rtl"] .nav-right.right-header {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .sidebar-submenu {
  text-align: right;
}

html[dir="rtl"] .fin-recent-table table th,
html[dir="rtl"] .fin-recent-table table td,
html[dir="rtl"] .fin-aged-tbl th,
html[dir="rtl"] .fin-aged-tbl td {
  text-align: right;
}

html[dir="rtl"] .fin-aged-tbl .text-end,
html[dir="rtl"] .text-end {
  text-align: left !important;
}

html[dir="rtl"] .dropdown-menu-end {
  --bs-position: start;
}

html[dir="rtl"] .ms-auto {
  margin-left: 0 !important;
  margin-right: auto !important;
}

html[dir="rtl"] .me-1,
html[dir="rtl"] .me-2 {
  margin-right: 0 !important;
  margin-left: 0.25rem !important;
}

.country-flag-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.country-flag-option .flag-icon {
  width: 20px;
  height: 15px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  background-size: cover;
  flex-shrink: 0;
}

.phone-select .select2-selection__rendered,
.phone-select-edit .select2-selection__rendered,
.select-country + .select2 .select2-selection__rendered {
  display: flex !important;
  align-items: center;
}

.phone-select .select2-container--default .select2-selection--single .select2-selection__arrow,
.phone-select-edit .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
}

.select2-container--default .select2-results__option .country-flag-option {
  line-height: 1.2;
}

.select-country + .select2 .select2-selection--single {
  height: auto !important;
  min-height: 47px;
  border: 1px solid #cccccc;
  border-radius: 5px;
  padding: 8px 4px;
}

html[dir="rtl"] .ms-1,
html[dir="rtl"] .ms-2 {
  margin-left: 0 !important;
  margin-right: 0.25rem !important;
}

.right-sidebar-title .group-members-trigger {
  cursor: pointer;
}

.right-sidebar-title button.group-members-trigger {
  display: block;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  text-align: left;
}

.right-sidebar-title button.group-members-trigger:hover {
  color: var(--theme-default);
  text-decoration: underline;
}

.group-members-list img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  flex-shrink: 0;
}

.page-wrapper .page-header .header-wrapper .nav-right .notification-box {
  overflow: visible;
}

.page-wrapper .page-header .header-wrapper .nav-right .notification-box .notification-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  color: #fff;
  background-color: #fc564a;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}

html[dir="rtl"] .page-wrapper .page-header .header-wrapper .nav-right .notification-box .notification-badge,
html.rtl .page-wrapper .page-header .header-wrapper .nav-right .notification-box .notification-badge {
  right: auto;
  left: -8px;
}

.header-alert-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  flex-grow: 1;
}

.header-alert-link:hover {
  color: inherit;
}

.header-alert-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.header-alert-copy,
.header-alert-link.toast-body {
  min-width: 0;
}

.header-alert-preview,
.header-alert-item small,
.header-notification-time {
  display: block;
  opacity: 0.75;
  font-size: 12px;
}

.header-alert-empty {
  padding: 12px 16px;
  color: var(--body-font-color);
}

.header-alert-read {
  opacity: 0.65;
}

.header-chat-dropdown .header-alert-item {
  padding: 8px 12px;
}

.header-chat-dropdown .header-alert-link {
  text-transform: none;
}

.page-wrapper .page-header .header-wrapper .nav-right .notification-dropdown.header-notification-dropdown {
  width: 360px;
}

@media (max-width: 575.98px) {
  .page-wrapper .page-header .header-wrapper .nav-right .notification-dropdown.header-notification-dropdown {
    width: calc(100vw - 30px);
  }
}

#header-notification-list {
  max-height: 360px;
  overflow-y: auto;
}

#header-notification-list .header-notification-item {
  padding: 10px 12px;
  width: 100%;
  max-width: 100%;
  text-align: left;
}

#header-notification-list .header-notification-item:last-child {
  text-align: left;
  background-color: #f9f9f9;
}

body.dark-only #header-notification-list .header-notification-item:last-child {
  background-color: #262932;
}

.header-notification-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.page-wrapper .page-header .header-wrapper .nav-right .notification-dropdown .header-notification-link {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  font-family: inherit;
}

.header-notification-link:hover {
  color: inherit;
}

.header-notification-kind {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 4px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(115, 102, 255, 0.1);
  color: #898989;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-notification-item.b-l-success .header-notification-kind {
  background: rgba(101, 193, 92, 0.15);
}

.header-notification-item.b-l-warning .header-notification-kind {
  background: rgba(255, 170, 68, 0.18);
}

.header-notification-item.b-l-primary .header-notification-kind {
  background: rgba(115, 102, 255, 0.12);
}

.page-wrapper .page-header .header-wrapper .nav-right .notification-dropdown .header-notification-message {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  word-wrap: break-word;
}

.header-notification-time {
  margin-top: 4px;
}

.header-notification-item .header-alert-dismiss {
  flex-shrink: 0;
  margin: 2px 0 0;
  font-size: 10px;
}

#header-chat-list {
  max-height: 320px;
  overflow-y: auto;
}

tr.task-highlight {
  outline: 2px solid var(--theme-default);
  outline-offset: -2px;
}

/* Tasks sidebar avatar: Spatie originals must not render at native size */
.main-tasks .media-size-email,
.task-sidebar .media-size-email {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  overflow: hidden;
  border-radius: 50%;
  flex-shrink: 0;
}

.main-tasks .media-size-email img,
.task-sidebar .media-size-email img {
  width: 42px !important;
  height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.main-tasks .common-circle {
  width: 32px;
  height: 32px;
  overflow: hidden;
  object-fit: cover;
}

.task-chat-mount .msger {
  border: 1px solid var(--chart-dashed-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}

.task-chat-mount .msger-chat {
  height: 280px;
}

.task-discussion-modal .msger-chat {
  height: 420px;
}

.task-chat-people {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.task-chat-people img {
  width: 28px !important;
  height: 28px !important;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-chat-people span {
  font-size: 12px;
  color: var(--chart-text-color);
}

.task-chat-divider {
  border-top: 1px solid var(--chart-dashed-border);
  margin: 16px 0 12px;
}

/* Platform logo: keep a large PNG from overflowing header/sidebar */
.page-wrapper .sidebar-wrapper .logo-wrapper img,
.page-wrapper .page-header .header-logo-wrapper .logo-wrapper img {
  height: 36px;
  max-height: 36px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.page-wrapper .sidebar-wrapper .logo-icon-wrapper img,
.page-wrapper .sidebar-wrapper .sidebar-links .back-btn img {
  height: 32px;
  max-height: 32px;
  width: auto;
  max-width: 40px;
  object-fit: contain;
}

.login-card .logo img {
  height: 48px;
  max-height: 48px;
  width: auto;
  object-fit: contain;
}
