/* StealthGram - electric lime + matte obsidian encrypted messenger PWA */
:root {
  --bg: #090d12;
  --panel: #0f151d;
  --panel-2: #0c1118;
  --panel-3: #161f2b;
  --panel-glass: rgba(15, 21, 29, 0.84);
  --border: #1c2633;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-lime: rgba(166, 253, 1, 0.28);
  --text: #edf3f8;
  --muted: #8a97a6;
  --accent: #a6fd01;
  --accent-dim: #82cf00;
  --accent-ink: #071204;
  --accent-soft: rgba(166, 253, 1, 0.11);
  --accent-glow: rgba(166, 253, 1, 0.22);
  --danger: #f0616d;
  --warn: #f0b94b;
  --bubble-me: #213a0e;
  --bubble-me-2: #162908;
  --bubble-me-border: rgba(166, 253, 1, 0.25);
  --bubble-them: #141c27;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
input::placeholder, textarea::placeholder { color: rgba(138, 151, 166, 0.55); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(166, 253, 1, 0.12);
  background: #0a0f16;
}
label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
a { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #b5ff1f 0%, var(--accent) 55%, #93e400 100%);
  color: var(--accent-ink);
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: 0 6px 22px rgba(166, 253, 1, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.1s, filter 0.15s, box-shadow 0.15s;
  user-select: none;
}
.btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 28px rgba(166, 253, 1, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.btn.ghost {
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn.ghost:hover { background: #1c2736; border-color: rgba(255, 255, 255, 0.14); filter: none; }
.btn.danger {
  background: rgba(240, 97, 109, 0.08);
  color: var(--danger);
  border: 1px solid rgba(240, 97, 109, 0.45);
  box-shadow: none;
}
.btn.danger:hover { background: rgba(240, 97, 109, 0.16); filter: none; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.full { width: 100%; }

/* ---------- brand marks ---------- */
.brand-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 0 10px rgba(166, 253, 1, 0.26));
}
.brand-mark-inline {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}
.brand-text {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 18px;
  color: #ffffff;
  line-height: 1;
}
.brand-text b {
  color: var(--accent);
  font-weight: 800;
}

/* ---------- auth & unlock screens ---------- */
.auth-wrap, .unlock-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-t));
  padding-bottom: calc(24px + var(--safe-b));
  background:
    radial-gradient(ellipse 70% 42% at 50% 8%, rgba(166, 253, 1, 0.11), transparent 68%),
    radial-gradient(circle at 82% 88%, rgba(130, 207, 0, 0.06), transparent 48%),
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 24px 24px, auto;
}
.auth-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(18, 25, 35, 0.94) 0%, rgba(12, 17, 24, 0.97) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  padding: 32px 26px 26px;
  box-shadow:
    0 24px 72px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(166, 253, 1, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.72;
}
.auth-card::after {
  content: '';
  position: absolute;
  top: -70px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 140px;
  background: radial-gradient(circle, rgba(166, 253, 1, 0.14), transparent 70%);
  pointer-events: none;
}
.auth-hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 18px;
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.auth-logo .brand-wordmark {
  width: 204px;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 24px rgba(166, 253, 1, 0.16));
}
.auth-logo.compact { margin-bottom: 12px; }
.auth-logo.compact .brand-wordmark { width: 158px; }

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border-lime);
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.45px;
  margin-bottom: 8px;
}
.auth-badge svg { width: 12px; height: 12px; flex: none; }
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.4px;
}
.auth-tabs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(7, 11, 16, 0.72);
  border: 1px solid var(--border-subtle);
  padding: 5px;
  border-radius: 13px;
  margin-bottom: 18px;
}
.auth-tabs button {
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 650;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-tabs button:hover { color: var(--text); }
.auth-tabs button.on {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.totp-input {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-align: center;
}
.auth-error {
  background: rgba(240, 97, 109, 0.1);
  border: 1px solid rgba(240, 97, 109, 0.35);
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 12px;
}
.auth-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 15px;
  text-align: center;
  line-height: 1.5;
}
.auth-note a { cursor: pointer; }
.auth-pillars {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.auth-pillars span {
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 10px;
  letter-spacing: 0.3px;
}
.totp-qr { display: flex; justify-content: center; margin: 14px 0; }
.totp-qr canvas {
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  width: 192px !important;
  height: 192px !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.totp-secret {
  text-align: center;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14.5px;
  letter-spacing: 2px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px dashed var(--accent-dim);
  padding: 10px;
  border-radius: 10px;
  user-select: all;
  word-break: break-all;
}
.mnemonic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 6px; margin: 14px 0; }
.mnemonic-grid div {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: ui-monospace, monospace;
}
.mnemonic-grid div b { color: var(--accent); margin-right: 6px; font-weight: 700; }
.recovery-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 14px 0; }
.recovery-list div {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  text-align: center;
  color: var(--warn);
}
.warn-box {
  background: rgba(240, 185, 75, 0.08);
  border: 1px solid rgba(240, 185, 75, 0.3);
  color: var(--warn);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 12.5px;
  margin: 12px 0;
  line-height: 1.5;
}
.steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 12px; }
.steps .dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--panel-3); border: 1px solid var(--border);
  color: var(--muted); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps .dot.on { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--accent); }
