/* =====================================================================
   SHIBATALKS 3.0 — SYSTEM PROJEKTOWY
   ---------------------------------------------------------------------
   1. Tokeny (kolory, typografia, odstępy, promienie, ruch)
   2. Baza
   3. Elementy podstawowe (przyciski, pola, ikony, awatary)
   4. Szkielet aplikacji (komputer / tablet / telefon)
   5. Nawigacja (rail / dolny pasek)
   6. Lista rozmów
   7. Czat: nagłówek, wiadomości, kompozytor
   8. Panele boczne, wyszukiwanie
   9. Rozmowy głosowe
  10. Pulpit (zadania, notatki)
  11. Okna i arkusze, transfer plików
  12. Ustawienia
  13. Menu, toasty, przełącznik rozmów
  14. Różne (lightbox, paski przewijania, dostępność)
   Zasady: siatka 4 pt, cele dotyku ≥ 44 px, kolory tylko z tokenów,
   animacje = krzywe sprężyn (linear()) wygenerowane z fizyki oscylatora.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENY
   --------------------------------------------------------------------- */
:root {
    color-scheme: light;
    /* Typografia: krój systemowy = natywny wygląd i zero pobierania czcionek */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, Ubuntu, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
    --fs-large: 32px; --fs-title1: 26px; --fs-title2: 21px; --fs-title3: 19px;
    --fs-headline: 16px; --fs-body: 15px; --fs-callout: 15px; --fs-sub: 14px; --fs-foot: 13px; --fs-cap: 12px; --fs-cap2: 11px;
    --fs-msg: 15px;

    /* Odstępy i promienie */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
    --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-full: 999px;
    --r-bubble: 20px; --r-bubble-join: 6px;

    /* Wymiary */
    --rail-w: 72px; --list-w: 340px; --panel-w: 340px;
    --hdr-h: 60px; --tab-h: 58px; --touch: 44px;

    /* Bezpieczne obszary: Capacitor 8 wstrzykuje --safe-area-inset-* (stare WebView Androida),
       wszędzie indziej działa env(). Bez fallbacków "20px" — na komputerze to ma być 0. */
    --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
    --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
    --sal: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
    --sar: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
    --safe-top: var(--sat); --safe-bottom: var(--sab);

    /* Ruch: sprężyny (response / dampingFraction jak w SwiftUI) jako krzywe linear() */
    --ease-snappy: cubic-bezier(.2,.9,.25,1); --dur-snappy: 380ms;
    --ease-smooth: cubic-bezier(.25,.85,.3,1); --dur-smooth: 520ms;
    --ease-bouncy: cubic-bezier(.3,1.35,.5,1); --dur-bouncy: 560ms;
    --ease-sheet: cubic-bezier(.2,.9,.25,1); --dur-sheet: 520ms;
    --ease-quick: cubic-bezier(.25,.8,.3,1); --dur-quick: 260ms;
    --ease-pop: cubic-bezier(.3,1.5,.5,1); --dur-pop: 520ms;
    --ease-out: cubic-bezier(.2,.8,.2,1);

    /* --- Jasny motyw (bazowe neutralne kolory) --- */
    --canvas: #f5ede7;
    --canvas-bg: linear-gradient(165deg, #eaf3f6 0%, #fbe4d6 60%, #ecd3c4 100%);
    --surface-1: rgba(255, 255, 255, 0.62);
    --surface-1-solid: #fbf6f2;
    --surface-2: rgba(255, 255, 255, 0.86);
    --surface-3: rgba(253, 251, 249, 0.96);
    --surface-sunk: rgba(31, 46, 72, 0.05);
    --material: rgba(250, 245, 241, 0.74);
    --material-strong: rgba(251, 247, 244, 0.92);
    --ink: #1f2e48;
    --ink-2: rgba(31, 46, 72, 0.66);
    --ink-3: rgba(31, 46, 72, 0.44);
    --line: rgba(31, 46, 72, 0.09);
    --line-strong: rgba(31, 46, 72, 0.15);
    --fill: rgba(31, 46, 72, 0.055);
    --fill-2: rgba(31, 46, 72, 0.1);
    --bubble-in: #ffffff;
    --bubble-in-ink: #1f2e48;
    --bubble-in-shadow: 0 1px 1.5px rgba(31, 46, 72, 0.08), 0 0 0 0.5px rgba(31, 46, 72, 0.05);
    --success: #24976a; --warning: #c77c00; --danger: #e5484d; --info: #2f74e8;
    --shadow-1: 0 1px 2px rgba(31, 46, 72, 0.06), 0 2px 8px rgba(31, 46, 72, 0.05);
    --shadow-2: 0 8px 28px rgba(31, 46, 72, 0.14), 0 2px 6px rgba(31, 46, 72, 0.06);
    --shadow-3: 0 24px 64px rgba(31, 46, 72, 0.22), 0 4px 14px rgba(31, 46, 72, 0.08);
    --scrim: rgba(18, 22, 32, 0.38);
    --chrome: #f6eee8;
    --blur: saturate(180%) blur(22px);

    /* --- Akcent (domyślnie koral) --- */
    --accent: #ee6a51;
    --accent-hi: #ff8a6f;
    --accent-ink: #ffffff;
    --accent-soft: rgba(238, 106, 81, 0.13);
    --accent-text: #c4472f;       /* akcent jako tekst na jasnym tle (kontrast ≥ 4.5) */
    --bubble-out: linear-gradient(172deg, #f87b63 0%, #e65a42 100%);
    --bubble-out-solid: #ee6a51;
    --bubble-out-ink: #ffffff;
}

@supports (transition-timing-function: linear(0, 1)) {
    :root {
        --ease-snappy: linear(0, 0.0346 3.6%, 0.1175 7.1%, 0.2246 10.7%, 0.3398 14.3%, 0.4525 17.9%, 0.5565 21.4%, 0.6485 25%, 0.7273 28.6%, 0.7929 32.1%, 0.8464 35.7%, 0.8889 39.3%, 0.922 42.9%, 0.9473 46.4%, 0.9662 50%, 0.98 53.6%, 0.99 57.1%, 1);
        --dur-snappy: 407ms;
        --ease-smooth: linear(0, 0.0374 3.6%, 0.1231 7.1%, 0.2296 10.7%, 0.3401 14.3%, 0.4453 17.9%, 0.5405 21.4%, 0.6237 25%, 0.6948 28.6%, 0.7544 32.1%, 0.8036 35.7%, 0.8439 39.3%, 0.8765 42.9%, 0.9027 46.4%, 0.9237 50%, 0.9403 53.6%, 0.9535 57.1%, 0.964 60.7%, 0.9722 64.3%, 0.9786 67.9%, 1);
        --dur-smooth: 565ms;
        --ease-bouncy: linear(0, 0.0314 3.6%, 0.1099 7.1%, 0.2158 10.7%, 0.3342 14.3%, 0.454 17.9%, 0.5677 21.4%, 0.6706 25%, 0.76 28.6%, 0.835 32.1%, 0.8958 35.7%, 0.9433 39.3%, 0.979 42.9%, 1.0045 46.4%, 1.0214 50%, 1.0314 53.6%, 1.0359 57.1%, 1.0363 60.7%, 1.0338 64.3%, 1.0294 67.9%, 1.0239 71.4%, 1.0179 75%, 1);
        --dur-bouncy: 572ms;
        --ease-sheet: linear(0, 0.0324 3.6%, 0.1103 7.1%, 0.2115 10.7%, 0.3211 14.3%, 0.4292 17.9%, 0.5299 21.4%, 0.6201 25%, 0.6983 28.6%, 0.7645 32.1%, 0.8194 35.7%, 0.8639 39.3%, 0.8995 42.9%, 0.9274 46.4%, 0.9489 50%, 0.9652 53.6%, 0.9773 57.1%, 0.9861 60.7%, 1);
        --dur-sheet: 541ms;
        --ease-quick: linear(0, 0.0374 3.6%, 0.1232 7.1%, 0.2296 10.7%, 0.3401 14.3%, 0.4454 17.9%, 0.5406 21.4%, 0.6238 25%, 0.6949 28.6%, 0.7545 32.1%, 0.8037 35.7%, 0.844 39.3%, 0.8766 42.9%, 0.9028 46.4%, 0.9238 50%, 0.9404 53.6%, 0.9536 57.1%, 0.9641 60.7%, 1);
        --dur-quick: 296ms;
        --ease-pop: linear(0, 0.0532 3.6%, 0.1815 7.1%, 0.3456 10.7%, 0.5166 14.3%, 0.6751 17.9%, 0.8098 21.4%, 0.9158 25%, 0.9927 28.6%, 1.0431 32.1%, 1.0715 35.7%, 1.0827 39.3%, 1.0818 42.9%, 1.0731 46.4%, 1.0601 50%, 1.0457 53.6%, 1.0318 57.1%, 1.0196 60.7%, 1.0098 64.3%, 1.0024 67.9%, 0.9974 71.4%, 1);
        --dur-pop: 564ms;
    }
}

/* --- Ciemny motyw: głębokie neutralne szarości, bez zabarwienia --- */
[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #111214;
    --canvas-bg: #111214;
    --surface-1: #18191c;
    --surface-1-solid: #18191c;
    --surface-2: #222327;
    --surface-3: #2a2c30;
    --surface-sunk: rgba(0, 0, 0, 0.22);
    --material: rgba(24, 25, 28, 0.78);
    --material-strong: rgba(26, 27, 30, 0.94);
    --ink: #eceef1;
    --ink-2: rgba(236, 238, 241, 0.64);
    --ink-3: rgba(236, 238, 241, 0.4);
    --line: rgba(255, 255, 255, 0.065);
    --line-strong: rgba(255, 255, 255, 0.11);
    --fill: rgba(255, 255, 255, 0.055);
    --fill-2: rgba(255, 255, 255, 0.1);
    --bubble-in: #26282d;
    --bubble-in-ink: #eceef1;
    --bubble-in-shadow: none;
    --success: #3cc68a; --warning: #f0a830; --danger: #ff5f5f; --info: #5b9bff;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-3: 0 28px 70px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.35);
    --scrim: rgba(0, 0, 0, 0.55);
    --chrome: #141517;

    --accent: #ff7a63;
    --accent-hi: #ff9a85;
    --accent-soft: rgba(255, 122, 99, 0.15);
    --accent-text: #ff8f7a;
    --bubble-out: linear-gradient(172deg, #f2735c 0%, #d9553f 100%);
    --bubble-out-solid: #e5634c;
}

/* --- Przygaszony (dim): jaśniejsze, ciepło-neutralne szarości jak w dawnym ShibaTalks.
   Działa na bazie ciemnego motywu (data-theme="dark"), nadpisuje tylko paletę. --- */
[data-theme="dark"][data-shade="dim"] {
    --canvas: #36393f;
    --canvas-bg: #36393f;
    --surface-1: #2f3136;
    --surface-1-solid: #2f3136;
    --surface-2: #40444b;
    --surface-3: #3a3d43;
    --surface-sunk: rgba(0, 0, 0, 0.14);
    --material: rgba(47, 49, 54, 0.82);
    --material-strong: rgba(47, 49, 54, 0.96);
    --ink: #dcddde;
    --ink-2: rgba(220, 221, 222, 0.7);
    --ink-3: rgba(220, 221, 222, 0.47);
    --line: rgba(255, 255, 255, 0.06);
    --line-strong: rgba(255, 255, 255, 0.1);
    --fill: rgba(255, 255, 255, 0.06);
    --fill-2: rgba(255, 255, 255, 0.11);
    --bubble-in: #2b2d31;
    --bubble-in-ink: #dcddde;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-3: 0 28px 70px rgba(0, 0, 0, 0.42), 0 4px 16px rgba(0, 0, 0, 0.25);
    --scrim: rgba(0, 0, 0, 0.45);
    --chrome: #2f3136;
}

/* --- Akcenty (Ustawienia → Wygląd). Każdy ma wariant jasny i ciemny. --- */
[data-accent="indigo"] { --accent: #5865f2; --accent-hi: #7984ff; --accent-soft: rgba(88, 101, 242, 0.13); --accent-text: #4250e0; --bubble-out: linear-gradient(172deg, #6874f6 0%, #4d59e6 100%); --bubble-out-solid: #5865f2; }
[data-theme="dark"][data-accent="indigo"] { --accent: #6d79ff; --accent-hi: #8f98ff; --accent-soft: rgba(109, 121, 255, 0.17); --accent-text: #9aa3ff; --bubble-out: linear-gradient(172deg, #6370f3 0%, #4b56e0 100%); --bubble-out-solid: #5865f2; }
[data-accent="ocean"] { --accent: #1a84f0; --accent-hi: #45a0ff; --accent-soft: rgba(26, 132, 240, 0.12); --accent-text: #0b6bd0; --bubble-out: linear-gradient(172deg, #2b95ff 0%, #0b74e3 100%); --bubble-out-solid: #1a84f0; }
[data-theme="dark"][data-accent="ocean"] { --accent: #3d9cff; --accent-hi: #69b3ff; --accent-soft: rgba(61, 156, 255, 0.16); --accent-text: #6cb4ff; --bubble-out: linear-gradient(172deg, #2a8ff5 0%, #0d6fd8 100%); --bubble-out-solid: #1a84f0; }
[data-accent="violet"] { --accent: #8a5cf5; --accent-hi: #a17bff; --accent-soft: rgba(138, 92, 245, 0.13); --accent-text: #6f3fe0; --bubble-out: linear-gradient(172deg, #9a6cfa 0%, #7a48e6 100%); --bubble-out-solid: #8a5cf5; }
[data-theme="dark"][data-accent="violet"] { --accent: #a07dff; --accent-hi: #b89cff; --accent-soft: rgba(160, 125, 255, 0.17); --accent-text: #b9a0ff; --bubble-out: linear-gradient(172deg, #9567f7 0%, #7444e0 100%); --bubble-out-solid: #8a5cf5; }

/* --- Zgodność: stare nazwy zmiennych (komponenty ustawień, strony logowania, style inline w JS) --- */
:root, [data-theme="dark"] {
    --bg-app: var(--canvas-bg);
    --bg-sidebar: var(--surface-1);
    --bg-chat: var(--surface-1);
    --bg-input: var(--surface-2);
    --bg-modal: var(--surface-3);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-2);
    --msg-sent: var(--accent);
    --msg-text-sent: var(--accent-ink);
    --msg-received: var(--bubble-in);
    --msg-text-received: var(--bubble-in-ink);
    --border-color: var(--line-strong);
    --hover-color: var(--fill);
    --shadow: var(--shadow-2);
    --rail-bg: var(--chrome);
    --icon-invert: 0;
}
[data-theme="dark"] { --icon-invert: 1; }

/* ---------------------------------------------------------------------
   2. BAZA
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    overscroll-behavior: none;            /* bez "gumy" całej strony i gestów historii */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
html { background: var(--canvas); }
body {
    font-family: var(--font);
    font-size: var(--fs-body);
    line-height: 1.4;
    color: var(--ink);
    background: var(--canvas-bg);
    background-color: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    font-synthesis-weight: none;
    text-rendering: optimizeLegibility;
}
body > main { inset: 0; height: auto !important; width: 100% !important; }
/* PWA na iOS: innerHeight/dvh/inset:0 kończą się NAD strefą wskaźnika Home (WebKit 254868),
   co dawało pusty pas na dole. 100vh w trybie standalone obejmuje cały ekran; viewport.js
   dodatkowo podaje --app-h = wysokość ekranu (i wysokość nad klawiaturą, gdy jest otwarta). */
@media (display-mode: standalone) {
    html.is-ios, html.is-ios body { height: var(--app-h, 100vh); }
    /* !important: "body > main { height: auto !important }" wygrywało, #root-view miał wtedy wysokość
       swojej zawartości (0 dla ekranu logowania z position:absolute) — czarny ekran bez pól w PWA */
    html.is-ios #root-view { bottom: auto; height: var(--app-h, 100vh) !important; }
    html.is-ios #app-wrapper { bottom: auto; height: var(--app-h, 100vh); }
}
button, input, textarea, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: var(--accent-text); }
img, svg, video { max-width: 100%; }
h1 { font-family: var(--font-display); }
::selection { background: var(--accent-soft); }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-foot); }
.text-center { text-align: center; }
.center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
kbd {
    font-family: var(--font); font-size: var(--fs-cap); font-weight: 600;
    padding: 1px 6px; border-radius: 5px; background: var(--fill); border: 1px solid var(--line-strong);
    color: var(--ink-2);
}

/* ---------------------------------------------------------------------
   3. ELEMENTY PODSTAWOWE
   --------------------------------------------------------------------- */
.ic { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-success { color: var(--success); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: var(--touch); min-height: var(--touch);
    padding: 0; border: 0; border-radius: var(--r-full);
    background: transparent; color: var(--ink-2);
    cursor: pointer; font-size: 18px; line-height: 1;
    transition: background var(--dur-quick) var(--ease-quick), color var(--dur-quick) var(--ease-quick), transform var(--dur-pop) var(--ease-pop);
}
@media (hover: hover) { .icon-btn:hover { background: var(--fill); color: var(--ink); } }
.icon-btn:active { transform: scale(0.9); transition-duration: 80ms; }

.primary-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 48px; padding: 12px 18px; margin: 6px 0;
    border: 0; border-radius: var(--r-md);
    background: var(--accent); color: var(--accent-ink);
    font-weight: 650; font-size: var(--fs-headline); letter-spacing: -0.01em;
    cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.18);
    transition: transform var(--dur-pop) var(--ease-pop), filter var(--dur-quick) var(--ease-quick), opacity .2s;
}
@media (hover: hover) { .primary-btn:hover { filter: brightness(1.06); } }
.primary-btn:active { transform: scale(0.97); transition-duration: 90ms; }
.primary-btn:disabled { opacity: .5; cursor: default; transform: none; }

.secondary-btn, .secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 44px; padding: 10px 16px; margin: 6px 0;
    border: 0; border-radius: var(--r-md);
    background: var(--fill); color: var(--ink);
    font-weight: 600; cursor: pointer;
    transition: background var(--dur-quick) var(--ease-quick), transform var(--dur-pop) var(--ease-pop);
}
@media (hover: hover) { .secondary-btn:hover { background: var(--fill-2); } }
.secondary-btn:active { transform: scale(0.97); transition-duration: 90ms; }
.secondary-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.danger-outline { color: var(--danger) !important; background: color-mix(in srgb, var(--danger) 10%, transparent) !important; }
.primary-btn.inline, .secondary-btn.inline { width: auto; margin: 0; min-height: 38px; padding: 8px 14px; white-space: nowrap; }
.text-btn { display: block; width: 100%; padding: 12px; border: 0; background: none; color: var(--ink-2); font-weight: 600; cursor: pointer; border-radius: var(--r-md); }
.text-btn:active { background: var(--fill); }

.auth-input, .search-input, select.auth-input, textarea.auth-input {
    width: 100%; min-height: 44px; padding: 11px 14px; margin: 0 0 10px;
    border: 1px solid var(--line-strong); border-radius: var(--r-md);
    background: var(--surface-2); color: var(--ink);
    font-size: 16px;                      /* 16 px = brak automatycznego zoomu na iOS */
    outline: none; -webkit-appearance: none; appearance: none;
    transition: border-color var(--dur-quick) var(--ease-quick), box-shadow var(--dur-quick) var(--ease-quick);
}
select.auth-input { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.auth-input:focus, .search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-input::placeholder, .search-input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.field-label { display: block; text-align: left; font-size: var(--fs-foot); font-weight: 600; color: var(--ink-2); margin: 4px 0 6px; }
.form-error { color: var(--danger); font-size: var(--fs-foot); min-height: 1.2em; margin: 4px 0 8px; }
#auth-error { color: var(--danger); text-align: center; margin-top: 10px; }

/* Pole wyszukiwania z ikoną (lista, panele, okna) */
.search-field {
    position: relative; display: flex; align-items: center; gap: 8px;
    min-height: 40px; padding: 0 12px; border-radius: var(--r-md);
    background: var(--fill); color: var(--ink-3);
    transition: background var(--dur-quick) var(--ease-quick), box-shadow var(--dur-quick) var(--ease-quick);
}
.search-field .ic { width: 18px; height: 18px; }
.search-field .search-input { flex: 1; min-width: 0; min-height: 40px; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none !important; }
.search-field:focus-within { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-strong), 0 0 0 4px var(--accent-soft); }
.search-field .icon-btn { min-width: 32px; min-height: 32px; }
.search-field .icon-btn .ic { width: 16px; height: 16px; }

.avatar {
    position: relative; flex-shrink: 0;
    width: 44px; height: 44px; border-radius: 50%;
    background-color: var(--fill-2); background-size: cover; background-position: center;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; overflow: hidden;
}
.avatar[data-initial] { container-type: size; }
.avatar[data-initial]::after {
    content: attr(data-initial); font-size: 42cqh; font-weight: 650; color: #fff; line-height: 1;
}

/* Kontrolka segmentowa (iOS) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--fill); }
.segmented > button { border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: var(--fs-sub); padding: 7px 14px; border-radius: 9px; cursor: pointer; transition: background var(--dur-snappy) var(--ease-snappy), color .2s, box-shadow .2s; }
.segmented > button.active { background: var(--surface-3); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 0.5px var(--line); }

.filter-chip {
    flex-shrink: 0; border: 0; border-radius: var(--r-full);
    padding: 6px 13px; min-height: 32px;
    background: var(--fill); color: var(--ink-2);
    font-weight: 600; font-size: var(--fs-foot); cursor: pointer;
    transition: background var(--dur-quick) var(--ease-quick), color var(--dur-quick) var(--ease-quick), transform var(--dur-pop) var(--ease-pop);
}
.filter-chip.active { background: var(--ink); color: var(--canvas); }
[data-theme="dark"] .filter-chip.active { background: var(--ink); color: #111; }
.filter-chip:active { transform: scale(0.95); }

.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 22px; text-align: center; cursor: pointer;
    border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
    color: var(--ink-2); background: var(--surface-sunk);
    transition: border-color var(--dur-quick) var(--ease-quick), background var(--dur-quick) var(--ease-quick), transform var(--dur-snappy) var(--ease-snappy);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.dropzone.dragover { transform: scale(1.01); }

/* ---------------------------------------------------------------------
   4. SZKIELET APLIKACJI
   --------------------------------------------------------------------- */
#app-wrapper {
    position: fixed; inset: 0;
    height: var(--app-h, 100dvh);
    display: flex; overflow: hidden;
    touch-action: pan-y;
    padding-left: var(--sal); padding-right: var(--sar);
}
.desktop-only { }
.mobile-only { display: none !important; }

.sidebar {
    position: relative; z-index: 10;
    width: var(--list-w); flex-shrink: 0;
    display: flex; flex-direction: column; min-height: 0;
    background: var(--surface-1);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-right: 1px solid var(--line);
}
[data-theme="dark"] .sidebar { backdrop-filter: none; -webkit-backdrop-filter: none; }

.chat-area {
    position: relative; z-index: 5;
    flex: 1; min-width: 0; height: 100%;
    display: flex; flex-direction: column;
    background: transparent;
}
[data-theme="dark"] .chat-area { background: var(--canvas); }
#active-chat { flex: 1; min-height: 0; display: flex; position: relative; }
.chat-column { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.nav-dim { display: none; }

@media (max-width: 1100px) and (min-width: 769px) { :root { --list-w: 300px; } }

/* ---------------------------------------------------------------------
   5. NAWIGACJA: RAIL (komputer)
   --------------------------------------------------------------------- */
.app-rail {
    position: relative; z-index: 30;
    width: var(--rail-w); flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: calc(var(--sat) + 12px) 0 calc(var(--sab) + 12px);
    background: rgba(255, 255, 255, 0.34);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-right: 1px solid var(--line);
}
[data-theme="dark"] .app-rail { background: #0e0f11; border-right-color: transparent; }
@media (min-width: 769px) { [data-theme="dark"][data-shade="dim"] .app-rail { background: #202225; } }
.rail-btn {
    position: relative; width: 64px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 4px 0; border: 0; background: transparent; cursor: pointer;
    color: var(--ink-2); font-size: var(--fs-cap2); font-weight: 600;
}
.rail-icon {
    position: relative; width: 48px; height: 48px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    background: var(--fill);
    transition: border-radius var(--dur-snappy) var(--ease-snappy), background var(--dur-quick) var(--ease-quick), color var(--dur-quick) var(--ease-quick), transform var(--dur-pop) var(--ease-pop);
}
.rail-icon .ic { width: 24px; height: 24px; }
@media (hover: hover) { .rail-btn:hover .rail-icon { border-radius: 14px; background: var(--fill-2); color: var(--ink); } }
.rail-btn:active .rail-icon { transform: scale(0.92); }
.rail-btn.active { color: var(--ink); }
.rail-btn.active .rail-icon { background: var(--accent); color: var(--accent-ink); border-radius: 14px; box-shadow: 0 6px 16px -6px var(--accent); }
.rail-btn::before {
    content: ''; position: absolute; left: -4px; top: 50%; width: 4px; height: 0; margin-top: -12px;
    border-radius: 0 4px 4px 0; background: var(--ink); transform: translateY(12px);
    transition: height var(--dur-snappy) var(--ease-snappy), transform var(--dur-snappy) var(--ease-snappy);
}
.rail-btn.active::before { height: 24px; transform: translateY(0); }
.rail-btn.has-unread .rail-icon::after {
    content: ''; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px;
    background: var(--danger); border-radius: 50%; border: 2.5px solid var(--chrome);
}
.rail-sep { width: 32px; height: 2px; border-radius: 2px; background: var(--line-strong); margin: 4px 0; }
.rail-servers { display: flex; flex-direction: column; gap: 6px; }
.rail-add .rail-icon { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--ink-3); }
.rail-spacer { flex: 1; }
.rail-me .avatar { width: 44px; height: 44px; }
.rail-me .rail-icon { background: transparent; }
.rail-me .rail-label { display: none; }
.rail-me.active .rail-icon { background: transparent; box-shadow: 0 0 0 2.5px var(--accent); border-radius: 50%; }

/* ---------------------------------------------------------------------
   6. LISTA ROZMÓW
   --------------------------------------------------------------------- */
.list-compact-bar { display: none; }
.list-scroll {
    flex: 1; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(var(--sat) + 6px);
    padding-bottom: 12px;
    scrollbar-gutter: stable;
}
.home-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 6px 18px; }
.home-title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 750; letter-spacing: -0.025em; color: var(--ink); text-align: left; line-height: 1.1; }
.home-new-btn { background: var(--fill); color: var(--ink); }
.home-new-btn .ic { width: 20px; height: 20px; }

.sidebar-search { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 12px 8px; }
.sidebar-search .search-field { flex: 1; }
.search-compose-btn { display: none; }
#search-results {
    position: absolute; top: calc(100% - 2px); left: 12px; right: 12px; z-index: 50;
    max-height: min(360px, 55vh); overflow-y: auto; overscroll-behavior: contain;
    padding: 6px; border-radius: var(--r-lg);
    background: var(--surface-3); box-shadow: var(--shadow-3); border: 1px solid var(--line);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    transform-origin: top center;
    animation: popIn var(--dur-snappy) var(--ease-snappy);
}
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; min-height: 48px; }
.search-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.search-item:hover, .search-item:active { background: var(--fill); }
.search-item .avatar { width: 34px !important; height: 34px !important; }
.search-item .bot-badge { margin-left: auto; flex-shrink: 0; overflow: visible; font-weight: 750; }

.list-filters { display: flex; gap: 6px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.list-filters::-webkit-scrollbar { display: none; }
#app-wrapper:not(.list-mode-dm) .list-filters [data-filter="pinned"] { }
.sidebar-tabs { display: none !important; }

/* Pasek szybkiego dostępu (przypięte / ostatnie) */
.home-quick { padding: 2px 0 6px; }
.home-strip-head { display: flex; align-items: baseline; gap: 8px; padding: 4px 18px 6px; font-size: var(--fs-cap); font-weight: 650; color: var(--ink-3); }
.home-strip-head small { font-weight: 500; opacity: .8; }
.home-strip { display: flex; gap: 4px; overflow-x: auto; padding: 2px 10px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.home-strip::-webkit-scrollbar { display: none; }
.home-chip {
    flex-shrink: 0; width: 68px; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 4px 0; border: 0; border-radius: var(--r-md);
    background: transparent; color: var(--ink); cursor: pointer;
    -webkit-touch-callout: none; user-select: none;
    transition: transform var(--dur-pop) var(--ease-pop);
}
.home-chip:active { transform: scale(0.93); }
.home-chip-av {
    position: relative; width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px; color: #fff;
    background-color: var(--accent); background-size: cover; background-position: center;
}
.home-chip-av.ws { background: var(--surface-2); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.home-chip-av.ws svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.home-chip.unread .home-chip-av { box-shadow: 0 0 0 2.5px var(--surface-1-solid), 0 0 0 4.5px var(--accent); }
.home-chip.unread .home-chip-name { color: var(--ink); font-weight: 700; }
.home-badge { position: absolute; top: -3px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface-1-solid); }
.home-chip-name { font-size: var(--fs-cap); max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

#create-group-btn-container { padding: 0 12px 8px; }
.create-group-btn { margin: 0; min-height: 40px; color: var(--accent-text); background: var(--accent-soft); }
.create-group-btn .ic { width: 18px; height: 18px; }

/* Pozycja na liście: awatar | nazwa + podgląd | czas + znaczniki */
#conversations-list { padding: 0 8px; }
.conv-item {
    position: relative; display: flex; align-items: center; gap: 12px;
    min-height: 68px; padding: 8px 10px; margin: 1px 0;
    border-radius: var(--r-md); cursor: pointer;
    -webkit-touch-callout: none; user-select: none;
    transition: background var(--dur-quick) var(--ease-quick), transform var(--dur-pop) var(--ease-pop);
}
.conv-item > .avatar { width: 52px; height: 52px; }
@media (hover: hover) { .conv-item:hover { background: var(--fill); } }
.conv-item:active { background: var(--fill-2); transform: scale(0.985); }
.conv-item.active { background: var(--accent-soft); }
.conv-item.active .conv-name-text { color: var(--ink); }
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.conv-name-text {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 4px;
    font-weight: 600; font-size: var(--fs-headline) !important; letter-spacing: -0.01em; color: var(--ink);
}
.conv-name-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-name-text > span[title], .conv-name-text img { flex-shrink: 0; }
.conv-name-text img { width: 15px !important; height: 15px; opacity: .55; position: static !important; filter: invert(var(--icon-invert)); }
.conv-lock { flex-shrink: 0; display: inline-flex; color: var(--success); }
.conv-lock.partial { color: var(--ink-3); }
.conv-lock .ic { width: 14px; height: 14px; stroke-width: 2.1; }
.conv-time { flex-shrink: 0; font-size: var(--fs-cap); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.conv-preview {
    display: flex; align-items: center; gap: 6px; min-width: 0;
    font-size: var(--fs-sub); color: var(--ink-2); line-height: 1.3;
}
.conv-preview-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-preview-text:empty::before { content: '\00a0'; }
.conv-muted-icon { flex-shrink: 0; margin-left: 2px; font-size: 12px; opacity: .6; }
.unread-dot {
    display: none; flex-shrink: 0;
    min-width: 10px; height: 10px; border-radius: 5px;
    background: var(--accent); box-shadow: none;
}
.conv-item.unread .unread-dot { display: block; animation: popIn var(--dur-pop) var(--ease-pop); }
.conv-item.unread .conv-name-text { font-weight: 750; }
.conv-item.unread .conv-preview-text { color: var(--ink); font-weight: 550; }
.conv-item.unread .conv-time { color: var(--accent-text); font-weight: 600; }
.conv-item.muted .unread-dot { background: var(--ink-3); }
.conv-item.muted .conv-name-text { opacity: 1; }
.conv-item.pinned .conv-time::before { content: '📌'; font-size: 10px; margin-right: 4px; opacity: .55; }
.conv-item.filtered-out { display: none; }
.list-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 24px; text-align: center; color: var(--ink-2); }
.list-empty-art { font-size: 44px; margin-bottom: 6px; }
.list-empty strong { color: var(--ink); font-size: var(--fs-headline); }

/* Pasek rozmowy głosowej (pod listą) */
.mini-voice-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin: 8px 10px 0; padding: 6px 6px 6px 12px;
    border-radius: var(--r-lg);
    background: color-mix(in srgb, var(--success) 14%, var(--surface-2));
    box-shadow: var(--shadow-1), inset 0 0 0 1px color-mix(in srgb, var(--success) 30%, transparent);
    animation: slideUp var(--dur-bouncy) var(--ease-bouncy);
}
.voice-info { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; min-width: 0; }
.voice-info-text { display: flex; flex-direction: column; line-height: 1.15; }
.voice-info-text strong { font-size: var(--fs-foot); color: var(--success); }
.voice-info-text span { font-size: var(--fs-cap); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.voice-status-dot { width: 9px; height: 9px; flex-shrink: 0; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: livePulse 2s infinite; }
.voice-mini-actions { display: flex; gap: 4px; }
.voice-mini-actions .icon-btn { min-width: 38px; min-height: 38px; background: var(--fill); color: var(--ink); }
.hangup-btn { background: var(--danger) !important; color: #fff !important; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Profil na dole listy (komputer) */
.user-profile {
    display: flex; align-items: center; gap: 10px;
    margin: 8px; padding: 8px 8px 8px 10px; margin-bottom: calc(8px + var(--sab));
    border-radius: var(--r-md); cursor: pointer;
    background: var(--fill);
}
.user-profile:hover { background: var(--fill-2); }
.user-profile .avatar { width: 36px; height: 36px; }
.user-profile-text { flex: 1; min-width: 0; line-height: 1.2; }
#my-username { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-profile small { color: var(--ink-3); font-size: var(--fs-cap); }
.user-profile .icon-btn { min-width: 34px; min-height: 34px; pointer-events: none; }

/* ---------------------------------------------------------------------
   7. CZAT
   --------------------------------------------------------------------- */
#empty-state { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.empty-hero { max-width: 420px; text-align: center; color: var(--ink-2); animation: fadeUp var(--dur-smooth) var(--ease-smooth); }
.empty-logo { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px; display: grid; place-items: center; font-size: 44px; background: var(--surface-2); box-shadow: var(--shadow-2); }
.empty-hero h2 { margin: 0 0 6px; color: var(--ink); font-size: var(--fs-title2); letter-spacing: -0.02em; }
.empty-hero p { margin: 0 0 18px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.empty-action {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    width: 116px; padding: 16px 8px; border: 0; border-radius: var(--r-lg);
    background: var(--surface-2); color: var(--ink); cursor: pointer; font-weight: 600; font-size: var(--fs-foot);
    box-shadow: var(--shadow-1);
    transition: transform var(--dur-pop) var(--ease-pop), box-shadow var(--dur-quick);
}
.empty-action .ic { color: var(--accent); width: 26px; height: 26px; }
.empty-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.empty-action:active { transform: scale(0.96); }
.empty-hint { margin-top: 22px !important; font-size: var(--fs-foot); color: var(--ink-3); }

/* Nagłówek czatu: materiał (rozmycie), treść przewija się POD nim */
.chat-header {
    position: absolute; top: 0; left: 0; right: 0; z-index: 30;
    display: flex; align-items: center; gap: 4px;
    min-height: calc(var(--hdr-h) + var(--sat));
    padding: var(--sat) 8px 0 12px;
    isolation: isolate;
    box-shadow: 0 0.5px 0 var(--line-strong);
}
/* Materiał (rozmycie tła) na osobnej warstwie POD treścią. Safari na iOS przy backdrop-filter
   na samym nagłówku (wewnątrz .chat-area z will-change: transform) rozmywał też jego zawartość —
   nazwę, zdjęcie i ikony. To samo dla kompozytora. */
.chat-header::before, .input-wrapper::before {
    content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: var(--material);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.nav-back {
    display: none; position: relative; align-items: center; gap: 2px;
    min-width: var(--touch); min-height: var(--touch); padding: 0 6px 0 0;
    border: 0; background: none; color: var(--accent-text); cursor: pointer;
    font-weight: 500; font-size: var(--fs-headline);
}
.nav-back .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.nav-back:active { opacity: .5; }
.nav-back-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-left: -4px; }
.chat-identity {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 4px 4px; border-radius: var(--r-md); cursor: pointer;
    transition: background var(--dur-quick) var(--ease-quick);
}
@media (hover: hover) { .chat-identity:hover { background: var(--fill); } }
.chat-identity:active { background: var(--fill-2); }
#current-chat-avatar { width: 38px; height: 38px; }
.chat-identity-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
#chat-title { font-weight: 650; font-size: var(--fs-headline); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-subtitle { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-cap); color: var(--ink-2); overflow: hidden; white-space: nowrap; }
.chat-subtitle:not(:has(> :not(.hidden):not(:empty))) { display: none; }
.chat-subtitle-text { overflow: hidden; text-overflow: ellipsis; }
.enc-badge { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; color: var(--ink-2); }
.enc-badge .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.enc-badge.enc-full { color: var(--success); font-weight: 600; }
.enc-badge:hover { text-decoration: underline; }
.chat-actions { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.chat-actions .icon-btn { color: var(--ink-2); }
.chat-actions .icon-btn .ic { width: 22px; height: 22px; }
#voice-call-btn { color: var(--accent-text); }
#group-menu-btn { display: none !important; }
.conv-notify-btn:not(.is-muted) { display: none; }
.conv-notify-btn.is-muted { color: var(--warning); }
.conv-notify-btn svg { width: 22px; height: 22px; }
#chat-info-btn.on { color: var(--accent-text); background: var(--accent-soft); }

/* Lista wiadomości.
   Przewijak ma flex-direction: column-reverse — punkt zaczepienia przewijania jest na DOLE.
   Dzięki temu doczytanie starszych wiadomości (dopisanie treści u góry) w ogóle nie zmienia
   pozycji widoku: zero ręcznej kompensacji scrollTop, zero skoków, a pęd przewijania na iOS
   nie jest przerywany. Nowe wiadomości same "przyklejają się" do dołu, gdy jesteśmy na dole.
   scrollTop w tym układzie jest ≤ 0 (0 = sam dół) — obsługa w window.chatScroll (chat.js). */
#msg-scroller {
    flex: 1; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    overflow-anchor: none;
    display: flex; flex-direction: column-reverse;
    scroll-padding-top: calc(var(--hdr-h) + var(--sat) + 8px);
    scroll-padding-bottom: calc(var(--composer-h, 72px) + 12px);
}
#messages-container {
    flex: 0 0 auto;
    display: flex; flex-direction: column;
    padding: calc(var(--hdr-h) + var(--sat) + 8px) clamp(10px, 3vw, 28px) calc(var(--composer-h, 72px) + 12px);
}
.chat-column.has-voice #messages-container { padding-top: 12px; }
.chat-column.has-voice #msg-scroller { scroll-padding-top: 12px; }

/* Data: separator w treści + pływająca pigułka pod nagłówkiem podczas przewijania (iOS / Telegram) */
.date-separator {
    position: relative; z-index: 4;
    display: flex; justify-content: center;
    margin: 14px 0 6px; pointer-events: none;
}
.floating-date {
    position: absolute; z-index: 28; left: 50%; top: calc(var(--hdr-h) + var(--sat) + 8px);
    transform: translate(-50%, -6px); opacity: 0; pointer-events: none;
    padding: 4px 11px; border-radius: var(--r-full);
    font-size: var(--fs-cap); font-weight: 650; color: var(--ink-2);
    background: var(--material-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--shadow-1);
    transition: opacity var(--dur-quick) var(--ease-quick), transform var(--dur-snappy) var(--ease-snappy);
}
.floating-date.visible { opacity: 1; transform: translate(-50%, 0); }
.chat-column.has-voice .floating-date { display: none; }
.date-separator span {
    padding: 4px 11px; border-radius: var(--r-full);
    font-size: var(--fs-cap); font-weight: 650; color: var(--ink-2);
    background: var(--material-strong);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--shadow-1);
}

/* Grupy wiadomości */
.msg-group { display: flex; flex-direction: column; width: 100%; position: relative; margin-top: 10px; }
.msg-group.chained { margin-top: 2px; }
.msg-group.group-mine { align-items: flex-end; }
.msg-group.group-theirs { align-items: flex-start; }
.msg-author-header { display: flex; align-items: center; gap: 6px; margin: 0 0 3px 50px; min-width: 0; max-width: 80%; }
.msg-author-header .msg-author-avatar { display: none; }
.msg-author-name { font-size: var(--fs-cap); font-weight: 650; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-mine .msg-author-header, .is-dm .group-theirs .msg-author-header .msg-author-name { display: none; }
.is-dm .group-theirs .msg-author-header:not(:has(.bot-badge)) { display: none; }
.msg-time-small { font-size: var(--fs-cap2); color: var(--ink-3); }
.msg-author-header .msg-time-small { display: none; }

.msg-row { display: flex; align-items: flex-end; gap: 8px; width: 100%; position: relative; }
.group-mine .msg-row { justify-content: flex-end; }
.group-theirs .msg-row { justify-content: flex-start; }
.msg-gutter { width: 32px; flex-shrink: 0; align-self: flex-end; }
.msg-gutter .avatar { width: 32px; height: 32px; }
.group-theirs:has(+ .group-theirs.chained) .msg-gutter .avatar,
.group-theirs:has(+ .msg-group.chained.group-theirs) .msg-gutter .avatar { visibility: hidden; }
.is-dm .msg-gutter { width: 0; display: none; }
.is-dm .msg-author-header { margin-left: 0; }

.msg-bubble-wrapper { display: flex; flex-direction: column; max-width: min(78%, 620px); min-width: 0; position: relative; }
.msg-bubble-wrapper.mine { align-items: flex-end; }
.msg-bubble-wrapper.theirs { align-items: flex-start; }

.msg {
    position: relative; max-width: 100% !important;
    padding: 8px 13px 8px;
    border-radius: var(--r-bubble);
    font-size: var(--fs-msg); line-height: 1.38; letter-spacing: -0.003em;
    overflow-wrap: anywhere; word-break: normal;
    transform-origin: var(--origin, bottom right);
    transition: transform var(--dur-pop) var(--ease-pop), filter .2s;
}
.msg.mine { background: var(--bubble-out); background-color: var(--bubble-out-solid); color: var(--bubble-out-ink); --origin: bottom right; }
.msg.theirs { background: var(--bubble-in); color: var(--bubble-in-ink); box-shadow: var(--bubble-in-shadow); --origin: bottom left; }
/* Ciągłość serii: wewnętrzne rogi zmniejszone (iMessage / Messenger) */
.group-mine:has(+ .group-mine.chained) .msg.mine { border-bottom-right-radius: var(--r-bubble-join); }
.group-mine.chained .msg.mine { border-top-right-radius: var(--r-bubble-join); }
.group-theirs:has(+ .group-theirs.chained) .msg.theirs { border-bottom-left-radius: var(--r-bubble-join); }
.group-theirs.chained .msg.theirs { border-top-left-radius: var(--r-bubble-join); }
.msg-group.is-new .msg { animation: bubbleIn var(--dur-bouncy) var(--ease-bouncy); }
@keyframes bubbleIn { from { transform: translateY(14px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }

.msg-text { overflow-wrap: anywhere; }
.msg-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; word-break: break-all; }
.msg-text code { font-family: var(--font-mono); font-size: 0.88em; padding: 1px 5px; border-radius: 5px; background: rgba(0,0,0,.08) !important; }
.msg.mine .msg-text code { background: rgba(255,255,255,.2) !important; }
/* Zaznaczenie tekstu we własnych dymkach: --accent-soft na tle w kolorze akcentu było niewidoczne */
.msg.mine::selection, .msg.mine *::selection { background: rgba(255,255,255,.88); color: var(--bubble-out-solid); }
.msg.theirs::selection, .msg.theirs *::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.msg-text iframe { width: 100% !important; max-width: 420px; aspect-ratio: 16/9; height: auto !important; border-radius: 12px !important; margin-top: 8px; border: 0; }
/* Godzina POD dymkiem — tylko pod ostatnim dymkiem serii (iMessage/Messenger).
   Dotknięcie dymka pokazuje pełną datę. */
.msg-meta {
    display: inline-flex; align-items: center; gap: 3px;
    margin: 3px 6px 0; min-height: 14px;
    font-size: var(--fs-cap2); line-height: 1; font-variant-numeric: tabular-nums;
    color: var(--ink-3); white-space: nowrap; pointer-events: none;
}
.msg-meta .ic { width: 10px; height: 10px; stroke-width: 2.4; opacity: .9; }
.msg-meta .t-full { display: none; }
.msg-group:has(+ .msg-group.chained) .msg-meta { display: none; }
.msg-bubble-wrapper:has(> .msg.show-date) .msg-meta { display: inline-flex; animation: fadeUp var(--dur-quick) var(--ease-quick); }
.msg-bubble-wrapper:has(> .msg.show-date) .msg-meta .t-short { display: none; }
.msg-bubble-wrapper:has(> .msg.show-date) .msg-meta .t-full { display: inline; }
.msg-exact-date { display: none !important; } /* zostaje w DOM jako źródło daty (notatki) */
.msg.media-only { padding: 0; background: transparent !important; box-shadow: none !important; }
.msg.media-only .msg-gallery { box-shadow: var(--bubble-in-shadow); }
.msg.file-only { padding: 0; overflow: hidden; } /* wszystko w środku przycięte do zaokrąglenia dymka */
.msg.file-only .file-attachment { background: transparent; border-radius: inherit; }

.msg-edited-tag, .msg-pinned-tag { font-size: var(--fs-cap2); color: var(--ink-3); font-weight: 600; margin: 2px 12px 2px 50px; display: flex; gap: 4px; align-items: center; }
.is-dm .msg-edited-tag, .is-dm .msg-pinned-tag { margin-left: 12px; }
.group-mine .msg-edited-tag, .group-mine .msg-pinned-tag { margin: 2px 12px 2px 0; justify-content: flex-end; }
.msg-pinned-tag { color: var(--accent-text); }
.bot-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 750; letter-spacing: .04em; line-height: 1; padding: 3px 5px 2px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); text-transform: uppercase; }

/* Wiadomości systemowe i rejestr połączeń */
.msg.system-msg-bubble { background: transparent !important; box-shadow: none !important; color: var(--ink-2) !important; font-size: var(--fs-foot) !important; text-align: center; padding: 4px 8px !important; margin: 6px auto !important; pointer-events: none; }
.msg-group:has(.system-msg-bubble) .msg-bubble-wrapper, .msg-group:has(.call-log) .msg-bubble-wrapper { max-width: 92%; margin: 0 auto; }
.msg-group:has(.system-msg-bubble), .msg-group:has(.call-log) { align-items: center; }
.msg-row:has(.call-log), .msg-row:has(.system-msg-bubble) { justify-content: center !important; }
.msg-group:has(.call-log) .msg-gutter, .msg-group:has(.system-msg-bubble) .msg-gutter { display: none; }
.msg.call-log { background: var(--surface-2) !important; color: var(--ink-2) !important; font-size: var(--fs-foot); padding: 10px 16px; border-radius: var(--r-lg); box-shadow: var(--shadow-1); text-align: center; }
.msg.call-log .primary-btn { background: var(--success) !important; min-height: 36px; font-size: var(--fs-foot); }

/* Zdjęcia: galeria kafelkowa */
.msg-gallery { display: grid; gap: 2px; border-radius: 17px; overflow: hidden; }
.gallery-1 { display: block; }
.gallery-2 { grid-template-columns: 1fr 1fr; }
.gallery-3 { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.gallery-img { display: block; width: 100%; cursor: zoom-in; background: var(--fill); object-fit: cover; transition: filter .2s; -webkit-touch-callout: none; user-select: none; }
.gallery-1 .gallery-img { max-height: 360px; min-height: 120px; min-width: 140px; max-width: 440px !important; border-radius: 17px; }
@media (max-width: 768px) { .gallery-1 .gallery-img { max-width: 100% !important; } }
.gallery-2 .gallery-img, .gallery-3 .gallery-img { aspect-ratio: 1 / 1; }
.gallery-img:hover { filter: brightness(.94); }
.msg img { -webkit-touch-callout: none; user-select: none; }
.msg.ctx-source { opacity: 0; }
/* Podgląd pełnoekranowy: przytrzymanie zdjęcia daje systemowe "Zapisz / Kopiuj" (także w PWA) */
.fancybox__container img, .fancybox__container .fancybox__image { -webkit-touch-callout: default !important; -webkit-user-select: auto; user-select: auto; }
/* Dotyk: przytrzymanie dymka otwiera menu (z "Kopiuj tekst"), więc systemowe zaznaczanie
   tekstu i dymek iOS nie mogą przechwytywać gestu (to one zamykały menu pod palcem). */
.is-touch #messages-container .msg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.msg .msg-text + .msg-gallery { margin-top: 6px; }
/* Pliki E2EE: tło tylko na czas odszyfrowywania; po odszyfrowaniu wygląda jak zwykły plik */
.e2e-files-container > div[id^="e2e-file-"]:not(.e2e-file-done) { background: var(--fill); color: inherit; }
.msg.mine .e2e-files-container > div[id^="e2e-file-"]:not(.e2e-file-done) { background: rgba(255,255,255,.14); }
.e2e-files-container > .e2e-file-done + .e2e-file-done { margin-top: 4px; }
.msg.file-only .e2e-files-container { margin: 0 !important; }
.msg video { display: block; border-radius: 14px; max-width: 100%; background: #000; }

/* Pliki */
.file-attachment {
    display: flex; align-items: center; gap: 10px; min-width: min(240px, 60vw);
    padding: 10px 12px; border-radius: 15px; text-decoration: none; color: inherit;
    background: var(--fill); border: 0;
    transition: background var(--dur-quick) var(--ease-quick);
}
.msg.mine .file-attachment { background: rgba(255,255,255,.16); }
@media (hover: hover) { .file-attachment:hover { background: var(--fill-2); } .msg.mine .file-attachment:hover { background: rgba(255,255,255,.12); } }
.file-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent); color: #fff; font-size: 18px; }
.msg.mine .file-icon { background: rgba(255,255,255,.95); color: var(--accent); }
.file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { font-weight: 650; font-size: var(--fs-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100% !important; }
.file-type { font-size: var(--fs-cap); opacity: .75; text-transform: uppercase; letter-spacing: .02em; }
.file-download-icon { opacity: .7; }

/* Spoilery */
.spoiler-text { background: currentColor; color: transparent; border-radius: 5px; padding: 0 4px; cursor: pointer; transition: background .25s, color .25s; }
.msg.mine .spoiler-text { background: rgba(255,255,255,.55); }
.spoiler-text a, .spoiler-text code { visibility: hidden; }
.spoiler-text.revealed { background: var(--fill-2); color: inherit; }
.spoiler-text.revealed a, .spoiler-text.revealed code { visibility: visible; }
.spoiler-media { filter: blur(22px) brightness(.75); cursor: pointer; transform: scale(1.02); transition: filter .35s var(--ease-out); }

/* Cytaty (odpowiedzi) — lekkie, jak w pierwotnym UI: zagięta linia, autor, tekst, miniatura.
   Bez ramki i tła — nie konkurują z dymkiem. */
.msg-reply-outside {
    display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%;
    margin: 0 0 2px; padding: 0 4px;
    cursor: pointer; user-select: none; -webkit-user-select: none;
    color: var(--ink-3); font-size: var(--fs-foot); line-height: 1.25;
    white-space: nowrap; overflow: hidden;
    opacity: .85;
    transition: opacity var(--dur-quick) var(--ease-quick);
}
.msg-reply-outside:hover { opacity: 1; }
.msg-reply-outside:active { opacity: .6; }
.reply-spine {
    width: 14px; height: 11px; flex-shrink: 0;
    border-top: 2px solid var(--line-strong);
    margin-bottom: -9px; align-self: center;
}
.msg-bubble-wrapper.theirs .msg-reply-outside { padding-left: 8px; }
.msg-bubble-wrapper.theirs .reply-spine { border-left: 2px solid var(--line-strong); border-top-left-radius: 7px; }
.msg-bubble-wrapper.mine .msg-reply-outside { flex-direction: row-reverse; padding-right: 8px; }
.msg-bubble-wrapper.mine .reply-spine { border-right: 2px solid var(--line-strong); border-top-right-radius: 7px; }
.reply-author { font-weight: 650; color: var(--ink-2); flex-shrink: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.reply-body { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.reply-kind { font-weight: 600; }
.reply-caption { margin-left: 4px; opacity: .85; }
.reply-caption::before { content: '· '; opacity: .6; }
.reply-thumb { width: 28px; height: 28px; flex-shrink: 0; border-radius: 7px; overflow: hidden; background: var(--fill-2); display: inline-flex; align-items: center; justify-content: center; }
.reply-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reply-thumb.sticker { background: transparent; }
.reply-thumb.sticker img { object-fit: contain; }
.reply-thumb.spoiler img { filter: blur(6px); }
.reply-thumb.locked::after { content: '🔒'; font-size: 11px; }
.reply-thumb.broken::after { content: '🖼️'; font-size: 12px; }

/* Reakcje — tuż pod dymkiem, lekko na niego zachodzą (iMessage / Messenger); godzina pod nimi */
.reactions-container { display: flex; flex-wrap: wrap; gap: 4px; position: relative; z-index: 2; margin: -7px 10px 0; max-width: 100%; }
.msg-bubble-wrapper.mine > .reactions-container { justify-content: flex-end; }
.reactions-container:empty { display: none; }
.reactions-container:not(:empty) + .msg-meta { margin-top: 2px; }
.reaction-pill {
    display: inline-flex; align-items: center; gap: 4px;
    height: 26px; padding: 0 8px; border-radius: 13px;
    background: var(--surface-3); color: var(--ink-2);
    font-size: 14px; cursor: pointer; user-select: none;
    box-shadow: 0 0 0 2px var(--canvas), var(--shadow-1);
    transition: transform var(--dur-pop) var(--ease-pop), background var(--dur-quick);
    animation: popIn var(--dur-pop) var(--ease-pop);
}
.reaction-pill span { font-size: var(--fs-cap); font-weight: 650; font-variant-numeric: tabular-nums; }
.reaction-pill:active { transform: scale(0.9); }
.reaction-pill.active { background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 2px var(--canvas), inset 0 0 0 1.5px var(--accent); }
[data-theme="light"] .reaction-pill, :root:not([data-theme="dark"]) .reaction-pill { box-shadow: 0 0 0 2px #f7ece4, var(--shadow-1); }

.highlighted-msg .msg { animation: highlight 1.6s var(--ease-out); }
@keyframes highlight { 0%, 30% { filter: brightness(1.12); transform: scale(1.03); box-shadow: 0 0 0 3px var(--accent); } 100% { filter: none; transform: none; } }
/* Własny dymek ma kolor akcentu — obwódka w tym samym kolorze była niewidoczna, więc dodajemy przerwę w kolorze tła */
.highlighted-msg .msg.mine { animation-name: highlightMine; }
@keyframes highlightMine { 0%, 30% { filter: brightness(1.12); transform: scale(1.03); box-shadow: 0 0 0 2px var(--canvas), 0 0 0 5px var(--accent); } 100% { filter: none; transform: none; } }

/* Narzędzia przy wiadomości (najechanie myszą) */
.msg-actions-container {
    display: flex; align-items: center; gap: 2px; align-self: center;
    padding: 2px; border-radius: var(--r-full);
    background: var(--surface-3); box-shadow: var(--shadow-1), 0 0 0 0.5px var(--line-strong);
    opacity: 0; transform: scale(0.85); pointer-events: none;
    transition: opacity var(--dur-quick) var(--ease-quick), transform var(--dur-snappy) var(--ease-snappy);
}
.msg-act {
    width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent;
    display: grid; place-items: center; color: var(--ink-2); cursor: pointer; font-size: 15px;
}
.msg-act .ic { width: 17px; height: 17px; }
.msg-act:hover { background: var(--fill); color: var(--ink); }
@media (hover: hover) {
    .msg-row:hover .msg-actions-container, .msg-actions-container.open { opacity: 1; transform: none; pointer-events: auto; }
}
@media (hover: none) { .msg-actions-container { display: none !important; } }
.action-icon-btn { display: none; }

/* Gest "przesuń, by odpowiedzieć" */
.swipe-reply-icon {
    position: absolute; right: -44px; top: 50%;
    width: 32px; height: 32px; margin-top: -16px; border-radius: 50%;
    display: grid; place-items: center; color: var(--accent);
    background: var(--surface-3); box-shadow: var(--shadow-1);
    opacity: 0; transform: scale(0.4); pointer-events: none;
}
.swipe-reply-icon.from-left { right: auto; left: -44px; }
.swipe-reply-icon svg { width: 17px; height: 17px; margin: 0 !important; }

/* Przycisk "na dół" */
#jump-to-bottom {
    position: absolute; z-index: 25; right: 14px;
    bottom: calc(var(--composer-h, 72px) + 12px);
    width: 42px; height: 42px; border-radius: 50%; border: 0;
    display: grid; place-items: center;
    background: var(--material-strong); color: var(--ink-2);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--shadow-2), 0 0 0 0.5px var(--line-strong);
    cursor: pointer;
    transition: opacity var(--dur-quick) var(--ease-quick), transform var(--dur-bouncy) var(--ease-bouncy), bottom var(--dur-snappy) var(--ease-snappy);
}
#jump-to-bottom .ic { width: 20px; height: 20px; }
#jump-to-bottom.hidden-btn { opacity: 0; transform: translateY(16px) scale(0.6); pointer-events: none; }
.jump-badge { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------------- KOMPOZYTOR ---------------- */
.input-wrapper {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; flex-direction: column;
    padding: 8px 10px calc(8px + var(--sab));
    isolation: isolate;
    box-shadow: 0 -0.5px 0 var(--line-strong);
    transition: padding var(--dur-snappy) var(--ease-snappy);
}
.kb-open .input-wrapper { padding-bottom: 8px; }
.input-wrapper.dragover { box-shadow: inset 0 0 0 2px var(--accent); }
.input-wrapper.dragover::before { background: var(--accent-soft); }
.input-area { display: flex; align-items: flex-end; gap: 6px; }
.action-btn {
    width: 38px; height: 38px; flex-shrink: 0; border: 0; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer;
    background: transparent; color: var(--ink-2); font-size: 20px; padding: 0;
    transition: transform var(--dur-pop) var(--ease-pop), color var(--dur-quick), background var(--dur-quick);
}
.action-btn:active { transform: scale(0.88); }
.composer-attach { background: var(--fill); color: var(--ink-2); margin-bottom: 1px; }
.composer-attach .ic { width: 22px; height: 22px; stroke-width: 2.1; }
.composer-field {
    flex: 1; min-width: 0; display: flex; align-items: flex-end;
    min-height: 40px; padding: 0 4px 0 14px;
    border-radius: 20px; background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    transition: box-shadow var(--dur-quick) var(--ease-quick);
}
.composer-field:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
#message-input {
    flex: 1; min-width: 0; display: block;
    min-height: 40px; max-height: 40vh; padding: 9px 0; margin: 0;
    border: 0; outline: none; resize: none; background: transparent; color: var(--ink);
    font-size: 16px; line-height: 22px; font-family: inherit;
    overflow-y: auto; scrollbar-width: none; -webkit-appearance: none;
}
#message-input::-webkit-scrollbar { display: none; }
.composer-emoji { width: 34px; height: 34px; margin: 3px 0; color: var(--ink-3); }
.composer-emoji .ic { width: 22px; height: 22px; }
.send-icon {
    width: 40px; height: 40px; background: var(--fill-2); color: var(--ink-3);
    font-size: 15px; font-weight: 700;
}
.send-icon .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.chat-column.can-send .send-icon { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 12px -4px var(--accent); animation: sendReady var(--dur-pop) var(--ease-pop); }
@keyframes sendReady { from { transform: scale(0.7); } to { transform: scale(1); } }

.composer-banner {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 8px; padding: 6px 4px 6px 12px;
    border-radius: var(--r-md); background: var(--surface-2);
    box-shadow: inset 3px 0 0 var(--accent);
    font-size: var(--fs-foot); color: var(--ink-2);
    animation: slideUp var(--dur-snappy) var(--ease-snappy);
}
.composer-banner-edit { box-shadow: inset 3px 0 0 var(--warning); }
.composer-banner-ic { width: 20px; height: 20px; color: var(--accent); }
.composer-banner-edit .composer-banner-ic { color: var(--warning); }
.composer-banner-text { flex: 1; min-width: 0; }
.composer-banner-title strong { color: var(--ink); }
.composer-banner-title, .composer-banner-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-banner .icon-btn { min-width: 36px; min-height: 36px; }
.composer-banner .icon-btn .ic { width: 18px; height: 18px; }
.reply-preview-thumb { width: 38px; height: 38px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--fill); }
.reply-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reply-preview-thumb.sticker { background: transparent; }
.reply-preview-thumb.sticker img { object-fit: contain; }

#image-preview { display: flex; gap: 8px; padding: 2px 0 8px; overflow-x: auto; scrollbar-width: none; }
.thumb-wrapper { position: relative; width: 68px; height: 68px; flex-shrink: 0; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; box-shadow: var(--shadow-1); animation: popIn var(--dur-pop) var(--ease-pop); }
.preview-img-item { width: 100%; height: 100%; object-fit: cover; }
.file-thumb { font-size: 10px; font-weight: 650; text-align: center; word-break: break-all; padding: 4px; color: var(--ink-2); }
.remove-thumb { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; padding: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.spoiler-toggle-container { display: none; align-items: center; gap: 8px; width: fit-content; margin: 0 0 8px; padding: 6px 12px; border-radius: var(--r-full); background: var(--fill); font-size: var(--fs-foot); color: var(--ink-2); cursor: pointer; }
.spoiler-toggle-container input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* Panel emoji / GIF / naklejki */
#media-picker { display: flex; flex-direction: column; overflow: hidden; background: var(--surface-3); }
.media-tabs { display: flex; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); }
.media-tab { flex: 1; border: 0; background: transparent; color: var(--ink-2); font-weight: 650; font-size: var(--fs-foot); padding: 8px 6px; border-radius: var(--r-sm); cursor: pointer; }
.media-tab.active { background: var(--fill-2); color: var(--ink); }
.close-picker { min-width: 36px !important; min-height: 36px !important; }
.media-content { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; overscroll-behavior: contain; }
#tab-emoji { overflow: hidden; }
.gif-header { padding: 8px; }
.gif-header .search-input { margin: 0; min-height: 38px; }
.gif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 0 8px 8px; overflow-y: auto; }
.gif-item { width: 100%; height: 110px; object-fit: cover; cursor: pointer; border-radius: 10px; transition: transform var(--dur-pop) var(--ease-pop); }
.gif-item:active { transform: scale(0.95); }
#tab-sticker-content { padding: 8px; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; overflow-y: auto; }
.sticker-picker-item { width: 100%; aspect-ratio: 1; object-fit: contain; cursor: pointer; padding: 4px; border-radius: 10px; transition: transform var(--dur-pop) var(--ease-pop), background .15s; }
.sticker-picker-item:hover { background: var(--fill); }
.sticker-picker-item:active { transform: scale(0.88); }
emoji-picker {
    --background: transparent; --border-color: transparent; --input-border-color: var(--line-strong);
    --input-border-radius: 12px; --input-padding: 8px 12px; --input-font-color: var(--ink); --input-placeholder-color: var(--ink-3);
    --button-hover-background: var(--fill); --button-active-background: var(--fill-2);
    --indicator-color: var(--accent); --outline-color: var(--accent);
    --num-columns: 8; --emoji-size: 1.55rem; --emoji-padding: 0.4rem; --category-font-color: var(--ink-2);
    width: 100%; height: 100%;
}
emoji-picker::part(preview) { display: none; }

@media (min-width: 769px) {
    #media-picker {
        position: fixed; z-index: 900; width: 360px; height: 420px;
        border-radius: var(--r-lg); box-shadow: var(--shadow-3), 0 0 0 0.5px var(--line-strong);
        transform-origin: bottom left;
        animation: popIn var(--dur-snappy) var(--ease-snappy);
    }
}

/* ---------------------------------------------------------------------
   8. PANELE BOCZNE (informacje, profil, wyszukiwanie)
   --------------------------------------------------------------------- */
.info-panel {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 60;
    width: min(var(--panel-w), 100%);
    display: flex; flex-direction: column; min-height: 0;
    background: var(--surface-3);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--shadow-3);
    border-left: 1px solid var(--line);
    overflow: hidden;
}
@media (min-width: 769px) {
    .info-panel:not(.hidden) { animation: panelIn var(--dur-snappy) var(--ease-snappy); }
}
@media (min-width: 1280px) {
    /* Szeroki ekran: panel dokowany obok rozmowy zamiast zasłaniać wiadomości */
    .info-panel { position: relative; box-shadow: none; flex-shrink: 0; background: var(--surface-1); }
    [data-theme="dark"] .info-panel { background: var(--surface-1); }
}
@keyframes panelIn { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.group-sidebar-header {
    display: flex; align-items: center; gap: 6px;
    min-height: calc(var(--hdr-h) + var(--sat)); padding: var(--sat) 8px 0 16px;
    border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.group-sidebar-header h3 { flex: 1; margin: 0; font-size: var(--fs-headline); font-weight: 650; }
.panel-back { display: none; }
.info-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 14px calc(20px + var(--sab)); }
.info-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 8px 14px; text-align: center; }
.info-avatar { width: 96px !important; height: 96px !important; font-size: 34px; box-shadow: var(--shadow-2); }
.info-name { margin: 6px 0 0; font-size: var(--fs-title3); font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.info-sub { color: var(--ink-2); font-size: var(--fs-foot); }
.info-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 16px; }
.info-quick button {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px 9px; border: 0; border-radius: var(--r-md);
    background: var(--fill); color: var(--accent-text); cursor: pointer;
    font-size: var(--fs-cap); font-weight: 600;
    transition: transform var(--dur-pop) var(--ease-pop), background var(--dur-quick);
}
.info-quick button span { color: var(--ink-2); }
.info-quick button:active { transform: scale(0.94); background: var(--fill-2); }
.info-group { background: var(--surface-2); border-radius: var(--r-md); overflow: hidden; margin-bottom: 14px; box-shadow: 0 0 0 0.5px var(--line); }
[data-theme="dark"] .info-group { background: var(--surface-2); }
.info-row {
    display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 48px; padding: 10px 12px; border: 0; background: transparent; color: var(--ink);
    font-size: var(--fs-body); text-align: left; cursor: pointer;
    transition: background var(--dur-quick);
}
.info-row + .info-row { box-shadow: inset 46px 0.5px 0 -45.5px var(--line-strong); }
.info-row:active, .info-row:hover { background: var(--fill); }
.info-row > span { flex: 1; min-width: 0; }
.info-row .ic { color: var(--accent-text); width: 21px; height: 21px; }
.info-row .chev { color: var(--ink-3); width: 16px; height: 16px; }
.info-row.danger, .info-row.danger .ic { color: var(--danger); }
.info-section-title { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px; font-size: var(--fs-cap); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.info-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--accent-text); font-weight: 650; font-size: var(--fs-foot); cursor: pointer; text-transform: none; letter-spacing: 0; }
.info-link .ic { width: 16px; height: 16px; }
.group-members-list { padding: 0; }
.member-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 6px 12px; }
.member-item + .member-item { box-shadow: inset 54px 0.5px 0 -53.5px var(--line-strong); }
.member-item .avatar { width: 34px !important; height: 34px !important; }
.member-info { flex: 1; min-width: 0; font-size: var(--fs-sub); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-badge { margin-left: 4px; font-size: .85em; }
.kick-btn, .member-item .icon-btn { min-width: 36px; min-height: 36px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; font-size: 15px; opacity: .8; }
.kick-btn:hover, .member-item .icon-btn:hover { background: var(--fill); opacity: 1; }
.mobile-close-btn { display: none !important; }

/* Wyszukiwanie w rozmowie */
.search-panel-field { position: relative; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
#search-active-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#search-active-chips:empty { display: none; }
.search-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-cap); font-weight: 650; }
.search-chip-remove { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.search-chip-remove:hover { background: var(--fill-2); }
.search-helper-popup {
    position: absolute; top: calc(100% - 4px); left: 10px; right: 10px; z-index: 20;
    max-height: 62vh; overflow-y: auto; overscroll-behavior: contain;
    padding: 8px; border-radius: var(--r-lg);
    background: var(--surface-3); box-shadow: var(--shadow-3), 0 0 0 0.5px var(--line-strong);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    transform-origin: top center; animation: popIn var(--dur-snappy) var(--ease-snappy);
}
.search-helper-section { padding: 4px 0 8px; }
.search-helper-section + .search-helper-section { border-top: 1px solid var(--line); padding-top: 8px; }
.search-helper-title { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 6px; font-size: var(--fs-cap2); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.search-helper-title .icon-btn { min-width: 28px; min-height: 28px; }
.search-helper-title .icon-btn .ic { width: 15px; height: 15px; }
.search-filter-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 40px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-foot); }
.search-filter-item:hover { background: var(--fill); }
.filter-key { font-family: var(--font-mono); font-size: 12px; font-weight: 650; padding: 2px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); }
.filter-desc { color: var(--ink-2); margin-left: 4px; }
#search-helper-users { display: flex; flex-direction: column; gap: 2px; max-height: 150px; overflow-y: auto; }
.search-date-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; }
.search-date-row .filter-key { min-width: 62px; text-align: center; }
.search-date-picker { flex: 1; min-height: 36px; padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); }
#search-results-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px calc(16px + var(--sab)); }
.panel-empty { text-align: center; color: var(--ink-3); padding: 40px 16px; line-height: 1.5; }
#search-results-list .history-item, .modal-list .history-item {
    background: var(--surface-2) !important; border: 0 !important; border-radius: var(--r-md) !important;
    box-shadow: 0 0 0 0.5px var(--line); padding: 12px !important; margin-bottom: 8px !important;
    transition: transform var(--dur-pop) var(--ease-pop), background var(--dur-quick) !important;
}
#search-results-list .history-item:hover, .modal-list .history-item:hover { background: var(--fill-2) !important; transform: none !important; filter: none !important; }
#search-results-list .history-item:active { transform: scale(0.98) !important; }
.history-item .avatar { width: 24px !important; height: 24px !important; }
.history-item img { max-width: 100%; border-radius: 10px; }

