:root {
    --accent: #007fff;
    --accent-2: #2AABEE;
    --accent-3: #2AABEE;
    --bg: #ffffff;
    --bg-2: #f4f4f5;
    --bg-3: #e4e6eb;
    --bg-chat: #d9eef9;
    --bubble-in: #ffffff;
    --bubble-out: #effdde;
    --text: #000000;
    --text-2: #707579;
    --border: #e4e6eb;
    --danger: #e53935;
    --header-bg: #ffffff;
    --composer-bg: #ffffff;
    --hover: #f0f0f0;
    --shadow: 0 1px 2px rgba(0,0,0,.10);
}

[data-theme="dark"] {
    --accent: #64b5ef;
    --accent-2: #79c0ff;
    --accent-3: #00ffea;
    --bg: #17212b;
    --bg-2: #0e1621;
    --bg-3: #242f3d;
    --bg-chat: #0e1621;
    --bubble-in: #182533;
    --bubble-out: #2b5278;
    --text: #ffffff;
    --text-2: #8b98a9;
    --border: #101921;
    --header-bg: #17212b;
    --composer-bg: #17212b;
    --hover: #202b36;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    background: var(--bg-2);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

button, input, textarea {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
    color: inherit;
}
input, textarea { cursor: text; }
a { text-decoration: none; color: inherit; }

/* ========== APP ========== */
.app {
    position: fixed;
    inset: 0;
    display: flex;
    max-width: 1500px;
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 0 24px rgba(0,0,0,.08);
    transition: background .2s;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 380px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg);
    min-height: 0;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    flex-shrink: 0;
}
.search {
    flex: 1;
    background: var(--bg-2);
    padding: 9px 14px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text);
    transition: background .15s, box-shadow .15s;
    min-width: 0;
}
.search::placeholder { color: var(--text-2); }
.search:focus { background: var(--bg-3); box-shadow: 0 0 0 2px var(--accent-2); }

.chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.chat-item-wrap { position: relative; overflow: hidden; }
.chat-item-actions {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    display: flex;
    align-items: stretch;
}
.act-btn {
    width: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.act-btn:active { filter: brightness(1.15); }
.act-settings { background: #43a047; }

.chat-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    background: var(--bg);
    transition: background .15s, transform .2s ease;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--accent); color: #fff; }
.chat-item.active .name,
.chat-item.active .preview,
.chat-item.active .time { color: #fff; }
.chat-item.active .badge { background: #fff; color: var(--accent); }

.avatar {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: #ccc center/cover no-repeat;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 18px;
    overflow: hidden;
}

.chat-body { flex: 1; min-width: 0; }
.chat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chat-row + .chat-row { margin-top: 4px; }
.name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.preview { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.badge {
    background: var(--accent); color: #fff;
    font-size: 12px; font-weight: 600;
    min-width: 22px; height: 22px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 6px; flex-shrink: 0;
}

/* ========== CHAT ========== */
.chat {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    min-height: 58px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    z-index: 2;
    flex-shrink: 0;
}
.chat-header .avatar { width: 42px; height: 42px; font-size: 16px; }
.chat-meta { line-height: 1.2; min-width: 0; }
.chat-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 13px; color: var(--accent); }
.spacer { flex: 1; }

/* MESSAGES — iOS-safe scroller */
.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 14px 4% 20px;
    scrollbar-width: thin;
    display: block;
}

/* ========== BUBBLES ========== */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 6px;
}
.msg-row.in + .msg-row.in { margin-bottom: 2px; }
.msg-avatar-spacer { width: 34px; flex-shrink: 0; margin-bottom: 2px; }
.msg-row.out { justify-content: flex-end; }
.msg-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #ccc center/cover no-repeat;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 13px;
    overflow: hidden;
    margin-bottom: 2px;
}

