/* ═══════════════════════════════════════
   BEACON PWA v5 — WhatsApp-Grade CSS
   ═══════════════════════════════════════ */

:root {
  /* WhatsApp Dark Theme */
  --bg-primary: #111b21;
  --bg-deeper: #0b141a;
  --bg-card: rgba(32, 44, 51, 0.85);
  --bg-card-hover: #2a3942;
  --bg-chat: #0b141a;
  --bg-input: #2a3942;
  --bg-bubble-out: #005c4b;
  --bg-bubble-out-hover: #026d57;
  --bg-bubble-in: #202c33;
  --bg-bubble-in-hover: #263a43;
  --bg-bubble-priority: #3d1a1a;
  --bg-system: rgba(255, 255, 255, 0.04);
  --tail-out: #005c4b;
  --tail-in: #202c33;
  --accent: #00a884;
  --accent-dark: #008f72;
  --accent-light: rgba(0, 168, 132, 0.15);
  --blue-tick: #53bdeb;
  --gold: #e6b84b;
  --green: #00a884;
  --green-light: #2cf6b3;
  --red: #ea4335;
  --red-bg: rgba(234, 67, 53, 0.1);
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --text-bubble-out: #d1f4cc;
  --text-time-out: rgba(255, 255, 255, 0.6);
  --text-time-in: #8696a0;
  --border: #222d34;
  --border-light: rgba(134, 150, 160, 0.15);
  --shadow: rgba(0, 0, 0, 0.3);
  --radius: 8px;
  --radius-lg: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --header-h: 56px;
  --input-h: 52px;
  --quick-h: 48px;
  --font-size: 14.2px;
  --wallpaper: none;
}

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

*::-webkit-scrollbar {
  width: 6px;
}

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

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-deeper);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  font-size: var(--font-size);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: -20px;
  background: url('bg.jpeg') no-repeat center center;
  background-size: cover;
  filter: blur(10px) brightness(0.4) saturate(1.1);
  z-index: -1;
  opacity: 0.8;
  pointer-events: none;
}

/* ─── APP SHELL ─── */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  background: rgba(17, 27, 33, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 100px rgba(0,0,0,0.5);
}

@media (min-width: 601px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* ════════════════════════════════════
   LOCK SCREEN — THE HINDU CLONE
   ════════════════════════════════════ */
#lockScreen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #f8f8f8;
  display: flex;
  flex-direction: column;
  color: #1a1a1a;
  font-family: 'Georgia', 'Times New Roman', serif;
  transition: opacity 0.4s ease;
  overflow-y: auto;
  user-select: none;
}

#lockScreen.hidden {
  opacity: 0;
  pointer-events: none;
}

.news-ad-bar {
  text-align: center;
  font-size: 9px;
  color: #999;
  letter-spacing: 2px;
  font-family: sans-serif;
  padding: 4px;
  background: #f0f0f0;
}

/* Masthead */
.news-masthead {
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  font-size: 11px;
  color: #555;
  font-family: -apple-system, sans-serif;
}

.masthead-date {
  font-size: 11px;
  color: #666;
}

.masthead-logo {
  text-align: center;
  cursor: pointer;
  flex: 1;
  padding: 4px 0;
}

.hindu-logo-img {
  height: 42px;
  width: auto;
  display: inline-block;
}

@media (max-width: 600px) {
  .hindu-logo-img { height: 28px; }
  .masthead-top { padding: 6px 12px; }
  .masthead-date { font-size: 10px; }
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: #333;
}

@media (max-width: 600px) {
  .masthead-actions span { display: none; }
}