/* ---------------------------------------------------------------------
   9. ROZMOWY GŁOSOWE I WIDEO
   --------------------------------------------------------------------- */
.chat-voice-status {
    position: relative; z-index: 26; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: calc(var(--hdr-h) + var(--sat)); padding: 7px 14px;
    background: color-mix(in srgb, var(--success) 16%, var(--surface-2));
    color: var(--success); font-size: var(--fs-foot); font-weight: 650; cursor: pointer; user-select: none;
    box-shadow: 0 0.5px 0 var(--line-strong);
}
.chat-voice-status small { color: var(--ink-3); font-weight: 500; }
#voice-room-panel {
    position: relative; z-index: 25; flex-shrink: 0;
    display: flex; flex-direction: column;
    max-height: 70vh; overflow: hidden;
    background: #16171a; color: #eceef1;
    transition: max-height var(--dur-smooth) var(--ease-smooth), opacity var(--dur-quick);
}
#voice-room-panel.collapsed { max-height: 0 !important; opacity: 0; pointer-events: none; }
.voice-room-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
.voice-room-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: var(--fs-sub); }
#mini-voice-timer-top { font-variant-numeric: tabular-nums; opacity: .7; font-weight: 500; }
.voice-controls { display: flex; gap: 8px; align-items: center; }
.panel-ctrl-btn { width: 44px; height: 44px; min-width: 44px; border-radius: 50%; background: rgba(255,255,255,.1) !important; color: #fff !important; }
.panel-ctrl-btn:hover { background: rgba(255,255,255,.18) !important; }
.panel-ctrl-btn svg { width: 21px; height: 21px; }
.decline-call-btn { min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--danger) !important; color: #fff !important; font-weight: 650; font-size: var(--fs-sub); }
.decline-call-btn span { margin-left: 2px; }
.voice-peers-grid { display: flex; gap: 18px; padding: 8px 16px 16px; overflow-x: auto; min-height: 96px; align-items: flex-start; scrollbar-width: none; }
.voice-peer { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 64px; }
.voice-peer .avatar { width: 58px; height: 58px; background-size: cover; box-shadow: 0 0 0 0 transparent; transition: box-shadow var(--dur-quick) var(--ease-quick), transform var(--dur-pop) var(--ease-pop); }
.voice-peer.speaking .avatar { box-shadow: 0 0 0 3px #16171a, 0 0 0 6px var(--success); transform: scale(1.04); }
.voice-peer.reconnecting .avatar { box-shadow: 0 0 0 3px #16171a, 0 0 0 6px var(--warning); animation: slowBlink 1.5s infinite; }
.voice-peer span { font-size: var(--fs-cap); font-weight: 600; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.voice-peer.has-volume { cursor: pointer; }
.voice-level { width: 44px; height: 4px; border-radius: 2px; margin: 2px auto 0; background: rgba(255,255,255,.18); position: relative; overflow: hidden; }
.voice-level::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--lvl, 0%); background: var(--success); transition: width 80ms linear; }
.peer-vol-badge { position: absolute; top: 40px; right: 0; font-size: 10px; font-weight: 750; padding: 2px 5px; border-radius: 6px; background: #2a2c30; color: #fff; pointer-events: none; }
.peer-vol-pop { position: fixed; z-index: 4000; display: flex; align-items: center; gap: 8px; width: 220px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-3); color: var(--ink); box-shadow: var(--shadow-3); animation: popIn var(--dur-snappy) var(--ease-snappy); }
.peer-vol-pop input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); margin: 0; }
.peer-vol-mute { border: 0; background: transparent; font-size: 1.05em; cursor: pointer; padding: 2px; }
.peer-vol-val { font-size: var(--fs-cap); font-weight: 700; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
@keyframes slowBlink { 50% { opacity: .55; } }

#voice-video-stage { display: flex; flex-wrap: wrap; gap: 10px; padding: 6px; background: #0b0b0c; justify-content: center; align-items: center; max-height: 46vh; overflow-y: auto; }
.screen-share-wrapper { position: relative; width: 100%; max-width: 820px; aspect-ratio: 16/9; border-radius: var(--r-md); overflow: hidden; background: #000; }
.screen-share-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; max-width: 100%; margin: 0; border-radius: 0; }
.screen-share-wrapper:fullscreen { max-width: 100%; border-radius: 0; }
.video-controls-overlay { position: absolute; bottom: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transition: opacity .2s; z-index: 20; }
.screen-share-wrapper:hover .video-controls-overlay { opacity: 1; }
@media (hover: none) { .video-controls-overlay { opacity: 1; } }
.vid-ctrl-btn { background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: var(--fs-foot); font-weight: 600; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.vid-ctrl-btn:hover { background: var(--accent); }
.peer-name-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 4px 9px; border-radius: 8px; font-size: var(--fs-cap); font-weight: 650; pointer-events: none; z-index: 20; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.show-stream-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--success); color: #fff; font-size: var(--fs-cap2); padding: 4px 10px; border-radius: 12px; cursor: pointer; margin-top: 4px; font-weight: 700; animation: popIn var(--dur-pop) var(--ease-pop); }
.show-stream-badge svg { width: 14px; height: 14px; }
#voice-room-panel.theater-mode { max-height: 78vh; height: 78vh; }
#voice-room-panel.theater-mode #voice-video-stage { flex: 1; max-height: none; }
#voice-room-panel.theater-mode .screen-share-wrapper { max-width: 1280px; }
#voice-room-panel.theater-mode .voice-peers-grid { min-height: 0; padding: 8px 16px; }
#voice-room-panel.theater-mode .voice-peer .avatar { width: 36px; height: 36px; }
.voice-stream-el { max-width: 100% !important; margin: 0; }
.quality-selector-overlay { position: fixed; inset: 0; z-index: 10000; }
.quality-menu { position: absolute; display: flex; flex-direction: column; min-width: 210px; max-height: 260px; overflow-y: auto; padding: 6px; border-radius: var(--r-md); background: var(--surface-3); box-shadow: var(--shadow-3); animation: popIn var(--dur-snappy) var(--ease-snappy); }
.quality-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sub); color: var(--ink); }
.quality-item:hover:not(.disabled) { background: var(--fill); }
.quality-item.disabled { opacity: .45; cursor: not-allowed; }
.calling-status { color: #fff !important; font-weight: 700; padding: 2px 10px; animation: slowBlink 1.5s infinite; }

/* ---------------------------------------------------------------------
  10. PULPIT
   --------------------------------------------------------------------- */
#app-wrapper.mode-workspace .chat-area { display: none; }
#app-wrapper.mode-workspace .sidebar-search,
#app-wrapper.mode-workspace .list-filters,
#app-wrapper.mode-workspace #conversations-list,
#app-wrapper.mode-workspace #list-empty,
#app-wrapper.mode-workspace .home-title-row,
#app-wrapper.mode-workspace .home-quick,
#app-wrapper.mode-workspace #create-group-btn-container { display: none !important; }

.ws-scope-panel { padding: 4px 10px 12px; }
.ws-scope-heading { font-family: var(--font-display); font-weight: 750; font-size: 26px; letter-spacing: -0.025em; padding: 10px 8px 10px; color: var(--ink); }
.ws-scope-sub { font-size: var(--fs-cap); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 14px 8px 4px; }
.ws-scope-hint { font-size: var(--fs-foot); color: var(--ink-3); padding: 10px 8px; line-height: 1.45; }
.ws-scope-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px; border-radius: var(--r-md); cursor: pointer; transition: background var(--dur-quick); }
.ws-scope-item:hover { background: var(--fill); }
.ws-scope-item.active { background: var(--accent-soft); }
.ws-scope-av { width: 36px !important; height: 36px !important; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background-color: var(--accent); font-size: 15px; border-radius: 11px !important; }
.ws-scope-item-text { flex: 1; min-width: 0; }
.ws-scope-item-text > div { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-scope-item-text small { color: var(--ink-3); font-size: var(--fs-cap); }
.ws-count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 10px; font-size: 11px; font-weight: 750; background: var(--accent); color: var(--accent-ink); }