.bubble {
    max-width: 68%;
    padding: 8px 12px 22px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-shadow: var(--shadow);
    position: relative;
    animation: pop .16s ease-out;
}
@keyframes pop {
    from { transform: scale(.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Block selection ONLY on the bubble when not in text-select mode */
.bubble:not(.text-selecting),
.bubble:not(.text-selecting) * {
    -webkit-user-select: none;
    user-select: none;
}

/* Text-select mode: enable full native selection */
.bubble.text-selecting,
.bubble.text-selecting * {
    -webkit-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

.bubble.in  { align-self: flex-start; background: var(--bubble-in);  border-bottom-left-radius: 4px;  color: var(--text); }
.bubble.out { align-self: flex-end;   background: var(--bubble-out); border-bottom-right-radius: 4px; color: var(--text); }

.bubble-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.bubble-text p { margin: 0 0 6px; }
.bubble-text p:last-child { margin-bottom: 0; }
.bubble-text br { line-height: 1; }
.bubble-text a { color: var(--accent); text-decoration: underline; }
.bubble-text code {
    background: rgba(0,0,0,.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 13px;
}
[data-theme="dark"] .bubble-text code { background: rgba(255,255,255,.1); }
.bubble-text pre {
    background: rgba(0,0,0,.06);
    padding: 8px 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    font-family: ui-monospace, Menlo, monospace;
    margin: 4px 0;
}
[data-theme="dark"] .bubble-text pre { background: rgba(0,0,0,.35); }
.bubble-text ul, .bubble-text ol { padding-left: 20px; margin: 4px 0; }
.bubble-text img { max-width: 100%; border-radius: 8px; }
.bubble-text b, .bubble-text strong { font-weight: 700; }
.bubble-text i, .bubble-text em { font-style: italic; }

/* ===== Telegram-style blockquote ===== */
.bubble-text blockquote {
    position: relative;
    margin: 6px 0;
    padding: 4px 0 4px 14px;
    border-left: 3px solid var(--accent);
    background: rgba(34,158,217,.06);
    border-radius: 0 6px 6px 0;
    color: inherit;
    font-style: normal;
    font-size: inherit;
    line-height: 1.45;
}
.bubble-text blockquote + blockquote {
    margin-top: 4px;
}
.bubble-text blockquote p {
    margin: 0 0 4px;
}
.bubble-text blockquote p:last-child {
    margin-bottom: 0;
}
.bubble-text blockquote strong,
.bubble-text blockquote b {
    color: var(--text);
    font-weight: 700;
}
.bubble-text blockquote code {
    background: rgba(34,158,217,.15);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 12.5px;
    font-family: ui-monospace, Menlo, monospace;
}
[data-theme="dark"] .bubble-text blockquote {
    background: rgba(100,181,239,.10);
    border-left-color: var(--accent);
}
[data-theme="dark"] .bubble-text blockquote code {
    background: rgba(100,181,239,.20);
    color: var(--accent-2);
}
.bubble.out .bubble-text blockquote {
    background: rgba(77,139,61,.08);
    border-left-color: #4d8b3d;
}
.bubble.out .bubble-text blockquote code {
    background: rgba(77,139,61,.18);
    color: #4d8b3d;
}
[data-theme="dark"] .bubble.out .bubble-text blockquote {
    background: rgba(100,200,150,.10);
    border-left-color: #a0c8a0;
}
[data-theme="dark"] .bubble.out .bubble-text blockquote code {
    background: rgba(100,200,150,.20);
    color: #a0c8a0;
}
.bubble-text blockquote blockquote {
    background: rgba(34,158,217,.10);
    border-left-color: var(--accent-2);
    margin-top: 4px;
    margin-bottom: 4px;
}
[data-theme="dark"] .bubble-text blockquote blockquote {
    background: rgba(100,181,239,.15);
}

/* ===== Copy tag: <copy>...</copy> ===== */
.bubble-text .copyable {
    color: var(--accent);
    cursor: pointer;
    letter-spacing: .5px;
    padding: 0 3px;
/*    border-radius: 4px; */
    transition: background .15s, color .15s;
}
.bubble-text .copyable:active {
    transform: scale(.94);
}
.bubble-text .copyable.copied {
background: var(--accent); color: #fff;
}

[data-theme="dark"] .bubble-text .copyable {
    color: var(--accent-2);
}
[data-theme="dark"] .bubble-text .copyable.copied {
    background: none !important;
    color: var(--text) !important;        
}

/* ===== Auto-link URLs ===== */
.bubble-text .auto-link {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.bubble-text .auto-link:active {
    opacity: 0.65;
}
.bubble-text .auto-link:hover {
    color: var(--accent-2);
}

.bubble-img {
    display: block;
    max-width: 100%;
    border-radius: 10px;
    margin: -4px -6px 6px;
    max-height: 320px;
    object-fit: cover;
}

.bubble .ts {
    position: absolute;
    right: 10px; bottom: 5px;
    font-size: 11px;
    color: var(--text-2);
    user-select: none;
}
.bubble.out .ts { color: #4d8b3d; }
[data-theme="dark"] .bubble.out .ts { color: #a0c8a0; }

.bubble-tags {
    position: absolute;
    left: 10px; bottom: 4px;
    display: inline-flex;
    gap: 3px;
    background: rgba(255,255,255,.92);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
[data-theme="dark"] .bubble-tags { background: rgba(0,0,0,.5); }
.bubble.out .bubble-tags { background: rgba(255,255,255,.75); }
.tag-pill { user-select: none; }

.bubble .card {
    color: var(--accent-3);
    cursor: pointer;
    letter-spacing: .5px;
    padding: 0 3px;
    border-radius: 4px;
    transition: background .15s, color .15s;
}
.bubble .card:hover { background: rgba(34,158,217,.10); }
.bubble .card.copied {
    background: var(--accent); color: #fff;

    }



.bubble.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
body.select-mode .bubble { cursor: pointer; }
.bubble.flash { animation: flash 1.4s ease-out; }
@keyframes flash {
    0% { box-shadow: 0 0 0 0 rgba(34,158,217,.7); }
    50% { box-shadow: 0 0 0 8px rgba(34,158,217,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,158,217,0); }
}

/* ========== COMPOSER ========== */
.composer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--composer-bg);
    border-top: 1px solid var(--border);
    z-index: 2;
    flex-shrink: 0;
}
#composerInput {
    flex: 1;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.4;
    padding: 11px 16px;
    background: var(--bg-2);
    border-radius: 22px;
    color: var(--text);
    cursor: text;
    resize: none;
    border: none;
    outline: none;
    min-height: 44px;
    max-height: 140px;
    overflow-y: auto;
    transition: background .15s, box-shadow .15s;
    -webkit-appearance: none;
    box-sizing: border-box;
    min-width: 0;
}
#composerInput::placeholder { color: var(--text-2); }
#composerInput:focus { background: var(--bg); box-shadow: 0 0 0 2px var(--accent-2); }

.icon-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, transform .1s;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--accent); }
.icon-btn:active { transform: scale(.92); }
/* send button: see TELEGRAM SEND BUTTON block below */

.theme-toggle svg { transition: transform .3s; }
.theme-toggle:active svg { transform: rotate(30deg); }

/* ========== CONTEXT MENU ========== */
.ctx-menu {
    position: fixed;
    background: var(--bg);
    border-radius: 12px;
    box-shadow: 0 6px 32px rgba(0,0,0,.28);
    padding: 6px;
    z-index: 9999;
    display: none;
    min-width: 230px;
    font-size: 14px;
    user-select: none;
    border: 1px solid var(--border);
}
.ctx-menu button {
    display: flex; align-items: center; gap: 12px;
    width: 100%; text-align: left;
    padding: 9px 12px; border-radius: 8px;
    cursor: pointer; font-size: 14px;
    color: var(--text);
    transition: background .12s;
    background: none; border: none;
}
.ctx-menu button svg { flex-shrink: 0; color: var(--text-2); }
.ctx-menu button:hover { background: var(--hover); color: var(--accent); }
.ctx-menu button:hover svg { color: var(--accent); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button.danger svg { color: var(--danger); }
.ctx-menu button.danger:hover { background: rgba(229,57,53,.1); }
.ctx-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 6px; }

/* ========== REACTION BAR ========== */
.tag-picker {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg);
    padding: 6px 8px;
    border-radius: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,.30);
    z-index: 10000;
    animation: pop .15s ease-out;
    border: 1px solid var(--border);
}
.tag-picker button {
    font-size: 22px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 50%;
    cursor: pointer;
    transition: background .12s, transform .12s;
    background: none; border: none;
}
.tag-picker button:hover { background: var(--hover); transform: scale(1.20); }
.tag-picker button.selected { background: rgba(34,158,217,.15); box-shadow: inset 0 0 0 2px var(--accent); }
.tag-picker .more {
    background: var(--bg-2);
    border-radius: 50%;
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; color: var(--text-2);
    flex-shrink: 0;
}

/* ========== SELECTION BAR ========== */
.sel-bar {
    position: fixed; left: 50%; bottom: 24px;
    transform: translate(-50%, 100px);
    background: var(--accent); color: #fff;
    padding: 10px 14px;
    border-radius: 30px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 8px 32px rgba(34,158,217,.4);
    transition: transform .25s;
    z-index: 9998;
    font-size: 14px;
}
.sel-bar.show { transform: translate(-50%, 0); }
.sel-bar span { padding: 0 8px; font-weight: 500; }
.sel-bar button {
    background: rgba(255,255,255,.2);
    color: #fff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: none;
}
.sel-bar button:hover { background: rgba(255,255,255,.35); }

/* ========== TOAST ========== */
#toast {
    position: fixed; left: 50%; bottom: 40px;
    transform: translate(-50%, 60px);
    background: rgba(0,0,0,.85);
    color: #fff;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    opacity: 0;
    transition: opacity .2s, transform .2s;
    pointer-events: none;
    z-index: 10000;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ========== TEXT SELECT BAR ========== */
.seltext-bar {
    position: fixed; left: 50%; bottom: 84px;
    transform: translate(-50%, 120px);
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 10px 7px 16px;
    border-radius: 26px;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,.20);
    transition: transform .2s;
    z-index: 9999;
    font-size: 13px;
    max-width: calc(100vw - 24px);
}
.seltext-bar.show { transform: translate(-50%, 0); }
.seltext-bar span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.seltext-bar button {
    background: var(--accent); color: #fff;
    padding: 8px 16px; border-radius: 18px;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
    border: none;
}
.seltext-bar #selTextDone { background: var(--bg-2); color: var(--text); }

/* ========== BOTFATHER POPUP ========== */
.bot-overlay {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 10001;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
    padding: 16px;
}
.bot-overlay.show { opacity: 1; pointer-events: auto; }
.bot-overlay-card {
    background: #f4f4f5;
    border-radius: 12px;
    width: 100%; max-width: 395px;
    height: min(660px, 92dvh);
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 60px rgba(0,0,0,.5);
    transform: translateY(14px) scale(.97);
    transition: transform .2s;
    display: flex; flex-direction: column;
}
.bot-overlay.show .bot-overlay-card { transform: none; }
.bot-overlay-card iframe { flex: 1; width: 100%; border: 0; background: transparent; }
.bot-overlay-close {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(128,128,128,.25);
    color: var(--text); font-size: 20px; line-height: 1;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    border: none;
}
.bot-overlay-close:hover { background: rgba(128,128,128,.4); }



/* ============================================================
   MERGED FROM admin.css (admin pages share this one file now)
   ============================================================ */
button, input, select { font-family: inherit; }

/* ============================================================
   TELEGRAM SEND BUTTON + COMPOSER
   ============================================================ */
.composer { align-items: flex-end; gap: 8px; padding: 8px 10px; }
#composerInput { border-radius: 22px; padding: 11px 16px; background: var(--bg-2); }
.icon-btn.send {
    width: 44px; height: 44px;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    opacity: .55;
    transform: scale(.94);
    transition: opacity .18s, transform .18s, background .15s, box-shadow .15s;
}
.icon-btn.send svg { width: 24px; height: 24px; margin-left: -2px; transform: rotate(0deg); }
.icon-btn.send.ready { opacity: 1; transform: scale(1); }
.icon-btn.send:hover { background: var(--accent); color: #fff; filter: brightness(1.08); }
.icon-btn.send:active { transform: scale(.9); }

/* ============================================================
   LOGOUT BUTTON
   ============================================================ */
.logout-form { display: inline-flex; margin: 0; }
.logout-form .icon-btn:hover { color: var(--danger); background: rgba(229,57,53,.10); }

/* ============================================================
   WELCOME / EMPTY STATE inside #messages
   ============================================================ */
.messages.is-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.welcome {
    display: flex; flex-direction: column; align-items: center;
    text-align: center;
    max-width: 340px; width: 100%;
    margin: auto;
    padding: 24px 20px;
    background: rgba(0,0,0,.18);
    border-radius: 18px;
    color: #fff;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
[data-theme="light"] .welcome { background: rgba(255,255,255,.55); color: var(--text); }
.welcome-logo {
    width: 84px; height: 84px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.welcome-logo img { width: 100%; height: 100%; object-fit: cover; }
.welcome-logo svg { width: 62%; height: 62%; }
.welcome-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.welcome-sub { font-size: 14px; opacity: .8; margin-bottom: 14px; }
.welcome-list { list-style: none; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.welcome-list li { display: flex; flex-direction: column; font-size: 13px; line-height: 1.35; }
.welcome-list li b { font-size: 13px; color: var(--accent-2); }
.welcome-list li span { opacity: .85; }
.welcome:has(.welcome-sub:only-child) { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }



/* avatars: gradient set from JS, keep text crisp */
.avatar, .msg-avatar { text-shadow: 0 1px 2px rgba(0,0,0,.2); }


/* ============================================================================
   BOTFATHER PAGES (admin.php + settings.php) — shared theme: light + dark
   Follows the app theme: <html data-theme="light|dark"> (localStorage "tg-theme")
   ============================================================================ */
body.page-bf {
    --bf-w: 420px;
    --bf-bg: #f4f4f5;      --bf-header: #ffffff;   --bf-text: #1a1a1a;     --bf-muted: #707579;
    --bf-input: #ffffff;   --bf-border: #dadce0;   --bf-border-2: #c3c8cf; --bf-card: #ffffff;
    --bf-chev: #a0a8b3;    --bf-ph: #8b98a9;       --bf-token-text: #3b4754;
    --bf-hover: rgba(0,0,0,.04); --bf-hover-2: rgba(0,0,0,.08);
    --bf-err-bg: #fdecea;  --bf-err-text: #c62828; --bf-ok-bg: #d1f4d8;    --bf-ok-text: #1b5e20;
}
html[data-theme="dark"] body.page-bf {
    --bf-bg: #0e1621;      --bf-header: #17212b;   --bf-text: #ffffff;     --bf-muted: #8b98a9;
    --bf-input: #242f3d;   --bf-border: #2b3a4a;   --bf-border-2: #3a4a5a; --bf-card: #1c2733;
    --bf-chev: #4d6275;    --bf-ph: #6b7d8f;       --bf-token-text: #b8c6d4;
    --bf-hover: rgba(255,255,255,.04); --bf-hover-2: rgba(255,255,255,.08);
    --bf-err-bg: #3a1c1c;  --bf-err-text: #ff8a80; --bf-ok-bg: #1c3a2a;    --bf-ok-text: #7ee2a8;
}

/* ============================================================================
   LOGIN PAGE (login.php)
   ============================================================================ */
body.page-login {
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
    --accent-soft-hover: color-mix(in srgb, var(--accent) 18%, transparent);
    --bg: #ffffff;  --bg-2: #f4f4f5;
    --text: #1a1a1a; --text-2: #707579; --text-3: #8b98a9;
    --border: #dadce0; --border-hover: var(--accent);
    --input-bg: #ffffff; --input-bg-focus: #ffffff; --input-border: #dadce0;
    --label-bg: #ffffff; --label-color: #707579; --label-active: var(--accent);
    --logo-shadow: 0 4px 20px color-mix(in srgb, var(--accent) 25%, transparent);
    --error-bg: #fdecea; --error-text: #c62828;
    --ok-bg: #d1f4d8;    --ok-text: #1b5e20;
}

html[data-theme="dark"] body.page-login {
    --bg: #0e1621; --bg-2: #17212b;
    --text: #ffffff; --text-2: #8b98a9; --text-3: #6b7d8f;
    --border: #2b3a4a; --border-hover: var(--accent);
    --input-bg: #242f3d; --input-bg-focus: #242f3d; --input-border: #2b3a4a;
    --label-bg: #0e1621; --label-color: #8b98a9; --label-active: var(--accent);
    --logo-shadow: 0 4px 20px rgba(0,0,0,.45);
    --error-bg: #3a1c1c; --error-text: #ff8a80;
    --ok-bg: #1c3a2a;    --ok-text: #7ee2a8;
}

body.page-login {
    height: 100%; width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg); color: var(--text);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    transition: background .25s ease, color .25s ease;
}

body.page-login .login-wrap {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 24px; overflow-y: auto;
}

body.page-login .login-box {
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column; align-items: center;
}

body.page-login .theme-btn {
    position: fixed;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: 16px;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--bg-2); border: 1px solid var(--border);
    color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 100;
    transition: background .15s, color .15s, transform .15s, border-color .15s;
    -webkit-appearance: none;
}

body.page-login .theme-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent);
}

body.page-login .theme-btn:active { transform: scale(.92);
}

body.page-login .theme-btn svg { display: block; pointer-events: none;
}

body.page-login .tg-logo {
    width: 120px; height: 120px; border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 24px;
    box-shadow: var(--logo-shadow);
    overflow: hidden;
}

body.page-login .tg-logo img { width: 100%; height: 100%; object-fit: cover;
}

body.page-login .tg-logo svg { width: 62%; height: 62%; color: #fff;
}

body.page-login .login-title {
    font-size: 26px; font-weight: 700; color: var(--text);
    margin-bottom: 10px; letter-spacing: -.4px; text-align: center;
}

body.page-login .login-sub {
    font-size: 14px; color: var(--text-2); text-align: center;
    line-height: 1.45; margin-bottom: 28px; max-width: 300px;
}

body.page-login .field { position: relative; width: 100%; margin-bottom: 14px;
}

body.page-login .field input {
    width: 100%;
    padding: 18px 16px 8px;
    border: 1px solid var(--input-border);
    border-radius: 100px;
    font-size: 16px; font-family: inherit;
    background: var(--input-bg); color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s, color .15s;
    -webkit-appearance: none;
    height: 56px;
}

body.page-login .field input::placeholder { color: transparent;
}

body.page-login .field label {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    padding: 0 5px; background: var(--label-bg);
    color: var(--label-color); font-size: 16px;
    pointer-events: none; white-space: nowrap;
    transition: top .12s ease, font-size .12s ease, color .12s ease;
}

body.page-login .field input:focus + label,
body.page-login .field input:not(:placeholder-shown) + label {
    top: 0; font-size: 12px; color: var(--label-active); font-weight: 500;
}

body.page-login .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}

