/* ============================================================
   GLULINE · Liquid Glass — Desktop Web
   Teal theme (accent hue 195), light + dark
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
#root { height: 100%; }
body {
  font-family: -apple-system, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow: hidden; color: var(--txt);
}
::-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; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* ============ THEME TOKENS ============ */
.app {
  --accent: oklch(0.64 0.12 195);
  --accent-2: oklch(0.57 0.13 215);
  --accent-3: oklch(0.68 0.11 188);
  --accent-soft: oklch(0.64 0.12 195 / 0.14);
  --accent-soft-2: oklch(0.64 0.12 195 / 0.22);
  --accent-txt: oklch(0.5 0.13 205);
  --txt: oklch(0.24 0.025 220);
  --txt-2: oklch(0.46 0.025 220);
  --txt-3: oklch(0.6 0.02 220);
  --green: oklch(0.62 0.13 150);
  --red: oklch(0.6 0.18 22);
  /* swipe-action hues (Telegram-style): read=blue, mute=orange, archive=gray */
  --blue: oklch(0.58 0.16 250);
  --orange: oklch(0.7 0.16 60);
  --gray: oklch(0.58 0.02 250);
  --scroll: oklch(0.7 0.02 220 / 0.5);

  /* glass */
  --g-bg: rgba(255,255,255,0.62);
  --g-bg-2: rgba(255,255,255,0.72);
  --g-bg-strong: rgba(255,255,255,0.82);
  --pop-bg: rgba(249,252,253,0.98);
  --g-border: rgba(255,255,255,0.7);
  --g-border-2: rgba(255,255,255,0.5);
  --g-hi: rgba(255,255,255,0.85);
  /* Liquid-glass specular edge: a crisp top-left rim hairline + a soft inner
     glass-wall glow (iOS-26 look). Bright in light, restrained in dark. */
  --lg-rim: rgba(255,255,255,0.92);
  --lg-glow: rgba(255,255,255,0.5);
  --lg-lift: brightness(1.03);
  /* Liquid-glass LAB tunables (live-editable via the ⚙ Glass panel, persisted to
     glu-glass-lab). Defaults reproduce the current look. tint-rgb is per-theme;
     sat/rim-a are shared. --lg-frost + the SVG #lg-refract scale/freq round it out. */
  --lg-tint-rgb: 255,255,255; --lg-tint-a: 0.62;
  --lg-sat: 1.4; --lg-rim-a: 0.28;
  --g-shadow: 0 12px 38px -10px rgba(30,55,75,0.22);
  --g-shadow-sm: 0 6px 18px -8px rgba(30,55,75,0.2);
  --hover: rgba(255,255,255,0.55);
  --press: rgba(120,160,180,0.16);
  --scrim: rgba(18,38,52,0.30);
  --scrim-strong: rgba(238,244,247,0.62);

  --recv: rgba(255,255,255,0.66);
  --recv-txt: oklch(0.28 0.03 220);
  /* Outgoing-bubble own palette (Telegram-style, separate from the wallpaper).
     Light theme: soft green like TG's #e3fee0 with dark text. */
  --sent-txt: #10331a;
  --bubble-grad: linear-gradient(160deg, #e4fbec, #cbf1d9);
  --field: rgba(255,255,255,0.66);
  --blur: blur(44px) saturate(160%);
  --blur-lite: blur(28px) saturate(150%);

  /* Chat-settings-controlled (M17): message text size + bubble corner radius.
     Defaults match the historical hardcoded .bubble values. Overridden live by
     ChatSettingsDetail via document-root inline vars (persisted to localStorage). */
  --chat-font-size: 14.5px;
  --bubble-radius: 18px;

  --wall:
    radial-gradient(46% 38% at 10% 2%, oklch(0.8 0.1 195 / 0.2), transparent 58%),
    radial-gradient(42% 36% at 94% 8%, oklch(0.82 0.09 175 / 0.18), transparent 56%),
    radial-gradient(52% 48% at 80% 98%, oklch(0.74 0.12 230 / 0.36), transparent 60%),
    radial-gradient(48% 46% at 22% 94%, oklch(0.8 0.1 160 / 0.34), transparent 60%),
    linear-gradient(165deg, #eef5f6, #f4f8f8 50%, #eaf3f4);
  background: var(--wall);
}
.app[data-theme="dark"] {
  --accent: oklch(0.72 0.12 195);
  --accent-2: oklch(0.66 0.13 215);
  --accent-3: oklch(0.76 0.11 188);
  --accent-soft: oklch(0.72 0.12 195 / 0.2);
  --accent-soft-2: oklch(0.72 0.12 195 / 0.3);
  --accent-txt: oklch(0.82 0.12 198);
  /* Dark theme: TG-style violet outgoing bubble + white text (separate palette). */
  --sent-txt: #ffffff;
  --bubble-grad: linear-gradient(160deg, #8f7fee, #6f59d8);
  --txt: oklch(0.95 0.012 220);
  --txt-2: oklch(0.72 0.02 220);
  --txt-3: oklch(0.58 0.02 220);
  --green: oklch(0.74 0.13 150);
  --red: oklch(0.68 0.16 22);
  --blue: oklch(0.66 0.16 250);
  --orange: oklch(0.76 0.15 62);
  --gray: oklch(0.62 0.02 250);
  --scroll: oklch(0.5 0.02 220 / 0.5);

  --g-bg: rgba(30,40,52,0.6);
  --g-bg-2: rgba(38,49,64,0.7);
  --g-bg-strong: rgba(44,56,72,0.8);
  --pop-bg: rgba(38,48,62,0.99);
  /* only tint-RGB is per-theme; tint-a/frost/sat/rim-a live at :root so the ⚙ Lab
     can override them globally via an inline html style (theme blocks would shadow). */
  --lg-tint-rgb: 30,40,52;
  --g-border: rgba(255,255,255,0.14);
  --g-border-2: rgba(255,255,255,0.08);
  --g-hi: rgba(255,255,255,0.22);
  --lg-rim: rgba(255,255,255,0.4);
  --lg-glow: rgba(255,255,255,0.14);
  --lg-lift: brightness(1.06);
  --g-shadow: 0 16px 44px -12px rgba(0,0,0,0.55);
  --g-shadow-sm: 0 8px 22px -10px rgba(0,0,0,0.5);
  --hover: rgba(255,255,255,0.07);
  --press: rgba(255,255,255,0.12);
  --scrim: rgba(0,0,0,0.55);
  --scrim-strong: rgba(4,9,14,0.74);

  --recv: rgba(54,66,84,0.55);
  --recv-txt: oklch(0.93 0.015 220);
  --field: rgba(48,60,78,0.64);

  /* Darker, more monotone dark wallpaper (iOS 708a32db, a SECOND darken pass on
     top of 723b499): the 165deg base is dropped to near-black and the four
     corner radial glows are ~halved again, so the background reads markedly
     darker with far less teal/blue/green bloom. */
  --wall:
    radial-gradient(62% 58% at 4% -2%, rgba(0,122,127,0.11), transparent 62%),
    radial-gradient(56% 52% at 100% 3%, rgba(0,116,77,0.08), transparent 56%),
    radial-gradient(72% 68% at 90% 102%, rgba(0,94,167,0.10), transparent 72%),
    radial-gradient(66% 62% at 8% 100%, rgba(0,116,61,0.07), transparent 66%),
    linear-gradient(165deg, #03060A, #04070B 50%, #020407);
}

/* ============ GLASS MATERIAL (iOS-26 liquid glass) ============ */
/* Faithful port of the liquid-glass generator (liquid-glass.pro recipe). The
   "glass" identity is REFRACTION + a bright specular rim, NOT frost — the panel
   stays mostly clear and the content behind it visibly BENDS (like a real glass
   lens), which is what reads as glass. Three layers:
   (1) element background = a light tint;
   (2) ::before (z-index:0) = the specular EDGE — a bright white inner rim glow
       + a crisp top-left hairline + a soft inner glass-wall glow;
   (3) ::after (z-index:-1, behind the tint, contained by isolation:isolate) =
       the LIQUID layer: a light frost (backdrop blur) pushed through the SVG
       displacement filter #lg-refract so the backdrop refracts/bends.
   Two hard-won rules baked in here: keep the backdrop blur LOW (≤~6px) — a heavy
   blur on the same layer as filter:url() swamps the displacement and the glass
   goes flat; and the content behind the panel must be un-composited (messages
   share the scroller raster, photos drop their blur-up filter via .photo-ready)
   or backdrop-filter can't sample it and nothing refracts. Chromium-only refract;
   Safari/Firefox ignore filter:url() and fall back to the light frost. */
:root { --lg-frost: 5px; }
.glass, .glass-2 {
  position: relative; isolation: isolate;
  background: rgba(var(--lg-tint-rgb), var(--lg-tint-a));
  border: 0.5px solid var(--g-border);
  box-shadow: var(--g-shadow), inset 0 1px 0 0 var(--g-hi);
}
.glass-2 { background: rgba(var(--lg-tint-rgb), calc(var(--lg-tint-a) + 0.1)); box-shadow: inset 0 1px 0 0 var(--g-hi); }
/* Specular rim — bright white inner glow (generator) + hairline + wall glow.
   SURVIVES the many chrome surfaces that redeclare their own box-shadow. */
.glass::before, .glass-2::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  box-shadow: inset 0 0 16px -8px rgba(255,255,255,var(--lg-rim-a)), inset 1px 1px 0 -1px var(--lg-rim), inset 0 0 6px 0 var(--lg-glow);
}
/* The LIQUID layer: light frost + SVG displacement refraction (bends the
   backdrop). z-index:-1 keeps it behind the tint; isolation:isolate contains it. */
.glass::after, .glass-2::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  -webkit-backdrop-filter: blur(var(--lg-frost)) saturate(var(--lg-sat)); backdrop-filter: blur(var(--lg-frost)) saturate(var(--lg-sat));
  -webkit-filter: url("#lg-refract"); filter: url("#lg-refract");
}
/* Distortion is expensive; turn it OFF on glass that appears many-at-once in a
   scrolling list (keep just the light frost + edge there for smooth scrolling). */
.glu-card::after, .detail-card::after, .info-card::after, .attach-chip::after, .cal-event::after { filter: none; -webkit-filter: none; }

/* ============ GLASS LAB — live liquid-glass tuning panel ============ */
.glasslab-handle {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 900;
  width: 30px; height: 76px; border: none; cursor: pointer;
  border-radius: 12px 0 0 12px; color: #fff; font-size: 17px; line-height: 76px; text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: -3px 0 14px -4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  opacity: 0.72; transition: opacity .16s, width .16s; padding: 0;
}
.glasslab-handle:hover { opacity: 1; width: 34px; }
.glasslab {
  position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 901;
  width: 288px; max-height: 86vh; overflow-y: auto; padding: 16px 18px 18px;
  border-radius: 22px; background: var(--g-bg-strong);
  -webkit-backdrop-filter: blur(30px) saturate(1.5); backdrop-filter: blur(30px) saturate(1.5);
  border: 0.5px solid var(--g-border); color: var(--txt);
  box-shadow: 0 24px 60px -14px rgba(0,0,0,0.5), inset 0 0 14px -6px rgba(255,255,255,0.6), inset 2px 2px 0 -2px var(--lg-rim);
  animation: attachPop .22s cubic-bezier(.2,.8,.3,1.1) both;
}
.glasslab-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 4px; }
.glasslab-sub { font-size: 11.5px; color: var(--txt-3); margin-bottom: 14px; }
.glasslab-x { width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--hover); color: var(--txt-2); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.glasslab-x:hover { background: var(--press); color: var(--txt); }
.glasslab-row { display: block; margin-bottom: 13px; }
.glasslab-lbl { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 600; color: var(--txt-2); margin-bottom: 6px; }
.glasslab-lbl b { font-size: 12px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.glasslab-row input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--pct,50%), var(--hover) var(--pct,50%), var(--hover) 100%);
}
.glasslab-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; border: 0.5px solid var(--g-border); box-shadow: 0 2px 6px -1px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.9); cursor: pointer;
}
.glasslab-row input[type="range"]::-moz-range-thumb { width: 17px; height: 17px; border-radius: 50%; background: #fff; border: 0.5px solid var(--g-border); box-shadow: 0 2px 6px -1px rgba(0,0,0,0.35); cursor: pointer; }
.glasslab-reset { width: 100%; margin-top: 4px; padding: 9px; border: none; border-radius: 12px; background: var(--hover); color: var(--txt); font-size: 13px; font-weight: 650; cursor: pointer; font-family: inherit; transition: background .14s; }
.glasslab-reset:hover { background: var(--press); }

/* ============ APP LAYOUT ============ */
/* Telegram-style floating shell: wallpaper fills the window; sidebar + chat are
   rounded cards with a gap, over it. */
.app { display: flex; height: 100%; overflow: hidden; color: var(--txt); position: relative; isolation: isolate; gap: 8px; padding: 14px 8px 14px 14px; box-sizing: border-box; }
.sidebar {
  width: 372px; flex-shrink: 0; height: 100%;
  display: flex; flex-direction: column; position: relative; z-index: 3;
  background: var(--g-bg-2);
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur) var(--lg-lift);
  border: 0.5px solid var(--g-border-2);
  border-radius: 42px;
  box-shadow: var(--g-shadow), inset 2px 2px 0 -2px var(--lg-rim), inset 0 0 9px 0 var(--lg-glow);
  overflow: hidden;
}
/* Real translucent glass (was a near-opaque .90 slab); the 30px blur keeps the
   chat-list text legible over the wallpaper while the wallpaper glows through. */
.app[data-theme="dark"] .sidebar { background: rgba(20,24,30,0.82); }
.app[data-theme="light"] .sidebar { background: rgba(255,255,255,0.82); }
/* chat pane is transparent (shows the window wallpaper); no clip so chat popovers
   aren't cut off. z-index keeps its content above the wallpaper layers. */
.main { flex: 1; min-width: 0; height: 100%; position: relative; display: flex; flex-direction: column; }

/* dot pattern over wallpaper in thread */
/* legacy dot texture retired — the app-wide doodle wallpaper replaces it everywhere */
.dotted { background-image: none; }

/* ============ APP-WIDE DOODLE WALLPAPER ============ */
/* The wallpaper (animated gradient + doodle pattern) is the WHOLE-WINDOW
   background; the sidebar and chat float as rounded cards over it — it shows in
   the margins around them and through the transparent chat card.
   LIGHT: the green gradient fills the window; dark doodle ink (::before) over it.
   DARK: the gradient is MASKED by the doodles so it glows ONLY through them on
   the dark wall (the flat ::before is dropped). Layers: wp-canvas z0, ink z1,
   chat card z2, sidebar z3. */
.app.wp-on { --doodle-tile: 900px; --doodle-tint: #16323a; }
.app.wp-on::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: var(--doodle-tint);
  -webkit-mask: url("assets/gluline-doodles.svg?v=7") 0 0 / var(--doodle-tile) repeat;
          mask: url("assets/gluline-doodles.svg?v=7") 0 0 / var(--doodle-tile) repeat;
  opacity: 0.10;
}
.wp-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  pointer-events: none; image-rendering: auto; animation: none;
}
.app[data-theme="dark"].wp-on::before { display: none; }
.app[data-theme="dark"] .wp-canvas {
  -webkit-mask: url("assets/gluline-doodles.svg?v=7") 0 0 / var(--doodle-tile) repeat;
          mask: url("assets/gluline-doodles.svg?v=7") 0 0 / var(--doodle-tile) repeat;
  opacity: var(--wp-glow, 0.12);
}
.app.wp-on > .sidebar { z-index: 3; }
.app.wp-on > .main { z-index: 2; }
/* the chat thread no longer paints its own dotted texture */
.main-chat .thread-scroll.dotted { background-image: none; }

/* dot pattern (used by other scroll panes, not the chat thread) */

/* ============ SIDEBAR HEADER ============ */
.sb-head { padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; position: relative; z-index: 2; box-shadow: 0 7px 12px -9px rgba(0,0,0,0.28); }
.sb-acct { display: flex; align-items: center; gap: 11px; }
/* Avatar + name are a single tap target that opens the Profile tab. */
.sb-acct-id { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; cursor: pointer; border-radius: 12px; transition: opacity .15s; }
.sb-acct-id:active { opacity: .6; }
.sb-acct .name { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--txt-2); transition: background .15s, color .15s; flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--txt); }
.icon-btn.accent { color: var(--accent); }
.search { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 42px; border-radius: 999px; position: relative; }
/* Search is a plain flat field — deliberately NOT liquid glass (no refraction,
   no frost, no specular rim), so it reads as an input, not a floating panel. */
