*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:          #6366f1;
  --brand-light:    #818cf8;
  --brand-dim:      rgba(99,102,241,0.15);
  --brand-gradient: linear-gradient(140deg, #312e81 0%, #4f46e5 50%, #6366f1 100%);

  --bg:        #0d0f14;
  --surface:   #13161f;
  --surface-2: #1a1f2e;
  --surface-3: #222840;

  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.13);

  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #3d4a63;

  --green:   #22c55e;
  --away:    #f97316;
  --busy:    #ef4444;
  --offline: #3d4a63;
}

body {
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

.screen { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* ─── SCROLLBAR ───────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

/* ─── LOGIN ───────────────────────────────────── */
.login-bg {
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 30% 30%, #1e1b4b 0%, #0d0f14 60%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}

.login-bg::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}
.login-bg::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(129,140,248,0.08) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  pointer-events: none;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 18px;
  padding: 40px 44px;
  width: 400px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.08);
  position: relative; z-index: 1;
}

.login-logo {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 34px;
}

.login-logo-text { line-height: 1.2; }
.logo-brand {
  display: block; font-size: 22px; font-weight: 800;
  color: var(--brand-light); letter-spacing: 3px;
}
.logo-tagline {
  display: block; font-size: 11px; color: var(--text-muted);
  letter-spacing: 1px; text-transform: lowercase;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-muted); margin-bottom: 7px; letter-spacing: 0.3px;
}
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=password],
.form-group select {
  width: 100%; padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: 9px;
  font-size: 14px; font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-group input::placeholder { color: var(--text-dim); }
.form-group input:focus,
.form-group select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.form-group select { cursor: pointer; }
.form-group select option { background: var(--surface-2); color: var(--text); }

.form-check {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 20px;
}
.form-check input[type=checkbox] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--brand);
}
.form-check label { font-size: 13px; color: var(--text-muted); cursor: pointer; }

.btn-primary {
  width: 100%; padding: 12px;
  background: var(--brand); color: #fff;
  border: none; border-radius: 9px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; letter-spacing: 0.3px;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
}
.btn-primary:hover {
  background: #4f46e5;
  box-shadow: 0 4px 24px rgba(99,102,241,0.5);
}
.btn-primary:active { transform: scale(0.98); }

.forgot-link {
  display: block; text-align: center; margin-top: 14px;
  font-size: 13px; color: var(--brand-light); text-decoration: none;
}
.forgot-link:hover { text-decoration: underline; }

.login-footer {
  margin-top: 28px; padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center; font-size: 12px; color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ─── APP LAYOUT ──────────────────────────────── */
.app-container {
  display: flex; height: 100vh;
}

/* ─── BUDDY LIST ──────────────────────────────── */
.buddy-list {
  width: 285px; min-width: 285px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh;
}

/* User panel */
.user-panel {
  background: var(--brand-gradient);
  padding: 16px 14px;
  display: flex; align-items: center; gap: 11px;
  color: #fff; position: relative; flex-shrink: 0;
}

.user-avatar-wrap { position: relative; flex-shrink: 0; }

.user-avatar {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  user-select: none;
}

.user-status-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #4f46e5;
}
.user-status-dot.online  { background: var(--green); }
.user-status-dot.away    { background: var(--away); }
.user-status-dot.busy    { background: var(--busy); }
.user-status-dot.offline { background: var(--offline); }

.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-personal-msg {
  font-size: 12px; opacity: 0.75; outline: none; cursor: text;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-radius: 4px; transition: background 0.15s;
}
.user-personal-msg:hover  { background: rgba(255,255,255,0.1); }
.user-personal-msg:focus  {
  background: rgba(255,255,255,0.15);
  padding: 2px 6px; margin: -2px -6px;
  white-space: normal; overflow: visible;
}

.user-menu-btn {
  cursor: pointer; opacity: 0.65; padding: 4px;
  border-radius: 4px; transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}
.user-menu-btn:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* Status dropdown */
.status-dropdown {
  position: absolute; top: calc(100% + 6px); left: 8px; right: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 100;
}
.status-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: background 0.12s;
}
.status-option:hover { background: var(--surface-3); }
.status-divider { height: 1px; background: var(--border); margin: 4px 0; }
.sign-out-option { color: #f87171; }
.sign-out-option:hover { background: rgba(239,68,68,0.1); }

.dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; border: 1.5px solid rgba(255,255,255,0.08);
}
.dot.online  { background: var(--green); }
.dot.away    { background: var(--away); }
.dot.busy    { background: var(--busy); }
.dot.offline { background: var(--offline); }