.steps .dot.done { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps .bar { width: 22px; height: 1px; background: var(--border); }
.mini-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.mini-actions button { font-size: 12px; padding: 7px 13px; }

/* ---------- app shell ---------- */
#app-shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  background: var(--bg);
}
#app-shell.in-chat {
  grid-template-rows: 1fr;
}
#app-shell.in-chat .topbar,
#app-shell.in-chat .bottomnav {
  display: none;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-t));
  background: var(--panel-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 6;
}
.topbar .logo { display: flex; align-items: center; gap: 9px; }
.topbar .me, .sidenav .me {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 5px 11px;
  border-radius: 999px;
}
.topbar .me { margin-left: auto; }
.me-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  flex: none;
}
.main { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
#app-shell.in-chat .main { overflow: hidden; }
#view { height: 100%; }

.bottomnav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--panel-glass);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 8px calc(6px + var(--safe-b));
}
.bottomnav button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; color: var(--muted); font-size: 10.5px; font-weight: 600;
  border-radius: 12px; letter-spacing: 0.3px; transition: color 0.15s, background 0.15s;
}
.bottomnav button svg { width: 22px; height: 22px; }
.bottomnav button.on { color: var(--accent); background: var(--accent-soft); }
.sidenav { display: none; }

@media (min-width: 900px) {
  #app-shell,
  #app-shell.in-chat {
    grid-template-columns: 256px 1fr;
    grid-template-rows: 1fr;
  }
  .topbar, .bottomnav { display: none !important; }
  .main { grid-column: 2; grid-row: 1; height: 100dvh; }
  .sidenav {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0e141c 0%, #0b1017 100%);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 14px;
    height: 100dvh;
  }
  .sidenav .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 22px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sidenav .brand-mark { width: 32px; height: 32px; }
  .sidenav .brand-text { font-size: 19px; }
  .sidenav button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 4px;
    text-align: left;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  .sidenav button:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }
  .sidenav button svg { width: 20px; height: 20px; }
  .sidenav button.on {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--border-lime);
  }
  .sidenav .me {
    margin-top: auto;
    padding: 10px 13px;
    border-radius: 12px;
    justify-content: flex-start;
    color: var(--text);
  }
}

.view {
  padding: 22px 18px;
  padding-bottom: calc(28px + var(--safe-b));
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.view-head .view-title { margin-bottom: 0; }
.view-title { font-size: 24px; font-weight: 800; margin-bottom: 16px; letter-spacing: -0.2px; }
.e2e-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border-lime);
  border-radius: 999px;
  padding: 5px 11px;
}
.e2e-chip svg { width: 12px; height: 12px; }

