/* Together messenger shell. Palette stays cyan #3EA6FF / violet #8B5CFF.
   Layout follows a dense chat: one composer, round send, photo stage, voice dock, reaction bar. */

:root {
  --tg-radius: 18px;
  --tg-fab: 44px;
  --tg-shadow: 0 10px 28px rgba(8, 11, 36, 0.28);
}

html, body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, a, .composer-send, .composer-icon, .ghost-e2ee-reaction, .ghost-add-reaction {
  -webkit-tap-highlight-color: transparent;
}

/* Chat list: name and time on one line, preview and unread on the next. */
.contact-box > li,
.contact-box > li:last-child {
  min-height: 4.6rem;
  margin: 0 0.35rem;
  padding: 0.4rem 0.65rem !important;
  border: 0 !important;
  border-radius: 16px;
  background: transparent !important;
}
.contact-box > li:hover {
  background: color-mix(in srgb, var(--tg-accent) 8%, transparent) !important;
}
.contact-box > li.selected {
  background: color-mix(in srgb, var(--tg-accent) 16%, transparent) !important;
}
.contact-box > li.tpinned {
  border-right: 0 !important;
  padding-right: 1rem !important;
  background: color-mix(in srgb, var(--tg-accent) 7%, transparent) !important;
}
.contact-box .avatar-box {
  overflow: visible !important;
  width: 3.35rem;
  min-width: 3.35rem;
  height: 3.35rem;
  margin-right: 0.75rem;
}
.contact-box .lettertile,
.contact-box .avatar-box img {
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 999px !important;
  overflow: hidden;
}
.contact-box .text-box {
  flex: 1;
  min-width: 0;
  justify-content: center;
  gap: 0.12rem;
}
.contact-title-row {
  gap: 0.28rem;
}
.contact-title-row .contact-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.contact-box > li.has-unread .contact-title {
  font-weight: 760;
}
.contact-when {
  flex: none;
  margin-left: auto;
  color: var(--tg-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.contact-box > li.has-unread .contact-when {
  color: var(--tg-accent);
  font-weight: 700;
}
.contact-comment-row {
  min-width: 0;
  gap: 0.35rem;
}
.contact-comment-row .contact-comment {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin: 0 !important;
  color: var(--tg-muted) !important;
}
.contact-comment-row .contact-comment > span {
  min-width: 0;
  flex: 1;
}
.contact-box > li.tpinned::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.28rem;
  width: 3px;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--tg-accent);
  transform: translateY(-50%);
}
.contact-box .unread {
  flex: none;
  width: auto !important;
  min-width: 1.25rem;
  height: 1.25rem !important;
  margin: 0 0 0 0.45rem !important;
  padding: 0 0.35rem;
  border: 0 !important;
  border-radius: 999px !important;
  background: var(--tg-accent) !important;
  box-shadow: none !important;
  color: #fff !important;
  font-size: 0.72rem !important;
  line-height: 1.25rem !important;
}
.contact-box .avatar-box .online {
  right: 0;
  bottom: 0;
  box-shadow: 0 0 0 2px var(--tg-bg);
  background: #3ddc97 !important;
}
.avatar-box .offline {
  display: none !important;
}
#dummy-view .brand-logo {
  width: 7.5rem !important;
  height: 7.5rem !important;
  border-radius: 1.7rem;
  filter: none !important;
}
#sidepanel .caption-panel,
#topic-caption-panel,
#info-caption-panel {
  min-height: 3.6rem;
  backdrop-filter: blur(16px);
}