body.page-login .field input:-webkit-autofill,
body.page-login .field input:-webkit-autofill:hover,
body.page-login .field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    transition: background-color 9999s ease-in-out 0s;
}

body.page-login .login-btn {
    width: 100%; padding: 14px; margin-top: 8px;
    background: transparent; color: var(--accent);
    border: 1px solid var(--accent); border-radius: 100px;
    font-size: 16px; font-weight: 600; font-family: inherit;
    cursor: pointer; letter-spacing: .2px;
    transition: filter .15s, transform .08s, background .15s, color .15s;
    -webkit-appearance: none;
}

body.page-login .login-btn:hover { background: var(--accent-soft-hover); color: var(--accent);
}

body.page-login .login-btn:active { transform: scale(.985);
}

body.page-login .alert {
    width: 100%; padding: 12px 16px; border-radius: 10px;
    background: var(--error-bg); color: var(--error-text);
    font-size: 13px; margin-bottom: 16px;
    text-align: center; font-weight: 500;
}

body.page-login .alert.ok { background: var(--ok-bg); color: var(--ok-text);
}

body.page-login .login-foot {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0;
    text-align: center; font-size: 12px;
    color: var(--text-3); padding: 0 24px;
}

body.page-login .login-foot a { color: var(--accent); text-decoration: none;
}

