/* Chat web (#4652) — aspetto sul modello di Telegram per iPhone, dai 4 screenshot di Giovanni del 12/11 02:43.
   Vetro (intestazioni e barre flottanti), cartelle a pillola, barra in basso, bolle verdi su sfondo verde. */
:root {
  --blue: #2f8a4e;   /* verde Qualitec (#4770), dal logo originale */
  --blue-press: #26743f;
  --red: #ff3b30;
  --green-check: #34b34a;
  --bg: #ffffff;
  --bg-grouped: #f2f2f7;
  --cell: #ffffff;
  --text: #000000;
  --text-2: #8a8a8e;
  --text-3: #3c3c43;
  --sep: rgba(60, 60, 67, .2);
  --hover: rgba(0, 0, 0, .04);
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-border: rgba(255, 255, 255, .75);
  --glass-shadow: 0 2px 14px rgba(0, 0, 0, .09), 0 0 0 .5px rgba(0, 0, 0, .05);
  --pill-sel: rgba(120, 120, 128, .16);
  --bubble-in: rgba(255, 255, 255, .94);
  --bubble-out: #e3fcc9;
  --time-in: #8e8e93;
  --time-out: #4fae4e;
  --link-in: #0a84ff;
  --link-out: #0a84ff;
  --accent-out: #3aa53a;
  --service-bg: rgba(60, 90, 50, .35);
  --wall-a: #d9ebb4; --wall-b: #a6d18f; --wall-c: #cfe39e; --wall-d: #8ec48a;
  --wall-pattern: .13;
  --badge-muted: #b0b0b5;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --msg-size: 17px;
  --c-0: #e5484d; --c-1: #e2870f; --c-2: #7a5df0; --c-3: #3aa53a; --c-4: #13a3a0; --c-5: #2a8fe0; --c-6: #c04fe0;
  --sidebar-w: 400px;
  color-scheme: light;
}
@media (min-width: 761px) { :root { --msg-size: 15.5px; } }

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --blue: #4cb866; --bg: #000000; --bg-grouped: #000000; --cell: #1c1c1e; --text: #ffffff; --text-2: #8d8d93; --text-3: #ebebf5;
  --sep: rgba(84, 84, 88, .55); --hover: rgba(255,255,255,.06);
  --glass: rgba(30, 30, 32, .72); --glass-strong: rgba(38, 38, 40, .9); --glass-border: rgba(255,255,255,.08);
  --glass-shadow: 0 2px 14px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.06); --pill-sel: rgba(120,120,128,.32);
  --bubble-in: #262628; --bubble-out: #2b5d3a; --time-in: #8d8d93; --time-out: #9ed59b; --link-in: #5ab1ff; --link-out: #b8e6ff;
  --accent-out: #9ed59b; --service-bg: rgba(0,0,0,.45); --green-check: #4cd964;
  --wall-a: #13241a; --wall-b: #0b1710; --wall-c: #1b2e1c; --wall-d: #0f1e14; --wall-pattern: .08; --badge-muted: #5a5a5e;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --blue: #4cb866; --bg: #000000; --bg-grouped: #000000; --cell: #1c1c1e; --text: #ffffff; --text-2: #8d8d93; --text-3: #ebebf5;
  --sep: rgba(84, 84, 88, .55); --hover: rgba(255,255,255,.06);
  --glass: rgba(30, 30, 32, .72); --glass-strong: rgba(38, 38, 40, .9); --glass-border: rgba(255,255,255,.08);
  --glass-shadow: 0 2px 14px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.06); --pill-sel: rgba(120,120,128,.32);
  --bubble-in: #262628; --bubble-out: #2b5d3a; --time-in: #8d8d93; --time-out: #9ed59b; --link-in: #5ab1ff; --link-out: #b8e6ff;
  --accent-out: #9ed59b; --service-bg: rgba(0,0,0,.45); --green-check: #4cd964;
  --wall-a: #13241a; --wall-b: #0b1710; --wall-c: #1b2e1c; --wall-d: #0f1e14; --wall-pattern: .08; --badge-muted: #5a5a5e;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
html { overscroll-behavior: none; }   /* su iPhone l'elastico va sul documento, non sul body (#4674) */
body { font: 17px/1.29 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
#app { height: 100dvh; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--text-2); }
.screen { height: 100%; }
.glass { background: var(--glass); backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%); box-shadow: var(--glass-shadow); border: .5px solid var(--glass-border); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--text-2); border-top-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
.spinner.sm { width: 13px; height: 13px; border-width: 1.6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- login ---------- */
#login { display: flex; justify-content: center; overflow-y: auto; padding: 0 16px; background: var(--bg-grouped); }
.login-box { width: 100%; max-width: 380px; text-align: center; padding-top: max(10vh, 48px); }
.login-logo { width: 110px; height: 110px; margin-bottom: 20px; }
.login-logo.qlogo { width: 130px; height: auto; }   /* Qualitec (#4770) */
.login-box h1 { font-size: 30px; font-weight: 700; margin: 0 0 8px; }
.login-box p { margin: 0 0 30px; font-size: 16px; }
.group { background: var(--cell); border-radius: 12px; overflow: hidden; margin-bottom: 18px; text-align: left; }
.group input { display: block; width: 100%; height: 50px; border: 0; outline: 0; padding: 0 16px; background: none; font-size: 17px; }
.group input + input { border-top: .5px solid var(--sep); }
.adv { text-align: left; margin: -4px 0 16px 4px; color: var(--text-2); font-size: 14px; }
.adv summary { cursor: pointer; margin-bottom: 10px; }
.btn-primary { width: 100%; height: 50px; border-radius: 14px; background: var(--blue); color: #fff; font-weight: 600; font-size: 17px; }
.btn-primary:active { background: var(--blue-press); }
.btn-primary:disabled { opacity: .55; }
.error { color: var(--red); font-size: 14px; margin: -6px 4px 14px !important; text-align: left; }

/* ---------- struttura ---------- */
#main { display: flex; height: 100%; position: relative; }
#sidebar { width: var(--sidebar-w); flex: none; position: relative; background: var(--bg); border-right: .5px solid var(--sep); overflow: hidden; }
.tab-page { position: absolute; inset: 0; display: flex; flex-direction: column; }
.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-top: calc(env(safe-area-inset-top) + 112px); padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
#page-contacts .scroller, #page-settings .scroller { padding-top: calc(env(safe-area-inset-top) + 68px); }

/* intestazione flottante della lista */
.glass-head { position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding: calc(env(safe-area-inset-top) + 8px) 14px 8px;
  background: linear-gradient(var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent)); }
.glass-head.flat { position: static; background: var(--bg); }
.gh-row { display: flex; align-items: center; gap: 10px; height: 48px; }
.gh-title { flex: 1; text-align: center; font-weight: 600; font-size: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.conn-state { font-size: 12px; font-weight: 400; color: var(--text-2); display: inline-flex; gap: 5px; align-items: center; }
.pill-btn { height: 44px; padding: 0 16px; border-radius: 22px; font-size: 17px; font-weight: 500; background: var(--glass-strong); box-shadow: var(--glass-shadow); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); min-width: 44px; }
.pill-btn.ghost { visibility: hidden; width: 92px; }
.circle-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--text); transition: transform .1s; }
.circle-btn:active { transform: scale(.94); }
.circle-btn.blue { background: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(10,132,255,.35); }
.circle-btn.big { width: 48px; height: 48px; }
.circle-btn.big svg { width: 26px; height: 26px; }