/* Search */
.search-bar {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-bar input {
  flex: 1; border: none; outline: none;
  font-size: 13px; font-family: inherit;
  color: var(--text); background: transparent;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* Contact list */
.contacts-list { flex: 1; overflow-y: auto; padding: 6px 0; }

.contact-group { margin-bottom: 4px; }

.group-header {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px 5px;
  font-size: 10px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.8px;
  cursor: pointer; user-select: none;
  transition: color 0.12s;
}
.group-header:hover { color: var(--text-muted); }

.group-chevron {
  width: 14px; height: 14px;
  transition: transform 0.2s; flex-shrink: 0;
  color: var(--text-dim);
}
.group-header.collapsed .group-chevron { transform: rotate(-90deg); }

.contact-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.contact-item:hover   { background: var(--surface-2); }
.contact-item.active  { background: var(--brand-dim); }

.contact-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0; position: relative;
}
.contact-avatar.offline { background: var(--surface-3) !important; }

.contact-status-dot {
  position: absolute; bottom: 0; right: 0;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--surface);
}
.contact-status-dot.online  { background: var(--green); }
.contact-status-dot.away    { background: var(--away); }
.contact-status-dot.busy    { background: var(--busy); }
.contact-status-dot.offline { background: var(--offline); }

.contact-info { flex: 1; min-width: 0; }
.contact-name {
  font-size: 13.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-item.offline .contact-name { color: var(--text-muted); }
.contact-personal-msg {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.unread-badge {
  background: var(--brand); color: #fff;
  border-radius: 12px; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px; flex-shrink: 0;
}

/* Buddy toolbar */
.buddy-toolbar {
  display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.toolbar-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.toolbar-btn:hover {
  background: var(--brand-dim);
  border-color: var(--brand);
  color: var(--brand-light);
}

/* ─── CHAT AREA ───────────────────────────────── */
.chat-area {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; background: var(--bg);
}

/* Welcome */
.chat-welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
}
.welcome-title {
  font-size: 22px; font-weight: 800; color: var(--text-dim);
  letter-spacing: 4px;
}
.welcome-sub { font-size: 14px; color: var(--text-dim); }

/* Chat window */
.chat-window {
  flex: 1; display: flex; flex-direction: column;
  height: 100vh;
}

/* Chat header */
.chat-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 13px 16px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.chat-header-name   { font-size: 15px; font-weight: 600; color: var(--text); }
.chat-header-status { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.chat-header-close {
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted); cursor: pointer;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.chat-header-close:hover {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border-color: rgba(239,68,68,0.3);
}

/* Messages */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg);
}

.msg-timestamp-divider {
  text-align: center; font-size: 11px; color: var(--text-dim);
  padding: 4px 0; position: relative;
}
.msg-timestamp-divider::before,
.msg-timestamp-divider::after {
  content: '';
  position: absolute; top: 50%;
  width: 28%; height: 1px;
  background: var(--border);
}
.msg-timestamp-divider::before { left: 8px; }
.msg-timestamp-divider::after  { right: 8px; }

.msg-row {
  display: flex; gap: 9px; align-items: flex-end;
}
.msg-row.sent { flex-direction: row-reverse; }

.msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.msg-content {
  display: flex; flex-direction: column; gap: 3px;
  max-width: 68%;
}
.msg-row.sent .msg-content { align-items: flex-end; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px; line-height: 1.55;
  word-break: break-word;
}
.msg-row.received .msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.msg-row.sent .msg-bubble {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}

.msg-time { font-size: 11px; color: var(--text-dim); padding: 0 2px; }

/* Nudge */
.nudge-row { display: flex; justify-content: center; }
.nudge-pill {
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px; color: var(--brand-light);
  display: flex; align-items: center; gap: 6px;
}

/* Typing bar */
.chat-typing-bar {
  padding: 6px 20px;
  font-size: 12px; color: var(--text-muted);
  font-style: italic;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}

.typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-muted);
  animation: typing-pulse 1.3s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-pulse {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Input area */
.chat-input-area {
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-format-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px 5px;
  border-bottom: 1px solid var(--border);
}

.fmt-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  font-size: 13px; font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: transparent; cursor: pointer; color: var(--text-muted);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.fmt-btn:hover {
  background: var(--brand-dim);
  border-color: var(--brand);
  color: var(--brand-light);
}

.nudge-btn {
  color: #f87171 !important;
  border-color: rgba(239,68,68,0.3) !important;
  font-weight: 600;
}
.nudge-btn:hover {
  background: rgba(239,68,68,0.1) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
}

.chat-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 14px 12px;
}

