/* AeroBaat — family tokens (docs/design-family-2026.md) with AeroBaat's own accent: a deep violet with a sky
   second colour. Own look: violet-tinted sent bubbles, a quiet dotted canvas, round avatars with gradient initials.
   No inline styles anywhere (strict CSP): dynamic values go through custom properties set by the CSSOM. */
:root {
  --ag-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", "Noto Sans", sans-serif;
  --ag-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ag-radius-sm: 8px; --ag-radius: 12px; --ag-radius-lg: 16px; --ag-radius-xl: 24px;
  --ag-ease: cubic-bezier(.2, .8, .2, 1);
  --ag-accent: #5b4df5; --ag-accent-2: #0e9be0; --ag-accent-contrast: #fff;
  --ag-bg: #f5f6fb; --ag-surface: #fff; --ag-raised: #fff; --ag-line: rgba(15, 23, 42, .08); --ag-line-2: rgba(15, 23, 42, .16);
  --ag-text: #0f172a; --ag-muted: #586174; --ag-ok: #15803d; --ag-warn: #b45309; --ag-err: #c81e1e; --ag-info: #2563eb;
  --ag-shadow-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --ag-shadow-2: 0 10px 30px -8px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .06);
  --accent-soft: rgba(91, 77, 245, .10); --accent-ink: #4a3de0;
  --mine: #ebe8ff; --mine-ink: #17123f; --theirs: #fff; --theirs-ink: #0f172a;
  --canvas: #eef0f8; --dot: rgba(91, 77, 245, .10);
  --font-scale: 1;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ag-accent: #7266ff; --ag-accent-2: #38b6f5;
  --ag-bg: #0b0d16; --ag-surface: #12152a; --ag-raised: #191d36; --ag-line: rgba(255, 255, 255, .08); --ag-line-2: rgba(255, 255, 255, .18);
  --ag-text: #e9ebf5; --ag-muted: #9aa1bb; --ag-ok: #4ade80; --ag-warn: #fbbf24; --ag-err: #f87171; --ag-info: #60a5fa;
  --ag-shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --ag-shadow-2: 0 14px 36px -8px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --accent-soft: rgba(114, 102, 255, .16); --accent-ink: #b3acff;
  --mine: #352d8f; --mine-ink: #f4f2ff; --theirs: #1a1e38; --theirs-ink: #e9ebf5;
  --canvas: #0d1020; --dot: rgba(140, 130, 255, .09);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ag-bg); color: var(--ag-text); font: 400 calc(15px * var(--font-scale)) / 1.45 var(--ag-font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow: hidden; overscroll-behavior: none;
}
:lang(hi) body, body:lang(hi) { line-height: 1.55; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
.i { stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ag-accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ag-muted); }
.small { font-size: .86em; }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--ag-line-2); background: var(--ag-surface); color: var(--ag-text); font-weight: 600; cursor: pointer;
  transition: transform .12s var(--ag-ease), background .16s, box-shadow .16s; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ag-accent); border-color: transparent; color: var(--ag-accent-contrast); box-shadow: 0 6px 16px -6px rgba(91, 77, 245, .55); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--ag-err); }
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 1.04em; border-radius: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent;
  color: var(--ag-muted); cursor: pointer; flex: none; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--ag-text); }
