/* Chat-owned presentation only. Leave navigation, auth, drafts and send handlers intact. */
body.ycs-space {
  --ycs-surface: var(--qmx-surface,var(--surface)); --ycs-soft: var(--qmx-soft,var(--soft));
  --ycs-ink: var(--qmx-ink,var(--ink)); --ycs-muted: var(--qmx-muted,var(--muted));
  --ycs-line: var(--qmx-line,var(--line)); --ycs-action: var(--qmx-modal-action,var(--accent));
}
body.ycs-space [data-panel="messages"] { min-width: 0; min-height: 0; }
body.ycs-space [data-panel="messages"] .chat-head {
  height: auto !important; min-height: 52px !important; flex: 0 0 auto; padding: 6px 10px !important;
  gap: 8px !important; flex-wrap: nowrap !important; background: var(--ycs-surface) !important; color: var(--ycs-ink);
}
body.ycs-space .chat-head .person { flex: 1 1 auto; min-width: 0; gap: 8px; }
body.ycs-space .chat-head .person > div { min-width: 0; }
body.ycs-space .chat-head .avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 11px; font-size: 16px; }
body.ycs-space .chat-head h2 { margin: 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
body.ycs-space .chat-head #chatName { overflow-wrap: anywhere; }
body.ycs-space .chat-head #chatStatus { margin: 2px 0 0; font-size: 11px; line-height: 1.35; white-space: normal; }
body.ycs-space .chat-head .member-tag { font-size: 10px; padding: 2px 5px; }
body.ycs-space [data-panel="messages"] #accountNotice.is-ready { display: none !important; }
body.ycs-space [data-panel="messages"] #accountNotice:not(.is-ready) {
  flex: 0 0 auto; margin: 4px 8px; padding: 8px 10px; background: var(--ycs-soft) !important;
  color: var(--ycs-ink); border-color: var(--ycs-line);
}
body.ycs-space .chat-head :is(.chat-return,.detail-btn,.ycs-details-toggle) {
  box-sizing: border-box; display: inline-grid; place-items: center; flex: 0 0 36px;
  width: 36px; min-width: 36px; height: 36px; min-height: 36px; max-width: 36px;
  padding: 0 !important; margin: 0; border: 1px solid var(--ycs-line); border-radius: 11px;
  background: var(--ycs-soft) !important; color: var(--ycs-ink) !important;
  font-size: 0 !important; line-height: 0; cursor: pointer;
}
body.ycs-space .chat-head .chat-return::before { content: '\2039'; font: 28px/1 Georgia,serif; }
body.ycs-space .chat-head :is(.detail-btn,.ycs-details-toggle)::before { content: '\22ef'; font: 24px/1 Georgia,serif; }
body.ycs-space [data-ycs-details] .chat-head .detail-btn { display: none !important; }
body.ycs-space .chat-head [hidden] { display: none !important; }
body.ycs-space [data-panel="messages"] .chat-layout {
  position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; height: auto !important;
  grid-template-columns: minmax(0,1fr) !important;
}
body.ycs-space [data-panel="messages"] .chat-column {
  display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 0; overflow: hidden;
}
body.ycs-space [data-ycs-details="closed"] .business-pane { display: none !important; }
body.ycs-space [data-ycs-details="open"] .business-pane {
  display: block !important; position: absolute; z-index: 30; inset: 0 0 0 auto;
  width: min(350px,100%); max-width: 100%; padding: 12px 14px; overflow-y: auto;
  border-inline-start: 1px solid var(--ycs-line); background: var(--ycs-surface) !important;
  color: var(--ycs-ink); box-shadow: var(--qmx-modal-shadow,0 10px 36px rgba(15,25,22,.2));
}
body.ycs-space .ycs-details-close {
  display: grid; place-items: center; width: 36px; height: 36px; margin: 0 0 8px auto;
  border: 1px solid var(--ycs-line); border-radius: 10px; color: var(--ycs-ink); background: var(--ycs-soft); cursor: pointer;
}
body.ycs-space .ycs-details-close::before { content: '\00d7'; font-size: 23px; line-height: 1; }
body.ycs-space [data-panel="messages"] .communication-tabs {
  display: grid !important; grid-template-columns: repeat(3,minmax(0,1fr)); flex: 0 0 auto;
  padding: 2px 8px 0 !important; gap: 4px !important; background: var(--ycs-surface) !important; border-color: var(--ycs-line);
}
body.ycs-space .communication-tab[data-ycs-label] {
  min-width: 0; width: 100%; height: auto !important; min-height: 34px !important;
  padding: 5px 6px !important; font-size: 0 !important; line-height: 0 !important; border-radius: 8px 8px 0 0; white-space: normal;
}
body.ycs-space .communication-tab[data-ycs-label]::before {
  content: attr(data-ycs-label); display: inline-block; vertical-align: middle;
  font-size: 12px; font-weight: 700; line-height: 1.2; white-space: pre-line;
}
body.ycs-space .communication-tab[data-ycs-label] > :not(.qmx-conversation-unread) { display: none !important; }
body.ycs-space .communication-tab .qmx-conversation-unread { font-size: 11px; line-height: 1.4; vertical-align: middle; }
body.ycs-space .communication-tab .qmx-conversation-unread[hidden] { display: none !important; }
body.ycs-space [data-panel="messages"] #chat {
  flex: 1 1 auto; min-height: 0; max-height: none; padding: 12px 14px; overflow-y: auto;
  overscroll-behavior: contain; scroll-padding-block: 12px;
}
body.ycs-space [data-panel="messages"] #composer {
  flex: 0 0 auto; min-width: 0; padding: 7px 10px !important;
  background: var(--ycs-surface) !important; border-color: var(--ycs-line);
}
body.ycs-space #composer .compose-box {
  min-width: 0; gap: 6px; padding: 6px; align-items: end;
  background: var(--ycs-soft) !important; border-color: var(--ycs-line); border-radius: 15px;
}
body.ycs-space #composer #input {
  width: 100%; min-width: 0; height: 64px !important; min-height: 52px !important;
  max-height: min(160px,25dvh) !important; padding: 7px 5px !important; font-size: 15px; line-height: 22px;
  color: var(--ycs-ink); caret-color: var(--ycs-ink); overflow-y: auto; resize: vertical;
}
body.ycs-space #composer #input::placeholder { color: var(--ycs-muted); opacity: 1; }
body.ycs-space #composer #send { min-height: 42px; min-width: 52px; max-width: 100px; padding-inline: 12px; }
body.ycs-space #composer .hint { margin: 3px 2px 0; font-size: 10px; line-height: 1.3; }
body.ycs-space .communication-ready { flex: 0 0 auto; padding: 3px 9px !important; gap: 5px; font-size: 10px; line-height: 1.3; }
body.ycs-space [data-panel="messages"] .communication-view:not([hidden]) {
  min-height: 0; min-width: 0; padding: 8px !important; background: var(--ycs-surface) !important;
}
body.ycs-space #businessCommunication.qmx-conversations-live:not([hidden]) {
  display: flex; flex-direction: column; overflow: hidden; flex: 1 1 auto;
}
body.ycs-space #qmx-conversation-frame {
  flex: 1 1 auto; width: 100%; height: 100% !important; min-height: 0 !important; max-height: none !important;
  border: 1px solid var(--ycs-line); border-radius: 12px; background: var(--ycs-surface) !important;
}
/* Explicit surfaces avoid painting scrims, video stages or message content. */
body.ycs-space :is(.privacy-sheet,.social-dialog,.bz-message-dialog,.pm-dialog,.call-dialog,.ft-dialog,.yl-panel,.qsd-panel,.qmx-assistant-dialog,#qmx-assistant-panel) {
  background: var(--ycs-surface) !important; color: var(--ycs-ink) !important; border-color: var(--ycs-line) !important;
  color-scheme: var(--qmx-modal-scheme,light); scrollbar-color: var(--ycs-line) var(--ycs-surface);
}
body.ycs-space :is(.privacy-sheet,.social-dialog,.bz-message-dialog) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]),textarea,select) {
  background: var(--ycs-soft) !important; color: var(--ycs-ink) !important; border-color: var(--ycs-line) !important; caret-color: var(--ycs-ink);
}
body.ycs-space :is(.privacy-sheet,.social-dialog,.bz-message-dialog) :is(input,textarea)::placeholder { color: var(--ycs-muted); opacity: 1; }
body.ycs-space :is(.social-dialog,.bz-message-dialog,.pm-dialog,.call-dialog,.ft-dialog)::backdrop { background: var(--qmx-modal-scrim,rgba(20,28,26,.42)); }
body.ycs-space :is(.privacy-modal,.yl-overlay,.qsd-overlay) { background: var(--qmx-modal-scrim,rgba(20,28,26,.42)) !important; }
body.ycs-space :is(.chat-return,.detail-btn,.ycs-details-toggle,.ycs-details-close,.communication-tab):focus-visible { outline: 2px solid var(--ycs-action); outline-offset: 2px; }
@media (min-width: 1120px) {
  body.ycs-in-chat .app { width: 100%; max-width: none; grid-template-columns: 64px minmax(210px,250px) minmax(0,1fr) !important; }
  body.ycs-in-chat .sidebar { min-width: 0; padding: 16px 12px; }
}
@media (max-width: 680px) {
  body.ycs-space [data-panel="messages"] .chat-head { min-height: 52px !important; padding: 3px 6px !important; gap: 5px !important; }
  body.ycs-space .chat-head :is(.chat-return,.detail-btn,.ycs-details-toggle) {
    width: 40px; min-width: 40px; max-width: 40px; height: 44px; min-height: 44px; flex-basis: 40px;
    border-color: transparent; background: transparent !important;
  }
  body.ycs-space .chat-head .avatar { width: 28px; height: 28px; flex-basis: 28px; border-radius: 9px; }
  body.ycs-space .chat-head h2 { font-size: 15px; }
  body.ycs-space .chat-head .member-tag { display: none; }
  body.ycs-space .communication-tab[data-ycs-label] { min-height: 40px !important; padding: 4px !important; }
  body.ycs-space .communication-tab[data-ycs-label]::before { font-size: 11px; line-height: 1.2; }
  body.ycs-space [data-panel="messages"] #chat { padding: 9px 8px; }
  body.ycs-space [data-panel="messages"] #composer { padding: 5px 6px !important; }
  body.ycs-space #composer #input { height: 52px !important; min-height: 44px !important; max-height: min(112px,24dvh) !important; font-size: 16px; line-height: 21px; resize: none; }
  body.ycs-space #composer #send { min-width: 46px; max-width: 74px; padding-inline: 8px; }
  body.ycs-space #businessCommunication.qmx-conversations-live:not([hidden]) { padding: 3px !important; }
}
@media (max-height: 520px) {
  body.ycs-space #composer #input { height: 44px !important; min-height: 40px !important; }
  body.ycs-space .chat-head #chatStatus { font-size: 10px; }
}