/* Bubbles */
.chat-box li > div {
  position: relative;
}
.left .bubble,
.left.flash .bubble {
  border-radius: 18px 18px 18px 6px !important;
  box-shadow: 0 1px 1px rgba(8, 11, 36, 0.12) !important;
}
.right .bubble,
.right.flash .bubble {
  border-radius: 18px 18px 6px 18px !important;
  background: linear-gradient(160deg, #4eafff 0%, #3ea6ff 42%, #6d78f0 100%) !important;
  box-shadow: 0 1px 1px rgba(8, 11, 36, 0.16) !important;
}
.bubble div.message-content {
  padding: 0.15rem 0.15rem 0 !important;
  line-height: 1.35;
}
.inline-image,
img.inline-image,
.inline-video img,
.image-preview {
  border-radius: 14px !important;
}
.inline-image {
  outline: 1px solid rgba(255, 255, 255, 0.14);
  outline-offset: -1px;
}
.chat-box .timestamp {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem !important;
  opacity: 0.86;
}
.meta .bubble.date {
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 0.2rem 0.7rem !important;
}

/* Applied reactions stay inside the bubble. The chooser is one scrolling line. */
.chat-box li {
  position: relative;
}
.chat-box .bubble {
  overflow: hidden;
}
.chat-box .bubble .ghost-e2ee-reactions {
  position: static !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.2rem !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0.2rem 0.15rem 0.15rem !important;
}
.chat-box .ghost-e2ee-reaction {
  min-height: 1.45rem;
  padding: 0 0.4rem !important;
  font-variant-numeric: tabular-nums;
}
.composer-send:active,
.composer-menu button:active {
  transform: scale(0.96);
}
.chat-box li > .ghost-reaction-overlay {
  position: fixed !important;
  top: auto !important;
  bottom: 4.7rem !important;
  left: auto !important;
  right: 0.75rem !important;
  z-index: 80;
  display: block !important;
  width: min(30rem, 36vw) !important;
  max-width: none !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden;
}
.chat-box .ghost-reaction-picker {
  display: block !important;
  flex-direction: row !important;
  width: 100% !important;
  max-width: none !important;
  padding: 0.2rem !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: var(--tg-side) !important;
  box-shadow: var(--tg-shadow) !important;
  overflow: hidden !important;
}
.chat-box .ghost-reaction-quick,
.chat-box .ghost-reaction-more {
  display: flex !important;
  flex-flow: row nowrap !important;
  grid-template-columns: none !important;
  gap: 0 !important;
  width: 100% !important;
  max-width: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
}
.chat-box .ghost-reaction-quick::-webkit-scrollbar { display: none; }
.chat-box .ghost-reaction-picker button {
  flex: 0 0 2.45rem !important;
  width: 2.45rem !important;
  height: 2.45rem !important;
  min-height: 2.45rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 999px !important;
  font-size: 1.35rem !important;
}
.chat-box .ghost-reaction-custom {
  color: var(--tg-accent) !important;
  font-weight: 700;
}
@media (max-width: 960px) {
  .chat-box li > .ghost-reaction-overlay {
    left: 0.6rem !important;
    right: 0.6rem !important;
    width: auto !important;
  }
}

/* Login fills the stage. No side column, no underline fields. */
#app-container:has(.tg-auth) {
  max-width: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: var(--tg-bg) !important;
}
#app-container:has(.tg-auth) #topic-view,
#app-container:has(.tg-auth) #info-view,
#app-container:has(.tg-auth) #dummy-view {
  display: none !important;
}
#app-container:has(.tg-auth) #sidepanel {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: 1 1 auto !important;
  border: 0 !important;
  background: var(--tg-bg) !important;
}
#sidepanel:has(.tg-auth) .caption-panel {
  display: none !important;
}
#sidepanel:has(.tg-auth) {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 3.4rem;
  background: var(--tg-bg) !important;
}
.tg-auth {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(24rem, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 0;
}
.tg-auth-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.55rem;
  text-align: center;
}
.tg-auth-hero img {
  width: 6.4rem;
  height: 6.4rem;
  border-radius: 1.7rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 24px 48px rgba(62, 166, 255, 0.32);
}
.tg-auth-title {
  margin-top: 1rem;
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
}
.tg-auth-lead {
  margin-top: 0.4rem;
  max-width: 18rem;
  color: var(--tg-muted);
  font-size: 1rem;
  line-height: 1.4;
}
.tg-auth input,
.tg-auth .group-focus {
  width: 100%;
}
.tg-auth input[type="text"],
.tg-auth input[type="password"] {
  height: 3.1rem !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 1rem !important;
  border: 0 !important;
  border-bottom: 0 !important;
  border-radius: 18px !important;
  background: color-mix(in srgb, var(--tg-input) 86%, #3ea6ff 8%) !important;
  box-shadow: inset 0 0 0 1px rgba(62, 166, 255, 0.28) !important;
}
.tg-auth input[type="text"]:focus,
.tg-auth input[type="password"]:focus {
  box-shadow: inset 0 0 0 1.5px #3ea6ff !important;
}
.tg-auth input.with-icon-right {
  margin-right: 0 !important;
  padding-right: 2.7rem !important;
}
.tg-auth .group-focus {
  position: relative;
}
.tg-auth .group-focus > span {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  display: flex;
  transform: translateY(-50%);
}
.tg-auth .group-focus .material-icons {
  font-size: 1.35rem;
  line-height: 1;
}
.tg-auth .dialog-buttons,
.tg-auth button.primary {
  width: 100%;
  margin: 0.4rem 0 0 !important;
}
.tg-auth button.primary {
  height: 3.25rem;
  border: 0 !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #4eafff 0%, #3ea6ff 46%, #7a6cf0 100%) !important;
  box-shadow: 0 14px 28px rgba(62, 166, 255, 0.32);
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.tg-auth button.primary:hover {
  filter: brightness(1.06);
}
.tg-auth .panel-form-row {
  margin: -0.15rem 0 0.15rem;
  text-align: center;
}
.tg-auth .panel-form-row a,
.tg-auth .ghost-apk-download a {
  color: var(--tg-muted);
  font-weight: 650;
  text-decoration: none;
}
.tg-auth .panel-form-row a:hover,
.tg-auth .ghost-apk-download a:hover {
  color: var(--tg-accent);
}
.tg-auth .ghost-apk-download {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.15rem;
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
}
#sidepanel {
  background: var(--tg-side) !important;
}
#sidepanel .caption-panel,
#topic-caption-panel,
#info-caption-panel {
  background: var(--tg-side) !important;
  border-bottom: 1px solid rgba(62, 166, 255, 0.14) !important;
}

