/* VFJah Messenger vNext - Y2K MSN Redesign
   Design System + Responsive Shell + Animations
   ================================================= */

/* ── CSS Custom Properties (Design Tokens) ──────────────────────────── */
:root {
  --msn-blue: #3a8fde;
  --msn-blue-dark: #1f6fc0;
  --msn-blue-light: #5ba9ed;
  --msn-blue-pale: #dce8f5;
  --msn-bg: #dfeefb;
  --msn-bg-gradient: linear-gradient(160deg, #eaf4ff, #c9e2f7);
  --msn-panel: #ffffff;
  --msn-sidebar: #f5f9fe;
  --msn-line: #b9d6f0;
  --msn-ink: #102030;
  --msn-ink-light: #5a6f85;
  --msn-gold: #f2a900;
  --msn-danger: #c0392b;
  --msn-success: #1e8449;
  --msn-bubble-self: #3a8fde;
  --msn-bubble-self-text: #ffffff;
  --msn-bubble-other: #f0f6fd;
  --msn-shadow: 0 8px 30px rgba(31, 111, 192, 0.18);
  --msn-shadow-sm: 0 2px 8px rgba(31, 111, 192, 0.10);
  --msn-radius: 12px;
  --msn-radius-sm: 8px;
  --msn-radius-xs: 6px;
  --msn-transition: 0.2s ease;
  --topbar-height: 52px;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 0px;
  /* backward-compat aliases (used by onboarding.mjs inline styles) */
  --panel: var(--msn-panel);
  --accent: var(--msn-blue);
  --accent-dark: var(--msn-blue-dark);
  --line: var(--msn-line);
  --bg: var(--msn-bg);
  --ink: var(--msn-ink);
}

/* ── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--msn-bg-gradient);
  color: var(--msn-ink);
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Utilities ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.grow { flex: 1; }

/* ── Auth Card ──────────────────────────────────────────────────────── */
#view-auth {
  max-width: 420px;
  margin: 8vh auto;
  background: var(--msn-panel);
  border: 1px solid var(--msn-line);
  border-radius: var(--msn-radius);
  padding: 24px 20px 20px;
  box-shadow: var(--msn-shadow);
  animation: fadeIn 0.3s ease;
}

.brand {
  text-align: center;
  color: var(--msn-blue-dark);
  margin: 0 0 16px;
  font-size: 22px;
}
.brand span { color: var(--msn-gold); }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--msn-line);
  background: #eef6ff;
  border-radius: var(--msn-radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--msn-transition), color var(--msn-transition);
}
.tab:hover { background: var(--msn-blue-pale); }
.tab.active {
  background: var(--msn-blue);
  color: #fff;
  border-color: var(--msn-blue-dark);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
  font-weight: 600;
  color: var(--msn-ink);
}