.search.glass { background: var(--field); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: transparent; box-shadow: inset 0 0 0 0.5px var(--g-border-2); }
.search.glass::before, .search.glass::after { display: none; }
.app[data-theme="light"] .search.glass { background: #f1f3f5; box-shadow: none; }
.search input { flex: 1; background: none; border: none; outline: none; font-size: 15px; color: var(--txt); }
.search input::placeholder { color: var(--txt-3); }
/* Animated placeholder (morphs Search chats ⇄ Search settings). Sits where the
   input text starts (icon 18 + gap 10 + pad 16 = 44px); typing hides it (only
   rendered when the field is empty). */
.search-ph { position: absolute; left: 44px; top: 0; height: 100%; display: flex; align-items: center; font-size: 15px; color: var(--txt-3); pointer-events: none; white-space: nowrap; }

/* ============ MODE CROSS-FADE (chats ⇄ settings) ============ */
/* Outgoing layer is absolutely stacked and fades out while the incoming layer
   fades in, both in parallel over 0.26s — the iOS tab-content transition logic. */
.xfade { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.xfade-layer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.xfade-in { animation: xfadeIn 260ms linear both; }
.xfade-out { position: absolute; inset: 0; pointer-events: none; animation: xfadeOut 260ms linear both; }
@keyframes xfadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes xfadeOut { from { opacity: 1; } to { opacity: 0; } }
.sidebar-body { flex: 1; min-height: 0; }
.main-xfade { flex: 1; min-height: 0; }

/* settings list living in the sidebar */
.sb-settings { padding-top: 6px; }
.sb-set-sep { height: 0.5px; background: var(--g-border-2); margin: 8px 14px; }
/* Plain iOS-style settings rows (icon + title + chevron, no subtitle). */
.srow-plain { align-items: center; }
.srow-plain .set-body { flex: 1; min-width: 0; }
.srow-plain > svg { flex-shrink: 0; }
/* Folder-tab switcher (iOS Liquid-Glass capsule bar). The strip is a real
   translucent glass capsule — chat rows scroll/blur behind it; the ACTIVE pill
   is a single sliding neutral capsule (the glider) and the active LABEL keeps
   the teal accent (color lives in the text, not the fill). */
/* margin-top pulls the folder tabs up under the search field (iOS fdee2e4a:
   tighter search<->tabs gap — tabs nudged up beneath the search bar). */
.tabs { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 999px; margin-top: -3px;
  background: var(--g-bg); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4) var(--lg-lift);
  border: 0.5px solid var(--g-border); box-shadow: inset 2px 2px 0 -2px var(--lg-rim), inset 0 0 5px 0 var(--lg-glow), 0 4px 14px -8px rgba(0,0,0,0.30); }
.tab-scroll { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tab-scroll::-webkit-scrollbar { display: none; }
.tab-x { width: 32px; height: 32px; flex-shrink: 0; }
.tab-chip { position: relative; z-index: 1; flex-shrink: 0; padding: 6px 13px; border-radius: 999px; font-size: 15px; font-weight: 500; color: var(--txt-2); white-space: nowrap; background: none; transition: color .18s; }
.tab-chip:hover { color: var(--txt); }
.tab-chip.on { color: var(--accent); font-weight: 600; }
/* sliding neutral pill — driven by --x / --w CSS vars from the active chip's
   measured offsetLeft / offsetWidth (the matchedGeometryEffect analog) */
.tab-glider { position: absolute; top: 0; bottom: 0; left: 0; z-index: 0; border-radius: 999px; pointer-events: none;
  background: rgba(0,0,0,0.07); transform: translateX(var(--x, 0px)); width: var(--w, 0px);
  transition: transform .22s cubic-bezier(.4,0,.2,1), width .22s cubic-bezier(.4,0,.2,1); }
.tab-glider.idle { transition: none; }
.app[data-theme="dark"] .tab-glider { background: rgba(255,255,255,0.16); }

/* ============ CHAT LIST ============ */
.chat-list { flex: 1; overflow-y: auto; padding: 4px 10px 8px; display: flex; flex-direction: column; gap: 3px; }
/* Rows must keep their natural height and let .chat-list scroll — NOT get
   flex-shrunk to fit. .chat-swipe has overflow:hidden, which zeroes a flex
   item's automatic min-height, so without this the column squeezes every row
   (clipping the 2nd line + the avatar's bottom) instead of overflowing. */
.chat-list > .chat-swipe, .chat-list > .chat-item { flex-shrink: 0; }
.chat-item { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 16px; cursor: pointer; position: relative; transition: background .14s; }
.chat-item:hover { background: var(--hover); }
/* Telegram-style thin grey hairline between every chat-list row (incl. the AI /
   archive virtual rows), inset past the 50px avatar so it lines up with the row
   text — mirrors the iOS 0.5px outline divider (leading-72). Suppressed on the
   last row of the list so nothing hangs below the final chat. */
.chat-item::after { content: ""; position: absolute; left: 70px; right: 0; bottom: 0; height: 0.5px; background: var(--g-border-2); pointer-events: none; }
.chat-list > .chat-item:last-child::after,
.chat-list > .chat-swipe:last-child .chat-item::after { display: none; }
.chat-item.on { background: var(--g-bg-strong); box-shadow: var(--g-shadow-sm), inset 0 1px 0 var(--g-hi); }
.chat-item.on::before { content: ""; position: absolute; left: 4px; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: var(--accent); }
.avatar { border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 2px 8px -2px rgba(0,0,0,0.12); }
.ci-body { flex: 1; min-width: 0; }
.ci-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ci-name { font-size: 15.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 12.5px; color: var(--txt-3); flex-shrink: 0; }
.ci-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.ci-bottom .ci-msg { flex: 1; min-width: 0; margin-top: 0; }
.ci-msg { font-size: 13.5px; color: var(--txt-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.ci-msg .pre { color: var(--txt-3); }
.badge { flex-shrink: 0; background: linear-gradient(150deg, var(--accent), var(--accent-2)); color: #fff; font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px -3px var(--accent-soft-2); }
.ci-name { display: inline-flex; align-items: center; gap: 5px; }

/* ---- archive bucket (collapsed row + in-sidebar panel) ---- */
/* Telegram-style auto-hide-on-scroll wrapper for the archive row. Visible at the
   top of the list; collapses to zero height + fades when scrolled down. The
   negative margin in the collapsed state absorbs the chat-list flex `gap` so the
   following row sits flush (no residual 3px gap when hidden). overflow:hidden
   clips the row during the height transition. */
.archive-collapsible { max-height: 80px; opacity: 1; overflow: hidden; transition: max-height .18s ease, opacity .18s ease, margin-bottom .18s ease; }
.archive-collapsible.collapsed { max-height: 0; opacity: 0; margin-bottom: -3px; pointer-events: none; }
.archive-row .ci-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-av { width: 46px; height: 46px; background: linear-gradient(150deg, var(--txt-3), var(--txt-2)); }
.archive-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px; }
.archive-title { font-size: 16px; font-weight: 700; color: var(--txt); }

/* ---- swipeable chat row (Telegram-style leading/trailing actions) ---- */
.chat-swipe { position: relative; overflow: hidden; border-radius: 16px; }
.chat-swipe .chat-item { position: relative; z-index: 1; will-change: transform; }
/* the translated row needs an opaque backdrop so the reveal panels stay hidden
   until the row slides away (the chat-list itself is transparent glass) */
.chat-swipe.open .chat-item { background: var(--g-bg-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.swipe-panel { position: absolute; top: 0; bottom: 0; display: flex; z-index: 0; }
.swipe-panel.lead { left: 0; }
.swipe-panel.trail { right: 0; }
/* iOS-26 round swipe actions: each slot is transparent (the row/wallpaper shows
   through), holding a tinted CIRCLE + a label below in secondary text — only the
   46px circle is colored, not the whole reveal strip. */
.swipe-act { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: none; min-width: 0; cursor: pointer; }
.swipe-act-circle { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 2px 8px -2px rgba(0,0,0,0.18); transition: transform .12s; }
.swipe-act-label { font-size: 11px; font-weight: 500; color: var(--txt-3); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.swipe-act:active .swipe-act-circle { transform: scale(0.9); }

/* ---- chat-row context menu (right-click / long-press) ---- */
.chat-ctx { position: fixed; z-index: 4000; min-width: 200px; padding: 6px; border-radius: 16px; display: flex; flex-direction: column; gap: 2px;
  /* Opaque popover — .glass-2's 0.62 translucency made the menu read as bare
     floating text over the chat list (no visible panel). A near-solid frosted
     card + strong shadow + hairline border so it's unmistakably a floating menu. */
  background: rgba(255,255,255,0.97); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(15,40,60,0.08);
  box-shadow: 0 18px 50px -12px rgba(20,40,60,0.36), 0 3px 10px -3px rgba(20,40,60,0.20);
  /* The menu portals to <body> (outside .app), so neither the app's themed CSS
     vars nor the [data-theme="dark"] surface override reach it. It carries its
     own data-theme (stamped in JS) and re-declares the few tokens its items use
     — base = light, the [data-theme="dark"] rule below swaps in dark values. */
  --txt: oklch(0.24 0.025 220); --txt-2: oklch(0.46 0.025 220); --hover: rgba(15,40,60,0.06); --red: oklch(0.6 0.18 22); }
.chat-ctx[data-theme="dark"], [data-theme="dark"] .chat-ctx { background: rgba(34,42,56,0.98); border-color: rgba(255,255,255,0.09); box-shadow: 0 18px 50px -12px rgba(0,0,0,0.62), 0 3px 10px -3px rgba(0,0,0,0.5); }
.chat-ctx[data-theme="dark"] { --txt: oklch(0.95 0.012 220); --txt-2: oklch(0.72 0.02 220); --hover: rgba(255,255,255,0.07); --red: oklch(0.68 0.16 22); }
.chat-ctx-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; font-size: 14.5px; font-weight: 550; color: var(--txt); cursor: pointer; transition: background .12s; text-align: left; }
.chat-ctx-item:hover { background: var(--hover); }
.chat-ctx-item.danger { color: var(--red); }

/* ============ BOTTOM NAV (Material pill) ============ */
.bottom-nav { display: flex; align-items: center; padding: 9px 12px 13px; gap: 6px; flex-shrink: 0; border-top: 0.5px solid var(--g-border-2); }
.nav-btn { flex: 0 1 56px; min-width: 56px; height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border-radius: 24px; color: var(--txt-3); position: relative; cursor: pointer; overflow: hidden; will-change: flex-grow; transition: flex-grow .28s cubic-bezier(.4,0,.2,1), background-color .18s linear, color .18s linear; }
.nav-btn:hover:not(.on) { color: var(--txt-2); background-color: var(--hover); }
.nav-btn.on { flex-grow: 1; color: var(--accent); background-color: var(--accent-soft); }
.nav-btn svg { flex-shrink: 0; }
.nav-btn .nav-lbl { font-size: 14px; font-weight: 700; white-space: nowrap; max-width: 0; opacity: 0; overflow: hidden; transition: max-width .28s cubic-bezier(.4,0,.2,1), opacity .18s linear; }
.nav-btn.on .nav-lbl { max-width: 120px; opacity: 1; }

/* ============ THREAD ============ */
.thread-head {
  position: absolute; top: 14px; left: 16px; right: 16px; z-index: 4;
  /* Full pill: the ends read as clean semicircles (was a 20px rounded rect). */
  display: flex; align-items: center; gap: 13px; padding: 10px 14px; border-radius: 100px;
  /* Same tunable tint as the composer (was --g-bg-strong / 0.8) so the two chat
     bars match in transparency + colour instead of the header reading heavier. */
  background: rgba(var(--lg-tint-rgb), var(--lg-tint-a));
  box-shadow: var(--g-shadow), inset 0 1px 0 0 var(--g-hi);
}
/* Sticky variant: header + banners pinned INSIDE the scroller (share its layer),
   so their glass frosts/refracts the messages scrolling behind them. Messages
   pass BEHIND the pinned header because a sticky (positioned) element paints over
   the in-flow content that follows it. The header now occupies layout at the top,
   so the old fat header-clearance top padding is dropped. */
.thread-scroll-sticky > .thread-head {
  position: sticky; left: auto; right: auto; top: 14px;
  margin: 14px 16px 0; box-sizing: border-box;
}
.thread-scroll-sticky > .thread-banners {
  position: sticky; left: auto; right: auto; top: 82px;
  margin: 7px auto 0; width: calc(100% - 32px);
}
/* Composer: sticky at the bottom of the scroller (same layer as messages). */
.thread-scroll-sticky > .composer { position: sticky; left: auto; right: auto; bottom: 0; }
.thread-scroll-sticky > .thread-inner { padding-top: 8px; padding-bottom: 8px; }
.th-name { font-size: 16px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-peer { display: flex; align-items: center; gap: 13px; min-width: 0; flex: 1; cursor: pointer; border-radius: 12px; padding: 2px 6px 2px 2px; margin: -2px; transition: background .15s; }
.th-peer:hover { background: var(--hover); }
.th-sub { font-size: 12.5px; color: var(--txt-3); line-height: 1.2; }
.th-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* .thread-root wraps the whole open chat (header + banners + scroll + composer)
   so it can be one drop zone for drag-and-drop file upload. It fills .main and
   keeps .main's old role (flex column + positioning context) so the absolute
   .thread-head / .composer anchor exactly as before. */
.thread-root { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Drop overlay — shown while OS files hover the chat. pointer-events:none so the
   drop event falls through to .thread-root; the tinted glass sits above content. */
.drop-overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px; pointer-events: none; background: var(--accent-soft); -webkit-backdrop-filter: var(--blur-lite); backdrop-filter: var(--blur-lite); animation: dropFade .12s ease both; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; padding: 30px 42px; border-radius: 22px; border: 2px dashed var(--accent); animation: dropCardIn .16s var(--ease-snap, cubic-bezier(.4,0,.2,1)) both; }
.drop-card svg { color: var(--accent); margin-bottom: 3px; }
.drop-title { font-size: 17px; font-weight: 700; color: var(--txt); }
.drop-sub { font-size: 13px; color: var(--txt-3); max-width: 260px; }
@keyframes dropFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dropCardIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.thread-scroll { flex: 1; overflow-y: auto; position: relative; }
.thread-inner { max-width: 940px; margin: 0 auto; padding: 146px 36px 132px; display: flex; flex-direction: column; gap: 4px; }
.msg-row { display: flex; align-items: center; gap: 6px; }
.msg-row.sent { justify-content: flex-end; }
.bubble { max-width: 60%; padding: 9px 14px 8px; font-size: var(--chat-font-size, 14.5px); line-height: 1.4; border-radius: var(--bubble-radius, 18px); position: relative; word-wrap: break-word; }
.bubble .meta { font-size: 11px; margin-left: 9px; float: right; margin-top: 6px; display: inline-flex; align-items: center; gap: 3px; opacity: 0.9; }
/* "не отправлено" marker in the bubble/vnote meta row (audit #28) — red over any bubble bg */
.msg-fail { color: #ff5c5c; font-size: 13px; font-weight: 700; line-height: 1; }
/* Flat fill, NO backdrop-filter: an own backdrop-filter makes the bubble a
   composited layer that the sticky header/composer's glass can't refract, so it
   left a crisp grey patch + outline while the wallpaper around it warped ("не
   полностью искажается"). Flat bubbles (Telegram-style) refract uniformly under
   the glass. The --recv fill carries legibility over the wallpaper. */
.bubble.recv { background: var(--recv); color: var(--recv-txt); border: 0.5px solid var(--g-border); border-bottom-left-radius: 6px; box-shadow: var(--g-shadow-sm), inset 0 1px 0 var(--g-hi); }
.bubble.sent { color: var(--sent-txt); border-bottom-right-radius: 6px; background: var(--bubble-grad, linear-gradient(150deg, var(--accent), var(--accent-2))); box-shadow: 0 8px 20px -8px var(--accent-soft-2), inset 0 1px 0 rgba(255,255,255,0.4); border: 0.5px solid rgba(255,255,255,0.16); }
/* Emoji-only messages: large and bubble-less (WhatsApp/Telegram parity). The
   bubble surface, blur, border and shadow are dropped; the time/ticks drop to
   their own line in a small glass pill so they stay legible over the wallpaper. */
.bubble.emoji-only, .bubble.emoji-only.sent, .bubble.emoji-only.recv { background: none; border: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 2px 2px 0; max-width: 72%; display: flex; flex-direction: column; line-height: 1.05; }
.msg-row.sent .bubble.emoji-only { align-items: flex-end; }
.bubble.emoji-only > span:not(.meta) { font-size: 56px; }
.bubble.emoji-only.emoji-only-2 > span:not(.meta) { font-size: 46px; }
.bubble.emoji-only.emoji-only-3 > span:not(.meta) { font-size: 38px; }
.bubble.emoji-only .meta { float: none; margin: 5px 0 0; align-self: flex-end; color: var(--txt-3) !important; background: var(--recv); border: 0.5px solid var(--g-border); -webkit-backdrop-filter: var(--blur-lite); backdrop-filter: var(--blur-lite); padding: 2px 8px; border-radius: 11px; }
.msg-row:not(.sent) .bubble.emoji-only .meta { align-self: flex-start; }
.grp-gap { height: 9px; }
.day-divider { display: flex; justify-content: center; padding: 14px 0 8px; }
.day-chip { font-size: 12px; font-weight: 600; color: var(--txt-2); padding: 6px 14px; border-radius: 14px; }
.call-row { display: flex; padding: 4px 0; }
.call-row.sent { justify-content: flex-end; }
.call-row.centered { justify-content: center; }
.call-card { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 16px; min-width: 230px; }
.call-card.call-tap { cursor: pointer; transition: transform .12s ease, background .12s ease; }
.call-card.call-tap:active { transform: scale(.98); }
.call-card .ic-circ { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.call-card .ic-circ.danger { background: color-mix(in srgb, var(--red) 16%, transparent); }
.call-card .call-dir { position: absolute; right: -2px; bottom: -2px; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; line-height: 15px; font-weight: 700; text-align: center; box-shadow: 0 0 0 2px var(--g-bg-strong); }
.call-card .call-dir.danger { background: var(--red); }
.call-card .call-meta { min-width: 0; }
.call-card .c-title { font-size: 14.5px; font-weight: 650; }
.call-card .c-sub { font-size: 12.5px; color: var(--txt-3); }
.call-card .c-sub.danger { color: var(--red); }
.call-card .c-time { font-size: 11.5px; color: var(--txt-3); margin-left: auto; align-self: flex-end; }

/* voice */
.voice { width: 340px; }
.voice-top { display: flex; align-items: center; gap: 13px; }
.play-btn { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.92); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 10px -3px rgba(0,0,0,0.22); transition: transform .12s; }
.play-btn:hover { transform: scale(1.06); }
.wave { display: flex; align-items: center; gap: 2.5px; flex: 1; height: 30px; }
.wave i { width: 2.6px; border-radius: 2px; background: rgba(255,255,255,0.55); display: block; transition: background .2s; }
.wave i.on { background: rgba(255,255,255,0.95); }
.v-meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; font-size: 12.5px; }
.v-speed { padding: 2px 8px; border-radius: 9px; background: rgba(255,255,255,0.22); font-weight: 600; cursor: pointer; }
.transcribe { display: flex; align-items: center; gap: 8px; margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,0.25); font-size: 14px; cursor: pointer; }
.transcript-text { margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,0.22); font-size: 14px; line-height: 1.45; }

/* composer */
.composer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: 0 24px 20px; }
.composer-inner { max-width: 940px; margin: 0 auto; }
.suggest-row { display: flex; gap: 8px; padding: 0 4px 10px; flex-wrap: wrap; }
.suggest { padding: 9px 14px; border-radius: 16px; font-size: 13.5px; font-weight: 500; color: var(--accent-txt); cursor: pointer; transition: transform .12s; }
.suggest:hover { transform: translateY(-1px); }
.input-bar { display: flex; align-items: flex-end; gap: 8px; padding: 7px 12px; border-radius: 26px; }
.input-bar input { flex: 1; background: none; border: none; outline: none; font-size: 15px; color: var(--txt); padding: 6px 2px; }
.input-bar input::placeholder { color: var(--txt-3); }
.composer-ta { flex: 1; min-width: 0; background: none; border: none; outline: none; resize: none; font-family: inherit; font-size: 15px; line-height: 22px; color: var(--txt); padding: 8px 2px; max-height: 124px; overflow-y: auto; scrollbar-width: thin; }
.composer-ta::placeholder { color: var(--txt-3); }
.composer-ta::-webkit-scrollbar { width: 5px; }
.composer-ta::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 3px; }
.send-btn { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px -6px var(--accent-soft-2), inset 0 1px 0 rgba(255,255,255,0.4); transition: transform .12s, opacity .15s; }
.send-btn:hover { transform: scale(1.06); }
.send-btn.hidden { display: none; }

/* chat/AI segmented at top of thread */
.thread-tabs { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; padding: 4px; border-radius: 16px; gap: 3px; background: var(--g-bg-strong); box-shadow: var(--g-shadow-sm), inset 0 1px 0 0 var(--g-hi); }
.tt-btn { padding: 7px 22px; border-radius: 12px; font-size: 13.5px; font-weight: 650; color: var(--txt-2); display: flex; align-items: center; gap: 7px; transition: color .15s; }
.tt-btn.on { color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px -4px var(--accent-soft-2); }

/* Compact Чат/AI switcher that lives IN the header (top bar). */
.head-aitabs { flex: none; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--g-bg); margin-left: 8px; }
.hat-btn { padding: 5px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--txt-2); display: flex; align-items: center; gap: 5px; white-space: nowrap; transition: color .15s, background .15s; }
.hat-btn.on { color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 3px 10px -4px var(--accent-soft-2); }
.hat-btn:not(.on):hover { color: var(--txt); }

/* Top-of-thread banners (pinned bar + "ИИ выключен" prompt) stack in ONE flex
   column so they can NEVER overlap, whatever their heights (audit #42 + the AI
   prompt). Children render in normal flow inside — no fragile hardcoded offsets. */
.thread-banners { position: absolute; top: 82px; left: 16px; right: 16px; z-index: 6; max-width: 940px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; }
.thread-banners > .pinned-bar, .thread-banners > .thread-tabs { position: static; top: auto; left: auto; right: auto; transform: none; margin: 0; pointer-events: auto; }
.thread-banners > .pinned-bar { max-width: none; width: 100%; }
/* The now-playing media bar lives inside the banners column too, so it flows
   under the pins (or sits right under the header when nothing is pinned) instead
   of a fixed top offset. position:relative (not static) so .mb-progress anchors
   to the bar. */
.thread-banners > .media-bar { position: relative; top: auto; left: auto; right: auto; margin: 0; width: 100%; max-width: none; z-index: auto; pointer-events: auto; }
/* Pinned-message bar (audit #42) — full-width glass bar (Telegram / legacy
   .chat-pinned-bar). OPAQUE so the messages scrolling under it don't bleed
   through. Positioning comes from .thread-banners above. */
.pinned-bar { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px; border-radius: 16px; background: var(--pop-bg); box-shadow: var(--g-shadow-sm), inset 0 1px 0 0 var(--g-hi); border: 0.5px solid var(--g-border); }
.pin-x { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--txt-3); transition: background .15s, color .15s; }
.pin-x:hover { background: var(--g-bg); color: var(--txt-2); }
/* Compact ↑/↓ pager for cycling through multiple pinned messages. */
.pin-nav { flex: none; display: flex; flex-direction: column; gap: 1px; }
.pin-nav button { display: flex; align-items: center; justify-content: center; width: 28px; height: 19px; border-radius: 7px; color: var(--txt-3); transition: background .15s, color .15s; }
.pin-nav button:hover { background: var(--g-bg); color: var(--txt); }
/* Telegram-style flash on the message you jump to (pinned bar / date jump). */
@keyframes msgFlash { 0% { background-color: color-mix(in oklch, var(--accent) 18%, transparent); } 100% { background-color: transparent; } }
.msg-flash { animation: msgFlash 1.6s ease-out; border-radius: 16px; }

