/* ==========================================================================
   MeshLink — design system
   Purple-first, premium, responsive. Dark and light.
   ========================================================================== */

:root {
  --font: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --shadow-sm: 0 2px 10px rgba(4, 0, 12, .18);
  --shadow-md: 0 18px 50px rgba(4, 0, 12, .35);
  --shadow-lg: 0 30px 90px rgba(4, 0, 12, .5);
  --speed: .18s;
  --rail-w: 86px;
  --side-w: 384px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0613;
  --bg-soft: #0d0819;
  --panel: #130d23;
  --panel-2: #191130;
  --surface: #211740;
  --surface-2: #2b1e51;
  --surface-3: #362665;
  --text: #f3eeff;
  --text-2: #c6b8e6;
  --muted: #9282b4;
  --faint: #675784;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .14);
  --accent: #a78bfa;
  --accent-2: #8b5cf6;
  --accent-3: #c4b5fd;
  --accent-soft: rgba(167, 139, 250, .14);
  --accent-ink: #170a2e;
  --bubble-out: #4b2a8a;
  --bubble-out-2: #3f2277;
  --bubble-in: #1e1634;
  --bubble-in-2: #251a40;
  --bubble-text: #f6f1ff;
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .14);
  --mint: #4ade80;
  --mint-soft: rgba(74, 222, 128, .14);
  --blue: #7dd3fc;
  --gold: #fbbf24;
  --glass: rgba(19, 13, 35, .72);
  --chat-a: #100a1e;
  --chat-b: #160d2a;
  --chat-c: #1b0f33;
  --chat-glow-1: rgba(139, 92, 246, .14);
  --chat-glow-2: rgba(192, 132, 252, .08);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, .3);
  --shadow-md: 0 20px 60px rgba(0, 0, 0, .45);
  --scroll: rgba(196, 181, 253, .18);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #efe9ff;
  --bg-soft: #f7f4ff;
  --panel: #ffffff;
  --panel-2: #fbf9ff;
  --surface: #f0eaff;
  --surface-2: #e8dfff;
  --surface-3: #ddd0ff;
  --text: #1d1135;
  --text-2: #524168;
  --muted: #7c6b97;
  --faint: #a495bd;
  --line: rgba(29, 17, 53, .075);
  --line-strong: rgba(29, 17, 53, .14);
  --accent: #7c3aed;
  --accent-2: #6d28d9;
  --accent-3: #a78bfa;
  --accent-soft: rgba(124, 58, 237, .1);
  --accent-ink: #ffffff;
  --bubble-out: #e9ddff;
  --bubble-out-2: #dfcfff;
  --bubble-in: #ffffff;
  --bubble-in-2: #f7f2ff;
  --bubble-text: #211334;
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, .08);
  --mint: #059669;
  --mint-soft: rgba(5, 150, 105, .1);
  --blue: #0284c7;
  --gold: #b45309;
  --glass: rgba(255, 255, 255, .75);
  --chat-a: #f3edff;
  --chat-b: #eee6ff;
  --chat-c: #f8f4ff;
  --chat-glow-1: rgba(139, 92, 246, .12);
  --chat-glow-2: rgba(59, 130, 246, .07);
  --scroll: rgba(124, 58, 237, .22);
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent-3); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- primitives */
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 16px; height: 16px; }
.icon.xs { width: 13px; height: 13px; stroke-width: 2.4; }
.icon.lg { width: 24px; height: 24px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px;
  font-weight: 650; font-size: 13.5px; letter-spacing: .01em;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); transition: transform var(--speed), background var(--speed), border-color var(--speed), box-shadow var(--speed);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: scale(.975); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 26px rgba(124, 58, 237, .34), inset 0 1px 0 rgba(255,255,255,.24);
}
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--accent-3), var(--accent-2)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface); color: var(--text); }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.danger:hover { background: rgba(251, 113, 133, .22); }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 10px; }
.btn.lg { height: 50px; font-size: 15px; border-radius: 14px; padding: 0 24px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--text-2);
  transition: background var(--speed), color var(--speed), transform var(--speed);
  flex: none; position: relative;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent-3); }
.icon-btn.filled { background: var(--accent); color: #fff; }
.icon-btn.filled:hover { background: var(--accent-2); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.lg { width: 44px; height: 44px; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 0 2px var(--panel); }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 650; color: var(--text-2); letter-spacing: .02em; }
.field .hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.input, .textarea, .select {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  font-size: 14px; outline: none; transition: border-color var(--speed), box-shadow var(--speed), background var(--speed);
  min-height: 44px;
}
.textarea { resize: vertical; min-height: 84px; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel-2);
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 13px; color: var(--faint); pointer-events: none; }
.input-wrap .input { padding-left: 40px; }

.switch {
  --w: 46px; width: var(--w); height: 27px; border-radius: 999px;
  background: var(--surface-2); position: relative; flex: none;
  border: 1px solid var(--line); transition: background var(--speed), border-color var(--speed);
}
.switch::after {
  content: ""; position: absolute; top: 50%; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; transform: translateY(-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,.28); transition: left var(--speed), background var(--speed);
}
.switch[aria-checked="true"] { background: linear-gradient(135deg, var(--accent-3), var(--accent-2)); border-color: transparent; }
.switch[aria-checked="true"]::after { left: calc(var(--w) - 24px); }
.switch.mini { --w: 38px; height: 22px; }
.switch.mini::after { width: 16px; height: 16px; }
.switch.mini[aria-checked="true"]::after { left: calc(var(--w) - 19px); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------------- avatars */
.avatar {
  --sz: 46px;
  width: var(--sz); height: var(--sz); border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; letter-spacing: .02em; position: relative;
  background: linear-gradient(135deg, #7c3aed, #c084fc);
  overflow: visible; user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.avatar .av-inner {
  width: 100%; height: 100%; border-radius: inherit; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--sz) * .36);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.ring::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--accent-3); opacity: .9;
}
.avatar .presence {
  position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--mint); border: 2.5px solid var(--panel);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.avatar .presence.away { background: var(--gold); }
.avatar .presence.off { background: var(--faint); }
.avatar.sm { --sz: 34px; }
.avatar.xs { --sz: 26px; }
.avatar.lg { --sz: 58px; }
.avatar.xl { --sz: 88px; }
.avatar.xxl { --sz: 118px; }
.avatar .emoji { font-size: calc(var(--sz) * .52); }

.av-stack { display: flex; align-items: center; }
.av-stack .avatar + .avatar { margin-left: -10px; box-shadow: 0 0 0 2px var(--panel); }

