/* V24 tiny targeted fix only: group fallback icon + RTL layout popup clamp. No global palette or layout changes. */
.cchat-room-row.is-group .cchat-room-avatar.ds-v24-group-icon,
.recent-room-item.is-group .cchat-avatar.ds-v24-group-icon,
.cchat-v146-header.is-v146-group .cchat-v146-avatar.ds-v24-group-icon,
.cchat-v140-header.is-v146-group .cchat-v140-avatar.ds-v24-group-icon,
.cchat-v140-header.is-group .cchat-v140-avatar.ds-v24-group-icon {
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  color: transparent !important;
  font-size: 0 !important;
  overflow: hidden !important;
  background: linear-gradient(135deg, #f7f2ff, #ede7ff) !important;
  border-color: #ded0ff !important;
}

.cchat-room-row.is-group .cchat-room-avatar.ds-v24-group-icon svg,
.recent-room-item.is-group .cchat-avatar.ds-v24-group-icon svg,
.cchat-v146-header.is-v146-group .cchat-v146-avatar.ds-v24-group-icon svg,
.cchat-v140-header.is-v146-group .cchat-v140-avatar.ds-v24-group-icon svg,
.cchat-v140-header.is-group .cchat-v140-avatar.ds-v24-group-icon svg {
  width: 62% !important;
  height: 62% !important;
  display: block !important;
  color: #111827 !important;
  stroke: currentColor !important;
  fill: none !important;
  pointer-events: none !important;
}

.cchat-layout-pop-v12.ds-v24-clamped,
[data-layout-menu-pop-v12].ds-v24-clamped,
.cchat-inbox-page .ds-v24-clamped {
  z-index: 2147483000 !important;
  max-width: calc(100vw - 18px) !important;
  box-sizing: border-box !important;
}

/* V253 targeted density fix: desktop frame + Android/Poco visual width only. No backend, template flow, or feature logic changes. */
@media (min-width: 769px) {
  body:not(.admin-page) .app-shell {
    width: 430px !important;
    max-width: 430px !important;
    min-height: calc(100vh - 36px) !important;
    margin-top: 18px !important;
    margin-bottom: 18px !important;
    border-radius: 34px !important;
    overflow: hidden !important;
  }

  body:not(.admin-page) .container {
    padding-inline: 16px !important;
  }

  body:not(.admin-page) .ds-topbar {
    height: 78px !important;
    padding: 12px 15px !important;
    grid-template-columns: 62px minmax(0,1fr) 92px !important;
  }

  body:not(.admin-page) .ds-brand {
    font-size: 26px !important;
    letter-spacing: -.5px !important;
  }

  body:not(.admin-page) .ds-brand img {
    max-width: min(var(--header-logo-width), 156px) !important;
    max-height: min(var(--header-logo-height), 44px) !important;
  }

  body:not(.admin-page) .top-actions .auth-mini,
  body:not(.admin-page) .top-actions .logo-upload-mini {
    width: 37px !important;
    height: 37px !important;
    min-width: 37px !important;
    border-radius: 15px !important;
  }

  body:not(.admin-page) .lang-switch button {
    padding: 7px 8px !important;
    font-size: 12px !important;
  }

  body:not(.admin-page) .ds-bottom-nav {
    width: 402px !important;
    max-width: calc(100vw - 48px) !important;
    height: 70px !important;
    bottom: 18px !important;
    border-radius: 30px !important;
    padding: 0 10px !important;
  }

  body:not(.admin-page) .ds-bottom-nav a {
    height: 52px !important;
    border-radius: 20px !important;
  }

  body:not(.admin-page) .ds-bottom-nav .create-plus {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    margin-top: -21px !important;
  }
}

@media (max-width: 768px) {
  html.ua-android body:not(.admin-page) .app-shell {
    width: min(100%, 390px) !important;
    max-width: 390px !important;
    margin-inline: auto !important;
  }

  html.ua-android body:not(.admin-page) .ds-topbar {
    max-width: 390px !important;
    margin-inline: auto !important;
  }

  html.ua-android body:not(.admin-page) .container {
    padding-inline: 13px !important;
  }

  html.ua-android body:not(.admin-page) .ds-brand {
    font-size: 25px !important;
  }

  html.ua-android body:not(.admin-page) .ds-brand img {
    max-width: min(var(--header-logo-width), 138px) !important;
    max-height: min(var(--header-logo-height), 35px) !important;
  }

  html.ua-android body:not(.admin-page) .ds-bottom-nav {
    width: min(372px, calc(100% - 28px)) !important;
    max-width: 372px !important;
  }
}


/* V254 root device density fix: only visual shell/header/profile density.
   Goal: desktop returns to the intended premium 560px app frame; Android/Poco stops using the over-tight 390px/mini profile overrides and follows the same iPhone-like mobile density.
   No backend, URL, model, view, websocket, or feature logic changes. */
@media (min-width: 769px) {
  body:not(.admin-page) .app-shell {
    width: min(100%, 560px) !important;
    max-width: 560px !important;
    min-height: calc(100vh - 44px) !important;
    margin-top: 22px !important;
    margin-bottom: 22px !important;
    border-radius: 42px !important;
    overflow: visible !important;
    padding-top: 88px !important;
    font-size: 14px !important;
  }

  body:not(.admin-page) .ds-topbar {
    width: min(100%, 560px) !important;
    max-width: 560px !important;
    height: 88px !important;
    top: 22px !important;
    padding: 18px 20px !important;
    border-radius: 42px 42px 0 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  body:not(.admin-page) .ds-brand {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 34px !important;
    max-width: 230px !important;
    letter-spacing: -1px !important;
  }

  body:not(.admin-page) .ds-brand img {
    max-width: min(var(--header-logo-width, 190px), 190px) !important;
    max-height: min(var(--header-logo-height, 62px), 46px) !important;
    object-fit: contain !important;
  }

  body:not(.admin-page) .top-actions .auth-mini,
  body:not(.admin-page) .top-actions .logo-upload-mini,
  body:not(.admin-page) .icon-bubble,
  body:not(.admin-page) .logo-upload-mini {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    border-radius: 50% !important;
  }

  body:not(.admin-page) .container {
    padding-inline: 20px !important;
  }

  body:not(.admin-page) .ds-bottom-nav {
    width: min(520px, calc(100% - 28px)) !important;
    max-width: 520px !important;
    height: 76px !important;
    bottom: 14px !important;
    border-radius: 34px !important;
    padding: 0 14px !important;
  }

  body:not(.admin-page) .ds-bottom-nav a {
    height: 56px !important;
    border-radius: 24px !important;
  }

  body:not(.admin-page) .ds-bottom-nav .create-plus {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    margin-top: -26px !important;
  }
}

@media (max-width: 768px) {
  html.ua-android body:not(.admin-page) {
    font-size: 13.5px !important;
    line-height: 1.42 !important;
    background: #f7f6ff !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }

  html.ua-android body:not(.admin-page) .app-shell {
    width: 100% !important;
    max-width: 430px !important;
    margin-inline: auto !important;
    border-radius: 0 !important;
    overflow-x: hidden !important;
    padding-top: 88px !important;
    padding-bottom: 105px !important;
    font-size: 13.5px !important;
  }

  html.ua-android body:not(.admin-page) .ds-topbar {
    width: min(100%, 430px) !important;
    max-width: 430px !important;
    height: 88px !important;
    padding: 18px 20px !important;
    margin-inline: auto !important;
    background: rgba(255,255,255,.74) !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  html.ua-android body:not(.admin-page) .ds-topbar .ds-brand {
    display: flex !important;
    visibility: visible !important;
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: 132px !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  html.ua-android body:not(.admin-page) .ds-topbar .ds-brand img {
    max-width: 126px !important;
    max-height: 38px !important;
    object-fit: contain !important;
  }

  html.ua-android body:not(.admin-page) .container {
    width: 100% !important;
    max-width: 430px !important;
    padding-inline: 18px !important;
    padding-top: 18px !important;
    margin-inline: auto !important;
  }

  html.ua-android body:not(.admin-page) .card,
  html.ua-android body:not(.admin-page) .profile-hero-story-v1,
  html.ua-android body:not(.admin-page) .profile-showcase-card,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v98,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v99 {
    border-radius: 28px !important;
    padding: 14px !important;
    margin-bottom: 18px !important;
    box-shadow: 0 14px 38px rgba(35,24,72,.09) !important;
  }

  html.ua-android body:not(.admin-page) .profile-main-row {
    grid-template-columns: 112px minmax(0,1fr) !important;
    gap: 14px !important;
    align-items: center !important;
  }

  html.ua-android body:not(.admin-page) .profile-avatar-wrap {
    width: 96px !important;
    height: 96px !important;
  }

  html.ua-android body:not(.admin-page) .profile-avatar-img,
  html.ua-android body:not(.admin-page) .profile-avatar-fallback {
    width: 86px !important;
    height: 86px !important;
  }

  html.ua-android body:not(.admin-page) .profile-username {
    max-width: 108px !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
  }

  html.ua-android body:not(.admin-page) .profile-caption-side {
    min-height: 92px !important;
    border-radius: 22px !important;
    padding: 12px !important;
    font-size: 13.5px !important;
  }

  html.ua-android body:not(.admin-page) .profile-icon-actions {
    gap: 10px !important;
    margin: -2px 0 12px !important;
  }

  html.ua-android body:not(.admin-page) .profile-mini-icon,
  html.ua-android body:not(.admin-page) .auth-mini,
  html.ua-android body:not(.admin-page) .icon-bubble,
  html.ua-android body:not(.admin-page) .logo-upload-mini {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 50% !important;
  }

  html.ua-android body:not(.admin-page) .profile-showcase-strip {
    gap: 10px !important;
    padding-bottom: 8px !important;
  }

  html.ua-android body:not(.admin-page) .profile-showcase-cell {
    width: 68px !important;
    gap: 5px !important;
  }

  html.ua-android body:not(.admin-page) .profile-showcase-item,
  html.ua-android body:not(.admin-page) .profile-showcase-placeholder,
  html.ua-android body:not(.admin-page) .profile-showcase-add,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v98 .profile-showcase-item,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v98 .profile-showcase-placeholder,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v98 .profile-showcase-add,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v99 .profile-showcase-item,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v99 .profile-showcase-placeholder,
  html.ua-android body:not(.admin-page) .profile-showcase-card-v99 .profile-showcase-add {
    width: 68px !important;
    height: 68px !important;
    border-width: 3px !important;
  }

  html.ua-android body:not(.admin-page) .ds-bottom-nav {
    width: min(430px, calc(100% - 24px)) !important;
    max-width: 430px !important;
    height: 64px !important;
    min-height: 64px !important;
    bottom: 10px !important;
    padding: 0 9px !important;
    border-radius: 28px !important;
  }

  html.ua-android body:not(.admin-page) .ds-bottom-nav a {
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 18px !important;
  }

  html.ua-android body:not(.admin-page) .ds-bottom-nav .create-plus {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    margin-top: -18px !important;
  }
}

/* V257 Android/Poco profile density micro-fix.
   Scope: ONLY Android-like mobile profile visual density on profile page blocks.
   No backend, database, URL, websocket, template flow, or other pages touched. */
@media (max-width: 768px) {
  html.ua-android-density body:not(.admin-page) .profile-hero,
  html.ua-android-density body:not(.admin-page) .profile-hero-story-v1 {
    padding: 12px !important;
    border-radius: 25px !important;
    margin-bottom: 14px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-icon-actions {
    gap: 8px !important;
    margin: -1px 0 10px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-icon-actions-right-v223 {
    gap: 8px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-mini-icon {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-mini-icon svg {
    width: 19px !important;
    height: 19px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-people-top-btn-v223 {
    min-width: 64px !important;
    height: 31px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
    gap: 5px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-main-row {
    grid-template-columns: 98px minmax(0, 1fr) !important;
    gap: 11px !important;
    align-items: center !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-avatar-wrap {
    width: 88px !important;
    height: 88px !important;
    border-width: 3px !important;
    box-shadow: 0 0 0 1px #e9ddff, 0 10px 23px rgba(35,24,72,.11) !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-avatar-img,
  html.ua-android-density body:not(.admin-page) .profile-avatar-fallback {
    width: 78px !important;
    height: 78px !important;
    font-size: 27px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-story-plus {
    width: 26px !important;
    height: 26px !important;
    font-size: 18px !important;
    border-width: 3px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-username,
  html.ua-android-density body:not(.admin-page) .profile-username-full {
    max-width: 96px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-caption-side {
    min-height: 82px !important;
    border-radius: 20px !important;
    padding: 10px !important;
    gap: 5px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-caption-side .profile-caption-text {
    font-size: 12px !important;
    line-height: 1.62 !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-showcase-card,
  html.ua-android-density body:not(.admin-page) .profile-showcase-card-v99 {
    padding: 10px !important;
    border-radius: 23px !important;
    margin: 10px 0 13px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-showcase-title {
    font-size: 14px !important;
    line-height: 1.35 !important;
    margin-bottom: 8px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-showcase-strip {
    gap: 7px !important;
    padding-bottom: 7px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-showcase-cell {
    width: 62px !important;
    gap: 4px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-showcase-item,
  html.ua-android-density body:not(.admin-page) .profile-showcase-placeholder,
  html.ua-android-density body:not(.admin-page) .profile-showcase-add,
  html.ua-android-density body:not(.admin-page) .profile-showcase-card-v99 .profile-showcase-item,
  html.ua-android-density body:not(.admin-page) .profile-showcase-card-v99 .profile-showcase-placeholder,
  html.ua-android-density body:not(.admin-page) .profile-showcase-card-v99 .profile-showcase-add {
    width: 60px !important;
    height: 60px !important;
    border-width: 3px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-showcase-delete-form button {
    width: 23px !important;
    height: 23px !important;
    font-size: 16px !important;
    line-height: 21px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-showcase-meta-form input,
  html.ua-android-density body:not(.admin-page) .showcase-price-input-v245 {
    width: 62px !important;
    height: 21px !important;
    min-height: 21px !important;
    padding: 0 5px !important;
    border-radius: 7px !important;
    font-size: 11px !important;
    line-height: 20px !important;
  }
}


/* V258 Android/Poco exact profile-page density patch.
   Scope: only templates/ads/profile.html via .profile-density-scope-v258.
   Purpose: make Android profile/showcase visually finer without touching backend, URLs, DB, chat, websocket, desktop, or iOS. */
@media (max-width: 768px) {
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 {
    padding-inline: 14px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-hero,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-hero-story-v1 {
    padding: 10px 11px !important;
    border-radius: 25px !important;
    margin-bottom: 12px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-icon-actions {
    gap: 7px !important;
    margin: 0 0 8px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-icon-actions-right-v223 {
    gap: 7px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-mini-icon {
    width: 35px !important;
    height: 35px !important;
    min-width: 35px !important;
    border-radius: 17px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-mini-icon svg {
    width: 18px !important;
    height: 18px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-people-top-btn-v223 {
    min-width: 58px !important;
    height: 29px !important;
    padding: 0 7px !important;
    border-radius: 15px !important;
    font-size: 11px !important;
    gap: 4px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-main-row {
    grid-template-columns: 88px minmax(0,1fr) !important;
    gap: 9px !important;
    align-items: center !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-avatar-wrap {
    width: 80px !important;
    height: 80px !important;
    border-width: 3px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-avatar-img,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-avatar-fallback {
    width: 70px !important;
    height: 70px !important;
    font-size: 25px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-story-plus {
    width: 24px !important;
    height: 24px !important;
    font-size: 17px !important;
    border-width: 3px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-username,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-username-full {
    max-width: 88px !important;
    font-size: 12.5px !important;
    line-height: 1.22 !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-caption-side {
    min-height: 72px !important;
    border-radius: 19px !important;
    padding: 8px 9px !important;
    gap: 4px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-caption-side .profile-caption-text {
    font-size: 11.5px !important;
    line-height: 1.55 !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-card,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-card-v99 {
    padding: 9px !important;
    border-radius: 21px !important;
    margin: 9px 0 12px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-title {
    font-size: 13px !important;
    line-height: 1.3 !important;
    margin: 0 4px 7px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-strip {
    gap: 6px !important;
    min-height: 80px !important;
    padding-bottom: 6px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-cell {
    width: 56px !important;
    gap: 3px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-image-wrap,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-image-wrap .profile-showcase-item,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-card-v99 .profile-showcase-item,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-card-v99 .profile-showcase-placeholder,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-card-v99 .profile-showcase-add {
    width: 54px !important;
    height: 54px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-delete-form button {
    width: 20px !important;
    height: 20px !important;
    font-size: 15px !important;
    line-height: 18px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-meta-form {
    width: 56px !important;
    gap: 2px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-meta-form input,
  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .showcase-price-input-v245 {
    width: 56px !important;
    height: 19px !important;
    min-height: 19px !important;
    padding: 0 4px !important;
    border-radius: 6px !important;
    font-size: 9.5px !important;
    line-height: 18px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-floating-upload {
    top: 7px !important;
    inset-inline-end: 9px !important;
    width: 28px !important;
    height: 28px !important;
  }

  html.ua-android-density body:not(.admin-page) .profile-density-scope-v258 .profile-showcase-card-v99 .profile-showcase-floating-upload .profile-showcase-add {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    font-size: 18px !important;
  }
}