/* Inputs */
input, textarea, select {
  padding: 9px 12px;
  border: 1px solid var(--msn-line);
  border-radius: var(--msn-radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fbfdff;
  transition: border-color var(--msn-transition), box-shadow var(--msn-transition);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--msn-blue);
  box-shadow: 0 0 0 3px rgba(58, 143, 222, 0.15);
}
input::placeholder, textarea::placeholder { color: #aab9cc; }

/* Buttons */
button { font-family: inherit; cursor: pointer; }
.primary {
  background: var(--msn-blue);
  color: #fff;
  border: 1px solid var(--msn-blue-dark);
  border-radius: var(--msn-radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  transition: background var(--msn-transition), transform var(--msn-transition);
}
.primary:hover { background: var(--msn-blue-dark); }
.primary:active { transform: scale(0.97); }
.primary:disabled { opacity: 0.6; cursor: not-allowed; }

.ghost {
  background: transparent;
  border: 1px solid var(--msn-line);
  border-radius: var(--msn-radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  transition: background var(--msn-transition);
}
.ghost:hover { background: rgba(255,255,255,0.15); }

.err {
  color: var(--msn-danger);
  font-size: 13px;
  min-height: 16px;
  margin: 0;
}

/* ── Emoji Picker (Auth) ────────────────────────────────────────────── */
.emoji-pick { font-size: 13px; }
.emoji-pick > span { font-weight: 600; }
#emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.emoji-opt {
  font-size: 20px;
  width: 38px;
  height: 38px;
  line-height: 1;
  border: 1px solid var(--msn-line);
  background: #fff;
  border-radius: var(--msn-radius-sm);
  cursor: pointer;
  transition: transform var(--msn-transition);
}
.emoji-opt:hover { transform: scale(1.15); z-index: 1; }
.emoji-opt.selected {
  outline: 3px solid var(--msn-blue);
  transform: scale(1.15);
}
.emoji-opt:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
}

/* ── App Shell ──────────────────────────────────────────────────────── */
#view-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  background: var(--msn-panel);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: linear-gradient(135deg, var(--msn-blue), var(--msn-blue-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(31, 111, 192, 0.25);
  z-index: 100;
  position: relative;
}
.topbar .emoji { font-size: 24px; }
.topbar .me-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main App Body ──────────────────────────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--topbar-height));
}

/* ── Left Sidebar / Roster ──────────────────────────────────────────── */
.sidebar-left {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--msn-sidebar);
  border-right: 1px solid var(--msn-line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--msn-transition), min-width var(--msn-transition);
}

/* Roster search */
.roster-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--msn-line);
}
.roster-search input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 20px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--msn-line);
}
.roster-search input:focus {
  box-shadow: 0 0 0 3px rgba(58, 143, 222, 0.12);
}

/* Roster groups */
.roster-groups {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.roster-groups::-webkit-scrollbar {
  width: 5px;
}
.roster-groups::-webkit-scrollbar-track {
  background: transparent;
}
.roster-groups::-webkit-scrollbar-thumb {
  background: var(--msn-line);
  border-radius: 10px;
}

/* Group header */
.group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--msn-ink-light);
  user-select: none;
  transition: background var(--msn-transition);
}
.group-header:hover { background: rgba(0,0,0,0.03); }
.group-header .arrow {
  font-size: 10px;
  transition: transform var(--msn-transition);
  display: inline-block;
}
.group-header.collapsed .arrow { transform: rotate(-90deg); }
.group-header .badge {
  margin-left: auto;
  background: var(--msn-blue);
  color: #fff;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.group-header .badge.danger { background: var(--msn-danger); }
.group-header .badge.success { background: var(--msn-success); }

.group-body { transition: max-height 0.2s ease; }
.group-body.collapsed { max-height: 0; overflow: hidden; }

/* Contact items */
.contacts-list { list-style: none; margin: 0; padding: 0; }
#contacts { list-style: none; margin: 0; padding: 0; }
#contacts li, .contacts-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 16px;
  cursor: pointer;
  transition: background var(--msn-transition);
  border-bottom: none;
  position: relative;
}
#contacts li:hover {
  background: rgba(58, 143, 222, 0.08);
}
#contacts li.active {
  background: rgba(58, 143, 222, 0.12);
  border-left: 3px solid var(--msn-blue);
  padding-left: 13px;
}
#contacts li .emoji {
  font-size: 24px;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
#contacts .contact-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
#contacts .contact-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
#contacts .contact-status-text {
  font-size: 11px;
  color: var(--msn-ink-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
#contacts .contact-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
#contacts .contact-status.online { background: #2ecc71; }
#contacts .contact-status.offline { background: #bdc3c7; }
#contacts .contact-status.idle { background: #f39c12; }

#contacts .contact-badge {
  background: var(--msn-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 4px;
  flex-shrink: 0;
  animation: pulseBadge 2s infinite;
}
#contacts .contact-badge:empty { display: none; }

#contacts .aff {
  font-size: 11px;
  color: var(--msn-blue);
  font-weight: 600;
  flex-shrink: 0;
}
#contacts .pending {
  color: var(--msn-gold);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Roster add form */