.subscribe-btn {
  background: #d32f2f;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.masthead-nav {
  display: flex;
  gap: 0;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: -apple-system, sans-serif;
  border-top: 1px solid #eee;
  background: #fff;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.masthead-nav::-webkit-scrollbar { display: none; }

.masthead-nav span {
  padding: 10px 12px;
  cursor: pointer;
  color: #222;
  flex-shrink: 0;
  font-size: 13px;
}

@media (max-width: 600px) {
  .masthead-nav span { padding: 8px 10px; font-size: 12px; }
}

.masthead-nav span:hover { color: #1565c0; }
.masthead-nav .nav-active { color: #1565c0; border-bottom: 3px solid #1565c0; }

/* Content */
.news-container {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 0;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  min-height: 80vh;
}

.main-article {
  padding: 24px 20px;
  border-right: 1px solid #eee;
}

.side-articles {
  padding: 24px 20px;
}

@media (max-width: 768px) {
  .news-container { grid-template-columns: 1fr; }
  .main-article { border-right: none; border-bottom: 1px solid #eee; padding: 16px; }
  .side-articles { padding: 16px; }
}

/* News Items */
.news-item-real {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #eee;
}

.news-live {
  color: #d32f2f;
  font-size: 11px;
  font-weight: 700;
  font-family: sans-serif;
  letter-spacing: 0.5px;
}

.news-item-real h2 {
  font-size: 22px;
  color: #b12704;
  margin: 6px 0 10px;
  line-height: 1.35;
  font-weight: 700;
}

.news-item-real h2:first-child { margin-top: 0; }

.news-item-img {
  width: 100%;
  height: auto;
  margin: 10px 0;
  display: block;
}

.news-desc {
  font-size: 13px;
  color: #555;
  font-family: sans-serif;
  line-height: 1.6;
}

.news-source {
  font-size: 11px;
  font-weight: 700;
  color: #1565c0;
  text-transform: uppercase;
  font-family: sans-serif;
  letter-spacing: 0.5px;
}

.side-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #d32f2f;
  font-family: sans-serif;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #d32f2f;
}

.side-news-item {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.side-news-item h3 {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: #1a1a1a;
}

.side-news-item h3:hover { color: #b12704; }

.news-skeleton {
  background: #eee;
  border-radius: 3px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* ════════════════════════════════════
   PIN MODAL
   ════════════════════════════════════ */
#pinModal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(11, 20, 26, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px) scale(0.95);
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.4s;
}

#pinModal.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.pin-label {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
}

.pin-dots {
  display: flex;
  gap: 16px;
}

.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 168, 132, 0.4);
  transform: scale(1.15);
}

.pin-dot.error {
  border-color: var(--red);
  background: var(--red);
  animation: pinShake 0.4s ease;
}

@keyframes pinShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px);
  }

  40% {
    transform: translateX(8px);
  }

  60% {
    transform: translateX(-5px);
  }

  80% {
    transform: translateX(5px);
  }
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  gap: 10px;
  margin-top: 8px;
}

.pin-key {
  height: 54px;
  width: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  -webkit-appearance: none;
}

.pin-key:active {
  background: var(--accent-light);
  transform: scale(0.9);
  border-color: var(--accent);
}

.pin-key.fn {
  font-size: 15px;
  color: var(--text-muted);
}

.pin-status {
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
  font-weight: 500;
}

/* ════════════════════════════════════
   HEADER BAR
   ════════════════════════════════════ */
.header {
  height: var(--header-h);
  padding: 0 10px 0 6px;
  padding-top: var(--safe-top);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  z-index: 200;
}

.header-back {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #25d366);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-right: 10px;
  flex-shrink: 0;
  cursor: pointer;
}

.header-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.header-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-status {
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}

.header-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 2s ease-in-out infinite;
}

.header-status.offline {
  color: var(--text-muted);
}

.header-status.offline .status-dot {
  background: var(--text-muted);
  animation: none;
}

.header-status.typing {
  color: var(--accent);
}

.header-status.typing #statusText::after {
  content: '...';
  animation: typingDots 1.2s steps(4) infinite;
}

@keyframes typingDots {
  0% {
    content: '';
  }

  25% {
    content: '.';
  }

  50% {
    content: '..';
  }

  75% {
    content: '...';
  }
}

@keyframes dotPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.header-actions {
  display: flex;
  gap: 2px;
}

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.header-btn:active {
  background: rgba(255, 255, 255, 0.06);
}

/* ════════════════════════════════════
   QUICK ACTIONS
   ════════════════════════════════════ */
.quick-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: var(--quick-h);
  align-items: center;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-bar::-webkit-scrollbar {
  display: none;
}

.quick-btn {
  padding: 6px 14px;
  border-radius: 18px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.quick-btn:active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(0.95);
}

.quick-btn.priority {
  background: var(--red-bg);
  border-color: rgba(234, 67, 53, 0.25);
  color: #f87171;
}

.quick-btn.priority:active {
  background: var(--red);
  color: #fff;
}

/* ════════════════════════════════════
   MESSAGES AREA
   ════════════════════════════════════ */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-chat);
  background-image: var(--wallpaper);
  background-size: cover;
  background-position: center;
  scroll-behavior: smooth;
}

/* System / Date separator */
.date-sep {
  align-self: center;
  padding: 5px 14px;
  margin: 8px 0 4px;
  background: rgba(11, 20, 26, 0.75);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  box-shadow: 0 1px 0.5px var(--shadow);
}

/* ════════════════════════════════════
   MESSAGE BUBBLES — WhatsApp Style
   ════════════════════════════════════ */