.icon-btn.on { color: var(--ag-accent); }
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field > span { font-size: .86em; font-weight: 600; color: var(--ag-muted); }
.input, textarea.input, select.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--ag-line-2); background: var(--ag-surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--ag-accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--ag-line); border-radius: 14px; margin: 10px 0; cursor: pointer; background: var(--ag-surface); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ag-accent); flex: none; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--ag-line-2); position: relative; cursor: pointer; flex: none; transition: background .18s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--ag-shadow-1); transition: transform .18s var(--ag-ease); }
.switch:checked { background: var(--ag-accent); }
.switch:checked::after { transform: translateX(18px); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; scrollbar-width: none; }
.chip { border: 1px solid var(--ag-line-2); background: var(--ag-surface); border-radius: 99px; padding: 6px 14px; font-size: .9em; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--ag-muted); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* ---------- avatars ---------- */
.av {
  --h: 250; width: var(--av, 44px); height: var(--av, 44px); border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--h) 72% 62%), hsl(calc(var(--h) + 40) 75% 52%)); color: #fff; font-weight: 700;
  font-size: calc(var(--av, 44px) * .38); letter-spacing: .02em; user-select: none;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.note { background: linear-gradient(135deg, #5b4df5, #0e9be0); }

/* ---------- app shell ---------- */
#app { height: 100dvh; display: flex; flex-direction: column; }
.boot { flex: 1; display: grid; place-items: center; align-content: center; gap: 14px; color: var(--ag-muted); }
.shell { flex: 1; display: grid; grid-template-columns: 1fr; min-height: 0; position: relative; }
.pane-list, .pane-chat, .pane-side { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--ag-surface); position: relative; }
.pane-chat { background: var(--canvas); }
.shell.in-chat .pane-list { display: none; }
.shell:not(.in-chat) .pane-chat { display: none; }
.pane-side { display: none; }
.rail { display: none; }
.topbar {
  display: flex; align-items: center; gap: 6px; min-height: 58px; padding: 6px 8px 6px 16px; padding-top: max(6px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--ag-surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--ag-line); position: relative; z-index: 2;
}
.topbar h1 { margin: 0; font-size: 1.32em; font-weight: 750; letter-spacing: -.01em; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar h1 .logo { flex: none; }
.list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.searchbox { margin: 10px 16px 8px; position: relative; }
.searchbox .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ag-muted); }
.searchbox input { padding-left: 40px; background: var(--ag-bg); border-color: transparent; border-radius: 99px; min-height: 42px; }
.bottomnav {
  position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); z-index: 3;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--ag-surface) 92%, transparent);
  backdrop-filter: blur(14px); border-top: 1px solid var(--ag-line);
}
.shell.in-chat .bottomnav { display: none; }
.navbtn { display: grid; justify-items: center; gap: 3px; padding: 6px 0 4px; border: 0; background: none; cursor: pointer; color: var(--ag-muted); font-size: .74em; font-weight: 600; border-radius: 14px; position: relative; }
.navbtn .pill { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 99px; transition: background .2s; }
.navbtn[aria-current="page"] { color: var(--ag-text); }
.navbtn[aria-current="page"] .pill { background: var(--accent-soft); color: var(--accent-ink); }
.navbtn .dot { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--ag-accent); color: #fff; font-size: 11px; display: grid; place-items: center; }
.fab {
  position: absolute; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; border: 0; z-index: 3;
  background: linear-gradient(135deg, var(--ag-accent), color-mix(in srgb, var(--ag-accent) 60%, var(--ag-accent-2))); color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 26px -8px rgba(91, 77, 245, .7); cursor: pointer;
}
.fab:active { transform: scale(.96); }
.banner { margin: 8px 16px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: .9em; display: flex; gap: 10px; align-items: center; }
.banner.warn { background: color-mix(in srgb, var(--ag-warn) 14%, transparent); color: var(--ag-warn); }
.banner.err { background: color-mix(in srgb, var(--ag-err) 12%, transparent); color: var(--ag-err); }
.banner .btn { margin-left: auto; min-height: 34px; }