/* ====================== GLOBAL MEDIA-PLAYER BAR ====================== */
/* Telegram-style transport bar that floats below the header + Chat/AI tabs. */
.media-bar {
  position: absolute; top: 138px; left: 16px; right: 16px; z-index: 5;
  max-width: 940px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  /* Extra bottom padding so the transport row clears the progress line at the
     bottom edge — they used to sit almost on top of each other. */
  padding: 8px 10px 17px; border-radius: 18px;
  background: var(--g-bg-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--g-shadow), inset 0 1px 0 0 var(--g-hi);
  border: 0.5px solid var(--g-border);
  animation: mbIn .22s cubic-bezier(.22,1,.36,1);
}
.mb-transport { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.mb-btn { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--txt-2); flex-shrink: 0; transition: background .15s, color .15s, transform .12s; }
.mb-btn:hover { background: var(--hover); color: var(--txt); }
.mb-btn:active { transform: scale(0.92); }
.mb-btn.on { color: var(--accent); }
.mb-btn.mb-play {
  width: 40px; height: 40px; border-radius: 50%; color: #fff;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -6px var(--accent-soft-2), inset 0 1px 0 rgba(255,255,255,0.4);
}
.mb-btn.mb-play:hover { background: linear-gradient(150deg, var(--accent), var(--accent-2)); transform: scale(1.05); }
.mb-btn.mb-close { color: var(--txt-3); }
.mb-text { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; line-height: 1.25; padding: 0 2px; }
.mb-name { font-size: 14px; font-weight: 700; color: var(--accent-txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-sub { font-size: 12px; color: var(--txt-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-speed {
  flex-shrink: 0; min-width: 42px; height: 30px; padding: 0 10px; border-radius: 11px;
  font-size: 13px; font-weight: 700; color: var(--accent-txt);
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s;
}
.mb-speed:hover { background: var(--accent-soft-2); }
.mb-speed:active { transform: scale(0.94); }
.mb-progress {
  position: absolute; left: 14px; right: 14px; bottom: 5px; height: 3px;
  border-radius: 3px; background: var(--accent-soft); cursor: pointer; overflow: hidden;
}
.mb-progress::before { content: ""; position: absolute; inset: -7px 0; }
.mb-progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  /* No CSS transition — the controller's requestAnimationFrame ticker writes
     the width every frame, so the fill glides smoothly at 60fps instead of
     stepping with the ~4x/sec 'timeupdate' event (looked jumpy on short clips). */
  transition: none;
}
@keyframes mbIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .media-bar { animation: none; } .mb-progress-fill { transition: none; } }

/* empty state */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--txt-3); }
.empty .e-icon { width: 104px; height: 104px; border-radius: 30px; display: flex; align-items: center; justify-content: center; color: var(--accent); margin-bottom: 14px; box-shadow: var(--g-shadow), inset 0 1px 0 0 var(--g-hi); }
.empty .e-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--txt); }
.empty .e-sub { font-size: 14px; font-weight: 500; line-height: 1.5; max-width: 300px; color: var(--txt-3); }

/* ============ AI PANEL (per-chat) ============ */
.ai-panel { flex: 1; overflow-y: auto; position: relative; }
/* Top pad clears the floating .thread-head only — the Чат/AI switcher now lives
   inside that header (was a separate floating pill needing extra clearance). */
.ai-inner { max-width: 720px; margin: 0 auto; padding: 104px 36px 132px; display: flex; flex-direction: column; gap: 14px; }
.ai-hero { text-align: center; padding: 18px 0 6px; }
.ai-hero .ai-mark { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 30px -10px var(--accent-soft-2), inset 0 1px 0 rgba(255,255,255,0.4); }
.ai-hero h3 { font-size: 20px; font-weight: 700; }
.ai-hero p { font-size: 14px; color: var(--txt-2); margin-top: 5px; line-height: 1.5; }
.ai-card { padding: 16px 18px; border-radius: 18px; cursor: pointer; display: flex; gap: 13px; align-items: flex-start; transition: transform .12s; }
.ai-card:hover { transform: translateY(-2px); }
.ai-card .ac-ic { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.ai-card .ac-title { font-size: 15px; font-weight: 650; }
.ai-card .ac-sub { font-size: 13px; color: var(--txt-2); margin-top: 3px; line-height: 1.45; }

/* ============ GENERIC LIST VIEW (calls / contacts) ============ */
.list-head { position: absolute; top: 14px; left: 16px; right: 16px; z-index: 4; display: flex; align-items: center; gap: 13px; padding: 12px 16px; border-radius: 100px; background: rgba(var(--lg-tint-rgb), var(--lg-tint-a)); box-shadow: var(--g-shadow), inset 0 1px 0 0 var(--g-hi); }
.list-head h2 { font-size: 18px; font-weight: 700; }
.list-scroll { flex: 1; overflow-y: auto; }
.list-inner { max-width: 720px; margin: 0 auto; padding: 92px 24px 40px; }
.row-item { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 16px; transition: background .14s; cursor: pointer; }
.row-item:hover { background: var(--hover); }
.ri-body { flex: 1; min-width: 0; }
.ri-name { font-size: 15.5px; font-weight: 650; }
.ri-name.missed { color: var(--red); }
.ri-sub { font-size: 13px; color: var(--txt-2); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.ri-time { font-size: 12.5px; color: var(--txt-3); }

/* ============ PROFILE ============ */
.profile-scroll { flex: 1; overflow-y: auto; }
.profile-inner { max-width: 560px; margin: 0 auto; padding: 56px 24px 48px; }
.profile-card { padding: 32px 28px; border-radius: 28px; text-align: center; }
.profile-big-av { width: 116px; height: 116px; border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 46px; position: relative; }
.online-dot { position: absolute; right: 8px; bottom: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--green); border: 3px solid var(--g-bg-strong); }
.profile-name { font-size: 26px; font-weight: 700; }
.profile-status { font-size: 14px; color: var(--green); font-weight: 600; margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; }
.profile-bio { font-size: 14px; color: var(--txt-2); margin-top: 6px; }
.profile-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 22px; }
.pa-btn { padding: 14px 8px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--accent-txt); transition: transform .12s; }
.pa-btn:hover { transform: translateY(-2px); }
.profile-field { display: flex; align-items: center; padding: 14px 16px; border-radius: 14px; margin-top: 10px; }
.pf-body { flex: 1; }
.pf-label { font-size: 12px; color: var(--txt-3); }
.pf-value { font-size: 15px; margin-top: 2px; }
.pf-value.accent { color: var(--accent); }

/* ============ CHAT INFO (profile of the chat) ============ */
.info-head { position: absolute; top: 14px; left: 16px; right: 16px; height: 52px; z-index: 6; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; border-radius: 100px; background: var(--g-bg-strong); box-shadow: var(--g-shadow), inset 0 1px 0 0 var(--g-hi); }
.info-head .ih-title { font-size: 17px; font-weight: 700; position: absolute; left: 50%; transform: translateX(-50%); }
.info-back, .info-edit { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 600; color: var(--accent); padding: 9px 14px; border-radius: 12px; transition: background .15s; }
.info-back:hover, .info-edit:hover { background: var(--accent-soft); }
.info-scroll { position: absolute; inset: 0; overflow-y: auto; }
.info-inner { max-width: 600px; margin: 0 auto; padding: 84px 24px 60px; }
.info-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.info-av-wrap { position: relative; display: inline-block; }
.info-av-wrap .online-dot { width: 22px; height: 22px; border: 3px solid var(--g-bg-strong); }
.info-name { font-size: 26px; font-weight: 700; margin-top: 16px; }
.info-status { font-size: 13.5px; color: var(--txt-3); margin-top: 4px; }
.info-status.on { color: var(--green); font-weight: 600; }
.info-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; margin-top: 22px; }
.info-actions.five, .info-actions.four { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.info-actions.five .pa-btn, .info-actions.four .pa-btn { padding: 13px 4px; gap: 6px; font-size: 12px; border-radius: 15px; }
.pa-btn.active { color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); }
.info-card { border-radius: 24px; overflow: hidden; margin-top: 16px; }
.info-card-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--txt-3); padding: 18px 18px 8px; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; }
.info-row + .info-row { border-top: 0.5px solid var(--g-border-2); }
.info-row-body { flex: 1; min-width: 0; }
.info-row-label { font-size: 12px; color: var(--txt-3); }
.info-row-value { font-size: 16px; margin-top: 3px; word-break: break-word; }
.info-row-value.accent { color: var(--accent); }
.info-block { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 18px; border-top: 0.5px solid var(--g-border-2); color: var(--red); font-size: 16px; font-weight: 650; transition: background .14s; }
.info-block:hover { background: color-mix(in oklch, var(--red) 9%, transparent); }
.info-seg { display: flex; gap: 2px; padding: 4px; margin: 4px 14px 0; border-radius: 14px; background: var(--field); border: 0.5px solid var(--g-border); overflow-x: auto; scrollbar-width: none; position: relative; }
.info-seg::-webkit-scrollbar { display: none; }
/* Single highlight that glides between tabs (measured in JS). The active tab no
   longer paints its own background — this span IS the indicator, so switching
   tabs slides it across instead of snapping the fill onto another button. */
.info-seg-glider { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 10px; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px -4px var(--accent-soft-2); transition: transform .36s cubic-bezier(.22,.88,.22,1), width .32s cubic-bezier(.22,.88,.22,1), opacity .2s ease; z-index: 0; pointer-events: none; }
.info-seg button { flex-shrink: 0; padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--txt-2); white-space: nowrap; transition: color .2s; position: relative; z-index: 1; }
.info-seg button:hover { color: var(--txt); }
.info-seg button.on { color: #fff; }
.info-empty { margin: 14px; padding: 36px 18px; border-radius: 16px; text-align: center; background: var(--g-bg); border: 0.5px solid var(--g-border-2); }
.info-empty .ie-title { font-size: 15px; font-weight: 650; }
.info-empty .ie-sub { font-size: 13px; color: var(--txt-3); margin-top: 7px; line-height: 1.45; }

/* ============ SETTINGS ============ */
.settings-col {
  width: 360px; flex-shrink: 0; height: 100%; display: flex; flex-direction: column;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 0.5px solid var(--g-border-2); border-radius: 42px; overflow: hidden;
  box-shadow: var(--g-shadow); position: relative; z-index: 3;
}
.app[data-theme="dark"] .settings-col { background: rgba(20,24,30,0.90); }
.app[data-theme="light"] .settings-col { background: rgba(255,255,255,0.90); }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px 22px; flex-shrink: 0; }
.settings-head h2 { font-size: 22px; font-weight: 700; }
.settings-list { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.set-row { display: flex; align-items: center; gap: 13px; padding: 9px 12px; border-radius: 14px; cursor: pointer; transition: background .14s; }
.set-row:hover { background: var(--hover); }
.set-row.on { background: var(--g-bg-strong); box-shadow: var(--g-shadow-sm); }
.set-ic { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.3); }
.set-body { flex: 1; min-width: 0; }
.set-title { font-size: 15px; font-weight: 600; }
.set-title.danger { color: var(--red); }
.set-sub { font-size: 12.5px; color: var(--txt-3); margin-top: 1px; }
.set-logout { display: flex; align-items: center; gap: 14px; padding: 14px 18px; flex-shrink: 0; border-top: 0.5px solid var(--g-border-2); color: var(--red); font-weight: 650; font-size: 15px; cursor: pointer; }