.msg {
  max-width: 80%;
  padding: 6px 8px 8px;
  position: relative;
  animation: msgIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  word-break: break-word;
  line-height: 1.4;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  margin-bottom: 1px;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Outgoing bubble */
.msg.out {
  align-self: flex-end;
  background: var(--bg-bubble-out);
  color: var(--text-bubble-out);
  border-radius: 8px 0 8px 8px;
  margin-right: 12px;
}

.msg.out::after {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 10px 8px;
  border-color: transparent transparent transparent var(--tail-out);
}

/* First message in out group gets tail */
.msg.out+.msg.out::after {
  display: none;
}

.msg.out+.msg.out {
  border-radius: 8px;
  margin-right: 12px;
}

/* Reset tail when switching direction */
.msg.in+.msg.out::after {
  display: block;
}

/* Incoming bubble */
.msg.in {
  align-self: flex-start;
  background: var(--bg-bubble-in);
  color: var(--text-primary);
  border-radius: 0 8px 8px 8px;
  margin-left: 12px;
}

.msg.in::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 10px 0;
  border-color: transparent var(--tail-in) transparent transparent;
}

.msg.in+.msg.in::before {
  display: none;
}

.msg.in+.msg.in {
  border-radius: 8px;
  margin-left: 12px;
}

.msg.out+.msg.in::before {
  display: block;
}

/* Priority */
.msg.priority-msg {
  align-self: flex-end;
  background: linear-gradient(135deg, #5c1a1a, #3d1010);
  border-radius: 8px;
  border-left: 3px solid var(--red);
  color: #fca5a5;
  margin-right: 12px;
}

.msg.priority-msg::after {
  display: none;
}

/* Preset */
.msg.preset-msg {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 168, 132, 0.15), rgba(0, 168, 132, 0.08));
  border: 1px solid rgba(0, 168, 132, 0.2);
  border-radius: 8px;
  color: var(--green-light);
  margin-right: 12px;
}

.msg.preset-msg::after {
  display: none;
}

/* Sender name */
.msg .sender {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 1px;
  display: block;
}

.msg.in .sender {
  color: var(--accent);
}

.msg.priority-msg .sender {
  color: #f87171;
}

.msg.preset-msg .sender {
  color: var(--accent);
}

/* Text */
.msg .text {
  font-size: var(--font-size);
  display: inline;
}

/* Reply quote */
.msg .reply-quote {
  display: block;
  padding: 5px 10px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.15);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  max-height: 48px;
  overflow: hidden;
}

.msg .reply-quote .rq-name {
  font-weight: 600;
  color: var(--accent);
  display: block;
  font-size: 11px;
}

/* Meta line */
.msg .meta {
  display: inline-flex;
  align-items: center;
  float: right;
  gap: 3px;
  margin: 4px 0 -4px 12px;
  position: relative;
}

.msg .time {
  font-size: 11px;
  color: var(--text-time-out);
}

.msg.in .time {
  color: var(--text-time-in);
}

/* ─── TICK MARKS ─── */
.msg .ticks {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}

.msg .ticks svg {
  width: 18px;
  height: 12px;
}

/* Single tick (sent) */
.tick-sent {
  fill: var(--text-time-out);
}

/* Double tick (delivered) */
.tick-delivered {
  fill: var(--text-time-out);
}

/* Double tick blue (read) */
.tick-read {
  fill: var(--blue-tick);
}

/* Images — WhatsApp style thumbnail */
.msg .msg-img {
  max-width: 240px;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  display: block;
}

/* Reactions */
.msg .reactions {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  flex-wrap: wrap;
  clear: both;
}

.msg .reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.msg .reaction.mine {
  border-color: var(--accent);
  background: var(--accent-light);
}

.msg .reaction:active {
  transform: scale(0.85);
}

.msg .reaction .r-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 1px;
}

/* ════════════════════════════════════
   INPUT BAR
   ════════════════════════════════════ */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px;
  padding-bottom: calc(6px + var(--safe-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-wrap {
  flex: 1;
  min-height: 42px;
  max-height: 130px;
  background: var(--bg-input);
  border-radius: 22px;
  display: flex;
  align-items: flex-end;
  padding: 0 8px 0 4px;
  transition: box-shadow 0.2s;
}

.input-wrap:focus-within {
  box-shadow: 0 0 0 1px var(--accent);
}

.attach-btn {
  width: 38px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-btn:active {
  color: var(--accent);
}

#msgInput {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--font-size);
  font-family: inherit;
  padding: 10px 6px;
  outline: none;
  resize: none;
  line-height: 1.35;
  min-height: 42px;
  max-height: 130px;
}

#msgInput::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s, background 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.send-btn:active {
  transform: scale(0.88);
}

.send-btn:disabled {
  background: var(--text-muted);
  box-shadow: none;
  cursor: default;
}

/* ─── Reply Preview ─── */
.reply-preview {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  gap: 10px;
  flex-shrink: 0;
}

.reply-preview-content {
  flex: 1;
  min-width: 0;
}

.reply-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  display: block;
}

