/* ==========================================================================
   PULSECHAT v2 — WhatsApp-Grade Minimalist Precision Design System
   Standards: Refactoring UI, Jakob's Law, Apple HIG, WCAG 2.2 AA+
   ========================================================================== */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg-rail: #202c33;
  --bg-list: #111b21;
  --bg-stage: #0b141a;
  --bg-header: #202c33;
  --bg-surface: #202c33;
  --bg-hover: #2a3942;
  --bg-input: #2a3942;
  --border: rgba(134, 150, 160, 0.16);

  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;

  --accent: #00a884;
  --accent-hover: #06cf9c;
  --accent-soft: rgba(0, 168, 132, 0.16);
  --bubble-out: #005c4b;
  --bubble-in: #202c33;
  --tick-read: #53bdeb;
  --pro-gold: #f59e0b;
  --danger: #f15c6d;

  --font-display: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-rail: #f0f2f5;
  --bg-list: #ffffff;
  --bg-stage: #efeae2;
  --bg-header: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-hover: #f5f6f6;
  --bg-input: #ffffff;
  --border: rgba(17, 27, 33, 0.10);

  --text-primary: #111b21;
  --text-secondary: #54656f;
  --text-muted: #667781;

  --accent: #008069;
  --accent-hover: #00a884;
  --accent-soft: rgba(0, 128, 105, 0.12);
  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --tick-read: #027eb5;
  --pro-gold: #d97706;
  --danger: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg-stage);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(134, 150, 160, 0.25); border-radius: 999px; }

/* ==========================================================================
   COMMON CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-primary);
  font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background 140ms ease, transform 110ms ease;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn-primary { background: var(--accent); border-color: transparent; color: #ffffff; font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-sm { height: 36px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: transparent; color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background 140ms ease, color 140ms ease;
}
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

input[type="text"], input[type="password"], input[type="search"], textarea {
  width: 100%; padding: 10px 14px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text-primary);
  font-family: inherit; font-size: 14.5px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #ffffff;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.xl { width: 88px; height: 88px; font-size: 32px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.pro-badge {
  display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  background: rgba(245, 158, 11, 0.16); color: var(--pro-gold);
}
.ai-badge {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(14, 165, 233, 0.22));
  color: #a5b4fc;
}

/* ==========================================================================
   ZERO-FRICTION AUTH GATE
   ========================================================================== */