.roster-add {
  padding: 10px 12px;
  border-top: 1px solid var(--msn-line);
}
.add { display: flex; gap: 4px; }
.add input { flex: 1; font-size: 12px; padding: 6px 10px; }

/* ── Chat Area ──────────────────────────────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--msn-panel);
}

/* Chat header */
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--msn-line);
  min-height: 52px;
  background: #fafcff;
}
.chat-head-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.chat-head-emoji { font-size: 26px; }
.chat-head-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head-status {
  font-size: 11px;
  color: var(--msn-ink-light);
  white-space: nowrap;
}
.chat-head-status.online { color: #2ecc71; }
.chat-head-status.offline { color: var(--msn-ink-light); }

.chat-head-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.chat-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--msn-line);
  background: #fff;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--msn-transition), transform var(--msn-transition);
}
.chat-btn:hover {
  background: var(--msn-blue-pale);
  transform: scale(1.08);
}
.chat-btn:active { transform: scale(0.92); }

/* Messages container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.messages-container::-webkit-scrollbar { width: 6px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb {
  background: var(--msn-line);
  border-radius: 10px;
}

#messages {
  list-style: none;
  margin: 0;
  padding: 12px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
}
#messages li {
  margin: 2px 0;
  max-width: 75%;
  animation: messageFadeIn 0.25s ease;
}
#messages .me {
  align-self: flex-end;
  text-align: right;
}
#messages .bubble {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
}
#messages .other .bubble {
  background: var(--msn-bubble-other);
  border: 1px solid var(--msn-line);
  border-bottom-left-radius: 4px;
  text-align: left;
}
#messages .me .bubble {
  background: var(--msn-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
  text-align: left;
}
#messages .msg-meta {
  font-size: 10px;
  margin-top: 3px;
  color: var(--msn-ink-light);
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
#messages .me .msg-meta { justify-content: flex-end; }
#messages .other .msg-meta { justify-content: flex-start; }
#messages .msg-status {
  font-size: 11px;
}
#messages .msg-status.sent { color: var(--msn-ink-light); }
#messages .msg-status.delivered { color: var(--msn-blue); }
#messages .msg-status.read { color: var(--msn-blue); }
#messages .msg-time { opacity: 0.7; }

/* System messages (conv start, date separator) */
#messages .system {
  align-self: center;
  max-width: 100%;
  text-align: center;
}
#messages .system .bubble {
  background: transparent;
  border: none;
  font-size: 11px;
  color: var(--msn-ink-light);
  padding: 8px 12px;
}

/* Wizz message */
#messages .wizz {
  align-self: center;
  max-width: 100%;
  text-align: center;
  animation: wizzShake 0.3s ease 3;
}
#messages .wizz .bubble {
  background: #fff0f0;
  border: 1px solid #f1b0b0;
  color: var(--msn-danger);
  font-weight: 700;
  font-style: italic;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 20px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 8px;
  font-size: 12px;
  color: var(--msn-ink-light);
  font-style: italic;
}
.typing-dots span {
  animation: typingDot 1.4s infinite;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: var(--msn-blue);
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── Composer ───────────────────────────────────────────────────────── */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--msn-line);
  background: #fafcff;
}
.composer textarea {
  flex: 1;
  resize: none;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 14px;
  min-height: 38px;
  max-height: 120px;
  line-height: 1.4;
  overflow-y: auto;
}
.emoji-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--msn-line);
  background: #fff;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--msn-transition), transform var(--msn-transition);
}
.emoji-btn:hover {
  background: var(--msn-blue-pale);
  transform: scale(1.1);
}
.send-btn {
  flex-shrink: 0;
  border-radius: 20px;
  padding: 8px 18px;
}
.wizz {
  background: #fff0f0;
  border: 1px solid #f1b0b0;
  border-radius: var(--msn-radius-sm);
  padding: 0 12px;
  color: var(--msn-danger);
  font-weight: 700;
  font-size: 13px;
  height: 36px;
  flex-shrink: 0;
  transition: background var(--msn-transition);
}
.wizz:hover { background: #fde0e0; }

/* ── Right Sidebar ──────────────────────────────────────────────────── */
.sidebar-right {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--msn-sidebar);
  border-left: 1px solid var(--msn-line);
  overflow-y: auto;
  padding: 16px;
}

