/* SONARA — Messaggi (artista) */

/* Override main padding to give chat full height */
.msgs-shell {
  padding: 0;
  max-width: none;
  margin: 0;
  height: calc(100vh - 69px); /* below topbar */
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  background: var(--background);
  overflow: hidden;
}
@media (max-width: 880px) {
  .msgs-shell { grid-template-columns: 1fr; height: auto; }
  .msgs-shell.thread-open .msgs-list-panel { display: none; }
  .msgs-shell:not(.thread-open) .msgs-thread { display: none; }
}

/* ============= LIST PANEL ============= */
.msgs-list-panel {
  border-right: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.msgs-list-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.msgs-list-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.msgs-list-title .t {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}
.msgs-list-title .count {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(123,85,208,0.14);
  color: var(--violet-bright, #7b55d0);
  font-weight: 600;
  border: 1px solid rgba(123,85,208,0.28);
}
.msgs-search {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--background);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  transition: border-color 150ms;
}
.msgs-search:focus-within { border-color: var(--violet-bright, #7b55d0); }
.msgs-search svg { color: var(--muted-foreground); flex-shrink: 0; }
.msgs-search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  color: var(--foreground);
  font-size: 13px;
}
.msgs-search input::placeholder { color: var(--muted-foreground); }

.msgs-list-filters {
  padding: 10px 18px;
  display: flex; gap: 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.msgs-list-filters::-webkit-scrollbar { display: none; }
.msgs-list-filter {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 120ms;
}
.msgs-list-filter:hover { color: var(--foreground); }
.msgs-list-filter.active {
  background: rgba(123,85,208,0.12);
  border-color: var(--violet-bright, #7b55d0);
  color: var(--violet-bright, #7b55d0);
}
.msgs-list-filter .num {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--violet, #7b55d0);
  color: white;
  font-weight: 600;
}

.msgs-list {
  flex: 1;
  overflow-y: auto;
}
.msgs-list::-webkit-scrollbar { width: 6px; }
.msgs-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.msgs-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms;
  position: relative;
}
.msgs-item:hover { background: var(--muted); }
.msgs-item.active { background: rgba(123,85,208,0.10); }
.msgs-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--violet, #7b55d0);
}

.msgs-avatar {
  width: 44px; height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6b4bb8, #2e1866);
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.msgs-avatar.online::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid var(--card);
}
.msgs-avatar.muted-color { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.msgs-avatar.amber { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.msgs-avatar.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.msgs-avatar.pink { background: linear-gradient(135deg, #ec4899, #be185d); }

.msgs-body { min-width: 0; }
.msgs-row1 {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.msgs-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.msgs-verified { color: var(--violet-bright, #7b55d0); display: inline-flex; }
.msgs-preview {
  font-size: 12.5px;
  color: var(--muted-foreground);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.msgs-item.unread .msgs-preview {
  color: var(--foreground);
  font-weight: 500;
}
.msgs-context {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  margin-bottom: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.msgs-context.project {
  background: rgba(123,85,208,0.10);
  color: var(--violet-bright, #7b55d0);
  border-color: rgba(123,85,208,0.22);
}
.msgs-context.predeal {
  background: rgba(245,158,11,0.10);
  color: #f59e0b;
  border-color: rgba(245,158,11,0.28);
}

.msgs-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  white-space: nowrap;
}
.msgs-time {
  font-size: 11px;
  color: var(--muted-foreground);
}
.msgs-item.unread .msgs-time { color: var(--violet-bright, #7b55d0); font-weight: 600; }
.msgs-unread-dot {
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--violet, #7b55d0);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ============= THREAD ============= */
.msgs-thread {
  display: flex;
  flex-direction: column;
  background: var(--background);
  overflow: hidden;
}

.msgs-thread-head {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.msgs-back {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--muted);
  color: var(--muted-foreground);
  display: none;
  align-items: center; justify-content: center;
  border: 0; cursor: pointer;
}
.msgs-back:hover { background: var(--border); }
@media (max-width: 880px) { .msgs-back { display: inline-flex; } }

.msgs-thread-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.msgs-thread-info .av {
  width: 44px; height: 44px;
  border-radius: 999px;
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(135deg, #6b4bb8, #2e1866);
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.msgs-thread-info .av.online::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid var(--card);
}
.msgs-thread-info .meta { min-width: 0; }
.msgs-thread-info .name-row {
  display: flex; align-items: center; gap: 6px;
}
.msgs-thread-info .name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.01em;
}
.msgs-thread-info .verified { color: var(--violet-bright, #7b55d0); display: inline-flex; }
.msgs-thread-info .sub {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 1px;
  display: flex; align-items: center; gap: 6px;
}
.msgs-thread-info .sub .dot-online {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: #22c55e;
}
.msgs-thread-actions {
  display: inline-flex; gap: 6px;
}
.msgs-thread-action {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 120ms;
}
.msgs-thread-action:hover { background: var(--muted); color: var(--foreground); }

/* Project context bar */
.msgs-thread-context {
  padding: 10px 22px;
  background: rgba(123,85,208,0.06);
  border-bottom: 1px solid rgba(123,85,208,0.18);
  display: flex; align-items: center; gap: 12px;
  font-size: 12.5px;
  color: var(--violet-bright, #7b55d0);
  flex-wrap: wrap;
}
.msgs-thread-context .ic {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(123,85,208,0.14);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.msgs-thread-context strong { color: var(--violet-bright, #7b55d0); font-weight: 600; }
.msgs-thread-context .link {
  margin-left: auto;
  color: var(--violet-bright, #7b55d0);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.msgs-thread-context .link:hover { text-decoration: underline; }

/* Anti-disintermediation banner */
.msgs-banner {
  margin: 14px 22px 0;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
}
.msgs-banner .ic {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: rgba(245,158,11,0.14);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.30);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.msgs-banner .body { min-width: 0; }
.msgs-banner .t {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 3px;
}
.msgs-banner .s {
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.msgs-banner .dismiss {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  border: 0;
  cursor: pointer;
}
.msgs-banner .dismiss:hover { background: rgba(245,158,11,0.10); color: #f59e0b; }

/* Messages list */
.msgs-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.msgs-messages::-webkit-scrollbar { width: 6px; }
.msgs-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.msgs-day-sep {
  align-self: center;
  font-size: 11px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 500;
  margin: 10px 0;
  padding: 4px 12px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.msgs-bubble-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 78%;
}
.msgs-bubble-row.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msgs-bubble-av {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6b4bb8, #2e1866);
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.msgs-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--card);
  border: 1px solid var(--border);
}
.msgs-bubble-row.mine .msgs-bubble {
  background: var(--violet, #7b55d0);
  color: white;
  border-color: var(--violet, #7b55d0);
}
.msgs-bubble-time {
  font-size: 10.5px;
  color: var(--muted-foreground);
  margin-top: 4px;
  padding: 0 4px;
}
.msgs-bubble-row.mine .msgs-bubble-time { text-align: right; }
.msgs-bubble-row.mine .msgs-bubble-time .check { color: var(--violet-bright, #7b55d0); }

/* Masked contact in pre-deal */
.msgs-masked {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px;
  margin: 0 2px;
  border-radius: 6px;
  background: rgba(245,158,11,0.18);
  color: #f59e0b;
  font-size: 12px;
  font-weight: 500;
  border: 1px dashed rgba(245,158,11,0.40);
  cursor: help;
}
.msgs-bubble-row.mine .msgs-masked {
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.92);
  border-color: rgba(255,255,255,0.35);
}

/* Attachment in bubble */
.msgs-attach-bubble {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.msgs-attach-bubble .ic {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(123,85,208,0.10);
  color: var(--violet-bright, #7b55d0);
  display: inline-flex; align-items: center; justify-content: center;
}
.msgs-attach-bubble .meta { min-width: 0; }
.msgs-attach-bubble .n {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--foreground);
}
.msgs-attach-bubble .s {
  font-size: 11px;
  color: var(--muted-foreground);
}

/* Voice memo */
.msgs-voice {
  display: flex; align-items: center; gap: 10px;
  min-width: 200px;
}
.msgs-voice-play {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: rgba(123,85,208,0.14);
  color: var(--violet-bright, #7b55d0);
  border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.msgs-bubble-row.mine .msgs-voice-play {
  background: rgba(255,255,255,0.18);
  color: white;
}
.msgs-voice-wave {
  flex: 1;
  display: flex; align-items: center; gap: 2px;
  height: 24px;
}
.msgs-voice-wave span {
  width: 2px;
  background: currentColor;
  opacity: 0.5;
  border-radius: 999px;
}
.msgs-voice-dur {
  font-size: 11px;
  color: var(--muted-foreground);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.msgs-bubble-row.mine .msgs-voice-dur { color: rgba(255,255,255,0.85); }

/* Composer */
.msgs-composer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 14px 22px;
  flex-shrink: 0;
}
.msgs-composer-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background);
  transition: border-color 150ms;
}
.msgs-composer-wrap:focus-within { border-color: var(--violet-bright, #7b55d0); }
.msgs-composer-attach {
  display: inline-flex; gap: 4px;
  align-items: center;
}
.msgs-composer-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-foreground);
  border: 0;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.msgs-composer-icon:hover { background: var(--muted); color: var(--foreground); }
.msgs-composer-input {
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  padding: 8px 4px;
  font-family: inherit;
  font-size: 14px;
  color: var(--foreground);
  line-height: 1.5;
  max-height: 120px;
  min-height: 36px;
}
.msgs-composer-input::placeholder { color: var(--muted-foreground); }
.msgs-composer-send {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: var(--violet, #7b55d0);
  color: white;
  border: 0;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 120ms;
}
.msgs-composer-send:hover { background: var(--violet-light, #6b4bb8); transform: scale(1.05); }
.msgs-composer-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Empty thread state */
.msgs-thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  text-align: center;
  color: var(--muted-foreground);
}
.msgs-thread-empty .ic {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: rgba(123,85,208,0.10);
  color: var(--violet-bright, #7b55d0);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(123,85,208,0.25);
}
.msgs-thread-empty .t {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
}
.msgs-thread-empty .s { font-size: 13px; max-width: 320px; }

/* Compact density */
body[data-density="compact"] .msgs-item { padding: 11px 14px; }
body[data-density="compact"] .msgs-avatar { width: 38px; height: 38px; font-size: 13px; }
body[data-density="compact"] .msgs-thread-head { padding: 11px 18px; }
body[data-density="compact"] .msgs-messages { padding: 14px 18px 10px; }
body[data-density="compact"] .msgs-composer { padding: 10px 18px; }