.auth-gate {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  padding: 20px; background: var(--bg-stage);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--bg-list);
  border: 1px solid var(--border); border-radius: 20px; padding: 28px 24px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.45);
}
.gate-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
}
.gate-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.gate-sub { font-size: 13px; color: var(--text-secondary); }
.gate-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; border-radius: 12px; background: var(--bg-stage); margin-bottom: 18px;
}
.gate-tab {
  height: 36px; border: none; border-radius: 9px; background: transparent;
  color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer;
}
.gate-tab.active { background: var(--bg-surface); color: var(--text-primary); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.input-prefix-wrap { position: relative; display: flex; align-items: center; }
.input-prefix-wrap span { position: absolute; left: 13px; color: var(--text-muted); font-weight: 700; }
.input-prefix-wrap input { padding-left: 30px; }
.gate-hint { margin-top: 12px; font-size: 12px; color: var(--text-secondary); text-align: center; }
.inline-alert {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(241, 92, 109, 0.14); color: var(--danger);
}

/* ==========================================================================
   WHATSAPP 3-COLUMN LAYOUT (RAIL + LIST + STAGE + OPTIONAL INFO)
   ========================================================================== */
.app-shell {
  display: flex;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* 1. SLIM ICON RAIL */
.nav-rail {
  width: 64px;
  flex-shrink: 0;
  background: var(--bg-rail);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  z-index: 20;
}
.rail-group { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.rail-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  border: none; background: transparent; color: var(--text-secondary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: background 140ms ease, color 140ms ease;
}
.rail-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.rail-lbl { display: none; font-size: 11px; font-weight: 600; margin-top: 3px; }
.rail-badge {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 800; display: grid; place-items: center;
}
.rail-dot {
  position: absolute; top: 8px; right: 8px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
}
.ai-ring-icon {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid transparent;
  background: linear-gradient(var(--bg-rail), var(--bg-rail)) padding-box,
              conic-gradient(from 0deg, #00a884, #38bdf8, #818cf8, #c084fc, #00a884) border-box;
}
.rail-avatar-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 50%; }

/* 2. MIDDLE LIST PANE */
.list-pane {
  width: 360px;
  flex-shrink: 0;
  background: var(--bg-list);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}
.pane-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pane-header {
  height: 60px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
}
.pane-title-wrap { display: flex; align-items: center; gap: 10px; }
.pane-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.conn-pill {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(245, 158, 11, 0.16); color: var(--pro-gold);
}

.pane-search { padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
.search-pill { position: relative; display: flex; align-items: center; margin-bottom: 10px; }
.search-pill svg { position: absolute; left: 13px; color: var(--text-secondary); pointer-events: none; }
.search-pill input {
  height: 38px; padding-left: 38px; border-radius: 10px;
  border: none; background: var(--bg-surface); font-size: 14px;
}
.filter-pills { display: flex; gap: 7px; overflow-x: auto; }
.pill {
  height: 30px; padding: 0 12px; border-radius: 999px; border: none;
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.pill.active { background: var(--accent-soft); color: var(--accent); }

.outbox-banner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: rgba(245, 158, 11, 0.12);
  font-size: 12.5px; color: var(--pro-gold);
}

.scroll-list { flex: 1; overflow-y: auto; padding: 4px 8px; }

/* Spacious WhatsApp Chat Row */
.room-item, .list-row {
  width: 100%; display: flex; align-items: center; gap: 13px;
  padding: 11px 12px; border-radius: 12px; border: none;
  background: transparent; color: inherit; text-align: left;
  cursor: pointer; transition: background 120ms ease;
}
.room-item:hover, .list-row:hover { background: var(--bg-hover); }
.room-item.active { background: var(--bg-hover); }

.avatar-wrap { position: relative; flex-shrink: 0; }
.online-dot {
  position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-list);
}
.room-body, .row-text { flex: 1; min-width: 0; }
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.room-title-group, .row-title-flex { display: flex; align-items: center; gap: 6px; min-width: 0; }
.room-title, .row-title {
  font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-time { font-size: 11.5px; color: var(--text-secondary); flex-shrink: 0; }
.room-time.unread { color: var(--accent); font-weight: 700; }
.room-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-preview, .row-sub {
  font-size: 13.5px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.unread-pill {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #ffffff; font-size: 11.5px; font-weight: 700;
  display: inline-grid; place-items: center; flex-shrink: 0;
}

/* Status & Settings Lists */
.section-label { padding: 14px 12px 6px; font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.avatar-ring {
  position: relative; padding: 2px; border-radius: 50%;
  border: 2.5px solid var(--accent); flex-shrink: 0;
}
.avatar-ring.seen { border-color: var(--text-muted); }
.avatar-ring.my-ring { border-color: transparent; padding: 0; }
.plus-dot {
  position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: #fff;
  border: 2px solid var(--bg-list); display: grid; place-items: center; font-weight: 800; font-size: 13px;
}

.native-sponsor-card {
  margin: 18px 8px 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--bg-surface); border: 1px solid var(--border);
}
.ns-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ns-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; color: var(--pro-gold); }
.ns-cta { background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ns-title { font-weight: 700; font-size: 14px; }
.ns-sub { font-size: 12.5px; color: var(--text-secondary); }

.settings-profile-card {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 12px;
  border-radius: 14px; border: none; background: transparent; color: inherit;
  text-align: left; cursor: pointer; margin-bottom: 8px;
}
.settings-profile-card:hover { background: var(--bg-hover); }
.setting-row {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 12px;
  border-radius: 12px; border: none; background: transparent; color: inherit;
  text-align: left; cursor: pointer;
}
.setting-row:hover { background: var(--bg-hover); }
.setting-ic { width: 28px; text-align: center; font-size: 18px; flex-shrink: 0; }
.setting-row.danger .row-title { color: var(--danger); }

/* 3. MAIN CHAT STAGE */
.chat-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-stage);
  background-image: radial-gradient(rgba(134, 150, 160, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
}
.empty-stage { flex: 1; display: grid; place-items: center; padding: 28px; }
.empty-box { max-width: 440px; text-align: center; }
.empty-logo {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 22px;
  background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
}
.empty-box h2 { font-family: var(--font-display); font-size: 1.55rem; font-weight: 800; margin-bottom: 8px; }
.empty-box p { color: var(--text-secondary); font-size: 14px; margin-bottom: 22px; }
.empty-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.active-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-header {
  height: 60px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; background: var(--bg-header); border-bottom: 1px solid var(--border);
}
.ch-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ch-profile-trigger {
  display: flex; align-items: center; gap: 11px; background: none; border: none;
  color: inherit; text-align: left; cursor: pointer; min-width: 0; padding: 4px 6px; border-radius: 10px;
}
.ch-profile-trigger:hover { background: var(--bg-hover); }
.ch-meta { min-width: 0; }
.ch-title-row { display: flex; align-items: center; gap: 6px; }
.ch-title { font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-subtitle { font-size: 12.5px; color: var(--text-secondary); }
.ch-subtitle.typing { color: var(--accent); font-weight: 600; }
.ch-actions { display: flex; align-items: center; gap: 2px; }

.inchat-search {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: var(--bg-header); border-bottom: 1px solid var(--border);
}
.inchat-search input { height: 36px; }

/* MESSAGE STREAM */
.message-list {
  flex: 1; overflow-y: auto; padding: 18px min(6%, 48px);
  display: flex; flex-direction: column; gap: 6px;
}
.date-pill, .msg-system {
  align-self: center; padding: 5px 12px; border-radius: 8px;
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: 12px; font-weight: 600; margin: 8px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}
.msg-row { display: flex; flex-direction: column; max-width: min(72%, 560px); }
.msg-row.out { align-self: flex-end; align-items: flex-end; }
.msg-row.in { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 8px 11px 6px; border-radius: 12px;
  background: var(--bubble-in); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  word-break: break-word; position: relative;
}
.msg-row.out .msg-bubble { background: var(--bubble-out); border-top-right-radius: 2px; }
.msg-row.in .msg-bubble { border-top-left-radius: 2px; }
.msg-bubble.sticker-bubble { background: transparent !important; box-shadow: none; padding: 2px; }
.sticker-big { font-size: 56px; line-height: 1.1; }

.msg-sender { font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; display: flex; gap: 6px; align-items: center; }
.msg-fwd { font-size: 11.5px; font-style: italic; color: var(--text-secondary); margin-bottom: 3px; }
.msg-quote {
  padding: 5px 9px; margin-bottom: 5px; border-left: 3px solid var(--accent);
  border-radius: 6px; background: rgba(0, 0, 0, 0.14); font-size: 12.5px;
}
.msg-quote-name { font-weight: 700; color: var(--accent); }
.msg-quote-text { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }

.msg-text { font-size: 14.5px; white-space: pre-wrap; line-height: 1.45; }
.msg-text.deleted { font-style: italic; color: var(--text-secondary); }
.msg-media-img { max-width: 100%; max-height: 300px; border-radius: 8px; margin-bottom: 5px; cursor: zoom-in; display: block; }
.msg-media-vid { max-width: 100%; max-height: 300px; border-radius: 8px; margin-bottom: 5px; display: block; }
.msg-audio { width: 250px; max-width: 100%; height: 36px; margin-bottom: 4px; }
.msg-file-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.15); color: inherit; text-decoration: none; margin-bottom: 4px; font-size: 13px;
}

.msg-meta {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px;
  margin-top: 2px; font-size: 11px; color: var(--text-secondary);
}
.tick-read { color: var(--tick-read); font-weight: 800; }

.msg-tools {
  display: none; align-items: center; gap: 2px; margin-top: 3px; padding: 2px 6px;
  border-radius: 999px; background: var(--bg-surface); border: 1px solid var(--border);
}
.msg-row:hover .msg-tools { display: inline-flex; }
.tool-btn {
  background: none; border: none; color: var(--text-secondary);
  font-size: 12.5px; padding: 2px 6px; border-radius: 6px; cursor: pointer;
}
.tool-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.rx-pill {
  padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-surface); color: var(--text-primary); font-size: 12px; cursor: pointer;
}
.rx-pill.mine { border-color: var(--accent); background: var(--accent-soft); }

/* CONTEXT BAR, EMOJI POPOVER, VOICE & COMPOSER */
.context-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 16px; background: var(--bg-header); border-top: 1px solid var(--border);
}
.context-bar-inner { border-left: 3px solid var(--accent); padding-left: 10px; min-width: 0; }
.context-title { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.context-text { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.emoji-popover {
  padding: 10px 14px; background: var(--bg-header); border-top: 1px solid var(--border);
}
.emoji-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.ep-tab {
  padding: 4px 12px; border-radius: 999px; border: none;
  background: var(--bg-input); color: var(--text-secondary); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.ep-tab.active { background: var(--accent-soft); color: var(--accent); }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 140px; overflow-y: auto; }
.ep-item {
  width: 38px; height: 38px; border-radius: 9px; border: none;
  background: transparent; font-size: 22px; cursor: pointer;
}
.ep-item.sticker { width: 52px; height: 52px; font-size: 32px; }
.ep-item:hover { background: var(--bg-hover); }

.voice-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-header); border-top: 1px solid var(--border);
}
.voice-status { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; color: var(--danger); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.voice-btns { display: flex; gap: 8px; }

.composer-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-header); border-top: 1px solid var(--border);
}
.composer-pill {
  flex: 1; background: var(--bg-input); border-radius: 22px;
  padding: 9px 15px; display: flex; align-items: center;
}
.composer-pill textarea {
  border: none; padding: 0; background: transparent; max-height: 110px; resize: none;
  font-size: 15px; line-height: 1.4;
}
.action-fab {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--bg-input); color: var(--text-secondary);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.action-fab.send { background: var(--accent); color: #ffffff; }
.action-fab:hover { opacity: 0.92; }

/* 4. RIGHT INFO DRAWER */
.info-drawer {
  width: 320px; flex-shrink: 0; background: var(--bg-list);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; height: 100%;
}
.info-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.info-hero { text-align: center; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.info-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.info-act-btn {
  padding: 10px 6px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-surface); color: var(--text-primary); font-size: 12px; font-weight: 600; cursor: pointer;
}
.info-act-btn:hover { background: var(--bg-hover); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; }

/* MODALS, STATUS VIEWER & CALL OVERLAY */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 220; background: rgba(0, 0, 0, 0.72);
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
}
.modal-card {
  width: 100%; max-width: 440px; background: var(--bg-list);
  border: 1px solid var(--border); border-radius: 18px; padding: 22px;
}
.modal-card.modal-wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.inline-row { display: flex; gap: 8px; }
.dir-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; margin-top: 8px; }
.dir-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 10px; border-radius: 12px; background: var(--bg-surface); cursor: pointer;
}
.dir-item:hover { background: var(--bg-hover); }
.dir-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.swatch-row { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: #fff; transform: scale(1.12); }

.invite-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; border-radius: 12px; background: var(--bg-surface); margin-bottom: 16px;
}
.muted-sm { font-size: 12.5px; color: var(--text-secondary); }
.pro-banner { padding: 14px; border-radius: 14px; background: var(--accent-soft); margin-bottom: 14px; }
.pro-price { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; margin: 4px 0; }
.pro-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; }
.pro-card { background: var(--bg-surface); border-radius: 14px; padding: 14px; }
.pro-card h4 { font-size: 14px; margin-bottom: 8px; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.qris-wrap { text-align: center; margin-bottom: 10px; }
.qris-wrap img { max-width: 160px; border-radius: 10px; }

/* Fullscreen Status Viewer */
.status-viewer {
  position: fixed; inset: 0; z-index: 260; background: #000; color: #fff;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.sv-top { position: absolute; top: 0; left: 0; right: 0; padding: 12px 16px; z-index: 5; background: linear-gradient(rgba(0,0,0,.65), transparent); }
.sv-bars { display: flex; gap: 5px; margin-bottom: 10px; }
.sv-bar { flex: 1; height: 3px; border-radius: 999px; background: rgba(255,255,255,.3); overflow: hidden; }
.sv-bar.done { background: #fff; }
.sv-bar.active { background: var(--accent); }
.sv-header { display: flex; align-items: center; justify-content: space-between; }
.sv-user { display: flex; align-items: center; gap: 10px; }
.sv-stage {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 80px 28px;
  text-align: center; font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
}
.sv-stage img { max-width: 92vw; max-height: 78vh; border-radius: 14px; }
.sv-nav-left, .sv-nav-right { position: absolute; top: 70px; bottom: 0; width: 35%; z-index: 4; cursor: pointer; }
.sv-nav-left { left: 0; }
.sv-nav-right { right: 0; }

/* Call Overlay */
.call-overlay {
  position: fixed; inset: 0; z-index: 270; background: rgba(11, 20, 26, 0.94);
  display: grid; place-items: center; padding: 20px; color: #fff;
}
.call-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 480px; }
.call-videos { position: relative; width: 100%; aspect-ratio: 4/3; background: #000; border-radius: 16px; overflow: hidden; }
.call-videos #remote-video { width: 100%; height: 100%; object-fit: cover; }
.call-videos #local-video { position: absolute; right: 12px; bottom: 12px; width: 110px; border-radius: 10px; border: 2px solid #fff; }
.call-controls { display: flex; gap: 14px; margin-top: 10px; }
.call-btn {
  height: 46px; padding: 0 22px; border-radius: 999px; border: none;
  font-weight: 700; color: #fff; cursor: pointer;
}
.call-btn.accept { background: #00a884; }
.call-btn.decline { background: #f15c6d; }
.call-btn.neutral { background: #2a3942; }

.lightbox { position: fixed; inset: 0; z-index: 280; background: rgba(0,0,0,.9); display: grid; place-items: center; padding: 20px; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 10px; }
.lightbox-close { position: fixed; top: 18px; right: 18px; width: 42px; height: 42px; border-radius: 50%; border: none; background: #202c33; color: #fff; font-size: 18px; cursor: pointer; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 350;
  padding: 10px 18px; border-radius: 999px; background: var(--bg-header);
  border: 1px solid var(--accent); color: var(--text-primary); font-size: 13.5px; font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.toast.err { border-color: var(--danger); color: var(--danger); }

.mobile-only, .mobile-only-flex { display: none; }

/* ==========================================================================
   MOBILE WHATSAPP EXPERIENCE (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex; }
  .mobile-only-flex { display: flex; }

  .app-shell { flex-direction: column; }
  .list-pane { width: 100%; border-right: none; flex: 1; min-height: 0; }

  .nav-rail {
    order: 3; width: 100%; height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding: 4px 8px env(safe-area-inset-bottom, 0px);
    flex-direction: row; border-right: none; border-top: 1px solid var(--border);
  }
  .rail-group { flex-direction: row; justify-content: space-around; flex: 1; gap: 0; }
  .rail-bottom { flex: 0.35; }
  .rail-btn { width: auto; min-width: 56px; height: 50px; border-radius: 14px; }
  .rail-lbl { display: block; }

  .app-shell:not(.in-chat) .chat-stage,
  .app-shell:not(.in-chat) .info-drawer { display: none; }

  .app-shell.in-chat .list-pane,
  .app-shell.in-chat .nav-rail { display: none; }

  .info-drawer { position: fixed; inset: 0; width: 100%; z-index: 120; }
  .msg-row { max-width: 86%; }
  .pro-cols { grid-template-columns: 1fr; }
}