.reply-preview-text {
  font-size: 13px;
  color: var(--text-secondary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ════════════════════════════════════
   CONTEXT MENU
   ════════════════════════════════════ */
.ctx-menu {
  position: fixed;
  z-index: 7000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 0;
  min-width: 190px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: none;
  animation: ctxPop 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes ctxPop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ctx-menu.show {
  display: block;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s;
}

.ctx-item:active {
  background: rgba(255, 255, 255, 0.05);
}

.ctx-item.danger {
  color: var(--red);
}

.ctx-item .ctx-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
}

/* Reaction Picker */
.react-picker {
  display: none;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 28px;
  position: fixed;
  z-index: 7001;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: ctxPop 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}

.react-picker.show {
  display: flex;
}

.react-emoji {
  font-size: 26px;
  cursor: pointer;
  padding: 3px;
  transition: transform 0.12s;
}

.react-emoji:active {
  transform: scale(1.4);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 6999;
  display: none;
}

.backdrop.show {
  display: block;
}

/* ════════════════════════════════════
   IMAGE PREVIEW
   ════════════════════════════════════ */
#imagePreview {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(0, 0, 0, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
}

#imagePreview.show {
  display: flex;
}

#imagePreview img {
  max-width: 92%;
  max-height: 80vh;
  border-radius: 6px;
}

.close-preview {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ════════════════════════════════════
   MSG INFO MODAL
   ════════════════════════════════════ */
.msg-info-modal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
}

.msg-info-modal.show {
  display: flex;
}

.msg-info-content {
  width: 320px;
  background: var(--bg-card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.msg-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.msg-info-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.msg-info-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-info-body {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.msg-info-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.msg-info-label {
  color: var(--text-muted);
}

/* ════════════════════════════════════
   SETTINGS PANEL
   ════════════════════════════════════ */
.settings-panel {
  position: absolute;
  inset: 0;
  z-index: 8000;
  background: var(--bg-primary);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
}

.settings-panel.open {
  transform: translateX(0);
  visibility: visible;
}

.settings-header {
  height: var(--header-h);
  padding-top: var(--safe-top);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 8px;
  padding-right: 16px;
}

.settings-back {
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
}

.settings-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 40px;
}

.settings-section {
  padding: 0 16px;
  margin-top: 20px;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.settings-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
}

.settings-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #25d366);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.settings-profile-name {
  font-size: 16px;
  font-weight: 600;
}

.settings-profile-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.15s;
}

.settings-item:first-of-type {
  border-radius: var(--radius) var(--radius) 2px 2px;
}

.settings-item:last-of-type {
  border-radius: 2px 2px var(--radius) var(--radius);
  margin-bottom: 0;
}

.settings-item:only-of-type {
  border-radius: var(--radius);
}

.settings-item:active {
  background: var(--bg-card-hover);
}

.settings-item.danger .settings-label {
  color: var(--red);
}

.settings-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.settings-label {
  flex: 1;
  font-size: 14px;
}

.settings-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* Toggle switch */
.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle.active {
  background: var(--accent);
}

.toggle-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle.active .toggle-knob {
  transform: translateX(20px);
}

.settings-select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.settings-about {
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  text-align: center;
}

.settings-about p {
  margin-bottom: 4px;
  font-size: 13px;
}

.settings-muted {
  color: var(--text-muted) !important;
  font-size: 12px !important;
}

/* ════════════════════════════════════
   TOAST
   ════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9500;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  padding: 40px 20px;
}

.empty-state .empty-icon {
  font-size: 52px;
  opacity: 0.5;
}

.empty-state .empty-text {
  font-size: 13px;
  text-align: center;
  max-width: 220px;
  line-height: 1.5;
}

/* ════════════════════════════════════
   UTILITIES & ANIMATIONS
   ════════════════════════════════════ */
.hidden {
  display: none !important;
}

@media (max-width: 400px) {
  .pin-pad {
    grid-template-columns: repeat(3, 60px);
    gap: 8px;
  }

  .pin-key {
    width: 60px;
    height: 50px;
    font-size: 20px;
  }
}