@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #1e1f22;
  --panel: #2b2d31;
  --panel-raised: #35373c;
  --hairline: #232428;
  --text: #f2f3f5;
  --muted: #949ba4;
  --accent: #6d5ef5;
  --accent-soft: rgba(109, 94, 245, 0.18);
  --good: #23a55a;
  --bad: #f23f43;
  --bubble-mine: #6d5ef5;
  --bubble-theirs: #3b3d43;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html[data-theme="light"] {
  --ink: #f4f3f0;
  --panel: #ffffff;
  --panel-raised: #f0eeea;
  --hairline: #e2dfd8;
  --text: #201e1b;
  --muted: #6b6862;
  --accent: #6d5ef5;
  --accent-soft: rgba(109, 94, 245, 0.12);
  --good: #1f9d73;
  --bad: #e0393f;
  --bubble-mine: #6d5ef5;
  --bubble-theirs: #eeece7;
}

html, body { transition: background 0.15s ease; }

* { box-sizing: border-box; }

/* Themed scrollbars (Chrome/Edge/Safari + Firefox) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--hairline) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--hairline);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #3a3f4c;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-soft);
}

/* ---------- Wordmark ---------- */

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.wordmark .dot {
  color: var(--accent);
  font-size: 0.9em;
}

.logo-mark {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.12em;
  margin-right: 0.28em;
}

/* ---------- Sidebar tabs ---------- */

.tab-row {
  display: flex;
  border-bottom: 1px solid var(--hairline);
  padding: 0 10px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 4px;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.badge {
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
}

.link-btn:hover { text-decoration: underline; }

/* ---------- Friends / requests / notifications rows ---------- */

.people-list {
  overflow-y: auto;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 0 8px 2px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.list-row:hover { background: var(--panel-raised); }

.list-row .meta { min-width: 0; flex: 1; }
.list-row .username { font-weight: 600; font-size: 14px; }
.list-row .sub-line { font-size: 12px; color: var(--muted); }

.row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.pill-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

.pill-btn.accept { background: var(--accent); color: #fff; }
.pill-btn.accept:hover { filter: brightness(1.08); }

.pill-btn.decline { background: var(--panel-raised); color: var(--muted); border: 1px solid var(--hairline); }
.pill-btn.decline:hover { color: var(--bad); border-color: var(--bad); }

.notification-row {
  padding: 12px 18px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.notification-row.unread { background: var(--accent-soft); }

.notification-row .n-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Settings modal ---------- */

.modal-lg { max-width: 440px; }

.settings-tabs {
  display: flex;
  gap: 4px;
  background: var(--panel-raised);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 22px;
}

.settings-tab, .info-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
}

.settings-tab.active, .info-tab.active {
  background: var(--accent);
  color: #fff;
}

.settings-heading {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  transition: background 0.15s ease;
  cursor: pointer;
}

.switch-track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.15s ease, background 0.15s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::before {
  transform: translateX(18px);
  background: var(--accent);
}

/* ---------- Auth page ---------- */

.auth-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 15% 10%, rgba(109, 94, 245, 0.14), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(79, 209, 165, 0.08), transparent 40%),
    var(--ink);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
}

.auth-card header {
  margin-bottom: 24px;
}

.auth-card .tagline {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 0;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--panel-raised);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 22px;
}

.tabs button {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.tabs button.active {
  background: var(--accent);
  color: #fff;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #565b66;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 15px;
  padding: 6px 8px;
  color: var(--muted);
  opacity: 0.6;
  border-radius: var(--radius-sm);
}

.password-toggle:hover { opacity: 1; }
.password-toggle.showing { opacity: 1; color: var(--accent); }

/* Avatar picker on the register form */

.avatar-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--muted);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-picker .btn-secondary {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-primary:active:not(:disabled) { transform: scale(0.98); }

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-secondary {
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--hairline);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.btn-secondary:active:not(:disabled) { transform: scale(0.98); }

.btn-secondary:hover { border-color: var(--accent); }

.form-error {
  background: rgba(245, 101, 101, 0.12);
  border: 1px solid rgba(245, 101, 101, 0.35);
  color: #ff9b9b;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.form-error.visible { display: block; }

/* ---------- App shell ---------- */

.app-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 300px 1fr;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar.hide-on-mobile { display: none; }
  .chat-pane.hide-on-mobile { display: none; }
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-header {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.me-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}

.me-row:hover { background: var(--panel-raised); }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-raised);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  color: var(--muted);
  font-size: 15px;
}

.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

.me-row .name { font-weight: 600; font-size: 14px; }
.me-row .sub { font-size: 12px; color: var(--muted); }

.search-box {
  padding: 12px 18px;
}

.search-box input {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 18px 4px;
}

.conversation-list, .people-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 0 8px;
}