/* settings detail */
.detail { flex: 1; min-width: 0; height: 100%; overflow-y: auto; }
.detail-inner { max-width: 760px; margin: 0 auto; padding: 40px 40px 60px; }
.detail-section-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--txt-3); margin: 21px 4px 8px; }
.detail-section-label:first-child { margin-top: 0; }
.detail-card { border-radius: 16px; overflow: hidden; }
/* iOS fdee2e4a: borderless grouped settings cards — the translucent glass FILL
   reads as the card; the hairline outline around several rows is dropped (it read
   as clutter). Rows inside keep their own 0.5px dividers (.opt-row + .opt-row).
   Radius 20->16 mirrors the iOS GluCard 22->16. */
.detail-card.glass { border: none; }
.detail-card-pad { padding: 6px; }
.opt-row { display: flex; align-items: center; gap: 13px; padding: 9px 16px; border-radius: 15px; }
.opt-row + .opt-row { border-top: 0.5px solid var(--g-border-2); }
.opt-body { flex: 1; min-width: 0; }
.opt-title { font-size: 15.5px; font-weight: 600; }
.opt-sub { font-size: 13px; color: var(--txt-2); margin-top: 3px; line-height: 1.4; }
.account-row { display: flex; align-items: center; gap: 16px; padding: 18px; }
.account-row .ar-name { font-size: 18px; font-weight: 700; }
.account-row .ar-user { font-size: 14px; color: var(--accent); margin-top: 2px; }
.text-btn { color: var(--accent); font-weight: 650; font-size: 14px; padding: 8px 14px; border-radius: 12px; transition: background .15s; }
.text-btn:hover { background: var(--accent-soft); }

/* toggle */
.toggle { width: 50px; height: 30px; border-radius: 16px; flex-shrink: 0; position: relative; cursor: pointer; transition: background .22s; background: var(--press); }
.toggle.on { background: linear-gradient(150deg, var(--accent), var(--accent-2)); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.25); transition: transform .22s; }
.toggle.on .knob { transform: translateX(20px); }

/* textarea */
.glass-textarea { width: 100%; min-height: 120px; border: none; outline: none; resize: none; background: none; font-size: 15px; line-height: 1.55; color: var(--txt); padding: 16px 18px; }
.glass-textarea::placeholder { color: var(--txt-3); }
.field-hint { font-size: 12.5px; color: var(--txt-3); margin: 9px 6px 0; }

/* big buttons — primary CTA = accent-tinted INTERACTIVE Liquid-Glass pill
   (iOS GluAccentPill): a translucent accent gradient with a real backdrop blur
   so the wallpaper bleeds through, a 0.5px white edge, and a press scale that
   mimics .interactive(). */
.btn-primary { padding: 13px 22px; border-radius: 22px; font-size: 15px; font-weight: 650; color: #fff;
  background: linear-gradient(135deg, color-mix(in oklch, var(--accent) 80%, transparent), color-mix(in oklch, var(--accent-2) 80%, transparent));
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid rgba(255,255,255,0.40);
  box-shadow: 0 6px 14px -6px var(--accent-soft-2), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: transform .12s, filter .12s; }
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97); filter: brightness(1.06); }
.btn-ghost { padding: 13px 22px; border-radius: 22px; font-size: 15px; font-weight: 650; color: var(--txt-2); transition: background .15s, transform .12s; }
.btn-ghost:hover { background: var(--hover); }
.btn-ghost:active { transform: scale(0.97); }

/* small bar button = compact NEUTRAL Liquid-Glass capsule (iOS gluGlassPillButton):
   untinted translucent glass for small chrome buttons (e.g. a "Готово"/Done). */
.glu-glass-pill { padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 650; color: var(--txt);
  background: var(--field); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid var(--g-border); transition: transform .12s, background .15s; }
.glu-glass-pill:hover { background: var(--g-bg-strong); }
.glu-glass-pill:active { transform: scale(0.96); }

/* appearance theme picker */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.theme-opt { padding: 6px; border-radius: 18px; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.theme-opt.on { border-color: var(--accent); }
.theme-preview { height: 96px; border-radius: 13px; overflow: hidden; position: relative; display: flex; flex-direction: column; gap: 5px; padding: 12px; }
.theme-preview.light { background: linear-gradient(165deg, #eef5f6, #eaf3f4); }
.theme-preview.dark { background: linear-gradient(165deg, #04070B, #020407); }
.tp-bubble { height: 13px; border-radius: 7px; }
.tp-bubble.r { width: 58%; }
.tp-bubble.s { width: 44%; align-self: flex-end; background: linear-gradient(150deg, var(--accent), var(--accent-2)); }
.theme-preview.light .tp-bubble.r { background: rgba(255,255,255,0.85); }
.theme-preview.dark .tp-bubble.r { background: rgba(255,255,255,0.18); }
.theme-opt-label { text-align: center; font-size: 14px; font-weight: 600; padding: 9px 0 4px; }

/* misc */
/* misc — entrance animations must NEVER hide content (transform-only, no opacity) */
.fade-in, .pop-in { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fadeIn .26s ease; }
  .pop-in { animation: popIn .2s ease; }
}
@keyframes fadeIn { from { transform: translateY(6px); } to { transform: none; } }
@keyframes popIn { from { transform: scale(.97); } to { transform: none; } }

/* ====================== FORM CONTROLS ====================== */
.glass-input {
  width: 100%; background: var(--field); border: 0.5px solid var(--g-border); border-radius: 13px;
  padding: 13px 15px; font-size: 15px; color: var(--txt); outline: none;
  -webkit-backdrop-filter: var(--blur-lite); backdrop-filter: var(--blur-lite); transition: border-color .15s;
}
.glass-input:focus { border-color: color-mix(in oklch, var(--accent) 55%, transparent); }
.glass-input::placeholder { color: var(--txt-3); }
textarea.glass-input { resize: none; min-height: 110px; line-height: 1.5; }
.glass-select {
  appearance: none; -webkit-appearance: none; cursor: pointer; min-width: 150px; width: auto;
  background: var(--field); border: 0.5px solid var(--g-border); border-radius: 12px;
  padding: 10px 38px 10px 14px; font-size: 14.5px; font-weight: 600; color: var(--txt); outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* ---- themed glass dropdown (replaces native select) ---- */
.gsel { position: relative; flex-shrink: 0; }
.gsel-btn { display: flex; align-items: center; gap: 8px; min-width: 132px; justify-content: space-between; padding: 10px 12px 10px 14px; border-radius: 12px; background: var(--field); border: 0.5px solid var(--g-border); font-size: 14.5px; font-weight: 600; color: var(--txt); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
.gsel-btn:hover { background: var(--hover); }
.gsel.open .gsel-btn { border-color: color-mix(in oklch, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--g-bg-strong); }
.gsel-chev { display: flex; color: var(--txt-3); transition: transform .2s ease; }
.gsel.open .gsel-chev { transform: rotate(180deg); color: var(--accent); }
.gsel-pop { position: fixed; z-index: 200; min-width: 100%; width: max-content; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; padding: 6px; border-radius: 15px; display: flex; flex-direction: column; gap: 2px; transform-origin: top right; background: var(--pop-bg); border: 0.5px solid var(--g-border); box-shadow: 0 18px 50px -16px rgba(20,40,55,0.4), 0 4px 14px -6px rgba(20,40,55,0.2), inset 0 1px 0 var(--g-hi); -webkit-backdrop-filter: saturate(1.3); backdrop-filter: saturate(1.3); animation: gselPop .17s cubic-bezier(.2,.8,.3,1.1) both; }
.gsel-pop::-webkit-scrollbar { width: 7px; }
.gsel-pop::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 7px; }
@keyframes gselPop { 0% { opacity: 0; transform: scale(.96) translateY(-5px); } 100% { opacity: 1; transform: none; } }
.gsel-opt { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--txt); cursor: pointer; white-space: nowrap; transition: background .13s; opacity: 0; animation: gselItem .22s ease forwards; }
@keyframes gselItem { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.gsel-opt:hover { background: var(--hover); }
.gsel-opt.on { background: var(--accent-soft); color: var(--accent); }
.field-select-row { display: flex; align-items: center; gap: 14px; padding: 15px 16px; }
.field-select-row + .field-select-row { border-top: 0.5px solid var(--g-border-2); }
.fsr-body { flex: 1; min-width: 0; }
.fsr-title { font-size: 15.5px; font-weight: 600; }
.fsr-sub { font-size: 13px; color: var(--txt-2); margin-top: 3px; }

/* discrete row: label + value/chevron */
.disc-row { display: flex; align-items: center; gap: 10px; padding: 15px 16px; cursor: pointer; transition: background .14s; }
.disc-row + .disc-row { border-top: 0.5px solid var(--g-border-2); }
.disc-row:hover { background: var(--hover); }
.disc-body { flex: 1; min-width: 0; }
.disc-title { font-size: 15.5px; font-weight: 600; }
.disc-title.danger { color: var(--red); }
.disc-sub { font-size: 13px; color: var(--txt-2); margin-top: 3px; }
.disc-val { font-size: 14px; color: var(--txt-3); }
.mono { font-family: ui-monospace, Menlo, monospace; }

/* segmented text tabs (Pending | In progress | …) */
.seg-line { display: flex; gap: 2px; border-bottom: 0.5px solid var(--g-border); margin-bottom: 16px; }
.seg-line button { padding: 10px 15px; font-size: 14px; font-weight: 600; color: var(--txt-3); position: relative; transition: color .15s; }
.seg-line button:hover { color: var(--txt-2); }
.seg-line button.on { color: var(--accent); }
.seg-line button.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -0.5px; height: 2px; border-radius: 2px; background: var(--accent); }

.empty-note { text-align: center; color: var(--txt-3); font-size: 14px; padding: 34px 0; }
.intro-note { font-size: 14px; color: var(--txt-2); line-height: 1.5; margin: 0 4px 16px; }

/* language */
.lang-row { display: flex; align-items: center; gap: 13px; padding: 13px 16px; cursor: pointer; transition: background .14s; }
.lang-row + .lang-row { border-top: 0.5px solid var(--g-border-2); }
.lang-row:hover { background: var(--hover); }
.lang-row.on { background: var(--accent-soft); }
.flag { width: 30px; height: 22px; border-radius: 5px; overflow: hidden; flex-shrink: 0; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.12); display: block; }
.lang-name { font-size: 15px; font-weight: 600; }
.lang-name.on { color: var(--accent); }
.lang-sub { font-size: 12.5px; color: var(--txt-3); margin-top: 1px; }
.soon-badge { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--txt-3); background: var(--press); padding: 4px 9px; border-radius: 8px; }
.lang-check { margin-left: auto; color: var(--accent); }

/* sessions */
.session-row { display: flex; align-items: center; gap: 12px; padding: 15px 16px; }
.session-row + .session-row { border-top: 0.5px solid var(--g-border-2); }
.sess-body { flex: 1; min-width: 0; }
.sess-title { font-size: 15px; font-weight: 650; }
.sess-sub { font-size: 12.5px; color: var(--txt-3); margin-top: 2px; }
.term-btn { color: var(--red); font-weight: 650; font-size: 14px; padding: 8px 14px; border-radius: 11px; transition: background .15s; }
.term-btn:hover { background: color-mix(in oklch, var(--red) 12%, transparent); }
.term-all { padding: 14px 16px; color: var(--red); font-weight: 650; font-size: 14.5px; cursor: pointer; border-top: 0.5px solid var(--g-border-2); }
.term-all:hover { background: var(--hover); }

/* swatches / chips / accent dots */
.sw-row { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { width: 52px; height: 52px; border-radius: 14px; cursor: pointer; border: 2px solid transparent; background-size: 170% 170%; background-position: 26% 20%; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4), inset 0 0 0 1.5px rgba(20,40,55,0.05), 0 3px 10px -3px rgba(20,40,55,0.28); transition: transform .12s; }
.sw:hover { transform: translateY(-2px); }
.sw.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4), 0 4px 14px -4px var(--accent-soft-2); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 8px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--txt-2); background: var(--field); cursor: pointer; border: 0.5px solid var(--g-border); transition: all .14s; }
.chip:hover { color: var(--txt); }
.chip.on { color: var(--accent); border-color: color-mix(in oklch, var(--accent) 45%, transparent); background: var(--accent-soft); }
.accent-dot { width: 38px; height: 38px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform .12s; }
.accent-dot:hover { transform: scale(1.08); }
.accent-dot.on { border-color: var(--txt); box-shadow: 0 0 0 2px var(--g-bg); }
.mini-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }

/* radios */
.radio-row { display: flex; align-items: center; gap: 11px; padding: 11px 2px; cursor: pointer; }
.radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--txt-3); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: border-color .15s; }
.radio-row.on .radio-dot { border-color: var(--accent); }
.radio-row.on .radio-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.radio-label { font-size: 15px; font-weight: 600; }

/* range */
.glu-range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 6px; background: var(--field); outline: none; cursor: pointer; box-shadow: inset 0 0 0 0.5px var(--g-border); }
.glu-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.5); cursor: pointer; }
.glu-range::-moz-range-thumb { width: 22px; height: 22px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }

/* char counter */
.counter { text-align: right; font-size: 12px; color: var(--txt-3); margin-top: 6px; }

/* ====================== MODALS ====================== */
.modal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--scrim-strong); -webkit-backdrop-filter: blur(30px) saturate(0.62) brightness(1.02); backdrop-filter: blur(30px) saturate(0.62) brightness(1.02); animation: cmFade .18s ease; }
.modal-card { width: 100%; max-width: 440px; border-radius: 24px; padding: 22px; position: relative; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 19px; font-weight: 700; }
.modal-close { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--press); color: var(--txt-2); }
.modal-close:hover { background: var(--hover); }
.qr-card { background: #fff; border-radius: 20px; padding: 26px; display: flex; align-items: center; justify-content: center; }
.qr-user { text-align: center; color: var(--accent); font-weight: 700; font-size: 16px; margin-top: 16px; }
.qr-uri { text-align: center; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--txt-3); margin-top: 5px; word-break: break-all; }
.qr-hint { text-align: center; font-size: 13px; color: var(--txt-2); margin-top: 12px; }
.acct-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; cursor: pointer; transition: background .14s; }
.acct-row:hover { background: var(--hover); }
.acct-row.cur { background: var(--accent-soft); }
.acct-row + .acct-row { margin-top: 8px; }
.acct-name { font-size: 16px; font-weight: 700; }
.acct-user { font-size: 13.5px; color: var(--accent); margin-top: 1px; }
.acct-add { border: 1.5px dashed var(--g-border); color: var(--accent); font-weight: 650; }
.cur-badge { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--accent); background: var(--accent-soft-2); padding: 4px 10px; border-radius: 9px; }