@media (max-width: 420px) {
body.page-login .login-wrap { padding: 20px;
}

body.page-login .tg-logo { width: 100px; height: 100px; margin-bottom: 20px;
}

body.page-login .login-title { font-size: 24px;
}
}



/* ---------- BotFather / Settings overlay (opened from index.php) ---------- */
html[data-theme="dark"] .bot-overlay-card { background: #0e1621; }
@media (max-width: 760px) {
    .bot-overlay { padding: 0; }
    .bot-overlay-card { max-width: none; height: 100%; height: 100dvh; border-radius: 0; }
}
@media (min-width: 761px) {
    .bot-overlay-card { max-width: 460px; height: min(720px, 92dvh); }
}

/* ============================================================================
   v2 — SHELL: one flex layout for phone + desktop
   --vvh / --vvt come from core.js (visual viewport: the area NOT covered by the keyboard)
   ============================================================================ */
[hidden] { display: none !important; }
.app { inset: auto; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100%); }
.sidebar { position: relative; }
.messages { overscroll-behavior: contain; display: block; }
.avatar.online { overflow: visible; position: relative; }
.avatar.online::after { content: ''; position: absolute; right: 0; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #4cd964; border: 2px solid var(--bg); }
.chat-header .avatar.online::after { border-color: var(--header-bg); }
.avatar, .msg-avatar { text-shadow: 0 1px 2px rgba(0,0,0,.2); }

/* empty state of the desktop chat pane */
.chat-empty { display: none; flex: 1; align-items: center; justify-content: center; padding: 20px; }
.chat.is-empty .chat-empty { display: flex; }
.chat.is-empty .chat-header, .chat.is-empty .messages, .chat.is-empty .composer { display: none; }

@media (max-width: 760px) {
    html, body { overflow: hidden; }
    .app { display: block; overflow: hidden; max-width: none; box-shadow: none; }
    .sidebar { position: absolute; inset: 0; width: 100%; min-width: 0; border-right: none; overflow: hidden; }
    .app:not(.chat-only) .chat { display: none; }
    .app.chat-only .sidebar { display: none; }
    .app.chat-only .chat { position: absolute; inset: 0; display: flex; }
    .sidebar-header { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
    .chat-header { padding-top: calc(8px + env(safe-area-inset-top, 0px)); min-height: calc(58px + env(safe-area-inset-top, 0px)); }
    .messages { padding: 12px 10px 16px; }
    .bubble { max-width: 84%; }
    #composerInput { font-size: 16px; max-height: 100px; }     /* 16px: iOS never zooms into the field */
    body.kb-open .composer { padding-bottom: 8px; }             /* no home-indicator gap above the keyboard */
    .ctx-menu { min-width: 200px; max-width: calc(100vw - 16px); }
}
@media (min-width: 761px) {
    .app:not(.chat-only) #chatBack { display: none; }
    .app.chat-only .sidebar { display: none; }
    .app.chat-only .chat { max-width: 920px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
    .bubble { max-width: 70%; }
}

/* ---------- sidebar header, FAB, badges ---------- */
.sidebar-header { gap: 6px; }
.has-badge { position: relative; }
.dot-badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.fab { position: absolute; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.28); cursor: pointer; z-index: 5; transition: transform .12s, filter .15s; }
.fab:hover { filter: brightness(1.08); }
.fab:active { transform: scale(.92); }
.list-empty { text-align: center; color: var(--text-2); padding: 40px 24px; line-height: 1.6; font-size: 14px; }
.chat-list { padding-bottom: 90px; }

/* ---------- chat list items ---------- */
.chat-item .name { display: flex; align-items: center; gap: 5px; min-width: 0; font-weight: 600; }
.chat-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .kind, .chat-item .pin, .chat-item .muted-ico { display: inline-flex; color: var(--text-2); flex-shrink: 0; }
.chat-item .kind svg, .chat-item .pin svg { width: 15px; height: 15px; }
.chat-item .muted-ico svg { width: 16px; height: 16px; }
.chat-item.active .kind, .chat-item.active .pin, .chat-item.active .muted-ico { color: #fff; }
.badge.muted { background: var(--text-2); }
.act-mute { background: #7a8a99; }

/* ---------- chat header ---------- */
.chat-sub { color: var(--text-2); }
.chat-sub.is-online { color: var(--accent); }
.chat-header .chat-meta { flex: 1 1 auto; }
.chat-header .spacer { flex: 0; }
.chat-header > .icon-btn:last-child { margin-left: auto; }

/* ---------- messages: day separators, system lines, group sender names ---------- */
.day-sep { text-align: center; margin: 12px 0 8px; position: sticky; top: 4px; z-index: 1; }
.day-sep span, .sys-msg span { display: inline-block; background: rgba(0,0,0,.30); color: #fff; font-size: 12.5px; padding: 3px 12px; border-radius: 14px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sys-msg { text-align: center; margin: 8px 0; }
.sys-msg span { font-size: 12.5px; max-width: 90%; }
.sender-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.bubble.pending { opacity: .65; }
.load-older { display: block; margin: 4px auto 10px; padding: 7px 16px; border-radius: 16px; background: rgba(0,0,0,.28); color: #fff; font-size: 13px; }
.empty-note { text-align: center; color: var(--text-2); padding: 60px 20px; font-size: 14px; }
.chat-empty .welcome { background: rgba(0,0,0,.12); }
[data-theme="light"] .chat-empty .welcome { background: rgba(255,255,255,.6); }

/* ---------- popover menu (hamburger, FAB, chat menu) ---------- */
.pop-menu { position: fixed; z-index: 10000; min-width: 230px; max-width: calc(100vw - 16px); background: var(--bg); color: var(--text); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.28); padding: 6px; border: 1px solid var(--border); animation: popin .12s ease-out; }
@keyframes popin { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.pop-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.pop-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 9px; font-size: 15px; text-align: left; color: var(--text); }
.pop-menu button:hover { background: var(--hover); }
.pop-menu button svg { color: var(--text-2); flex-shrink: 0; }
.pop-menu button.danger, .pop-menu button.danger svg { color: var(--danger); }
.pop-badge { margin-left: auto; font-style: normal; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; min-width: 20px; padding: 1px 6px; border-radius: 10px; text-align: center; }
.pop-profile { display: flex; align-items: center; gap: 12px; padding: 8px 8px 4px; }
.pop-profile .avatar { width: 46px; height: 46px; font-size: 17px; }
.pp-name { font-weight: 700; font-size: 16px; }
.pp-sub { font-size: 13px; color: var(--text-2); }
.pop-menu .pop-chatid { margin: 4px 6px 2px; width: calc(100% - 12px); padding: 8px 10px; background: var(--bg-2); border-radius: 9px; font-size: 13px; color: var(--text-2); justify-content: space-between; }
.pop-menu .pop-chatid b { color: var(--text); letter-spacing: .5px; }

/* ---------- sign-in pages ---------- */
body.page-login .login-wrap { justify-content: flex-start; }
body.page-login .login-box { margin: auto 0; padding-bottom: 8px; }
body.page-login .login-foot { position: static; margin-top: 18px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
body.page-login .login-alt { margin-top: 18px; font-size: 14px; color: var(--text-2); text-align: center; }
body.page-login .login-alt a { color: var(--accent); font-weight: 600; text-decoration: none; }
body.page-login .login-btn.ghost { border-color: var(--border); color: var(--text-2); margin-top: 4px; }
body.page-login .code-input { text-align: center; letter-spacing: 8px; font-size: 24px; font-weight: 700; }

/* ============================================================================
   TOOL PAGES (people, group, my bots, settings) — theme variables --bf-* are defined above
   ============================================================================ */
body.page-tool { overflow: hidden; background: var(--bf-bg); color: var(--bf-text); }
.tl-wrap { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bf-bg); color: var(--bf-text); }
.tl-header { display: flex; align-items: center; gap: 6px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); background: var(--bf-header); border-bottom: 1px solid var(--bf-border); flex-shrink: 0; }
.tl-header h1 { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-back { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--bf-muted); text-decoration: none; cursor: pointer; flex-shrink: 0; }
.tl-back:hover { background: var(--bf-hover-2); }
.tl-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tl-body { max-width: 560px; margin: 0 auto; padding: 14px 14px calc(34px + env(safe-area-inset-bottom, 0px)); }
.tl-body .avatar { font-size: 17px; }
.tl-body .avatar.big { width: 96px; height: 96px; font-size: 36px; margin: 0 auto 10px; }

.tl-tabs { display: flex; gap: 4px; background: var(--bf-header); border: 1px solid var(--bf-border); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.tl-tabs button { flex: 1; padding: 9px 6px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--bf-muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.tl-tabs button.on { background: var(--accent); color: #fff; }
.tl-tabs em { font-style: normal; background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; padding: 1px 5px; border-radius: 9px; }

.tl-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--bf-border); color: var(--bf-text); text-decoration: none; }
.tl-row:last-child { border-bottom: 0; }
.tl-row .avatar { width: 46px; height: 46px; }
.tl-row-main { flex: 1; min-width: 0; }
.tl-row-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row-sub { font-size: 13px; color: var(--bf-muted); margin-top: 1px; }
.tl-row-btns { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.tl-link:hover { background: var(--bf-hover); }
.tl-chev { color: var(--bf-chev); font-size: 24px; }
.tl-check { cursor: pointer; }
.tl-check input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }

.tl-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 15px; border-radius: 18px; border: 1px solid var(--bf-border); background: var(--bf-header); color: var(--bf-text); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: filter .15s, transform .08s; }
.tl-btn:hover { filter: brightness(.97); }
.tl-btn:active { transform: scale(.97); }
.tl-btn:disabled { opacity: .55; cursor: default; }
.tl-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tl-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.tl-btn.wide { display: flex; width: 100%; margin-top: 10px; padding: 13px; border-radius: 14px; font-size: 15px; }
form + form .tl-btn.wide, .tl-btn.wide + .tl-btn.wide { margin-top: 10px; }

.tl-input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--bf-border); background: var(--bf-input); color: var(--bf-text); font-size: 16px; margin-bottom: 8px; outline: none; font-family: inherit; }
.tl-input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tl-input::placeholder { color: var(--bf-ph); }
input[type="color"] { width: 48px; height: 46px; border: 1px solid var(--bf-border); border-radius: 12px; background: var(--bf-input); padding: 3px; cursor: pointer; }
.tl-label { display: block; font-size: 13px; font-weight: 600; color: var(--bf-muted); margin: 12px 2px 6px; }
.tl-section { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--bf-muted); margin: 20px 4px 8px; }
.tl-hint, .tl-hint-inline { font-size: 12.5px; color: var(--bf-muted); line-height: 1.5; font-weight: 400; text-transform: none; letter-spacing: 0; }
.tl-hint { margin: 4px 2px 8px; }
.tl-card { background: var(--bf-header); border: 1px solid var(--bf-border); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.tl-profile { text-align: center; }
.tl-profile h2 { font-size: 20px; margin: 4px 0 2px; }
.tl-profile-btns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.tl-empty { text-align: center; color: var(--bf-muted); padding: 28px 12px; line-height: 1.6; font-size: 14px; }
.tl-alert { background: var(--bf-err-bg); color: var(--bf-err-text); padding: 11px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
.tl-pill { display: inline-block; font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--bf-hover-2); color: var(--bf-muted); text-transform: none; letter-spacing: 0; vertical-align: middle; }
.tl-pill.ok { background: var(--bf-ok-bg); color: var(--bf-ok-text); }
.tl-pill.off { background: var(--bf-err-bg); color: var(--bf-err-text); }
.tl-copy { display: block; width: 100%; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; padding: 11px 13px; border-radius: 12px; background: var(--bf-card); border: 1px dashed var(--bf-border-2); color: var(--bf-token-text); word-break: break-all; cursor: pointer; margin-bottom: 4px; }
.tl-copy.small { display: inline-block; width: auto; padding: 4px 9px; margin: 0; }
.tl-copy:active { background: var(--bf-hover-2); }
.tl-code { background: var(--bf-card); border: 1px solid var(--bf-border); border-radius: 12px; padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; color: var(--bf-token-text); }
.tl-inline { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.tl-inline .tl-input { margin-bottom: 0; flex: 1; }
.tl-kv { display: flex; justify-content: space-between; align-items: center; padding: 11px 2px; border-top: 1px solid var(--bf-border); font-size: 14px; }
.tl-kv span { color: var(--bf-muted); }
.tl-spacer { height: 16px; }
.tl-form .tl-btn.wide { margin-top: 14px; }
.tl-check-inline { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 8px 2px; }
.tl-profile-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.tl-profile-edit .avatar.big { margin: 0; }
.tl-profile-edit-btns { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bf-hover-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; }

.tl-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--bf-border); cursor: pointer; position: relative; }
.tl-switch-row small { display: block; color: var(--bf-muted); font-size: 12.5px; margin-top: 2px; }
.tl-switch-row.is-disabled { opacity: .55; cursor: default; }
.tl-switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.tl-switch { width: 46px; height: 28px; border-radius: 14px; background: var(--bf-border-2); position: relative; flex-shrink: 0; transition: background .18s; }
.tl-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.tl-switch-row input:checked + .tl-switch { background: var(--accent); }
.tl-switch-row input:checked + .tl-switch::after { transform: translateX(18px); }

@media (min-width: 761px) { .tl-body { padding-top: 24px; } .tl-header { padding-left: 18px; } }
@media (max-width: 420px) { .tl-row-btns .tl-btn { padding: 7px 12px; } .tl-profile-edit { flex-direction: column; align-items: flex-start; } }

/* ---------- "turn on notifications" bar ---------- */
.push-banner { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 8px; right: 8px; max-width: 520px; margin: 0 auto; z-index: 9000; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--accent); color: #fff; box-shadow: 0 6px 22px rgba(0,0,0,.3); font-size: 14px; line-height: 1.35; animation: popin .2s ease-out; }
.push-banner span { flex: 1; }
.push-banner button { flex-shrink: 0; color: #fff; font-weight: 700; }
.push-banner .pb-go { background: rgba(255,255,255,.22); border-radius: 12px; padding: 7px 14px; }
.push-banner .pb-x { font-size: 24px; line-height: 1; padding: 0 6px; opacity: .85; }