.convo-item, .person-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--text);
  position: relative;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.convo-item:hover, .person-item:hover { background: var(--panel-raised); }
.convo-item.active { background: var(--accent); color: #fff; }
.convo-item.active .preview { color: rgba(255, 255, 255, 0.75); }

.convo-item .meta { min-width: 0; flex: 1; }
.convo-item .username { font-weight: 600; font-size: 14px; }
.convo-item .preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #565b66;
  position: absolute;
  right: -1px;
  bottom: -1px;
  border: 2px solid var(--panel);
}

.status-dot.online { background: var(--good); }
.status-dot.away { background: #e8b23d; }
.status-dot.busy { background: var(--bad); }

.avatar-with-status {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.status-dot-lg {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #565b66;
  position: absolute;
  right: -1px;
  bottom: -1px;
  border: 2px solid var(--panel);
}

.status-dot-lg.online { background: var(--good); }
.status-dot-lg.away { background: #e8b23d; }
.status-dot-lg.busy { background: var(--bad); }

.status-select {
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-size: 12px;
  border-radius: var(--radius-sm);
  padding: 5px 6px;
  max-width: 90px;
}

.status-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.empty-note {
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- Chat pane ---------- */

.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: var(--panel);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--hairline);
}

.chat-header .back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 0 4px 0 0;
}

@media (max-width: 760px) {
  .chat-header .back-btn { display: block; }
}

.chat-header .name { font-weight: 600; font-size: 15px; }
.chat-header .presence { font-size: 12px; color: var(--muted); }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble-row {
  display: flex;
  animation: bubble-in 0.18s ease-out;
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.highlight-flash .bubble {
  animation: highlight-flash-anim 1.4s ease-out;
}

@keyframes highlight-flash-anim {
  0%, 15% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble-row { animation: none; }
}

.bubble-row.mine { justify-content: flex-end; }

.bubble-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: min(480px, 78%);
}

.bubble-row.mine .bubble-group { align-items: flex-end; }
.bubble-row.theirs .bubble-group { align-items: flex-start; }

.bubble {
  min-width: 0;
  max-width: 100%;
  width: fit-content;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.bubble-row.mine .bubble {
  background: var(--bubble-mine);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble-row.theirs .bubble {
  background: var(--bubble-theirs);
  border-bottom-left-radius: 4px;
}

.bubble-time {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.bubble-row.mine .bubble-time { text-align: right; }

/* ---------- Call log (centered system message) ---------- */

.call-log-row {
  display: flex;
  justify-content: center;
  margin: 4px 0;
}

.call-log-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
}

.call-log-pill.missed { color: var(--bad); border-color: rgba(245, 101, 101, 0.35); }
.call-log-icon { font-size: 13px; }
.call-log-time { opacity: 0.7; }

/* ---------- Message hover actions ---------- */

.bubble-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.bubble-row.mine .bubble-wrap { flex-direction: row-reverse; }

.msg-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
  padding-bottom: 4px;
}

.bubble-row:hover .msg-actions { opacity: 1; }

.msg-action-btn {
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.msg-action-btn:hover { color: var(--text); border-color: var(--accent); }

.reply-quote {
  border-left: 2px solid rgba(255,255,255,0.4);
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  opacity: 0.85;
  border-radius: 4px;
  background: rgba(0,0,0,0.12);
}

.bubble-row.theirs .reply-quote { border-left-color: var(--accent); }

.reply-quote .rq-name { font-weight: 700; }

.forwarded-tag {
  font-size: 11px;
  opacity: 0.7;
  font-style: italic;
  margin-bottom: 3px;
}

.edited-tag {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 6px;
}

.edit-input {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: inherit;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  resize: vertical;
}

.edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.edit-actions button {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
}

.edit-actions .save { background: #fff; color: var(--accent); }
.edit-actions .cancel { background: rgba(255,255,255,0.15); color: inherit; }

/* ---------- Voice message bubble ---------- */

.voice-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}

.voice-bubble audio {
  height: 32px;
  max-width: 220px;
}

/* ---------- Reply preview / schedule popover / recording bar ---------- */

.reply-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-top: 1px solid var(--hairline);
  background: var(--panel-raised);
}

.reply-preview-bar {
  width: 3px;
  align-self: stretch;
  background: var(--accent);
  border-radius: 2px;
}

.reply-preview-body { flex: 1; min-width: 0; }
.reply-preview-label { font-size: 11px; color: var(--accent); font-weight: 700; }
.reply-preview-text {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emoji-picker {
  border-top: 1px solid var(--hairline);
  background: var(--panel-raised);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}

.emoji-picker button {
  background: none;
  border: none;
  font-size: 20px;
  padding: 6px;
  border-radius: 6px;
}

.emoji-picker button:hover { background: var(--panel); }

.gif-picker {
  border-top: 1px solid var(--hairline);
  background: var(--panel-raised);
  padding: 10px 14px;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gif-search-input {
  background: var(--panel);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.gif-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  overflow-y: auto;
  max-height: 200px;
}

.gif-results img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.1s ease;
  background: var(--panel);
}

.gif-results img:hover { transform: scale(1.03); }

.gif-results .empty-note { grid-column: 1 / -1; }

.sticker-picker {
  border-top: 1px solid var(--hairline);
  background: var(--panel-raised);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.sticker-picker button {
  background: none;
  border: none;
  font-size: 30px;
  padding: 6px;
  border-radius: 8px;
}

.sticker-picker button:hover { background: var(--panel); }

.image-bubble img {
  max-width: 260px;
  max-height: 260px;
  border-radius: var(--radius-md);
  display: block;
  cursor: pointer;
}

.sticker-bubble {
  font-size: 64px;
  line-height: 1;
  background: none !important;
  padding: 4px !important;
}

.bubble-row.mine .sticker-bubble,
.bubble-row.theirs .sticker-bubble {
  background: none;
}

.schedule-popover {
  border-top: 1px solid var(--hairline);
  background: var(--panel-raised);
  padding: 14px 18px;
}

.schedule-popover input[type="datetime-local"] {
  color-scheme: dark;
}

.recording-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--hairline);
  background: var(--panel-raised);
}

.recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad);
  animation: pulse-dot 1.1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.recording-hint { color: var(--muted); font-size: 13px; flex: 1; }
.recording-bar .btn-primary, .recording-bar .btn-secondary { padding: 7px 14px; width: auto; }

.composer-icon {
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.composer-icon:hover { background: var(--panel-raised); }

.composer-icon.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Calls ---------- */

.call-btns { display: flex; gap: 2px; }

.call-modal { text-align: center; }

.call-status-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.call-status-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.call-actions {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 26px;
}

.call-action {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  font-size: 20px;
  display: grid;
  place-items: center;
  color: #fff;
}

.call-action.accept { background: var(--good); }
.call-action.decline { background: var(--bad); }
.call-action.mute, .call-action.camera { background: var(--panel-raised); color: var(--text); border: 1px solid var(--hairline); }
.call-action.mute.off, .call-action.camera.off { background: var(--bad); color: #fff; }
.call-action.video-upgrade { background: var(--accent); color: #fff; }

.call-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(109, 94, 245, 0.12), transparent 55%),
    #05060a;
  z-index: 100;
  display: flex;
  flex-direction: column;
  animation: call-overlay-in 0.25s ease-out;
}

@keyframes call-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.call-overlay-header {
  text-align: center;
  padding: 28px 20px 10px;
}

.call-video-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#remote-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-lg);
  background: #0c0e14;
}

#remote-video.sr-audio-only {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#local-video {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 140px;
  border-radius: var(--radius-md);
  border: 2px solid var(--hairline);
  background: #0c0e14;
}