/* ---------- chat list ---------- */
.chat-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.chat-row:hover {
  background: var(--panel);
  border-color: var(--border-subtle);
}
.chat-row:active { background: var(--panel-3); transform: scale(0.995); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #071204; user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.32);
}
.chat-row .mid { min-width: 0; flex: 1; }
.chat-row .name { font-weight: 680; display: flex; align-items: center; gap: 7px; font-size: 15.5px; }
.chat-row .prev {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.chat-row .meta { text-align: right; flex: none; }
.chat-row .time { color: var(--muted); font-size: 11.5px; }
.chat-row .badge {
  min-width: 20px; height: 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px; margin-top: 5px;
  box-shadow: 0 0 12px rgba(166, 253, 1, 0.35);
}
.chat-row .badge.hide { visibility: hidden; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(138, 151, 166, 0.45); display: inline-block; }
.presence-dot.on { background: var(--accent); box-shadow: 0 0 8px rgba(166, 253, 1, 0.75); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 46px 24px;
  background: linear-gradient(180deg, rgba(15, 21, 29, 0.72), rgba(11, 15, 20, 0.55));
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  margin-top: 8px;
}
.empty-ghost-wrap {
  width: 94px;
  height: 94px;
  margin: 0 auto 18px;
  border-radius: 26px;
  background: radial-gradient(circle, rgba(166, 253, 1, 0.18) 0%, rgba(166, 253, 1, 0.03) 70%);
  border: 1px solid var(--border-lime);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.empty-ghost {
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(166, 253, 1, 0.25));
  animation: ghostFloat 3.2s ease-in-out infinite;
}
@keyframes ghostFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.empty svg { width: 54px; height: 54px; opacity: 0.45; margin-bottom: 12px; }
.empty h3 { color: var(--text); font-size: 19px; font-weight: 750; margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 340px; margin: 0 auto; line-height: 1.5; }
.empty .btn { margin-top: 18px; }
.empty .mini-note { font-size: 12px; margin-top: 8px; color: var(--muted); }
.install-hint {
  background: var(--accent-soft);
  border: 1px solid var(--border-lime);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 12.5px;
  margin-top: 18px;
  color: #d6ff82;
  text-align: center;
  line-height: 1.45;
}

/* ---------- chat view ---------- */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  padding-top: calc(10px + var(--safe-t));
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 4;
}
.chat-head .avatar { width: 40px; height: 40px; font-size: 15px; }
.chat-head .back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  margin-left: -4px; border-radius: 10px; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.chat-head .back:hover { background: var(--panel-3); color: var(--text); }
.chat-head .back svg { width: 20px; height: 20px; }
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .who .nm {
  font-weight: 700;
  font-size: 15.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head .who .st-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}
.chat-head .who .st-line svg { width: 11px; height: 11px; color: var(--accent); flex: none; }
.chat-head .who .st.typing { color: var(--accent); font-style: italic; }
.chat-head .head-action {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chat-head .head-action:hover {
  background: var(--accent-soft);
  border-color: var(--border-lime);
  color: var(--accent);
}
.chat-head .head-action.active-ttl {
  background: rgba(240, 185, 75, 0.14);
  border-color: rgba(240, 185, 75, 0.5);
  color: var(--warn);
}
.chat-head .head-action svg { width: 18px; height: 18px; }

.msgs {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 65% 45% at 50% 0%, rgba(166, 253, 1, 0.045), transparent 65%),
    radial-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: auto, 22px 22px;
}
.msgs::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 240px;
  background: url('/brand/stealthgram-app-icon-mark.png') center / contain no-repeat;
  opacity: 0.032;
  pointer-events: none;
  z-index: 0;
}
@media (min-width: 900px) {
  .msgs::before { left: calc(50% + 128px); }
}
.msgs > * { position: relative; z-index: 1; }

.chat-e2e-banner {
  margin: auto;
  max-width: 340px;
  text-align: center;
  padding: 24px 20px;
  border-radius: 20px;
  background: rgba(15, 21, 29, 0.85);
  border: 1px solid var(--border-lime);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}
.chat-e2e-ghost {
  width: 54px;
  height: 54px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 6px 16px rgba(166, 253, 1, 0.25));
}
.chat-e2e-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 6px;
}
.chat-e2e-title svg { width: 14px; height: 14px; }
.chat-e2e-banner p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.chat-e2e-banner b { color: var(--text); }