/* ── Scene Canvas ───────────────────────────────────────────────────── */
.scene-canvas {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 160px;
  background: transparent;
  pointer-events: none;
  z-index: 500;
}

/* Roster mini canvas */
.roster-scene-mini canvas {
  width: 100%;
  height: 60px;
  opacity: 0.6;
  pointer-events: none;
}

/* ── Animations ─────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes messageFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes wizzShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(58, 143, 222, 0.2); }
  50% { box-shadow: 0 0 12px rgba(58, 143, 222, 0.4); }
}

/* Wizz body shake (applied to body via JS) */
.wizz-active {
  animation: wizzShake 0.15s ease 4;
}

/* ── Roster Toggle Button (mobile) ──────────────────────────────────── */
.roster-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.roster-toggle:hover { opacity: 0.8; }

/* ── Responsive: Tablet & Mobile ────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar-left { width: 240px; min-width: 240px; }
  .sidebar-right { width: 240px; min-width: 240px; }
  .chat-head-name { font-size: 14px; }
}

/* Mobile: roster collapses to bottom drawer */
@media (max-width: 768px) {
  :root { --sidebar-width: 100%; }
  .roster-toggle { display: block; }

  .sidebar-left {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    min-width: 100%;
    height: 55vh;
    max-height: 55vh;
    z-index: 200;
    border-right: none;
    border-top: 1px solid var(--msn-line);
    border-radius: var(--msn-radius) var(--msn-radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }
  .sidebar-left.open {
    transform: translateY(0);
  }

  .sidebar-right {
    display: none !important;
  }

  .chat-area {
    width: 100%;
  }

  #messages li { max-width: 85%; }

  .topbar {
    padding: 0 10px;
  }
  .topbar .me-name { font-size: 13px; max-width: 120px; }

  .composer {
    padding: 8px 10px;
  }

  .chat-head {
    padding: 8px 12px;
    min-height: 44px;
  }
  .chat-head-emoji { font-size: 22px; }
  .chat-head-name { font-size: 13px; }
}

/* Small mobile */
@media (max-width: 480px) {
  #messages li { max-width: 90%; }
  #messages .bubble { font-size: 13px; padding: 6px 12px; }
  .composer textarea { font-size: 13px; }
  .send-btn { padding: 8px 14px; font-size: 13px; }
}

/* ── Onboarding Overlay & Reminder ──────────────────────────────────── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.onboarding-card {
  background: var(--msn-panel);
  border: 2px solid var(--msn-blue);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.onboarding-card h2 {
  color: var(--msn-blue-dark);
  margin: 0 0 12px;
  font-size: 20px;
}
.onboarding-card .steps { text-align: left; margin: 12px 0; }
.onboarding-card .step {
  padding: 8px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}
.onboarding-card .step.done { color: var(--msn-success); text-decoration: line-through; }
.onboarding-card .step .check { width: 20px; text-align: center; }

/* ════════════════════════════════════════════════════════════ */
/* PATCH NOTES MODAL                                           */
/* ════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: var(--msn-panel);
  border: 1px solid var(--msn-line);
  border-radius: 16px;
  box-shadow: var(--msn-shadow);
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--msn-line);
}
.modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--msn-blue-dark);
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--msn-ink-light);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--msn-transition);
}
.modal-close:hover {
  background: rgba(0,0,0,0.06);
  color: var(--msn-ink);
}
.modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--msn-line); border-radius: 10px; }
.modal-loading { color: var(--msn-ink-light); font-size: 14px; text-align: center; }

/* Patch notes version entries */
.patch-version {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--msn-line);
}
.patch-version:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.patch-version h3 {
  margin: 0 0 2px;
  font-size: 16px;
  color: var(--msn-blue-dark);
}
.patch-version .patch-date {
  font-size: 12px;
  color: var(--msn-ink-light);
  margin: 0 0 10px;
}
.patch-version ul {
  margin: 0;
  padding: 0 0 0 18px;
  list-style: disc;
}
.patch-version li {
  font-size: 13px;
  line-height: 1.6;
  color: var(--msn-ink);
}