/* ---------------------------------------------------------------------- auth */
.auth {
  min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr);
  background: var(--bg); overflow: hidden;
}
.auth-art {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(900px 640px at 12% 4%, rgba(196, 181, 253, .22), transparent 60%),
    radial-gradient(780px 620px at 92% 88%, rgba(124, 58, 237, .34), transparent 62%),
    linear-gradient(150deg, #150b2a 0%, #1e0f3d 38%, #2a1157 72%, #150a2a 100%);
  color: #f7f2ff; padding: 46px 56px 40px; display: flex; flex-direction: column;
}
.auth-art::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.16) .7px, transparent .7px);
  background-size: 22px 22px; mask-image: linear-gradient(180deg, #000 0%, transparent 72%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 20px; letter-spacing: -.02em; }
.auth-logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(255,255,255,.22), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.24); backdrop-filter: blur(8px);
  box-shadow: 0 14px 34px rgba(0,0,0,.3);
}
.auth-logo svg { width: 27px; height: 27px; }
.auth-copy { margin-top: auto; max-width: 580px; position: relative; z-index: 2; }
.auth-kicker {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px;
  border-radius: 999px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14); font-size: 11.5px; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase; color: #e4d7ff; margin-bottom: 22px;
}
.auth-kicker .live { width: 7px; height: 7px; border-radius: 50%; background: #6ee7b7; box-shadow: 0 0 0 4px rgba(110,231,183,.16); }
.auth-copy h1 {
  margin: 0 0 18px; font-size: clamp(38px, 4.6vw, 62px); line-height: 1.02;
  letter-spacing: -.045em; font-weight: 800;
}
.auth-copy h1 .grad {
  background: linear-gradient(100deg, #e9d5ff 0%, #c4b5fd 35%, #8b5cf6 75%, #6ee7b7 130%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-copy p { margin: 0; color: rgba(238,230,255,.76); font-size: 16px; line-height: 1.6; max-width: 470px; }
.auth-points { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.auth-point {
  display: inline-flex; gap: 8px; align-items: center; padding: 9px 13px;
  border-radius: 999px; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12); font-size: 12.5px; color: #eadfff;
}
.auth-point .icon { color: #a7f3d0; width: 15px; height: 15px; }
.auth-mock {
  margin-top: 38px; display: flex; gap: 14px; align-items: flex-end; position: relative; z-index: 2;
}
.auth-bubble {
  max-width: 320px; padding: 12px 15px; border-radius: 18px 18px 18px 6px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.13);
  backdrop-filter: blur(14px); font-size: 13.5px; color: #f0e8ff; box-shadow: 0 20px 44px rgba(0,0,0,.3);
}
.auth-bubble.out {
  margin-left: auto; border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6); color: #1a0b31;
  border-color: transparent; font-weight: 600;
}
.auth-bubble .who { display: flex; align-items: center; gap: 8px; font-size: 11px; opacity: .7; margin-bottom: 4px; }
.auth-foot { margin-top: auto; padding-top: 40px; font-size: 11.5px; color: rgba(238,230,255,.56); position: relative; z-index: 2; }

.auth-panel {
  display: flex; align-items: center; justify-content: center; padding: 36px;
  background: var(--bg-soft); position: relative;
}
.auth-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(520px 380px at 90% 0%, var(--accent-soft), transparent 70%);
}
.auth-card { width: 100%; max-width: 424px; position: relative; z-index: 2; }
.auth-card-head { margin-bottom: 26px; }
.auth-card-head h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.035em; font-weight: 800; }
.auth-card-head p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface); border-radius: 12px; border: 1px solid var(--line); }
.auth-tab { height: 36px; border-radius: 9px; font-size: 12.5px; font-weight: 650; color: var(--muted); transition: var(--speed); }
.auth-tab.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-alt { display: flex; flex-direction: column; gap: 10px; }
.auth-note { display: flex; gap: 9px; align-items: flex-start; font-size: 11.5px; color: var(--muted); line-height: 1.5; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.auth-note .icon { color: var(--accent-3); width: 15px; height: 15px; margin-top: 1px; }
.otp-input { letter-spacing: .5em; font-size: 22px; font-weight: 700; text-align: center; font-family: var(--mono); padding-left: 13px; }
.auth-demo { font-size: 11.5px; color: var(--muted); text-align: center; }
.auth-demo b { color: var(--accent-3); letter-spacing: .12em; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.auth-back:hover { color: var(--text); }
.auth-mobile-brand { display: none; }

/* ----------------------------------------------------------------- app shell */
.app {
  height: 100dvh; display: grid; grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr);
  background: var(--bg); overflow: hidden; position: relative;
}
.app.wide { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.app.wide .sidebar { display: none; }
.app.wide .main { grid-column: 2 / 4; }

/* ---------------------------------------------------------------------- rail */
.rail {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 14px 8px 12px; z-index: 30; min-height: 0;
}
.rail-logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent-3), var(--accent-2));
  color: #fff; box-shadow: 0 10px 26px rgba(124,58,237,.4), inset 0 1px 0 rgba(255,255,255,.3);
  margin-bottom: 16px; flex: none;
}
.rail-logo svg { width: 27px; height: 27px; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }
.nav-btn {
  width: 66px; min-height: 54px; border-radius: 14px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; color: var(--muted);
  font-size: 9.5px; font-weight: 650; letter-spacing: .01em; position: relative;
  transition: background var(--speed), color var(--speed), transform var(--speed);
}
.nav-btn .icon { width: 21px; height: 21px; }
.nav-btn:hover { background: var(--surface); color: var(--text-2); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent-3); }
.nav-btn.active::before {
  content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--accent-3);
}
.nav-btn .nbadge {
  position: absolute; top: 6px; right: 11px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 9px;
  display: grid; place-items: center; border: 2px solid var(--panel); font-weight: 750;
}
.rail-spacer { flex: 1; }
.rail-profile { margin-top: 8px; }
.rail-profile .avatar { cursor: pointer; }
.rail-version { font-size: 8px; color: var(--faint); margin-top: 6px; letter-spacing: .05em; }

/* ------------------------------------------------------------------- sidebar */
.sidebar {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  position: relative; z-index: 20;
}
.side-head { padding: 18px 18px 12px; display: flex; align-items: center; gap: 8px; }
.side-title { font-size: 23px; font-weight: 800; letter-spacing: -.035em; flex: 1; }
.side-title small { display: block; font-size: 10px; letter-spacing: .14em; color: var(--accent-3); font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.side-actions { display: flex; gap: 2px; }
.side-search { padding: 4px 18px 12px; }
.side-search .input { background: var(--surface); border-color: transparent; height: 42px; font-size: 13px; border-radius: 12px; }
.side-search .input:focus { border-color: var(--accent); background: var(--panel-2); }
.filters { display: flex; gap: 6px; padding: 0 18px 12px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; background: transparent;
  border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; font-weight: 650;
  white-space: nowrap; transition: var(--speed);
}
.chip:hover { background: var(--surface); color: var(--text-2); }
.chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent-3); }
.chip .count { margin-left: 5px; opacity: .65; }
.chat-list { flex: 1; overflow-y: auto; padding: 2px 10px 14px; min-height: 0; }
.chat-row {
  display: flex; gap: 12px; align-items: center; padding: 10px 10px; border-radius: 14px;
  cursor: pointer; position: relative; transition: background var(--speed);
  border: 1px solid transparent;
}
.chat-row:hover { background: var(--surface); }
.chat-row.active { background: var(--surface); border-color: var(--line); }
.chat-row.active::before {
  content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px;
  border-radius: 3px; background: var(--accent-3);
}
.chat-row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-row .top { display: flex; align-items: center; gap: 8px; }
.chat-row .name { font-weight: 700; font-size: 13.5px; letter-spacing: -.01em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .time { font-size: 10.5px; color: var(--faint); flex: none; font-weight: 550; }
.chat-row .preview { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; min-width: 0; }
.chat-row .preview .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .preview .ticks { color: var(--muted); display: inline-flex; }
.chat-row.unread .name { color: var(--text); }
.chat-row.unread .preview { color: var(--text-2); }
.chat-row.unread .time { color: var(--accent-3); }
.row-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  color: #fff; font-size: 10px; font-weight: 750; flex: none;
  box-shadow: 0 4px 12px rgba(124,58,237,.3);
}
.row-meta-ic { display: inline-flex; gap: 4px; color: var(--faint); align-items: center; }
.row-meta-ic .icon { width: 13px; height: 13px; }
.empty-list { padding: 40px 24px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.empty-list .icon { width: 34px; height: 34px; color: var(--faint); margin-bottom: 10px; }
.side-foot { padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--faint); display: flex; gap: 6px; align-items: center; }
.side-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }

/* ---------------------------------------------------------------------- main */
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--bg-soft); }
.chat { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-head {
  height: 68px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; background: var(--glass); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line); z-index: 12; position: relative;
}
.chat-head .who { flex: 1; min-width: 0; cursor: pointer; }
.chat-head .who .nm { font-weight: 750; font-size: 14.5px; letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.chat-head .who .st { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.chat-head .who .st .online { color: var(--mint); font-weight: 600; }
.chat-head .who .st .typing { color: var(--accent-3); }
.chat-actions { display: flex; align-items: center; gap: 1px; }
.enc-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 7px;
  background: var(--mint-soft); color: var(--mint); font-size: 9px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.enc-chip .icon { width: 11px; height: 11px; }
.verified-badge { display: inline-flex; color: var(--blue); }
.verified-badge .icon { width: 13px; height: 13px; fill: currentColor; stroke-width: 0; }

.chat-body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 16px clamp(16px, 5vw, 68px) 12px; position: relative;
  background:
    radial-gradient(760px 460px at 12% 0%, var(--chat-glow-1), transparent 60%),
    radial-gradient(680px 480px at 92% 92%, var(--chat-glow-2), transparent 62%),
    linear-gradient(160deg, var(--chat-a), var(--chat-b) 55%, var(--chat-c));
  scroll-behavior: auto;
}
.chat-body[data-wallpaper="dune"] {
  background:
    radial-gradient(700px 400px at 85% 8%, rgba(251, 191, 36, .07), transparent 60%),
    radial-gradient(600px 500px at 10% 100%, rgba(139, 92, 246, .16), transparent 60%),
    linear-gradient(155deg, #0e0819, #1c1030 55%, #22133a);
}
[data-theme="light"] .chat-body[data-wallpaper="dune"] {
  background:
    radial-gradient(700px 400px at 85% 8%, rgba(180, 83, 9, .08), transparent 60%),
    radial-gradient(600px 500px at 10% 100%, rgba(139, 92, 246, .12), transparent 60%),
    linear-gradient(155deg, #f6f0e8, #f3edff 55%, #efe7ff);
}
.chat-body[data-wallpaper="grid"] {
  background-color: var(--chat-a);
  background-image:
    linear-gradient(rgba(167,139,250,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167,139,250,.055) 1px, transparent 1px),
    radial-gradient(700px 440px at 20% 0%, var(--chat-glow-1), transparent 65%),
    linear-gradient(160deg, var(--chat-a), var(--chat-c));
  background-size: 34px 34px, 34px 34px, auto, auto;
}
.chat-body[data-wallpaper="paper"] {
  background-color: var(--chat-a);
  background-image:
    radial-gradient(var(--chat-glow-1) 1px, transparent 1.2px),
    linear-gradient(160deg, var(--chat-a), var(--chat-c));
  background-size: 18px 18px, auto;
}
.chat-body[data-wallpaper="plain"] { background: var(--chat-a); }
.chat-body.drag-over::after {
  content: "Drop files to send"; position: absolute; inset: 14px; z-index: 20;
  border: 2px dashed var(--accent); border-radius: 22px; background: rgba(124,58,237,.07);
  display: grid; place-items: center; font-weight: 700; color: var(--accent-3); backdrop-filter: blur(3px);
}

.chat-scroll-inner { display: flex; flex-direction: column; gap: 2px; max-width: 1080px; margin: 0 auto; width: 100%; }
.day-divider { display: flex; justify-content: center; margin: 18px 0 14px; }
.day-divider span {
  padding: 5px 12px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--line); color: var(--muted); font-size: 10.5px; font-weight: 650;
  letter-spacing: .03em; backdrop-filter: blur(10px);
}
.unread-divider { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: var(--accent-3); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.unread-divider::before, .unread-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

.msg-row { display: flex; gap: 8px; margin: 2px 0; align-items: flex-end; position: relative; animation: msgIn .18s ease both; }
.msg-row.out { justify-content: flex-end; }
.msg-row.grouped { margin-top: 1px; }
.msg-row .bubble-wrap { position: relative; max-width: min(580px, 74%); display: flex; flex-direction: column; align-items: flex-start; }
.msg-row.out .bubble-wrap { align-items: flex-end; }
.sender-name { font-size: 11px; font-weight: 750; color: var(--accent-3); margin: 4px 2px 3px; letter-spacing: .01em; }
.sender-name span { color: var(--faint); font-weight: 500; font-size: 9px; margin-left: 4px; }
.bubble {
  background: var(--bubble-in); color: var(--bubble-text);
  border-radius: 16px 16px 16px 5px; padding: 8px 11px 6px;
  position: relative; box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,.045);
  min-width: 62px;
}
.msg-row.out .bubble {
  background: linear-gradient(145deg, var(--bubble-out-2), var(--bubble-out));
  border-radius: 16px 16px 5px 16px; border-color: rgba(255,255,255,.07);
}
.msg-row.sticker .bubble { background: transparent !important; box-shadow: none; border: 0; padding: 0; }
.msg-row.highlight .bubble { animation: flashBubble 1.4s ease; }
.msg-text { font-size: 14.3px; line-height: 1.44; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text + .msg-meta { margin-top: 3px; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 10px; color: var(--muted); float: right; margin: 2px 0 -1px 8px; position: relative; top: 3px; }
.msg-row.out .msg-meta { color: rgba(243,238,255,.62); }
[data-theme="light"] .msg-row.out .msg-meta { color: #6d5a8c; }
.edited { font-style: italic; opacity: .72; font-size: 9.5px; }
.ticks { display: inline-flex; align-items: center; color: currentColor; opacity: .85; }
.ticks.read { color: #8be9ff; opacity: 1; }
[data-theme="light"] .ticks.read { color: #0ea5e9; }
.ticks .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.msg-actions-btn {
  opacity: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); background: var(--glass); border: 1px solid var(--line);
  transition: opacity var(--speed), background var(--speed); position: absolute; top: -9px; right: -4px; z-index: 4;
}
.msg-row.in .msg-actions-btn { right: auto; left: -4px; }
.msg-row:hover .msg-actions-btn { opacity: 1; }
.msg-actions-btn:hover { color: var(--text); background: var(--surface); }
.msg-row .msg-actions-btn .icon { width: 14px; height: 14px; }

.reactions { display: flex; gap: 3px; flex-wrap: wrap; margin-top: -6px; margin-left: 6px; z-index: 3; position: relative; }
.msg-row.out .reactions { margin-left: 0; margin-right: 6px; justify-content: flex-end; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 3px; height: 23px; padding: 0 6px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--line-strong);
  font-size: 12px; box-shadow: var(--shadow-sm); transition: transform var(--speed);
}
.reaction-chip:hover { transform: translateY(-1px); }
.reaction-chip.mine { border-color: var(--accent); background: var(--accent-soft); }
.reaction-chip .cnt { font-size: 9.5px; color: var(--text-2); font-weight: 650; }

.reply-quote {
  display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; margin: 0 0 6px;
  border-left: 3px solid var(--accent-3); border-radius: 6px;
  background: rgba(0,0,0,.16); font-size: 11.5px; cursor: pointer;
}
[data-theme="light"] .reply-quote { background: rgba(124,58,237,.07); }
.reply-quote .rq-name { font-weight: 750; color: var(--accent-3); font-size: 10.5px; }
.reply-quote .rq-text { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.forwarded-label { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); font-style: italic; margin-bottom: 3px; }
.forwarded-label .icon { width: 11px; height: 11px; }
.deleted-text { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-style: italic; color: var(--muted); }
.deleted-text .icon { width: 13px; height: 13px; }

/* media in bubbles */
.msg-image { border-radius: 11px; overflow: hidden; background: var(--surface); max-width: 320px; cursor: zoom-in; position: relative; }
.msg-image img { max-height: 360px; width: auto; max-width: 100%; object-fit: cover; }
.msg-image .img-cap { padding: 7px 2px 1px; font-size: 13px; }
.msg-video { border-radius: 11px; overflow: hidden; max-width: 330px; background: #000; position: relative; }
.msg-video video { max-height: 340px; width: 100%; }
.file-card {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 11px;
  background: rgba(0,0,0,.16); min-width: 210px; cursor: pointer;
}
[data-theme="light"] .file-card { background: rgba(124,58,237,.06); }
.file-ic { width: 38px; height: 44px; border-radius: 8px; background: linear-gradient(140deg, #8b5cf6, #6d28d9); display: grid; place-items: center; color: #fff; flex: none; position: relative; }
.file-ic::after { content: ""; position: absolute; top: 0; right: 0; border-width: 0 9px 9px 0; border-style: solid; border-color: transparent var(--bubble-in) transparent transparent; }
[data-theme="light"] .file-ic::after { border-color: transparent #fff transparent transparent; }
.file-ic .icon { width: 18px; height: 18px; }
.file-info { min-width: 0; }
.file-info .fn { font-size: 12.5px; font-weight: 650; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info .fs { font-size: 10px; color: var(--muted); margin-top: 1px; text-transform: uppercase; letter-spacing: .04em; }
.link-card {
  display: block; border-radius: 11px; overflow: hidden; margin-top: 5px;
  background: rgba(0,0,0,.18); border: 1px solid var(--line); min-width: 240px;
}
[data-theme="light"] .link-card { background: rgba(124,58,237,.05); }
.link-card .lc-top { height: 74px; background: linear-gradient(135deg, #2e1065, #7c3aed 60%, #c084fc); position: relative; overflow: hidden; }
.link-card .lc-top::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.25) 1px, transparent 1px); background-size: 14px 14px; opacity: .5; }
.link-card .lc-body { padding: 8px 10px 9px; }
.link-card .lc-domain { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-3); font-weight: 700; }
.link-card .lc-title { font-size: 12.5px; font-weight: 700; margin: 1px 0 2px; }
.link-card .lc-desc { font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.link-card:hover { text-decoration: none; }

.voice-player { display: flex; align-items: center; gap: 9px; min-width: 220px; padding: 2px 0; }
.voice-play { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.voice-play .icon { width: 15px; height: 15px; }
.voice-wave { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.voice-wave .bar { flex: 1; min-width: 2px; border-radius: 2px; background: var(--accent-3); opacity: .45; transition: opacity .1s; }
.voice-wave .bar.on { opacity: 1; }
.voice-time { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

.sticker-msg { font-size: 76px; line-height: 1; filter: drop-shadow(0 8px 20px rgba(0,0,0,.3)); padding: 2px; }

/* typing */
.typing-row { display: flex; margin: 4px 0 10px; }
.typing-bubble { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-radius: 16px 16px 16px 5px; background: var(--bubble-in); border: 1px solid var(--line); }
.typing-bubble .avatar { --sz: 24px; }
.typing-dots { display: inline-flex; gap: 3px; align-items: center; height: 14px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: typing 1.3s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }

/* composer */
.composer-wrap { flex: none; padding: 0 14px 14px; background: linear-gradient(180deg, transparent, var(--bg-soft) 34%); position: relative; z-index: 11; }
.composer { max-width: 1080px; margin: 0 auto; position: relative; }
.composer-bar {
  display: flex; align-items: flex-end; gap: 7px; padding: 7px 8px 7px 8px;
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 18px; box-shadow: 0 12px 38px rgba(0,0,0,.28);
}
.composer-bar .icon-btn { margin-bottom: 1px; }
.composer-input {
  flex: 1; min-height: 40px; max-height: 148px; resize: none; border: 0; outline: none;
  background: transparent; padding: 10px 4px 8px; font-size: 14px; line-height: 1.4;
  color: var(--text);
}
.composer-input::placeholder { color: var(--faint); }
.send-btn {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2)); color: #fff;
  box-shadow: 0 8px 22px rgba(124,58,237,.38); transition: transform var(--speed), filter var(--speed);
}
.send-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.send-btn:active { transform: scale(.94); }
.send-btn.mic { background: var(--surface); color: var(--text-2); box-shadow: none; border: 1px solid var(--line); }
.composer-hint { text-align: center; font-size: 9px; color: var(--faint); margin-top: 5px; letter-spacing: .03em; }
.typing-bar {
  display: flex; align-items: center; gap: 8px; background: var(--accent-soft);
  border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; margin-bottom: 7px;
  font-size: 11.5px; color: var(--text-2);
}
.typing-bar .icon { width: 14px; height: 14px; color: var(--accent-3); }
.typing-bar b { color: var(--accent-3); font-weight: 650; }
.reply-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 7px;
  background: var(--panel); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent-3);
  border-radius: 12px; box-shadow: var(--shadow-sm);
}
.reply-bar .rb-body { flex: 1; min-width: 0; }
.reply-bar .rb-label { font-size: 10px; font-weight: 750; color: var(--accent-3); text-transform: uppercase; letter-spacing: .05em; }
.reply-bar .rb-text { font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-attach {
  display: flex; gap: 4px; padding: 6px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: var(--shadow-md); position: absolute; bottom: 64px; left: 0; z-index: 40;
  animation: popUp .16s ease both;
}
.composer-attach button { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 62px; padding: 8px 4px; border-radius: 10px; font-size: 9.5px; color: var(--muted); font-weight: 600; }
.composer-attach button:hover { background: var(--surface); color: var(--text); }
.composer-attach .att-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.composer-attach .att-ic .icon { width: 18px; height: 18px; }

/* emoji picker */
.emoji-pop {
  position: absolute; bottom: 64px; right: 0; width: min(360px, calc(100vw - 40px));
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 18px;
  box-shadow: var(--shadow-lg); z-index: 45; overflow: hidden; animation: popUp .16s ease both;
}
.emoji-head { display: flex; gap: 3px; padding: 8px 8px 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.emoji-head::-webkit-scrollbar { display: none; }
.emoji-tab { width: 32px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 16px; opacity: .55; flex: none; }
.emoji-tab.active { background: var(--surface); opacity: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; padding: 8px; max-height: 232px; overflow-y: auto; }
.emoji-grid button { height: 36px; border-radius: 8px; font-size: 21px; display: grid; place-items: center; transition: background .12s, transform .12s; }
.emoji-grid button:hover { background: var(--surface); transform: scale(1.13); }
.emoji-foot { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); }
.emoji-foot .input { height: 34px; font-size: 12px; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px; max-height: 250px; overflow-y: auto; }
.sticker-grid button { height: 68px; border-radius: 12px; background: var(--surface); font-size: 40px; display: grid; place-items: center; }
.sticker-grid button:hover { background: var(--surface-2); transform: scale(1.04); }
.gif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; max-height: 260px; overflow-y: auto; }
.gif-card { border-radius: 10px; overflow: hidden; aspect-ratio: 16/10; display: grid; place-items: end start; padding: 8px; font-size: 10px; font-weight: 750; color: #fff; position: relative; }
.gif-card span { position: relative; z-index: 2; background: rgba(0,0,0,.35); padding: 2px 6px; border-radius: 5px; }
.gif-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 12px; }

/* empty states */
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; position: relative; overflow: hidden; }
.chat-empty .glow { position: absolute; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 65%); filter: blur(10px); }
.chat-empty-art { width: 150px; height: 150px; border-radius: 44px; display: grid; place-items: center; background: linear-gradient(150deg, var(--surface-2), var(--panel)); border: 1px solid var(--line-strong); box-shadow: var(--shadow-md); position: relative; z-index: 2; transform: rotate(-4deg); }
.chat-empty-art .icon { width: 66px; height: 66px; color: var(--accent-3); stroke-width: 1.2; }
.chat-empty h2 { margin: 26px 0 8px; font-size: 26px; letter-spacing: -.035em; font-weight: 800; position: relative; z-index: 2; }
.chat-empty p { margin: 0; max-width: 380px; color: var(--muted); font-size: 13px; line-height: 1.65; position: relative; z-index: 2; }
.chat-empty .tiny { margin-top: 24px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 10.5px; color: var(--muted); position: relative; z-index: 2; }
.chat-empty .tiny .icon { width: 13px; height: 13px; color: var(--mint); }

/* full page views */
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 34px clamp(20px, 4vw, 48px) 60px; }
.page-inner { max-width: 980px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 26px; }
.page-head .eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--accent-3); font-weight: 750; margin-bottom: 5px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 3.4vw, 38px); letter-spacing: -.04em; font-weight: 800; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.page-head .head-actions { margin-left: auto; display: flex; gap: 8px; }
.page-section { margin-bottom: 30px; }
.page-section > h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.mobile-back { display: none; }

/* status page */
.my-status-row { display: flex; gap: 16px; align-items: center; padding: 16px; margin-bottom: 16px; cursor: pointer; transition: var(--speed); }
.my-status-row:hover { background: var(--panel-2); border-color: var(--line-strong); }
.my-status-row .add-ring { position: relative; }
.my-status-row .add-ring .plus { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 2.5px solid var(--panel); }
.my-status-row .add-ring .plus .icon { width: 12px; height: 12px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.status-card {
  border-radius: var(--r-md); overflow: hidden; position: relative; aspect-ratio: 9/13;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer;
  transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed);
  display: flex; flex-direction: column; justify-content: space-between; padding: 12px;
}
.status-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.status-card .sc-bg { position: absolute; inset: 0; z-index: 0; }
.status-card .sc-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,5,20,.16), transparent 36%, rgba(10,5,20,.82)); }
.status-card .sc-bg img { width: 100%; height: 100%; object-fit: cover; }
.status-card .sc-top { display: flex; align-items: center; gap: 8px; position: relative; z-index: 2; }
.status-card .sc-top .avatar { box-shadow: 0 0 0 2px var(--accent-3), 0 4px 16px rgba(0,0,0,.4); }
.status-card .sc-top .nm { font-size: 11.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.status-card .sc-top .tm { margin-left: auto; font-size: 9.5px; color: rgba(255,255,255,.75); }
.status-card .sc-bottom { position: relative; z-index: 2; }
.status-card .sc-text { font-size: 12.5px; color: #fff; line-height: 1.4; font-weight: 550; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.status-card .sc-seen { display: inline-flex; margin-top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-3); }
.status-card.seen .sc-bg::after { opacity: .7; }
.status-empty { padding: 34px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); font-size: 12.5px; line-height: 1.6; }
.status-empty .icon { width: 30px; height: 30px; color: var(--faint); margin-bottom: 8px; }

/* story viewer */
.story-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(5, 2, 12, .96);
  backdrop-filter: blur(16px); display: flex; align-items: center; justify-content: center;
  animation: fadeIn .18s ease;
}
.story-shell { width: min(440px, 100vw); height: min(820px, 100dvh); display: flex; flex-direction: column; position: relative; }
.story-progress { display: flex; gap: 4px; padding: 10px 10px 0; position: relative; z-index: 5; }
.story-progress .sp { flex: 1; height: 2.5px; background: rgba(255,255,255,.24); border-radius: 3px; overflow: hidden; }
.story-progress .sp i { display: block; height: 100%; width: 0; background: #fff; border-radius: 3px; }
.story-progress .sp.done i { width: 100%; }
.story-progress .sp.active i { animation: storyFill 5s linear forwards; }
.story-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; position: relative; z-index: 5; }
.story-head .nm { font-weight: 700; font-size: 13.5px; color: #fff; }
.story-head .tm { font-size: 10.5px; color: rgba(255,255,255,.6); }
.story-head .icon-btn { color: rgba(255,255,255,.8); }
.story-canvas {
  flex: 1; border-radius: 22px; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center; padding: 30px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
.story-canvas.has-media { padding: 0; }
.story-canvas img, .story-canvas video { width: 100%; height: 100%; object-fit: contain; background: #05020c; }
.story-text { font-size: clamp(24px, 5.4vw, 34px); line-height: 1.24; font-weight: 750; text-align: center; letter-spacing: -.02em; color: #fff; text-shadow: 0 4px 26px rgba(0,0,0,.28); max-width: 330px; overflow-wrap: anywhere; }
.story-nav { position: absolute; inset: 0; display: flex; z-index: 3; }
.story-nav button { flex: 1; height: 100%; }
.story-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px 16px; position: relative; z-index: 5; }
.story-views { display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.8); font-size: 11.5px; flex: 1; }
.story-views .icon { width: 15px; height: 15px; }
.story-reply { display: flex; align-items: center; gap: 6px; flex: 1; }
.story-reply input { flex: 1; height: 38px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; padding: 0 14px; outline: none; font-size: 12px; }
.story-reply input::placeholder { color: rgba(255,255,255,.45); }
.story-close { position: absolute; top: 8px; right: 8px; z-index: 8; color: #fff; }

/* calls */
.call-row { display: flex; align-items: center; gap: 13px; padding: 13px 14px; border-radius: 14px; cursor: pointer; transition: var(--speed); border: 1px solid transparent; }
.call-row:hover { background: var(--surface); }
.call-row + .call-row { margin-top: 2px; }
.call-row .cr-main { flex: 1; min-width: 0; }
.call-row .nm { font-weight: 650; font-size: 13.5px; }
.call-row .meta { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.call-row .meta .icon { width: 12px; height: 12px; }
.call-row .meta.missed { color: var(--danger); }
.call-row .time { font-size: 10.5px; color: var(--faint); flex: none; }
.call-row .call-back { color: var(--accent-3); }
.call-tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 18px; width: fit-content; }
.call-tabs .chip { border: 0; }
.call-tabs .chip.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

.call-overlay {
  position: fixed; inset: 0; z-index: 260; display: flex; flex-direction: column;
  background:
    radial-gradient(900px 700px at 50% -10%, rgba(167,139,250,.3), transparent 60%),
    radial-gradient(700px 600px at 10% 100%, rgba(124,58,237,.22), transparent 60%),
    linear-gradient(160deg, #120823, #1c0d35 50%, #0c0517);
  color: #fff; overflow: hidden; animation: fadeIn .2s ease;
}
.call-overlay::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.09) .6px, transparent .6px); background-size: 26px 26px; opacity: .4; }
.call-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 22px 24px; }
.call-top .call-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); font-size: 10.5px; color: rgba(255,255,255,.8); }
.call-top .call-chip .icon { width: 12px; height: 12px; color: #6ee7b7; }
.call-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; z-index: 3; padding: 20px; }
.call-avatar-wrap { position: relative; display: grid; place-items: center; margin-bottom: 26px; }
.call-avatar-wrap .pulse { position: absolute; width: 190px; height: 190px; border-radius: 50%; border: 1px solid rgba(196,181,253,.3); animation: pulseRing 2.4s ease-out infinite; }
.call-avatar-wrap .pulse:nth-child(2) { animation-delay: 1.2s; }
.call-avatar-wrap .avatar { --sz: 128px; font-size: 40px; box-shadow: 0 24px 70px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.15); }
.call-name { font-size: 28px; font-weight: 750; letter-spacing: -.035em; margin-bottom: 7px; }
.call-status { font-size: 13px; color: rgba(255,255,255,.6); display: flex; align-items: center; gap: 8px; }
.call-status .icon { width: 14px; height: 14px; }
.call-controls { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 20px 24px 42px; position: relative; z-index: 4; flex-wrap: wrap; }
.call-ctrl { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 10.5px; color: rgba(255,255,255,.62); }
.call-ctrl .cc-btn {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); color: #fff;
  backdrop-filter: blur(12px); transition: var(--speed);
}
.call-ctrl .cc-btn:hover { background: rgba(255,255,255,.18); transform: translateY(-2px); }
.call-ctrl .cc-btn.off { background: #fff; color: #211333; }
.call-ctrl .cc-btn.end { background: #ef4444; border-color: #ef4444; box-shadow: 0 10px 30px rgba(239,68,68,.4); width: 64px; height: 64px; }
.call-ctrl .cc-btn.end:hover { background: #dc2626; }
.call-video {
  position: absolute; inset: 0; z-index: 1; background: #05020c;
  display: flex; align-items: center; justify-content: center;
}
.call-video video { width: 100%; height: 100%; object-fit: cover; opacity: .82; }
.call-video .video-off { display: flex; flex-direction: column; align-items: center; gap: 12px; color: rgba(255,255,255,.5); font-size: 12px; }
.call-video .video-off .icon { width: 44px; height: 44px; }
.call-video + .call-stage { background: linear-gradient(180deg, transparent, rgba(8,4,18,.7) 70%); }
.self-preview { position: absolute; right: 18px; top: 76px; width: 110px; height: 150px; border-radius: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,.2); background: #120823; z-index: 6; box-shadow: var(--shadow-md); }
.self-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.call-timer { font-variant-numeric: tabular-nums; }

/* settings */
.settings-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: start; }
.settings-col { display: flex; flex-direction: column; gap: 16px; }
.set-card { padding: 18px; }
.set-card > h2 { margin: 0 0 3px; font-size: 15px; font-weight: 750; letter-spacing: -.015em; }
.set-card > .sub { margin: 0 0 15px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .si-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--accent-3); flex: none; }
.set-row .si-ic .icon { width: 17px; height: 17px; }
.set-row .si-body { flex: 1; min-width: 0; }
.set-row .si-title { font-size: 12.5px; font-weight: 650; }
.set-row .si-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; line-height: 1.4; }
.profile-editor { display: flex; flex-direction: column; gap: 14px; }
.profile-editor .pe-top { display: flex; align-items: center; gap: 14px; }
.profile-editor .pe-top .avatar { --sz: 72px; }
.avatar-edit { display: flex; gap: 6px; }
.theme-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-card { border-radius: 14px; border: 1.5px solid var(--line); padding: 10px; cursor: pointer; transition: var(--speed); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card .tc-preview { height: 54px; border-radius: 8px; overflow: hidden; display: flex; margin-bottom: 8px; }
.theme-card .tc-preview .p1 { flex: 1.6; background: #0a0613; }
.theme-card .tc-preview .p2 { flex: 1; background: #4b2a8a; }
.theme-card.light .tc-preview .p1 { background: #efe9ff; }
.theme-card.light .tc-preview .p2 { background: #e9ddff; }
.theme-card .tc-name { font-size: 11px; font-weight: 650; display: flex; align-items: center; gap: 5px; }
.theme-card .tc-name .icon { width: 12px; height: 12px; color: var(--accent-3); }
.wallpaper-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wp-swatch { height: 52px; border-radius: 10px; border: 1.5px solid var(--line); cursor: pointer; position: relative; overflow: hidden; transition: var(--speed); }
.wp-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wp-swatch span { position: absolute; bottom: 3px; left: 5px; font-size: 8.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.wp-aurora { background: radial-gradient(60px 50px at 20% 10%, rgba(167,139,250,.6), transparent), linear-gradient(150deg, #100a1e, #2a1157); }
.wp-dune { background: radial-gradient(70px 50px at 80% 20%, rgba(251,191,36,.35), transparent), linear-gradient(150deg, #1c1030, #3b1d2e); }
.wp-grid { background-color: #140d26; background-image: linear-gradient(rgba(167,139,250,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(167,139,250,.18) 1px, transparent 1px); background-size: 12px 12px; }
.wp-paper { background-color: #191130; background-image: radial-gradient(rgba(196,181,253,.3) 1px, transparent 1px); background-size: 10px 10px; }
.blocked-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.blocked-row + .blocked-row { border-top: 1px solid var(--line); }
.blocked-row .nm { flex: 1; font-size: 12.5px; font-weight: 600; }
.danger-zone { display: flex; flex-direction: column; gap: 8px; }
.about-line { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.about-line .icon { width: 13px; height: 13px; }
.about-line + .about-line { margin-top: 6px; }

/* collections */
.starred-list { display: flex; flex-direction: column; gap: 10px; }
.star-card { padding: 13px 15px; cursor: pointer; transition: var(--speed); }
.star-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.star-card .sc-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.star-card .sc-chat { font-size: 10.5px; color: var(--accent-3); font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star-card .sc-time { font-size: 9.5px; color: var(--faint); }
.star-card .sc-msg { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.star-card .sc-actions { display: flex; justify-content: flex-end; margin-top: 8px; gap: 4px; }
.archived-list { display: flex; flex-direction: column; gap: 4px; }
.archive-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; transition: var(--speed); }
.archive-row:hover { background: var(--surface); }
.archive-row .ar-body { flex: 1; min-width: 0; }
.archive-row .ar-name { font-size: 13px; font-weight: 650; }
.archive-row .ar-preview { font-size: 11px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- overlays */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 180; background: rgba(6, 3, 14, .62);
  backdrop-filter: blur(7px); display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .16s ease;
}
.modal {
  width: 100%; max-width: 460px; max-height: min(86dvh, 760px); overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 22px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: modalIn .18s cubic-bezier(.2,.9,.3,1.1) both;
}
.modal.wide { max-width: 560px; }
.modal-head { padding: 18px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head .mh-body { flex: 1; min-width: 0; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.modal-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.modal-close { margin: -4px -4px 0 0; }
.menu {
  position: fixed; z-index: 190; min-width: 194px; background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 6px; animation: popUp .14s ease both; transform-origin: top right;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border-radius: 9px; font-size: 12.5px; color: var(--text-2); text-align: left; font-weight: 550;
}
.menu-item:hover { background: var(--surface); color: var(--text); }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-label { padding: 5px 10px 3px; font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; }
.quick-reactions { display: flex; gap: 2px; padding: 4px; margin-bottom: 4px; background: var(--surface); border-radius: 10px; justify-content: space-between; }
.quick-reactions button { width: 34px; height: 34px; border-radius: 8px; font-size: 19px; display: grid; place-items: center; }
.quick-reactions button:hover { background: var(--panel); transform: scale(1.12); }

/* toast */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 11px 15px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  color: var(--text); font-size: 12.5px; font-weight: 550; animation: toastIn .2s ease both;
  max-width: 100%;
}
.toast .icon { width: 16px; height: 16px; color: var(--accent-3); flex: none; }
.toast.success .icon { color: var(--mint); }
.toast.error .icon { color: var(--danger); }
.toast.out { animation: toastOut .2s ease both; }

/* menu anchor */
.context-anchor { position: fixed; z-index: 195; }

/* variants */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 9px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tag.mint { background: var(--mint-soft); color: var(--mint); border-color: transparent; }
.tag.purple { background: var(--accent-soft); color: var(--accent-3); border-color: transparent; }

/* cropper-ish image preview */
.preview-thumb { width: 100%; max-height: 250px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.upload-zone { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 22px; text-align: center; color: var(--muted); font-size: 11.5px; cursor: pointer; transition: var(--speed); }
.upload-zone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text-2); }
.upload-zone .icon { width: 24px; height: 24px; margin-bottom: 6px; color: var(--accent-3); }

/* voice recorder overlay */
.recorder {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 2px 4px;
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: blink 1.1s infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 650; color: var(--danger); width: 38px; flex: none; }
.rec-wave { flex: 1; height: 34px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.rec-wave i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 2px; background: var(--accent-3); opacity: .9; transition: height .06s linear; }
.rec-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.rec-btn.stop { background: var(--danger-soft); color: var(--danger); }
.rec-btn.send { background: var(--accent); color: #fff; }
.rec-btn .icon { width: 15px; height: 15px; }

/* empty chat placeholder in list page */
.empty-page { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-page .icon { width: 40px; height: 40px; color: var(--faint); margin-bottom: 12px; }
.empty-page h3 { margin: 0 0 5px; color: var(--text); font-size: 15px; }
.empty-page p { margin: 0 auto; font-size: 12px; max-width: 320px; line-height: 1.6; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  :root { --side-w: 344px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  :root { --rail-w: 0px; --side-w: 100%; }
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: 64px;
    flex-direction: row; justify-content: space-around; align-items: center;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); gap: 0;
    border-right: 0; border-top: 1px solid var(--line); background: var(--glass);
    backdrop-filter: blur(20px);
  }
  .rail-logo, .rail-version { display: none; }
  .rail-nav { flex-direction: row; justify-content: space-around; width: 100%; gap: 0; }
  .nav-btn { width: auto; flex: 1; min-height: 46px; max-width: 76px; border-radius: 12px; gap: 1px; font-size: 8.5px; }
  .nav-btn .icon { width: 20px; height: 20px; }
  .nav-btn.active::before { display: none; }
  .nav-btn .nbadge { top: 1px; right: 15%; }
  .rail-spacer { display: none; }
  .rail-profile { display: none; }
  .sidebar { grid-column: 1; grid-row: 1; padding-bottom: 64px; border-right: 0; }
  .main { grid-column: 1; grid-row: 1; padding-bottom: 64px; display: none; }
  .app.chat-open .sidebar { display: none; }
  .app.chat-open .main { display: flex; }
  .side-head { padding-top: 14px; }
  .mobile-back { display: inline-flex; }
  .chat-head { height: 62px; padding: 0 8px 0 6px; }
  .chat-body { padding: 14px 12px 8px; }
  .composer-wrap { padding: 0 8px 10px; }
  .msg-row .bubble-wrap { max-width: 84%; }
  .page { padding-bottom: 90px; }
  .app.wide .main { grid-column: 1; }
  .chat-empty { display: none; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { padding: 26px 20px; align-items: flex-start; padding-top: 44px; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; font-weight: 750; font-size: 17px; }
  .auth-mobile-brand .auth-logo { width: 40px; height: 40px; border-radius: 12px; }
  .auth-card-head h2 { font-size: 26px; }
  .story-shell { height: 100dvh; }
  .story-canvas { border-radius: 0; }
  .page { padding: 24px 16px 90px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; }
  .page-head .head-actions { width: 100%; margin-left: 0; margin-top: 10px; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { gap: 12px; }
  .modal { border-radius: 20px; }
  .call-name { font-size: 24px; }
  .call-avatar-wrap .avatar { --sz: 108px; }
  .chat-actions .icon-btn.hide-mobile { display: none; }
  .msg-row .bubble-wrap { max-width: 88%; }
  .msg-image img { max-height: 300px; }
  .composer-hint { display: none; }
  #toast-root { bottom: 78px; }
  .call-controls { padding-bottom: 32px; gap: 10px; }
  .call-ctrl .cc-btn { width: 52px; height: 52px; }
  .call-ctrl { font-size: 9.5px; }
  .self-preview { width: 88px; height: 122px; top: 70px; right: 12px; }
  .theme-cards { grid-template-columns: 1fr 1fr; }
  .wallpaper-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 420px) {
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
  .msg-row .bubble-wrap { max-width: 90%; }
  .chat-body { padding: 12px 8px 6px; }
  .status-grid { gap: 8px; }
  .status-card { aspect-ratio: 3/4.2; }
  .side-head { padding: 14px 14px 10px; }
  .side-search, .filters { padding-left: 14px; padding-right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ----------------------------------------------------------------- animations */
@keyframes msgIn { from { opacity: 0; transform: translateY(4px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes popUp { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes storyFill { from { width: 0; } to { width: 100%; } }
@keyframes flashBubble { 0%, 100% { box-shadow: var(--shadow-sm); } 30% { box-shadow: 0 0 0 3px var(--accent); } }
@keyframes pulseRing { 0% { transform: scale(.85); opacity: 0; } 20% { opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }

/* ------------------------------------------------ hybrid / transport additions */
.net-pill {
  display: flex; align-items: center; gap: 8px; padding: 8px 11px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  font-size: 10.5px; font-weight: 650; color: var(--text-2); cursor: pointer;
  transition: var(--speed); width: 100%;
}
.net-pill:hover { border-color: var(--line-strong); }
.net-pill .np-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-pill .np-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); flex: none; }
.net-pill.local .np-dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(251,191,36,.14); }
.net-pill.offline .np-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.net-pill .icon { color: var(--faint); width: 13px; height: 13px; }
.ticks.queued { color: var(--gold); opacity: 1; }
.ticks.mesh { color: var(--accent-3); opacity: 1; }
.msg-row .bubble .ticks.queued, .msg-row .bubble .ticks.mesh { filter: drop-shadow(0 0 5px rgba(0,0,0,.2)); }
.side-actions .icon-btn, .rail .nav-btn { -webkit-tap-highlight-color: transparent; }
mark { color: #fff; }
@media (max-width: 980px) {
  .rail-nav { gap: 0; }
  .nav-btn { max-width: 64px; font-size: 8px; }
}

/* ------------------------------- security, MeshLink ID, MeshLink AI */
.mesh-id-card {
  border: 1px solid var(--line); background: linear-gradient(145deg, var(--surface), var(--panel));
  border-radius: 16px; padding: 14px; margin-bottom: 16px; position: relative; overflow: hidden;
}
.mesh-id-card::after { content:''; position:absolute; width:120px; height:120px; border-radius:50%; right:-40px; top:-60px; background:var(--accent); filter:blur(45px); opacity:.16; }
.mid-top { display:flex; align-items:center; gap:6px; font-size:10px; font-weight:750; text-transform:uppercase; letter-spacing:.08em; color:var(--accent-3); }
.mid-top .icon { width:13px; height:13px; }
.mid-number { font-family:var(--font-mono,ui-monospace,SFMono-Regular,Menlo,monospace); font-size:25px; font-weight:750; letter-spacing:.12em; margin:6px 0 3px; color:var(--text); }
.mid-sub { font-size:10.5px; color:var(--muted); line-height:1.5; }
.security-banner { display:flex; align-items:center; gap:12px; padding:11px; border-radius:13px; background:var(--accent-soft); border:1px solid color-mix(in srgb,var(--accent) 30%,transparent); margin-bottom:6px; }
.sb-ic { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:linear-gradient(135deg,var(--accent),var(--accent-3)); color:#fff; flex:none; }
.pin-input { letter-spacing:.5em; font-family:var(--font-mono,ui-monospace,monospace); font-size:18px; text-align:center; }
.lock-screen { min-height:100dvh; display:grid; place-items:center; padding:20px; background:radial-gradient(circle at 20% 10%,var(--accent-soft),transparent 45%),var(--bg); }
.lock-card { width:min(360px,100%); background:var(--surface); border:1px solid var(--line); border-radius:24px; padding:28px 22px; box-shadow:0 30px 80px rgba(0,0,0,.35); text-align:center; }
.lock-logo { width:56px; height:56px; border-radius:18px; margin:0 auto 14px; display:grid; place-items:center; background:linear-gradient(135deg,var(--accent),var(--accent-3)); color:#fff; }
.lock-card h1 { font-size:21px; margin:0 0 6px; }
.lock-card > p { font-size:12.5px; color:var(--muted); margin:0 0 20px; line-height:1.6; }
.pin-dots { display:flex; justify-content:center; gap:11px; margin-bottom:8px; }
.pin-dots span { width:11px; height:11px; border-radius:50%; border:1.5px solid var(--line-strong); transition:var(--speed); }
.pin-dots span.on { background:var(--accent-3); border-color:var(--accent-3); box-shadow:0 0 0 4px var(--accent-soft); transform:scale(1.06); }
.pin-error { min-height:18px; color:var(--danger); font-size:11px; margin-bottom:6px; }
.pin-pad { display:grid; grid-template-columns:repeat(3,1fr); gap:9px; margin-bottom:16px; }
.pin-key { height:52px; border-radius:14px; border:1px solid var(--line); background:var(--surface-2,var(--surface)); color:var(--text); font-size:19px; font-weight:650; cursor:pointer; transition:var(--speed); }
.pin-key:hover { border-color:var(--accent); color:var(--accent-3); }
.pin-key:active { transform:scale(.96); }
.pin-key.mute { color:var(--muted); }
.ai-inner { max-width:1180px; }
.ai-layout { display:grid; grid-template-columns:270px minmax(0,1fr); gap:16px; height:calc(100dvh - 190px); min-height:520px; }
.ai-side { padding:16px; overflow:auto; }
.ai-engine { display:flex; align-items:center; gap:10px; padding-bottom:14px; border-bottom:1px solid var(--line); margin-bottom:14px; }
.ai-orb { width:38px; height:38px; flex:none; border-radius:12px; display:grid; place-items:center; background:linear-gradient(135deg,var(--accent),var(--accent-3)); color:#fff; box-shadow:0 6px 22px var(--accent-soft); }
.ai-orb.big { width:62px; height:62px; border-radius:20px; margin:0 auto 14px; }
.engine-dot { width:9px; height:9px; border-radius:50%; background:var(--gold); box-shadow:0 0 0 4px rgba(251,191,36,.12); }
.engine-dot.online { background:var(--mint); box-shadow:0 0 0 4px var(--mint-soft); }
.ai-section-label { font-size:9.5px; font-weight:800; text-transform:uppercase; letter-spacing:.12em; color:var(--faint); margin:16px 0 8px; }
.model-row { display:flex; align-items:center; gap:9px; width:100%; text-align:left; padding:9px; border-radius:11px; border:1px solid transparent; background:transparent; color:var(--text); cursor:pointer; }
.model-row:hover { background:var(--surface); }
.model-row.active { border-color:var(--accent); background:var(--accent-soft); }
.model-row.active .icon { color:var(--accent-3); }
.ai-prompts { display:flex; flex-wrap:wrap; gap:6px; }
.ai-prompts .chip { font-size:10.5px; padding:5px 9px; }
.ai-chat { display:flex; flex-direction:column; overflow:hidden; padding:0; }
.ai-chat-head { display:flex; align-items:center; gap:10px; padding:12px 16px; border-bottom:1px solid var(--line); }
.ai-avatar { width:32px; height:32px; border-radius:10px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent-3); }
.ai-messages { flex:1; overflow:auto; padding:18px; display:flex; flex-direction:column; gap:14px; }
.ai-welcome { margin:auto; text-align:center; max-width:380px; color:var(--muted); }
.ai-welcome h2 { color:var(--text); font-size:18px; margin:0 0 6px; }
.ai-welcome p { font-size:12.5px; line-height:1.6; margin:0 0 14px; }
.ai-suggest { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; }
.ai-msg { display:flex; flex-direction:column; max-width:82%; }
.ai-msg.mine { align-self:flex-end; align-items:flex-end; }
.ai-msg.theirs { align-self:flex-start; align-items:flex-start; }
.ai-msg-head { font-size:9.5px; color:var(--faint); margin:0 6px 4px; display:flex; align-items:center; gap:4px; }
.ai-msg-head .icon { width:12px; height:12px; }
.ai-bubble { position:relative; padding:11px 13px; border-radius:15px; font-size:12.5px; line-height:1.65; background:var(--surface-2,var(--panel)); border:1px solid var(--line); white-space:pre-wrap; word-break:break-word; }
.ai-msg.mine .ai-bubble { background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:#fff; border-color:transparent; border-bottom-right-radius:5px; }
.ai-msg.theirs .ai-bubble { border-bottom-left-radius:5px; }
.ai-bubble.pending { min-width:54px; }
.ai-copy { position:absolute; right:6px; bottom:5px; border:0; background:transparent; color:var(--faint); cursor:pointer; opacity:0; transition:var(--speed); }
.ai-bubble:hover .ai-copy { opacity:1; }
.typing { display:inline-flex; gap:4px; align-items:center; height:14px; }
.typing i { width:5px; height:5px; border-radius:50%; background:var(--accent-3); animation:bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay:.15s; }
.typing i:nth-child(3) { animation-delay:.3s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-4px);opacity:1} }
.ai-composer { display:flex; align-items:flex-end; gap:9px; padding:12px 14px; border-top:1px solid var(--line); }
.ai-composer .textarea { flex:1; min-height:40px; max-height:130px; padding:10px 12px; }
.ai-composer .send-btn.ready { background:linear-gradient(135deg,var(--accent),var(--accent-3)); color:#fff; }
@media (max-width:900px) {
  .ai-layout { grid-template-columns:1fr; height:auto; }
  .ai-side { order:2; }
  .ai-chat { min-height:560px; }
}

/* QR device linking -------------------------------------------------- */
.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 0 10px;
}
.qr-frame {
  width: 216px;
  height: 216px;
  padding: 12px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28), 0 0 0 1px var(--border);
  display: grid;
  place-items: center;
}
.qr-frame svg { display: block; }
.qr-frame .qr-error { color: #991b1b; font-size: 13px; text-align: center; }
.qr-expiry {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .2px;
}
.qr-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .14);
  animation: qrPulse 1.6s ease-in-out infinite;
}
@keyframes qrPulse { 50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } }
.qr-status {
  font-size: 13px;
  color: var(--text);
  min-height: 20px;
  text-align: center;
}
.qr-status.approved { color: #22c55e; font-weight: 700; }