.day-sep { display: flex; justify-content: center; margin: 14px 0 8px; }
.day-sep span {
  background: rgba(15, 21, 29, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.4px;
}
.bubble {
  max-width: min(78%, 540px);
  padding: 9px 13px 7px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  animation: pop 0.14s ease-out;
}
.bubble.me {
  align-self: flex-end;
  background: linear-gradient(155deg, var(--bubble-me) 0%, var(--bubble-me-2) 100%);
  border: 1px solid var(--bubble-me-border);
  color: #f3f9ec;
  border-bottom-right-radius: 5px;
}
.bubble.them {
  align-self: flex-start;
  background: var(--bubble-them);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  border-bottom-left-radius: 5px;
}
.bubble.me::after {
  content: '';
  position: absolute;
  right: -6px;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 9px 7px;
  border-color: transparent transparent transparent var(--bubble-me-2);
}
.bubble.them::after {
  content: '';
  position: absolute;
  left: -6px;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 7px 9px 0;
  border-color: transparent var(--bubble-them) transparent transparent;
}
.bubble .txt { white-space: pre-wrap; line-height: 1.48; }
.bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble img.media { max-width: 100%; border-radius: 11px; display: block; cursor: pointer; margin: 2px 0; }
.bubble .ftr {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: 10.5px;
  color: rgba(237, 243, 248, 0.54);
  margin-top: 4px;
}
.bubble .ttl { color: var(--warn); display: inline-flex; align-items: center; gap: 3px; animation: ttlPulse 2.4s infinite; }
.bubble .ttl svg { width: 11px; height: 11px; }
.bubble .check { color: var(--accent); letter-spacing: -2px; font-weight: 700; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes ttlPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.ttl-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 9px 14px;
  background: var(--panel);
  border-top: 1px solid var(--border-subtle);
}
.ttl-picker.collapsed { display: none; }
.ttl-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
  flex: none;
}
.ttl-label svg { width: 13px; height: 13px; color: var(--warn); }
.ttl-picker button {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--panel-2);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ttl-picker button:hover { color: var(--text); }
.ttl-picker button.on {
  color: var(--warn);
  border-color: rgba(240, 185, 75, 0.55);
  background: rgba(240, 185, 75, 0.12);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  transition: border-color 0.16s;
}
.composer:focus-within { border-top-color: var(--border-lime); }
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  border-radius: 22px;
  padding: 10px 16px;
  min-height: 42px;
  line-height: 1.4;
  background: var(--panel-2);
  border-color: var(--border);
}
.composer textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(166, 253, 1, 0.09);
}
.composer .icon-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.composer .icon-btn:hover { color: var(--text); background: var(--panel-3); }
.composer .icon-btn.send {
  background: linear-gradient(180deg, #b5ff1f 0%, var(--accent) 100%);
  color: var(--accent-ink);
  box-shadow: 0 4px 16px rgba(166, 253, 1, 0.28);
}
.composer .icon-btn.send:hover { filter: brightness(1.06); }
.composer .icon-btn.send:active { transform: scale(0.94); }
.composer .icon-btn.send:disabled { opacity: 0.35; box-shadow: none; filter: saturate(0.4); }
.composer .icon-btn svg { width: 20px; height: 20px; }

/* ---------- wallet ---------- */
.chain-card {
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.chain-head { display: flex; align-items: center; gap: 12px; }
.chain-badge {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #fff; flex: none;
}
.chain-head .nm { font-weight: 700; }
.chain-head .bal { color: var(--muted); font-size: 12.5px; }
.chain-head .usd { margin-left: auto; text-align: right; }
.chain-head .usd .v { font-weight: 700; color: var(--accent); }
.chain-head .usd .s { color: var(--muted); font-size: 11px; }
.addr-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.addr-row code {
  font-family: ui-monospace, monospace; font-size: 12px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted);
}
.chain-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.token-row {
  display: flex; justify-content: space-between;
  padding: 7px 12px; background: var(--panel-2);
  border-radius: 8px; margin-top: 6px; font-size: 13px; color: var(--muted);
}
.token-row b { color: var(--text); font-weight: 600; }
.wallet-total {
  background: linear-gradient(145deg, rgba(166, 253, 1, 0.08) 0%, var(--panel) 55%);
  border: 1px solid var(--border-lime);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 14px;
}
.wallet-total .lbl { color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase; }
.wallet-total .val { font-size: 30px; font-weight: 800; color: var(--accent); margin-top: 4px; }
.wallet-total .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ---------- settings & contacts ---------- */
.settings-card {
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 4px 16px;
  margin-bottom: 14px;
}
.settings-card h4 { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; padding: 14px 0 4px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
}
.settings-row:last-child { border-bottom: none; }
.settings-row .l .t { font-weight: 600; font-size: 14.5px; }
.settings-row .l .d { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.settings-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.settings-footer-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  opacity: 0.82;
  filter: drop-shadow(0 4px 12px rgba(166, 253, 1, 0.2));
}
.switch {
  position: relative; width: 46px; height: 26px; flex: none;
  background: var(--panel-3); border-radius: 999px; border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: var(--muted); border-radius: 50%; transition: transform 0.2s, background 0.2s;
}
.switch.on { background: var(--accent-soft); border-color: var(--accent-dim); }
.switch.on::after { transform: translateX(20px); background: var(--accent); box-shadow: 0 0 8px rgba(166, 253, 1, 0.55); }
.contact-add { display: flex; gap: 8px; margin-bottom: 16px; }
.contact-add input { flex: 1; }

/* ---------- modal / toast / misc ---------- */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(4, 7, 11, 0.76);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 60; animation: fade 0.15s;
  padding: 12px; padding-bottom: calc(12px + var(--safe-b));
}
@media (min-width: 640px) { .modal-back { align-items: center; } }
.modal {
  width: 100%; max-width: 440px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 22px 20px;
  max-height: 86dvh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.58);
  animation: rise 0.18s ease-out;
}
.modal h3 { margin-bottom: 4px; }
.modal .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.modal .actions { display: flex; gap: 8px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }

#toasts {
  position: fixed; top: calc(14px + var(--safe-t)); left: 50%;
  transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 8px; width: min(92vw, 380px);
}
.toast {
  background: var(--panel-3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 15px;
  font-size: 13.5px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
  animation: rise 0.18s ease-out;
}
.toast.err { border-color: rgba(240, 97, 109, 0.55); color: var(--danger); }
.toast.ok { border-color: var(--border-lime); color: #e8ffbc; }

.qr-box { display: flex; justify-content: center; margin: 12px 0; }
.qr-box canvas { background: #fff; border-radius: 12px; padding: 10px; width: 200px !important; height: 200px !important; }
.key-pre {
  font-family: ui-monospace, monospace; font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; word-break: break-all; user-select: all; color: var(--warn);
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lightbox {
  position: fixed; inset: 0; background: rgba(4, 7, 11, 0.94);
  z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }
.dot-load { display: inline-flex; gap: 4px; align-items: center; }
.dot-load i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.dot-load i:nth-child(2) { animation-delay: 0.2s; }
.dot-load i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.msgs::-webkit-scrollbar, .main::-webkit-scrollbar { width: 5px; }
.msgs::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 4px; }
.caption-preview { max-width: 100%; border-radius: 12px; margin-bottom: 10px; }
.ctx-menu { display: flex; gap: 8px; }
.pw-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.pw-hint.good { color: var(--accent); }

/* ---------- encrypted calls ---------- */
.call-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 7, 11, 0.92);
  backdrop-filter: blur(10px);
  z-index: 90; display: flex; align-items: center; justify-content: center;
  animation: fade 0.15s;
}
.call-box {
  background: var(--panel);
  border: 1px solid var(--border-lime);
  border-radius: 24px;
  padding: 32px 28px;
  text-align: center;
  width: min(92vw, 340px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
}
#call-avatar .avatar { width: 84px; height: 84px; font-size: 30px; margin: 0 auto 14px; }
.call-name { font-size: 20px; font-weight: 700; }
.call-state { color: var(--muted); margin-top: 6px; font-size: 14px; }
.call-timer { color: var(--accent); font-size: 26px; font-weight: 700; margin-top: 12px; font-variant-numeric: tabular-nums; }
.call-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.call-box audio { display: none; }

/* ---------- security shield, safety numbers, privacy blur & lock ---------- */
.sidenav .lock-btn {
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  border-radius: 12px;
  color: var(--muted);
}
.sidenav .lock-btn:hover { color: var(--accent); background: var(--accent-soft); }
.topbar-lock {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}
.topbar-lock:hover { color: var(--accent); border-color: var(--border-lime); }
.topbar-lock svg { width: 17px; height: 17px; }
.topbar .me { margin-left: 6px; }

.chat-head .head-action.verified {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--border-lime);
}
.chat-head .head-action.warn-pulse {
  color: var(--danger);
  background: rgba(240, 97, 109, 0.14);
  border-color: rgba(240, 97, 109, 0.5);
}
.verified-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 900;
  vertical-align: middle;
  margin-left: 4px;
}
.key-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(240, 97, 109, 0.12);
  border-bottom: 1px solid rgba(240, 97, 109, 0.35);
  color: #ff9ba3;
  font-size: 12.5px;
}
.safety-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 12px 0;
}
.safety-grid span {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 1px;
  padding: 9px 6px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-lime);
  color: var(--accent);
}
.verify-ok-pill {
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border-lime);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.safety-hint { font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.5; }
.exif-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border-lime);
  border-radius: 10px;
  padding: 8px 11px;
  margin-bottom: 10px;
}
.exif-pill svg { width: 15px; height: 15px; flex: none; }

body.privacy-blur #app {
  filter: blur(22px) brightness(0.45);
  transition: filter 0.14s ease;
  pointer-events: none;
  user-select: none;
}
body.privacy-locked #app {
  filter: blur(26px) brightness(0.25);
  pointer-events: none;
  user-select: none;
}
.privacy-shield {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse 65% 45% at 50% 30%, rgba(166, 253, 1, 0.10), transparent 68%), rgba(7, 10, 15, 0.92);
  backdrop-filter: blur(18px);
  animation: fade 0.15s ease;
}
.shield-box {
  width: min(92vw, 360px);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border-lime);
  border-radius: 24px;
  padding: 32px 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
}
.shield-logo {
  width: 175px;
  height: auto;
  margin: 0 auto 14px;
  filter: drop-shadow(0 8px 22px rgba(166, 253, 1, 0.18));
}
.shield-box p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 8px 0 20px;
  line-height: 1.5;
}