.call-avatar-fallback {
  display: none;
}

.call-avatar-fallback.visible {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--panel-raised);
  font-family: var(--font-display);
  font-size: 44px;
  color: var(--muted);
  position: relative;
}

.call-avatar-fallback.visible::before,
.call-avatar-fallback.visible::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  animation: call-pulse-ring 2.2s ease-out infinite;
}

.call-avatar-fallback.visible::after {
  animation-delay: 1.1s;
}

@keyframes call-pulse-ring {
  0% { transform: scale(0.85); opacity: 0.55; }
  100% { transform: scale(1.35); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .call-avatar-fallback.visible::before,
  .call-avatar-fallback.visible::after {
    animation: none;
    opacity: 0;
  }
}

.call-device-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
}

.call-device-row .status-select {
  max-width: 160px;
  font-size: 11px;
}

.call-controls {
  display: flex;
  justify-content: center;
  gap: 22px;
  padding: 22px;
}

.typing-indicator {
  font-size: 12px;
  color: var(--muted);
  padding: 0 22px 6px;
  height: 16px;
}

.composer {
  border-top: 1px solid var(--hairline);
  padding: 14px 18px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  resize: none;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  max-height: 120px;
}

.send-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: filter 0.15s ease;
}

.send-btn:hover { filter: brightness(1.08); }
.send-btn:disabled { opacity: 0.5; cursor: default; }

.chat-empty {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.chat-empty .wordmark { opacity: 0.5; margin-bottom: 10px; }

/* ---------- Profile modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 12, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop.visible { display: flex; }

.modal {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  animation: modal-in 0.16s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 18px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .btn-secondary { flex: 1; }
.modal-actions .btn-primary { flex: 1; }

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover { color: var(--text); background: var(--panel-raised); }