/* Composer */
#send-message-wrapper {
  position: relative;
  padding: 0.35rem 0.55rem 0.55rem !important;
  border-top: 0 !important;
  background: var(--tg-side) !important;
}
#send-message-panel {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-height: 3rem !important;
  padding: 0 !important;
  background: transparent !important;
}
#send-message-input,
#send-message-panel textarea {
  flex: 1;
  min-height: 2.75rem !important;
  max-height: 8rem;
  margin: 0 !important;
  padding: 0.65rem 0.95rem !important;
  border-radius: 22px !important;
  line-height: 1.35;
  box-shadow: inset 0 0 0 1px var(--tg-line);
}
.composer-attach {
  position: relative;
  flex: none;
  align-self: flex-end;
}
.composer-icon,
.composer-send {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: var(--tg-fab);
  height: var(--tg-fab);
  border-radius: 999px;
  text-decoration: none !important;
}
.composer-icon .material-icons {
  color: var(--tg-muted) !important;
  font-size: 1.55rem !important;
}
.composer-send {
  flex: none;
  align-self: flex-end;
  background: linear-gradient(160deg, #4eafff, #6a6cf0) !important;
  box-shadow: 0 6px 16px rgba(62, 166, 255, 0.35);
}
.composer-send .material-icons {
  color: #fff !important;
  font-size: 1.35rem !important;
  min-width: 0 !important;
}
.composer-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 11.5rem;
  padding: 0.35rem;
  border-radius: 16px;
  background: var(--tg-side);
  box-shadow: var(--tg-shadow);
}
.composer-menu button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--tg-text);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.composer-menu button:hover,
.composer-menu button:focus-visible {
  background: color-mix(in srgb, var(--tg-accent) 12%, transparent);
}
.composer-menu .material-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--tg-accent);
  color: #fff !important;
  font-size: 1.15rem !important;
}
.composer-menu button:nth-child(2) .material-icons { background: #8b5cff; }
.composer-menu button:nth-child(3) .material-icons { background: #d97706; }

/* Voice dock inside the composer */
.voice-dock {
  flex: 1;
  height: 2.75rem !important;
  margin: 0 !important;
  padding: 0 0.35rem 0 0.15rem;
  gap: 0.25rem;
  border-radius: 22px !important;
  background: var(--tg-input) !important;
  box-shadow: inset 0 0 0 1px var(--tg-line);
}
.voice-dock canvas,
.voice-dock .audio-player,
.voice-dock .playback {
  width: min(14rem, 42vw) !important;
  height: 1.8rem !important;
  margin: 0 !important;
}
.voice-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
}
.voice-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--tg-muted);
  flex: none;
}
.voice-dot.live {
  background: #e11d48;
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.6);
  animation: together-rec 1.2s ease-out infinite;
}
.voice-dock .duration {
  min-width: 2.6rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem !important;
  font-weight: 700;
}
@keyframes together-rec {
  70% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .voice-dot.live { animation: none; }
}