/* ---------- chat list ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; position: relative; border: 0; background: none; width: 100%; text-align: left; min-height: 72px; }
.row:hover { background: color-mix(in srgb, var(--ag-accent) 5%, transparent); }
.row[aria-current="true"] { background: var(--accent-soft); }
.row .mid { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.row .mid > * { min-width: 0; }
.row .top { display: flex; align-items: baseline; gap: 8px; }
.row .nm { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .tm { font-size: .78em; color: var(--ag-muted); flex: none; }
.row .tm.new { color: var(--ag-accent); font-weight: 700; }
.row .sub { display: flex; align-items: center; gap: 6px; color: var(--ag-muted); font-size: .92em; }
.row .pv { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .pv .i { vertical-align: -4px; }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--ag-accent); color: #fff; font-size: .78em; font-weight: 700; display: inline-grid; place-items: center; }
.badge.muted { background: var(--ag-line-2); color: var(--ag-muted); }
.empty { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 48px 28px; color: var(--ag-muted); }
.empty svg.art { width: 140px; height: 110px; }
.section-h { padding: 18px 16px 6px; font-size: .78em; font-weight: 700; color: var(--ag-muted); text-transform: uppercase; letter-spacing: .07em; }
.section-h:lang(hi) { text-transform: none; letter-spacing: 0; font-size: .86em; }

/* ---------- chat ---------- */
.chat-head { padding-left: 4px; }
.chat-head .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 12px; text-align: left; }
.chat-head .who .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who .st { font-size: .8em; color: var(--ag-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who .st.typing { color: var(--ag-accent); }
.canvas { flex: 1; position: relative; min-height: 0; background-color: var(--canvas); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px); background-size: 18px 18px; }
.canvas.wp-plain { background-image: none; }
.canvas.wp-sky { background-image: linear-gradient(180deg, color-mix(in srgb, var(--ag-accent-2) 10%, var(--canvas)), var(--canvas)); }
.canvas.wp-dusk { background-image: linear-gradient(160deg, color-mix(in srgb, var(--ag-accent) 16%, var(--canvas)), var(--canvas) 60%); }
.vlist { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; contain: strict; }
.vlist .spacer { position: relative; width: 100%; }
.vrow { position: absolute; left: 0; right: 0; padding: 1px 12px; }
.daysep { display: flex; justify-content: center; padding: 10px 0 6px; }
.daysep span { background: color-mix(in srgb, var(--ag-surface) 90%, transparent); padding: 4px 12px; border-radius: 99px; font-size: .78em; font-weight: 600; color: var(--ag-muted); box-shadow: var(--ag-shadow-1); }
.sysline { display: flex; justify-content: center; padding: 6px 24px; }
.sysline span { font-size: .82em; color: var(--ag-muted); background: color-mix(in srgb, var(--ag-surface) 85%, transparent); padding: 5px 12px; border-radius: 10px; text-align: center; max-width: 520px; }
.sysline.e2e span { color: var(--ag-warn); background: color-mix(in srgb, var(--ag-warn) 10%, var(--ag-surface)); display: inline-flex; gap: 6px; align-items: center; }
.msg { display: flex; padding: 1px 0; touch-action: pan-y; }
.msg.mine { justify-content: flex-end; }
.bubble {
  position: relative; max-width: min(76%, 560px); padding: 7px 10px 6px 12px; border-radius: 18px; background: var(--theirs); color: var(--theirs-ink);
  box-shadow: var(--ag-shadow-1); overflow-wrap: anywhere; transition: transform .18s var(--ag-ease);
}
.msg.mine .bubble { background: var(--mine); color: var(--mine-ink); }
.msg.first:not(.mine) .bubble { border-top-left-radius: 6px; }
.msg.first.mine .bubble { border-top-right-radius: 6px; }
.msg.hl .bubble { box-shadow: 0 0 0 2px var(--ag-accent); }
.bubble .author { font-size: .8em; font-weight: 700; color: hsl(var(--h, 250) 65% 52%); margin-bottom: 1px; }
:root[data-theme="dark"] .bubble .author { color: hsl(var(--h, 250) 80% 72%); }
.bubble .txt { white-space: pre-wrap; }
.bubble .txt a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble .txt.big { font-size: 2.2em; line-height: 1.2; }
.bubble .meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -2px 10px; font-size: .7em; color: color-mix(in srgb, currentColor 58%, transparent); white-space: nowrap; }
.bubble .meta .i { width: 15px; height: 15px; }
.bubble .meta .i.read { color: var(--ag-accent-2); }
:root[data-theme="dark"] .bubble .meta .i.read { color: #7dd3fc; }
.bubble .fwd { font-size: .78em; font-style: italic; color: color-mix(in srgb, currentColor 60%, transparent); display: flex; gap: 4px; align-items: center; }
.bubble .quote { display: block; border-left: 3px solid var(--ag-accent); background: color-mix(in srgb, currentColor 6%, transparent); border-radius: 8px; padding: 4px 8px; margin: 2px 0 4px; font-size: .88em; cursor: pointer; }
.bubble .quote b { display: block; font-size: .92em; color: var(--accent-ink); }
.bubble .quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .8; }
.bubble.deleted .txt { font-style: italic; opacity: .65; }
.reacts { position: absolute; bottom: -12px; display: inline-flex; gap: 2px; padding: 1px 6px; border-radius: 99px; background: var(--ag-surface); box-shadow: var(--ag-shadow-1); border: 1px solid var(--ag-line); font-size: .82em; cursor: pointer; }
.msg:not(.mine) .reacts { left: 10px; } .msg.mine .reacts { right: 10px; }
.msg.has-reacts { padding-bottom: 14px; }
.swipe-hint { position: absolute; left: -36px; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0; color: var(--ag-accent); }
.media-box { margin: -3px -6px 4px -8px; border-radius: 14px; overflow: hidden; background: color-mix(in srgb, currentColor 8%, transparent); position: relative; min-width: 200px; }
.media-box img, .media-box video { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.media-box .dl { position: absolute; inset: 0; display: grid; place-items: center; }
.filecard { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: color-mix(in srgb, currentColor 6%, transparent); margin-bottom: 4px; min-width: 220px; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 2px 0; }
.voice .wave { flex: 1; height: 30px; display: flex; align-items: center; gap: 2px; }
.voice .wave i { flex: 1; background: currentColor; opacity: .35; border-radius: 2px; min-height: 3px; height: var(--hgt, 30%); }
.voice .wave i.on { opacity: 1; color: var(--ag-accent); }
.voice .spd { font-size: .75em; font-weight: 700; border: 0; border-radius: 99px; padding: 2px 8px; background: color-mix(in srgb, currentColor 12%, transparent); cursor: pointer; }
.pollbox { min-width: 240px; }
.pollbox h4 { margin: 2px 0 8px; }
.pollopt { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 6px 0; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.pollopt .bar { grid-column: 2 / 4; height: 4px; border-radius: 4px; background: color-mix(in srgb, currentColor 12%, transparent); overflow: hidden; }
.pollopt .bar i { display: block; height: 100%; width: var(--pct, 0%); background: var(--ag-accent); }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: transparent; position: relative; z-index: 2; }
.composer .box { flex: 1; display: flex; align-items: flex-end; gap: 2px; background: var(--ag-surface); border-radius: 24px; padding: 3px 4px; box-shadow: var(--ag-shadow-1); border: 1px solid var(--ag-line); min-width: 0; }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; padding: 10px 4px; max-height: 140px; min-height: 22px; line-height: 1.4; min-width: 0; }
.composer .sendbtn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ag-accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 8px 18px -8px rgba(91, 77, 245, .8); }
.composer .sendbtn.rec { background: var(--ag-err); transform: scale(1.12); }
.ctx-bar { display: flex; align-items: center; gap: 10px; margin: 0 8px; padding: 8px 10px; background: var(--ag-surface); border-radius: 14px 14px 0 0; border-left: 3px solid var(--ag-accent); font-size: .88em; }
.ctx-bar .mid { flex: 1; min-width: 0; }
.ctx-bar .mid b { color: var(--accent-ink); display: block; font-size: .92em; }
.ctx-bar .mid span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ag-muted); }
.recbar { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 48px; background: var(--ag-surface); border-radius: 24px; color: var(--ag-err); font-weight: 600; }
.recbar .dotlive { width: 10px; height: 10px; border-radius: 50%; background: var(--ag-err); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.jump { position: absolute; right: 14px; bottom: 12px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ag-surface); box-shadow: var(--ag-shadow-2); color: var(--ag-muted); display: grid; place-items: center; cursor: pointer; z-index: 2; }
.emoji-pop { position: absolute; bottom: 64px; left: 8px; right: 8px; max-width: 380px; max-height: 300px; overflow: auto; background: var(--ag-raised); border-radius: 18px; box-shadow: var(--ag-shadow-2); border: 1px solid var(--ag-line); padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; z-index: 5; }
.emoji-pop button { font-size: 24px; border: 0; background: none; border-radius: 10px; height: 42px; cursor: pointer; }
.emoji-pop button:hover { background: var(--accent-soft); }
.react-bar { display: flex; gap: 4px; padding: 6px 8px; background: var(--ag-raised); border-radius: 99px; box-shadow: var(--ag-shadow-2); border: 1px solid var(--ag-line); }
.react-bar button { font-size: 24px; width: 42px; height: 42px; border: 0; background: none; border-radius: 50%; cursor: pointer; transition: transform .12s; }
.react-bar button:hover { transform: scale(1.18); background: var(--accent-soft); }

