
/*
 DATE48 V45 DESKTOP MESSENGER
 Scope: desktop-only React wrapper.
 Mobile breakpoints receive no rules.
*/

@media (min-width:1200px) {

  html body .d48-v45-messenger {
    position:fixed!important;
    inset:18px!important;
    z-index:90!important;

    box-sizing:border-box!important;
    display:grid!important;

    grid-template-columns:
      320px minmax(0,1fr)!important;

    gap:15px!important;

    width:calc(100vw - 36px)!important;
    max-width:1390px!important;

    height:calc(100dvh - 36px)!important;
    min-height:0!important;

    margin:auto!important;
    padding:0!important;

    overflow:hidden!important;

    background:#faf7f5!important;
    border-radius:23px!important;

    box-shadow:
      0 18px 60px rgba(56,30,42,.09)!important;
  }

  /* LEFT PANEL */

  html body .d48-v45-sidebar {
    box-sizing:border-box!important;

    display:flex!important;
    flex-direction:column!important;

    min-width:0!important;
    min-height:0!important;

    height:100%!important;

    padding:22px 13px 14px!important;

    overflow-y:auto!important;
    overscroll-behavior:contain!important;

    background:#fffdfb!important;
    border-right:1px solid rgba(83,47,60,.09)!important;
  }

  .d48-v45-sidebar-brand {
    padding:3px 10px 20px!important;
    border-bottom:1px solid rgba(80,48,61,.08)!important;
    margin-bottom:14px!important;
  }

  .d48-v45-logo {
    color:#35232d!important;
    font:500 29px/1.1
      Georgia,"Times New Roman",serif!important;
    text-decoration:none!important;
  }

  .d48-v45-sidebar-brand p {
    margin:8px 0 0!important;
    font-size:10px!important;
    letter-spacing:1.4px!important;
    text-transform:uppercase!important;
    color:#a16b7a!important;
  }

  .d48-v45-sidebar .date48-groups-and-personal-chats,
  .d48-v45-sidebar .date48-matches-page {
    position:relative!important;
    inset:auto!important;

    display:block!important;

    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    height:auto!important;
    min-height:0!important;

    margin:0!important;
    padding:0!important;

    overflow:visible!important;
    transform:none!important;
    box-shadow:none!important;
  }

  .d48-v45-sidebar .date48-matches-head {
    padding:12px 8px!important;
    margin:0!important;
  }

  .d48-v45-sidebar .date48-matches-head h1 {
    margin:5px 0!important;
    font:500 24px/1.2
      Georgia,"Times New Roman",serif!important;
  }

  .d48-v45-sidebar .date48-matches-head span {
    display:none!important;
  }

  .d48-v45-sidebar .date48-matches-list {
    display:flex!important;
    flex-direction:column!important;
    gap:6px!important;

    padding:0!important;
    margin:0!important;
  }

  .d48-v45-sidebar .date48-match-row {
    box-sizing:border-box!important;
    display:flex!important;
    align-items:center!important;

    width:100%!important;
    max-width:none!important;
    min-width:0!important;

    margin:0!important;
    padding:12px 10px!important;

    gap:11px!important;

    border-radius:14px!important;
    text-decoration:none!important;

    transition:background .15s ease!important;
  }

  .d48-v45-sidebar .date48-match-row:hover,
  .d48-v45-sidebar .date48-match-row:focus-visible {
    background:rgba(165,63,101,.085)!important;
  }

  .d48-v45-sidebar .date48-match-row__body {
    min-width:0!important;
    flex:1!important;
  }

  .d48-v45-sidebar .date48-match-row__body strong,
  .d48-v45-sidebar .date48-match-row__body small {
    display:block!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  /* RIGHT PANEL */

  html body .d48-v45-conversation {
    position:relative!important;

    display:flex!important;
    flex-direction:column!important;

    box-sizing:border-box!important;

    min-width:0!important;
    min-height:0!important;

    width:100%!important;
    height:100%!important;

    overflow:hidden!important;

    padding:0!important;
    margin:0!important;

    border-radius:20px!important;
    background:#fcf9f8!important;
  }

  /* Override existing full-screen mobile chat
     only inside this desktop wrapper. */

  html body.date48-direct-chat-open
  .d48-v45-conversation .date48-chat-page,
  html body .d48-v45-conversation .date48-chat-page {
    position:relative!important;

    inset:auto!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    bottom:auto!important;

    display:flex!important;
    flex-direction:column!important;

    width:100%!important;
    max-width:none!important;
    min-width:0!important;

    height:100%!important;
    max-height:100%!important;
    min-height:0!important;

    margin:0!important;
    padding:0!important;

    overflow:hidden!important;
    transform:none!important;

    border-radius:20px!important;
  }

  html body.date48-direct-chat-open
  .d48-v45-conversation .date48-chat-head,
  html body .d48-v45-conversation .date48-chat-head {
    position:relative!important;
    top:auto!important;
    inset-inline:auto!important;

    flex:0 0 auto!important;

    width:100%!important;
    max-width:none!important;
    min-height:67px!important;

    box-sizing:border-box!important;

    margin:0!important;
    padding:12px 20px!important;

    border-radius:0!important;
    z-index:10!important;
  }

  html body.date48-direct-chat-open
  .d48-v45-conversation .date48-chat-thread,
  html body .d48-v45-conversation .date48-chat-thread {
    position:relative!important;

    flex:1 1 auto!important;
    display:flex!important;
    flex-direction:column!important;

    box-sizing:border-box!important;

    width:100%!important;
    max-width:850px!important;

    min-width:0!important;
    min-height:0!important;

    margin:0 auto!important;
    padding:22px 28px 28px!important;

    overflow-x:hidden!important;
    overflow-y:auto!important;

    scrollbar-gutter:stable!important;
    overscroll-behavior:contain!important;
  }

  html body .d48-v45-conversation
  .date48-chat-thread > .date48-chat-message {
    box-sizing:border-box!important;

    width:fit-content!important;
    min-width:0!important;
    max-width:min(76%,420px)!important;

    flex-shrink:0!important;
  }

  html body .d48-v45-conversation
  .date48-chat-thread > .date48-chat-message.is-mine {
    align-self:flex-end!important;
    margin-left:auto!important;
    margin-right:0!important;
  }

  html body .d48-v45-conversation
  .date48-chat-thread > .date48-chat-message:not(.is-mine) {
    align-self:flex-start!important;
    margin-left:0!important;
    margin-right:auto!important;
  }

  /* Composer stays within the right-hand panel. */

  html body.date48-direct-chat-open
  .d48-v45-conversation .date48-chat-composer,
  html body .d48-v45-conversation .date48-chat-composer {
    position:relative!important;

    inset:auto!important;
    left:auto!important;
    right:auto!important;
    bottom:auto!important;

    flex:0 0 auto!important;

    box-sizing:border-box!important;

    width:calc(100% - 38px)!important;
    max-width:850px!important;

    min-width:0!important;
    min-height:60px!important;

    margin:8px auto 16px!important;
    padding:9px 12px!important;

    transform:none!important;
    border-radius:18px!important;

    z-index:12!important;
  }

  html body .d48-v45-conversation
  .date48-chat-composer__field {
    min-width:0!important;
  }

  /* Empty conversation selection */

  .d48-v45-empty {
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;

    flex:1!important;

    text-align:center!important;
    padding:40px!important;
  }

  .d48-v45-empty-heart {
    display:block;
    font:400 72px/1 Georgia,serif;
    color:#a34b70;
    opacity:.55;
  }

  .d48-v45-empty h1 {
    margin:16px 0 8px;
    font:500 34px/1.2 Georgia,serif;
  }

  .d48-v45-empty p {
    max-width:320px;
    font-size:14px;
    line-height:1.55;
    opacity:.65;
  }
}

/* Existing dark theme, desktop scope only. */

@media (min-width:1200px) {

  html[data-date48-theme="dark"] body
  .d48-v45-messenger {
    background:#1b161c!important;
  }

  html[data-date48-theme="dark"] body
  .d48-v45-sidebar {
    background:#272028!important;
    border-color:rgba(255,255,255,.09)!important;
  }

  html[data-date48-theme="dark"] body
  .d48-v45-logo {
    color:#f3e9ed!important;
  }

  html[data-date48-theme="dark"] body
  .d48-v45-conversation {
    background:#1e191f!important;
  }

  html[data-date48-theme="dark"] body
  .d48-v45-empty {
    color:#f3e9ed!important;
  }

  html[data-date48-theme="dark"] body
  .d48-v45-sidebar .date48-match-row:hover {
    background:rgba(212,120,157,.12)!important;
  }
}



/* DATE48 V46 — desktop messenger width tuning.
   Desktop only. Mobile stays untouched. */
@media (min-width: 1200px) {
  .d48-v45-page,
  .d48-v45-shell,
  .d48-v45-messenger-root,
  .d48-v45-messenger-wrap,
  .d48-v45-messenger {
    width: min(1720px, calc(100vw - 32px)) !important;
    max-width: min(1720px, calc(100vw - 32px)) !important;
  }

  .d48-v45-messenger {
    grid-template-columns: 344px minmax(0, 1fr) !important;
    gap: 18px !important;
    align-items: stretch !important;
  }

  .d48-v45-sidebar {
    width: 344px !important;
    min-width: 344px !important;
    max-width: 344px !important;
  }

  .d48-v45-thread,
  .d48-v45-conversation,
  .d48-v45-chat,
  .d48-v45-panel,
  .d48-v45-main {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .d48-v45-thread > *,
  .d48-v45-conversation > *,
  .d48-v45-chat > *,
  .d48-v45-panel > * {
    max-width: none !important;
  }

  .d48-v45-messages,
  .d48-v45-message-list,
  .d48-v45-scroll {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
  }

  .d48-v45-composer,
  .d48-v45-compose,
  .d48-v45-inputbar,
  .d48-v45-footer {
    width: 100% !important;
    max-width: none !important;
  }

  .d48-v45-message,
  .d48-v45-bubble {
    max-width: min(760px, 68%) !important;
  }
}



/*
 DATE48 V47 — DESKTOP MESSENGER LAYOUT
 Only >=1200px. No mobile selectors or JS changes.
 Higher specificity than V45/V46 layout rules.
*/

@media (min-width:1200px) {

  /* Make the messenger use the available desktop width. */

  html body .d48-v45-messenger {
    width:calc(100vw - 284px)!important;
    max-width:1720px!important;
    min-width:0!important;

    grid-template-columns:
      310px minmax(0,1fr)!important;

    gap:12px!important;
    margin:0!important;
  }

  html body .d48-v45-sidebar {
    width:auto!important;
    min-width:0!important;
    max-width:none!important;

    box-sizing:border-box!important;
  }

  html body .d48-v45-conversation {
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  /* Comfortable reading width, without wasting
     the entire right-hand conversation panel. */

  html body.date48-direct-chat-open
  .d48-v45-conversation .date48-chat-thread,
  html body
  .d48-v45-conversation .date48-chat-thread {
    width:100%!important;
    max-width:1000px!important;
    min-width:0!important;

    padding:22px 30px 30px!important;
    box-sizing:border-box!important;
  }

  /* Prevent tiny text messages from shrinking
     to the width of a few letters. */

  html body .d48-v45-conversation
  .date48-chat-thread
  > .date48-chat-message:not(:has(
    .has-photo,
    .has-circle,
    .date48-chat-voice-message,
    .date48-message-life-editor
  )) {
    width:max-content!important;
    max-width:min(76%,460px)!important;
    min-width:0!important;
  }

  html body .d48-v45-conversation
  .date48-chat-message
  > .date48-chat-bubble:not(.has-photo):not(.has-circle):not(:has(
    .date48-chat-voice-message,
    .date48-message-life-editor
  )) {
    width:max-content!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  html body .d48-v45-conversation
  .date48-chat-bubble p {
    word-break:normal!important;
    overflow-wrap:break-word!important;
    hyphens:none!important;
    white-space:pre-wrap!important;
  }

  /* Preserve message directions. */

  html body .d48-v45-conversation
  .date48-chat-thread
  > .date48-chat-message.is-mine {
    align-self:flex-end!important;
    margin-left:auto!important;
    margin-right:0!important;
  }

  html body .d48-v45-conversation
  .date48-chat-thread
  > .date48-chat-message:not(.is-mine) {
    align-self:flex-start!important;
    margin-left:0!important;
    margin-right:auto!important;
  }

  /* Wider composer, confined to the chat panel. */

  html body.date48-direct-chat-open
  .d48-v45-conversation .date48-chat-composer,
  html body
  .d48-v45-conversation .date48-chat-composer {
    width:calc(100% - 48px)!important;
    max-width:1000px!important;
    min-width:0!important;

    margin:8px auto 16px!important;
    box-sizing:border-box!important;
  }

  html body .d48-v45-conversation
  .date48-chat-composer__field {
    min-width:0!important;
    flex:1 1 auto!important;
  }
}



/*
 DATE48 V48 — correct desktop messenger placement.

 Existing app sidebar is separate from messenger.
 Anchor messenger BETWEEN sidebar and right viewport edge.

 Desktop only. No global/mobile/chat API changes.
*/

@media (min-width:1200px) {

  html body .d48-v45-messenger {
    position:fixed!important;

    /* Top, right, bottom, left */
    inset:14px 16px 14px 232px!important;

    width:auto!important;
    max-width:none!important;
    min-width:0!important;

    height:auto!important;
    max-height:none!important;
    min-height:0!important;

    margin:0!important;
    padding:0!important;

    transform:none!important;

    display:grid!important;
    grid-template-columns:
      320px minmax(0,1fr)!important;

    gap:0!important;

    box-sizing:border-box!important;
    overflow:hidden!important;

    border-radius:22px!important;
  }

  html body .d48-v45-messenger
  > .d48-v45-sidebar {
    position:relative!important;
    inset:auto!important;

    grid-column:1!important;

    width:100%!important;
    min-width:0!important;
    max-width:none!important;

    height:100%!important;
    min-height:0!important;

    box-sizing:border-box!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;

    border-radius:0!important;
    margin:0!important;

    border-right:
      1px solid rgba(100,65,80,.10)!important;
  }

  html body .d48-v45-messenger
  > .d48-v45-conversation {
    position:relative!important;
    inset:auto!important;

    grid-column:2!important;

    width:100%!important;
    min-width:0!important;
    max-width:none!important;

    height:100%!important;
    min-height:0!important;

    margin:0!important;
    padding:0!important;

    box-sizing:border-box!important;
    overflow:hidden!important;

    border-radius:0!important;
  }

  /* Keep the conversation readable while
     taking advantage of the larger panel. */

  html body .d48-v45-conversation
  .date48-chat-thread {
    width:100%!important;
    max-width:1100px!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  html body .d48-v45-conversation
  .date48-chat-composer {
    max-width:1100px!important;
  }

  /* Full-width conversation header. */

  html body .d48-v45-conversation
  .date48-chat-head {
    width:100%!important;
    max-width:none!important;
    box-sizing:border-box!important;
  }

  /* Preserve the V47 short-message fix. */

  html body .d48-v45-conversation
  .date48-chat-bubble p {
    word-break:normal!important;
    overflow-wrap:break-word!important;
    hyphens:none!important;
  }
}

/* More compact layout on smaller desktop screens. */

@media (min-width:1200px) and (max-width:1350px) {

  html body .d48-v45-messenger {
    inset:12px 12px 12px 224px!important;

    grid-template-columns:
      280px minmax(0,1fr)!important;
  }
}

/* DATE48 V49 — slight desktop nudge to the right. */
/* Mobile untouched. */
@media (min-width: 1200px) {
  .d48-v45-messenger {
    left: 248px !important;
    right: 16px !important;
    width: auto !important;
    max-width: none !important;
  }

  .d48-v45-sidebar {
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
  }

  .d48-v45-conversation {
    min-width: 0 !important;
  }
}



/*
 DATE48 V50 — corrected desktop CSS specificity.

 Overrides V48's max-width:1350px rule,
 which previously defeated V49's offset.

 Desktop only. No mobile or global changes.
*/

@media (min-width:1200px) {

  html body .d48-v45-messenger {
    left:248px!important;
    right:16px!important;

    width:auto!important;
    max-width:none!important;
    min-width:0!important;

    margin:0!important;

    grid-template-columns:
      320px minmax(0,1fr)!important;
  }

  html body .d48-v45-messenger
  > .d48-v45-sidebar {
    grid-column:1!important;

    width:100%!important;
    min-width:0!important;
    max-width:none!important;
  }

  html body .d48-v45-messenger
  > .d48-v45-conversation {
    grid-column:2!important;

    width:100%!important;
    min-width:0!important;
    max-width:none!important;
  }
}



/* DATE48 V51 — final 16px right shift.
   Desktop only. Existing messenger logic preserved. */

@media (min-width:1200px) {
  html body .d48-v45-messenger {
    left:264px!important;
    right:16px!important;
    width:auto!important;
    max-width:none!important;
    margin:0!important;

    grid-template-columns:
      320px minmax(0,1fr)!important;
  }
}



/*
 DATE48 V52 — final +12px desktop spacing.
 No mobile or JavaScript changes.
*/

@media (min-width:1200px) {
  html body .d48-v45-messenger {
    left:276px!important;
    right:16px!important;
    width:auto!important;
    max-width:none!important;
    margin:0!important;
    grid-template-columns:
      320px minmax(0,1fr)!important;
  }
}

/* Explicitly override earlier compact-desktop rules. */
@media (min-width:1200px) and (max-width:1350px) {
  html body .d48-v45-messenger {
    left:276px!important;
    right:16px!important;
    grid-template-columns:
      320px minmax(0,1fr)!important;
  }
}



/*
 DATE48 V53 — wider internal desktop conversation.

 Preserve external messenger:
 left 276px, right 16px, dialogs 320px.

 Fix the inner thread's previous 1000px cap.
 Desktop only. No mobile changes.
*/

@media (min-width:1200px) {

  html body.date48-direct-chat-open
  .d48-v45-messenger
  .d48-v45-conversation .date48-chat-thread,

  html body
  .d48-v45-messenger
  .d48-v45-conversation .date48-chat-thread {

    box-sizing:border-box!important;

    width:100%!important;
    max-width:1440px!important;
    min-width:0!important;

    margin-left:auto!important;
    margin-right:auto!important;

    padding-left:26px!important;
    padding-right:24px!important;

    scrollbar-gutter:stable!important;
  }

  html body.date48-direct-chat-open
  .d48-v45-messenger
  .d48-v45-conversation .date48-chat-composer,

  html body
  .d48-v45-messenger
  .d48-v45-conversation .date48-chat-composer {

    box-sizing:border-box!important;

    width:calc(100% - 36px)!important;
    max-width:1404px!important;
    min-width:0!important;

    margin-left:auto!important;
    margin-right:auto!important;
  }
}



/*
 DATE48 V54 — deleted message readability.
 Desktop only.
 Preserve V53 messenger geometry and chat features.
*/

@media (min-width:1200px) {

  /* Small clearance before the scrollbar. */

  html body .d48-v45-conversation
  .date48-chat-thread {
    padding-right:40px!important;
  }

  /* Deleted messages must not collapse
     to an unreadably narrow bubble. */

  html body .d48-v45-conversation
  .date48-chat-thread
  > .date48-chat-message:has(
    .date48-chat-bubble--deleted
  ) {
    width:max-content!important;
    min-width:196px!important;
    max-width:min(85%,320px)!important;
    box-sizing:border-box!important;
  }

  html body .d48-v45-conversation
  .date48-chat-bubble--deleted {
    width:100%!important;
    min-width:196px!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }

  html body .d48-v45-conversation
  .date48-message-life-deleted {
    width:auto!important;
    max-width:none!important;
    white-space:normal!important;
    text-overflow:clip!important;
    overflow:visible!important;
    overflow-wrap:normal!important;
    word-break:normal!important;
  }

  html body .d48-v45-conversation
  .date48-message-life-deleted span,
  html body .d48-v45-conversation
  .date48-message-life-deleted p {
    max-width:none!important;
    white-space:normal!important;
    text-overflow:clip!important;
    overflow:visible!important;
    word-break:normal!important;
  }
}



/*
 DATE48 V55 — Deleted message bubble correction.

 Diagnosed in browser:
 wrapper: 196px
 bubble: 145px, max-width: 74%, overflow hidden
 text: 121px, scrollWidth 146px

 Fix inner bubble and text.
 Desktop only. Do not change other messages.
*/

@media (min-width:1200px) {

  /* The deleted message wrapper. */

  html body.date48-direct-chat-open
  .d48-v45-messenger
  .d48-v45-conversation
  .date48-chat-thread
  > .date48-chat-message:has(
    > .date48-chat-bubble--deleted
  ) {
    width:224px!important;
    min-width:224px!important;
    max-width:224px!important;
    box-sizing:border-box!important;
    flex-shrink:0!important;
  }

  /* Override the old 74% bubble width. */

  html body.date48-direct-chat-open
  .d48-v45-messenger
  .d48-v45-conversation
  .date48-chat-thread
  > .date48-chat-message
  > .date48-chat-bubble.date48-chat-bubble--deleted {
    display:block!important;

    width:100%!important;
    min-width:0!important;
    max-width:100%!important;

    box-sizing:border-box!important;

    overflow:visible!important;
    flex-shrink:0!important;
  }

  /* Text fits inside the full bubble. */

  html body.date48-direct-chat-open
  .d48-v45-messenger
  .d48-v45-conversation
  .date48-chat-thread
  .date48-chat-bubble--deleted
  > p.date48-message-life-deleted {
    width:auto!important;
    min-width:0!important;
    max-width:none!important;

    white-space:nowrap!important;
    overflow:visible!important;
    text-overflow:clip!important;

    word-break:normal!important;
    overflow-wrap:normal!important;

    box-sizing:border-box!important;
  }
}