/* Voice message inside a bubble */
.bubble .audio-player {
  min-width: 12rem;
  gap: 0.35rem;
  padding: 0.15rem 0.1rem 0.1rem;
}
.bubble .audio-player .material-icons,
.bubble .audio-player .material-icons.large {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit !important;
  font-size: 1.7rem !important;
  line-height: 2.4rem;
  text-align: center;
}
.left .bubble .audio-player .material-icons {
  background: color-mix(in srgb, var(--tg-accent) 16%, transparent);
  color: var(--tg-accent) !important;
}
.bubble .audio-player .playback {
  width: min(11rem, 46vw) !important;
  height: 1.7rem !important;
}
.bubble .audio-player .timer {
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

/* Photo and file stage */
#image-preview.tg-lightbox {
  background: rgba(8, 11, 36, 0.94) !important;
  color: #f7f8ff;
}
#image-preview.tg-lightbox #preview-caption-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: auto !important;
  padding: 0.8rem 0.9rem !important;
  background: linear-gradient(to bottom, rgba(8, 11, 36, 0.72), transparent) !important;
  box-shadow: none !important;
  color: #fff !important;
}
#image-preview.tg-lightbox #preview-caption-panel a,
#image-preview.tg-lightbox #preview-caption-panel .material-icons {
  color: #fff !important;
}
#image-preview.tg-lightbox #image-preview-container {
  background: transparent !important;
}
#image-preview.tg-lightbox img.image-preview,
#image-preview.tg-lightbox video.image-preview {
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
#image-preview.tg-lightbox #image-preview-footer,
#image-preview.tg-lightbox .tg-media-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  height: auto !important;
  padding: 0.75rem 1rem 0.9rem;
  background: transparent !important;
  box-shadow: none !important;
  color: rgba(247, 248, 255, 0.78);
  font-size: 0.86rem;
}
#image-preview.tg-lightbox #send-message-wrapper {
  background: transparent !important;
}
#image-preview.tg-lightbox #send-message-input {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
  box-shadow: none;
}
#image-preview.tg-lightbox .doc-card {
  width: min(24rem, 88vw);
  padding: 1.4rem 1.2rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: #f7f8ff;
  text-align: center;
}
#image-preview.tg-lightbox .doc-card .material-icons {
  font-size: 3rem !important;
  color: #3ea6ff !important;
}

/* Stickers */
.ghost-sticker-picker {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: calc(100% + 0.35rem);
  z-index: 25;
  border: 0 !important;
  border-radius: 20px !important;
  background: var(--tg-side) !important;
  box-shadow: var(--tg-shadow) !important;
}
.ghost-sticker-grid button,
.ghost-sticker-grid img {
  border-radius: 12px;
}

/* Menus */
ul.menu {
  width: min(15.5rem, calc(100vw - 1.5rem)) !important;
  margin: 0 !important;
  padding: 0.35rem !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: var(--tg-side) !important;
  color: var(--tg-text) !important;
  box-shadow: var(--tg-shadow) !important;
  overflow: hidden;
}
ul.menu > li {
  min-height: 2.55rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 !important;
  padding: 0.45rem 0.75rem !important;
  border-radius: 12px;
  font-weight: 650;
  color: var(--tg-text) !important;
}
ul.menu > li .material-icons {
  font-size: 1.25rem;
  color: var(--tg-accent);
}
ul.menu > li:hover {
  background: color-mix(in srgb, var(--tg-accent) 12%, transparent) !important;
}
ul.menu > li.separator {
  min-height: 0;
  height: 1px;
  margin: 0.25rem 0.55rem !important;
  padding: 0 !important;
  background: var(--tg-line) !important;
}
ul.menu > li.disabled {
  opacity: 0.45;
  pointer-events: none;
}
ul.menu > li.danger,
ul.menu > li.danger .material-icons {
  color: #ff6b81 !important;
}
ul.menu > li > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#side-caption-panel::before {
  background: url('../img/together-app-icon.png') center / cover no-repeat !important;
  border-radius: 9px !important;
  opacity: 1 !important;
  filter: none !important;
}

/* Login stays on the brand field, just quieter */
#login-view,
.login-page {
  background: var(--tg-bg);
}
label .material-icons.orange,
label .material-icons.blue {
  color: var(--tg-text) !important;
}