/* "Nouveau" badge on notes button */
.new-badge {
  font-size: 9px;
  background: var(--msn-danger);
  color: #fff;
  padding: 1px 5px;
  border-radius: 8px;
  vertical-align: super;
  margin-left: 2px;
  font-weight: 700;
  animation: pulseBadge 2s infinite;
}
.new-badge.hidden { display: none; }

/* ════════════════════════════════════════════════════════════ */
/* AFFINITY BAR                                                */
/* ════════════════════════════════════════════════════════════ */
.affinity-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.affinity-bar {
  width: 40px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.affinity-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease, background 0.3s ease;
}
.affinity-text {
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--msn-ink-light);
}

/* Beating heart for high affinity */
.affinity-heart {
  font-size: 14px;
  animation: heartBeat 1s ease infinite;
  flex-shrink: 0;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
  45% { transform: scale(1.2); }
  60% { transform: scale(1); }
}

/* Affinity history in contact info panel */
.affinity-history {
  margin-top: 8px;
  font-size: 12px;
}
.affinity-history h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--msn-blue-dark);
}
.affinity-history-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--msn-ink-light);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 11px;
}
.affinity-history-item:last-child { border-bottom: none; }
.affinity-history-item .aff-delta.positive { color: var(--msn-success); }
.affinity-history-item .aff-delta.negative { color: var(--msn-danger); }

/* ════════════════════════════════════════════════════════════ */
/* DARK THEME                                                  */
/* ════════════════════════════════════════════════════════════ */
html.dark {
  --msn-blue: #4a9fef;
  --msn-blue-dark: #3a8fde;
  --msn-blue-light: #6bb9ff;
  --msn-blue-pale: #1a2a3a;
  --msn-bg: #121820;
  --msn-bg-gradient: linear-gradient(160deg, #0d1520, #1a2535);
  --msn-panel: #1a2332;
  --msn-sidebar: #151e2c;
  --msn-line: #2a3a4e;
  --msn-ink: #d0dce8;
  --msn-ink-light: #8899aa;
  --msn-shadow: 0 8px 30px rgba(0,0,0,0.4);
  --msn-shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --msn-bubble-self: #2a7bc8;
  --msn-bubble-other: #1e2d42;
  --msn-bubble-self-text: #ffffff;
}

html.dark body {
  background: var(--msn-bg-gradient);
}

html.dark input,
html.dark textarea,
html.dark select {
  background: #0f1724;
  color: var(--msn-ink);
  border-color: var(--msn-line);
}

html.dark .tab {
  background: #1a2332;
  color: var(--msn-ink);
}

html.dark .chat-head {
  background: #1a2332;
}

html.dark .composer {
  background: #1a2332;
}

html.dark .roster-search input {
  background: #0f1724;
  color: var(--msn-ink);
}

html.dark .chat-btn {
  background: #1a2332;
  border-color: var(--msn-line);
}

html.dark .emoji-btn {
  background: #1a2332;
  border-color: var(--msn-line);
}

html.dark .wizz {
  background: #2a1a1a;
  border-color: #4a2020;
}

html.dark #contacts .contact-status.offline { background: #3a4a5e; }

html.dark .group-header:hover { background: rgba(255,255,255,0.04); }

html.dark .ghost:hover { background: rgba(255,255,255,0.08); }