.workspace-view { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; position: relative; background: transparent; }
[data-theme="dark"] .workspace-view { background: var(--canvas); }
.ws-header {
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
    min-height: calc(var(--hdr-h) + var(--sat)); padding: var(--sat) 14px 0;
    background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: 0 0.5px 0 var(--line-strong);
}
.ws-scope-btn { display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: transparent; color: var(--ink); padding: 4px 8px 4px 4px; border-radius: var(--r-md); cursor: pointer; text-align: left; }
.ws-scope-btn:hover { background: var(--fill); }
.ws-scope-btn .avatar { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; background-color: var(--accent); }
.ws-scope-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ws-scope-text > span { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.ws-scope-text small { color: var(--ink-3); font-size: var(--fs-cap); }
.ws-caret { width: 16px; height: 16px; color: var(--ink-3); transform: rotate(90deg); }
.ws-tabs { margin-left: auto; }
.ws-tab.active { background: var(--surface-3); color: var(--ink); }
.ws-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border: 0; border-radius: var(--r-full); background: var(--fill); color: var(--ink); font-weight: 650; cursor: pointer; white-space: nowrap; font-size: var(--fs-foot); transition: background var(--dur-quick), transform var(--dur-pop) var(--ease-pop); }
.ws-chip .ic { width: 17px; height: 17px; }
.ws-chip:hover { background: var(--fill-2); }
.ws-chip:active { transform: scale(0.95); }
.ws-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ws-board-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; flex-shrink: 0; }
.ws-board-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.ws-board-tabs::-webkit-scrollbar { display: none; }
.ws-board-tab { display: inline-flex; gap: 6px; align-items: center; min-height: 36px; padding: 6px 12px; border: 0; border-radius: var(--r-full); background: transparent; color: var(--ink-2); font-weight: 650; cursor: pointer; white-space: nowrap; }
.ws-board-tab:hover { background: var(--fill); }
.ws-board-tab.active { background: var(--ink); color: var(--canvas); }
[data-theme="dark"] .ws-board-tab.active { color: #111; }
.ws-board-bar-spacer { flex: 1; }
.ws-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-foot); color: var(--ink-2); white-space: nowrap; cursor: pointer; user-select: none; min-height: 36px; }
.ws-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.ws-board { flex: 1; min-height: 0; display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 4px 14px 20px; overscroll-behavior-x: contain; }
.ws-col { width: 300px; flex-shrink: 0; max-height: 100%; display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface-1); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: 0 0 0 0.5px var(--line-strong); }
[data-theme="dark"] .ws-col { background: var(--surface-1); }
.ws-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 8px 16px; cursor: grab; user-select: none; }
.ws-col-title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-col-count { font-size: var(--fs-cap); color: var(--ink-2); font-weight: 700; background: var(--fill); padding: 2px 8px; border-radius: 10px; }
.ws-col-menu { min-width: 34px !important; min-height: 34px !important; font-size: 18px; }
.ws-cards { flex: 1; min-height: 24px; overflow-y: auto; padding: 2px 10px 6px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.ws-card { background: var(--surface-2); border: 0; border-radius: var(--r-md); padding: 11px 12px; cursor: pointer; box-shadow: var(--shadow-1), 0 0 0 0.5px var(--line); transition: box-shadow var(--dur-quick), transform var(--dur-pop) var(--ease-pop); user-select: none; -webkit-touch-callout: none; }
[data-theme="dark"] .ws-card { background: var(--surface-3); }
.ws-card:hover { box-shadow: var(--shadow-2); }
.ws-card:active { transform: scale(0.98); }
.ws-card.filtered { display: none; }
.ws-card.done .ws-card-title { text-decoration: line-through; opacity: .5; }
.ws-card-labels-row { display: flex; gap: 4px; margin-bottom: 7px; }
.ws-label { width: 30px; height: 6px; border-radius: 3px; display: inline-block; }
.ws-card-main { display: flex; gap: 9px; align-items: flex-start; }
.ws-card-title { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; font-size: var(--fs-sub); font-weight: 550; white-space: pre-wrap; }
.ws-check { flex-shrink: 0; width: 22px; height: 22px; margin-top: -1px; border-radius: 50%; border: 1.8px solid var(--ink-3); background: transparent; color: #fff; font-size: 12px; font-weight: 900; line-height: 1; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--dur-quick), border-color var(--dur-quick), transform var(--dur-pop) var(--ease-pop); }
.ws-check:hover { border-color: var(--success); }
.ws-check:active { transform: scale(0.85); }
.ws-card.done .ws-check { background: var(--success); border-color: var(--success); }
.ws-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: var(--fs-cap); color: var(--ink-2); }
.ws-due { padding: 2px 7px; border-radius: 6px; background: var(--fill); }
.ws-due.soon { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.ws-due.overdue { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 700; }
.ws-assignee { width: 22px !important; height: 22px !important; margin-left: auto; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; color: #fff; background-color: var(--accent); }
.ws-add-card { padding: 4px 10px 12px; }
.ws-add-card-btn { width: 100%; min-height: 40px; text-align: left; background: transparent; border: 0; color: var(--ink-2); padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; }
.ws-add-card-btn:hover { background: var(--fill); color: var(--ink); }
.ws-inline-input { width: 100%; resize: none; border-radius: var(--r-md); border: 1px solid var(--accent); background: var(--surface-2); color: var(--ink); padding: 9px 11px; font-size: 16px; outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.ws-inline-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ws-inline-actions .primary-btn { width: auto; min-height: 36px; padding: 6px 14px; margin: 0; font-size: var(--fs-sub); }
.ws-add-col { flex-shrink: 0; width: 220px; min-height: 52px; padding: 14px; border-radius: var(--r-lg); border: 1.5px dashed var(--line-strong); background: transparent; color: var(--ink-2); font-weight: 650; cursor: pointer; }
.ws-add-col:hover { border-color: var(--accent); color: var(--accent-text); }
.ws-ghost { opacity: .35; }
.ws-chosen { box-shadow: var(--shadow-3) !important; }
.ws-drag { transform: rotate(2deg) scale(1.02); }
.ws-empty { margin: auto; text-align: center; color: var(--ink-2); padding: 30px 20px; max-width: 640px; }
.ws-empty h3 { color: var(--ink); margin: 8px 0 4px; }
.ws-empty.small { padding: 24px 12px; font-size: var(--fs-sub); }
.ws-template-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.ws-template { display: flex; flex-direction: column; gap: 4px; text-align: left; width: 190px; padding: 14px; border-radius: var(--r-lg); border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-1); transition: transform var(--dur-pop) var(--ease-pop), box-shadow var(--dur-quick); }
.ws-template:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.ws-template small { color: var(--ink-2); font-size: var(--fs-cap); line-height: 1.35; }

.ws-card-dialog { gap: 10px; }
.ws-card-dialog .modal-header { margin-bottom: 0; }
.ws-card-done { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; cursor: pointer; }
.ws-card-done input { width: 20px; height: 20px; accent-color: var(--success); }
input.ws-card-title { font-size: var(--fs-title3) !important; font-weight: 700; }
.ws-card-desc { min-height: 120px; resize: vertical; line-height: 1.45; }
.ws-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ws-card-grid label, .ws-field-label { font-size: var(--fs-cap); font-weight: 650; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.ws-card-grid .auth-input { margin: 0; font-size: 15px; }
.ws-card-labels { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ws-label-pick { width: 40px; height: 26px; border-radius: 8px; background: var(--c); border: 0; cursor: pointer; opacity: .4; transition: opacity .15s, transform var(--dur-pop) var(--ease-pop); }
.ws-label-pick.on { opacity: 1; box-shadow: 0 0 0 2px var(--surface-3), 0 0 0 4px var(--c); }
.ws-label-pick:active { transform: scale(0.9); }
.ws-card-footer { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.ws-card-footer .primary-btn, .ws-card-footer .secondary-btn { width: auto; margin: 0; padding: 10px 18px; }
.ws-card-footer .ws-card-meta { flex: 1; justify-content: center; margin: 0; }

.ws-notes-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr; }
.ws-notes-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ws-notes-list-head { display: flex; gap: 8px; padding: 10px 12px; }
.ws-notes-list-head .search-field { flex: 1; }
.ws-new-note { width: 40px !important; min-height: 40px !important; margin: 0 !important; padding: 0 !important; flex-shrink: 0; border-radius: var(--r-md) !important; }
#ws-notes-items { flex: 1; overflow-y: auto; padding: 4px 8px; overscroll-behavior: contain; }
.ws-note-item { padding: 10px 12px; border-radius: var(--r-md); cursor: pointer; margin-bottom: 2px; transition: background var(--dur-quick); }
.ws-note-item:hover { background: var(--fill); }
.ws-note-item.active { background: var(--accent-soft); }
.ws-note-item-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-note-item-snippet { font-size: var(--fs-foot); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.ws-note-item-date { font-size: var(--fs-cap2); color: var(--ink-3); margin-top: 4px; }
.ws-note-editor { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.ws-note-empty { margin: auto; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; padding: 20px; max-width: 340px; }
.ws-note-empty-art { font-size: 40px; }
.ws-note-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 24px 12px; }
.ws-note-toolbar { display: flex; align-items: center; gap: 4px; }
.ws-note-toolbar .icon-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.ws-note-back { display: none !important; }
.ws-note-title { flex: 1; min-width: 0; font-size: var(--fs-title2); font-weight: 750; letter-spacing: -0.02em; border: 0; background: transparent; color: var(--ink); outline: none; padding: 8px 0; }
.ws-note-source, .ws-note-conflict { font-size: var(--fs-foot); padding: 9px 12px; border-radius: var(--r-md); margin: 4px 0 8px; background: var(--fill); color: var(--ink-2); }
.ws-note-conflict { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--ink); }
.ws-link { background: none; border: 0; color: var(--accent-text); font-weight: 650; cursor: pointer; padding: 0 4px; }
.ws-note-content { flex: 1; min-height: 200px; resize: none; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 16px; line-height: 1.6; font-family: inherit; padding: 6px 0; }
/* Edytor notatek (v3.3): contenteditable z paskiem formatowania */
.ws-rt { overflow-y: auto; cursor: text; overflow-wrap: anywhere; }
.ws-rt:empty::before { content: attr(data-placeholder); opacity: .45; pointer-events: none; }
.ws-rt p, .ws-rt div { margin: .15em 0; }
.ws-rt a:not(.ws-file-tile) { color: var(--accent-text); }
.ws-rt-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px; margin: 4px 0 2px; border-radius: 12px; background: var(--fill); overflow-x: auto; scrollbar-width: none; flex: none; }
.ws-rt-toolbar::-webkit-scrollbar { display: none; }
.ws-rt-toolbar button { flex: none; min-width: 32px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.ws-rt-toolbar button:hover { background: var(--fill-2); }
.ws-rt-toolbar button.on { background: var(--accent-soft); color: var(--accent-text); }
.ws-rt-sep { flex: none; width: 1px; height: 18px; margin: 0 4px; background: var(--line, rgba(127,127,127,.25)); }
.ws-rt ul.ws-check { list-style: none; padding-left: 4px; }
.ws-rt ul.ws-check > li { position: relative; padding-left: 28px; }
.ws-rt ul.ws-check > li::before { content: ''; position: absolute; left: 2px; top: .3em; width: 16px; height: 16px; border-radius: 5px; border: 2px solid var(--accent); box-sizing: border-box; cursor: pointer; }
.ws-rt ul.ws-check > li[data-checked="1"] { text-decoration: line-through; opacity: .55; }
.ws-rt ul.ws-check > li[data-checked="1"]::before { background: var(--accent); box-shadow: inset 0 0 0 2px var(--bg, #fff); }
.ws-rt a.ws-file-tile { user-select: none; }
.ws-rt img.ws-note-img { display: block; }
.ws-note-preview { flex: 1; overflow-y: auto; line-height: 1.6; padding: 6px 0; overflow-wrap: anywhere; }
.ws-note-preview h2, .ws-note-preview h3, .ws-note-preview h4 { margin: .6em 0 .3em; letter-spacing: -0.015em; }
.ws-note-preview p { margin: .2em 0; }
.ws-note-preview .gap { height: .6em; }
.ws-note-preview blockquote { margin: .3em 0; padding: 2px 12px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.ws-note-preview ul { margin: .3em 0; padding-left: 22px; }
.ws-note-preview li.task { list-style: none; margin-left: -20px; }
/* Pliki w notatkach (v3.3) */
.ws-note-preview img.ws-note-img { display: block; max-width: 100%; max-height: 420px; border-radius: 10px; margin: 6px 0; cursor: zoom-in; }
.ws-note-preview { cursor: text; }
.ws-note-preview .ws-note-placeholder { opacity: .5; }
.ws-note-preview ol { margin: .3em 0; padding-left: 26px; }
/* Kafelek pliku: ikona po lewej, nazwa i typ po prawej; klik pobiera */
a.ws-file-tile { display: inline-flex; align-items: center; gap: 10px; max-width: min(100%, 360px); padding: 8px 12px 8px 8px; margin: 4px 0; border-radius: 14px; background: var(--fill, rgba(127,127,127,.12)); border: 1px solid var(--line, rgba(127,127,127,.2)); color: var(--ink); text-decoration: none; vertical-align: middle; cursor: pointer; transition: background .15s, border-color .15s; }
a.ws-file-tile:hover { background: var(--accent-soft); border-color: var(--accent); }
.ws-ft-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: var(--accent-soft); }
.ws-ft-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ws-ft-name { font-weight: 600; font-size: .95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-ft-sub { font-size: .75em; opacity: .65; letter-spacing: .02em; }
.ws-ft-dl { flex: none; margin-left: 4px; opacity: .5; font-size: .9em; }
a.ws-file-tile:hover .ws-ft-dl { opacity: 1; color: var(--accent-text); }
.ws-note-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 2px; border-top: 1px solid var(--line, rgba(127,127,127,.2)); }
.ws-note-files .ws-nf { position: relative; display: inline-flex; align-items: center; max-width: 280px; }
.ws-note-files .ws-nf a.ws-file-tile { margin: 0; max-width: 280px; }
.ws-note-files .ws-nf img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: zoom-in; display: block; }
.ws-note-files .ws-nf-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--ink, #222); color: var(--bg, #fff); font-size: 12px; line-height: 20px; padding: 0; cursor: pointer; opacity: .85; }
.ws-note-editor.ws-drop-over .ws-note-body { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 12px; }
.ws-note-preview li.task input { accent-color: var(--accent); }
.ws-note-preview li.task .checked { text-decoration: line-through; opacity: .55; }
.ws-note-preview pre, .ws-note-preview code { background: var(--fill); border-radius: 6px; font-family: var(--font-mono); font-size: .9em; }
.ws-note-preview pre { padding: 10px; overflow-x: auto; }
.ws-note-preview code { padding: 1px 5px; }
.ws-note-status { font-size: var(--fs-cap); color: var(--ink-3); text-align: right; padding-top: 6px; min-height: 1.2em; }

/* ---------------------------------------------------------------------
  11. OKNA I ARKUSZE
   (komputer: wyśrodkowane okno ze sprężystym wejściem; telefon: arkusz od dołu)
   --------------------------------------------------------------------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: max(16px, var(--sat)) 16px max(16px, var(--sab));
    background: var(--scrim);
    opacity: 1;
    transition: opacity var(--dur-quick) var(--ease-quick), display var(--dur-quick) allow-discrete, overlay var(--dur-quick) allow-discrete;
}
.modal-overlay.hidden { display: none !important; opacity: 0; }
@starting-style { .modal-overlay { opacity: 0; } }
.settings-modal {
    position: relative; display: flex; flex-direction: column; gap: 4px;
    width: 100%; max-width: 520px; max-height: min(86vh, 860px);
    padding: 20px; overflow: auto; overscroll-behavior: contain;
    border-radius: var(--r-xl);
    background: var(--surface-3); color: var(--ink);
    box-shadow: var(--shadow-3), 0 0 0 0.5px var(--line-strong);
    transform: none;
    transition: transform var(--dur-snappy) var(--ease-snappy);
}
@starting-style { .settings-modal { transform: scale(0.94) translateY(8px); } }
.modal-overlay.hidden .settings-modal { transform: scale(0.96); }
.dialog-sm { max-width: 420px; }
.dialog-md { max-width: 480px; }
.dialog-lg { max-width: 560px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -4px -6px 8px 0; }
.modal-header h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--fs-title3); font-weight: 700; letter-spacing: -0.02em; }
.modal-header h2 .ic { width: 24px; height: 24px; }
.modal-hero-ic { font-size: 40px; margin: 6px 0 4px; }
.settings-modal h2 { letter-spacing: -0.02em; }
.settings-modal > p { line-height: 1.5; }
.modal-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 1; margin: 0 -4px; padding: 2px 4px; }
.setting-group { margin-bottom: 14px; }
.link-card { display: block; margin: 6px 0 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--fill); color: var(--accent-text); font-weight: 650; text-decoration: none; }
.note-card { text-align: left; margin: 6px 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--fill); font-size: var(--fs-sub); line-height: 1.5; }
.note-card ul { margin: 6px 0 0; padding-left: 20px; color: var(--ink-2); }
.fingerprint-card { margin: 8px 0; padding: 14px; border-radius: var(--r-md); background: var(--fill); }
.fp-label { font-size: var(--fs-cap); font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin: 2px 0 4px; }
.fp-label:not(:first-child) { margin-top: 12px; }
.fp-code { display: block; font-family: var(--font-mono); font-size: 13px; color: var(--accent-text); overflow-wrap: anywhere; line-height: 1.5; }
.fp-peer { color: var(--success); }

/* Zdjęcie grupy */
.avatar-edit-wrapper { position: relative; width: 104px; height: 104px; border-radius: 50%; cursor: pointer; overflow: hidden; margin: 4px auto 18px; box-shadow: var(--shadow-2); }
.avatar-edit-wrapper .avatar { width: 100%; height: 100%; }
.avatar-edit-overlay { position: absolute; inset: auto 0 0 0; display: flex; justify-content: center; align-items: center; gap: 4px; padding: 6px 0; background: rgba(0,0,0,.55); color: #fff; font-size: var(--fs-cap); font-weight: 650; opacity: 0; transition: opacity .2s; }
.avatar-edit-overlay .ic { width: 16px; height: 16px; }
.avatar-edit-wrapper:hover .avatar-edit-overlay { opacity: 1; }
@media (hover: none) { .avatar-edit-overlay { opacity: 1; } }
.crop-modal { position: fixed; inset: 0; z-index: 10001; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: rgba(0,0,0,.88); padding: 16px; }
.crop-container { width: 92%; max-width: 420px; height: 60vh; background: #000; border-radius: var(--r-lg); overflow: hidden; }
.crop-container img { max-width: 100%; display: block; }
.crop-actions { display: flex; gap: 12px; width: 92%; max-width: 420px; }
.crop-actions .secondary-btn { background: rgba(255,255,255,.15); color: #fff; }

/* Kreator i podgląd naklejek */
#sticker-creator-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 260px; overflow-y: auto; padding: 4px; margin-top: 12px; }
.sc-item { position: relative; background: var(--fill); padding: 6px; border-radius: var(--r-md); text-align: center; }
.sc-item img { width: 100%; height: 64px; object-fit: contain; }
.sc-emoji-input { width: 100%; text-align: center; margin: 6px 0 0 !important; padding: 6px !important; min-height: 36px !important; }
.sortable-ghost { opacity: .4; }
#sc-drop-area { margin: 12px 0 0; }
#spp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 340px; overflow-y: auto; padding: 10px; background: var(--fill); border-radius: var(--r-md); margin: 12px 0; }
#spp-name { margin: 0; }
.sticker-peek { background: rgba(0,0,0,.5) !important; pointer-events: none !important; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#sticker-preview-img { width: 240px; height: 240px; object-fit: contain; filter: drop-shadow(0 10px 24px rgba(0,0,0,.45)); animation: popIn var(--dur-pop) var(--ease-pop); }

/* Transfer plików (LFE) */
.lfe-dialog { max-width: 980px; height: min(86vh, 760px); padding: 0; gap: 0; overflow: hidden; }
.lfe-head { margin: 0; padding: 16px 12px 14px 20px; border-bottom: 1px solid var(--line); }
.lfe-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lfe-title h2 { margin: 0; font-size: var(--fs-title3); }
.lfe-title-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex-shrink: 0; }
.lfe-status { display: inline-block; margin-top: 3px; padding: 2px 9px; border-radius: var(--r-full); font-size: var(--fs-cap); font-weight: 650; background: var(--fill); color: var(--ink-2) !important; }
.lfe-status a { color: inherit !important; }
.lfe-head-actions { display: flex; gap: 2px; }
.lfe-warning { padding: 10px 16px; font-size: var(--fs-foot); font-weight: 600; text-align: center; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.lfe-body-container { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.lfe-col { display: flex; flex-direction: column; min-height: 0; padding: 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.lfe-col + .lfe-col { border-left: 1px solid var(--line); background: var(--surface-sunk); }
.lfe-col h3 { margin: 0 0 12px; font-size: var(--fs-cap); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.lfe-drop { min-height: 150px; }
.lfe-drop .ic { width: 34px; height: 34px; color: var(--accent); }
.lfe-drop strong { color: var(--ink); }
.lfe-drop span { font-size: var(--fs-foot); }
.lfe-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.lfe-list > div[style*="text-align: center"] { color: var(--ink-3) !important; }
.lfe-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); box-shadow: 0 0 0 0.5px var(--line-strong); animation: fadeUp var(--dur-snappy) var(--ease-snappy); }
.lfe-item-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--fs-sub); font-weight: 650; }
.lfe-item-header > div:first-child { min-width: 0; }
.lfe-progress-bg { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.lfe-progress-bar { height: 100%; width: 0; border-radius: 3px; background: var(--accent) !important; transition: width .2s linear; }
.lfe-stats { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--fs-cap); color: var(--ink-2); }
.lfe-stats .primary-btn { min-height: 34px; border-radius: var(--r-sm); font-size: var(--fs-foot) !important; }
.lfe-action-btn { min-height: 30px; padding: 4px 10px; border: 0; border-radius: var(--r-sm); font-size: var(--fs-cap); font-weight: 650; cursor: pointer; }
.lfe-btn-cancel { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.lfe-btn-remove { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
#lfe-dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------------------------------------------------------------------
  12. USTAWIENIA
   --------------------------------------------------------------------- */
.settings-shell { flex-direction: row; gap: 0; width: 94%; max-width: 1000px; height: min(780px, 88vh); max-height: 88vh; padding: 0; overflow: hidden; }
.settings-navigator { width: 270px; flex-shrink: 0; display: flex; flex-direction: column; padding: 16px 12px 14px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface-sunk); }
.settings-nav-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 10px; }
.settings-nav-head h2 { margin: 0; font-size: var(--fs-title3); font-weight: 750; letter-spacing: -0.02em; }
.settings-nav-close { display: none; }
.settings-me { display: flex; align-items: center; gap: 12px; padding: 10px; margin-bottom: 4px; border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; box-shadow: 0 0 0 0.5px var(--line); }
.settings-me .avatar { width: 46px; height: 46px; }
.settings-me > div:not(.avatar) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.settings-me strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-me small { color: var(--ink-3); font-size: var(--fs-cap); }
.settings-me .chev { width: 16px; height: 16px; color: var(--ink-3); }
.settings-nav-group { font-size: var(--fs-cap2); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 14px 10px 4px; }
.settings-navigator ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.settings-navigator ul li { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 7px 10px; border-radius: var(--r-sm); font-weight: 550; font-size: var(--fs-sub); color: var(--ink); cursor: pointer; white-space: nowrap; transition: background var(--dur-quick); }
.settings-navigator ul li:hover { background: var(--fill); }
.settings-navigator ul li.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.sn-ico { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; font-size: 15px; background: var(--fill-2); }
.sn-c1 { background: #5b8def33; } .sn-c2 { background: #f0b42933; } .sn-c3 { background: #24976a33; } .sn-c4 { background: #8a5cf533; }
.sn-c5 { background: #ee6a5133; } .sn-c6 { background: #e5484d33; } .sn-c7 { background: #d6409f33; } .sn-c8 { background: #1a84f033; }
.sn-c9 { background: #f76b1533; } .sn-c10 { background: #12a59433; } .sn-c11 { background: #e5484d33; } .sn-c12 { background: #5865f233; } .sn-c13 { background: #24976a33; } .sn-c14 { background: #8e8e9333; }
.settings-logout { display: flex; align-items: center; gap: 10px; margin-top: auto; min-height: 44px; border: 0; background: transparent; color: var(--danger); font-weight: 650; padding: 10px; text-align: left; border-radius: var(--r-sm); cursor: pointer; }
.settings-logout .ic { width: 20px; height: 20px; }
.settings-logout:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.settings-content { flex: 1; min-width: 0; min-height: 0; padding: 22px 32px 32px; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.settings-content .modal-header { margin: 0 0 18px; }
.settings-content .modal-header h2 { font-size: var(--fs-title2); }
.settings-content .setting-group { max-width: 640px; }
.settings-content label { color: var(--ink-2); font-size: var(--fs-sub); }
.settings-mobile-bar { display: none; }
.settings-card { background: var(--surface-2); border: 0; border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 16px; max-width: 680px; box-shadow: 0 0 0 0.5px var(--line); }
.settings-card-title { margin: 0 0 10px; font-size: var(--fs-headline); }
.settings-hint { font-size: var(--fs-foot); color: var(--ink-2); margin: 0 0 12px; line-height: 1.5; }
.settings-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: var(--fs-foot); font-weight: 650; color: var(--ink-2); }
.settings-field .auth-input { margin: 0; font-weight: 400; }
.settings-row { display: flex; align-items: center; gap: 10px; }
.settings-row .auth-input { flex: 1; min-width: 0; margin: 0; }
.settings-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sub); color: var(--ink-2); cursor: pointer; }
.settings-kv { display: flex; justify-content: space-between; padding: 6px 0; }
.settings-switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; border-top: 0.5px solid var(--line-strong); }
.settings-card .settings-switch:first-of-type { border-top: 0; }
.settings-switch > span:last-child { display: flex; flex-direction: column; }
.settings-switch small { color: var(--ink-2); font-size: var(--fs-cap); margin-top: 2px; }
.settings-switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { flex-shrink: 0; width: 51px; height: 31px; border-radius: 16px; background: var(--fill-2); position: relative; transition: background var(--dur-quick) var(--ease-quick); }
.switch-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform var(--dur-snappy) var(--ease-bouncy); }
.settings-switch input:checked + .switch-ui { background: var(--success); }
.settings-switch input:checked + .switch-ui::after { transform: translateX(20px); }
.settings-switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings-switch.disabled { opacity: .45; pointer-events: none; }
.av-meter-wrap { margin-top: 6px; }
.av-meter { position: relative; height: 26px; border-radius: 13px; background: var(--fill-2); overflow: hidden; }
.av-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--ink-3); border-radius: 13px; transition: width 60ms linear; }
.av-meter-fill.open { background: linear-gradient(90deg, var(--success) 0%, #46c47f 70%, #e2b308 90%, var(--danger) 100%); }
.av-meter-threshold { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.av-meter.gate-off .av-meter-threshold { opacity: .25; }
.av-gate-slider { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.av-meter-scale { display: flex; justify-content: space-between; font-size: var(--fs-cap); color: var(--ink-2); margin-top: 4px; }
.av-meter-scale #av-gate-value { font-weight: 700; color: var(--ink); }
.av-gate-state { font-size: var(--fs-foot); font-weight: 700; color: var(--ink-2); margin-left: auto; font-variant-numeric: tabular-nums; }
.av-gate-state.open { color: var(--success); }
.theme-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 6px; }
@media (max-width: 520px) { .theme-options { grid-template-columns: repeat(2, 1fr); } }
.theme-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; border: 0; background: var(--surface-2); text-align: center; border-radius: var(--r-md); cursor: pointer; font-weight: 600; color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); transition: box-shadow var(--dur-quick), transform var(--dur-pop) var(--ease-pop); }
.theme-btn:active { transform: scale(0.96); }
.theme-btn.active { box-shadow: 0 0 0 2px var(--accent); color: var(--accent-text); }
.theme-swatch { width: 100%; height: 54px; border-radius: 10px; position: relative; overflow: hidden; }
.theme-swatch.light { background: linear-gradient(165deg, #eaf3f6, #fbe4d6 60%, #ecd3c4); }
.theme-swatch.dark { background: #111214; }
.theme-swatch.dim { background: #36393f; }
.theme-swatch.dim::before { background: #2b2d31; }
.theme-swatch.auto { background: linear-gradient(110deg, #fbe4d6 50%, #111214 50%); }
.theme-swatch::before, .theme-swatch::after { content: ''; position: absolute; height: 12px; border-radius: 6px; }
.theme-swatch::before { left: 8px; top: 10px; width: 46%; background: #fff; }
.theme-swatch.dark::before { background: #26282d; }
.theme-swatch::after { right: 8px; bottom: 10px; width: 40%; background: var(--accent); }
.accent-options { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.accent-dot { width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); transition: transform var(--dur-pop) var(--ease-pop), box-shadow var(--dur-quick); }
.accent-dot.active { box-shadow: 0 0 0 3px var(--surface-3), 0 0 0 5px var(--c); }
.accent-dot:active { transform: scale(0.9); }
.lang-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.lang-option { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-md); border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; text-align: left; box-shadow: 0 0 0 1px var(--line-strong); }
.lang-option:hover { box-shadow: 0 0 0 1px var(--accent); }
.lang-option.active { box-shadow: 0 0 0 2px var(--accent); }
.lang-option > span:last-child { display: flex; flex-direction: column; }
.lang-option small { color: var(--ink-2); font-size: var(--fs-cap); }
.lang-flag { font-size: 1.8em; }
.bot-badge + .bot-badge { margin-left: 2px; }
.conv-bot-tag { margin-left: 6px; flex-shrink: 0; }

/* ---------------------------------------------------------------------
  13. MENU, TOASTY, PRZEŁĄCZNIK
   --------------------------------------------------------------------- */
/* Menu kontekstowe na komputerze */
.msg-dropdown-menu, .ws-pop {
    position: fixed; z-index: 20000;
    min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto;
    padding: 6px; border-radius: var(--r-md);
    background: var(--surface-3); border: 0;
    box-shadow: var(--shadow-3), 0 0 0 0.5px var(--line-strong);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    transform-origin: var(--menu-origin, top left);
    animation: popIn var(--dur-snappy) var(--ease-snappy);
}
.msg-dropdown-menu { position: absolute; }
.ws-pop.wide { min-width: 260px; }
.msg-dropdown-item, .ws-pop-item {
    display: flex; align-items: center; gap: 10px; min-height: 38px;
    padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
    font-size: var(--fs-sub); color: var(--ink);
}
.ws-pop-item { flex-direction: column; align-items: flex-start; gap: 2px; justify-content: center; }
.msg-dropdown-item svg { margin: 0 !important; width: 17px; height: 17px; }
.msg-dropdown-item:hover, .ws-pop-item:hover { background: var(--fill); }
.msg-dropdown-item.danger, .ws-pop-item.danger { color: var(--danger); }
.ws-pop-item small { color: var(--ink-2); font-size: var(--fs-cap); }
.ws-pop-item.ws-pop-scope { padding: 2px; }
.ws-pop-item.ws-pop-scope .ws-scope-item { padding: 6px; width: 100%; }
.ws-pop-sep { height: 0.5px; background: var(--line-strong); margin: 5px 6px; }
.conv-ctx-menu { min-width: 240px; }
.conv-ctx-title { padding: 6px 10px 2px; font-size: var(--fs-cap2); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.conv-ctx-indent { padding-left: 24px; }
.menu-reactions { display: flex; justify-content: space-between; gap: 2px; padding: 4px 4px 8px; margin-bottom: 4px; border-bottom: 0.5px solid var(--line-strong); }
.menu-reactions span, .emoji-reaction-btn-pc, .emoji-reaction-btn { font-size: 22px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; transition: transform var(--dur-pop) var(--ease-pop), background var(--dur-quick) !important; }
.menu-reactions span:hover, .emoji-reaction-btn-pc:hover { background: var(--fill); transform: scale(1.18) !important; }
.edit-history-link { font-size: var(--fs-foot); color: var(--ink-2); text-align: center; margin-top: 4px; padding: 10px 6px 6px; border-top: 0.5px solid var(--line-strong); cursor: pointer; }
.edit-history-link:hover { color: var(--accent-text); }
.history-item { background: var(--fill); padding: 10px 12px; border-radius: var(--r-md); font-size: var(--fs-sub); }

/* Menu wiadomości na telefonie (iOS): rozmyte tło, podniesiony dymek, reakcje i akcje */
.ctx-overlay {
    position: fixed; inset: 0; z-index: 20000;
    background: rgba(0,0,0,.18);
    -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
    opacity: 0; transition: opacity var(--dur-quick) var(--ease-quick);
    touch-action: none;
}
[data-theme="dark"] .ctx-overlay { background: rgba(0,0,0,.45); }
.ctx-overlay.visible { opacity: 1; }
.ctx-preview { position: fixed; z-index: 1; pointer-events: none; transform-origin: center; transition: transform var(--dur-pop) var(--ease-pop); }
.ctx-preview .msg { box-shadow: var(--shadow-3) !important; animation: none !important; }
.ctx-reactions {
    position: fixed; z-index: 2; display: flex; gap: 2px; padding: 6px;
    border-radius: 30px; background: var(--surface-3); box-shadow: var(--shadow-3);
    transform: scale(0.6); opacity: 0;
    transition: transform var(--dur-pop) var(--ease-pop), opacity var(--dur-quick);
}
.ctx-reactions button { width: 42px; height: 42px; border: 0; background: transparent; font-size: 26px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; transition: transform var(--dur-pop) var(--ease-pop); }
.ctx-reactions button:active { transform: scale(1.3); background: var(--fill); }
.ctx-menu {
    position: fixed; z-index: 2; width: 250px; overflow: hidden;
    border-radius: var(--r-md); background: var(--surface-3); box-shadow: var(--shadow-3);
    transform: scale(0.7); opacity: 0;
    transition: transform var(--dur-pop) var(--ease-snappy), opacity var(--dur-quick);
}
.ctx-overlay.visible .ctx-reactions, .ctx-overlay.visible .ctx-menu { transform: none; opacity: 1; }
.ctx-menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 46px; padding: 10px 16px; border: 0; background: transparent; color: var(--ink); font-size: var(--fs-body); text-align: left; cursor: pointer; }
.ctx-menu button + button { box-shadow: inset 0 0.5px 0 var(--line-strong); }
.ctx-menu button:active { background: var(--fill-2); }
.ctx-menu button .ic { width: 20px; height: 20px; color: var(--ink-2); }
.ctx-menu button.danger, .ctx-menu button.danger .ic { color: var(--danger); }
.ctx-menu .ctx-sep { height: 8px; background: var(--fill); }

/* Arkusz akcji (telefon) */
.sheet-overlay { position: fixed; inset: 0; z-index: 19000; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); opacity: 0; transition: opacity var(--dur-quick) var(--ease-quick); }
.sheet-overlay.visible { opacity: 1; }
.action-sheet { width: 100%; max-width: 520px; padding: 8px 8px calc(8px + var(--sab)); transform: translateY(105%); }
.action-sheet-group { overflow: hidden; border-radius: var(--r-lg); background: var(--surface-3); margin-bottom: 8px; box-shadow: var(--shadow-3); }
.action-sheet-title { padding: 14px 16px 10px; text-align: center; font-size: var(--fs-foot); color: var(--ink-2); box-shadow: inset 0 -0.5px 0 var(--line-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-sheet button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 18px; border: 0; background: transparent; color: var(--ink); font-size: 17px; text-align: left; cursor: pointer; }
.action-sheet button + button { box-shadow: inset 52px 0.5px 0 -51.5px var(--line-strong); }
.action-sheet button:active { background: var(--fill-2); }
.action-sheet button .ic { width: 22px; height: 22px; color: var(--accent-text); }
.action-sheet button.danger, .action-sheet button.danger .ic { color: var(--danger); }
.action-sheet .sheet-cancel { justify-content: center; font-weight: 650; color: var(--accent-text); }
.mobile-menu-overlay { position: fixed; inset: 0; background: var(--scrim); z-index: 10000; display: flex; align-items: flex-end; opacity: 0; transition: opacity .25s; }
.mobile-menu-overlay.visible { opacity: 1; }
.mobile-bottom-sheet { background: var(--surface-3); width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 16px 16px calc(16px + var(--sab)); display: flex; flex-direction: column; gap: 8px; }
.mobile-sheet-btn { background: var(--fill); border: 0; padding: 14px; border-radius: var(--r-md); color: var(--ink); font-size: var(--fs-body); font-weight: 600; text-align: left; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.mobile-sheet-btn.danger { color: var(--danger); }

/* Toasty: od góry (telefon i komputer), przesuń w górę, by zamknąć */
#toast-container {
    position: fixed; z-index: 100000; top: calc(var(--sat) + 10px); right: 16px;
    display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 24px));
    pointer-events: none;
}
.toast {
    pointer-events: auto; touch-action: none;
    display: flex; flex-direction: column; gap: 2px;
    padding: 12px 16px; border-radius: var(--r-lg);
    background: var(--material-strong); color: var(--ink);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--shadow-3), 0 0 0 0.5px var(--line-strong);
    border-left: 0 !important;
    transform: translateY(calc(-100% - 40px)); opacity: 0;
    transition: transform var(--dur-bouncy) var(--ease-bouncy), opacity var(--dur-quick);
}
.toast.show { transform: none; opacity: 1; }
.toast strong { font-size: var(--fs-sub); font-weight: 650; }
.toast-body { font-size: var(--fs-sub); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.toast .primary-btn { min-height: 36px; font-size: var(--fs-foot); }

/* Przełącznik rozmów (Ctrl+K) */
#quick-switcher { align-items: flex-start; padding-top: 12vh; }
.switcher-box { max-width: 560px; padding: 10px; gap: 6px; }
.switcher-field { min-height: 48px; }
.switcher-field .search-input { min-height: 48px; font-size: 17px; }
.switcher-results { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.switcher-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: var(--r-md); cursor: pointer; }
.switcher-item .avatar { width: 32px; height: 32px; }
.switcher-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.switcher-item small { color: var(--ink-3); font-size: var(--fs-cap); }
.switcher-item.sel { background: var(--accent); color: var(--accent-ink); }
.switcher-item.sel small { color: rgba(255,255,255,.75); }
.switcher-hint { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 6px; font-size: var(--fs-cap); color: var(--ink-3); }

/* ---------------------------------------------------------------------
  14. RÓŻNE
   --------------------------------------------------------------------- */
.lightbox-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; justify-content: center; align-items: center; background: rgba(0,0,0,.92); cursor: zoom-out; opacity: 0; pointer-events: none; transition: opacity .2s; }
.lightbox-overlay:not(.hidden) { opacity: 1; pointer-events: auto; }
#lightbox-image { max-width: 92vw; max-height: 88vh; border-radius: 8px; cursor: default; }
.lightbox-close { position: absolute; top: calc(var(--sat) + 12px); right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; z-index: 2001; }
.lb-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; z-index: 2005; }
#lb-prev { left: 16px; } #lb-next { right: 16px; }
.screen-share-video:not(.voice-stream-el) { }
.fancybox__container { --fancybox-bg: rgba(10, 10, 12, 0.94); }

/* Paski przewijania: cienkie, w kolorach motywu, widoczne przy najechaniu */
:root { --scroll-thumb: rgba(31, 46, 72, 0.22); --scroll-thumb-hover: rgba(31, 46, 72, 0.42); }
[data-theme="dark"] { --scroll-thumb: rgba(255, 255, 255, 0.14); --scroll-thumb-hover: rgba(255, 255, 255, 0.3); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-thumb { border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; min-height: 40px; }
*:hover::-webkit-scrollbar-thumb { background-color: var(--scroll-thumb); }
*::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
@supports (-moz-appearance: none) { * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; } }

/* Klatki kluczowe */
@keyframes popIn { from { opacity: 0; transform: scale(0.88); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Stare elementy uwierzytelniania (forgot/register) */
.center-form-container-parent { display: flex; justify-content: center; align-items: center; min-height: 100%; padding: 16px; }
.center-form-container { padding: 36px; width: 100%; max-width: 440px; background: var(--surface-3); border-radius: var(--r-xl); box-shadow: var(--shadow-3); }
h1 { text-align: center; color: var(--ink); }
#toggle-auth { text-align: center; margin-top: 15px; cursor: pointer; font-size: var(--fs-foot); color: var(--ink-2); }

/* =====================================================================
   TELEFON (≤ 768 px): stos nawigacji jak w iOS
   - lista = ekran główny z dużym tytułem; wyszukiwarka i "nowa rozmowa" w zasięgu kciuka (nad paskiem kart),
   - czat wjeżdża z prawej (sprężyna z prędkością gestu), lista lekko odjeżdża w lewo (paralaksa),
   - panele informacji = kolejne ekrany stosu; okna = arkusze od dołu.
   ===================================================================== */
@media (max-width: 768px) {
    :root { --hdr-h: 52px; --fs-msg: 16px; }
    .desktop-only { display: none !important; }
    .mobile-only { display: inline-flex !important; }
    #app-wrapper { display: block; }

    /* --- Dolny pasek kart --- */
    .app-rail {
        position: absolute; left: 0; right: 0; bottom: 0; z-index: 60;
        width: auto; height: calc(var(--tab-h) + var(--sab));
        flex-direction: row; align-items: flex-start; justify-content: space-around; gap: 0;
        padding: 5px max(6px, var(--sar)) var(--sab) max(6px, var(--sal));
        background: var(--material); border-right: 0;
        -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
        box-shadow: 0 -0.5px 0 var(--line-strong);
        transition: transform var(--dur-snappy) var(--ease-snappy);
    }
    [data-theme="dark"] .app-rail { background: var(--material); }
    .kb-open .app-rail { transform: translateY(110%); }
    .rail-btn { flex: 1; width: auto; gap: 2px; padding: 3px 0; font-size: 10.5px; font-weight: 600; letter-spacing: .01em; }
    .rail-icon { width: 56px; height: 30px; border-radius: 15px; background: transparent; }
    .rail-icon .ic { width: 25px; height: 25px; }
    .rail-btn.active { color: var(--accent-text); }
    .rail-btn.active .rail-icon { background: transparent; color: var(--accent); box-shadow: none; border-radius: 15px; }
    .rail-btn.active .rail-icon .ic { stroke-width: 2.2; }
    .rail-btn::before { display: none; }
    .rail-btn:active .rail-icon { transform: scale(0.86); }
    .rail-btn.has-unread .rail-icon::after { top: -1px; right: 10px; border-color: var(--surface-1-solid); }
    .rail-spacer, .rail-sep, .rail-servers, .rail-add { display: none !important; }
    .rail-me .avatar { width: 27px; height: 27px; }
    .rail-me .rail-label { display: block; }
    .rail-me.active .rail-icon { box-shadow: none; }
    .rail-me.active .avatar { box-shadow: 0 0 0 2px var(--surface-1-solid), 0 0 0 3.5px var(--accent); }

    /* --- Ekran listy --- */
    .sidebar {
        position: absolute; inset: 0; width: auto; z-index: 10;
        border-right: 0; background: var(--canvas-bg); background-color: var(--canvas);
        -webkit-backdrop-filter: none; backdrop-filter: none;
        will-change: transform;
    }
    [data-theme="dark"] .sidebar { background: var(--canvas); }
    .list-scroll { padding-top: calc(var(--sat) + 4px); padding-bottom: calc(var(--tab-h) + var(--sab) + 76px); scrollbar-gutter: auto; }
    .list-compact-bar {
        display: flex; align-items: flex-end; justify-content: center;
        position: absolute; top: 0; left: 0; right: 0; z-index: 20;
        height: calc(var(--sat) + 44px); padding-bottom: 11px;
        background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
        box-shadow: 0 0.5px 0 var(--line-strong);
        opacity: 0; pointer-events: none;
        transition: opacity var(--dur-quick) var(--ease-quick);
    }
    .list-compact-title { font-weight: 650; font-size: var(--fs-headline); transform: translateY(4px); transition: transform var(--dur-snappy) var(--ease-snappy); }
    .sidebar.scrolled .list-compact-bar { opacity: 1; }
    .sidebar.scrolled .list-compact-title { transform: none; }
    .home-title-row { padding: 8px 12px 4px 18px; }
    .home-title { font-size: var(--fs-large); font-weight: 780; }
    .home-new-btn { display: none; }
    #conversations-list { padding: 0 6px; }
    .conv-item { border-radius: var(--r-md); min-height: 72px; padding: 8px 10px; }
    .conv-item > .avatar { width: 54px; height: 54px; }
    @media (hover: none) { .conv-item.active { background: transparent; } }

    /* Wyszukiwarka + "nowa rozmowa" w strefie kciuka */
    .sidebar-search {
        position: absolute; left: 0; right: 0; z-index: 40;
        bottom: calc(var(--tab-h) + var(--sab) + 8px);
        padding: 0 12px;
        transition: bottom var(--dur-snappy) var(--ease-snappy), transform var(--dur-snappy) var(--ease-snappy);
    }
    .kb-open .sidebar-search { bottom: 8px; }
    .sidebar-search .search-field {
        min-height: 50px; border-radius: 25px; padding: 0 16px;
        background: var(--material-strong); color: var(--ink-2);
        -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
        box-shadow: var(--shadow-2), 0 0 0 0.5px var(--line-strong);
    }
    .sidebar-search .search-input { min-height: 50px; font-size: 17px; }
    .search-compose-btn {
        display: grid; place-items: center; flex-shrink: 0;
        width: 50px; height: 50px; border: 0; border-radius: 50%;
        background: var(--accent); color: var(--accent-ink); cursor: pointer;
        box-shadow: 0 8px 20px -6px var(--accent), var(--shadow-1);
        transition: transform var(--dur-pop) var(--ease-pop);
    }
    .search-compose-btn:active { transform: scale(0.9); }
    #search-results { top: auto; bottom: calc(100% + 8px); max-height: min(420px, 50vh); transform-origin: bottom center; }

    /* --- Ekran czatu (nad listą i paskiem kart) --- */
    .chat-area {
        position: absolute; inset: 0; z-index: 70;
        background: var(--canvas-bg); background-color: var(--canvas);
        transform: translate3d(100%, 0, 0);
        box-shadow: -1px 0 0 var(--line), -10px 0 40px rgba(0,0,0,.08);
        will-change: transform;
    }
    [data-theme="dark"] .chat-area { background: var(--canvas); }
    #app-wrapper.mobile-chat-active .chat-area { transform: translate3d(0, 0, 0); }
    #app-wrapper.mobile-chat-active .sidebar { transform: translate3d(-28%, 0, 0); }
    .nav-dim { display: block; position: absolute; inset: 0; z-index: 65; background: #000; opacity: 0; pointer-events: none; }
    #app-wrapper.mobile-chat-active .nav-dim { opacity: .14; }
    #app-wrapper.mobile-chat-active .sidebar-search { visibility: hidden; }
    #empty-state { display: none; }
    .nav-back { display: inline-flex; }
    .chat-header { padding-left: 4px; gap: 2px; }
    .chat-identity { padding: 2px 4px; gap: 9px; }
    #current-chat-avatar { width: 36px; height: 36px; }
    .chat-actions .icon-btn { min-width: 42px; }
    #messages-container { padding-left: 8px; padding-right: 8px; }
    .msg-bubble-wrapper { max-width: 82%; }
    .msg-author-header { margin-left: 44px; }
    .msg-gutter { width: 28px; }
    .msg-gutter .avatar { width: 28px; height: 28px; }
    .msg-row { gap: 6px; }
    .msg, .msg-row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
    .msg-row { overflow: visible; }
    .input-wrapper { padding-left: 8px; padding-right: 8px; }
    #jump-to-bottom { right: 10px; }

    /* Panel emoji zamiast klawiatury — ta sama wysokość, co ostatnia klawiatura */
    #media-picker { position: static; height: var(--kb-last, 300px); max-height: 46vh; min-height: 260px; margin: 8px -8px calc(-8px - var(--sab)); padding-bottom: var(--sab); border-radius: 0; background: transparent; animation: slideUp var(--dur-snappy) var(--ease-snappy); }
    .media-tabs { border-bottom-color: var(--line); }
    emoji-picker { --num-columns: 8; --emoji-size: 1.7rem; }

    /* --- Panele (profil, grupa, wyszukiwanie) = kolejny ekran stosu --- */
    .info-panel {
        position: fixed; inset: 0; width: auto; z-index: 90;
        background: var(--canvas-bg); background-color: var(--canvas);
        -webkit-backdrop-filter: none; backdrop-filter: none;
        border-left: 0; box-shadow: -10px 0 40px rgba(0,0,0,.12);
        will-change: transform;
    }
    [data-theme="dark"] .info-panel { background: var(--canvas); }
    .group-sidebar-header { padding-left: 4px; }
    .group-sidebar-header h3 { text-align: center; margin-right: 44px; }
    .panel-back { display: inline-flex; }
    .panel-close { display: none; }
    .info-scroll { padding-left: 16px; padding-right: 16px; }
    .info-group { background: var(--surface-2); }

    /* --- Pulpit: pełny ekran nad listą, pasek kart dalej widoczny --- */
    .workspace-view { position: absolute; inset: 0; bottom: calc(var(--tab-h) + var(--sab)); z-index: 55; background: var(--canvas-bg); background-color: var(--canvas); height: auto; animation: fadeUp var(--dur-snappy) var(--ease-snappy); }
    [data-theme="dark"] .workspace-view { background: var(--canvas); }
    .ws-header { padding: var(--sat) 10px 0; gap: 8px; }
    .ws-scope-text > span { max-width: 36vw; }
    .ws-tab { padding: 7px 12px; }
    .ws-board-bar { padding: 8px 10px; flex-wrap: wrap; row-gap: 6px; }
    .ws-board-tabs { flex: 1 1 100%; order: -1; }
    .ws-board-bar-spacer { display: none; }
    .ws-board { scroll-snap-type: x mandatory; padding: 4px 12px 14px; gap: 10px; scroll-padding: 0 12px; }
    .ws-col { width: calc(100vw - 48px); scroll-snap-align: center; }
    .ws-add-col { width: calc(100vw - 120px); scroll-snap-align: center; }
    .ws-col-head { cursor: default; }
    .ws-check { width: 26px; height: 26px; }
    .ws-card-grid { grid-template-columns: 1fr 1fr; }
    .ws-notes-layout { grid-template-columns: 1fr; }
    .ws-notes-layout .ws-note-editor { display: none; }
    .ws-notes-layout.editing .ws-notes-list { display: none; }
    .ws-notes-layout.editing .ws-note-editor { display: flex; animation: fadeUp var(--dur-snappy) var(--ease-snappy); }
    .ws-note-back { display: inline-flex !important; }
    .ws-note-body { padding: 6px 14px 10px; }
    #app-wrapper.mode-workspace .sidebar { visibility: hidden; }

    /* --- Okna = arkusze od dołu z uchwytem --- */
    .modal-overlay { align-items: flex-end; padding: max(24px, var(--sat)) 0 0; }
    .settings-modal {
        max-width: none !important; width: 100% !important; max-height: calc(100% - 8px) !important; height: auto;
        border-radius: var(--r-xl) var(--r-xl) 0 0;
        padding: 26px 18px calc(18px + var(--sab));
        transition: transform var(--dur-sheet) var(--ease-sheet);
    }
    .kb-open .settings-modal { padding-bottom: 18px; }
    .settings-modal::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--fill-2); }
    @starting-style { .settings-modal { transform: translateY(100%); } }
    .modal-overlay.hidden .settings-modal { transform: translateY(100%); }
    .modal-header { margin-right: -8px; }
    .lfe-dialog { height: calc(100% - 8px) !important; padding: 0 !important; }
    .lfe-head { padding-top: 22px; }
    .lfe-body-container { grid-template-columns: 1fr; overflow-y: auto; }
    .lfe-col { overflow: visible; }
    .lfe-col + .lfe-col { border-left: 0; border-top: 1px solid var(--line); }
    .ws-card-dialog { padding-bottom: calc(18px + var(--sab)) !important; }
    #quick-switcher { align-items: flex-end; padding-top: 0; }

    /* --- Ustawienia: karta "Ty" — pełny ekran nad listą, pasek kart widoczny --- */
    #settings-modal { padding: 0; background: transparent; z-index: 58 !important; bottom: calc(var(--tab-h) + var(--sab)); align-items: stretch; }
    #settings-modal .settings-shell {
        position: absolute; inset: 0; width: 100% !important; max-width: none !important; height: 100% !important; max-height: none !important;
        border-radius: 0; box-shadow: none; padding: 0 !important; display: block;
        background: var(--canvas-bg); background-color: var(--canvas);
        transform: none; animation: none;
    }
    [data-theme="dark"] #settings-modal .settings-shell { background: var(--canvas); }
    #settings-modal .settings-shell::before { display: none; }
    @starting-style { #settings-modal .settings-shell { transform: none; } }
    .settings-shell .settings-navigator { position: absolute; inset: 0; width: 100%; padding: calc(var(--sat) + 8px) 16px 24px; border: 0; background: transparent; }
    .settings-nav-head { padding: 4px 4px 12px; }
    .settings-nav-head h2 { font-size: var(--fs-large); font-weight: 780; }
    .settings-nav-close { display: none; }
    .settings-me { padding: 12px; margin-bottom: 8px; }
    .settings-me .avatar { width: 58px; height: 58px; }
    .settings-me strong { font-size: var(--fs-title3); }
    .settings-navigator ul { background: var(--surface-2); border-radius: var(--r-md); overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); gap: 0; }
    .settings-navigator ul li { min-height: 48px; padding: 9px 12px; border-radius: 0; font-size: var(--fs-body); }
    .settings-navigator ul li + li { box-shadow: inset 52px 0.5px 0 -51.5px var(--line-strong); }
    .settings-navigator ul li::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-top: 2px solid var(--ink-3); transform: rotate(45deg); margin-right: 4px; }
    .settings-navigator ul li.active { background: transparent; color: var(--ink); }
    .settings-nav-group { padding: 18px 12px 6px; }
    .settings-logout { margin-top: 18px; justify-content: center; background: var(--surface-2); border-radius: var(--r-md); min-height: 48px; }
    .settings-shell .settings-content {
        position: absolute; inset: 0; padding: 0 16px calc(24px + var(--sab));
        background: var(--canvas-bg); background-color: var(--canvas);
        transform: translate3d(100%, 0, 0); visibility: hidden;
        transition: transform var(--dur-snappy) var(--ease-snappy), visibility 0s linear var(--dur-snappy);
        box-shadow: -10px 0 40px rgba(0,0,0,.1);
    }
    [data-theme="dark"] .settings-shell .settings-content { background: var(--canvas); }
    .settings-shell.show-content .settings-content { transform: none; visibility: visible; transition: transform var(--dur-snappy) var(--ease-snappy), visibility 0s; }
    .settings-shell.show-content .settings-navigator { transform: translate3d(-28%, 0, 0); transition: transform var(--dur-snappy) var(--ease-snappy); }
    .settings-shell .settings-navigator { transition: transform var(--dur-snappy) var(--ease-snappy); }
    .settings-mobile-bar {
        display: flex; align-items: flex-end; position: sticky; top: 0; z-index: 5;
        margin: 0 -16px 8px; padding: calc(var(--sat) + 4px) 8px 4px;
        min-height: calc(var(--sat) + 48px);
        background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
        box-shadow: 0 0.5px 0 var(--line-strong);
    }
    .settings-mobile-bar .nav-back { display: inline-flex; }
    .settings-content .modal-header { margin-top: 6px; }
    .settings-content .modal-header .icon-btn { display: none; }
    .settings-card { padding: 14px; border-radius: var(--r-md); }
    .settings-row { flex-wrap: wrap; }

    /* Toasty na telefonie: pełna szerokość pod wyspą / wcięciem */
    #toast-container { left: 10px; right: 10px; width: auto; top: calc(var(--sat) + 6px); }
}

/* Bardzo wąskie telefony (iPhone SE, starsze Androidy) */
@media (max-width: 360px) {
    :root { --fs-large: 28px; }
    .rail-btn { font-size: 10px; }
    .rail-icon { width: 48px; }
    .info-quick { gap: 6px; }
    .info-quick button { font-size: 11px; }
    .chat-actions .icon-btn { min-width: 38px; }
}

/* Poziomo na telefonie: niższe nagłówki */
@media (max-height: 480px) and (max-width: 950px) {
    :root { --hdr-h: 46px; --tab-h: 50px; }
    .home-title { font-size: 24px; }
}

/* Dostępność: ograniczony ruch → bez sprężyn i przesunięć, tylko przenikanie */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
/* Wyższy kontrast na życzenie systemu */
@media (prefers-contrast: more) {
    :root { --line: rgba(31,46,72,.22); --line-strong: rgba(31,46,72,.35); --ink-2: rgba(31,46,72,.85); --material: var(--surface-3); }
    [data-theme="dark"] { --line: rgba(255,255,255,.2); --line-strong: rgba(255,255,255,.3); --ink-2: rgba(236,238,241,.85); --material: var(--surface-3); }
}
@media (prefers-reduced-transparency: reduce) {
    :root, [data-theme="dark"] { --material: var(--surface-1-solid); --blur: none; }
}
.lfe-status[data-state="wait"] { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning) !important; }
.lfe-status[data-state="ok"] { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success) !important; }
.lfe-status[data-state="relay"] { background: var(--accent-soft); color: var(--accent-text) !important; }
.lfe-status[data-state="err"] { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger) !important; }
@media (min-width: 769px) { #home-quick { display: none; } }
#root-view { position: fixed; inset: 0; overflow: hidden; }

/* Okno "Powiadomienia tej rozmowy" (notify.js) */
.conv-notify-box { gap: 10px; }
.conv-notify-name { font-weight: 650; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-notify-status { padding: 12px 14px; border-radius: var(--r-md); font-weight: 650; color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.conv-notify-status.is-muted { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.conv-notify-section-title { font-size: var(--fs-cap); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin-top: 6px; }
.conv-notify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.conv-notify-grid .secondary-btn { margin: 0; min-height: 46px; }
.conv-notify-grid .secondary-btn.active { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.conv-notify-unmute { margin: 0; }
.conv-notify-bots { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--fill); cursor: pointer; line-height: 1.4; }
.conv-notify-bots input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }
.conv-notify-bots small { color: var(--ink-2); }
.conv-notify-hint { font-size: var(--fs-foot); color: var(--ink-2); margin: 0; line-height: 1.5; }

/* Wyszukiwanie osób do grupy */
#add-member-results { margin-top: 10px; }
#add-member-results .acc-search-result { display: flex; align-items: center; gap: 10px; }
#add-member-results .history-item { background: transparent; padding: 8px 6px; border-radius: var(--r-md); }
#add-member-results .history-item:hover { background: var(--fill); }
#add-member-results .primary-btn { min-height: 34px; font-size: var(--fs-foot); border-radius: var(--r-full) !important; }
.error-message { min-height: 1.2em; font-size: var(--fs-foot); }

/* Boty (Ustawienia → Boty) */
.bot-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); box-shadow: 0 0 0 0.5px var(--line); margin-bottom: 8px; }
.bot-item-main { flex: 1; min-width: 0; }
.bot-item-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-item-meta, .bot-muted { color: var(--ink-2); font-size: var(--fs-foot); }
.bot-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }
.bot-err { color: var(--danger); font-size: var(--fs-foot); }
.bot-perms { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0; font-size: var(--fs-sub); }
.bot-token-box { font-family: var(--font-mono); font-size: 13px; padding: 12px; border-radius: var(--r-md); background: var(--fill); overflow-wrap: anywhere; }
.bot-edit { margin-top: 10px; padding-top: 10px; border-top: 0.5px solid var(--line-strong); }

/* Ustawienia otwarte z poziomu czatu na telefonie: pełny ekran nad czatem, z przyciskiem zamknięcia */
@media (max-width: 768px) {
    #app-wrapper.mobile-chat-active #settings-modal { z-index: 95 !important; bottom: 0; }
    #app-wrapper.mobile-chat-active .settings-nav-close { display: inline-flex; }
    #app-wrapper.mobile-chat-active .settings-shell .settings-navigator { padding-bottom: calc(24px + var(--sab)); }
}
@media (max-width: 768px) {
    .user-profile { display: none; }
    .mini-voice-bar { position: absolute; left: 12px; right: 12px; z-index: 41; margin: 0; bottom: calc(var(--tab-h) + var(--sab) + 66px); box-shadow: var(--shadow-2); }
    .kb-open .mini-voice-bar { display: none; }
    .list-scroll:has(~ .mini-voice-bar:not(.hidden)) { padding-bottom: calc(var(--tab-h) + var(--sab) + 140px); }
}
.settings-navigator > * { flex-shrink: 0; }

/* Blokada obrotu w PWA na iPhonie (iOS nie pozwala zablokować orientacji) — patrz viewport.js */
#rotate-lock { display: none; }
html.rotate-locked #rotate-lock {
    display: flex; position: fixed; inset: 0; z-index: 2147483647;
    flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: var(--canvas-bg, #141517); color: var(--text-primary, #fff);
    font: 700 1.05em 'Lato', system-ui, sans-serif; text-align: center;
}
html.rotate-locked #rotate-lock svg { transform: rotate(90deg); opacity: 0.85; }

/* Okienko z polem tekstowym (window.app.askText — zamiennik prompt(), którego nie ma w Electronie) */
.ask-text-overlay { display: flex; align-items: center; justify-content: center; }
.ask-text { display: flex; flex-direction: column; gap: 12px; }
.ask-text-label { font-weight: 700; color: var(--text-primary); }
.ask-text-input { width: 100%; box-sizing: border-box; font-size: 16px; margin: 0; }
.ask-text-actions { display: flex; gap: 10px; justify-content: flex-end; }
.ask-text-actions button { margin: 0; flex: 1 1 0; width: auto; min-width: 96px; }

/* Zaznaczanie w aplikacji: tylko tekst w dymkach wiadomości i pola do pisania.
   Reszta interfejsu (listy, przyciski, nagłówki, menu) nie podświetla się przy przeciąganiu ani Ctrl+A. */
#app-wrapper, .modal-overlay, .ws-pop { -webkit-user-select: none; user-select: none; }
#app-wrapper input, #app-wrapper textarea, #app-wrapper [contenteditable]:not([contenteditable="false"]),
.modal-overlay input, .modal-overlay textarea, .modal-overlay [contenteditable]:not([contenteditable="false"]) {
    -webkit-user-select: text; user-select: text;
}
/* Na dotyku dymki zostają niezaznaczalne (przytrzymanie otwiera menu z "Kopiuj tekst") */
/* Komputer: zaznaczalny cały dymek, nie tylko sam tekst — przeciąganie zaczęte na marginesie dymka
   (albo przed pierwszym słowem) też zaczepia zaznaczenie. Wcześniej nic się wtedy nie zaznaczało,
   a prawy przycisk otwierał menu wiadomości zamiast "Kopiuj". */
html:not(.is-touch) #app-wrapper .msg .msg-text,
html:not(.is-touch) #app-wrapper #messages-container .msg { -webkit-user-select: text; user-select: text; }
html:not(.is-touch) #app-wrapper #messages-container .msg :is(img, video, button, .reaction-pill, .spoiler-media) { -webkit-user-select: none; user-select: none; }

/* Kto zareagował */
.reactions-modal { max-height: min(70vh, 640px); }
.reactions-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.reactions-tabs::-webkit-scrollbar { display: none; }
.reactions-tab { flex: none; border: 0; cursor: pointer; padding: 6px 12px; border-radius: 999px; background: var(--fill); color: var(--ink); font: inherit; font-size: var(--fs-sub); font-variant-numeric: tabular-nums; }
.reactions-tab.active { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.reaction-user-row { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.reaction-user-row .avatar { width: 36px; height: 36px; flex: none; }
.reaction-user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.reaction-user-emoji { font-size: 1.3em; flex: none; }
.reactions-empty { text-align: center; padding: 16px; color: var(--ink-2); }

/* Powrót do wyników wyszukiwania (telefon, po kliknięciu wyniku) */
.search-return-pill {
    position: absolute; z-index: 25; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--composer-h, 72px) + 16px);
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
    background: var(--material-strong); color: var(--accent-text);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--shadow-2), 0 0 0 0.5px var(--line-strong);
    font: inherit; font-size: var(--fs-sub); font-weight: 650; cursor: pointer;
}
.search-return-pill .ic { width: 16px; height: 16px; }
.search-return-pill.hidden { display: none; }
#search-results-list .history-item.search-last, #pinned-messages-list .history-item.search-last { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Okna dialogowe aplikacji (window.app.askConfirm / alertBox — zamiast confirm()/alert()) */
.app-dialog-title { margin: 0; font-size: var(--fs-headline); font-weight: 700; }
.app-dialog-msg { margin: 0; line-height: 1.5; color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
.app-dialog .primary-btn.danger { background: var(--danger, #d63d43); color: #fff; box-shadow: none; }