#chat-input {
  flex: 1; padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: 20px;
  font-size: 14px; font-family: inherit; color: var(--text);
  resize: none; outline: none;
  max-height: 120px; min-height: 40px; line-height: 1.5;
  transition: border-color 0.18s, box-shadow 0.18s;
}
#chat-input::placeholder { color: var(--text-muted); }
#chat-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.btn-send {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  background: var(--brand); color: #fff;
  border: none; border-radius: 20px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
  flex-shrink: 0;
}
.btn-send:hover {
  background: #4f46e5;
  box-shadow: 0 4px 20px rgba(99,102,241,0.45);
}
.btn-send:active { transform: scale(0.97); }

/* ─── EMOJI PICKER ────────────────────────────── */
.emoji-popup {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 200; width: 260px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-btn {
  width: 30px; height: 30px;
  border: none; background: transparent;
  border-radius: 7px; font-size: 18px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background 0.1s;
}
.emoji-btn:hover { background: var(--surface-3); }

/* ─── NUDGE ANIMATIONS ────────────────────────── */
@keyframes nudge-shake {
  0%   { transform: translate(0,0) rotate(0deg); }
  8%   { transform: translate(-10px,-5px) rotate(-1.5deg); }
  16%  { transform: translate(10px,5px) rotate(1.5deg); }
  24%  { transform: translate(-12px,-7px) rotate(-2deg); }
  32%  { transform: translate(12px,7px) rotate(2deg); }
  40%  { transform: translate(-9px,-4px) rotate(-1deg); }
  48%  { transform: translate(9px,4px) rotate(1deg); }
  56%  { transform: translate(-6px,-3px) rotate(-0.5deg); }
  64%  { transform: translate(6px,3px) rotate(0.5deg); }
  72%  { transform: translate(-3px,-1px) rotate(0deg); }
  80%  { transform: translate(3px,1px) rotate(0deg); }
  90%  { transform: translate(-1px,0) rotate(0deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}

.nudge-active {
  animation: nudge-shake 0.65s cubic-bezier(0.36,0.07,0.19,0.97) both;
}

.nudge-flash {
  position: fixed; inset: 0;
  background: rgba(99,102,241,0.12);
  pointer-events: none; z-index: 999;
  opacity: 0; transition: opacity 0.1s;
}
.nudge-flash.show { opacity: 1; }

/* ─── SETTINGS MODAL ────────────────────────── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 18px;
  width: 620px;
  height: 500px;
  display: flex;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55);
}

.settings-sidebar {
  width: 180px;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 28px 12px 16px;
  gap: 4px;
  flex-shrink: 0;
}

.settings-sidebar-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  overflow: hidden; margin-bottom: 8px; flex-shrink: 0;
}

.settings-sidebar-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  text-align: center; margin-bottom: 16px;
  word-break: break-word;
}

.settings-nav {
  width: 100%; display: flex; flex-direction: column; gap: 2px;
}

.settings-tab {
  width: 100%; padding: 9px 12px;
  border: none; background: transparent;
  border-radius: 8px; color: var(--text-muted);
  font-size: 13px; font-weight: 500; font-family: inherit;
  text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  transition: background 0.12s, color 0.12s;
}
.settings-tab:hover  { background: var(--surface-3); color: var(--text); }
.settings-tab.active { background: var(--brand-dim); color: var(--brand-light); }

.settings-content {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-title {
  font-size: 15px; font-weight: 600; color: var(--text);
}

.settings-panel {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
}

/* Avatar editor */
.avatar-edit-row {
  display: flex; align-items: center; gap: 20px;
  padding: 18px; margin-bottom: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.avatar-edit-wrap {
  width: 70px; height: 70px; border-radius: 50%;
  position: relative; cursor: pointer; flex-shrink: 0;
  overflow: hidden;
}

.settings-avatar-display {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
  overflow: hidden;
}

.avatar-edit-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.avatar-edit-wrap:hover .avatar-edit-overlay { opacity: 1; }

.avatar-edit-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

.btn-link-danger {
  background: none; border: none; padding: 0;
  font-size: 12px; color: #f87171; cursor: pointer;
  font-family: inherit;
}
.btn-link-danger:hover { text-decoration: underline; }

/* Color swatches */
.color-swatches {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 0;
}

.color-swatch {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.color-swatch:hover   { transform: scale(1.15); }
.color-swatch.active  { border-color: #fff; box-shadow: 0 0 0 2px var(--brand); }

/* Fields */
.settings-field {
  margin-bottom: 16px;
}
.settings-field label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.3px;
}
.settings-field input[type=text],
.settings-field input[type=email],
.settings-field input[type=password] {
  width: 100%; padding: 11px 14px;
  background: var(--surface-3);
  border: 1px solid var(--border-hover);
  border-radius: 9px;
  font-size: 14px; font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.settings-field input::placeholder { color: var(--text-muted); }
.settings-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

.field-row {
  display: flex; gap: 8px;
}
.field-row input { flex: 1; }

.btn-field-save {
  padding: 0 16px; height: 42px;
  background: var(--brand-dim);
  border: 1px solid var(--brand);
  border-radius: 8px; color: var(--brand-light);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background 0.12s;
  flex-shrink: 0;
}
.btn-field-save:hover { background: rgba(99,102,241,0.25); }

.settings-section { margin-bottom: 4px; }
.settings-section-label {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 14px;
}
.danger-label { color: #ef4444; opacity: 0.7; }

.settings-divider {
  height: 1px; background: var(--border);
  margin: 20px 0;
}

.settings-action-btn {
  width: auto; padding: 10px 20px;
  margin-top: 4px;
}

/* Toggle */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 0;
}
.toggle-text { flex: 1; }
.toggle-label { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.toggle-desc  { font-size: 12px; color: var(--text-muted); }

.toggle-switch {
  position: relative; display: inline-block;
  width: 42px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-knob {
  position: absolute; inset: 0;
  background: var(--surface-3); border-radius: 24px;
  cursor: pointer; transition: background 0.2s;
}
.toggle-knob::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch input:checked + .toggle-knob { background: var(--brand); }
.toggle-switch input:checked + .toggle-knob::before { transform: translateX(18px); }

/* Danger zone */
.danger-actions { display: flex; flex-direction: column; gap: 2px; }
.danger-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.danger-row:last-child { border-bottom: none; }
.danger-text { flex: 1; }

.btn-danger {
  padding: 7px 14px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px; color: #f87171;
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background 0.12s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* ─── MODAL ──────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}

.modal-card {
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  padding: 28px;
  width: 360px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}

.modal-title {
  font-size: 16px; font-weight: 600; color: var(--text);
}

.modal-close {
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.12s, background 0.12s;
}
.modal-close:hover { color: var(--text); background: var(--surface-3); }

.modal-desc {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 18px; line-height: 1.5;
}

.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 20px;
}

.btn-secondary {
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }

.modal-btn-primary {
  width: auto; padding: 10px 20px;
}

/* ─── AUTH EXTRAS ────────────────────────────── */
.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  color: #f87171;
  font-size: 13px;
  padding: 9px 12px;
  margin-bottom: 12px;
}

.auth-switch {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-switch a {
  color: var(--brand-light);
  text-decoration: none;
  font-weight: 500;
}
.auth-switch a:hover { text-decoration: underline; }

/* ─── CONTACTS EMPTY STATE ───────────────────── */
.contacts-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding: 40px 20px;
  text-align: center;
}
.contacts-empty p:first-of-type {
  font-size: 14px; font-weight: 500; color: var(--text-muted);
}
.contacts-empty p:last-of-type {
  font-size: 12px; color: var(--text-dim);
}

/* ─── CHAT EMPTY HINT ────────────────────────── */
.chat-empty-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 28px;
}

/* ─── ANIMATIONS ──────────────────────────────── */
@keyframes slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-row, .nudge-row { animation: slide-in 0.18s ease-out; }