/* ====================== EDIT PROFILE SCREEN ====================== */
.edit-head { position: absolute; top: 0; left: 0; right: 0; height: 64px; z-index: 6; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: var(--g-bg-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 0.5px solid var(--g-border-2); }
.edit-head .t { font-size: 17px; font-weight: 700; }
.edit-head .b { font-size: 16px; font-weight: 600; color: var(--accent); padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.edit-head .b:hover { background: var(--accent-soft); }
.edit-head .b.muted { color: var(--txt-2); }
.edit-scroll { position: absolute; inset: 64px 0 0 0; overflow-y: auto; }
.edit-inner { max-width: 620px; margin: 0 auto; padding: 32px 28px 60px; }
.edit-av-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.edit-cam { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.edit-hint { font-size: 12.5px; color: var(--txt-3); margin: 8px 4px 20px; }
.field-group { border-radius: 16px; overflow: hidden; }
.field-group .glass-input { border-radius: 0; border: none; border-bottom: 0.5px solid var(--g-border-2); background: var(--g-bg); }
.field-group .glass-input:last-child { border-bottom: none; }
.fg-row { display: flex; align-items: center; gap: 10px; padding: 15px 16px; background: var(--g-bg); cursor: pointer; }
.fg-row + .fg-row { border-top: 0.5px solid var(--g-border-2); }
.fg-label { font-size: 15px; font-weight: 500; }
.fg-val { margin-left: auto; color: var(--txt-3); font-size: 15px; }

/* ====================== GLU CALENDAR ====================== */
.cal-wrap { position: absolute; inset: 140px 0 0 0; display: flex; }
.cal-left { width: 296px; flex-shrink: 0; height: 100%; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; border-right: 0.5px solid var(--g-border-2); }
.cal-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.cal-right { width: 322px; flex-shrink: 0; height: 100%; overflow-y: auto; padding: 22px 20px; border-left: 0.5px solid var(--g-border-2); }
.cal-mini { border-radius: 20px; padding: 14px 14px 16px; }
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-mh-title { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cal-month { font-size: 15px; font-weight: 700; }
.cal-today-btn { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 7px; transition: background .15s; }
.cal-today-btn:hover { background: var(--accent-soft-2); }
.cal-nav { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--txt-2); transition: background .15s, color .15s; }
.cal-nav:hover { background: var(--hover); color: var(--txt); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { margin-bottom: 5px; }
.cal-wd-cell { text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; color: var(--txt-3); padding: 2px 0; }
.cal-day { aspect-ratio: 1; border-radius: 10px; display: flex; align-items: center; justify-content: center; position: relative; font-size: 13px; font-weight: 600; color: var(--txt); transition: background .14s, color .14s; }
.cal-day:hover:not(.empty) { background: var(--hover); }
.cal-day.empty { pointer-events: none; }
.cal-day.sel { background: var(--accent-soft); color: var(--accent); }
.cal-day.today { background: linear-gradient(150deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 12px -4px var(--accent-soft-2), inset 0 1px 0 rgba(255,255,255,0.35); }
.cal-day.today.sel { box-shadow: 0 0 0 2px var(--accent-soft-2), 0 4px 12px -4px var(--accent-soft-2); }
.cal-dot { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-day.today .cal-dot { background: #fff; }
.cal-new-btn { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px; border-radius: 14px; font-size: 14px; font-weight: 650; color: var(--accent); background: var(--accent-soft); border: 0.5px solid color-mix(in oklch, var(--accent) 30%, transparent); transition: transform .12s, background .15s; }
.cal-new-btn:hover { transform: translateY(-1px); background: var(--accent-soft-2); }
.cal-new-dot { width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 0 0 3px var(--accent-soft); }
.cal-hints { margin-top: auto; display: flex; flex-direction: column; gap: 7px; padding-top: 14px; font-size: 12px; color: var(--txt-3); }
.cal-hints span { display: flex; align-items: center; gap: 5px; }
.cal-hints kbd { font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; min-width: 18px; height: 18px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: var(--field); border: 0.5px solid var(--g-border); color: var(--txt-2); }
.cal-day-head { display: flex; align-items: center; gap: 16px; padding: 16px 26px; border-bottom: 0.5px solid var(--g-border-2); flex-shrink: 0; }
.cal-bignum { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1px; color: var(--accent); }
.cal-dh-wd { font-size: 17px; font-weight: 700; }
.cal-dh-sub { font-size: 13px; color: var(--txt-3); margin-top: 2px; }
.cal-evbadge { margin-left: auto; text-align: center; padding: 7px 14px; border-radius: 13px; background: var(--field); border: 0.5px solid var(--g-border); }
.cal-evbadge.has { background: var(--accent-soft); border-color: color-mix(in oklch, var(--accent) 30%, transparent); }
.cal-evbadge-n { font-size: 18px; font-weight: 800; line-height: 1; color: var(--txt-2); }
.cal-evbadge.has .cal-evbadge-n { color: var(--accent); }
.cal-evbadge-l { font-size: 10px; font-weight: 600; color: var(--txt-3); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }
.cal-timeline { flex: 1; overflow-y: auto; position: relative; }
.cal-tl-inner { position: relative; max-width: 760px; margin: 0 auto; }
.cal-hour-row { position: relative; border-top: 0.5px solid var(--g-border-2); padding-left: 66px; cursor: pointer; }
.cal-hour-row:hover { background: var(--hover); }
.cal-hour-lbl { position: absolute; left: 14px; top: -8px; font-size: 11.5px; font-weight: 600; color: var(--txt-3); font-variant-numeric: tabular-nums; }
.cal-slot-ghost { position: absolute; left: 66px; right: 14px; top: 6px; height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 1px dashed color-mix(in oklch, var(--accent) 45%, transparent); }
.cal-now { position: absolute; left: 56px; right: 8px; height: 0; z-index: 5; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: 10px; right: 0; top: -1px; height: 2px; background: var(--red); }
.cal-now-dot { position: absolute; left: 4px; top: -5px; width: 11px; height: 11px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px color-mix(in oklch, var(--red) 22%, transparent); }
.cal-now-lbl { position: absolute; right: 0; top: -9px; font-size: 11px; font-weight: 700; color: #fff; background: var(--red); padding: 1px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) { .cal-now-dot { animation: nowPulse 2.4s ease-in-out infinite; } }
@keyframes nowPulse { 0%, 100% { box-shadow: 0 0 0 4px color-mix(in oklch, var(--red) 22%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in oklch, var(--red) 8%, transparent); } }
.cal-event { position: absolute; left: 70px; right: 16px; border-radius: 11px; border: 0.5px solid; -webkit-backdrop-filter: var(--blur-lite); backdrop-filter: var(--blur-lite); display: flex; overflow: hidden; padding: 7px 10px 7px 0; box-shadow: var(--g-shadow-sm); z-index: 3; }
.cal-ev-bar { width: 4px; border-radius: 4px; flex-shrink: 0; margin: 0 10px; }
.cal-ev-body { flex: 1; min-width: 0; }
.cal-ev-title { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev-time { font-size: 12px; color: var(--txt-2); margin-top: 2px; }
.cal-ev-del { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--txt-3); opacity: 0; transition: opacity .15s, background .15s, color .15s; flex-shrink: 0; align-self: center; }
.cal-event:hover .cal-ev-del { opacity: 1; }
.cal-ev-del:hover { background: color-mix(in oklch, var(--red) 14%, transparent); color: var(--red); }
.cal-empty { position: absolute; top: 44%; left: 0; right: 0; text-align: center; pointer-events: none; }
.cal-empty-t { font-size: 15px; font-weight: 650; color: var(--txt-2); }
.cal-empty-s { font-size: 13px; color: var(--txt-3); margin-top: 6px; }
.cal-rt-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.cal-flabel { display: block; font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--txt-3); text-transform: uppercase; margin: 14px 2px 7px; }
.cal-flabel:first-of-type { margin-top: 0; }
.cal-quick-when { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--field); border: 0.5px solid var(--g-border); font-size: 14px; font-weight: 600; color: var(--txt-2); }
.cal-check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.cal-box { width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--field); border: 1.5px solid var(--g-border); transition: background .15s, border-color .15s; }
.cal-box.on { background: linear-gradient(150deg, var(--accent), var(--accent-2)); border-color: transparent; }
.cal-colors { display: flex; gap: 10px; }
.cal-color { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 2px 6px -2px rgba(0,0,0,0.25); transition: transform .12s; }
.cal-color:hover { transform: scale(1.1); }
.cal-color.on { border-color: var(--g-bg); box-shadow: 0 0 0 2px var(--txt-2), inset 0 1px 0 rgba(255,255,255,0.3); }
.cal-form-actions { display: flex; gap: 10px; margin-top: 20px; }
.cal-form-actions .btn-primary, .cal-form-actions .btn-ghost { flex: 1; }
.cal-ai-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin: 26px 0 12px; }
.cal-ai-empty { text-align: center; font-size: 13px; color: var(--txt-3); padding: 22px 0; background: var(--field); border: 0.5px dashed var(--g-border); border-radius: 14px; }

/* ---- redesigned event form ---- */
.cal-title-input { font-size: 16px; font-weight: 650; }
.cal-datestep { display: flex; align-items: center; gap: 8px; }
.cal-step { width: 38px; height: 42px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--txt-2); background: var(--field); border: 0.5px solid var(--g-border); cursor: pointer; transition: background .14s, color .14s; }
.cal-step:hover { background: var(--hover); color: var(--accent); }
.cal-datestep-lbl { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 12px; background: var(--field); border: 0.5px solid var(--g-border); font-size: 14px; font-weight: 650; }
.cal-allday { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding: 12px 15px; border-radius: 13px; background: var(--field); border: 0.5px solid var(--g-border); font-size: 14.5px; font-weight: 600; cursor: pointer; }
.cal-timeselect .gsel, .cal-timeselect .gsel-btn { width: 100%; }
.cal-timeselect .gsel-btn { height: 46px; }
.cal-durs { display: flex; flex-wrap: wrap; gap: 7px; }
.cal-dur { padding: 9px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 650; color: var(--txt-2); background: var(--field); border: 0.5px solid var(--g-border); cursor: pointer; transition: all .13s; }
.cal-dur:hover { color: var(--txt); background: var(--hover); }
.cal-dur.on { color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 6px 16px -8px var(--accent-soft-2); }
.cal-endline { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding: 11px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 13.5px; color: var(--txt-2); }
.cal-endline b { color: var(--txt); font-weight: 700; }
.cal-end-dur { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--g-bg-strong); padding: 2px 9px; border-radius: 8px; }
.btn-primary.disabled { opacity: .45; pointer-events: none; box-shadow: none; }

/* ====================== MESSAGE CONTEXT MENU ====================== */
.msg-menu-btn { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--txt-3); background: var(--g-bg); border: 0.5px solid var(--g-border-2); opacity: 0; transition: opacity .15s, background .15s, color .15s; -webkit-backdrop-filter: var(--blur-lite); backdrop-filter: var(--blur-lite); }
.msg-row:hover .msg-menu-btn { opacity: 1; }
.msg-menu-btn:hover { color: var(--txt); background: var(--hover); }
.msg-row.tappable { cursor: pointer; border-radius: 16px; padding: 2px 6px; margin: 0 -6px; transition: background .16s ease; }
/* no full-row hover fill (it read as a big dark box over the wallpaper) — the
   hover-revealed menu button is the affordance; keep only a faint tap feedback */
.msg-row.tappable:hover { background: transparent; }
.msg-row.tappable:active { background: transparent; }
.bubble-reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; clear: both; }
.reaction-chip { font-size: 14px; line-height: 1; padding: 4px 8px; border-radius: 12px; background: var(--accent-soft); border: 0.5px solid color-mix(in oklch, var(--accent) 25%, transparent); animation: reactPop .42s cubic-bezier(.2,.8,.3,1.5) both; }
.reaction-chip { display: inline-flex; align-items: center; gap: 2px; }
.reaction-chip.on-sent { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.3); }
/* my own reaction — solid accent, like Telegram's highlighted pill (audit #26) */
.reaction-chip.mine { background: var(--accent); border-color: var(--accent); }
.reaction-chip.mine.on-sent { background: rgba(255,255,255,0.9); border-color: #fff; }
.reaction-count { font-size: 12px; font-weight: 700; opacity: 0.85; }
.reaction-chip.mine .reaction-count { color: #fff; opacity: 1; }
/* mine-on-sent chip is near-white → the count needs a dark/accent colour, not the bubble's white text */
.reaction-chip.mine.on-sent .reaction-count { color: var(--accent); }
@keyframes reactPop { 0% { transform: scale(0) rotate(-14deg); } 55% { transform: scale(1.35) rotate(5deg); } 100% { transform: none; } }
.msg-cm-overlay { position: fixed; inset: 0; z-index: 80; }
.msg-cm-scrim { position: absolute; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: cmFade .2s ease; }
.msg-cm-clone { position: fixed; z-index: 82; animation: cmLift .3s cubic-bezier(.2,.8,.3,1.15) both; }
.msg-cm-clone .bubble { max-width: none !important; width: 100%; margin: 0; }
@keyframes cmLift { 0% { transform: scale(.97); } 60% { transform: scale(1.035); } 100% { transform: scale(1.02); } }
@keyframes cmFade { from { opacity: 0; } to { opacity: 1; } }
.msg-cm-overlay.closing .msg-cm-scrim { animation: cmScrimOut .38s ease forwards; }
.msg-cm-overlay.closing .msg-cm-menu { animation: cmMenuOut .26s ease forwards; }
.msg-cm-overlay.closing .msg-cm-clone { animation: cmCloneOut .38s ease forwards; }
@keyframes cmScrimOut { to { opacity: 0; } }
@keyframes cmMenuOut { to { opacity: 0; transform: scale(.94) translateY(-6px); } }
@keyframes cmCloneOut { to { transform: scale(1); } }
.msg-cm-react { position: fixed; z-index: 84; display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 26px; animation: cmPop .24s cubic-bezier(.2,.8,.3,1.1) both; transition: border-radius .25s ease, padding .25s ease; }
.msg-cm-react.expanded { align-items: flex-start; border-radius: 24px; padding: 9px; }
.msg-cm-react .rx-grid { display: flex; align-items: center; gap: 2px; }
.msg-cm-react.expanded .rx-grid { display: grid; grid-template-columns: repeat(7, 44px); gap: 3px; }
.msg-cm-react .rx { width: 44px; height: 44px; border-radius: 50%; font-size: 24px; line-height: 1; display: flex; align-items: center; justify-content: center; opacity: 0; animation: cmEmoji .32s cubic-bezier(.2,.8,.3,1.3) both; transition: transform .16s, background .14s, box-shadow .14s; will-change: transform; }
.msg-cm-react .rx:hover { transform: scale(1.32) translateY(-3px); background: var(--hover); }
.msg-cm-react .rx.active { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
.msg-cm-react .rx-more { width: 38px; height: 44px; border-radius: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--txt-2); transition: background .14s, color .14s; }
.msg-cm-react.expanded .rx-more { width: 40px; height: 40px; border-radius: 50%; background: var(--field); }
.msg-cm-react .rx-more:hover { background: var(--hover); color: var(--txt); }
.msg-cm-react.picked .rx:not(.chosen) { opacity: .18 !important; transform: scale(.6); pointer-events: none; }
.msg-cm-react.picked .rx-more { opacity: .18; pointer-events: none; }
.msg-cm-react .rx.chosen { animation: rxChosen .42s cubic-bezier(.2,.8,.3,1.5) both; z-index: 3; }
@keyframes rxChosen { 0% { transform: scale(1); } 40% { transform: scale(1.75) translateY(-8px); } 100% { transform: scale(1.25) translateY(-3px); } }
@keyframes cmEmoji { 0% { opacity: 0; transform: scale(.4) translateY(8px); } 100% { opacity: 1; transform: none; } }
@keyframes cmPop { 0% { opacity: 0; transform: scale(.85) translateY(6px); } 100% { opacity: 1; transform: none; } }
.msg-cm-menu { position: fixed; z-index: 84; min-width: 226px; max-width: 280px; border-radius: 18px; padding: 6px; animation: cmMenu .2s cubic-bezier(.2,.8,.3,1) both; }
.msg-cm-menu.below { transform-origin: top; }
.msg-cm-menu.above { transform-origin: bottom; }
@keyframes cmMenu { 0% { opacity: 0; transform: scale(.9) translateY(-4px); } 100% { opacity: 1; transform: none; } }
.msg-cm-item { display: flex; align-items: center; gap: 14px; padding: 11px 13px; border-radius: 12px; font-size: 14.5px; font-weight: 600; color: var(--txt); cursor: pointer; transition: background .14s; }
.msg-cm-item:hover { background: var(--hover); }
.msg-cm-item .ci-ic { color: var(--txt-2); display: flex; }
.msg-cm-item.danger, .msg-cm-item.danger .ci-ic { color: var(--red); }
.msg-cm-sep { height: 0.5px; background: var(--g-border-2); margin: 5px 10px; }
.cm-toast { position: absolute; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 70; padding: 11px 20px; border-radius: 14px; font-size: 14px; font-weight: 600; color: var(--txt); animation: cmFade .2s ease; }

/* ====================== BRAND LOGO ====================== */
.brand-logo { background-image: url("assets/gluline-logo.svg?v=1"); background-size: contain; background-repeat: no-repeat; background-position: center; }
.app[data-theme="dark"] .brand-logo { background-image: url("assets/gluline-logo.svg?v=1"); }
.sb-brand { display: flex; align-items: center; gap: 9px; padding: 2px 4px 11px; cursor: pointer; width: fit-content; align-self: center; transition: opacity .15s; }
.sb-brand:active { opacity: .6; }
.sb-brand .brand-logo { width: 26px; height: 26px; flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.16)); }
.sb-brand .brand-word { font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }
.brand-foot { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 16px 0 8px; opacity: 0.72; }
.brand-foot .brand-logo { width: 20px; height: 20px; flex-shrink: 0; }
.brand-foot .bf-text { font-size: 12.5px; font-weight: 700; letter-spacing: .3px; color: var(--txt-3); }

.search-x { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: background .14s; }
.search-x:hover { background: var(--hover); }

/* ====================== FOLDER MANAGER ====================== */
.fm-card { width: 440px; max-width: calc(100vw - 32px); padding: 0; display: flex; flex-direction: column; max-height: min(86vh, 700px); }
.fm-card .modal-head { padding: 16px 18px 12px; }
.fm-scroll { overflow-y: auto; padding: 0 20px 20px; }
.fm-intro { font-size: 13px; color: var(--txt-2); line-height: 1.5; margin-bottom: 16px; }
.fm-list { display: flex; flex-direction: column; gap: 6px; }
.fm-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 15px; background: var(--field); border: 0.5px solid var(--g-border); cursor: pointer; transition: background .14s; }
.fm-row:hover { background: var(--hover); }
.fm-row-ic { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.fm-row-b { flex: 1; min-width: 0; }
.fm-row-n { font-size: 14.5px; font-weight: 650; }
.fm-row-s { font-size: 12px; color: var(--txt-3); margin-top: 1px; }
.fm-ico-btn { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--txt-3); transition: background .14s, color .14s; }
.fm-ico-btn:hover { background: var(--press); color: var(--txt); }
.fm-ico-btn.danger:hover { color: var(--red); }
.fm-create { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin-top: 16px; padding: 13px; border-radius: 14px; font-size: 14.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); cursor: pointer; transition: background .15s; }
.fm-create:hover { background: var(--accent-soft-2); }
.fm-search { margin-bottom: 10px; padding: 10px 14px; font-size: 14px; }
.fm-chats { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; margin-bottom: 16px; }

