/* One consistent control language for chat navigation and settings panels. */
#back.icon.mobile-back, .psc-back.icon.mobile-back {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 50%;
  background: var(--hover);
  color: var(--blue);
  font-size: 0;
  transition: background-color .18s ease, transform .18s ease;
}
#back.mobile-back::after, .psc-back.mobile-back::after { display: none; }
#back svg, .psc-back svg, #lightbox .media-viewer-nav svg {
  display: block;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#back:hover, .psc-back:hover { background: color-mix(in srgb, var(--blue) 14%, var(--surface)); }
#back:active, .psc-back:active { transform: scale(.94); }
#back:focus-visible, .psc-back:focus-visible, #lightbox .media-viewer-nav:focus-visible,
#workspace-close:focus-visible, .profile-switcher:focus-visible,
.connected-chats > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#lightbox .media-viewer-nav { font-size: 0; }
#lightbox .media-viewer-nav svg { width: 23px; height: 23px; margin: auto; }
#lightbox .media-viewer-nav:not(:disabled):active { transform: translateY(-50%) scale(.94); }

.ios-navigation { justify-content: center; }
.ios-navigation .sidebar-nav-spacer { display: none; }
.profile-switcher { cursor: pointer; transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.profile-switcher:hover { background: color-mix(in srgb, var(--blue) 9%, var(--hover)); }
.profile-switcher:active { transform: scale(.985); }
.profile-switcher.is-open { background: color-mix(in srgb, var(--blue) 13%, var(--hover)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 24%, transparent); }
.profile-switcher .profile-chevron { display: grid; flex: none; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--muted); transition: transform .18s ease, background-color .18s ease, color .18s ease; }
.profile-switcher .profile-chevron svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.profile-switcher:hover .profile-chevron, .profile-switcher.is-open .profile-chevron { background: color-mix(in srgb, var(--blue) 13%, transparent); color: var(--blue); }
.profile-switcher.is-open .profile-chevron { transform: rotate(180deg); }

.connected-chats > summary { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 10px; list-style: none; transition: background-color .18s ease; }
.connected-chats > summary::-webkit-details-marker { display: none; }
.connected-chats > summary::marker { content: ''; }
.connected-chats > summary .archive-disclosure-chevron { display: none; }
.connected-chats > summary::after { content: ''; width: 8px; height: 8px; flex: none; margin-left: auto; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.connected-chats[open] > summary::after { transform: rotate(225deg) translateY(-2px); }
.connected-chats > summary:hover { background: var(--hover); }
.connected-chats > .connection-card { margin: 4px 12px 12px; }

.workspace-header { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 8px; }
.workspace-header > span:last-child { display: block; width: 44px; }
.workspace-header h2 { min-width: 0; margin: 0; text-align: center; font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
#workspace-panel { width: min(460px, 100vw); }
#workspace-panel:has(.sc-select-trigger[data-state="open"]) { pointer-events: auto; }
@media (max-width: 700px) { #workspace-panel { width: 100%; } }
#workspace-close { position: relative; display: grid; flex: none; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--hover); font-size: 0 !important; transition: background-color .18s ease, transform .18s ease; }
#workspace-close::before { content: ''; position: absolute; inset: 0; width: 20px; height: 20px; margin: auto; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m15.5 5-7 7 7 7' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m15.5 5-7 7 7 7' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat; }
#workspace-close:hover { background: color-mix(in srgb, var(--blue) 14%, var(--hover)); }
#workspace-close:active { transform: scale(.94); }

body.chat-unselected .conversation > .chat-header, body.chat-unselected .chat-source-strip,
body.chat-unselected .archive-footer, body.chat-unselected #to-bottom { display: none !important; }
body.chat-unselected #messages { display: grid; flex: 1; place-items: center; }
.no-chat-prompt { max-width: 310px; padding: 32px; border-radius: 20px; background: color-mix(in srgb, var(--surface) 90%, transparent); text-align: center; box-shadow: 0 10px 36px #00000012; }
.no-chat-symbol { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 15px; background: color-mix(in srgb, var(--blue) 12%, var(--surface)); color: var(--blue); font-size: 23px; }
.no-chat-symbol svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.no-chat-prompt h2 { margin: 0 0 7px; font-size: 20px; }
.no-chat-prompt p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
@media (max-width: 700px) {
  #back.icon.mobile-back, .psc-back.icon.mobile-back { width: 44px; height: 44px; justify-content: center; }
  body.chat-unselected.show-list .conversation { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #back, #lightbox .media-viewer-nav, #workspace-close, .profile-switcher,
  .profile-switcher .profile-chevron, .connected-chats > summary,
  .connected-chats > summary::after { transition-duration: 1ms; }
}

.no-chat-prompt:has(.archive-start){max-width:680px;background:transparent;box-shadow:none;text-align:left}
.no-chat-prompt .archive-start h2{margin:8px 0 12px;font-size:24px}
.no-chat-prompt .archive-start p{margin:8px 0;font-size:14px;line-height:1.55}
.archive-list-start{margin:20px 14px;padding:18px;border:1px solid var(--line);border-radius:16px;text-align:left}
.archive-list-start strong{font-size:15px}.archive-list-start p{font-size:13px;line-height:1.55;color:var(--muted)}
.archive-list-start button{min-height:42px;padding:9px 14px;border:0;border-radius:10px;background:var(--blue);color:white;font-size:13px;cursor:pointer}

#search-icon[aria-hidden="true"]{pointer-events:none}

/* Wide screens show the list beside the chat: the header back button appears only to return to the page a message was opened from. */
@media (min-width: 701px) { #back.icon.mobile-back:not([data-returnable="true"]) { display: none; } }

/* Message menu: readable items and 44 px targets. */
#action-menu .message-menu-list button { min-height: 44px; font-size: 14px; }

/* 901-1150 px: the panel takes its own column instead of covering the conversation. */
@media (min-width: 901px) and (max-width: 1150px) {
  #workspace-panel:not([hidden]) { position: relative; inset: auto; width: 380px; box-shadow: none; }
}
.no-chat-prompt h2 { font-size: 17px; }