/* ---------- menus, dialogs, sheets, toasts ---------- */
.pop-menu-back { position: fixed; inset: 0; z-index: 60; }
.pop-menu { position: fixed; min-width: 210px; max-width: calc(100vw - 16px); background: var(--ag-raised); border: 1px solid var(--ag-line); border-radius: 14px; box-shadow: var(--ag-shadow-2); padding: 6px; animation: pop .14s var(--ag-ease); }
.pop-menu hr { border: 0; border-top: 1px solid var(--ag-line); margin: 4px 0; }
.pop-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: left; min-height: 44px; }
.pop-item:hover, .pop-item:focus-visible { background: var(--accent-soft); }
.pop-item.danger { color: var(--ag-err); }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.dlg-back { position: fixed; inset: 0; background: rgba(8, 10, 24, .45); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dlg { width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--ag-raised); border-radius: 22px; box-shadow: var(--ag-shadow-2); border: 1px solid var(--ag-line); animation: pop .18s var(--ag-ease); }
.dlg.wide { width: min(720px, 100%); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 10px 6px 20px; }
.dlg-head h2 { flex: 1; margin: 0; font-size: 1.12em; }
.dlg-ic { color: var(--ag-accent); display: grid; }
.dlg-body { padding: 6px 20px 16px; overflow-y: auto; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 16px; flex-wrap: wrap; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); display: grid; gap: 8px; z-index: 80; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: #1b1f36; color: #fff; padding: 11px 16px; border-radius: 14px; box-shadow: var(--ag-shadow-2); font-size: .92em; animation: pop .18s var(--ag-ease); }
.toast.err { background: #8f1d1d; }
.toast.out { opacity: 0; transition: opacity .3s; }

/* ---------- pages: landing, setup, settings ---------- */
.page { flex: 1; overflow-y: auto; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.landing { background: radial-gradient(900px 520px at 85% -10%, rgba(91, 77, 245, .16), transparent 60%), radial-gradient(700px 460px at -10% 10%, rgba(14, 155, 224, .12), transparent 60%), var(--ag-bg); }
.lnav { display: flex; align-items: center; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 0 14px; }
.lnav .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2em; flex: 1; }
.hero { display: grid; grid-template-columns: 1fr; gap: 36px; padding: 28px 0 40px; align-items: center; }
.hero h1 { font-size: clamp(2.1em, 6vw, 3.4em); line-height: 1.08; letter-spacing: -.025em; margin: 14px 0 14px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--ag-accent), var(--ag-accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12em; color: var(--ag-muted); max-width: 560px; margin: 0 0 24px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mock { position: relative; justify-self: center; width: min(340px, 86vw); aspect-ratio: 9 / 15; border-radius: 38px; padding: 12px; background: linear-gradient(160deg, #1d2140, #0c0f22); box-shadow: 0 40px 80px -30px rgba(40, 30, 140, .55); }
.mock .scr { height: 100%; border-radius: 28px; overflow: hidden; background: var(--canvas); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px); background-size: 18px 18px; display: flex; flex-direction: column; }
.mock .mh { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; background: var(--ag-surface); font-weight: 700; }
.mock .mb { flex: 1; display: grid; align-content: start; gap: 8px; padding: 16px 12px; }
.mock .mb .bubble { max-width: 82%; font-size: .9em; }
.mock .mb .mine-row { display: flex; justify-content: flex-end; }
.mock .mb .mine-row .bubble { background: var(--mine); color: var(--mine-ink); }
.features { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 10px 0 34px; }
.feat { background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 18px; padding: 18px; box-shadow: var(--ag-shadow-1); }
.feat .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 10px; }
.feat h3 { margin: 0 0 6px; font-size: 1.04em; }
.feat p { margin: 0; color: var(--ag-muted); font-size: .94em; }
.lfoot { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: center; justify-content: center; padding: 24px 0 calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ag-line); color: var(--ag-muted); font-size: .9em; }
.lfoot a { color: var(--ag-muted); }
.card { background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 22px; padding: 22px; box-shadow: var(--ag-shadow-1); }
.setup { max-width: 480px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 18px 40px; }
.setup h2 { margin: 18px 0 6px; font-size: 1.5em; letter-spacing: -.01em; }
.setup .notice { font-size: .92em; color: var(--ag-muted); background: var(--ag-bg); border-radius: 14px; padding: 12px 14px; }
.qrbox { display: grid; justify-items: center; gap: 12px; padding: 18px; background: #fff; border-radius: 22px; margin: 16px auto; width: fit-content; }
.qrbox svg { width: 240px; height: 240px; display: block; }
.code { font-family: var(--ag-font-mono); font-size: .86em; word-break: break-all; background: var(--ag-bg); padding: 10px 12px; border-radius: 10px; user-select: all; }
.safety { display: grid; grid-template-columns: repeat(4, auto); gap: 10px 18px; justify-content: center; font-family: var(--ag-font-mono); font-size: 1.12em; letter-spacing: .05em; padding: 14px; }
.list-group { background: var(--ag-surface); border-radius: 18px; margin: 0 12px 14px; border: 1px solid var(--ag-line); overflow: hidden; }
.item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; min-height: 56px; width: 100%; border: 0; background: none; text-align: left; cursor: pointer; border-bottom: 1px solid var(--ag-line); }
.item:last-child { border-bottom: 0; }
.item:hover { background: color-mix(in srgb, var(--ag-accent) 4%, transparent); }
.item .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.item .mid { flex: 1; min-width: 0; }
.item .mid b { display: block; font-weight: 600; }
.item .mid small { display: block; color: var(--ag-muted); font-size: .86em; }
.item.danger { color: var(--ag-err); }
.item.danger .ic { background: color-mix(in srgb, var(--ag-err) 12%, transparent); color: var(--ag-err); }
.profile-head { display: grid; justify-items: center; gap: 6px; padding: 22px 16px 16px; text-align: center; }
.profile-head h2 { margin: 6px 0 0; font-size: 1.4em; }
.profile-head .actions { display: flex; gap: 10px; margin-top: 10px; }
.profile-head .actions .btn { flex-direction: column; gap: 4px; min-height: 64px; min-width: 84px; font-size: .84em; border-radius: 16px; }
.subpage { position: absolute; inset: 0; background: var(--ag-bg); z-index: 20; display: flex; flex-direction: column; animation: slidein .22s var(--ag-ease); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.subpage .body { flex: 1; overflow-y: auto; padding: 10px 0 calc(30px + env(safe-area-inset-bottom)); }
.callscreen { position: fixed; inset: 0; z-index: 90; background: radial-gradient(800px 600px at 50% 0%, #2c2470, #0b0d1e); color: #fff; display: flex; flex-direction: column; align-items: center; }
.callscreen video.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.callscreen video.local { position: absolute; right: 16px; top: calc(16px + env(safe-area-inset-top)); width: 110px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; box-shadow: var(--ag-shadow-2); z-index: 2; }
.callscreen .who { margin-top: 18vh; display: grid; justify-items: center; gap: 10px; z-index: 1; text-align: center; }
.callscreen .who h2 { margin: 6px 0 0; font-size: 1.6em; }
.callscreen .ctl { position: absolute; bottom: calc(34px + env(safe-area-inset-bottom)); display: flex; gap: 18px; z-index: 2; }
.callscreen .ctl button { width: 62px; height: 62px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(8px); }
.callscreen .ctl button.on { background: #fff; color: #111; }
.callscreen .ctl button.end { background: #e5484d; }
.callscreen .ctl button.ok { background: #22a55b; }
.status-ring { padding: 3px; border-radius: 50%; background: conic-gradient(var(--ag-accent), var(--ag-accent-2), var(--ag-accent)); }
.status-ring.seen { background: var(--ag-line-2); }
.status-ring .av { border: 2px solid var(--ag-surface); }
.storyview { position: fixed; inset: 0; z-index: 85; background: #000; color: #fff; display: flex; flex-direction: column; }
.storyview .bars { display: flex; gap: 4px; padding: calc(10px + env(safe-area-inset-top)) 10px 8px; }
.storyview .bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.storyview .bars i b { display: block; height: 100%; width: var(--p, 0%); background: #fff; }
.storyview .content { flex: 1; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 1.6em; font-weight: 650; background: var(--bg, #1d4ed8); }
.storyview .content img, .storyview .content video { max-width: 100%; max-height: 80vh; }
.skel { background: linear-gradient(90deg, var(--ag-line) 25%, var(--ag-line-2) 50%, var(--ag-line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- bigger screens ---------- */
@media (min-width: 900px) {
  .shell { grid-template-columns: 72px minmax(320px, 400px) 1fr; }
  .shell.side-open { grid-template-columns: 72px minmax(320px, 380px) 1fr 360px; }
  .shell.in-chat .pane-list, .shell:not(.in-chat) .pane-chat { display: flex; }
  .pane-list { border-right: 1px solid var(--ag-line); }
  .shell.side-open .pane-side { display: flex; border-left: 1px solid var(--ag-line); }
  .rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; background: var(--ag-bg); border-right: 1px solid var(--ag-line); }
  .rail .navbtn { width: 60px; }
  .rail .grow { flex: 1; }
  .bottomnav { display: none; }
  .fab { bottom: 22px; right: 22px; }
  .list-scroll { padding-bottom: 20px; }
  .chat-head .back { display: none; }
  .bubble { max-width: min(64%, 620px); }
  .hero { grid-template-columns: 1.15fr .85fr; padding-top: 48px; }
  .features { grid-template-columns: repeat(3, 1fr); }
  .placeholder { flex: 1; display: grid; place-items: center; text-align: center; color: var(--ag-muted); padding: 30px; }
  .subpage.in-list { position: absolute; }
  .dlg-back { padding: 32px; }
}
@media (max-width: 899px) {
  .placeholder { display: none; }
  .dlg-back { place-items: end stretch; padding: 0; }
  .dlg { width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); animation: up .22s var(--ag-ease); }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* install control (js/app/install.js) */
.ibtn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: var(--ag-muted); cursor: pointer; }
.ibtn:hover { background: var(--accent-soft); color: var(--ag-text); }
.inst-wrap { display: contents; }
.inst-big { gap: 12px; text-align: left; max-width: 100%; white-space: normal; }
.inst-big .inst-txt { display: grid; line-height: 1.2; }
.inst-big .inst-txt small { font-weight: 500; color: var(--ag-muted); font-size: .8em; }
.inst-done { display: flex; gap: 10px; align-items: center; }
.inst-ok { color: var(--ag-ok); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.inst-steps { padding-left: 20px; line-height: 1.7; }
.inst-note { color: var(--ag-muted); font-size: .9em; }
.inst-copy-field { position: fixed; opacity: 0; }
.hero .cta > * { max-width: 100%; }
video.scanner { width: 100%; border-radius: 16px; background: #000; margin: 8px 0; }
.scam { text-decoration-color: var(--ag-err) !important; }
.scam-tag { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 0 4px; font-size: .78em; font-weight: 700; color: var(--ag-err); }
.media-box img.blur { filter: blur(8px); transform: scale(1.05); }
.once-img { max-width: 100%; display: block; margin: 0 auto; }
.legal h3 { margin: 16px 0 4px; font-size: 1em; }
.legal p { margin: 6px 0; color: var(--ag-text); }
.storyview .topbar { background: transparent; border: 0; color: #fff; gap: 10px; }
.storyview .topbar .grow { flex: 1; }
.storyview .topbar .icon-btn { color: #fff; }
.rail-logo { padding-bottom: 6px; }

/* group calls */
.callscreen.group { align-items: stretch; }
.gc-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; }
.tiles { flex: 1; display: grid; gap: 8px; padding: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-content: center; margin-bottom: 120px; }
.tile { position: relative; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; background: hsl(var(--h, 250) 40% 22%); display: grid; place-items: center; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .tname { position: absolute; left: 10px; bottom: 8px; font-size: .85em; font-weight: 600; background: rgba(0, 0, 0, .45); padding: 2px 8px; border-radius: 8px; z-index: 1; }
.bubble.sticker { background: transparent !important; box-shadow: none; padding: 0; }
.bubble.sticker .meta { float: none; display: inline-flex; background: color-mix(in srgb, var(--ag-surface) 80%, transparent); padding: 2px 8px; border-radius: 99px; color: var(--ag-muted); }
img.stk { display: block; width: 140px; height: 140px; }
.lpreview { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 2px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, currentColor 7%, transparent); color: inherit; text-decoration: none; }
.lpreview span { display: grid; min-width: 0; }
.lpreview small { opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; grid-column: 1 / -1; }
.stk-grid button { border: 0; background: none; border-radius: 12px; padding: 4px; cursor: pointer; height: auto !important; }
.stk-grid button:hover { background: var(--accent-soft); }
.stk-grid img { width: 100%; height: auto; display: block; }
.emoji-tabs { grid-column: 1 / -1; display: flex; gap: 6px; padding-bottom: 6px; }
.smart { display: flex; gap: 6px; padding: 0 10px 6px; overflow-x: auto; scrollbar-width: none; }
.smart button { border: 1px solid var(--ag-line-2); background: var(--ag-surface); border-radius: 99px; padding: 6px 12px; font-size: .88em; cursor: pointer; white-space: nowrap; }
.community-list { margin: 8px 12px; }