/* ====================== AUTH ====================== */
.auth-screen { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; background: var(--wall, linear-gradient(160deg, oklch(0.94 0.03 195), oklch(0.9 0.05 205))); }
.auth-card { width: 410px; max-width: calc(100vw - 32px); border-radius: 28px; padding: 34px 30px 26px; display: flex; flex-direction: column; }
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 24px; }
.auth-logo { width: 38px; height: 38px; flex-shrink: 0; background-image: url("assets/gluline-logo.svg?v=1"); background-size: contain; background-repeat: no-repeat; background-position: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.16)); }
.app[data-theme="dark"] .auth-logo { background-image: url("assets/gluline-logo.svg?v=1"); }
.auth-word { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.auth-title { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; text-align: center; }
.auth-sub { font-size: 14px; color: var(--txt-2); text-align: center; margin-top: 8px; margin-bottom: 22px; line-height: 1.5; }
.auth-seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--field); margin-bottom: 18px; }
.auth-seg button { flex: 1; padding: 9px; border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--txt-2); transition: all .15s; }
.auth-seg button.on { background: var(--g-bg-strong); color: var(--accent); box-shadow: var(--g-shadow-sm); }
.auth-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.auth-lbl { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--txt-3); margin-left: 2px; }
.auth-field input { height: 50px; padding: 0 16px; border-radius: 14px; background: var(--field); border: 0.5px solid var(--g-border); font-size: 15px; color: var(--txt); outline: none; transition: border-color .15s; }
.auth-field input:focus { border-color: var(--accent); }
.auth-forgot { align-self: flex-end; font-size: 13px; font-weight: 600; color: var(--accent); margin: -4px 2px 4px 0; }
.auth-submit { height: 52px; margin-top: 10px; border-radius: 15px; font-size: 15.5px; font-weight: 700; color: #fff; background: var(--field); color: var(--txt-3); cursor: not-allowed; transition: all .18s; }
.auth-submit.ready { background: linear-gradient(150deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 12px 28px -10px var(--accent-soft-2); cursor: pointer; }
.auth-submit.ready:hover { transform: translateY(-1px); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--txt-3); font-size: 12.5px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--g-border); }
.auth-alt { display: flex; align-items: center; justify-content: center; gap: 10px; height: 50px; border-radius: 14px; font-size: 14.5px; font-weight: 650; color: var(--txt); cursor: pointer; transition: transform .14s; }
.auth-alt:hover { transform: translateY(-1px); }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--txt-2); margin-top: 20px; }
.auth-switch button { color: var(--accent); font-weight: 700; }

/* ---- auth (new design): back, terms, otp, qr, shield ---- */
.auth-back { align-self: flex-start; display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; color: var(--txt-2); padding: 4px 8px 4px 4px; border-radius: 10px; margin-bottom: 4px; transition: background .14s, color .14s; }
.auth-back:hover { background: var(--hover); color: var(--txt); }
.auth-terms { font-size: 11.5px; color: var(--txt-3); line-height: 1.5; margin: -2px 2px 4px; }
.auth-resend { align-self: center; font-size: 13.5px; font-weight: 650; color: var(--accent); margin: 18px 0 6px; }
.auth-switch-btn { font-size: 13.5px; font-weight: 700; color: var(--accent); margin-top: 18px; }
.auth-shield { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 17px; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 28px -10px var(--accent-soft-2); }

.otp-row { position: relative; display: flex; gap: 9px; justify-content: center; margin: 22px 0 4px; }
.otp-hidden { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.otp-box { width: 46px; height: 56px; border-radius: 14px; background: var(--field); border: 1.5px solid var(--g-border); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: var(--txt); transition: border-color .15s, background .15s; }
.otp-box.filled { border-color: var(--accent); background: var(--g-bg-strong); }
.otp-box.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.qr-wrap { position: relative; width: max-content; max-width: 100%; margin: 8px auto 4px; padding: 16px; border-radius: 22px; background: #fff; box-shadow: var(--g-shadow-sm), inset 0 0 0 1px rgba(20,40,54,0.06); }
/* Size the center logo as a FRACTION of the QR, not a fixed 46px: the device-
   link QR renders at min(208px,60vw), so a fixed logo would occupy a growing
   share on narrow viewports and eventually exceed the ECC-M ~15% damage budget,
   making the (security-critical) QR undecodable. min(46px,19%) keeps the full-
   size look while capping occlusion at ~4% area on any width. */
.qr-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(46px, 19%); height: min(46px, 19%); border-radius: 13px; background-image: url("assets/gluline-logo.svg?v=1"); background-size: 74%; background-repeat: no-repeat; background-position: center; background-color: #fff; box-shadow: 0 2px 10px rgba(20,40,54,0.18), 0 0 0 4px #fff; }
.app[data-theme="dark"] .qr-logo { background-image: url("assets/gluline-logo.svg?v=1"); }
.qr-steps { display: flex; flex-direction: column; gap: 11px; text-align: left; margin: 20px 2px 4px; }
.qr-step { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--txt-2); }
.qr-step-n { width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: var(--accent); background: var(--accent-soft); }
.qr-status { display: inline-flex; align-items: center; gap: 9px; margin: 18px auto 0; padding: 9px 16px; border-radius: 13px; background: var(--field); font-size: 13px; font-weight: 600; color: var(--txt-2); }
.qr-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: recBlink 1.3s ease-in-out infinite; }

/* ====================== IN-CHAT SEARCH ====================== */
.chat-search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-shrink: 0; animation: csDown .22s cubic-bezier(.2,.8,.3,1) both; }
@keyframes csDown { 0% { opacity: 0; transform: translateY(-8px); } 100% { opacity: 1; transform: none; } }
.cs-field { flex: 1; display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px; border-radius: 21px; background: var(--field); border: 0.5px solid var(--g-border); }
.cs-field input { flex: 1; background: none; border: none; outline: none; font-size: 14.5px; color: var(--txt); }
.cs-field input::placeholder { color: var(--txt-3); }
.cs-date-btn { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--txt-2); transition: background .14s, color .14s; }
.cs-date-btn.on, .cs-date-btn:hover { background: var(--accent-soft); color: var(--accent); }
.cs-close { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--txt-2); transition: background .14s; }
.cs-close:hover { background: var(--hover); }
.cs-datebar { display: flex; align-items: center; gap: 10px; padding: 0 16px 10px; flex-shrink: 0; animation: csDown .2s ease both; }
.cs-datebar input { height: 40px; padding: 0 14px; border-radius: 13px; background: var(--field); border: 0.5px solid var(--g-border); font-size: 14px; color: var(--txt); outline: none; font-family: inherit; }
.cs-result-note { font-size: 12.5px; color: var(--txt-3); padding: 0 4px; }
.search-hl { background: var(--accent-soft-2); border-radius: 4px; padding: 0 1px; color: var(--accent-txt); font-weight: 600; }

/* ====================== EMOJI PICKER ====================== */
.emoji-wrap { position: relative; flex-shrink: 0; }
.emoji-scrim { position: fixed; inset: 0; z-index: 40; }
.emoji-pop { position: absolute; bottom: calc(100% + 14px); left: -6px; z-index: 50; width: 320px; max-width: calc(100vw - 32px); padding: 12px; border-radius: 22px; background: var(--pop-bg); transform-origin: bottom left; animation: attachPop .2s cubic-bezier(.2,.8,.3,1.1) both; }
.emoji-tabs { display: flex; gap: 4px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 0.5px solid var(--g-border-2); }
.emoji-tab { width: 38px; height: 36px; border-radius: 10px; font-size: 20px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: background .14s; }
.emoji-tab:hover { background: var(--hover); }
.emoji-tab.on { background: var(--accent-soft); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 188px; overflow-y: auto; }
.emoji-cell { height: 36px; border-radius: 9px; font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; animation: cmEmoji .26s ease forwards; transition: transform .12s, background .12s; }
.emoji-cell:hover { background: var(--hover); transform: scale(1.22); }

/* ====================== VOICE / VIDEO RECORDER ====================== */
.rec-toggle-ic { display: flex; animation: recSwap .26s cubic-bezier(.2,.8,.3,1.3); }
@keyframes recSwap { 0% { transform: scale(.4) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.rec-toggle:active { transform: scale(.9); }
.rec-bar { align-items: center !important; gap: 12px; padding-left: 18px; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--red); flex-shrink: 0; animation: recBlink 1.1s ease-in-out infinite; }
@keyframes recBlink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.3; transform: scale(0.8); } }
.rec-time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--txt); flex-shrink: 0; min-width: 42px; }
.rec-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 30px; overflow: hidden; }
.rec-wave i { flex: 1; min-width: 2px; max-width: 4px; background: var(--accent); border-radius: 2px; height: 20%; animation: recWave 0.9s ease-in-out infinite; }
@keyframes recWave { 0%, 100% { height: 18%; } 50% { height: 90%; } }
.rec-wave.live { justify-content: flex-end; gap: 2px; }
.rec-wave.live i { flex: 0 0 auto; width: 3px; min-width: 3px; max-width: 3px; height: 12px; background: var(--accent); animation: none; transition: height .08s linear; }
.rec-vid { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, var(--accent), var(--accent-2)); position: relative; }
.rec-vid-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent); animation: callRing 1.6s ease-out infinite; }
.rec-hint { flex: 1; font-size: 13.5px; color: var(--txt-3); }
.rec-trash { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--red); transition: background .14s; }
.rec-trash:hover { background: color-mix(in oklch, var(--red) 12%, transparent); }

/* ====================== VIDEO NOTE MESSAGE ====================== */
.vnote { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vnote-circle { width: 180px; height: 180px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; box-shadow: var(--g-shadow), inset 0 2px 0 rgba(255,255,255,0.2); overflow: hidden; cursor: pointer; }
.vnote-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.vnote-ring circle { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 295; stroke-dashoffset: 295; opacity: 0.9; }
/* Ring fill is driven from real playback progress in JS (VNOTE_RING_CIRC +
   mediaChain.onTick sets stroke-dashoffset per frame) — the ободок tracks the
   video timer, not a fixed clock. The .on class stays as a playing-state hook. */
.vnote-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--txt-2); }
.vnote-meta.sent { color: var(--accent-txt); }
.vnote-time { display: flex; align-items: center; gap: 4px; color: var(--txt-3); margin-left: 4px; }