.folders { display: flex; gap: 2px; padding: 4px; margin-top: 8px; border-radius: 22px; background: var(--glass-strong); box-shadow: var(--glass-shadow); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); overflow-x: auto; scrollbar-width: none; }
.folders::-webkit-scrollbar { display: none; }
.folders button { flex: none; height: 36px; padding: 0 16px; border-radius: 18px; font-size: 16px; font-weight: 500; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.folders button.on { background: var(--pill-sel); font-weight: 600; }
.folders .space-pick { color: var(--blue); font-weight: 600; max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 36px; }
.folders .space-pick .sp-caret { font-size: 12px; }
.alert-actions.sp-list { max-height: 60vh; overflow-y: auto; }
.folders .f-badge { background: var(--blue); color: #fff; border-radius: 10px; min-width: 20px; height: 20px; font-size: 13px; padding: 0 6px; display: grid; place-items: center; font-weight: 600; }

.searchbar { margin: 4px 14px 8px; height: 38px; border-radius: 12px; background: var(--pill-sel); display: flex; align-items: center; gap: 6px; padding: 0 10px; color: var(--text-2); }
.searchbar svg { width: 18px; height: 18px; }
.searchbar input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; min-width: 0; color: var(--text); -webkit-appearance: none; }
.push-banner { margin: 0 14px 8px; padding: 12px 14px; border-radius: 14px; background: var(--bg-grouped); font-size: 15px; display: flex; gap: 10px; align-items: center; }
.push-banner .pb-text { flex: 1; }
.push-banner button { color: var(--blue); font-weight: 600; }
.push-banner .x { color: var(--text-2); font-weight: 400; }

/* righe della lista */
.chatlist { list-style: none; margin: 0; padding: 0; }
.chatlist li { display: flex; gap: 12px; padding: 0 0 0 12px; cursor: pointer; user-select: none; -webkit-user-select: none; position: relative; }
.chatlist li:active, .chatlist li:hover { background: var(--hover); }
.chatlist li.active { background: color-mix(in srgb, var(--blue) 12%, transparent); }
.chatlist li > .avatar { margin: 6px 0; width: 54px; height: 54px; font-size: 20px; }
.cl-main { flex: 1; min-width: 0; padding: 5px 14px 6px 0; border-bottom: .5px solid var(--sep); min-height: 66px; display: flex; flex-direction: column; justify-content: center; }
.cl-top { display: flex; align-items: baseline; gap: 6px; }
.cl-name { flex: 1; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-name .muted-ico { width: 15px; height: 15px; color: var(--text-2); vertical-align: -2px; margin-left: 3px; }
.cl-time { font-size: 15px; color: var(--text-2); flex: none; display: inline-flex; align-items: center; gap: 2px; }
.cl-time svg { width: 19px; height: 19px; color: var(--green-check); stroke-width: 2; }
.cl-bottom { display: flex; gap: 8px; align-items: flex-start; margin-top: 1px; }
.cl-text { flex: 1; min-width: 0; font-size: 15px; line-height: 1.25; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.cl-sender { color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-text.one { -webkit-line-clamp: 1; }
.cl-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; padding-top: 2px; flex: none; }
.badge { min-width: 22px; height: 22px; border-radius: 11px; background: var(--blue); color: #fff; font-size: 14px; font-weight: 500; display: grid; place-items: center; padding: 0 7px; }
.badge.muted { background: var(--badge-muted); }
.badge.at { padding: 0; width: 22px; font-size: 14px; font-weight: 600; }
.badge.invite { background: var(--green-check); font-size: 12px; padding: 0 8px; }
.cl-more { text-align: center; padding: 16px; }
.cl-empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.chatlist li.cl-empty { display: block; cursor: default; padding: 48px 24px; }
.chatlist li.cl-empty:hover, .chatlist li.cl-empty:active { background: none; }
.contacts .cl-main { min-height: 60px; }
.contacts li > .avatar { width: 44px; height: 44px; font-size: 17px; }

/* avatar */
.avatar { width: 60px; height: 60px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 22px; background-size: cover; background-position: center; overflow: hidden; text-transform: uppercase; letter-spacing: .5px; }
.avatar.sm { width: 44px; height: 44px; font-size: 17px; }
.avatar.xs { width: 30px; height: 30px; font-size: 12px; }
.avatar.xl { width: 100px; height: 100px; font-size: 38px; }
.avatar.hash { font-size: 30px; font-weight: 500; }
.av-0 { background-image: linear-gradient(#ff885e, #ff516a); } .av-1 { background-image: linear-gradient(#ffcd6a, #ffa85c); }
.av-2 { background-image: linear-gradient(#82b1ff, #665fff); } .av-3 { background-image: linear-gradient(#a0de7e, #54cb68); }
.av-4 { background-image: linear-gradient(#53edd6, #28c9b7); } .av-5 { background-image: linear-gradient(#72d5fd, #2a9ef1); }
.av-6 { background-image: linear-gradient(#e0a2f3, #d669ed); }
.name-0 { color: #e5484d; } .name-1 { color: #e2870f; } .name-2 { color: #7a5df0; } .name-3 { color: #3aa53a; }
.name-4 { color: #13a3a0; } .name-5 { color: #2a8fe0; } .name-6 { color: #c04fe0; }

/* barra in basso */
.tabbar { position: absolute; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 10px); z-index: 6; height: 64px; border-radius: 32px; display: flex; padding: 4px; background: var(--glass-strong); }
.tabbar button { flex: 1; border-radius: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--text); }
.tabbar button svg { width: 27px; height: 27px; }
.tabbar button.on { color: var(--blue); }
/* pillola Liquid Glass: la muove app.js con una molla; premuta diventa una lente chiara che esce dalla barra */
.tabbar { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tabbar button { position: relative; z-index: 1; }
.tb-pill { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 28px; background: var(--pill-sel); pointer-events: none; will-change: transform; transform-origin: center; }
.tb-pill.lens { background: color-mix(in srgb, #fff 55%, transparent); box-shadow: 0 6px 22px rgba(0,0,0,.16), inset 0 0 0 .5px rgba(255,255,255,.7), inset 0 1px 1px rgba(255,255,255,.9); backdrop-filter: blur(6px) saturate(160%); -webkit-backdrop-filter: blur(6px) saturate(160%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-pill.lens { background: color-mix(in srgb, #fff 18%, transparent); } }
:root[data-theme="dark"] .tb-pill.lens { background: color-mix(in srgb, #fff 18%, transparent); }
.tabbar button.on svg { fill: currentColor; stroke: none; }
.tabbar button[data-tab="settings"].on svg { fill: none; stroke: currentColor; }
.tb-ico { position: relative; display: block; }
.tb-badge { position: absolute; top: -4px; left: 16px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; display: grid; place-items: center; border: 2px solid var(--glass-strong); }
/* ===== Liquid Glass della barra in basso — dalla #4713, 13/11/2026 (demo: ~/claudecodeproj/20261113-liquid-glass-barra/demo/index.html)
   Va in app.css SUBITO DOPO la riga 187 (.tb-badge), cosi' vince sulle righe 173 e 180-183 senza toccarle.
   Le righe 181-183 (.tb-pill.lens della 1.4.0) restano: queste le sovrascrivono. */
:root {
  --lg-bar: rgba(255,255,255,.66); --lg-lens: rgba(246,246,248,.94); --lg-glare: .7;
  --lg-rim: rgba(255,255,255,.95); --lg-rim-2: rgba(255,255,255,.35); --lg-shade: rgba(0,0,0,.10);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --lg-bar: rgba(28,28,30,.62); --lg-lens: rgba(52,52,56,.93); --lg-glare: .22;
  --lg-rim: rgba(255,255,255,.55); --lg-rim-2: rgba(255,255,255,.12); --lg-shade: rgba(0,0,0,.45);
} }
:root[data-theme="dark"] {
  --lg-bar: rgba(28,28,30,.62); --lg-lens: rgba(52,52,56,.93); --lg-glare: .22;
  --lg-rim: rgba(255,255,255,.55); --lg-rim-2: rgba(255,255,255,.12); --lg-shade: rgba(0,0,0,.45);
}
/* 1. la barra: vetro meno pieno, sfocatura con saturazione forte, bordo di luce in alto a sinistra e in basso a destra */
.tabbar.glass { background: var(--lg-bar); backdrop-filter: blur(18px) saturate(190%) brightness(1.04); -webkit-backdrop-filter: blur(18px) saturate(190%) brightness(1.04);
  box-shadow: 0 10px 30px -6px rgba(0,0,0,.18), 0 1px 3px rgba(0,0,0,.06), inset 0 0 0 .5px var(--lg-rim-2); }
.tabbar::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1.2px;
  background: linear-gradient(135deg, var(--lg-rim) 0%, var(--lg-rim-2) 28%, transparent 50%, var(--lg-rim-2) 72%, var(--lg-rim) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; z-index: 3; }
/* 2. la lente: quasi piena (copre le icone vere), sfocatura dietro, bordo luminoso, riflesso in alto, ombra sotto, e sta SOPRA le icone */
/* 13/11 03:3x goccia d'acqua senza bordi (Giovanni 03:26: «nell'iPhone e' come fosse una goccia d'acqua senza bordi»): niente filo bianco, niente riflesso, solo ombra morbida e un velo di volume */
.tb-pill.lens { z-index: 2; background: var(--lg-lens); backdrop-filter: blur(8px) saturate(180%); -webkit-backdrop-filter: blur(8px) saturate(180%);
  box-shadow: 0 8px 24px var(--lg-shade), inset 0 -8px 16px -10px var(--lg-shade); }
/* le righe 182-183 della 1.4.0 hanno specificita' piu' alta: in scuro rimetterebbero il fondo vecchio */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-pill.lens { background: var(--lg-lens); } }
:root[data-theme="dark"] .tb-pill.lens { background: var(--lg-lens); }
/* riflesso in alto tolto il 13/11 03:3x (goccia senza bordi) */
/* 3. dentro la lente: copia delle schede, ingrandita dalla scala della lente e piegata ai bordi dal filtro SVG (rifrazione + frange colorate).
      filter: url() sul contenuto funziona in WebKit; backdrop-filter: url() no (si legge e non disegna niente). */
.tb-lens-view { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; opacity: 0; pointer-events: none; }
.tb-pill.refr .tb-lens-view { opacity: 1; filter: url(#lg-refract); }
.tb-lens-row { position: absolute; top: -4px; left: 0; display: flex; padding: 4px; height: 64px; }
.tb-lens-row button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--text); }
.tb-lens-row button svg { width: 27px; height: 27px; }
.tb-lens-row button.on { color: var(--blue); }
.tb-lens-row button.on svg { fill: currentColor; stroke: none; }
.tb-lens-row button[data-tab="settings"].on svg { fill: none; stroke: currentColor; }
@media (prefers-reduced-transparency: reduce) {
  .tabbar.glass { background: var(--glass-strong); }
  .tb-pill.refr .tb-lens-view { filter: none; }
}
/* 13/11 03:4x dal confronto video Giovanni (IMG_9082 nostra / IMG_9083 Telegram): la lente di Telegram e' acqua trasparente,
   si vedono le schede ingrandite e piegate ai bordi; niente fondo grigio/bianco ne' ombra sotto. Dentro la lente la copia sta su un
   fondo pieno come la barra, cosi' le schede vere sotto non si vedono doppie; il fondo sfuma via mentre la lente torna pillola. */
:root { --lg-lens: transparent; --lg-lensbg: rgba(252,252,254,.97); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --lg-lens: transparent; --lg-lensbg: rgba(34,34,36,.97); } }
:root[data-theme="dark"] { --lg-lens: transparent; --lg-lensbg: rgba(34,34,36,.97); }
/* il fondo sta sulla pillola e non nella vista filtrata: dentro il filtro il suo bordo diventava un filo colorato (03:5x) */
.tb-pill:not(.lens) .tb-lens-view { opacity: 0; filter: none; }   /* lente spenta: niente copia sopra la pillola grigia (testo doppio nei fotogrammi 03:5x) */
.tb-pill.lens { background: var(--lg-lensbg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-pill.lens { background: var(--lg-lensbg); } }
:root[data-theme="dark"] .tb-pill.lens { background: var(--lg-lensbg); }
/* 13/11 04:0x screen di Giovanni 03:52 su iPhone vero: la parte di lente che esce dalla barra era bianca piena sul fondo grigio
   (il «contorno bianco») e copriva a meta' il bollino rosso. Ora la lente e' trasparente; il fondo pieno ce l'ha solo la copia
   della barra dentro la lente, quindi sopra e sotto la barra si vede la pagina, senza alone e senza ombra. */
.tb-pill.lens { box-shadow: none; }
.tb-pill.lens, :root[data-theme="dark"] .tb-pill.lens { background: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-pill.lens { background: transparent; } }
.tb-lens-row { background: #fff; border-radius: 32px; }   /* stesso colore che la barra mostra sul telefono */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-lens-row { background: #1f1f21; } }
:root[data-theme="dark"] .tb-lens-row { background: #1f1f21; }
/* 13/11 04:1x dagli screen di Giovanni 04:09: in Telegram il bordo della lente si vede come una fascia di vetro sottile,
   appena grigia e iridescente (frange R/G/B provate e tolte: davano un filo blu doppio). Velo sopra la copia, non un filo bianco. */
.tb-pill.lens::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; opacity: 1; background: none;
  box-shadow: inset 0 0 7px rgba(0,0,0,.09), inset 0 0 0 .5px rgba(0,0,0,.07), inset 0 1px 2px rgba(255,255,255,.5); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-pill.lens::after { box-shadow: inset 0 0 7px rgba(255,255,255,.10), inset 0 0 0 .5px rgba(255,255,255,.12); } }
:root[data-theme="dark"] .tb-pill.lens::after { box-shadow: inset 0 0 7px rgba(255,255,255,.10), inset 0 0 0 .5px rgba(255,255,255,.12); }
/* 13/11 04:3x Giovanni 04:23 «la dimensione della barra cambia sull'originale»: nel video Telegram (IMG_9083, fotogrammi 44-56)
   la barra intera cresce di circa il 3% mentre la lente e' accesa e torna con un piccolo rimbalzo. */
.tabbar { transition: transform .42s cubic-bezier(.34, 1.45, .64, 1); transform-origin: 50% 60%; }
.tabbar.grow { transform: scale(1.035); transition-duration: .22s; }
@media (prefers-reduced-motion: reduce) { .tabbar.grow { transform: none; } }
/* 13/11 05:0x barra a 4 sezioni come l'originale (Giovanni 04:31): icone piene sempre, nere a riposo e blu se scelte; Impostazioni = la propria foto */
.tabbar button svg, .tabbar button.on svg, .tabbar button[data-tab="settings"].on svg, .tb-lens-row button svg, .tb-lens-row button.on svg { fill: currentColor; stroke: none; width: 28px; height: 28px; }
.tabbar button, .tb-lens-row button { font-size: 10.5px; font-weight: 600; letter-spacing: -.1px; }
.tb-me { display: block; width: 28px; height: 28px; }
.tb-me .avatar.tb { width: 28px; height: 28px; font-size: 11px; border: 0; }
.tabbar button.on .tb-me .avatar.tb, .tb-lens-row button.on .tb-me .avatar.tb { box-shadow: 0 0 0 1.5px var(--blue); }
/* bordo tratteggiato della bolla (screen IMG_9108): il filo dei pixel spostati al limite si taglia via di 2 px */
.tb-pill.refr .tb-lens-view { clip-path: inset(4px round 24px); }
/* la barra di Telegram e' quasi piena: sotto il testo della lista non si legge (prima .66, si leggeva) */
:root { --lg-bar: rgba(255,255,255,.88); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --lg-bar: rgba(28,28,30,.86); } }
:root[data-theme="dark"] { --lg-bar: rgba(28,28,30,.86); }
.tabbar button[data-tab="calls"] svg, .tb-lens-row button[data-tab="calls"] svg { transform: scale(.86); }   /* nell'originale la cornetta e' piu' piccola */
.tabbar button, .tb-lens-row button { font-weight: 500; }
/* ===== fine Liquid Glass */

/* impostazioni */
.me-hero { text-align: center; padding: 8px 0 22px; }
.me-hero .avatar { margin: 0 auto 10px; }
.me-hero h2 { margin: 0 0 2px; font-size: 24px; font-weight: 600; }
.ios-group { margin: 0 14px 22px; background: var(--cell); border-radius: 14px; overflow: hidden; }
#page-settings .scroller { background: var(--bg-grouped); }
#page-settings { background: var(--bg-grouped); }
#page-settings .glass-head { background: linear-gradient(var(--bg-grouped) 55%, transparent); }
.ios-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 12px 0 14px; text-align: left; font-size: 17px; position: relative; }
.ios-row + .ios-row::before { content: ""; position: absolute; top: 0; left: 56px; right: 0; border-top: .5px solid var(--sep); }
.ios-row:active { background: var(--hover); }
.ios-row .row-label { flex: 1; }
.ios-row .row-val { color: var(--text-2); }
.ios-row .chev { width: 18px; height: 18px; color: var(--text-2); opacity: .6; }
.ios-row.danger { color: var(--red); justify-content: center; }
.ios-row.danger .row-label { text-align: center; }
.ico-sq { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; }
.ico-sq svg { width: 19px; height: 19px; stroke-width: 2.1; }
.ico-sq.red { background: #ff3b30; } .ico-sq.blue { background: #007aff; } .ico-sq.green { background: #34c759; } .ico-sq.orange { background: #ff9500; }
.foot { text-align: center; font-size: 13px; }

/* ---------- conversazione ---------- */
.chat { flex: 1; position: relative; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.wallpaper { position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 10% 10%, var(--wall-a) 0, transparent 55%),
    radial-gradient(ellipse at 90% 35%, var(--wall-b) 0, transparent 55%),
    radial-gradient(ellipse at 20% 80%, var(--wall-d) 0, transparent 55%),
    radial-gradient(ellipse at 85% 95%, var(--wall-c) 0, transparent 50%),
    var(--wall-c); }
.wallpaper::after { content: ""; position: absolute; inset: 0; opacity: var(--wall-pattern);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23234' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='28' cy='30' r='10'/%3E%3Cpath d='M23 28h0M33 28h0M24 34c2 2 6 2 8 0'/%3E%3Cpath d='M95 18l6 12 13 2-9 9 2 13-12-6-12 6 2-13-9-9 13-2z'/%3E%3Crect x='140' y='22' width='24' height='18' rx='4'/%3E%3Cpath d='M146 40v6l6-6'/%3E%3Cpath d='M20 95c6-10 18-10 24 0s18 10 24 0'/%3E%3Ccircle cx='120' cy='95' r='12'/%3E%3Cpath d='M120 83v24M108 95h24'/%3E%3Cpath d='M160 100l8 8-8 8'/%3E%3Cpath d='M30 150h20l-4 18H34z'/%3E%3Cpath d='M50 154h5a4 4 0 0 1 0 8h-6'/%3E%3Cpath d='M95 140c0 8 10 16 10 16s10-8 10-16a10 10 0 0 0-20 0z'/%3E%3Cpath d='M145 145l20 20M165 145l-20 20'/%3E%3C/g%3E%3C/svg%3E"); }
.chat > *:not(.wallpaper) { position: relative; z-index: 1; }
.empty-hint { display: none; }
.chat.empty .empty-hint { display: grid; place-items: center; flex: 1; }
.empty-hint span, .date-sep, .service { background: var(--service-bg); color: #fff; font-size: 14px; font-weight: 500; padding: 3px 10px; border-radius: 14px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.chat.empty > :not(.wallpaper):not(.empty-hint) { display: none !important; }

.thread-head { position: absolute !important; top: 0; left: 0; right: 0; z-index: 5 !important; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 12px 6px; pointer-events: none; }
.thread-head > * { pointer-events: auto; }
/* i messaggi che passano sotto la testata sfumano, come Telegram (prima si leggevano nitidi dietro le pillole) */
.thread-head::before { content: ""; position: absolute; inset: 0 0 -26px; z-index: -1; pointer-events: none !important;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 88%, transparent) 0%, color-mix(in srgb, var(--bg) 62%, transparent) 55%, transparent 100%);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent); }
.back-pill { height: 44px; border-radius: 22px; display: flex; align-items: center; gap: 2px; padding: 0 10px 0 8px; color: var(--text); flex: none; }
.back-pill svg { width: 26px; height: 26px; stroke-width: 2.3; }
.back-count { background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; border-radius: 12px; min-width: 24px; height: 24px; padding: 0 7px; display: grid; place-items: center; }
.title-pill { flex: 1; min-width: 0; max-width: 340px; margin: 0 auto; height: 50px; border-radius: 25px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 16px; }
.head-title { font-weight: 600; font-size: 17px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-sub { font-size: 13px; color: var(--text-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-sub.typing { color: var(--blue); }
.head-avatar { flex: none; border-radius: 50%; box-shadow: var(--glass-shadow); }
.head-avatar .avatar { width: 46px; height: 46px; font-size: 18px; }

.pinned { position: absolute !important; z-index: 4 !important; top: calc(env(safe-area-inset-top) + 64px); left: 12px; right: 12px; height: 54px; border-radius: 22px; display: flex; align-items: center; gap: 10px; padding: 0 14px; text-align: left; color: var(--text); }
.pin-bar { width: 2.5px; align-self: stretch; margin: 10px 0; border-radius: 2px; background: var(--text); opacity: .75; }
.pin-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pin-title { font-weight: 600; font-size: 15px; }
.pin-text { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned svg { color: var(--text-2); }
.invite-bar { position: absolute !important; top: calc(env(safe-area-inset-top) + 66px); left: 12px; right: 12px; z-index: 4 !important; border-radius: 20px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; font-size: 15px; text-align: center; }
.invite-bar button { color: #fff; background: var(--blue); font-weight: 600; padding: 8px 18px; border-radius: 18px; }
.invite-bar button.no { color: var(--red); background: none; }

/* column-reverse: si scorre dal fondo, i vecchi aggiunti in cima non spostano la vista (#4674) */
.timeline-wrap { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: flex; flex-direction: column-reverse; }
.timeline { width: 100%; max-width: 760px; margin: 0 auto; flex: none; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 72px) 10px 6px; }
.chat.has-pin .timeline { padding-top: calc(env(safe-area-inset-top) + 130px); }
.tl-loader { text-align: center; padding: 12px; }
.tl-start { align-self: center; margin: 8px 0 14px; }
.date-sep { align-self: center; margin: 8px 0; position: sticky; top: calc(env(safe-area-inset-top) + 66px); z-index: 2; transition: opacity .3s; }
/* data flottante come Telegram: sopra i messaggi solo mentre si scorre (prima restava fissa sul primo messaggio) */
.chat:not(.scrolling) .date-sep.floating { opacity: 0; transition-delay: .2s; }
.chat.has-pin .date-sep { top: calc(env(safe-area-inset-top) + 124px); }
.service { align-self: center; margin: 6px 0; font-weight: 400; font-size: 14px; text-align: center; max-width: 85%; }

.msg { display: flex; align-items: flex-end; gap: 6px; margin-top: 2px; }
.msg.out { flex-direction: row-reverse; }
.msg.first-in-group { margin-top: 7px; }
.msg > .avatar { width: 36px; height: 36px; font-size: 14px; visibility: hidden; cursor: pointer; margin-bottom: 1px; }
.msg.last-in-group > .avatar { visibility: visible; }
.msg.out > .avatar, .msg.dm > .avatar { display: none; }
.bubble { position: relative; max-width: min(520px, calc(100% - 52px)); background: var(--bubble-in); border-radius: 18px; padding: 7px 11px 7px 12px; word-wrap: break-word; overflow-wrap: anywhere; min-width: 64px; box-shadow: 0 .5px 1px rgba(0,0,0,.08); }
.msg.dm .bubble, .msg.out .bubble { max-width: min(520px, calc(100% - 44px)); }
.msg.out .bubble { background: var(--bubble-out); }
.msg.in.last-in-group .bubble { border-bottom-left-radius: 5px; }
.msg.out.last-in-group .bubble { border-bottom-right-radius: 5px; }
.msg.last-in-group .bubble::after { content: ""; position: absolute; bottom: 0; width: 12px; height: 17px; background: inherit; }
.msg.in.last-in-group .bubble::after { left: -6px; clip-path: path("M12 0v17H0c4 0 8-3 9-8 .6-3 .8-6 3-9Z"); }
.msg.out.last-in-group .bubble::after { right: -6px; clip-path: path("M0 0v17h12c-4 0-8-3-9-8C2.4 6 2.2 3 0 0Z"); }
.msg.highlight .bubble { animation: flash 1.4s; }
@keyframes flash { 25% { filter: brightness(.82); } }
.sender { font-size: 15px; font-weight: 600; margin-bottom: 1px; cursor: pointer; }
.text { white-space: pre-wrap; font-size: var(--msg-size); line-height: 1.3; }
.text a { color: var(--link-in); text-decoration: none; }
.msg.out .text a { color: var(--link-out); }
.text code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; }
.text pre { margin: 4px 0; padding: 6px 8px; background: rgba(0,0,0,.05); border-radius: 8px; white-space: pre-wrap; font-size: .85em; }
.text blockquote { margin: 2px 0; padding-left: 8px; border-left: 3px solid currentColor; opacity: .85; }
.text.big-emoji { font-size: 44px; line-height: 1.15; }
.bubble.big-emoji-b { background: none !important; box-shadow: none; padding: 0 2px; }
.bubble.big-emoji-b::after { display: none; }
.meta { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--time-in); margin: 8px -3px -5px 10px; height: 16px; white-space: nowrap; user-select: none; position: relative; top: 1px; }
.msg.out .meta { color: var(--time-out); }
.meta svg { width: 17px; height: 17px; stroke-width: 2; }
.meta .ed { font-style: normal; }
.meta .failed { color: var(--red); cursor: pointer; display: inline-flex; }
.meta .replies { display: inline-flex; align-items: center; gap: 1px; margin-right: 3px; }
.meta .replies svg { width: 14px; height: 14px; }
.meta-overlay { position: absolute; right: 8px; bottom: 8px; float: none; margin: 0; background: rgba(0,0,0,.4); color: #fff !important; padding: 0 7px; border-radius: 10px; height: 20px; top: auto; }

.reply-quote { display: block; border-radius: 6px; padding: 3px 8px; margin: 2px -2px 5px; background: color-mix(in srgb, var(--q, var(--blue)) 12%, transparent); border-left: 3px solid var(--q, var(--blue)); cursor: pointer; font-size: 15px; overflow: hidden; }
.msg.out .reply-quote { --q: var(--accent-out); }
.rq-who { font-weight: 600; color: var(--q, var(--blue)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.rq-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }

.media { display: block; margin: -4px -8px 5px -9px; border-radius: 15px; overflow: hidden; position: relative; background: rgba(0,0,0,.06); cursor: pointer; }
/* la foto riempie sempre il riquadro: prima un'immagine lunga si fermava a 440 px e sotto restava una fascia grigia vuota (Giovanni 16:10) */
.media img, .media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.bubble.only-media { padding: 4px; }
.bubble.only-media .media { margin: 0; border-radius: 15px; }
.msg.last-in-group .bubble.only-media::after { display: none; }
.progress { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.28); color: #fff; font-size: 13px; font-weight: 600; }

.file { display: flex; align-items: center; gap: 12px; padding: 2px 0 2px; min-width: 220px; cursor: pointer; }
.file-ico { width: 50px; height: 50px; border-radius: 12px; background: var(--blue); display: grid; place-items: center; color: #fff; flex: none; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.msg.out .file-ico { background: var(--accent-out); }
.file-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.file-size { font-size: 14px; color: var(--time-in); }
.msg.out .file-size { color: var(--time-out); }

.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 1px 0; }
.voice .play { width: 46px; height: 46px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
.msg.out .voice .play { background: var(--accent-out); }
.voice .play svg { fill: currentColor; stroke: none; width: 22px; height: 22px; }
.voice-body { flex: 1; min-width: 0; }
.wave { display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; }
.wave i { width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--blue) 35%, transparent); flex: none; min-height: 3px; }
.wave i.on { background: var(--blue); }
.msg.out .wave i { background: color-mix(in srgb, var(--accent-out) 40%, transparent); }
.msg.out .wave i.on { background: var(--accent-out); }
.voice-time { font-size: 13px; color: var(--time-in); margin-top: 1px; }
.msg.out .voice-time { color: var(--time-out); }
.transcript { font-size: 14px; color: var(--text-3); margin-top: 4px; opacity: .85; }

.reactions { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0 1px; clear: both; }
.reaction { display: inline-flex; align-items: center; gap: 4px; height: 30px; border-radius: 15px; padding: 0 4px 0 8px; font-size: 14px; font-weight: 600; background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.msg.out .reaction { background: color-mix(in srgb, var(--accent-out) 18%, transparent); color: var(--accent-out); }
.reaction.mine { background: var(--blue); color: #fff; }
.msg.out .reaction.mine { background: var(--accent-out); color: #fff; }
.reaction .emo { font-size: 17px; }
.reaction .who { display: flex; }
.reaction .who .avatar { width: 22px; height: 22px; font-size: 9px; border: 1.5px solid var(--bubble-in); margin-left: -6px; }
.reaction .who .avatar:first-child { margin-left: 0; }
.reaction .cnt { padding-right: 6px; }

.down-btn { position: absolute !important; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 84px); width: 44px; height: 44px; border-radius: 50%; color: var(--text-2); display: grid; place-items: center; z-index: 3 !important; }
#chat:has(#rec-row:not([hidden]), #prev-row:not([hidden])) #down-btn { display: none; }   /* durante la registrazione la freccia copriva il tasto pausa (#4662) */
.down-count { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--blue); color: #fff; font-size: 12px; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; font-weight: 600; }

/* ---------- barra di scrittura ---------- */
.composer { flex: none; width: 100%; max-width: 760px; margin: 0 auto; padding: 6px 10px calc(env(safe-area-inset-bottom) + 8px); position: relative; }
.reply-bar { display: flex; align-items: center; gap: 10px; border-radius: 18px; padding: 6px 6px 6px 12px; margin: 0 58px 6px; }
.reply-ico { color: var(--blue); width: 22px; height: 22px; }
.reply-body { flex: 1; min-width: 0; border-left: 2.5px solid var(--blue); padding-left: 8px; font-size: 14px; }
.reply-who { color: var(--blue); font-weight: 600; }
.reply-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.x-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.input-pill { flex: 1; min-width: 0; border-radius: 24px; display: flex; align-items: flex-end; min-height: 48px; }
.input { flex: 1; min-width: 0; max-height: 36vh; overflow-y: auto; outline: 0; padding: 13px 4px 13px 16px; font-size: 17px; line-height: 1.3; white-space: pre-wrap; word-break: break-word; -webkit-user-select: text; user-select: text; }
.input:empty::before { content: attr(data-placeholder); color: var(--text-2); pointer-events: none; }
.in-btn { width: 44px; height: 46px; display: grid; place-items: center; color: var(--text-2); flex: none; }
#send-btn .ico-send { display: none; }
#send-btn.can-send { background: var(--blue); color: #fff; border-color: transparent; }
#send-btn.can-send .ico-send { display: block; stroke-width: 2.4; }
#send-btn.can-send .ico-mic { display: none; }

.rec-row { display: flex; align-items: center; gap: 8px; min-height: 48px; position: relative; }
.rec-pill { flex: 1; height: 48px; border-radius: 24px; display: flex; align-items: center; gap: 10px; padding: 0 18px; font-variant-numeric: tabular-nums; font-size: 17px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .15; } }
.rec-cancel { color: var(--blue); font-size: 17px; margin: 0 auto; padding-right: 40px; }
.rec-send { width: 76px; height: 76px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; margin: -14px -2px -6px 0; box-shadow: 0 0 0 10px color-mix(in srgb, var(--blue) 18%, transparent); animation: pulse 1.6s infinite; }
.rec-send svg { width: 34px; height: 34px; stroke-width: 2.4; }
#prev-row .rec-send { width: 48px; height: 48px; margin: 0; animation: none; box-shadow: none; }
#prev-row .rec-send svg { width: 24px; height: 24px; fill: #fff; stroke: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--blue) 10%, transparent); } }
.rec-stop { position: absolute; right: 18px; bottom: 72px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); }
.rec-stop svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }
.prev-pill { flex: 1; min-width: 0; height: 48px; border-radius: 24px; background: var(--blue); color: #fff; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 6px; font-variant-numeric: tabular-nums; font-size: 15px; }
.prev-play { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.prev-play svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }
.prev-wave { flex: 1; min-width: 0; overflow: hidden; }
#prev-time { flex: none; }
.prev-wave i { background: rgba(255,255,255,.5) !important; }
.prev-wave i.on { background: #fff !important; }

.emoji-panel { position: absolute; bottom: calc(100% + 2px); right: 66px; width: min(352px, calc(100% - 20px)); max-height: 300px; overflow-y: auto; border-radius: 18px; padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; z-index: 20; animation: pop .15s; transform-origin: bottom right; background: var(--glass-strong); }
.emoji-panel button { font-size: 28px; height: 42px; border-radius: 10px; }
.emoji-panel button:hover { background: var(--hover); }

/* ---------- menu sul messaggio (stile iOS: anteprima + reazioni + azioni) ---------- */
/* niente selezione di testo ne' fumetto di sistema sotto la pressione lunga: il menu si apre al posto loro, come Telegram */
.ctx-layer, .ctx-layer * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (pointer: coarse) { #timeline .msg, #timeline .msg * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.ctx-layer { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .15s; }
.ctx-box { position: fixed; display: flex; flex-direction: column; gap: 8px; animation: pop .16s; }
.ctx-reacts { display: flex; gap: 2px; padding: 5px 8px; border-radius: 26px; background: var(--glass-strong); box-shadow: var(--glass-shadow); align-self: flex-start; }
.ctx-reacts button { width: 40px; height: 40px; font-size: 26px; border-radius: 50%; display: grid; place-items: center; transition: transform .1s; }
.ctx-reacts button:active { transform: scale(1.25); }
.ctx-menu { background: var(--glass-strong); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: var(--glass-shadow); border-radius: 14px; overflow: hidden; min-width: 230px; align-self: flex-start; }
.ctx-menu button { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; height: 46px; padding: 0 16px; font-size: 17px; text-align: left; }
.ctx-menu button + button { border-top: .5px solid var(--sep); }
.ctx-menu button:active { background: var(--hover); }
.ctx-menu button svg { width: 22px; height: 22px; }
.ctx-menu .danger { color: var(--red); }
.ctx-box.out .ctx-reacts, .ctx-box.out .ctx-menu { align-self: flex-end; }

/* ---------- foglio dal basso (nuovo messaggio, gruppo, conferme) ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.3); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; background: var(--bg-grouped); border-radius: 14px 14px 0 0; display: flex; flex-direction: column; animation: up .3s cubic-bezier(.2,.8,.2,1); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 761px) { .sheet-layer { align-items: center; } .sheet { border-radius: 14px; } }
@keyframes up { from { transform: translateY(100%); } }
.sheet-head { display: flex; align-items: center; height: 56px; padding: 0 8px; }
.sheet-head .t { flex: 1; text-align: center; font-weight: 600; }
.sheet-head button { color: var(--blue); font-size: 17px; padding: 8px 10px; min-width: 80px; }
.sheet-head button:last-child { text-align: right; font-weight: 600; }
.sheet-head button:disabled { color: var(--text-2); }
.sheet-body { overflow-y: auto; padding: 0 0 16px; }
.sheet-body .group { margin: 0 14px 16px; }
.sheet .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 14px 10px; }
.chip { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); border-radius: 14px; padding: 4px 10px; font-size: 15px; cursor: pointer; }
.pick-list { list-style: none; margin: 0 14px; padding: 0; background: var(--cell); border-radius: 12px; overflow: hidden; }
.pick-list li { display: flex; gap: 12px; align-items: center; padding: 8px 14px; cursor: pointer; position: relative; }
.pick-list li + li::before { content: ""; position: absolute; top: 0; left: 70px; right: 0; border-top: .5px solid var(--sep); }
.pick-list li .avatar { width: 42px; height: 42px; font-size: 16px; }
.pick-list li .pl-name { font-weight: 500; }
.pick-list li .pl-sub { font-size: 14px; color: var(--text-2); }
.pick-list li .check { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--text-2); display: grid; place-items: center; }
.pick-list li.sel .check { background: var(--blue); border-color: var(--blue); color: #fff; }
.pick-list li.sel .check svg { width: 16px; height: 16px; stroke-width: 3; }
.pick-empty { padding: 16px; text-align: center; color: var(--text-2); font-size: 15px; }
.alert { text-align: center; padding: 20px 18px 6px; }
.alert h3 { margin: 0 0 6px; font-size: 17px; }
.alert p { margin: 0; font-size: 14px; color: var(--text-2); }
.alert-actions { display: flex; flex-direction: column; margin-top: 14px; }
.alert-actions button { height: 50px; color: var(--blue); font-size: 17px; border-top: .5px solid var(--sep); }
.alert-actions button.danger { color: var(--red); }
.alert-actions button.bold { font-weight: 600; }

/* ---------- info stanza ---------- */
.info { position: absolute; inset: 0; z-index: 20; background: var(--bg-grouped); display: flex; flex-direction: column; animation: fade .15s; }
@media (min-width: 1101px) { .info { position: relative; inset: auto; width: 360px; border-left: .5px solid var(--sep); flex: none; } }
.info-body { padding: 8px 0 24px !important; }
.info-hero { text-align: center; padding: 8px 0 18px; }
.info-hero .avatar { margin: 0 auto 10px; }
.info-hero h2 { margin: 0 0 2px; font-size: 22px; font-weight: 600; padding: 0 16px; }
.info-text { margin: 0 14px 18px; background: var(--cell); border-radius: 12px; padding: 10px 14px; font-size: 15px; white-space: pre-wrap; }
.info-label { margin: 0 30px 6px; font-size: 13px; color: var(--text-2); text-transform: uppercase; }

.viewer { position: fixed; inset: 0; background: #000; z-index: 70; display: grid; place-items: center; animation: fade .15s; }
.viewer img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.viewer-close { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 12px; color: #fff; background: rgba(60,60,60,.6); }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 14px); transform: translateX(-50%); background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--glass-shadow); padding: 12px 18px; border-radius: 16px; z-index: 80; font-size: 15px; max-width: calc(100% - 32px); animation: pop .2s; }

/* ---------- telefono: una colonna, la chat scorre da destra ---------- */
@media (max-width: 760px) {
  #sidebar { width: 100%; border-right: 0; }
  .chat { position: absolute; inset: 0; z-index: 10; transform: translateX(100%); transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s .32s; visibility: hidden; box-shadow: -4px 0 16px rgba(0,0,0,.08); }
  /* chiusa, la chat fuori schermo lasciava l'ombra sul bordo destro: la striscia grigia nelle foto di Giovanni 16:08 */
  #main.in-chat .chat { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2,.8,.2,1); }
  #main.in-chat .chat.dragging { transition: none; }
  #sidebar { transition: transform .32s cubic-bezier(.2,.8,.2,1); }
  #main.in-chat #sidebar { transform: translateX(-28%); }
  .chat.dragging, .chat.dragging ~ * { transition: none; }
}
@media (min-width: 761px) {
  .back-pill { display: none; }
  #page-chats .scroller { padding-bottom: 96px; }
}

/* piu' account (Impostazioni), come Telegram */
.acc-row .avatar { width: 32px; height: 32px; font-size: 13px; flex: none; }
.acc-row .row-label { display: flex; flex-direction: column; min-width: 0; }
.acc-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-id { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-check { width: 22px; height: 22px; color: var(--blue); stroke-width: 2.4; flex: none; }
.acc-add { color: var(--blue); }
.acc-plus { width: 32px; text-align: center; font-size: 26px; font-weight: 300; line-height: 1; }
.acc-row + .ios-row::before, .acc-add::before { left: 58px !important; }
.link-btn { display: block; margin: 14px auto 0; color: var(--blue); font-size: 17px; background: none; }

/* 13/11 vocale: il microfono non da' audio -> la riga di registrazione lo dice in rosso */
.rec-row.rec-bad #rec-time { color: var(--red); font-weight: 600; }

/* 13/11 05:1x come l'originale (screen Giovanni 04:48): la ricerca sta in alto, sopra le cartelle, pillola grande col testo al centro */
.glass-head .searchbar.big { margin: 10px 0 0; height: 44px; border-radius: 22px; justify-content: center; background: var(--glass-strong); box-shadow: var(--glass-shadow); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }
.glass-head .searchbar.big input { flex: 0 1 auto; width: 4.2em; text-align: left; transition: width .2s; }
.glass-head .searchbar.big:focus-within { justify-content: flex-start; padding: 0 14px; }
.glass-head .searchbar.big:focus-within input, .glass-head .searchbar.big input:not(:placeholder-shown) { flex: 1; width: auto; }
#page-chats .scroller { padding-top: calc(env(safe-area-inset-top) + 166px); }
#page-calls .scroller { padding-top: calc(env(safe-area-inset-top) + 68px); }

/* 13/11 05:2x Giovanni 04:49 «stessa distanza in basso» (misurato sugli screen 04:48): in Telegram la barra sta a ~22 pt
   dal fondo e dai lati ed e' un poco piu' bassa (61 invece di 64) */
.tabbar { left: 22px; right: 22px; height: 61px; bottom: max(calc(env(safe-area-inset-bottom) - 12px), 12px); }
.tb-lens-row { height: 61px; }
.tabbar svg path { transform-box: fill-box; transform-origin: center; }

/* 1.8.0 menu della lista (13/11 #4737): pressione lunga con anteprima, scorrimento a sinistra, cartelle */
.chatlist li { touch-action: pan-y; overflow: hidden; }
.chatlist li > :not(.sw-acts) { transform: translateX(var(--sx, 0px)); transition: transform .28s cubic-bezier(.2,.9,.3,1.1); }
.chatlist li.sw-drag > :not(.sw-acts) { transition: none; }
.sw-acts { position: absolute; top: 0; bottom: 0; right: 0; width: 222px; display: flex; align-items: center; justify-content: space-around; padding: 0 6px; z-index: 0; }
.chatlist li > .avatar { position: relative; z-index: 1; }
.chatlist li > .cl-main { position: relative; z-index: 1; background: var(--bg); }
.sw-acts button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text); }
.sw-acts button svg { width: 52px; height: 52px; padding: 13px; border-radius: 50%; color: #fff; stroke: currentColor; fill: none; stroke-width: 1.8; }
.sw-mute svg { background: #f09a37; } .sw-del svg { background: var(--red, #ff3b30); } .sw-arch svg { background: #a3a3a8; }
.pin-ico { width: 16px; height: 16px; color: var(--text-2); fill: none; stroke: currentColor; stroke-width: 1.8; transform: rotate(45deg); }
.row-ctx { inset: max(20px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom)); justify-content: center; gap: 10px; max-width: 520px; margin: 0 auto; }
.row-ctx .ctx-menu { align-self: flex-end; }
.pv-card { border-radius: 18px; overflow: hidden; background: var(--bg-grouped); box-shadow: var(--glass-shadow); }
.pv-head { padding: 10px 14px; text-align: center; background: var(--glass-strong); display: flex; flex-direction: column; font-size: 16px; }
.pv-head span { font-size: 12px; color: var(--text-2); }
.pv-body { height: min(38vh, 300px); overflow: hidden; padding: 8px 10px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }   /* altezza fissa: i messaggi che arrivano dopo non spostano il menu sotto il dito */
.ctx-layer:has(.row-ctx) { background: rgba(0,0,0,.22); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.pv-msg { align-self: flex-start; max-width: 82%; background: var(--bubble-in, #fff); border-radius: 14px; padding: 6px 10px; font-size: 15px; line-height: 1.3; word-break: break-word; }
.pv-msg.out { align-self: flex-end; background: var(--bubble-out, #e1fec6); }
.pv-who { font-size: 13px; font-weight: 600; color: var(--blue); }
.pv-t { font-size: 11px; color: var(--text-2); margin-left: 8px; float: right; margin-top: 4px; }
.pv-empty { text-align: center; color: var(--text-2); padding: 24px 0; font-size: 14px; }
.new-folder { display: flex; gap: 8px; padding: 8px 12px; border-top: .5px solid var(--sep); }
.new-folder input { flex: 1; height: 36px; border-radius: 10px; border: .5px solid var(--sep); padding: 0 10px; font-size: 16px; background: var(--bg); color: var(--text); }
.new-folder button { height: 36px; border-top: none !important; padding: 0 10px; }

/* foglio Permessi (#4739, 13/11): 3 righe con lo stato, come una tabella di Impostazioni */
.perm-list { margin: 14px 0 0; text-align: left; border-top: .5px solid var(--sep); }
.perm-row { display: flex; justify-content: space-between; align-items: center; min-height: 40px; font-size: 16px; border-bottom: .5px solid var(--sep); }
.perm-st { font-size: 14px; color: var(--text-2); }
.perm-st.perm-si { color: #34c759; font-weight: 600; }
.perm-st.perm-no { color: var(--red); font-weight: 600; }
.alert p.perm-note { margin-top: 10px; font-size: 13px; text-align: left; }
