/* RuiTalk Host delivery marker: messenger-service-pack-version-503 */
.chat-thread-panel { min-width: 0; --thread-header-height: 64px; --thread-header-gap: 6px; --thread-header-outline: var(--rt-floating-chrome-border-strong); --thread-jump-outline: var(--rt-floating-chrome-border); }

.thread-header-host {
  position: absolute;
  inset: 0 0 auto 0;
  width: 100%;
  transform: none;
  z-index: 40;
  overflow: visible;
  isolation: isolate;
  pointer-events: none;
  touch-action: none;
}

.thread-header-layer {
  position: relative;
  inset: auto;
  z-index: 20;
  overflow: visible;
  isolation: isolate;
  pointer-events: none;
}

@media (max-width: 719px) {
  .thread-header-host {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    bottom: auto !important;
    width: 100%;
    height: auto !important;
    max-width: 100vw;
    margin: 0 !important;
    transform: none !important;
    transition: none !important;
    will-change: auto;
    contain: none;
  }

  .thread-header-layer {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }
}

.thread-header-layer::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: calc(var(--safe-top) + 30px);
  background: linear-gradient(180deg, rgba(4, 8, 16, 0.58) 0%, rgba(5, 10, 18, 0.26) calc(var(--safe-top) + 6px), rgba(7, 12, 21, 0.08) calc(var(--safe-top) + 18px), rgba(8, 13, 23, 0) 100%);
  pointer-events: none;
}

.thread-header {
  position: relative;
  padding: calc(7px + var(--safe-top)) calc(7px + var(--safe-right)) 6px calc(7px + var(--safe-left));
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
  overscroll-behavior: none;
  touch-action: none;
  pointer-events: auto;
  transform: none;
  transition: none;
}
.thread-header.is-thread-open { padding-top: calc(8px + var(--safe-top)); }
.thread-topbar { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: start; gap: 7px; }
.thread-topbar-center { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 4px; }
.thread-topbar-spacer { display: block; width: 40px; height: 40px; }

.thread-identity-pill {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 40px;
  width: min(100%, 216px);
  min-width: 0;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--thread-header-outline);
  border-radius: 20px;
  background: var(--rt-floating-chrome-bg-soft);
  box-shadow: var(--rt-floating-chrome-shadow-soft);
  backdrop-filter: var(--rt-floating-chrome-blur);
  -webkit-backdrop-filter: var(--rt-floating-chrome-blur);
}
.thread-identity-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(220, 232, 248, 0.18);
  border-radius: 50%;
  background: linear-gradient(180deg, #6a92c5 0%, #315179 100%);
  color: #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.thread-identity-avatar-copy { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); }
.thread-identity-copy { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 1px; }
.thread-title { width: 100%; margin: 0; color: #f4f7fb; font-size: 13px; font-weight: 760; letter-spacing: -0.02em; line-height: 1.06; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-subtitle { width: 100%; margin: 0; color: rgba(224, 230, 239, 0.74); font-size: 9px; line-height: 1.08; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.thread-status-cue {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  color: rgba(222, 232, 247, 0.88);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.thread-status-cue.is-blocked { border-color: rgba(198, 108, 108, 0.34); background: transparent; color: #ffc9cb; }
.thread-status-cue.is-restricted { border-color: rgba(190, 153, 86, 0.32); background: transparent; color: #f4ddad; }

.thread-header .rt-control-button-thread-back,
.thread-header .rt-control-button-thread-overflow {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(94, 125, 168, 0.62);
  background: rgba(20, 31, 49, 0.78);
  color: #e0ebfb;
  box-shadow: 0 8px 18px rgba(4, 10, 20, 0.16);
  backdrop-filter: var(--rt-floating-chrome-blur);
  -webkit-backdrop-filter: var(--rt-floating-chrome-blur);
  touch-action: manipulation;
  outline: none;
}

.thread-header .rt-control-button-thread-back:hover,
.thread-header .rt-control-button-thread-back:focus-visible,
.thread-header .rt-control-button-thread-overflow:hover,
.thread-header .rt-control-button-thread-overflow:focus-visible {
  border-color: rgba(119, 160, 214, 0.82);
  background: var(--rt-floating-chrome-bg-accent);
}

.thread-header .rt-control-button-thread-back:focus-visible,
.thread-header .rt-control-button-thread-overflow:focus-visible {
  outline: 2px solid rgba(90, 139, 195, 0.52);
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(9, 16, 28, 0.88), 0 8px 18px rgba(4, 10, 20, 0.16);
}

.thread-jump-control-wrap .rt-control-button-thread-jump {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border-color: var(--thread-jump-outline);
  background: var(--rt-floating-chrome-bg-quiet);
  color: #dce8fb;
  box-shadow: var(--rt-floating-chrome-shadow-quiet);
  backdrop-filter: var(--rt-floating-chrome-blur);
  -webkit-backdrop-filter: var(--rt-floating-chrome-blur);
  touch-action: manipulation;
}

.thread-jump-control-wrap .rt-control-button-thread-jump:hover,
.thread-jump-control-wrap .rt-control-button-thread-jump:focus-visible {
  border-color: var(--thread-jump-outline);
  background: var(--rt-floating-chrome-bg-soft);
}

.thread-header .rt-control-button-thread-back .thread-back-icon,
.thread-header .rt-control-button-thread-overflow .thread-menu-icon,
.thread-jump-control-wrap .rt-control-button-thread-jump .thread-jump-icon {
  width: 20px;
  height: 20px;
}

@media (min-width: 720px) {
  .chat-thread-panel { --thread-header-height: 68px; }
  .thread-header, .thread-header.is-thread-open { padding: calc(8px + var(--safe-top)) calc(10px + var(--safe-right)) 7px calc(10px + var(--safe-left)); }
  .thread-topbar { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; }
  .thread-topbar-spacer { width: 44px; height: 44px; }
  .thread-identity-pill { min-height: 42px; width: min(100%, 228px); padding: 4px 11px 4px 6px; border-radius: 21px; }
  .thread-identity-avatar { width: 32px; height: 32px; }
  .thread-title { font-size: 13.5px; }
  .thread-subtitle, .thread-status-cue { font-size: 9.25px; }
}