/* ====================== INCOMING CALL ====================== */
.incall { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 150; animation: incallDrop .4s cubic-bezier(.2,.8,.3,1.2) both; }
@keyframes incallDrop { 0% { opacity: 0; transform: translate(-50%, -24px); } 100% { opacity: 1; transform: translate(-50%, 0); } }
.incall-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 22px; width: 420px; max-width: calc(100vw - 32px); box-shadow: var(--g-shadow), 0 18px 40px -16px rgba(20,40,54,0.4); }
.incall-av-wrap { position: relative; flex-shrink: 0; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; }
.incall-av { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; font-weight: 700; position: relative; z-index: 2; }
.incall-ring { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.incall-ring.r1 { animation: callRing 2s ease-out infinite; }
.incall-ring.r2 { animation: callRing 2s ease-out infinite 1s; }
.incall-body { flex: 1; min-width: 0; }
.incall-name { font-size: 16px; font-weight: 700; }
.incall-sub { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--txt-2); margin-top: 2px; }
.incall-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: recBlink 1.1s ease-in-out infinite; }
.incall-actions { display: flex; gap: 10px; flex-shrink: 0; }
.incall-btn { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .14s; }
.incall-btn:hover { transform: scale(1.08); }
.incall-btn.accept { background: linear-gradient(150deg, #2ec27a, #1d9d5e); box-shadow: 0 8px 20px -8px rgba(29,157,94,0.6); animation: incallWiggle 1.4s ease-in-out infinite; }
.incall-btn.decline { background: linear-gradient(150deg, #ff5a52, #e02d24); box-shadow: 0 8px 20px -8px rgba(224,45,36,0.6); }
.incall-btn.decline svg { transform: rotate(135deg); }
@keyframes incallWiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

/* ====================== MINI DATE PICKER ====================== */
.dp-pop { width: 280px; padding: 14px; border-radius: 20px; background: var(--pop-bg); animation: attachPop .2s cubic-bezier(.2,.8,.3,1.1) both; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dp-title { font-size: 14.5px; font-weight: 700; }
.dp-nav { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--txt-2); transition: background .14s; }
.dp-nav:hover { background: var(--hover); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-wd { margin-bottom: 4px; }
.dp-wd-c { text-align: center; font-size: 11px; font-weight: 700; color: var(--txt-3); padding: 4px 0; }
.dp-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--txt); cursor: pointer; transition: background .12s, color .12s; }
.dp-cell.empty { cursor: default; }
.dp-cell:not(.empty):hover { background: var(--hover); }
.dp-cell.today { color: var(--accent); font-weight: 800; }
.dp-cell.sel { background: linear-gradient(150deg, var(--accent), var(--accent-2)); color: #fff; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 0.5px solid var(--g-border-2); }
.dp-foot-btn { font-size: 13px; font-weight: 650; color: var(--txt-2); padding: 5px 8px; border-radius: 8px; transition: background .14s; }
.dp-foot-btn:hover { background: var(--hover); }
.dp-foot-btn.accent { color: var(--accent); }
.cs-datebar.open { flex-direction: column; align-items: flex-start; gap: 8px; }

/* ====================== VIDEO RECORDING OVERLAY ====================== */
.vrec-overlay { position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(10,20,28,0.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: cmFade .2s ease; }
.vrec-circle { position: relative; width: 280px; height: 280px; border-radius: 50%; overflow: hidden; box-shadow: 0 24px 60px -18px rgba(0,0,0,0.6); }
.vrec-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #1a2430; }
.vrec-ring { position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--accent); box-shadow: 0 0 0 3px rgba(255,255,255,0.15) inset; animation: vrecPulse 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes vrecPulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(255,255,255,0.15) inset, 0 0 0 0 var(--accent-soft-2); } 50% { box-shadow: 0 0 0 3px rgba(255,255,255,0.15) inset, 0 0 0 10px transparent; } }
.vrec-badge { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 20px; background: rgba(0,0,0,0.5); color: #fff; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vrec-hint { color: rgba(255,255,255,0.85); font-size: 14px; font-weight: 600; }
.vrec-acts { display: flex; gap: 14px; }
.vrec-cancel, .vrec-send { display: flex; align-items: center; gap: 9px; height: 50px; padding: 0 24px; border-radius: 25px; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .14s; }
.vrec-cancel { background: rgba(255,255,255,0.14); color: #fff; }
.vrec-send { background: linear-gradient(150deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 10px 26px -10px var(--accent-soft-2); }
.vrec-cancel:hover, .vrec-send:hover { transform: translateY(-2px); }

/* ====================== SETTINGS TOAST + CONFIRM ====================== */
.set-toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 95; padding: 12px 22px; border-radius: 14px; font-size: 14px; font-weight: 650; color: var(--txt); box-shadow: var(--g-shadow); animation: toastUp .26s cubic-bezier(.2,.8,.3,1.1) both; }
/* global engine→UI toast — server-rejected send reason (audit #27) */
.glu-toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 200; max-width: min(90vw, 460px); padding: 12px 20px; border-radius: 14px; font-size: 14px; font-weight: 650; text-align: center; color: var(--txt); box-shadow: var(--g-shadow); cursor: pointer; animation: toastUp .26s cubic-bezier(.2,.8,.3,1.1) both; }
/* lift clear of the composer + tab bar on mobile so it doesn't cover the input */
@media (max-width: 900px) { .glu-toast { bottom: calc(132px + var(--safe-bottom, 0px)); } }
@keyframes toastUp { 0% { opacity: 0; transform: translate(-50%, 12px); } 100% { opacity: 1; transform: translate(-50%, 0); } }
.confirm-card { width: 380px; max-width: calc(100vw - 32px); padding: 26px 24px 20px; text-align: center; }
.confirm-ic { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 24px -10px var(--accent-soft-2); }
.confirm-ic.danger { background: linear-gradient(150deg, var(--red), oklch(0.52 0.18 18)); box-shadow: none; }
.confirm-title { font-size: 17px; font-weight: 700; }
.confirm-body { font-size: 13.5px; color: var(--txt-2); line-height: 1.5; margin-top: 9px; }
.confirm-actions { display: flex; gap: 10px; margin-top: 22px; }
.confirm-actions .btn-ghost, .confirm-actions .btn-primary { flex: 1; }
.btn-primary.danger { background: linear-gradient(150deg, var(--red), oklch(0.52 0.18 18)); }
.btn-ghost[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ====================== AVATAR IMAGE (butler / user photo) ====================== */
.butler-ava { overflow: hidden; }
.butler-ava img { width: 100%; height: 100%; object-fit: cover; }

/* ====================== ATTACHMENT CHIP (composer) ====================== */
.attach-chip { display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 0 4px 8px; border-radius: 16px; animation: attachPop .2s cubic-bezier(.2,.8,.3,1.1) both; }
.attach-chip-thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.attach-chip-ic { width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.attach-chip-meta { flex: 1; min-width: 0; }
.attach-chip-name { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-chip-size { font-size: 12px; color: var(--txt-3); margin-top: 1px; }
.attach-chip-x { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--txt-3); transition: background .14s, color .14s; }
.attach-chip-x:hover { background: var(--hover); color: var(--txt); }

/* ====================== BUBBLE IMAGE / FILE ====================== */
/* Thin the coloured frame around media ~2x (was 5px/7px). Media-only bubbles get
   a uniform 2px edge; captioned media keeps a little more bottom for the text. */
.bubble.has-img { padding: 2px; }
.bubble.has-img:not(.mo) { padding-bottom: 4px; }
/* Media-only: no bottom margin under the image, so the frame stays even (the
   time is overlaid, not stacked below). */
.bubble.mo .bubble-photo, .bubble.mo .bubble-img, .bubble.mo .bubble-spoiler { margin-bottom: 0; }
/* Corner time-pill overlaid on a single photo/video (bubble-relative, since the
   bubble is position:relative and only 2px-inset from the media). */
.media-meta { position: absolute; right: 7px; bottom: 7px; z-index: 3; display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,0.45); color: #fff; font-size: 11px; font-weight: 600; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); pointer-events: none; }
.bubble-img { display: block; max-width: 280px; width: 100%; border-radius: 14px; margin-bottom: 4px; }
/* Progressive photo: aspect-locked container reserves the right box BEFORE the
   full image loads (no layout jump); blur preview underneath, full image fades
   in on top (blur-up). */
.bubble-photo { position: relative; display: block; width: 100%; max-width: 280px; border-radius: 14px; overflow: hidden; margin-bottom: 4px; background: var(--hover); }
.bubble-photo .bubble-img-blur { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px); transform: scale(1.08); margin: 0; border-radius: 0; }
.bubble-photo .bubble-img.in-photo { position: relative; width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; animation: bubblePhotoFade .22s ease-out; }
@keyframes bubblePhotoFade { from { opacity: 0; } to { opacity: 1; } }
/* Once the full photo has decoded (.photo-ready), drop the blur-up preview's
   GPU-promoting filter/transform so the photo subtree paints into the shared
   scroller raster — otherwise it sits on its own composited layer that the
   sticky glass header/composer's backdrop-filter cannot sample (photo shows
   crisp through the glass). The blur is fully covered by the opaque full image
   by now, so removing its blur is invisible. */
.bubble-photo.photo-ready .bubble-img-blur { filter: none; transform: none; }
/* Loading spinner shown over the blur preview while the full image downloads. */
.bubble-photo-spin { position: absolute; top: 50%; left: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.45); border-top-color: #fff; animation: bubblePhotoSpin .7s linear infinite; }
@keyframes bubblePhotoSpin { to { transform: rotate(360deg); } }
/* Regular (non-note) video bubble: first-frame poster + centred play badge. */
.bubble-video .bubble-video-play { position: absolute; top: 50%; left: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; pointer-events: none; backdrop-filter: blur(2px); }

/* ── Full-screen media preview (lightbox) ── */
.media-lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(6,10,16,0.94); display: flex; align-items: center; justify-content: center; animation: mlFade .16s ease-out; }
@keyframes mlFade { from { opacity: 0; } to { opacity: 1; } }
.media-lightbox .ml-media { max-width: 94vw; max-height: 86vh; width: auto; height: auto; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.media-lightbox video.ml-media { background: #000; }
.ml-topbar { position: absolute; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 16px; z-index: 2; background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent); }
.ml-topbar .ml-count { flex: 1; text-align: center; color: rgba(255,255,255,0.85); font-size: 14px; font-weight: 600; }
.ml-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.12); color: #fff; transition: background .14s; }
.ml-btn:hover { background: rgba(255,255,255,0.22); }
.ml-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.1); color: #fff; font-size: 30px; line-height: 1; transition: background .14s; }
.ml-nav:hover { background: rgba(255,255,255,0.2); }
.ml-prev { left: 18px; }
.ml-next { right: 18px; }
.bubble.has-img > span:not(.meta):not(.media-meta) { padding: 0 8px; }
/* Media spoiler: blur the image behind a frosted cover until tapped. */
.bubble-spoiler { position: relative; display: block; cursor: pointer; margin-bottom: 4px; border-radius: 14px; overflow: hidden; }
.bubble-img.spoilered { margin-bottom: 0; filter: blur(22px); transform: scale(1.06); }
.bubble-spoiler-cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20,28,38,0.28); }
.bubble-spoiler-cover span { font-size: 13px; font-weight: 650; color: #fff; letter-spacing: .02em; padding: 5px 12px; border-radius: 999px; background: rgba(0,0,0,0.34); backdrop-filter: blur(4px); }
/* Per-attachment send-option toggle chips (send-as-file / spoiler). */
.attach-chip-opt { flex-shrink: 0; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--txt-3); background: var(--hover); transition: background .14s, color .14s; }
.attach-chip-opt.on { color: #fff; background: var(--accent); }

/* ── Media ALBUM grid (batch-sent photos/videos collapse into one bubble) ── */
.bubble.album-bubble { max-width: none; }
.album-grid { position: relative; display: flex; flex-direction: column; gap: 2px; border-radius: 14px; overflow: hidden; max-width: 100%; }
.album-grid-row { display: flex; gap: 2px; }
.album-tile { position: relative; overflow: hidden; background: var(--hover); flex: 0 0 auto; }
/* Tile layers stack in DOM order: blur → server thumb poster → full image/video. */
.album-tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; animation: bubblePhotoFade .22s ease-out; }
.album-tile-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.album-tile-blur { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(12px); transform: scale(1.08); }
.album-tile-play { position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; pointer-events: none; backdrop-filter: blur(2px); }
.album-tile-upload { position: absolute; inset: 0; background: rgba(10,16,24,0.28); }
.album-tile-fail { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; background: rgba(120,20,20,0.42); }
.album-meta { position: absolute; right: 6px; bottom: 6px; z-index: 3; display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,0.45); color: #fff; font-size: 11px; font-weight: 600; backdrop-filter: blur(4px); pointer-events: none; }
/* Staged multi-attachment strip in the composer. */
.attach-multi { display: flex; flex-wrap: wrap; gap: 6px; }
.attach-multi-item { position: relative; width: 54px; height: 54px; border-radius: 10px; overflow: hidden; background: var(--hover); flex-shrink: 0; }
.attach-multi-item img, .attach-multi-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-multi-doc { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.attach-multi-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1; color: #fff; background: rgba(0,0,0,0.55); }
.attach-multi-x:hover { background: rgba(0,0,0,0.75); }
/* Live batch-send counter above the input bar. */
.batch-progress { display: inline-flex; align-items: center; gap: 8px; margin: 0 4px 8px; padding: 7px 13px; border-radius: 14px; font-size: 12.5px; font-weight: 600; color: var(--txt-2); animation: attachPop .2s cubic-bezier(.2,.8,.3,1.1) both; }
.batch-progress.done { color: var(--accent); }
.batch-progress-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: bubblePhotoSpin .7s linear infinite; flex-shrink: 0; }

.bubble.has-img .meta { padding-right: 8px; }
.bubble-file { display: flex; align-items: center; gap: 11px; padding: 4px 2px 6px; }
.bf-ic { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.bf-name { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.bf-size { font-size: 12px; color: var(--txt-3); margin-top: 1px; }

/* ====================== 1 · ATTACH MENU (grid) ====================== */
.attach-wrap { position: relative; flex-shrink: 0; }
.attach-scrim { position: fixed; inset: 0; z-index: 40; }
.attach-pop { position: absolute; bottom: calc(100% + 14px); left: -6px; z-index: 50; width: 372px; max-width: calc(100vw - 32px); padding: 18px 18px 14px; border-radius: 24px; background: var(--pop-bg); transform-origin: bottom left; animation: attachPop .22s cubic-bezier(.2,.8,.3,1.1) both; }
@keyframes attachPop { 0% { opacity: 0; transform: scale(.9) translateY(10px); } 100% { opacity: 1; transform: none; } }
.attach-pop-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 16px; }
.attach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; }
.attach-cell { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 4px 2px; border-radius: 14px; cursor: pointer; opacity: 0; animation: attachItem .3s ease forwards; transition: transform .14s; }
@keyframes attachItem { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }
.attach-cell:hover { transform: translateY(-2px); }
.attach-cell:active { transform: scale(.94); }
.attach-bubble { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 18px -6px rgba(20,40,54,0.35), inset 0 1px 0 rgba(255,255,255,0.25); transition: box-shadow .15s; }
.attach-cell:hover .attach-bubble { box-shadow: 0 12px 24px -6px rgba(20,40,54,0.45), inset 0 1px 0 rgba(255,255,255,0.3); }
.attach-cell-lbl { font-size: 12.5px; font-weight: 600; color: var(--txt-2); white-space: nowrap; }
.attach-pop-foot { margin-top: 16px; padding-top: 13px; border-top: 0.5px solid var(--g-border-2); text-align: center; font-size: 12.5px; color: var(--txt-3); }

/* ====================== 2 · CREATE CHAT MODAL ====================== */
.cc-card { width: 440px; max-width: calc(100vw - 32px); padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: min(86vh, 720px); }
.cc-card .modal-head { padding: 18px 20px 12px; }
.cc-scroll { overflow-y: auto; padding: 0 20px 8px; display: flex; flex-direction: column; gap: 14px; }
.cc-secret { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border-radius: 15px; background: var(--accent-soft); border: 1px solid color-mix(in oklch, var(--accent) 42%, transparent); cursor: pointer; transition: background .15s, border-color .15s; }
.cc-secret:hover { background: var(--accent-soft-2); }
.cc-secret.on { background: var(--accent-soft-2); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cc-secret-ic { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); }
.cc-secret-t { font-size: 14.5px; font-weight: 700; }
.cc-secret-s { font-size: 12px; color: var(--txt-2); margin-top: 1px; }
.cc-segs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cc-seg { padding: 11px 14px; border-radius: 14px; text-align: left; background: var(--field); border: 1px solid var(--g-border); cursor: pointer; transition: background .15s, border-color .15s; }
.cc-seg:hover { background: var(--hover); }
.cc-seg.on { background: var(--g-bg-strong); border-color: color-mix(in oklch, var(--accent) 45%, transparent); box-shadow: var(--g-shadow-sm); }
.cc-seg-t { font-size: 14px; font-weight: 700; }
.cc-seg.on .cc-seg-t { color: var(--accent); }
.cc-seg-s { font-size: 11.5px; color: var(--txt-3); margin-top: 2px; }
.cc-field { display: flex; flex-direction: column; gap: 8px; }
.cc-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--txt-3); }
.cc-row-label { display: flex; align-items: center; justify-content: space-between; }
.cc-count { font-size: 11.5px; font-weight: 600; color: var(--txt-3); letter-spacing: .3px; }
.cc-search { display: flex; align-items: center; gap: 9px; padding: 0 13px; height: 44px; border-radius: 13px; background: var(--field); border: 0.5px solid var(--g-border); }
.cc-search input { flex: 1; background: none; border: none; outline: none; font-size: 14.5px; color: var(--txt); }
.cc-search input::placeholder { color: var(--txt-3); }
.cc-people { display: flex; flex-direction: column; gap: 2px; }
.cc-person { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; cursor: pointer; transition: background .14s; }
.cc-person:hover { background: var(--hover); }
.cc-person.on { background: var(--accent-soft); }
.cc-person-b { flex: 1; min-width: 0; text-align: left; }
.cc-person-n { font-size: 14.5px; font-weight: 650; }
.cc-person-s { font-size: 12px; color: var(--txt-3); margin-top: 1px; }
.cc-check { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid var(--g-border); display: flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s; }
.cc-check.on { background: linear-gradient(150deg, var(--accent), var(--accent-2)); border-color: transparent; }
.cc-create { margin: 4px 20px 20px; padding: 14px; border-radius: 15px; font-size: 15px; font-weight: 700; color: var(--txt-3); background: var(--field); border: 0.5px solid var(--g-border); cursor: not-allowed; transition: all .18s; }
.cc-create.ready { color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 24px -10px var(--accent-soft-2); cursor: pointer; }
.cc-create.ready:hover { transform: translateY(-1px); }

/* ====================== 3 · SEARCH PANEL ====================== */
.search-panel { flex: 1; overflow-y: auto; padding: 12px 14px; animation: spFade .22s ease both; }
@keyframes spFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sp-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--accent); padding: 6px 6px 10px; }
.sp-freq { display: flex; gap: 6px; overflow-x: auto; padding: 0 4px 6px; scrollbar-width: none; }
.sp-freq::-webkit-scrollbar { display: none; }
.sp-freq-item { flex-shrink: 0; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 8px 4px; border-radius: 14px; cursor: pointer; transition: background .14s; opacity: 0; animation: spPop .32s cubic-bezier(.2,.8,.3,1.2) forwards; }
.sp-freq-item:hover { background: var(--hover); }
@keyframes spPop { 0% { opacity: 0; transform: scale(.8) translateY(8px); } 100% { opacity: 1; transform: none; } }
.sp-freq-n { font-size: 12px; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sp-recent { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.sp-recent-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; cursor: pointer; transition: background .14s; opacity: 0; animation: spSlide .34s ease forwards; }
@keyframes spSlide { 0% { opacity: 0; transform: translateX(-8px); } 100% { opacity: 1; transform: none; } }
.sp-recent-item:hover { background: var(--hover); }
.sp-recent-b { flex: 1; min-width: 0; text-align: left; }
.sp-recent-n { font-size: 14.5px; font-weight: 650; }
.sp-recent-s { font-size: 12.5px; color: var(--txt-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-cancel { flex-shrink: 0; font-size: 14px; font-weight: 650; color: var(--accent); padding: 0 6px 0 10px; cursor: pointer; white-space: nowrap; }

/* Search VIEW — scope tabs over the frequent/recent panel or scoped results */
.search-view { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: spFade .2s ease both; }
.search-scopes { display: flex; gap: 7px; padding: 8px 14px 6px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.search-scopes::-webkit-scrollbar { display: none; }
.scope-chip { flex-shrink: 0; padding: 6px 15px; border: none; border-radius: 17px; background: var(--field); color: var(--txt-2); font-size: 13px; font-weight: 650; cursor: pointer; transition: background .16s, color .16s, transform .12s; }
.scope-chip:active { transform: scale(.96); }
.scope-chip.on { background: var(--accent); color: #fff; }
.search-results { flex: 1; overflow-y: auto; padding: 4px 14px 12px; }
.search-results .sp-recent-item { animation: spSlide .26s ease forwards; }
.sp-msg-time { float: right; font-size: 11.5px; font-weight: 500; color: var(--txt-3); margin-left: 8px; }

/* ====================== 4 · CALL SCREEN ====================== */
/* Full-bleed Telegram/FaceTime 1:1: the BIG feed fills the whole screen
   (object-fit cover, no letterbox); the OTHER feed is a tappable PiP. The
   gradient is the avatar-fallback backdrop (shows through when no video). */
.call-screen { position: fixed; inset: 0; z-index: 90; color: #fff; background: radial-gradient(120% 90% at 50% 30%, oklch(0.28 0.04 220), oklch(0.16 0.02 240) 60%, #07090d); animation: callIn .32s cubic-bezier(.2,.8,.3,1) both; overflow: hidden; }
@keyframes callIn { 0% { opacity: 0; transform: scale(1.03); } 100% { opacity: 1; transform: none; } }

/* ONE stacking container; both feeds live here permanently. */
.call-stage { position: absolute; inset: 0; }

/* A feed = its persistent <video> + an avatar fallback. Swapping only flips
   the is-big / is-pip class → size/position/z transition, never re-binding. */
.call-feed { position: absolute; overflow: hidden; transition: all .3s cubic-bezier(.2, .8, .3, 1); background: transparent; }
.call-feed.is-big { inset: 0; border-radius: 0; z-index: 1; }
.call-feed.is-pip { right: 16px; bottom: calc(104px + env(safe-area-inset-bottom)); width: 30%; max-width: 190px; aspect-ratio: 3 / 4; border-radius: 18px; border: 1.5px solid rgba(255,255,255,0.55); box-shadow: 0 14px 40px -16px rgba(0,0,0,0.7); z-index: 3; cursor: pointer; }
.call-feed.is-pip:active { transform: scale(.97); }
/* the persistent <video> the JSX appends fills the feed (inline styles also set
   this; kept here so any newly-appended node is covered immediately) */
.call-feed > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* avatar fallback — shown until .has-video, then hidden so the <video> shows */
.call-feed-fallback { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(120% 90% at 50% 35%, oklch(0.30 0.045 220), oklch(0.17 0.02 240) 65%, #07090d); }
.call-feed.has-video .call-feed-fallback { opacity: 0; pointer-events: none; }
.call-feed-fallback { transition: opacity .2s; }
.call-feed-av { width: 150px; height: 150px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 52px; font-weight: 700; color: #fff; box-shadow: 0 20px 60px -20px rgba(0,0,0,0.6), inset 0 2px 0 rgba(255,255,255,0.18); }
.call-feed-name { font-size: 24px; font-weight: 700; color: #fff; }
/* PiP fallback: just a small avatar filling the corner, no name */
.call-feed.is-pip .call-feed-av { width: 46%; height: auto; aspect-ratio: 1; font-size: 22px; box-shadow: none; }
.call-feed.is-pip .call-feed-fallback { gap: 0; }

/* top name+timer overlay + bottom controls overlay the video, with scrims */
.call-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 4; display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 24px calc(18px + 40px); background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0)); pointer-events: none; }
.call-bar > * { pointer-events: auto; }
.call-bar-name { font-size: 17px; font-weight: 700; }
.call-bar-sub { font-size: 13px; color: rgba(255,255,255,0.65); margin-top: 2px; font-variant-numeric: tabular-nums; }
.call-bar-right { display: flex; align-items: center; gap: 16px; }
.call-net { font-size: 11px; color: rgba(255,255,255,0.45); display: flex; flex-direction: column; gap: 2px; text-align: right; line-height: 1.3; }
.call-net b { color: rgba(255,255,255,0.7); letter-spacing: 1px; }
.call-controls { position: absolute; bottom: 0; left: 0; right: 0; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 14px; padding: calc(24px + 40px) 24px calc(34px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0)); }
.call-ctl { display: flex; align-items: center; gap: 9px; padding: 12px 20px; border-radius: 14px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.06); cursor: pointer; transition: background .15s, color .15s; }
.call-ctl:hover { background: rgba(255,255,255,0.14); }
.call-ctl.on { background: #fff; color: #15171c; }
.call-ctl-ic { display: flex; }
.call-hangup { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, #ff5a52, #e02d24); box-shadow: 0 12px 30px -8px rgba(224,45,36,0.6); cursor: pointer; transition: transform .14s; }
.call-hangup svg { transform: rotate(135deg); }
.call-hangup:hover { transform: scale(1.06); }
.call-hangup.sm { width: 42px; height: 42px; box-shadow: 0 8px 20px -8px rgba(224,45,36,0.6); }

/* ====================== GLU AI CHAT ====================== */
.glu-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.glu-scroll { flex: 1; overflow-y: auto; position: relative; }
.glu-thread { max-width: 860px; margin: 0 auto; padding: 150px 36px 128px; display: flex; flex-direction: column; gap: 18px; }
.glu-day { display: flex; justify-content: center; margin-bottom: 2px; }
.glu-day-chip { font-size: 12px; font-weight: 600; color: var(--txt-2); padding: 5px 13px; border-radius: 11px; }

.glu-msg { display: flex; gap: 11px; align-items: flex-start; }
.fade-up { animation: gluUp .34s cubic-bezier(.2,.8,.3,1) both; }
@keyframes gluUp { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }
.glu-ava { width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px -4px var(--accent-soft-2), inset 0 1px 0 rgba(255,255,255,0.3); margin-top: 2px; }
.glu-body { min-width: 0; max-width: 80%; display: flex; flex-direction: column; gap: 9px; }

.glu-card { border-radius: 6px 18px 18px 18px; padding: 14px 17px 12px; }
.glu-card.greet { background: var(--accent-soft); border-color: color-mix(in oklch, var(--accent) 30%, transparent); }
.glu-name { font-size: 12.5px; font-weight: 800; color: var(--accent); letter-spacing: .2px; display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.glu-badge { font-size: 9.5px; font-weight: 800; letter-spacing: .6px; color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); padding: 1.5px 6px; border-radius: 6px; }
.glu-text { font-size: 14.5px; line-height: 1.55; color: var(--txt); margin: 0; }
.glu-text + * { margin-top: 11px; }
.glu-text b { font-weight: 700; }
.glu-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--field); padding: 1px 6px; border-radius: 6px; }
.glu-time { font-size: 10.5px; color: var(--txt-3); margin-top: 9px; text-align: right; font-variant-numeric: tabular-nums; }

.glu-people { display: flex; flex-direction: column; gap: 4px; }
.glu-person { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 13px; background: var(--field); border: 0.5px solid var(--g-border-2); }
.glu-person-b { flex: 1; min-width: 0; }
.glu-person-h { display: flex; align-items: center; gap: 8px; }
.glu-person-n { font-size: 13.5px; font-weight: 700; }
.glu-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--red); background: color-mix(in oklch, var(--red) 14%, transparent); padding: 1.5px 6px; border-radius: 5px; }
.glu-person-t { font-size: 12.5px; color: var(--txt-2); margin-top: 2px; line-height: 1.4; }

.glu-tasks { display: flex; flex-direction: column; gap: 4px; }
.glu-task { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 13px; background: var(--field); border: 0.5px solid var(--g-border-2); }
.glu-date { width: 42px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 5px 0; border-radius: 10px; background: var(--accent-soft); }
.gd-day { font-size: 9.5px; font-weight: 800; letter-spacing: .5px; color: var(--accent); }
.gd-num { font-size: 17px; font-weight: 800; color: var(--accent); line-height: 1; }
.glu-task-b { flex: 1; min-width: 0; }
.glu-task-t { font-size: 13.5px; font-weight: 650; line-height: 1.35; }
.glu-task-s { font-size: 12px; color: var(--txt-3); margin-top: 2px; }

.glu-draft { border-radius: 14px; padding: 12px 15px; background: var(--field); border: 0.5px solid var(--g-border); border-left: 3px solid var(--accent); }
.glu-draft-q { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--accent); margin-bottom: 7px; }
.glu-draft p { font-size: 14px; line-height: 1.55; margin: 0; color: var(--txt); }

.glu-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 0.5px solid var(--g-border-2); font-size: 11.5px; color: var(--txt-3); }
.glu-src { font-size: 11px; font-weight: 600; color: var(--txt-2); background: var(--field); padding: 2px 8px; border-radius: 7px; }

.glu-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.glu-chip { display: flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 11px; font-size: 13px; font-weight: 650; color: var(--accent); background: var(--g-bg-strong); border: 0.5px solid color-mix(in oklch, var(--accent) 32%, transparent); cursor: pointer; transition: transform .12s, background .15s; }
.glu-chip:hover { transform: translateY(-1px); background: var(--accent-soft); }
.glu-chip.primary { color: #fff; background: linear-gradient(150deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 6px 16px -8px var(--accent-soft-2); }

.glu-suggest { display: flex; flex-wrap: wrap; gap: 7px; }
.glu-sug { padding: 8px 13px; border-radius: 11px; font-size: 13px; font-weight: 600; color: var(--txt-2); background: var(--field); border: 0.5px solid var(--g-border); cursor: pointer; transition: background .14s, color .14s; }
.glu-sug:hover { background: var(--hover); color: var(--accent); }

.glu-actions { display: flex; gap: 4px; padding-left: 2px; opacity: 0; transition: opacity .18s; }
.glu-msg:hover .glu-actions { opacity: 1; }
.glu-act { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--txt-3); transition: background .14s, color .14s; }
.glu-act:hover { background: var(--hover); color: var(--txt); }
.glu-act.ok { color: var(--accent); }
.glu-act.bad { color: var(--red); }

.glu-typing { display: flex; gap: 5px; align-items: center; padding: 16px 18px; width: fit-content; }
.gt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .4; animation: gtBlink 1.2s infinite ease-in-out; }
.gt-dot:nth-child(2) { animation-delay: .2s; }
.gt-dot:nth-child(3) { animation-delay: .4s; }
@keyframes gtBlink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.glu-input .glu-spark { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; margin-left: 4px; background: linear-gradient(150deg, var(--accent), var(--accent-2)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3); }

