.tgagg .messages .date-chip{position:sticky;top:8px;z-index:3;align-self:center}
html,body{margin:0;padding:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none;background:#fff}
.tgagg{--bg:#fff;--surface:#fff;--side:#f4f4f5;--border:#dadce0;--text:#111827;--muted:#707579;--blue:#3390ec;--blue2:#2481cc;--incoming:#fff;--outgoing:#d9fdd3;--hover:#e9edf0;--shadow:0 8px 24px rgba(0,0,0,.12);--app-height:100dvh;width:100%;max-width:100%;height:var(--app-height,100dvh);color:var(--text);background:var(--bg);overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
    .tgagg,.tgagg *{box-sizing:border-box}.tgagg button,.tgagg input,.tgagg select,.tgagg textarea{font:inherit}.tgagg button{cursor:pointer}
    .tgagg .app{width:100%;max-width:100%;height:100%;min-height:0;display:grid;grid-template-columns:390px minmax(0,1fr);background:var(--surface);overflow:hidden}
    .tgagg .sidebar{position:relative;min-width:0;min-height:0;height:100%;display:flex;flex-direction:column;overflow:hidden;background:var(--side);border-right:1px solid var(--border);z-index:20}
    .tgagg .topbar,.tgagg .tabs,.tgagg .chips,.tgagg .screen-title{flex-shrink:0}
    .tgagg .topbar{display:flex;align-items:center;gap:10px;padding:9px 12px 4px;background:#fff;border-bottom:0}
    .tgagg .menu-btn,.tgagg .icon-btn{width:42px;height:42px;border:0;border-radius:50%;background:transparent;color:var(--muted);display:grid;place-items:center;flex:0 0 auto;transition:.15s}
    .tgagg .menu-btn:hover,.tgagg .icon-btn:hover{background:var(--hover);color:var(--text)}
    .tgagg .hamb{width:21px;display:grid;gap:4px}.tgagg .hamb span{height:2px;border-radius:99px;background:currentColor}
    .tgagg .search{flex:1;min-width:0;height:38px;border:0;outline:0;border-radius:999px;background:#f1f3f4;padding:0 16px;font-size:15px;color:var(--text)}
    .tgagg .tabs,.tgagg .chips{display:flex;gap:8px;padding:9px 12px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;background:#fff;border-bottom:1px solid rgba(218,220,224,.65);scrollbar-width:none;-webkit-overflow-scrolling:touch}.tgagg .tabs::-webkit-scrollbar,.tgagg .chips::-webkit-scrollbar{display:none}
    .tgagg .chip,.tgagg .tab{border:0;display:inline-flex;align-items:center;gap:7px;padding:7px 10px;border-radius:999px;background:#f1f3f4;color:#4b5563;font-size:13px;white-space:nowrap}.tgagg .chip.chip-all.active,.tgagg .tab.active{color:#fff;background:var(--blue)}.tgagg .chip.account-chip{background:var(--account-color,#64748b);color:#fff;border:1px solid rgba(255,255,255,.18)}.tgagg .chip.account-chip.active{box-shadow:0 0 0 2px rgba(17,24,39,.22)}.tgagg .chip.account-chip .badge{background:rgba(0,0,0,.22);color:#fff}.tgagg .chip .platform-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:rgba(255,255,255,.22);color:#fff;font-size:10px;font-weight:900;letter-spacing:.02em}
    .tgagg .dot{width:9px;height:9px;border-radius:50%;background:var(--dot,var(--blue));flex:0 0 auto}.tgagg .badge{min-width:22px;height:22px;padding:0 7px;border-radius:999px;display:inline-grid;place-items:center;background:var(--blue);color:#fff;font-size:12px;font-weight:800}
    .tgagg .screen-title{padding:12px 18px 4px;font-size:11.5px;color:#7c8998;font-weight:700;text-transform:uppercase;letter-spacing:.09em}
    .tgagg .dialog-list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;padding:4px 0 12px}
    .tgagg .dialog-list-footer{padding:10px 16px 14px;text-align:center;font-size:12.5px;color:#94a3b8}
    .tgagg .dialog-list-footer-done{color:#cbd5e1}
    .tgagg .dialog-sync-footer{display:flex;align-items:center;justify-content:center;gap:10px;padding:14px 12px;color:#475569;font-size:13px;font-weight:700}
    .tgagg .dialog-sync-spinner{width:18px;height:18px;border:2px solid #cbd5e1;border-top-color:var(--blue,#3390ec);border-radius:50%;animation:tgaggSpin .7s linear infinite;flex:0 0 auto}
    .tgagg .dialog-sync-check{color:#16a34a;font-weight:900}
    @keyframes tgaggSpin{to{transform:rotate(360deg)}}
    .tgagg .dialog-card{display:grid;grid-template-columns:44px minmax(0,1fr);gap:10px;align-items:center;margin:4px 8px;padding:9px 10px;border:1px solid #e5e7eb;width:calc(100% - 16px);text-align:left;border-radius:12px;position:relative;overflow:hidden;background:#fff;box-shadow:0 1px 2px rgba(15,23,42,.06);transition:.16s}
    .tgagg .dialog-card.unread{background:#eef6ff}
    .tgagg .dialog-card:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--account-accent,#ef4444);opacity:.92;pointer-events:none}.tgagg .dialog-card>*{position:relative;z-index:1}.tgagg .dialog-card:hover{transform:translateY(-1px);box-shadow:0 5px 14px rgba(15,23,42,.12)}.tgagg .dialog-card.active{box-shadow:0 8px 20px rgba(15,23,42,.16);border-color:#cbd5e1}
    .tgagg .avatar{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:900;font-size:14px;background:linear-gradient(135deg,#7dd3fc,#2563eb);overflow:hidden;flex:0 0 auto}.tgagg .avatar img{width:100%;height:100%;object-fit:cover;display:block}
    .tgagg .dialog-main{min-width:0;display:grid;gap:3px}.tgagg .dialog-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}.tgagg .dialog-title{min-width:0;flex:1;font-size:15.5px;font-weight:700;letter-spacing:-.005em;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tgagg .dialog-head-meta{display:flex;align-items:center;gap:4px;flex:0 0 auto;min-width:0}.tgagg .dialog-time{flex:0 0 auto;font-size:12px;line-height:1;color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}.tgagg .dialog-head-meta .client-badge.positive-offer{min-width:14px;height:14px;padding:0 4px;font-size:10px;font-weight:800;border-radius:999px}.tgagg .dialog-head-meta .client-badge.verified{font-size:11px;line-height:1;display:inline-flex;align-items:center}.tgagg .dialog-account-row{min-width:0}.tgagg .dialog-account-row{min-width:0;display:flex}.tgagg .dialog-account-row .account-label{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:2px 9px 2px 7px;border-radius:999px;background:color-mix(in srgb,var(--account-accent,#ef4444) 15%,transparent);color:color-mix(in srgb,var(--account-accent,#ef4444) 62%,var(--text,#14202e));font-size:11.5px;font-weight:650;line-height:1.25;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tgagg .dialog-account-row .account-label::before{content:"";flex:0 0 7px;width:7px;height:7px;border-radius:50%;background:var(--account-accent,#ef4444)}.tgagg .dialog-subline{display:flex;align-items:center;gap:8px;min-width:0}.tgagg .dialog-preview{font-size:13.5px;color:var(--muted);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0}.tgagg .dialog-unread.badge{flex:0 0 auto;min-width:22px;height:22px;padding:0 7px;border-radius:999px;display:inline-grid;place-items:center;background:#ef4444;color:#fff;font-size:12px;font-weight:800}
    .tgagg .chat-pane{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;overflow:hidden;background:linear-gradient(rgba(167,198,217,.88),rgba(167,198,217,.88)),radial-gradient(circle at 20% 20%,rgba(255,255,255,.45) 0 1px,transparent 1px),radial-gradient(circle at 80% 40%,rgba(255,255,255,.35) 0 1px,transparent 1px);background-size:auto,36px 36px,48px 48px}
    .tgagg .chat-header,.tgagg .composer,.tgagg .note-panel{flex-shrink:0}
    .tgagg .chat-pane.empty .chat-header,.tgagg .chat-pane.empty .messages,.tgagg .chat-pane.empty .composer,.tgagg .chat-pane.empty .note-panel,.tgagg .chat-pane.empty .quick-replies{display:none}.tgagg .empty-state{position:absolute;inset:0;display:none;align-items:center;justify-content:center;padding:24px;text-align:center;color:rgba(255,255,255,.92)}.tgagg .chat-pane.empty .empty-state{display:flex}.tgagg .chat-pane.settings-mode,.tgagg .chat-pane.notes-mode{background:transparent}.tgagg .chat-pane.settings-mode .empty-state,.tgagg .chat-pane.settings-mode .chat-header,.tgagg .chat-pane.settings-mode .messages,.tgagg .chat-pane.settings-mode .composer,.tgagg .chat-pane.settings-mode .note-panel,.tgagg .chat-pane.settings-mode .quick-replies,.tgagg .chat-pane.settings-mode .templates-sheet,.tgagg .chat-pane.settings-mode .templates-sheet-backdrop,.tgagg .chat-pane.notes-mode .empty-state,.tgagg .chat-pane.notes-mode .chat-header,.tgagg .chat-pane.notes-mode .messages,.tgagg .chat-pane.notes-mode .composer,.tgagg .chat-pane.notes-mode .note-panel,.tgagg .chat-pane.notes-mode .quick-replies,.tgagg .chat-pane.notes-mode .templates-sheet,.tgagg .chat-pane.notes-mode .templates-sheet-backdrop{display:none}.tgagg .settings-view{display:none;flex:1;min-height:0;overflow-y:auto;padding:22px;background:transparent}.tgagg .chat-pane.settings-mode .settings-view,.tgagg .chat-pane.notes-mode .settings-view,.tgagg .chat-pane.global-templates-mode .settings-view,.tgagg .chat-pane.broadcasts-mode .settings-view{display:block}.tgagg .settings-window{max-width:920px;margin:0 auto}.tgagg .settings-window-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.tgagg .settings-window-title{font-size:20px;font-weight:900}.tgagg .settings-window-subtitle{margin-top:4px;color:var(--muted);font-size:13px}.tgagg .settings-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:12px}.tgagg .empty-card{max-width:380px;padding:20px 22px;border-radius:20px;background:rgba(0,0,0,.24);backdrop-filter:blur(10px);box-shadow:0 8px 24px rgba(0,0,0,.14)}.tgagg .empty-icon{width:76px;height:76px;margin:0 auto 14px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.2);font-size:34px}.tgagg .empty-title{font-size:19px;font-weight:900;margin-bottom:7px}.tgagg .empty-text{font-size:14px;line-height:1.42;opacity:.86}
    .tgagg .chat-header{min-height:66px;display:flex;align-items:center;gap:12px;padding:8px 16px;background:rgba(255,255,255,.96);border-bottom:1px solid rgba(218,220,224,.85);backdrop-filter:blur(12px);z-index:5}.tgagg .back-btn{display:none}.tgagg .header-info{min-width:0;flex:1}.tgagg .header-title{font-size:16px;font-weight:900;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tgagg .header-subtitle{margin-top:2px;font-size:12.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tgagg .header-actions{display:flex;align-items:center;gap:6px}.tgagg .mini-btn{min-height:34px;border:0;border-radius:999px;padding:0 10px;background:#f1f5f9;color:#334155;font-size:12.5px;font-weight:800;white-space:nowrap}.tgagg .mini-btn.primary{background:var(--blue);color:#fff}
    .tgagg .messages{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;padding:12px 10px 9px;display:flex;flex-direction:column;gap:6px}.tgagg .date-chip{align-self:center;margin:2px 0 10px;padding:5px 12px;border-radius:999px;background:rgba(0,0,0,.22);color:#fff;font-size:12.5px;backdrop-filter:blur(6px)}
    .tgagg .message{max-width:min(560px,76%);font-size:15px;line-height:1.38;position:relative;white-space:pre-wrap;word-break:break-word}.tgagg .message.in{align-self:flex-start}.tgagg .message.out{align-self:flex-end}.tgagg .message.message-media{padding:0;background:transparent;box-shadow:none;max-width:min(320px,82%);overflow:visible}.tgagg .message.message-media .message-head{display:none}.tgagg .message.message-media .message-time{float:none;margin:0;padding:2px 6px;border-radius:999px;background:rgba(255,255,255,.86);color:#64748b;font-size:11.5px;box-shadow:0 1px 2px rgba(0,0,0,.08)}.tgagg .media-time-row{display:flex;justify-content:flex-end;margin-top:3px}.tgagg .message-service{align-self:center;max-width:80%;padding:5px 11px;border-radius:999px;background:rgba(0,0,0,.18);color:#fff;font-size:12.5px}.tgagg .message-head{display:flex;align-items:center;gap:6px;margin-bottom:2px;color:var(--blue2);font-size:12px;font-weight:900}.tgagg .message-time{float:right;margin-left:10px;margin-top:2px;color:#6b7280;font-size:11.5px;white-space:nowrap;display:inline-flex;align-items:center;gap:3px}
    .tgagg .media-block{display:block;margin:0;overflow:hidden}.tgagg .media-photo,.tgagg .media-sticker{display:block;max-width:min(280px,100%);max-height:340px;border-radius:12px;object-fit:contain;background:rgba(0,0,0,.04)}.tgagg .media-album-grid{display:grid;gap:2px;max-width:min(300px,100%);border-radius:12px;overflow:hidden}.tgagg .media-album-grid[data-count="1"]{grid-template-columns:1fr}.tgagg .media-album-grid[data-count="2"],.tgagg .media-album-grid[data-count="4"]{grid-template-columns:repeat(2,1fr)}.tgagg .media-album-grid[data-count="3"]{grid-template-columns:1fr 1fr;grid-template-rows:repeat(2,1fr)}.tgagg .media-album-grid[data-count="3"] .media-album-item:first-child{grid-row:span 2}.tgagg .media-album-item{display:block;overflow:hidden;background:rgba(0,0,0,.04);min-height:72px}.tgagg .media-album-photo{display:block;width:100%;height:100%;min-height:72px;max-height:170px;object-fit:cover}.tgagg .message.message-media-album .message-head{display:none}.tgagg .message.message-media-album.message-media{padding:0;background:transparent;box-shadow:none;max-width:min(300px,82%)}.tgagg .message.message-media-album .media-album-caption{padding:6px 9px 4px;border-radius:0 0 13px 13px;background:var(--incoming);box-shadow:0 1px 1px rgba(0,0,0,.08)}.tgagg .message.out.message-media-album .media-album-caption{background:var(--outgoing);border-bottom-right-radius:4px}.tgagg .message.in.message-media-album .media-album-caption{border-bottom-left-radius:4px}.tgagg .media-sticker{max-width:160px;max-height:160px;background:transparent}.tgagg .media-sticker-emoji{display:inline-grid;place-items:center;min-width:58px;min-height:58px;margin:2px 0 6px;border-radius:16px;background:rgba(255,255,255,.72);font-size:42px;line-height:1}.tgagg .media-gif,.tgagg .media-video{display:block;width:min(280px,100%);max-height:340px;border-radius:12px;background:#111}.tgagg .media-video-note{display:block;width:190px;height:190px;border-radius:50%;object-fit:cover;background:#111}.tgagg .media-audio-block{min-width:230px}.tgagg .media-audio{display:block;width:230px;max-width:100%;height:42px}.tgagg .media-file{display:flex;align-items:center;gap:9px;max-width:280px;padding:10px 11px;border-radius:12px;background:rgba(51,144,236,.1);color:#1d4ed8;text-decoration:none;font-weight:800}.tgagg .media-file-icon{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:rgba(51,144,236,.16);flex:0 0 auto}.tgagg .media-file-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tgagg .media-note{color:#64748b;font-size:12px;font-weight:800}.tgagg .media-unsupported{display:flex;align-items:center;gap:9px;max-width:min(280px,100%);padding:10px 11px;border-radius:12px;background:rgba(100,116,139,.12);color:inherit}.tgagg .media-unsupported-body{display:flex;flex-direction:column;gap:2px;min-width:0}.tgagg .media-unsupported-body b{font-weight:800}.tgagg .media-unsupported-body small{font-size:12px;opacity:.75;line-height:1.3}
    .tgagg .note-panel{display:none!important;margin:0 12px 8px;padding:10px;border-radius:14px;background:rgba(255,255,255,.92);box-shadow:0 1px 2px rgba(0,0,0,.08)}.tgagg .note-title{font-size:12px;font-weight:900;color:#475569;margin-bottom:6px}.tgagg .note-row{display:flex;gap:8px;align-items:flex-start}.tgagg .note-row textarea{flex:1;min-width:0;border:1px solid #e5e7eb;border-radius:10px;padding:8px 10px;outline:0;font-size:14px;line-height:1.35;resize:vertical;min-height:42px;font-family:inherit;background:#fff}
.tgagg .composer{display:flex;align-items:stretch;gap:10px;padding:8px 12px 12px;position:relative;z-index:6;background:rgba(167,198,217,.96)}.tgagg .composer-main{flex:1;min-width:0}.tgagg .composer-box{min-height:48px;display:flex;align-items:center;gap:8px;padding:8px 8px 8px 14px;border-radius:18px;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.12)}.tgagg .composer-box.composer-box-multiline{align-items:flex-end;padding-top:6px;padding-bottom:6px}.tgagg .composer-box #attachInput{display:none!important}.tgagg .composer-box textarea{flex:1;border:0;outline:0;min-width:0;padding:0;margin:0;font-size:15.5px;background:transparent;font-family:inherit;line-height:21px;min-height:21px;resize:none;max-height:160px;overflow-y:auto;overflow-x:hidden;align-self:center;display:block}.tgagg .composer-box.composer-box-multiline textarea{align-self:auto}.tgagg .send-btn{width:48px;height:48px;border:0;border-radius:50%;display:grid;place-items:center;background:var(--blue);color:#fff;box-shadow:0 2px 8px rgba(51,144,236,.36);flex:0 0 auto}
    .tgagg .drawer-backdrop,.tgagg .modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.35);opacity:0;pointer-events:none;transition:.18s;z-index:90}.tgagg .drawer-backdrop.show,.tgagg .modal-backdrop.show{opacity:1;pointer-events:auto}.tgagg .drawer{position:fixed;inset:0 auto 0 0;width:min(350px,88vw);background:#fff;box-shadow:var(--shadow);transform:translateX(-102%);transition:.22s;z-index:100;display:flex;flex-direction:column}.tgagg .drawer.open{transform:translateX(0)}.tgagg .drawer-profile{min-height:150px;padding:22px 18px 16px;color:#fff;background:linear-gradient(135deg,#3390ec,#1d4ed8);display:flex;flex-direction:column;justify-content:flex-end}.tgagg .drawer-avatar{width:64px;height:64px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.2);font-size:24px;font-weight:900;margin-bottom:13px}.tgagg .drawer-name{font-size:17px;font-weight:900}.tgagg .drawer-hint{margin-top:3px;font-size:13px;opacity:.88}.tgagg .drawer-menu{padding:8px 0}.tgagg .drawer-item{display:flex;align-items:center;gap:14px;width:100%;min-height:48px;border:0;background:#fff;padding:0 20px;font-size:15px;color:#202124;text-align:left}.tgagg .drawer-item:hover{background:#f1f3f4}
    .tgagg .settings-panel{flex:1;overflow-y:auto;padding:14px 16px 18px;border-top:1px solid #eef2f7;background:#fff}.tgagg .settings-card{padding:13px;border-radius:16px;background:#f8fafc;border:1px solid #e5e7eb;margin-bottom:12px}.tgagg .settings-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.tgagg .settings-title{font-weight:900;font-size:14px}.tgagg .settings-subtitle{color:var(--muted);font-size:12.5px;margin-top:2px}.tgagg .toggle{width:48px;height:28px;border:0;border-radius:999px;padding:3px;background:#cbd5e1;transition:.15s}.tgagg .toggle:before{content:"";display:block;width:22px;height:22px;border-radius:50%;background:#fff;transition:.15s;box-shadow:0 1px 2px rgba(0,0,0,.18)}.tgagg .toggle.on{background:var(--blue)}.tgagg .toggle.on:before{transform:translateX(20px)}
    .tgagg .role-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.tgagg .role-btn{border:1px solid #e5e7eb;border-radius:10px;padding:8px;background:#fff;color:#334155;font-size:13px;font-weight:800}.tgagg .role-btn.active{background:var(--blue);border-color:var(--blue);color:#fff}.tgagg .account-row{display:grid;gap:8px;padding:10px 0;border-top:1px solid #e5e7eb}.tgagg .account-row:first-child{border-top:0}.tgagg .account-name-line{display:flex;align-items:center;justify-content:space-between;gap:8px}.tgagg .account-name{font-weight:900;min-width:0}.tgagg .account-phone{color:var(--muted);font-size:12.5px;margin-top:2px}.tgagg .status{display:inline-flex;align-items:center;gap:5px;padding:4px 7px;border-radius:999px;font-size:11.5px;font-weight:900;white-space:nowrap;background:#e2e8f0;color:#334155}.tgagg .status.active{background:#dcfce7;color:#166534}.tgagg .status.needs_login{background:#ffedd5;color:#9a3412}.tgagg .status.disconnected{background:#e5e7eb;color:#374151}.tgagg .status.error{background:#fee2e2;color:#991b1b}.tgagg .account-actions{display:flex;gap:8px;flex-wrap:wrap}.tgagg .color-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.tgagg .color-dot{position:relative;width:30px;height:30px;border-radius:50%;border:2px solid transparent;background:var(--dot-color,#ef4444);justify-self:center}.tgagg .color-dot.active{border-color:#111827;box-shadow:0 0 0 2px #fff inset}.tgagg .color-dot.locked{opacity:.62;cursor:not-allowed}.tgagg .color-dot.locked.active{border-color:#94a3b8}.tgagg .color-lock{position:absolute;right:-1px;bottom:-1px;width:14px;height:14px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.95);font-size:9px;line-height:1;box-shadow:0 1px 2px rgba(15,23,42,.18)}
    .tgagg .user-form{display:grid;grid-template-columns:1fr 110px;gap:8px;margin-bottom:10px}.tgagg .user-form input,.tgagg .user-form select{min-width:0;border:1px solid #e5e7eb;border-radius:10px;padding:9px 10px;background:#fff;color:var(--text);outline:0}.tgagg .user-form .btn{grid-column:1/-1}.tgagg .user-form{min-width:0}.tgagg .user-form .team-password-row{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:8px;min-width:0}.tgagg .user-form .team-password-row input{flex:1 1 180px;min-width:0;width:auto}.tgagg .user-form .team-password-row .btn{grid-column:auto;flex:0 1 auto;white-space:normal}/* STAFF_BOOT_V1 */.tgagg .user-list{display:grid;gap:6px}.tgagg .user-row{display:grid;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;gap:10px;padding:9px 0;border-top:1px solid #e5e7eb}.tgagg .user-row:first-child{border-top:0}.tgagg .user-row .btn{min-height:32px;padding:0 10px;font-size:12px}.tgagg .user-avatar{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;overflow:hidden;background:linear-gradient(135deg,#7dd3fc,#2563eb);color:#fff;font-weight:900}.tgagg .user-avatar img{width:100%;height:100%;object-fit:cover;display:block}.tgagg .user-main{min-width:0}.tgagg .user-name-line{display:flex;align-items:center;gap:7px;min-width:0}.tgagg .user-name-line b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tgagg .role-badge{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:999px;font-size:11.5px;font-weight:900;white-space:nowrap}.tgagg .role-badge.admin{background:#dcfce7;color:#166534}.tgagg .role-badge.operator{background:#ffedd5;color:#9a3412}
    .tgagg .btn{border:0;border-radius:10px;min-height:38px;padding:0 12px;background:var(--blue);color:#fff;font-size:14px;font-weight:900}.tgagg .btn.secondary{background:#eef2f7;color:#334155}.tgagg .btn.danger{background:#fee2e2;color:#991b1b}.tgagg .btn.full{width:100%}
    .tgagg .delete-option{display:flex;align-items:flex-start;gap:9px;margin:14px 0;color:#334155;font-size:13px;font-weight:800;line-height:1.35}.tgagg .delete-option input{margin-top:2px}.tgagg .modal-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:14px}
    .tgagg .modal{position:fixed;left:50%;top:50%;width:min(420px,calc(100% - 28px));max-height:min(720px,calc(var(--app-height) - 28px));overflow:auto;transform:translate(-50%,-50%) scale(.98);opacity:0;pointer-events:none;z-index:120;background:#fff;border-radius:22px;box-shadow:0 18px 60px rgba(0,0,0,.22);transition:.16s}.tgagg .modal.open{opacity:1;pointer-events:auto;transform:translate(-50%,-50%) scale(1)}.tgagg .modal-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:16px 16px 10px}.tgagg .modal-title{font-size:18px;font-weight:900}.tgagg .modal-body{padding:0 16px 16px}.tgagg .field{margin:12px 0}.tgagg .field label{display:block;margin-bottom:6px;color:#475569;font-size:13px;font-weight:900}.tgagg .field input{width:100%;border:1px solid #e5e7eb;border-radius:12px;padding:11px 12px;outline:0;background:#fff;color:var(--text)}.tgagg .field input:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(51,144,236,.14)}.tgagg .helper{color:var(--muted);font-size:12.5px;line-height:1.38}.tgagg .error-text{color:#b91c1c;background:#fee2e2;border-radius:12px;padding:9px 10px;margin-top:10px;font-size:13px;display:none}.tgagg .error-text.show{display:block}.tgagg .success-box{text-align:center;padding:18px 6px 8px}.tgagg .success-icon{width:72px;height:72px;margin:0 auto 12px;border-radius:50%;display:grid;place-items:center;background:#dcfce7;color:#166534;font-size:34px;font-weight:900}.tgagg .profile-modal{width:min(380px,calc(100% - 28px));min-height:380px;max-height:min(620px,calc(var(--app-height) - 28px))}.tgagg .profile-head{display:grid;justify-items:center;gap:8px;padding-top:4px}.tgagg .profile-avatar{width:72px;height:72px;border-radius:50%;overflow:hidden;display:grid;place-items:center;background:linear-gradient(135deg,#7dd3fc,#2563eb);color:#fff;font-size:24px;font-weight:900}.tgagg .profile-avatar img{width:100%;height:100%;object-fit:cover;display:block}.tgagg .profile-name{font-size:17px;font-weight:900;text-align:center;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tgagg .profile-copy-list{display:grid;gap:8px;margin-top:12px}.tgagg .profile-copy-row{display:flex;align-items:center;justify-content:space-between;gap:8px;border:1px solid #e5e7eb;border-radius:12px;padding:8px 10px;background:#f8fafc}.tgagg .profile-copy-meta{min-width:0}.tgagg .profile-copy-label{font-size:11px;color:#64748b;font-weight:800;text-transform:uppercase;letter-spacing:.03em}.tgagg .profile-copy-value{font-size:13px;color:#111827;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:210px}.tgagg .copy-btn{min-height:30px;border:0;border-radius:10px;padding:0 10px;background:#e2e8f0;color:#334155;font-size:12px;font-weight:900}.tgagg .profile-note{margin-top:12px}.tgagg .profile-note textarea{width:100%;min-height:94px;border:1px solid #e5e7eb;border-radius:12px;padding:10px;outline:0;resize:vertical;font:inherit}.tgagg .profile-note textarea[readonly]{background:#f8fafc;color:#334155}.tgagg .profile-note-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}.tgagg .profile-verify{margin-top:12px;padding:10px;border-radius:12px;border:1px solid #dcfce7;background:#f0fdf4;display:flex;align-items:center;justify-content:space-between;gap:8px}.tgagg .profile-verify-label{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:900;color:#166534}.tgagg .profile-verify-label .check{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:#22c55e;color:#fff;font-size:12px}    .tgagg .profile-verify input{width:18px;height:18px}
    .tgagg .templates-sheet-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.28);opacity:0;pointer-events:none;transition:.18s;z-index:12}
    .tgagg .templates-sheet-backdrop.show{opacity:1;pointer-events:auto}
    .tgagg .templates-sheet{position:absolute;left:0;right:0;bottom:0;max-height:min(52vh,420px);background:#fff;border-radius:18px 18px 0 0;box-shadow:0 -10px 30px rgba(15,23,42,.18);transform:translateY(102%);transition:.22s;z-index:13;display:flex;flex-direction:column;padding-bottom:env(safe-area-inset-bottom)}
    .tgagg .templates-sheet.open{transform:translateY(0)}
    .tgagg .templates-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px 6px}
    .tgagg .templates-sheet-title{font-size:17px;font-weight:900}
    .tgagg .templates-sheet-sub{padding:0 16px 8px;color:var(--muted);font-size:12.5px}
    .tgagg .templates-sheet-list{flex:1;overflow-y:auto;padding:0 12px 12px;display:grid;gap:8px}
    .tgagg .chat-header{min-height:56px;gap:8px;padding:6px 12px}.tgagg .header-avatar{width:36px;height:36px;font-size:13px;flex:0 0 36px}.tgagg .header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.tgagg .header-info{min-width:0;flex:1}.tgagg .header-title{font-size:15px}.tgagg .header-subtitle{font-size:11.5px}    .tgagg .icon-action-btn{width:34px;height:34px;border:0;border-radius:50%;display:grid;place-items:center;background:#f1f5f9;color:#334155;font-size:16px;padding:0;flex:0 0 auto}.tgagg .icon-action-btn.primary{background:var(--blue);color:#fff}
    .tgagg .peer-accounts-anchor{position:relative;display:inline-flex;align-items:center;flex:0 0 auto}
    .tgagg .peer-accounts-indicator{width:34px;height:34px;border:0;border-radius:50%;display:grid;place-items:center;background:transparent;padding:0;cursor:pointer;flex:0 0 auto}
    .tgagg .peer-accounts-indicator[hidden]{display:none!important}
    .tgagg .peer-accounts-dot{width:12px;height:12px;border-radius:50%;background:#dc2626;box-shadow:0 0 0 4px rgba(220,38,38,.18);animation:tgaggPeerPulse 1.15s ease-in-out infinite}
    .tgagg .peer-accounts-indicator.is-open .peer-accounts-dot{animation:none;opacity:1;transform:scale(1.08)}
    .tgagg #chatAiBtn{position:relative}.tgagg #chatAiBtn.ai-away::after{content:"!";position:absolute;top:-3px;right:-3px;width:16px;height:16px;border-radius:50%;background:#dc2626;color:#fff;font:800 11px/16px system-ui,sans-serif;text-align:center;box-shadow:0 0 0 3px rgba(220,38,38,.22);animation:tgaggPeerPulse 1.15s ease-in-out infinite;pointer-events:none}
    @media (prefers-reduced-motion:reduce){.tgagg #chatAiBtn.ai-away::after{animation:none}}
    @keyframes tgaggPeerPulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.82)}}
    .tgagg .peer-accounts-popover{position:absolute;top:calc(100% + 8px);right:0;min-width:min(260px,calc(100vw - 24px));max-width:320px;padding:8px;border-radius:14px;background:#fff;border:1px solid #e5e7eb;box-shadow:0 14px 36px rgba(15,23,42,.18);z-index:40}
    .tgagg .peer-accounts-popover[hidden]{display:none!important}
    .tgagg .peer-accounts-popover-title{padding:4px 8px 8px;font-size:12px;font-weight:900;color:#64748b;text-transform:uppercase;letter-spacing:.03em}
    .tgagg .peer-accounts-item{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;border:0;border-radius:10px;background:#fff;padding:10px 10px;text-align:left;font:inherit;cursor:pointer}
    .tgagg .peer-accounts-item:hover,.tgagg .peer-accounts-item:focus-visible{background:#f8fafc;outline:0}
    .tgagg .peer-accounts-item.is-current{background:#eff6ff}
    .tgagg .peer-accounts-item-label{font-size:14px;font-weight:900;line-height:1.25}
    .tgagg .peer-accounts-item-meta{font-size:11.5px;color:#94a3b8;white-space:nowrap}
    .tgagg .composer{flex-direction:column;align-items:stretch}.tgagg .composer-row{display:flex;align-items:center;gap:10px;width:100%}.tgagg .composer-row:has(.composer-box-multiline){align-items:flex-end}.tgagg .composer-preview{display:flex;flex-wrap:wrap;gap:8px;padding:0 12px 8px;width:100%}.tgagg .composer-preview[hidden]{display:none!important}.tgagg .composer-preview-item{position:relative;width:72px;height:72px;border-radius:10px;overflow:hidden;background:#e5e7eb}.tgagg .composer-preview-item img{width:100%;height:100%;object-fit:cover}.tgagg .composer-preview-item.template-ref{display:flex;align-items:center;justify-content:center;padding:6px;font-size:11px;text-align:center;color:#334155}.tgagg .composer-preview-remove{position:absolute;top:2px;right:2px;width:22px;height:22px;border:0;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;font-size:14px;line-height:1}.tgagg .composer-preview-timer{position:absolute;right:4px;bottom:4px;width:20px;height:20px;border-radius:50%;background:rgba(15,23,42,.72);color:#fff;font-size:11px;line-height:20px;text-align:center;pointer-events:none;box-shadow:0 1px 4px rgba(0,0,0,.25)}.tgagg .composer-preview-voice{display:inline-flex;align-items:center;gap:8px;max-width:100%;padding:6px 10px 6px 6px;border-radius:999px;background:#e5e7eb}.tgagg .composer-preview-voice-play{width:32px;height:32px;border:0;border-radius:50%;background:#fff;color:#334155;font-size:12px;line-height:1;display:grid;place-items:center;cursor:pointer;box-shadow:0 1px 3px rgba(15,23,42,.12)}.tgagg .composer-preview-voice-label{font-size:13px;font-weight:700;color:#334155;white-space:nowrap}.tgagg .composer-preview-voice-duration{font-size:12px;color:#64748b;font-variant-numeric:tabular-nums;white-space:nowrap}.tgagg .composer-preview-voice .composer-preview-remove{position:static;width:22px;height:22px;flex:0 0 22px;margin-left:2px}.tgagg .composer-preview-voice audio{display:none}
    .tgagg .template-kind-toggle{display:flex;gap:8px;margin:8px 0}.tgagg .template-kind-toggle button{flex:1}.tgagg .template-photo-grid{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.tgagg .template-photo-thumb{width:64px;height:64px;border-radius:8px;object-fit:cover;background:#e5e7eb}.tgagg .global-template-title-input{width:100%;min-height:42px;border:1px solid #e5e7eb;border-radius:12px;padding:10px 12px;font-size:15px;margin-bottom:12px}
    .tgagg .chat-pane.global-templates-mode,.tgagg .chat-pane.broadcasts-mode{background:transparent}.tgagg .chat-pane.global-templates-mode .empty-state,.tgagg .chat-pane.global-templates-mode .chat-header,.tgagg .chat-pane.global-templates-mode .messages,.tgagg .chat-pane.global-templates-mode .composer,.tgagg .chat-pane.global-templates-mode .note-panel,.tgagg .chat-pane.global-templates-mode .templates-sheet,.tgagg .chat-pane.global-templates-mode .templates-sheet-backdrop,.tgagg .chat-pane.broadcasts-mode .empty-state,.tgagg .chat-pane.broadcasts-mode .chat-header,.tgagg .chat-pane.broadcasts-mode .messages,.tgagg .chat-pane.broadcasts-mode .composer,.tgagg .chat-pane.broadcasts-mode .note-panel,.tgagg .chat-pane.broadcasts-mode .templates-sheet,.tgagg .chat-pane.broadcasts-mode .templates-sheet-backdrop{display:none!important}
    .tgagg .btn-compact{padding:6px 10px;font-size:12px;border-radius:10px}
    .tgagg .account-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
    .tgagg .account-label-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
    .tgagg .account-label-edit{display:grid;gap:8px}
    .tgagg .account-label-input{width:100%;border:1px solid #e5e7eb;border-radius:10px;padding:8px 10px;font:inherit}
    .tgagg .account-label-edit-actions{display:flex;gap:8px;flex-wrap:wrap}
    .tgagg .client-badge.positive-offer{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#16a34a;color:#fff;font-size:12px;font-weight:900;line-height:1}
    .tgagg .client-badge.negative-offer{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#dc2626;color:#fff;font-size:12px;font-weight:900;line-height:1}
    .tgagg .dialog-head-meta .client-badge.negative-offer{min-width:14px;height:14px;padding:0 4px;font-size:10px;font-weight:800;border-radius:999px}
    .tgagg .profile-offer,.tgagg .profile-hide,.tgagg .profile-block{margin-top:14px;padding-top:14px;border-top:1px solid #eef2f7}
    .tgagg .profile-offer-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:8px}
    .tgagg .profile-offer-side{display:flex;align-items:center;gap:8px}
    .tgagg .profile-offer-side-positive{justify-content:flex-start}
    .tgagg .profile-offer-side-negative{justify-content:flex-end}
    .tgagg .dialog-head-meta .client-badge.positive-offer{order:1}
    .tgagg .dialog-head-meta .client-badge.negative-offer{order:2}
    .tgagg .dialog-head-meta .client-badge.verified{order:3}
    .tgagg .dialog-head-meta .dialog-read-status{order:4}
    .tgagg .dialog-head-meta .dialog-time{order:5}
    .tgagg .positive-offer-btn,.tgagg .negative-offer-btn{min-width:72px;color:#fff;font-weight:800}
    .tgagg .positive-offer-btn{background:#16a34a;border-color:#16a34a}
    .tgagg .negative-offer-btn{background:#dc2626;border-color:#dc2626}
    .tgagg .profile-offer-count{min-width:28px;height:28px;font-size:14px}
    .tgagg .offer-entry-list{display:grid;gap:10px;margin-top:12px;max-height:240px;overflow:auto}
    .tgagg .offer-entry-card{padding:12px 14px;border-radius:14px;border:1px solid rgba(15,23,42,.06)}
    .tgagg .offer-entry-card.offer-entry-positive{background:linear-gradient(135deg,#ecfdf5 0%,#d1fae5 100%)}
    .tgagg .offer-entry-card.offer-entry-negative{background:linear-gradient(135deg,#fef2f2 0%,#fee2e2 100%)}
    .tgagg .offer-entry-heading{font-size:13px;font-weight:900;text-transform:uppercase;letter-spacing:.03em;line-height:1.35}
    .tgagg .offer-entry-positive .offer-entry-heading{color:#15803d}
    .tgagg .offer-entry-negative .offer-entry-heading{color:#b91c1c}
    .tgagg .offer-entry-comment{margin-top:6px;font-size:13px;line-height:1.4;color:#334155;white-space:pre-wrap;word-break:break-word;font-style:italic}
    .tgagg .offer-entry-comment.is-empty{color:#94a3b8}
    .tgagg .offer-entry-author{margin-top:8px;font-size:12px;font-weight:700;color:#64748b}
    .tgagg .offer-field-label{display:block;margin:12px 0 6px;color:#475569;font-size:13px;font-weight:900}
    .tgagg .offer-field-label:first-child{margin-top:0}
    .tgagg .offer-field-input,.tgagg .offer-field-textarea{width:100%;border:1px solid #e5e7eb;border-radius:12px;padding:11px 12px;outline:0;background:#fff;color:var(--text);font:inherit;resize:vertical}
    .tgagg .offer-field-input:focus,.tgagg .offer-field-textarea:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(51,144,236,.14)}
    .tgagg .offer-entry-form-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:16px}
    .tgagg .offer-entry-form-modal.positive .modal-title{color:#15803d}
    .tgagg .offer-entry-form-modal.negative .modal-title{color:#b91c1c}
    .tgagg .offer-entry-form-modal.positive #saveOfferEntryBtn{background:#16a34a;border-color:#16a34a}
    .tgagg .offer-entry-empty{font-size:13px;color:#94a3b8;padding:4px 2px}
    .tgagg .profile-block-actions{display:grid;gap:8px;margin-top:8px}
    .tgagg .profile-block-delete{margin-top:10px}
    .tgagg .profile-hide-hint{margin-top:8px}
    .tgagg .profile-offer-badge{margin-left:6px;vertical-align:middle}
    .tgagg .drawer-notify{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 16px 12px;padding:12px 14px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc;cursor:pointer;user-select:none}
    .tgagg .drawer-notify-label{font-size:15px;font-weight:600;color:var(--text)}
    .tgagg .drawer-notify input{width:18px;height:18px;cursor:pointer;flex:0 0 auto}
    @media(min-width:861px){.tgagg .app{grid-template-columns:min(420px,34vw) minmax(0,1fr)}}
    @media(max-width:860px){.tgagg .app{display:block;overflow:hidden;background:var(--side)}.tgagg .sidebar{position:fixed;inset:0;width:100%;height:var(--app-height);min-height:0;overflow:hidden;transform:translateX(0);transition:.22s;box-shadow:none;border-right:0;z-index:30}.tgagg .app.chat-open .sidebar{transform:translateX(-102%)}.tgagg .chat-pane{position:fixed;inset:0;width:100%;height:var(--app-height);min-height:0;overflow:hidden;z-index:20}.tgagg .app:not(.chat-open) .chat-pane,.tgagg .chat-pane.empty{display:none}.tgagg .topbar{padding-top:calc(8px + env(safe-area-inset-top))}.tgagg .dialog-list{padding-bottom:calc(16px + env(safe-area-inset-bottom))}.tgagg .dialog-card{grid-template-columns:40px minmax(0,1fr);margin:4px 8px;padding:7px 9px;border-radius:12px}.tgagg .avatar{width:40px;height:40px;font-size:14px}.tgagg .back-btn{display:grid}.tgagg .chat-header{min-height:calc(58px + env(safe-area-inset-top));padding:calc(8px + env(safe-area-inset-top)) 10px 8px}.tgagg .header-actions .mini-btn:not(.primary):not(.header-visible){display:none}.tgagg .messages{padding:14px 10px 10px}.tgagg .message{max-width:88%;font-size:14.5px}.tgagg .quick-replies{padding:7px 10px 0}.tgagg .note-panel{margin:0 10px 8px}.tgagg .composer{padding:8px 8px calc(10px + env(safe-area-inset-bottom));gap:8px}.tgagg .composer-box{min-height:46px;border-radius:17px;padding-left:8px}.tgagg .send-btn{width:46px;height:46px}}
    .tgagg .qr-box{display:grid;justify-items:center;gap:12px;margin:14px 0 8px;padding:14px;border-radius:16px;background:#f8fafc;border:1px solid #e5e7eb}.tgagg .qr-box img{width:260px;max-width:100%;height:auto;border-radius:12px;background:#fff}

.tgagg .message-wrap{display:flex;flex-direction:column;align-items:stretch;width:fit-content;cursor:default}.tgagg .message-wrap{-webkit-touch-callout:none;touch-action:manipulation;user-select:none}
.tgagg .message-wrap audio,.tgagg .message-wrap video,.tgagg .message-wrap a{pointer-events:auto;touch-action:auto;-webkit-user-select:auto;user-select:auto}
/* TEXT_SELECT_V1: the text of a message can be selected by a piece (everywhere except a touch phone/tablet - the same test as isCoarsePointer() in app.js; on a phone after "Выделить текст" in the menu).
   Time, name, reactions, buttons, media and quotes stay unselectable. Not while messages are being chosen for forwarding or deleting. */
@media not all and (hover:none) and (pointer:coarse){.tgagg .message-wrap .message{-webkit-user-select:text;user-select:text;cursor:auto}}
.tgagg .message-wrap.text-pick .message{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
.tgagg .message-wrap .message .message-head,.tgagg .message-wrap .message .message-time,.tgagg .message-wrap .message .media-time-row,.tgagg .message-wrap .message .message-reactions,.tgagg .message-wrap .message .reply-quote,.tgagg .message-wrap .message .message-forward,.tgagg .message-wrap .message button,.tgagg .message-wrap .message [class*="media-"]:not(.media-caption),.tgagg .message-wrap .message img,.tgagg .message-wrap .message video,.tgagg .message-wrap .message canvas{-webkit-user-select:none;user-select:none}
.tgagg .chat-pane.message-selecting .message-wrap .message{-webkit-user-select:none!important;user-select:none!important;cursor:default!important}
/* PEER_STATUS_V1: "в сети" / "был(а) в сети в 14:32" in front of the line under the name of a private Telegram chat. The line keeps its own look: the box only puts the mark beside it. */
.tgagg .header-subline{display:flex;align-items:baseline;min-width:0;margin-top:2px}
.tgagg .header-subline .header-subtitle{margin-top:0;min-width:0}
.tgagg .header-presence{flex:0 0 auto;max-width:100%;white-space:nowrap}
.tgagg .header-presence:not([hidden])::after{content:"\00a0·\00a0";font-weight:400}
.tgagg .header-subline .header-presence.is-online{color:#16a34a;font-weight:600}
.tgagg.theme-dark .header-subline .header-presence.is-online{color:#4ade80}
/* PWA_PULL_REFRESH_V1: the round mark that follows the finger when the chat list is pulled down in the installed app */
.tgagg .ptr{position:fixed;left:50%;top:calc(env(safe-area-inset-top,0px) + 64px);width:38px;height:38px;margin-left:-19px;border-radius:50%;background:var(--surface);color:var(--blue);box-shadow:var(--shadow);display:grid;place-items:center;opacity:0;pointer-events:none;z-index:80;transform:translateY(-70px);will-change:transform,opacity}
.tgagg .ptr svg{width:20px;height:20px}
.tgagg .ptr.spin svg{animation:ptr-spin .8s linear infinite}
@keyframes ptr-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.tgagg .ptr.spin svg{animation:none}}
.tgagg .message a,.tgagg .channel-caption a,.tgagg .reply-quote a,.tgagg .reply-preview-bar a,.tgagg .favorite-forward-preview-source a,.tgagg .favorite-composer-caption a{color:#2481cc;cursor:pointer;text-decoration:underline;overflow-wrap:anywhere}
.tgagg .media-audio-block{pointer-events:auto}
/* VOICE_GLASS_V1 */
.tgagg .media-voice-player{display:flex;align-items:center;gap:10px;min-width:220px;max-width:min(300px,100%);padding:8px 10px 8px 8px;border-radius:20px;background:rgba(255,255,255,.42);border:1px solid rgba(255,255,255,.62);box-shadow:0 8px 24px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.75);backdrop-filter:blur(16px) saturate(1.45);-webkit-backdrop-filter:blur(16px) saturate(1.45);pointer-events:auto;color:#2481cc}
.tgagg .message.out .media-voice-player{background:rgba(255,255,255,.5)}
.tgagg .media-voice-play{position:relative;width:42px;height:42px;border:0;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.62);color:#2481cc;cursor:pointer;flex:0 0 42px;box-shadow:inset 0 1px 0 rgba(255,255,255,.9), 0 6px 16px rgba(36,129,204,.16);backdrop-filter:blur(10px)}
.tgagg .media-voice-icon{width:18px;height:18px;display:block}
.tgagg .media-voice-icon path{fill:currentColor;transition:opacity .18s ease}
.tgagg .media-voice-icon .icon-pause{opacity:0}
.tgagg .media-voice-player.playing .icon-play{opacity:0}
.tgagg .media-voice-player.playing .icon-pause{opacity:1}
.tgagg .media-voice-ring{position:absolute;inset:-3px;border-radius:50%;border:2px solid transparent;border-top-color:currentColor;opacity:0;pointer-events:none}
.tgagg .media-voice-player.is-loading .media-voice-ring{opacity:1;animation:tgagg-spin .7s linear infinite}
.tgagg .media-voice-player.is-error .media-voice-ring{opacity:1;border-top-color:#ef4444;animation:none}
.tgagg .media-voice-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.tgagg .media-voice-wave{position:relative;height:28px;cursor:pointer;touch-action:none}
.tgagg .media-voice-wave-rest,.tgagg .media-voice-wave-played{position:absolute;inset:0;display:flex;align-items:center;gap:2px}
.tgagg .media-voice-wave i{flex:1 1 0;min-width:2px;border-radius:99px;background:currentColor;align-self:center}
.tgagg .media-voice-wave-rest i{opacity:.32}
.tgagg .media-voice-wave-played{clip-path:inset(0 var(--rest,100%) 0 0)}
.tgagg .media-voice-wave-played i{opacity:1}
.tgagg .media-voice-meta{display:flex;align-items:center;justify-content:space-between;gap:8px}
.tgagg .media-voice-time{font-size:12px;font-weight:700;color:#475569;font-variant-numeric:tabular-nums;white-space:nowrap}
.tgagg .media-voice-speed{border:0;border-radius:999px;padding:3px 8px;background:rgba(255,255,255,.72);color:var(--blue);font-size:12px;font-weight:900;line-height:1;cursor:pointer;white-space:nowrap}
.tgagg .media-voice-speed:hover{background:#fff}
.tgagg .media-voice-audio{display:none!important}
.tgagg .message.message-media .media-voice-player{margin:2px 0}
.tgagg .media-frame{position:relative;display:block;overflow:hidden;border-radius:12px;background:rgba(0,0,0,.06);min-height:72px}
.tgagg .media-frame .media-photo,.tgagg .media-frame .media-album-photo,.tgagg .media-frame .media-sticker,.tgagg .media-frame .media-gif,.tgagg .media-frame .media-video,.tgagg .media-frame .media-video-poster{position:absolute;inset:0;width:100%;height:100%;max-width:none;max-height:none;min-height:0;object-fit:cover;border-radius:0}
.tgagg .media-video-player{display:block;max-width:min(280px,100%);cursor:pointer;position:relative}
.tgagg .media-video-player .media-video-frame{background:#0f172a}
.tgagg .media-video-player .media-video{opacity:0;pointer-events:none;background:#000}
.tgagg .media-video-player.is-playing .media-video{opacity:1;pointer-events:auto}
.tgagg .media-video-player.is-playing .media-video-poster,.tgagg .media-video-player.is-playing .media-video-play,.tgagg .media-video-player.is-playing .media-video-duration{display:none}
.tgagg .media-video-play{position:absolute;left:0;top:0;right:0;bottom:0;margin:auto;z-index:4;width:56px;height:56px;border:0;border-radius:50%;background:rgba(15,23,42,.55);color:#fff;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;box-shadow:inset 0 0 0 1px rgba(255,255,255,.18);transform:none}
.tgagg .media-video-play::before{content:"";display:block;width:0;height:0;border-top:11px solid transparent;border-bottom:11px solid transparent;border-left:18px solid #fff;margin:0 0 0 4px}
.tgagg .media-video-duration{position:absolute;right:8px;bottom:8px;z-index:3;padding:2px 6px;border-radius:999px;background:rgba(15,23,42,.62);color:#fff;font-size:12px;font-weight:700;line-height:1.2;font-variant-numeric:tabular-nums;pointer-events:none}
.tgagg .media-video-player{pointer-events:auto}
.tgagg .media-video-play{pointer-events:none}
.tgagg .media-video-player.is-loading .media-video-play::before{width:22px;height:22px;margin:0;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:tgagg-spin .7s linear infinite}
.tgagg .media-video-player.is-failed .media-video-play{background:#7f1d1d}
.tgagg .media-album-grid{width:min(340px,100%);max-width:min(340px,100%);gap:2px}
.tgagg .media-album-grid > .media-album-item{position:relative;height:100%;min-height:0;padding:0;border:0}
.tgagg .media-album-grid .media-album-photo,.tgagg .media-album-grid .media-gif,.tgagg .media-album-grid .media-video,.tgagg .media-album-grid .media-video-poster{position:absolute;inset:0;width:100%;height:100%;max-width:none;max-height:none;min-height:0;object-fit:cover}
.tgagg .media-album-grid > .media-video-player{display:block;width:100%;height:100%;max-width:none}
.tgagg .media-album-grid .media-video-frame,.tgagg .media-album-grid .media-album-frame{width:100%!important;height:100%!important;min-height:0;aspect-ratio:auto!important;border-radius:0}
.tgagg .media-album-grid .media-video-play{width:42px;height:42px}
.tgagg .media-album-grid .media-video-play::before{border-top-width:8px;border-bottom-width:8px;border-left-width:13px}
.tgagg .media-album-grid .media-video-player.is-loading .media-video-play::before{width:18px;height:18px;margin:0;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:tgagg-spin .7s linear infinite}
.tgagg .media-album-grid[data-count="2"]{grid-template-columns:1fr 1fr;height:168px}
.tgagg .media-album-grid[data-count="3"]{grid-template-columns:1.35fr 1fr;grid-template-rows:1fr 1fr;height:220px}
.tgagg .media-album-grid[data-count="3"] > .media-album-item:first-child{grid-row:1 / span 2}
.tgagg .media-album-grid[data-count="4"]{grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;height:220px}
.tgagg .media-album-grid[data-count="5"]{grid-template-columns:repeat(6,1fr);grid-template-rows:1.15fr 1fr;height:248px}
.tgagg .media-album-grid[data-count="5"] > .media-album-item:nth-child(-n+2){grid-column:span 3}
.tgagg .media-album-grid[data-count="5"] > .media-album-item:nth-child(n+3){grid-column:span 2}
.tgagg .media-album-grid[data-count="6"]{grid-template-columns:repeat(3,1fr);grid-template-rows:1fr 1fr;height:220px}
.tgagg .media-album-grid[data-count="7"]{grid-template-columns:repeat(6,1fr);grid-template-rows:1.05fr 1fr 1fr;height:286px}
.tgagg .media-album-grid[data-count="7"] > .media-album-item:nth-child(-n+2){grid-column:span 3}
.tgagg .media-album-grid[data-count="7"] > .media-album-item:nth-child(n+3):nth-child(-n+5){grid-column:span 2}
.tgagg .media-album-grid[data-count="7"] > .media-album-item:nth-child(n+6){grid-column:span 3}
.tgagg .media-album-grid[data-count="8"]{grid-template-columns:repeat(6,1fr);grid-template-rows:1.1fr 1fr 1fr;height:300px}
.tgagg .media-album-grid[data-count="8"] > .media-album-item:nth-child(-n+2){grid-column:span 3}
.tgagg .media-album-grid[data-count="8"] > .media-album-item:nth-child(n+3){grid-column:span 2}
.tgagg .media-album-grid[data-count="9"]{grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);height:312px}
.tgagg .media-album-grid[data-count="10"]{grid-template-columns:repeat(12,1fr);grid-template-rows:1.15fr 1fr 1fr;height:330px}
.tgagg .media-album-grid[data-count="10"] > .media-album-item:nth-child(-n+2){grid-column:span 6}
.tgagg .media-album-grid[data-count="10"] > .media-album-item:nth-child(n+3){grid-column:span 3}
.tgagg .media-album-item .media-frame{width:100%;height:100%;min-height:72px;border-radius:0}
.tgagg .media-sticker-frame .media-sticker{object-fit:contain;background:transparent}
.tgagg .message.message-sticker{background:transparent;box-shadow:none;padding:0}
/* BIGEMOJI_V1: 1-3 emoji alone in a message, big and without a bubble, premium ones play */
.tgagg .message.message-bigemoji,.tgagg.theme-dark .message.in.message-bigemoji,.tgagg.theme-dark .message.out.message-bigemoji{background:transparent!important;border:0!important;box-shadow:none!important;padding:0 2px 2px;max-width:none;--bigemoji-size:64px}
.tgagg .message.message-bigemoji-1{--bigemoji-size:84px}
.tgagg .message.message-bigemoji-2{--bigemoji-size:66px}
.tgagg .message.message-bigemoji-3{--bigemoji-size:54px}
.tgagg .message.message-bigemoji .message-head,.tgagg .message.message-bigemoji .message-forward{display:none}
.tgagg .message.message-bigemoji .bigemoji-text{font-size:var(--bigemoji-size);line-height:1.1;letter-spacing:.04em;white-space:normal;min-width:0}
.tgagg .message.message-bigemoji .bigemoji-text .message-premium-emoji{background:none;box-shadow:none;padding:0;overflow:visible;vertical-align:-0.18em}
.tgagg .message.message-bigemoji .media-time-row{margin-top:0}
.tgagg .message.message-bigemoji .message-time{float:none;margin:0;padding:2px 7px;border-radius:999px;background:rgba(15,23,42,.42);color:#fff;font-size:11.5px;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
.tgagg .message.message-bigemoji .message-time svg{color:inherit}
.tgagg .media-sticker-block{display:block;width:180px;max-width:min(180px,70vw);background:transparent}
.tgagg .media-sticker-block .media-sticker,.tgagg .media-sticker-anim{display:block;width:180px;height:180px;max-width:100%;object-fit:contain;background:transparent}
.tgagg .media-sticker-anim svg{width:100%;height:100%;display:block}
.tgagg .media-video-note-frame{border-radius:50%;width:190px!important;height:190px!important;max-width:190px;aspect-ratio:1/1!important;min-height:190px;touch-action:none;cursor:pointer}
.tgagg .media-video-note-frame .media-video-note{border-radius:50%;object-fit:cover;background:#000}
.tgagg .media-video-note-player{--vn-ring-width:4px;width:190px;max-width:190px;position:relative}
.tgagg .media-video-note-player .media-video-note-frame .media-video-note{position:absolute;inset:0;width:100%;height:100%;max-width:none;max-height:none;min-height:0}
.tgagg .media-video-note-ring{position:absolute;inset:-4px;display:block;pointer-events:none;z-index:2;border-radius:50%}
.tgagg .media-video-note-ring-track,.tgagg .media-video-note-ring-progress{position:absolute;inset:0;display:block;border-radius:50%}
.tgagg .media-video-note-ring-track{border:var(--vn-ring-width) solid rgba(255,255,255,.24)}
.tgagg .media-video-note-ring-progress{--vn-progress-angle:0deg;background:conic-gradient(from 0deg,#fff 0deg var(--vn-progress-angle),transparent var(--vn-progress-angle) 360deg);-webkit-mask:radial-gradient(farthest-side,transparent calc(100% - var(--vn-ring-width)),#000 calc(100% - var(--vn-ring-width)));mask:radial-gradient(farthest-side,transparent calc(100% - var(--vn-ring-width)),#000 calc(100% - var(--vn-ring-width)));opacity:0}
.tgagg .media-video-note-player.has-ring-progress .media-video-note-ring-progress,.tgagg .media-video-note-player.scrubbing .media-video-note-ring-progress{opacity:1}
.tgagg .media-video-note-player.scrub-armed,.tgagg .media-video-note-player.scrubbing{--vn-ring-width:6.5px}
.tgagg .media-video-note-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:3;width:56px;height:56px;border:0;border-radius:50%;background:rgba(20,20,20,.48);color:#fff;cursor:pointer;display:grid;place-items:center;padding:0;box-shadow:inset 0 0 0 1px rgba(255,255,255,.12)}
.tgagg .media-video-note-play::before{content:"";display:block;width:0;height:0;border-top:11px solid transparent;border-bottom:11px solid transparent;border-left:18px solid #fff;margin-left:5px}
.tgagg .media-video-note-player.playing .media-video-note-play::before{width:16px;height:18px;margin-left:0;border:0;background:linear-gradient(to right,#fff 0,#fff 36%,transparent 36%,transparent 64%,#fff 64%,#fff 100%)}
.tgagg .media-video-note-player.playing:not(.scrubbing):not(:hover) .media-video-note-play{opacity:0;pointer-events:none}
.tgagg .media-video-note-player.playing:not(.scrubbing):hover .media-video-note-play,.tgagg .media-video-note-player.paused .media-video-note-play,.tgagg .media-video-note-player.scrubbing .media-video-note-play{opacity:1;pointer-events:auto}
.tgagg .media-video-note-timer{position:absolute;left:50%;bottom:12px;z-index:3;transform:translateX(-50%);min-width:62px;padding:3px 7px;border-radius:999px;background:rgba(15,23,42,.56);color:#fff;font-size:11px;font-weight:700;line-height:1.2;text-align:center;font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;text-shadow:0 1px 2px rgba(0,0,0,.35)}
.tgagg .favorite-composer-preview .media-video-note-player{width:120px;max-width:120px}
.tgagg .favorite-composer-preview .media-video-note-frame{width:120px!important;height:120px!important;max-width:120px;min-height:120px}
.tgagg .favorite-composer-preview .media-video-note-play{width:44px;height:44px}
.tgagg .favorite-composer-preview .media-video-note-play::before{border-top-width:9px;border-bottom-width:9px;border-left-width:14px}
.tgagg .favorite-composer-preview .media-video-note-timer{bottom:8px;font-size:10px;padding:2px 6px}
.tgagg .media-frame:not(.media-loaded):not(.media-error)::after{content:"";position:absolute;inset:0;background:linear-gradient(110deg,rgba(255,255,255,0) 30%,rgba(255,255,255,.28) 50%,rgba(255,255,255,0) 70%);background-size:200% 100%;animation:tgagg-media-shimmer 1.2s linear 10;pointer-events:none}
.tgagg .media-frame.media-loaded::after{display:none}
.tgagg .message.message-media .media-file{display:flex;align-items:center;gap:9px;max-width:min(280px,100%);padding:10px 11px;border-radius:12px;background:rgba(255,255,255,.92);color:#1e3a5f;text-decoration:none;font-weight:800;box-shadow:0 1px 2px rgba(15,23,42,.08)}
.tgagg .message.message-media .media-file-icon{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:rgba(51,144,236,.12);color:#1d4ed8;flex:0 0 auto;font-size:11px;text-transform:lowercase}
.tgagg .message.message-media .media-file-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tgagg .message.message-media .media-note{min-height:52px;display:flex;align-items:center;padding:10px 12px;border-radius:12px;background:rgba(255,255,255,.86);color:#64748b;font-size:13px}
.tgagg .link-preview{display:flex;flex-direction:column;gap:2px;margin:4px 0 0;padding:8px 10px;border-radius:10px;background:rgba(255,255,255,.94);color:#1e3a5f;text-decoration:none}
.tgagg .message.message-media .link-preview{margin:4px}
.tgagg .link-preview-site{font-size:11px;font-weight:700;color:#64748b}
.tgagg .link-preview-title{font-size:14px;font-weight:800}
.tgagg .link-preview-text{font-size:12px;line-height:1.35;color:#334155;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.tgagg .message.message-media:not(.message-post) .media-caption{box-shadow:0 1px 1px rgba(0,0,0,.08);white-space:pre-wrap;word-break:break-word}
.tgagg .message.message-media .reply-quote{margin:0 0 4px}
.tgagg .message.message-media .media-file{min-height:54px;box-sizing:border-box}
.tgagg .media-file{min-height:54px;box-sizing:border-box}
.tgagg .messages-load-indicator{align-self:center;display:grid;place-items:center;padding:6px 0 10px;min-height:40px}
.tgagg .messages-load-spinner{width:28px;height:28px;border:3px solid rgba(51,144,236,.18);border-top-color:var(--blue);border-radius:50%;animation:tgagg-spin .8s linear infinite}
.tgagg .media-glass{position:relative;display:grid;place-items:center;width:100%;height:100%;min-height:72px;border-radius:12px;background:linear-gradient(135deg,rgba(148,163,184,.22),rgba(148,163,184,.08));overflow:hidden}
.tgagg .media-glass-inner{position:relative;z-index:1;display:grid;place-items:center;gap:6px;color:var(--muted)}
.tgagg .media-glass-label{font-size:11.5px;font-weight:700}
.tgagg .media-glass-spinner{width:20px;height:20px;border-width:2px}
.tgagg .media-photo-open{border:0;padding:0;background:transparent;cursor:zoom-in;text-align:inherit;font:inherit;color:inherit}
.tgagg .media-album-item.media-photo-open{display:block;width:100%}
.tgagg .photo-lightbox,
.photo-lightbox{position:fixed;inset:0;z-index:6000;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100vw;height:100vh;height:100dvh;height:var(--app-height,100dvh);max-width:100vw;max-height:100vh;max-height:100dvh;max-height:var(--app-height,100dvh);padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow:hidden;background:rgba(0,0,0,.92);backdrop-filter:blur(4px)}
.tgagg .photo-lightbox[hidden],
.photo-lightbox[hidden]{display:none!important}
.tgagg .photo-lightbox-img,
.photo-lightbox-img{display:block;box-sizing:border-box;width:auto;height:auto;max-width:100%;max-height:100%;max-width:min(100%,calc(100vw - 32px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)));max-height:min(100%,calc(100vh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));max-height:min(100%,calc(100dvh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));max-height:min(100%,calc(var(--app-height,100dvh) - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));object-fit:contain;object-position:center;flex:0 1 auto;min-width:0;min-height:0;user-select:none;-webkit-user-drag:none}
.tgagg .photo-lightbox-close,
.photo-lightbox-close{position:absolute;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));width:42px;height:42px;border:0;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;font-size:22px;line-height:1;cursor:pointer;z-index:1}
body.photo-lightbox-open{overflow:hidden}
@keyframes tgagg-spin{to{transform:rotate(360deg)}}
@keyframes tgagg-media-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
.tgagg .message-wrap.in{align-self:flex-start;margin-right:auto;margin-left:0}
.tgagg .message-wrap.out{align-self:flex-end;margin-left:auto;margin-right:0}
.tgagg .message-wrap > .message.in,.tgagg .message-wrap > .message.out{align-self:auto}
.tgagg .message-wrap.menu-open .message{box-shadow:0 0 0 2px rgba(51,144,236,.35)}
.tgagg .message-wrap .message{max-width:100%}.tgagg .message{position:relative}
.tgagg .reply-quote{display:grid;gap:1px;margin:1px 0 5px;padding:4px 7px;border-left:3px solid #38bdf8;border-radius:8px;background:rgba(14,165,233,.12);font-size:12.5px;line-height:1.25;color:#334155;overflow:hidden}
.tgagg .reply-quote b{color:#0284c7;font-size:12px}
.tgagg .reply-quote span{display:block;max-width:260px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tgagg .composer-reply[hidden],.tgagg .composer-edit[hidden]{display:none!important}
.tgagg .composer-reply,.tgagg .composer-edit{padding:0 54px 0 8px}
.tgagg .reply-preview-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 10px;border-radius:13px;background:rgba(255,255,255,.78);box-shadow:0 1px 4px rgba(15,23,42,.08);border-left:3px solid #38bdf8;color:#334155}
.tgagg .edit-preview-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 10px;border-radius:13px;background:rgba(255,255,255,.78);box-shadow:0 1px 4px rgba(15,23,42,.08);border-left:3px solid #f59e0b;color:#334155}
.tgagg .edit-preview-bar b{font-size:12px;color:#d97706}
.tgagg .reply-preview-bar div{min-width:0;display:grid;gap:1px}
.tgagg .reply-preview-bar b{font-size:12px;color:#0284c7}
.tgagg .reply-preview-bar span{font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tgagg .reply-preview-bar button,.tgagg .edit-preview-bar button{width:24px;height:24px;border:0;border-radius:50%;background:#e5e7eb;color:#475569;font-size:18px;line-height:1;cursor:pointer}
.tgagg .composer.composer-editing .attach-btn-hidden,.tgagg .composer.composer-editing #attachBtn,.tgagg .composer.composer-editing #voiceBtn{display:none}
.tgagg .message-edited-label{margin-right:2px;color:#6b7280;font-size:10.5px;font-weight:700}
.tgagg .message-read-status{display:inline-flex;align-items:center;flex:0 0 auto;line-height:1;vertical-align:middle}
.tgagg .message-read-status svg{display:block;overflow:visible}
.tgagg .message-read-status.sent{color:#9ca3af}
.tgagg .message-read-status.read{color:var(--blue)}
.tgagg .message-read-status.failed{color:#e5484d}
.tgagg .message-send-actions{display:flex;gap:14px;margin-top:4px}
.tgagg .message-send-actions button{padding:0;border:0;background:none;font:inherit;font-size:12.5px;font-weight:650;color:var(--blue);cursor:pointer}
.tgagg .message-send-actions button:last-child{color:#e5484d}
.tgagg .message-time .message-read-status{margin-right:3px}
.tgagg .message-context-menu,#messageContextMenu.message-context-menu{position:fixed;z-index:10000;min-width:148px;padding:6px;border-radius:12px;background:#fff;box-shadow:0 12px 34px rgba(15,23,42,.2);border:1px solid rgba(148,163,184,.28);animation:tgaggMenuIn .12s ease-out}
@keyframes tgaggMenuIn{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}}
.tgagg .message-context-menu button,#messageContextMenu.message-context-menu button{width:100%;border:0;background:transparent;border-radius:9px;padding:9px 12px;text-align:left;color:#1f2937;font-size:14px;font-weight:800;cursor:pointer;white-space:nowrap}
.tgagg .message-context-menu button:hover,.tgagg .message-context-menu button:focus-visible,#messageContextMenu.message-context-menu button:hover,#messageContextMenu.message-context-menu button:focus-visible{background:#f1f5f9;outline:none}
.tgagg .message-context-menu button.danger,#messageContextMenu.message-context-menu button.danger{color:#dc2626}
.tgagg .dialog-card.menu-open{background:#eef2ff}
.tgagg .favorites-chip{min-width:38px;justify-content:center;padding-inline:11px;background:#fff7d6;color:#b7791f;font-size:20px;line-height:1;border:1px solid #f4d06f}
.tgagg .favorites-chip.active{background:#f4b942;color:#fff;box-shadow:0 0 0 2px rgba(180,120,20,.22)}
.tgagg .favorites-tab{min-width:38px;justify-content:center;padding-inline:11px;background:#fff7d6;color:#b7791f;font-size:20px;line-height:1;border:1px solid #f4d06f}
.tgagg .favorites-tab.active{background:#f4b942;color:#fff;box-shadow:0 0 0 2px rgba(180,120,20,.22)}
.tgagg .favorite-card{--account-accent:#f4b942}
.tgagg .favorite-avatar{display:flex;align-items:center;justify-content:center;color:#fff;font-size:20px}
.tgagg .favorites-empty{padding:24px 16px;color:#707579;text-align:center}
.tgagg .favorites-error{color:#c0392b}
.tgagg .messages > .favorite-message-row{display:flex;width:100%;max-width:100%;align-self:stretch}
.tgagg .messages > .favorite-message-row.in{justify-content:flex-start}
.tgagg .messages > .favorite-message-row.out{justify-content:flex-end}
.tgagg .favorite-message-stack{display:flex;flex-direction:column;align-items:center;gap:4px;width:max-content;max-width:min(590px,86%)}
.tgagg .favorite-message-stack > .message-wrap{margin-left:0!important;margin-right:0!important;align-self:center!important;width:max-content;max-width:100%}
.tgagg .favorite-forward-btn{align-self:center;border:0;border-radius:8px;padding:5px 9px;background:#fff7d6;color:#96651c;cursor:pointer;font-size:12px}
.tgagg .favorite-forward-btn:hover{background:#f4d06f}
.tgagg .chat-pane.favorites-mode .chat-header{display:flex}
.tgagg .chat-pane.favorites-mode .composer,
.tgagg .chat-pane.favorites-mode .note-panel,
.tgagg .chat-pane.favorites-mode .empty-state,
.tgagg .chat-pane.favorites-mode .quick-replies{display:none!important}
.tgagg .favorite-forward-picker{position:fixed;inset:0;z-index:12000;background:rgba(15,23,42,.42);display:flex;align-items:center;justify-content:center;padding:18px}
.tgagg .favorite-forward-picker-panel{width:min(620px,100%);max-height:min(86vh,760px);display:flex;flex-direction:column;background:#f8fafc;border-radius:16px;box-shadow:0 20px 60px rgba(15,23,42,.3);overflow:hidden}
.tgagg .favorite-forward-picker-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px;background:#fff;border-bottom:1px solid #e5e7eb}
.tgagg .favorite-forward-picker-title{font-size:18px;font-weight:800;color:#111827}
.tgagg .favorite-forward-picker-subtitle{margin-top:3px;color:#6b7280;font-size:13px}
.tgagg .favorite-forward-picker-body{overflow:auto;padding:10px 4px 14px}
.tgagg .favorite-forward-picker-footer{display:flex;justify-content:flex-end;padding:10px 12px;background:#fff;border-top:1px solid #e5e7eb}
.tgagg .favorite-forward-preview{padding:18px;background:#fff;border:1px solid #e5e7eb;border-radius:12px;margin:4px 8px 12px}
.tgagg .favorite-forward-preview-label{font-weight:800;color:#111827}
.tgagg .favorite-forward-preview-source{margin-top:12px;padding:10px;border-radius:9px;background:#f1f5f9;color:#334155;white-space:pre-wrap;overflow-wrap:anywhere}
.tgagg .favorite-forward-preview-target{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px;color:#334155}
.tgagg .favorite-forward-preview-target span{color:#64748b}
.tgagg .favorite-forward-preview-note{margin-top:12px;color:#64748b;font-size:12px}
.tgagg .favorite-forward-actions{display:flex;justify-content:flex-end;gap:8px;padding:0 8px 8px}
.tgagg .favorite-composer-preview{position:relative;display:flex;align-items:center;gap:10px;max-width:100%;padding:7px 34px 7px 8px;border:1px solid #dbe3ec;border-radius:10px;background:#f8fafc}
.tgagg .favorite-composer-image,.tgagg .favorite-composer-video{width:74px;height:54px;object-fit:cover;border-radius:7px}
.tgagg .favorite-composer-audio{max-width:220px}
.tgagg .favorite-composer-media{padding:10px 12px;border-radius:7px;background:#e8eef5;color:#475569;font-size:12px}
.tgagg .favorite-composer-caption{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#334155;font-size:13px}
@media(max-width:860px){.tgagg .app.favorites-mode:not(.favorite-chat-open) .sidebar{transform:translateX(0)}}
.tgagg .dialog-delete-confirm-overlay{position:fixed;inset:0;z-index:10050;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(15,23,42,.42)}
.tgagg .dialog-delete-confirm-card{width:min(420px,100%);background:#fff;border-radius:16px;padding:18px 18px 14px;box-shadow:0 18px 50px rgba(15,23,42,.28);border:1px solid #e5e7eb}
.tgagg .dialog-delete-confirm-title{font-size:17px;font-weight:900;color:#0f172a;margin-bottom:8px}
.tgagg .dialog-delete-confirm-text{font-size:13.5px;line-height:1.45;color:#64748b;margin-bottom:12px}
.tgagg .dialog-delete-confirm-check{display:flex;align-items:center;gap:8px;margin:0 0 14px;font-size:13.5px;font-weight:700;color:#334155}
.tgagg .dialog-delete-confirm-actions{display:flex;justify-content:flex-end;gap:8px}
.tgagg .billing-renew-row{display:flex;align-items:center;gap:10px;margin:10px 0}
.tgagg .billing-renew-label{font-weight:700}
.tgagg button.billing-switch{position:relative;width:72px;height:30px;min-height:30px;flex:0 0 72px;padding:0;border:0;border-radius:999px;background:#ef4444;color:#fff;cursor:pointer;box-shadow:none}
.tgagg button.billing-switch.on{background:#22c55e}
.tgagg .billing-switch-knob{position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(15,23,42,.28);transition:transform .16s ease}
.tgagg button.billing-switch.on .billing-switch-knob{transform:translateX(42px)}
.tgagg .billing-switch-text{position:absolute;top:0;bottom:0;display:flex;align-items:center;font-size:12px;font-weight:800;letter-spacing:.03em;color:#fff;pointer-events:none}
.tgagg button.billing-switch.on .billing-switch-text{left:10px}
.tgagg button.billing-switch:not(.on) .billing-switch-text{right:8px}
.tgagg .billing-help{position:relative;display:inline-flex;flex:0 0 auto}
.tgagg button.billing-help-btn{width:16px;height:16px;min-height:16px;flex:0 0 16px;padding:0;border:0;border-radius:50%;background:#9aa3af;color:#fff;font-size:11px;font-weight:700;line-height:16px;cursor:pointer}
.tgagg .billing-help-tip{position:absolute;left:calc(100% + 8px);top:50%;transform:translateY(-50%);width:max-content;max-width:220px;padding:8px 10px;border-radius:4px;background:#1f7f92;color:#fff;font-size:13px;font-weight:500;line-height:1.35;z-index:40;box-shadow:0 8px 18px rgba(15,23,42,.18)}
.tgagg .billing-help-tip[hidden]{display:none!important}
@media(max-width:640px){.tgagg .billing-help-tip{left:auto;right:0;top:calc(100% + 8px);transform:none}}
.tgagg .billing-choice-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.tgagg .dialog-delete-confirm-card .field input{width:100%;box-sizing:border-box;height:44px;margin:8px 0;padding:0 12px;border:1px solid #cbd5e1;border-radius:10px;font:inherit}
@media(max-width:860px){.tgagg .composer-reply,.tgagg .composer-edit{padding:0 48px 0 6px}}

.tgagg .message-wrap .message.message-media{max-width:min(320px,100%)}
.tgagg .message-wrap .message.message-media-album,.tgagg .message-wrap .message.message-album{max-width:min(340px,100%);width:fit-content}

/* Compact message layout overrides. */
.tgagg .message{padding:4px 7px 4px;border-radius:11px;line-height:1.26}
.tgagg .message-head{line-height:1.15}
.tgagg .message-time{line-height:1.1}
.tgagg .messages{gap:3px;padding-left:var(--chat-side,10px);padding-right:var(--chat-side,10px)}
.tgagg .reply-quote{margin:0 0 4px;padding:3px 6px;border-radius:7px;font-size:12px;line-height:1.18}
.tgagg .reply-quote b{font-size:11.5px}

/* Voice recording button inside composer. */
    .tgagg .composer-box textarea{min-width:0}
    .tgagg .message-premium-emoji{display:inline-block;padding:0 1px;border-radius:4px;background:linear-gradient(120deg,rgba(255,215,0,.18),rgba(255,105,180,.14));box-shadow:inset 0 0 0 1px rgba(255,193,7,.25)}
.tgagg .voice-btn{width:34px;height:34px;border:1px solid #cbd5e1;border-radius:50%;display:grid;place-items:center;flex:0 0 34px;background:#fff;color:#475569;font-size:16px;touch-action:none;user-select:none}
.tgagg .voice-btn.recording{border-color:#ef4444;background:#fee2e2;color:#dc2626;box-shadow:0 0 0 4px rgba(239,68,68,.16)}
.tgagg .voice-btn:disabled{opacity:.55}
@media(max-width:860px){.tgagg .voice-btn{width:32px;height:32px;flex-basis:32px}}

.tgagg .voice-btn.recording{animation:tgaggVoicePulse 1s ease-in-out infinite}
.tgagg .voice-btn.processing{pointer-events:none;border-color:#3b82f6;background:#eff6ff;color:#2563eb;box-shadow:none}
.tgagg .voice-btn.processing::after{content:"";width:16px;height:16px;border:2px solid rgba(37,99,235,.22);border-top-color:#2563eb;border-radius:50%;animation:tgaggVoiceSpin .75s linear infinite}
.tgagg .voice-btn.processing svg,.tgagg .voice-btn.processing{font-size:0}
@keyframes tgaggVoiceSpin{to{transform:rotate(360deg)}}
@keyframes tgaggVoicePulse{0%,100%{transform:scale(1);box-shadow:0 0 0 4px rgba(239,68,68,.16)}50%{transform:scale(1.08);box-shadow:0 0 0 8px rgba(239,68,68,.08)}}

.tgagg .voice-cancel-btn{width:30px;height:30px;border:1px solid #fecaca;border-radius:50%;display:grid;place-items:center;flex:0 0 30px;background:#fff1f2;color:#dc2626;font-size:20px;font-weight:800;line-height:1;cursor:pointer}
.tgagg .voice-cancel-btn[hidden]{display:none!important}
.tgagg .voice-cancel-btn:hover{background:#ffe4e6;border-color:#fca5a5}

.tgagg .overlay-fab-stack{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));z-index:180;display:flex;flex-direction:column;align-items:flex-end;gap:10px;pointer-events:none}
.tgagg .overlay-fab-stack[hidden]{display:none!important}
.tgagg .overlay-fab-stack > *{pointer-events:auto}
.tgagg .overlay-save-fab{min-height:44px;padding:10px 16px;border-radius:999px;box-shadow:0 8px 24px rgba(51,144,236,.22);white-space:nowrap;font-size:14px;font-weight:800}
.tgagg .overlay-save-fab[hidden]{display:none!important}
.tgagg .settings-head-account-actions{display:flex;gap:8px;flex-wrap:nowrap;align-items:stretch;width:100%;max-width:520px}
.tgagg .settings-head-account-actions .btn{flex:1 1 0;min-width:0;white-space:nowrap;padding-left:10px;padding-right:10px;font-size:13px;display:inline-flex;align-items:center;justify-content:center;text-align:center}
.tgagg .settings-metrics{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px;padding:14px 16px;border-radius:16px;background:linear-gradient(135deg,#eff6ff,#f8fafc);border:1px solid #dbeafe}
.tgagg .billing-card{display:flex;align-items:center;justify-content:space-between;gap:18px}
.tgagg .billing-card-main{min-width:0;flex:1}
.tgagg .billing-card .settings-metrics{margin:0;padding:0;border:0;background:transparent;flex:0 0 auto}
@media(max-width:720px){.tgagg .billing-card{flex-direction:column;align-items:stretch}.tgagg .billing-card .settings-metrics{justify-content:space-between}}
.tgagg .settings-metric-main{display:grid;gap:2px;min-width:0}
.tgagg .settings-metric-value{font-size:28px;font-weight:900;line-height:1;color:#0f172a}
.tgagg .settings-metric-label{font-size:12.5px;font-weight:700;color:#64748b}
.tgagg .settings-metric-split{display:flex;gap:8px;flex:0 0 auto}
.tgagg .settings-metric-pill{display:inline-flex;align-items:center;gap:6px;padding:7px 10px;border-radius:999px;background:#fff;border:1px solid #e2e8f0;color:#334155;font-size:13px;font-weight:800}.tgagg button.settings-metric-pill{font:inherit;cursor:pointer}.tgagg .settings-metric-pill.active{background:#dbeafe;border-color:#3390ec;color:#1d4ed8;box-shadow:0 0 0 2px rgba(51,144,236,.12)}
.tgagg .settings-accounts-grid{display:grid;gap:10px}
.tgagg .settings-account-accordion{border:1px solid #e5e7eb;border-radius:16px;background:#fff;overflow:hidden;box-shadow:0 4px 14px rgba(15,23,42,.05)}
.tgagg .settings-account-toggle{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 14px;border:0;background:#f8fafc;color:inherit;text-align:left;cursor:pointer}
.tgagg .settings-account-toggle-main{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.tgagg .settings-account-toggle-text{display:grid;gap:2px;min-width:0}
.tgagg .settings-account-toggle-phone{font-size:15px;font-weight:900;color:#0f172a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tgagg .settings-account-toggle-label{font-size:12.5px;font-weight:700;color:#64748b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tgagg .settings-account-toggle-meta{display:inline-flex;align-items:center;gap:8px;flex:0 0 auto}
.tgagg .settings-account-chevron{display:grid;place-items:center;width:24px;height:24px;border-radius:999px;background:#e2e8f0;color:#475569;font-size:18px;line-height:1;transition:transform .18s}
.tgagg .settings-account-accordion.is-open .settings-account-chevron{transform:rotate(90deg)}
.tgagg .settings-account-body[hidden]{display:none!important}
.tgagg .settings-account-body{padding:0 8px 8px}
.tgagg .settings-account-card{margin:0;border:0;border-radius:12px;background:#f8fafc;box-shadow:none}
.tgagg .overlay-back-fab{position:static;right:auto;bottom:auto}
.tgagg .overlay-back-fab{width:52px;height:52px;border:2px solid #3390ec;border-radius:50%;background:#fff;color:#3390ec;font-size:28px;line-height:1;display:grid;place-items:center;cursor:pointer;box-shadow:0 8px 24px rgba(51,144,236,.22);transition:transform .15s,background .15s,color .15s}
.tgagg .overlay-back-fab[hidden]{display:none!important}
.tgagg .overlay-back-fab span{display:block;margin-right:2px;margin-top:-1px}
.tgagg .overlay-back-fab:hover{background:#3390ec;color:#fff}
.tgagg .overlay-back-fab:active{transform:scale(.96)}
.tgagg .field input[type="radio"],.tgagg .field input[type="checkbox"]{width:auto;padding:0;flex:0 0 auto;margin:0}
.tgagg .chat-pane.broadcasts-mode .settings-view{container-type:inline-size;container-name:tgagg-broadcasts}
.tgagg .btn.is-loading{opacity:.72;pointer-events:none;cursor:wait;display:inline-flex;align-items:center;justify-content:center;gap:10px}
.tgagg .btn .btn-spin{flex:0 0 auto;width:16px;height:16px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:tgagg-spin .7s linear infinite}
.tgagg .chat-pane.settings-mode .settings-view,.tgagg .chat-pane.notes-mode .settings-view,.tgagg .chat-pane.global-templates-mode .settings-view,.tgagg .chat-pane.broadcasts-mode .settings-view{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
.tgagg .chat-pane.settings-admin-mode .settings-view{padding-bottom:calc(132px + env(safe-area-inset-bottom))}

.tgagg .sidebar.explorer-mode .chips{display:none!important}
.tgagg .explorer-banner{display:grid;gap:6px;padding:0 2px 4px}
.tgagg .explorer-back{border:0;background:transparent;color:#2563eb;font:inherit;font-size:13px;padding:0;text-align:left;cursor:pointer}
.tgagg .explorer-banner-title{font-size:14px;font-weight:700;color:#111827;line-height:1.3}
.tgagg .tabs .tab.explorer-folder{font-size:12.5px;padding:7px 10px}
.tgagg .dialog-title-row{display:flex;align-items:center;gap:6px;min-width:0}
.tgagg .dialog-title-row .dialog-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tgagg .entity-kind-badge{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;background:#eef2ff;color:#4338ca;font-size:11px;line-height:1;flex:0 0 auto}
.tgagg .entity-kind-badge.entity-kind-channel{background:#fef3c7;color:#b45309}
.tgagg .entity-kind-badge.entity-kind-group{background:#dcfce7;color:#15803d}
.tgagg .entity-kind-badge.entity-kind-saved{background:#fce7f3;color:#be185d}
.tgagg .entity-kind-badge.entity-kind-archive{background:#f3f4f6;color:#4b5563}
.tgagg .explorer-dialog-card .dialog-head{align-items:flex-start}
.tgagg .composer.composer-disabled{opacity:.55;pointer-events:none}
.tgagg .chat-pane.explorer-mode .note-panel{display:none!important}


/* Side alignment: only message-wrap positions bubbles in the chat column. */
.tgagg .messages > .message-wrap{display:flex;flex-direction:column;align-items:stretch;width:max-content;max-width:min(640px,84%)}
@media(max-width:860px){.tgagg .messages > .message-wrap{max-width:90%}}
.tgagg .messages > .message-wrap.in{align-self:flex-start!important;margin-right:auto!important;margin-left:0!important}
.tgagg .messages > .message-wrap.out{align-self:flex-end!important;margin-left:auto!important;margin-right:0!important}
.tgagg .messages > .message-wrap > .message.in,
.tgagg .messages > .message-wrap > .message.out{align-self:auto!important;width:auto!important;max-width:100%!important}
.tgagg .message.message-album .message-head{display:none}

.tgagg .drawer-lang{display:flex;gap:8px;margin:0 16px 10px;padding:4px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc}
.tgagg .lang-btn{flex:1;border:0;border-radius:9px;padding:8px 10px;background:transparent;color:#64748b;font-size:12px;font-weight:900;cursor:pointer}
.tgagg .lang-btn.is-active{background:#dbeafe;color:#1d4ed8}
.tgagg .drawer-theme{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 16px 12px;padding:9px 12px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc}
.tgagg .drawer-theme-label{font-size:14px;font-weight:700;color:var(--text)}
.tgagg .theme-options{display:flex;gap:3px;padding:3px;border-radius:999px;background:#e2e8f0}
.tgagg .theme-option{width:38px;height:28px;border:0;border-radius:999px;background:transparent;color:#64748b;font-size:14px;line-height:1;cursor:pointer}
.tgagg .theme-option.is-active{background:var(--blue);color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.18)}

/* Dark theme */
body.tgagg-dark{background:#0e1621}
.tgagg.theme-dark{--bg:#0e1621;--surface:#17212b;--side:#111b26;--border:#2b3a49;--text:#e8edf2;--muted:#9aaabd;--incoming:#182533;--outgoing:#214b3d;--hover:#223344;--shadow:0 12px 36px rgba(0,0,0,.42)}
.tgagg.theme-dark .app,.tgagg.theme-dark .sidebar,.tgagg.theme-dark .chat-pane{background:var(--surface);color:var(--text)}
.tgagg.theme-dark .sidebar{border-color:var(--border);background:var(--side)}
.tgagg.theme-dark .topbar,.tgagg.theme-dark .tabs,.tgagg.theme-dark .chips,.tgagg.theme-dark .screen-title{background:var(--side);border-color:var(--border);color:var(--text)}
.tgagg.theme-dark .search{background:#1c2a38;color:var(--text)}
.tgagg.theme-dark .search::placeholder,.tgagg.theme-dark input::placeholder,.tgagg.theme-dark textarea::placeholder{color:#8293a5}
.tgagg.theme-dark .tab,.tgagg.theme-dark .chip{background:#1c2a38;border-color:#304253;color:#cbd5df}
.tgagg.theme-dark .tab.active,.tgagg.theme-dark .chip.active{background:#24547c;border-color:#3a83bc;color:#fff}
.tgagg.theme-dark .chat-pane.settings-mode,.tgagg.theme-dark .chat-pane.notes-mode{background:transparent}
.tgagg.theme-dark .chat-header,.tgagg.theme-dark .note-panel,.tgagg.theme-dark .composer{background:rgba(23,33,43,.96);border-color:var(--border);color:var(--text)}
.tgagg.theme-dark .composer-box,.tgagg.theme-dark .modal,.tgagg.theme-dark .drawer,.tgagg.theme-dark .templates-sheet{background:#17212b;color:var(--text)}
.tgagg.theme-dark .composer-box{box-shadow:0 1px 3px rgba(0,0,0,.35)}
.tgagg.theme-dark .composer-box textarea,.tgagg.theme-dark .rich-composer{color:var(--text)}
.tgagg.theme-dark .settings-panel{background:#101b27;border-color:var(--border)}
.tgagg.theme-dark .settings-card,.tgagg.theme-dark .settings-account-card,.tgagg.theme-dark .settings-metric-pill{background:#172533;border-color:#2e4152;color:var(--text)}
.tgagg.theme-dark .settings-window,.tgagg.theme-dark .settings-window-head{color:var(--text)}
.tgagg.theme-dark .settings-window-subtitle,.tgagg.theme-dark .settings-subtitle,.tgagg.theme-dark .helper,.tgagg.theme-dark .account-phone{color:var(--muted)}
.tgagg.theme-dark .settings-account-accordion{border-color:#2e4152;background:#172533}
.tgagg.theme-dark .settings-account-toggle{color:var(--text)}
.tgagg.theme-dark .settings-account-body{border-color:#2e4152}
.tgagg.theme-dark .account-row,.tgagg.theme-dark .user-row{border-color:#2e4152}
.tgagg.theme-dark .btn.secondary,.tgagg.theme-dark .mini-btn,.tgagg.theme-dark .role-btn{background:#243443;border-color:#354b5e;color:#e5edf5}
.tgagg.theme-dark .btn.danger{background:#552b35;color:#ffb4bd}
.tgagg.theme-dark .field input,.tgagg.theme-dark .field select,.tgagg.theme-dark .field textarea,.tgagg.theme-dark .user-form input,.tgagg.theme-dark .user-form select,.tgagg.theme-dark .offer-field-input,.tgagg.theme-dark .offer-field-textarea{background:#101b27;border-color:#354b5e;color:var(--text)}
.tgagg.theme-dark .modal-head,.tgagg.theme-dark .modal-body,.tgagg.theme-dark .templates-sheet-head{color:var(--text)}
.tgagg.theme-dark .field label,.tgagg.theme-dark .field-caption,.tgagg.theme-dark .drawer-theme-label{color:#b9c7d5}
.tgagg.theme-dark .modal-backdrop,.tgagg.theme-dark .drawer-backdrop{background:rgba(0,0,0,.62)}
.tgagg.theme-dark .drawer-profile{background:linear-gradient(135deg,#24547c,#172f48)}
.tgagg.theme-dark .drawer-menu{background:#17212b}
.tgagg.theme-dark .drawer-item{color:#d7e1ea}
.tgagg.theme-dark .drawer-item:hover{background:#203142}
.tgagg.theme-dark .drawer-notify,
.tgagg.theme-dark .drawer-lang,
.tgagg.theme-dark .drawer-theme{border-color:#2e4152}
.tgagg.theme-dark .drawer-lang{background:#172533!important}
.tgagg.theme-dark .lang-btn{background:#1b2b3a;color:#cbd5df}
.tgagg.theme-dark .lang-btn.is-active{background:#2b6b9e;color:#fff}
.tgagg.theme-dark .theme-options{background:#1b2b3a}
.tgagg.theme-dark .theme-option{color:#aebdca}
.tgagg.theme-dark .message .message-meta,.tgagg.theme-dark .header-subtitle{color:var(--muted)}
.tgagg.theme-dark .dialog-card{border-color:#263847;background:#172533;color:var(--text)}
.tgagg.theme-dark .dialog-card:hover,.tgagg.theme-dark .dialog-card.active{background:#203445}
.tgagg.theme-dark .dialog-preview,.tgagg.theme-dark .dialog-time{color:var(--muted)}
.tgagg.theme-dark .status{background:#2b3b4b;color:#d7e1ea}
.tgagg.theme-dark .status.active{background:#174b38;color:#a7f3c5}
.tgagg.theme-dark .status.needs_login{background:#553b22;color:#ffd29a}
.tgagg.theme-dark .error-text{color:#ff9ca8}
.tgagg.theme-dark .offer-entry-card,.tgagg.theme-dark .profile-block,.tgagg.theme-dark .profile-section{background:#172533;border-color:#2e4152;color:var(--text)}
.tgagg.theme-dark .templates-sheet-list,.tgagg.theme-dark .template-slot{border-color:#2e4152}
.tgagg.theme-dark .icon-btn:hover,.tgagg.theme-dark .menu-btn:hover{background:#25394a;color:#fff}
.tgagg .team-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.tgagg .team-panel-body{margin-top:12px;padding-top:12px;border-top:1px solid #e5e7eb}
.tgagg .team-panel-body[hidden]{display:none!important}

@media (max-width: 720px) {
  .tgagg .settings-window-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .tgagg .settings-window-head > .btn{
    width: 100%;
    white-space: normal;
    text-align: center;
    font-size: 13px;
    min-height: 38px;
    padding: 8px 12px;
  }}

/* Final dark-theme contrast overrides */
.tgagg.theme-dark .drawer,
.tgagg.theme-dark .drawer-menu{background:#17212b!important}
.tgagg.theme-dark .drawer-item{color:#dce7f1!important}
.tgagg.theme-dark .drawer-item:hover{background:#243849!important}
.tgagg.theme-dark a.tg-open-link,.tgagg.theme-dark a.tg-ext-link{color:#8fcaff!important}
.tgagg.theme-dark .reply-quote{background:rgba(56,189,248,.18)!important;border-left-color:#38bdf8!important;color:#dbeafe!important}
.tgagg.theme-dark .reply-quote b{color:#7dd3fc!important}
.tgagg.theme-dark .reply-quote span{color:#dbeafe!important}
.tgagg.theme-dark .reply-preview-bar,.tgagg.theme-dark .edit-preview-bar{background:#203344!important;color:#dbe7f1!important}
.tgagg.theme-dark .reply-preview-bar b{color:#7dd3fc!important}
body.tgagg-dark .drawer,
body.tgagg-dark .drawer-menu{background:#17212b!important}
body.tgagg-dark .drawer-item{background:transparent!important;color:#dce7f1!important;border:0!important}
.tgagg .drawer-theme{justify-content:center;margin:0 16px 10px;padding:4px 0;border:0;background:transparent}
.tgagg .theme-options{width:138px;justify-content:center}
.tgagg .theme-option{width:64px;height:28px}
.tgagg.theme-dark .drawer-notify{color:#dce7f1;background:#1d2d3c;border-color:#354b5e}
.tgagg.theme-dark .drawer-notify-label{color:#dce7f1}

/* Complete dark coverage for secondary screens and overlays */
.tgagg.theme-dark .chat-pane.explorer-mode{background:#101b27!important;color:#e8edf2}
.tgagg.theme-dark .settings-view,
.tgagg.theme-dark .settings-window,
.tgagg.theme-dark .settings-window-head{color:#e8edf2}
.tgagg.theme-dark .settings-grid,.tgagg.theme-dark .settings-accounts-grid{background:transparent!important}
.tgagg.theme-dark .settings-card,
.tgagg.theme-dark .settings-account-card,
.tgagg.theme-dark .team-panel,
.tgagg.theme-dark .template-slot,
.tgagg.theme-dark .template-pick-btn,
.tgagg.theme-dark .favorite-forward-picker-panel,
.tgagg.theme-dark .favorite-forward-preview,
.tgagg.theme-dark .dialog-delete-confirm-card,
.tgagg.theme-dark .offer-entry-form-modal,
.tgagg.theme-dark .profile-modal,
.tgagg.theme-dark .template-modal{background:#172533!important;border-color:#304656!important;color:#e8edf2}
.tgagg.theme-dark .modal,
.tgagg.theme-dark .modal-body,
.tgagg.theme-dark .modal-head,
.tgagg.theme-dark .templates-sheet{background:#172533!important;color:#e8edf2}
.tgagg.theme-dark .settings-card *,
.tgagg.theme-dark .template-slot *,
.tgagg.theme-dark .favorite-forward-picker-panel *,
.tgagg.theme-dark .dialog-delete-confirm-card *,
.tgagg.theme-dark .offer-entry-form-modal *,
.tgagg.theme-dark .profile-modal *,
.tgagg.theme-dark .template-modal *{border-color:#304656}
.tgagg.theme-dark .template-slot-text,
.tgagg.theme-dark .profile-block,
.tgagg.theme-dark .profile-section,
.tgagg.theme-dark .favorite-forward-preview-source,
.tgagg.theme-dark .favorite-forward-preview-target,
.tgagg.theme-dark .dialog-delete-confirm-text{color:#d8e3ed}
.tgagg.theme-dark .template-add-row textarea,
.tgagg.theme-dark .global-template-title-input,
.tgagg.theme-dark .offer-field-input,
.tgagg.theme-dark .offer-field-textarea,
.tgagg.theme-dark .profile-block textarea,
.tgagg.theme-dark .profile-block input,
.tgagg.theme-dark .settings-card input,
.tgagg.theme-dark .settings-card select,
.tgagg.theme-dark .settings-card textarea,
.tgagg.theme-dark .modal input,
.tgagg.theme-dark .modal select,
.tgagg.theme-dark .modal textarea{background:#101b27!important;color:#e8edf2!important;border-color:#40576a!important}
.tgagg.theme-dark .template-pick-btn,.tgagg.theme-dark .favorite-forward-picker-item{background:#1b2c3b!important;color:#e8edf2!important;border-color:#3a5265!important}
.tgagg.theme-dark .template-pick-btn:hover,.tgagg.theme-dark .favorite-forward-picker-item:hover{background:#263e51!important}
.tgagg.theme-dark .templates-sheet-backdrop{background:rgba(0,0,0,.62)!important}
.tgagg.theme-dark .favorites-empty,.tgagg.theme-dark .favorites-error{color:#b9c9d8!important}
.tgagg.theme-dark .dialog-card{background:#172533!important;border-color:#304656!important}
.tgagg.theme-dark .dialog-card.unread{background:#1d3a52!important}
.tgagg.theme-dark .explorer-banner,
.tgagg.theme-dark .explorer-dialog-card{color:#e8edf2!important}
.tgagg.theme-dark .entity-kind-badge{background:#263d52;color:#9ed5ff}
.tgagg.theme-dark .format-toolbar{background:#1b2c3b!important;border-color:#3a5265!important}

/* Chat surface in the dark theme (bubbles: see the chat section at the end of this file) */
.tgagg.theme-dark .messages{background:#0e1823!important}
.tgagg.theme-dark .composer{
  background:#111d29!important;
  border-top:1px solid #2c4355!important;
}
.tgagg.theme-dark .composer-box{
  background:#1d3040!important;
  border:1px solid #3d5a70!important;
  box-shadow:0 2px 10px rgba(0,0,0,.34)!important;
}
.tgagg.theme-dark .composer-box textarea{color:#f1f6fa!important}
.tgagg.theme-dark .peer-accounts-popover,.tgagg.theme-dark .peer-accounts-item,.tgagg.theme-dark .message-context-menu,.tgagg.theme-dark #messageContextMenu.message-context-menu{background:#172533!important;border-color:#304656!important;color:#e8edf2!important}
.tgagg.theme-dark .peer-accounts-item:hover,.tgagg.theme-dark .message-context-menu button:hover{background:#263e51!important;color:#fff!important}
.tgagg.theme-dark .message-context-menu button{color:#d8e3ed!important}
.tgagg.theme-dark .message.message-media .message-time,
.tgagg.theme-dark .media-voice-player{background:rgba(18,32,48,.48);border-color:rgba(255,255,255,.14);box-shadow:0 8px 24px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.12);color:#8ec8ff}
.tgagg.theme-dark .message.out .media-voice-player{background:rgba(28,48,70,.5)}
.tgagg.theme-dark .media-voice-play{background:rgba(255,255,255,.12);color:#9fd4ff;box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 6px 16px rgba(0,0,0,.25)}
.tgagg.theme-dark .media-voice-time{color:#c5d4e2}
.tgagg.theme-dark .media-voice-speed,
.tgagg.theme-dark .voice-btn,
.tgagg.theme-dark .voice-btn.processing{background:#243443!important;border-color:#40576a!important;color:#d8e3ed!important}
.tgagg.theme-dark .qr-box{background:#172533!important;border-color:#304656!important;color:#e8edf2!important}
.tgagg.theme-dark .favorites-chip,
.tgagg.theme-dark .favorite-composer-preview{background:#5b4617!important;border-color:#a87924!important;color:#f5d98b!important}

/* Component-level contrast corrections */
.tgagg.theme-dark .settings-metrics{background:#172533!important;border-color:#304656!important;color:#e8edf2!important}
.tgagg.theme-dark .billing-card .settings-metrics{background:transparent!important;border:0!important}
.tgagg.theme-dark .settings-metric-value{color:#f3f7fb!important}
.tgagg.theme-dark .settings-metric-label{color:#b9c9d8!important}
.tgagg.theme-dark .settings-metric-pill{background:#1d3040!important;border-color:#40576a!important;color:#e8edf2!important}
.tgagg.theme-dark .settings-metric-pill.active{background:#214d73!important;border-color:#5aa7e8!important;color:#fff!important}
.tgagg.theme-dark .settings-account-accordion{background:#172533!important;border-color:#40576a!important}
.tgagg.theme-dark .settings-account-toggle{background:#1b2c3b!important;color:#e8edf2!important}
.tgagg.theme-dark .settings-account-toggle-phone,
.tgagg.theme-dark .settings-account-toggle-label{color:#d8e3ed!important}
.tgagg.theme-dark .settings-account-chevron{background:#304656!important;color:#e8edf2!important}
.tgagg.theme-dark .message.in,
.tgagg.theme-dark .message.out{isolation:isolate}
.tgagg.theme-dark .message.in .message-head,
.tgagg.theme-dark .message.in .message-head *,
.tgagg.theme-dark .message.in .message-time,
.tgagg.theme-dark .message.out .message-head,
.tgagg.theme-dark .message.out .message-head *,
.tgagg.theme-dark .message.out .message-time{color:#d8e3ed!important}
/* DARK_SPAN_FIX_V1: only the album blocks are stretched; message time / body spans keep their natural size */
.tgagg .media-album-grid > .media-album-item > .media-block,.tgagg .media-album-grid > .media-album-item > .media-frame{display:block;width:100%;height:100%;min-height:0;max-width:none}
.tgagg .media-album-grid > .media-album-item .media-photo{position:absolute;inset:0;width:100%;height:100%;max-width:none;max-height:none;object-fit:cover;border-radius:0}
.tgagg .video-modal-player,.video-modal-player{display:block;max-width:min(96vw,1100px);max-height:90vh;border-radius:10px;background:#000;outline:0}
.tgagg .messages > .favorite-message-row,.tgagg .messages > .favorite-message-row.in,.tgagg .messages > .favorite-message-row.out{display:flex;justify-content:flex-start;align-items:flex-start;width:100%;padding:0 4px;box-sizing:border-box}
.tgagg .favorite-message-stack{align-items:flex-start;width:auto;max-width:min(590px,92%)}
.tgagg .favorite-message-stack > .message-wrap,.tgagg .favorite-message-stack > .message-wrap.out,.tgagg .favorite-message-stack > .message-wrap.in{align-self:flex-start!important;margin:0!important;width:fit-content}
.tgagg .favorite-forward-btn{align-self:flex-start}
.tgagg .media-video-player.is-playing .media-video,.tgagg .media-video:fullscreen,.tgagg .media-video:-webkit-full-screen{object-fit:contain!important;background:#000}
.tgagg .media-video:fullscreen,.tgagg .media-video:-webkit-full-screen{position:static!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important}
.tgagg .media-album-grid .media-video-player.is-playing .media-video{object-fit:cover!important}
.tgagg .media-album-grid{width:min(340px,72vw)!important;max-width:none!important;min-width:200px}
.tgagg .message-wrap .message.message-media-album,.tgagg .message-wrap .message.message-album{width:min(340px,72vw);min-width:200px;max-width:none}
.photo-lightbox-nav{position:absolute;top:50%;transform:translateY(-50%);width:48px;height:64px;border:0;border-radius:12px;background:rgba(255,255,255,.14);color:#fff;font-size:26px;cursor:pointer;z-index:2;display:flex;align-items:center;justify-content:center}
.photo-lightbox-nav:hover{background:rgba(255,255,255,.26)}
.photo-lightbox-nav[hidden]{display:none}
.photo-lightbox-nav.prev{left:max(12px,env(safe-area-inset-left))}
.photo-lightbox-nav.next{right:max(12px,env(safe-area-inset-right))}
.photo-lightbox-counter{position:absolute;bottom:max(14px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);padding:3px 10px;border-radius:999px;background:rgba(0,0,0,.5);color:#fff;font-size:13px;pointer-events:none}
.photo-lightbox-counter:empty{display:none}
.photo-lightbox-img{touch-action:pan-y}
/* saving a photo or a video: the button of the viewers (next to the cross) and the one on a video that plays in the chat */
.photo-lightbox-dl{position:absolute;top:max(12px,env(safe-area-inset-top));right:calc(max(12px,env(safe-area-inset-right)) + 52px);width:42px;height:42px;border:0;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;cursor:pointer;z-index:1;display:flex;align-items:center;justify-content:center;padding:0}
.photo-lightbox-dl:hover{background:rgba(255,255,255,.26)}
.photo-lightbox-dl[hidden]{display:none}
.tgagg .media-video-dl{display:none;position:absolute;right:8px;top:8px;z-index:5;width:34px;height:34px;border:0;border-radius:50%;background:rgba(15,23,42,.62);color:#fff;cursor:pointer;padding:0;align-items:center;justify-content:center}
.tgagg .media-video-dl:hover{background:rgba(15,23,42,.85)}
.tgagg .media-video-player.is-playing .media-video-dl{display:flex}
.tgagg .composer-preview-item video{display:block;width:100%;height:100%;object-fit:cover;background:#0f172a}
.tgagg .composer-preview-play{position:absolute;left:50%;top:50%;z-index:2;width:30px;height:30px;margin:-15px 0 0 -15px;border:0;border-radius:50%;background:rgba(15,23,42,.62);cursor:pointer;padding:0}
.tgagg .composer-preview-play::after{content:"";position:absolute;left:11px;top:8px;border-left:10px solid #fff;border-top:7px solid transparent;border-bottom:7px solid transparent}
/* MEDIA_EDITOR_V1: the pencil on the preview of an attached file (the cross that removes it is on the other corner); the editor itself has its own style, fetched with it */
.tgagg .composer-preview-edit{position:absolute;left:4px;top:4px;display:grid;place-items:center;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:rgba(15,23,42,.6);color:#fff;cursor:pointer}
.tgagg .composer-preview-edit svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tgagg .composer-preview-edit:hover{background:rgba(36,129,204,.9)}
/* the window of one video that is brought from Telegram first: the picture, a spinner or what went wrong */
.video-modal-poster{display:block;max-width:min(96vw,1100px);max-height:90vh;border-radius:10px;object-fit:contain;opacity:.55}
.video-modal-poster[hidden],.video-modal-player[hidden],.video-modal-status[hidden]{display:none}
.video-modal-status{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;gap:12px;max-width:min(88vw,360px);padding:14px 18px;border-radius:14px;background:rgba(15,23,42,.74);color:#fff;font-size:14px;line-height:1.35;text-align:center}
.video-modal-spin{display:block;width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:tgagg-spin .8s linear infinite}
.video-modal-retry{border:0;border-radius:10px;background:#2f8cf0;color:#fff;font:inherit;font-weight:700;padding:8px 16px;cursor:pointer}

/* BILLING_V2 */
.tgagg .pay-sheet{width:min(280px,100%);padding:10px 10px 8px;border-radius:0;box-shadow:0 10px 28px rgba(0,0,0,.38)}
.tgagg .pay-sheet .dialog-delete-confirm-title{margin-bottom:2px;font-size:15px}
.tgagg .pay-sheet .dialog-delete-confirm-text{margin:0 0 6px;font-size:12px;line-height:1.25}
.tgagg .pay-sheet .field{display:block;margin:0}
.tgagg .pay-sheet .field input{height:32px;margin:0 0 8px;padding:0 8px;border-radius:0}
.tgagg .pay-sheet .pay-methods{display:flex;flex-direction:column;gap:0;margin:0 0 6px}
.tgagg .pay-sheet .pay-method{display:block;width:100%;min-height:0;padding:0;border:0;border-radius:0;background:transparent;cursor:pointer;box-shadow:none}
.tgagg .pay-sheet .pay-method img{display:block;width:100%;height:auto}
.tgagg .drawer-avatar{overflow:visible;background:transparent;border-radius:0;width:64px;height:64px;padding:0}
.tgagg .drawer-avatar img{width:64px;height:64px;object-fit:contain;display:block;border-radius:0;background:transparent}
.tgagg .pay-sheet .dialog-delete-confirm-actions{margin:0}
.tgagg .pay-sheet .dialog-delete-confirm-actions .btn{min-height:30px;border-radius:0}
.tgagg .pay-sheet #billingTopupError{min-height:0;margin:0 0 4px;font-size:12px}
.tgagg.theme-dark .pay-sheet{box-shadow:0 12px 32px rgba(0,0,0,.55)}
.tgagg.theme-dark .pay-sheet .pay-method{background:transparent!important;border:0!important}
/* DASHBOARD_V1 */
.tgagg .chat-pane.dashboard-mode{background:transparent}
.tgagg .chat-pane.dashboard-mode .empty-state,
.tgagg .chat-pane.dashboard-mode .chat-header,
.tgagg .chat-pane.dashboard-mode .messages,
.tgagg .chat-pane.dashboard-mode .composer,
.tgagg .chat-pane.dashboard-mode .note-panel,
.tgagg .chat-pane.dashboard-mode .quick-replies{display:none}
.tgagg .chat-pane.dashboard-mode .settings-view{display:block;background:transparent;padding:16px 16px calc(24px + env(safe-area-inset-bottom))}

/* SHIFTS_V2 red alert on the Dashboard menu button and the burger */
.tgagg .drawer-item .dash-alert-badge{order:9;margin-left:auto;min-width:22px;height:22px;padding:0 7px;border-radius:999px;display:inline-grid;place-items:center;background:#e5484d;color:#fff;font-size:12px;font-weight:800;font-style:normal}
.tgagg .drawer-item .dash-alert-badge[hidden]{display:none}
.tgagg .menu-btn.has-dash-alert{position:relative}
.tgagg .menu-btn.has-dash-alert::after{content:"";position:absolute;top:7px;right:7px;width:11px;height:11px;border-radius:50%;background:#e5484d;box-shadow:0 0 0 2px var(--side,#fff)}
/* BILLING_V3: hint next to a button when a paid module or a free slot is missing */
.billing-hint{position:fixed;z-index:220;display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin:0;padding:10px 12px;border-radius:12px;background:#111827;color:#fff;font-size:13px;line-height:1.35;box-shadow:0 8px 24px rgba(0,0,0,.28);animation:billingHintIn .18s cubic-bezier(.22,.8,.3,1) both;box-sizing:border-box}
.billing-hint::before{content:"";position:absolute;left:var(--arrow,18px);top:-5px;width:10px;height:10px;background:#111827;transform:rotate(45deg)}
.billing-hint.is-above::before{top:auto;bottom:-5px}
.billing-hint-link{border:0;border-radius:8px;padding:5px 10px;background:#3390ec;color:#fff;font-size:12px;font-weight:800;cursor:pointer}
.billing-hint-link:hover{background:#2481cc}
@keyframes billingHintIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.billing-hint{animation:none}}
/* BILLING_V3: a number that expires within 3 days */
.tgagg .settings-account-card.is-expiring{border:1.5px solid #e5484d;background:rgba(229,72,77,.07)}
.tgagg .settings-expire-plate{display:inline-flex;align-items:center;margin:0 0 8px;padding:5px 11px;border-radius:999px;background:#e5484d;color:#fff;font-size:12.5px;font-weight:800;letter-spacing:.01em}
.tgagg .settings-expire-plate[hidden]{display:none}
.tgagg .media-sticker-anim canvas{width:100%;height:100%;display:block}
.tgagg .media-sticker-anim,.tgagg .media-sticker-video{contain:paint}

/* ---------- Chat window: one centred column and soft grouped bubbles ----------
   Header, messages and composer share the side margin --chat-side (see also template-redesign.css and account-filter.css).
   Messages of one sender in a row are grouped by app.js (class msg-cont): the name is shown once. */
@media(min-width:861px){
  .tgagg .chat-pane{--chat-side:10%}
}
.tgagg{
  --bub-radius:18px;
  --bub-tail:6px;
  --bub-in-bg:#fff;
  --bub-in-border:rgba(15,35,60,.07);
  --bub-in-fg:#0f1b2d;
  --bub-out-bg:linear-gradient(135deg,#d8edff 0%,#d3f4ea 100%);
  --bub-out-border:rgba(40,120,170,.16);
  --bub-out-fg:#0b2530;
  --bub-meta:rgba(15,27,45,.52);
  --bub-quote:#2f8cf0;
}
.tgagg.theme-dark{
  --bub-in-bg:#1e2d3c;
  --bub-in-border:rgba(255,255,255,.08);
  --bub-in-fg:#eef4fa;
  --bub-out-bg:linear-gradient(135deg,#1f5a8c 0%,#1a7a70 100%);
  --bub-out-border:rgba(255,255,255,.14);
  --bub-out-fg:#f5fbff;
  --bub-meta:rgba(238,244,250,.62);
  --bub-quote:#7cc4ff;
}
.tgagg .messages > .message-wrap:not(.msg-cont){margin-top:7px}
.tgagg .messages > .message-wrap.msg-cont .message-head{display:none}

.tgagg .chat-pane .message:not(.message-media):not(.message-sticker):not(.message-bigemoji){
  padding:8px 13px 6px;
  font-size:15.5px;
  line-height:1.45;
  border-radius:var(--bub-radius);
  letter-spacing:.005em;
}
.tgagg .chat-pane .message.in:not(.message-media):not(.message-sticker):not(.message-bigemoji){
  background:var(--bub-in-bg);
  color:var(--bub-in-fg);
  border:1px solid var(--bub-in-border);
  box-shadow:0 1px 2px rgba(15,35,60,.06),0 6px 16px -10px rgba(15,35,60,.28);
  border-bottom-left-radius:var(--bub-tail);
}
.tgagg .chat-pane .message.out:not(.message-media):not(.message-sticker):not(.message-bigemoji){
  background:var(--bub-out-bg);
  color:var(--bub-out-fg);
  border:1px solid var(--bub-out-border);
  box-shadow:0 1px 2px rgba(15,35,60,.08),0 8px 18px -10px rgba(25,90,140,.45);
  border-bottom-right-radius:var(--bub-tail);
}
/* the corner that touches the previous bubble of the same sender */
.tgagg .messages > .message-wrap.msg-cont.in > .message:not(.message-media){border-top-left-radius:var(--bub-tail)}
.tgagg .messages > .message-wrap.msg-cont.out > .message:not(.message-media){border-top-right-radius:var(--bub-tail)}

/* links */
.tgagg.theme-dark .chat-pane .message a{color:#9ad2ff!important}

/* sender name and time */
.tgagg .chat-pane .message .message-head{margin-bottom:2px;font-size:12px;font-weight:750;letter-spacing:.01em;color:var(--bub-quote)}
.tgagg .chat-pane .message.out .message-head{color:inherit;opacity:.78}
.tgagg .chat-pane .message .message-time{margin-left:10px;margin-top:3px;font-size:11px;font-weight:500;color:var(--bub-meta)}
.tgagg .chat-pane .message .message-read-status.read{color:#2f8cf0}
.tgagg.theme-dark .chat-pane .message .message-read-status.read{color:#8fd0ff}

/* quotes inside a bubble */
.tgagg .chat-pane .message .reply-quote{
  margin:1px 0 6px;padding:5px 9px;border-left:3px solid var(--bub-quote);border-radius:10px;
  background:rgba(47,140,240,.10);color:inherit;
}
.tgagg.theme-dark .chat-pane .message .reply-quote{background:rgba(255,255,255,.09)}
.tgagg .chat-pane .message.out .reply-quote{background:rgba(255,255,255,.34)}
.tgagg.theme-dark .chat-pane .message.out .reply-quote{background:rgba(255,255,255,.14)}

/* photos, video and captions */
.tgagg .chat-pane .media-photo,
.tgagg .chat-pane .media-video{border-radius:16px}
.tgagg .chat-pane .message.message-media:not(.message-post) .media-caption{
  padding:7px 12px 5px;border-radius:0 0 var(--bub-radius) var(--bub-radius);
}
.tgagg .chat-pane .message.in.message-media:not(.message-post) .media-caption{background:var(--bub-in-bg);color:var(--bub-in-fg);border-bottom-left-radius:var(--bub-tail)}
.tgagg .chat-pane .message.out.message-media:not(.message-post) .media-caption{background:var(--bub-out-bg);color:var(--bub-out-fg);border-bottom-right-radius:var(--bub-tail)}

/* ---- POST_BUBBLE_V1: photo / video / album, with or without a caption, is ONE bubble: picture on top edge to edge,
   caption and time inside, exactly like a post in Telegram ---- */
.tgagg .chat-pane .message.message-post{
  width:fit-content;max-width:min(340px,100%);padding:0;overflow:hidden;border-radius:var(--bub-radius);
}
.tgagg .chat-pane .message.in.message-post{
  background:var(--bub-in-bg);color:var(--bub-in-fg);border:1px solid var(--bub-in-border);
  box-shadow:0 1px 2px rgba(15,35,60,.06),0 6px 16px -10px rgba(15,35,60,.28);border-bottom-left-radius:var(--bub-tail);
}
.tgagg .chat-pane .message.out.message-post{
  background:var(--bub-out-bg);color:var(--bub-out-fg);border:1px solid var(--bub-out-border);
  box-shadow:0 1px 2px rgba(15,35,60,.08),0 8px 18px -10px rgba(25,90,140,.45);border-bottom-right-radius:var(--bub-tail);
}
.tgagg .chat-pane .message.message-post .media-photo,
.tgagg .chat-pane .message.message-post .media-video{display:block;border-radius:0;max-width:100%}
.tgagg .chat-pane .message.message-post .media-album-grid{border-radius:0;max-width:100%}
/* the caption wraps inside the width of the picture instead of stretching the bubble */
.tgagg .chat-pane .message.message-post .media-caption{
  width:0;min-width:100%;box-sizing:border-box;padding:7px 12px 6px;background:none;box-shadow:none;border-radius:0;
  font-size:15.5px;line-height:1.45;white-space:pre-wrap;word-break:break-word;
}
.tgagg .chat-pane .message.message-post .media-caption .message-time{
  float:right;margin:6px 0 -2px 10px;padding:0;background:none;box-shadow:none;border-radius:0;color:var(--bub-meta);font-size:11px;
}
/* no caption: the time lies over the picture, bottom right */
.tgagg .chat-pane .message.message-post.no-caption .media-time-row{position:absolute;right:7px;bottom:7px;margin:0;width:auto}
.tgagg .chat-pane .message.message-post.no-caption .message-time{
  margin:0;padding:2px 7px;border-radius:10px;background:rgba(0,0,0,.5);color:#fff;font-size:11px;box-shadow:none;
}
.tgagg .chat-pane .message.message-post .message-reactions{padding:0 10px 7px}

/* ---------- Reactions: a fixed row in the message menu, clickable chips under a bubble ---------- */
.tgagg .message-reaction{cursor:pointer;user-select:none;animation:tgagg-reaction-pop .22s ease-out}
.tgagg .message-reaction:active{filter:brightness(.92)}
@keyframes tgagg-reaction-pop{from{transform:scale(.6);opacity:.4}to{transform:none;opacity:1}}
#messageContextMenu.message-context-menu.has-reactions{width:304px;max-width:calc(100vw - 16px)}
#messageContextMenu.message-context-menu .message-reaction-bar{padding:2px 2px 6px;margin-bottom:4px;border-bottom:1px solid rgba(15,23,42,.1)}
.tgagg.theme-dark #messageContextMenu.message-context-menu .message-reaction-bar{border-bottom-color:rgba(255,255,255,.12)}
#messageContextMenu.message-context-menu .message-reaction-row{display:flex;align-items:center;justify-content:space-between}
#messageContextMenu.message-context-menu button.message-reaction-pick{
  flex:0 0 auto;width:34px;height:34px;display:grid;place-items:center;padding:0;text-align:center;border-radius:10px;
  font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;font-size:21px;line-height:1;cursor:pointer;
}
#messageContextMenu.message-context-menu button.message-reaction-pick:hover{transform:scale(1.18)}
#messageContextMenu.message-context-menu button.message-reaction-pick.is-mine{background:rgba(51,144,236,.22)}
@media(prefers-reduced-motion:reduce){.tgagg .message-reaction{animation:none}}

/* a media block that did not load: a quiet note you can tap */
.tgagg .media-note.media-retry{display:block;width:100%;border:0;font:inherit;text-align:left;cursor:pointer;text-decoration:underline dotted}

/* a deleted message: a quiet card with an icon, not the old picture with a line under it */
.tgagg .message.message-deleted{min-width:150px;max-width:min(260px,82%);padding:8px 12px 6px;background:rgba(100,116,139,.16)!important;border:1px dashed rgba(100,116,139,.45);box-shadow:none!important;color:inherit}
.tgagg .message.message-deleted .deleted-note{display:flex;align-items:center;gap:10px;opacity:.85}
.tgagg .message.message-deleted .deleted-ico{flex:0 0 32px;width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:rgba(100,116,139,.22)}
.tgagg .message.message-deleted .deleted-text{display:flex;flex-direction:column;line-height:1.25;white-space:normal}
.tgagg .message.message-deleted .deleted-text b{font-size:13.5px;font-weight:700;font-style:normal}
.tgagg .message.message-deleted .deleted-text small{font-size:12px;opacity:.75}
.tgagg .message.message-deleted .message-head{display:none}
.tgagg .message.message-deleted .message-time{opacity:.7}

/* A gift that somebody sent to the number (service message of Telegram): a gift box above the text */
.tgagg .media-gift{display:flex;justify-content:center;padding:6px 0 2px}
.tgagg .media-gift svg{width:96px;height:96px;filter:drop-shadow(0 4px 8px rgba(0,0,0,.18))}

/* The chat list can hold hundreds of cards: the ones off the screen are not laid out or painted until they scroll in (the height is remembered once they were seen). */
.tgagg .dialog-list .dialog-card{content-visibility:auto;contain-intrinsic-size:auto 76px}

/* Phones: blurring what lies behind (the scrolling chat, a wallpaper, every date chip and voice bubble) is redone on every frame of a scroll and heats the device.
   The surfaces keep their own colour, only the blur goes. Windows that open for a moment (pickers, dialogs) keep theirs. */
@media (max-width:860px){
  .tgagg .chat-header,.tgagg .date-chip,.tgagg .media-voice-player,.tgagg .media-voice-play,.tgagg .message.message-bigemoji .message-time,.tgagg .empty-card{-webkit-backdrop-filter:none;backdrop-filter:none}
}

/* Press feedback on touch screens: the pressed button or chat card shrinks a little at once, before the request goes out (audit F03-8).
   `scale` is its own property: it adds to any `transform` a button already has and never replaces it. :where keeps the specificity at zero, so every
   control that has its own press style keeps it. */
@media (hover:none) and (pointer:coarse){
  :where(.tgagg){-webkit-tap-highlight-color:transparent}
  :where(.tgagg) :where(button:not(:disabled),[role="button"],.dialog-card):active{scale:.97;transition:scale .08s ease-out}
  :where(.tgagg) :where(.dialog-card):active{scale:.985}
  :where(.tgagg) :where(button,[role="button"],.dialog-card){touch-action:manipulation}
}
@media (prefers-reduced-motion:reduce){
  :where(.tgagg) :where(button,[role="button"],.dialog-card):active{scale:1}
}