/* ============================================================
   RESPONSIVE — single-column phone / small-tablet adaptation
   The desktop layout is a fixed two-pane shell (sidebar 372px + main),
   with the bottom-nav living INSIDE the sidebar and settings adding a 3rd
   column. On a narrow viewport that overflows horizontally. Below 900px we
   collapse to ONE pane at a time, lift the nav into a shell tab bar, and add
   back affordances + safe-area insets.
   ============================================================ */

/* safe-area scaffolding — 0 on desktop / non-notched, so harmless everywhere */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* mobile-only chrome — hidden by default, revealed inside the media query */
.mobile-tabbar { display: none; }
.thread-back { display: none; }
.detail-mback { display: none; }

/* keyboard-focus ring for the touch/nav controls (no effect on mouse/touch) */
.icon-btn:focus-visible, .nav-btn:focus-visible, .mtab:focus-visible,
.thread-back:focus-visible, .detail-mback:focus-visible, .pa-btn:focus-visible,
.tab-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 900px) {
  /* ---- shell: column stack, one visible pane fills, tab bar pinned below ---- */
  .app { flex-direction: column; }
  .sidebar, .main, .settings-col, .detail {
    width: 100%; max-width: 100%; min-width: 0;
    height: auto; flex: 1 1 auto; min-height: 0;
    border-right: none; border-left: none;
    box-shadow: none;
    /* keep content clear of side notches in landscape / curved-edge devices */
    padding-left: var(--safe-left); padding-right: var(--safe-right);
  }

  /* which pane shows (driven by data-m on .app) */
  .app[data-m="list"] > .main { display: none; }
  .app[data-m="detail"] > .sidebar { display: none; }
  /* mobile: full-bleed single panel (no floating cards) */
  .app { padding: 0; gap: 0; }
  .sidebar, .main, .settings-col { border-radius: 0; }
  /* Settings now shares the sidebar (list) + main (detail): the shell data-m
     list/detail flip handles single-column, so no per-pane .m-show gate here. */

  /* lift the nav: hide the in-sidebar one, show the shell tab bar */
  .sidebar .bottom-nav { display: none; }
  .mobile-tabbar {
    display: flex; align-items: stretch; justify-content: space-around;
    flex: 0 0 auto; gap: 2px; z-index: 6;
    padding: 6px 6px calc(6px + var(--safe-bottom));
    padding-left: calc(6px + var(--safe-left)); padding-right: calc(6px + var(--safe-right));
    background: var(--g-bg-2);
    -webkit-backdrop-filter: var(--blur) var(--lg-lift); backdrop-filter: var(--blur) var(--lg-lift);
    border-top: 0.5px solid var(--g-border-2);
    box-shadow: inset 0 1px 0 0 var(--lg-rim);
  }
  .app[data-tabs="off"] .mobile-tabbar { display: none; }
  .mtab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 7px 0 4px; border-radius: 14px; color: var(--txt-3); transition: color .15s, background .15s; }
  .mtab.on { color: var(--accent); }
  .mtab:active { background: var(--hover); }
  .mtab-lbl { font-size: 11px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

  /* ---- sidebar header / search keep clear of the notch ---- */
  .sb-head { padding-top: calc(16px + var(--safe-top)); }

  /* ---- floating headers: room for back button + notch ---- */
  .thread-head, .list-head { top: calc(12px + var(--safe-top)); left: 10px; right: 10px; }
  .thread-tabs { top: calc(88px + var(--safe-top)); }
  .thread-banners { top: calc(80px + var(--safe-top)); left: 10px; right: 10px; }
  .media-bar { top: calc(136px + var(--safe-top)); left: 10px; right: 10px; gap: 7px; padding: 7px 8px 11px; }
  .media-bar .mb-name { font-size: 13.5px; }
  .media-bar .mb-speed { min-width: 38px; padding: 0 8px; }
  .thread-back { display: flex; align-items: center; justify-content: center; width: 36px; height: 40px; border-radius: 12px; color: var(--txt-2); flex-shrink: 0; margin: -2px 2px -2px -4px; }
  .thread-back:active { background: var(--hover); }
  .info-head { top: calc(14px + var(--safe-top)); }
  .info-scroll { inset: 0; }
  .edit-head { height: calc(64px + var(--safe-top)); padding-top: var(--safe-top); }
  .edit-scroll { inset: calc(64px + var(--safe-top)) 0 0 0; }
  .edit-inner { padding-left: 18px; padding-right: 18px; }

  /* ---- thread body: tighter gutters, wider bubbles ---- */
  .thread-inner { padding: calc(150px + var(--safe-top)) 12px calc(120px + var(--safe-bottom)); }
  .bubble { max-width: 82%; }
  .voice { width: min(72vw, 340px); }
  .call-card { min-width: 0; width: min(78vw, 320px); }
  .composer { padding: 0 10px calc(14px + var(--safe-bottom)); }
  .ai-inner { padding: calc(108px + var(--safe-top)) 16px calc(120px + var(--safe-bottom)); }

  /* ---- list / info / profile inners ---- */
  .list-head { padding: 12px 16px; }
  .list-inner { padding: calc(90px + var(--safe-top)) 16px 40px; }
  .info-inner { padding: calc(84px + var(--safe-top)) 16px 56px; }
  .profile-inner { padding: calc(44px + var(--safe-top)) 16px 44px; }
  .info-actions.five, .info-actions.four { gap: 6px; }
  .info-actions.five .pa-btn, .info-actions.four .pa-btn { padding: 12px 3px; }

  /* ---- settings detail back bar (sticky atop the scrolling detail) ---- */
  .detail-mback {
    display: flex; align-items: center; gap: 6px;
    position: sticky; top: 0; z-index: 5;
    padding: calc(14px + var(--safe-top)) 16px 12px;
    font-size: 16px; font-weight: 650; color: var(--accent);
    background: var(--g-bg-2);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-bottom: 0.5px solid var(--g-border-2);
  }
  .settings-head { padding-top: calc(18px + var(--safe-top)); }
  .detail-inner { padding: 22px 16px 56px; }

  /* ---- calendar: stack the side rails ---- */
  .cal-wrap { flex-direction: column; inset: calc(132px + var(--safe-top)) 0 0 0; overflow-y: auto; }
  .cal-left, .cal-right { width: 100%; height: auto; border: none; border-bottom: 0.5px solid var(--g-border-2); }
  .cal-mid { min-height: 58vh; }

  /* ---- modals: nearly full-width, internal scroll, clear of the notch ---- */
  .modal-overlay { padding: 16px calc(16px + var(--safe-left)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-right)); }
  .modal-card { max-width: 100%; max-height: calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom)); overflow-y: auto; }
  .msg-cm-menu { max-width: min(280px, calc(100vw - 16px)); }

  /* ---- full-screen call surfaces ---- */
  .call-bar { padding-top: calc(16px + var(--safe-top)); }
  .call-controls { gap: 10px; flex-wrap: wrap; padding: calc(40px) 16px calc(28px + var(--safe-bottom)); }
  .call-feed.is-pip { width: 33%; max-width: 150px; right: 12px; bottom: calc(118px + env(safe-area-inset-bottom)); }
  .auth-screen { padding: calc(20px + var(--safe-top)) 18px calc(20px + var(--safe-bottom)); align-items: flex-start; }
  .otp-row { gap: 7px; }
  .otp-box { width: 44px; height: 54px; font-size: 22px; }
  .qr-wrap { padding: 12px; }
}

/* ---- phone-tight tier ---- */
@media (max-width: 480px) {
  .bubble { max-width: 86%; }
  .thread-inner { padding-left: 10px; padding-right: 10px; }
  .th-actions { gap: 0; }
  .th-actions .icon-btn { width: 36px; height: 36px; }
  .thread-back { width: 34px; height: 36px; }
  .mtab-lbl { font-size: 10.5px; }
  .profile-actions { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   MOTION PASS — one "fast but smooth" rhythm (Telegram feel)
   ============================================================ */
:root {
  --ease-snap: cubic-bezier(.2, .8, .3, 1);  /* snappy decelerate, no overshoot */
  --dur-fast: .14s;   /* press / micro */
  --dur-std: .2s;     /* hover / state */
  --dur-emph: .28s;   /* view / panel entrance */
}

/* View cross-fade: when the main pane's content swaps (tab switch, opening a
   chat from the empty state) the fresh child fades in. Opacity-only — no
   transform — so position:sticky headers inside the thread are never trapped
   in a transformed ancestor (and chat→chat reuses the thread, so no re-fade). */
@keyframes gluViewIn { from { opacity: 0; } to { opacity: 1; } }
.main > * { animation: gluViewIn var(--dur-emph) var(--ease-snap) both; }

/* Press feedback — a quick scale-down on tap (presses were instant before).
   Only .icon-btn/.tab-chip get their transition redeclared (their full prior
   transition is reproduced + transform added); .nav-btn keeps its own
   flex-grow transition untouched. */
.icon-btn, .tab-chip { transition: background .15s, color .15s, transform var(--dur-fast) var(--ease-snap); }
.icon-btn:active, .tab-chip:active, .btn-primary:active, .play-btn:active, .scope-chip:active { transform: scale(.94); }

/* Honor the OS reduce-motion setting across the whole app. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Chat-list row typing indicator — accent "печатает" + animated dots (reuses
   the gtBlink keyframe) in place of the message preview when someone's typing. */
.ci-msg.typing { color: var(--accent); }
.typing-dots { display: inline-flex; gap: 3px; margin-left: 5px; align-items: center; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: .4; animation: gtBlink 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }

/* ===== Inline message text formatting (markdown-ish, like the old web) ===== */
.md-text { white-space: pre-wrap; word-break: break-word; }
.md-text strong { font-weight: 700; }
.md-text em { font-style: italic; }
.md-text .md-u { text-decoration: underline; }
.md-text .md-s { text-decoration: line-through; opacity: .85; }
.md-text .md-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; padding: 1px 5px; border-radius: 6px; background: rgba(127,127,127,.18); }
.md-text .md-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble.sent .md-text .md-code { background: rgba(255,255,255,.20); }
.md-text .md-quote { display: block; border-left: 3px solid currentColor; opacity: .9; padding: 1px 0 1px 10px; margin: 2px 0; }
.md-text .md-spoiler { background: currentColor; color: transparent !important; border-radius: 5px; cursor: pointer; transition: color .15s, background .15s; -webkit-user-select: none; user-select: none; }
.md-text .md-spoiler * { color: transparent !important; }
.md-text .md-spoiler.revealed { background: rgba(127,127,127,.16); color: inherit !important; cursor: auto; }
.md-text .md-spoiler.revealed * { color: inherit !important; }

/* ===== WYSIWYG contentEditable composer (live formatting) ===== */
.composer-ce { display: block; min-height: 22px; max-height: 124px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; outline: none; cursor: text; line-height: 1.35; }
.composer-ce:empty::before { content: attr(data-ph); color: var(--txt-3); pointer-events: none; }
.composer-ce b, .composer-ce strong { font-weight: 700; }
.composer-ce i, .composer-ce em { font-style: italic; }
.composer-ce u { text-decoration: underline; }
.composer-ce s, .composer-ce strike, .composer-ce del { text-decoration: line-through; }
.composer-ce code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; padding: 1px 4px; border-radius: 5px; background: rgba(127,127,127,.18); }
.composer-ce a { color: var(--accent); text-decoration: underline; }
.composer-ce .ce-spoiler { background: rgba(127,127,127,.22); border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(127,127,127,.35); padding: 0 2px; }
