/* Готовые темы Бересты. Специфичность бьёт body.beresta-v2 и inline без !important. */

.theme-select{position:relative;margin:0 0 12px}
.theme-select-toggle{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--field, var(--panel));
  color:var(--text);
  cursor:pointer;
  text-align:left;
  box-sizing:border-box;
}
.theme-select-toggle:hover,
.theme-select.open .theme-select-toggle{border-color:var(--brand)}
.theme-select-copy{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.theme-select-copy strong{font-size:14px;font-weight:650;line-height:1.2}
.theme-select-copy small{font-size:11px;color:var(--muted);line-height:1.25}
.theme-select-caret{color:var(--muted);font-size:12px;transition:transform .15s}
.theme-select.open .theme-select-caret{transform:rotate(180deg)}
.theme-select-menu{
  position:absolute;
  left:0;right:0;
  top:calc(100% + 6px);
  max-height:min(52vh,380px);
  overflow:auto;
  z-index:80;
  padding:6px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel);
  box-shadow:0 16px 40px rgba(0,0,0,.35);
  -webkit-overflow-scrolling:touch;
}
.theme-select-menu[hidden]{display:none !important}
.theme-select-option{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:var(--text);
  cursor:pointer;
  text-align:left;
  box-sizing:border-box;
}
.theme-select-option:hover{background:var(--hover-fill, rgba(255,255,255,.06))}
.theme-select-option.is-active{
  background:rgba(var(--glow-rgb, 0,194,255), .14);
  box-shadow:inset 0 0 0 1px var(--brand);
}
.theme-select-option span{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.theme-select-option strong{font-size:13px;font-weight:650}
.theme-select-option small{font-size:11px;color:var(--muted)}
.theme-preset-swatch{
  display:flex;
  width:56px;
  height:28px;
  border-radius:8px;
  overflow:hidden;
  border:1px solid var(--border);
  flex-shrink:0;
}
.theme-preset-swatch i{flex:1;display:block}

html[data-theme="classic"],
html[data-theme="classic"]:has(body.beresta-v2),
html[data-theme="classic"] body,
html[data-theme="classic"] body.beresta-v2{
  color-scheme:dark;
  --bg:#070b14;
  --panel:#101a2c;
  --sidebar:#0b1426;
  --text:#eef6ff;
  --muted:#a3b3c7;
  --brand:#00c2ff;
  --accent:#8b5cf6;
  --bubble-in:#2b1b63;
  --bubble-out:#005ea6;
  --bubble-out-text:#e9f7ff;
  --button-bg:#0f1a33;
  --button-text:#eef6ff;
  --on-brand:#041018;
  --field:#0b1426;
  --border:#24324d;
  --hover-fill:#152238;
  --glow-rgb:0,194,255;
  --accent-rgb:139,92,246;
  --success:#22c55e;
  --danger:#ff3b30;
  --warn:#f59e0b;
}

html[data-theme="birch"],
html[data-theme="birch"]:has(body.beresta-v2),
html[data-theme="birch"] body,
html[data-theme="birch"] body.beresta-v2{
  color-scheme:dark;
  --bg:#56483c;
  --panel:#231c16;
  --sidebar:#15110e;
  --text:#fffaf2;
  --muted:#d5c3ae;
  --brand:#efc588;
  --accent:#e0b06c;
  --bubble-in:#1c1612;
  --bubble-out:#efc588;
  --bubble-out-text:#1a140e;
  --button-bg:#efc588;
  --button-text:#1a140e;
  --on-brand:#1a140e;
  --field:#1c1612;
  --border:#7d6a56;
  --hover-fill:#3a2e24;
  --glow-rgb:239,197,136;
  --accent-rgb:224,176,108;
  --success:#7dba74;
  --danger:#d36a5c;
  --warn:#d4a85a;
}

html[data-theme="graphite"],
html[data-theme="graphite"]:has(body.beresta-v2),
html[data-theme="graphite"] body,
html[data-theme="graphite"] body.beresta-v2{
  color-scheme:dark;
  --bg:#121417;
  --panel:#1c1f24;
  --sidebar:#16181c;
  --text:#f4f6f8;
  --muted:#9aa3ad;
  --brand:#d7dee6;
  --accent:#8b9aab;
  --bubble-in:#252a31;
  --bubble-out:#3d4652;
  --bubble-out-text:#f4f6f8;
  --button-bg:#2a3038;
  --button-text:#f4f6f8;
  --on-brand:#121417;
  --field:#1a1d22;
  --border:#3a414b;
  --hover-fill:#252a31;
  --glow-rgb:215,222,230;
  --accent-rgb:139,154,171;
}

html[data-theme="taiga"],
html[data-theme="taiga"]:has(body.beresta-v2),
html[data-theme="taiga"] body,
html[data-theme="taiga"] body.beresta-v2{
  color-scheme:dark;
  --bg:#0e1612;
  --panel:#16241c;
  --sidebar:#101c16;
  --text:#e8f3ea;
  --muted:#93b49c;
  --brand:#7dba74;
  --accent:#c4a35a;
  --bubble-in:#1a2e22;
  --bubble-out:#2f6b45;
  --bubble-out-text:#eef8f0;
  --button-bg:#1e3326;
  --button-text:#e8f3ea;
  --on-brand:#0e1612;
  --field:#132019;
  --border:#2c4a38;
  --hover-fill:#1a2e22;
  --glow-rgb:125,186,116;
  --accent-rgb:196,163,90;
}

html[data-theme="aurora"],
html[data-theme="aurora"]:has(body.beresta-v2),
html[data-theme="aurora"] body,
html[data-theme="aurora"] body.beresta-v2{
  color-scheme:dark;
  --bg:#07131a;
  --panel:#0d2230;
  --sidebar:#0a1b26;
  --text:#e7fbff;
  --muted:#8ec9d4;
  --brand:#2ee6c6;
  --accent:#5b8cff;
  --bubble-in:#12343f;
  --bubble-out:#0e6e78;
  --bubble-out-text:#e7fbff;
  --button-bg:#11313c;
  --button-text:#e7fbff;
  --on-brand:#07131a;
  --field:#0b1c24;
  --border:#1e4a58;
  --hover-fill:#12343f;
  --glow-rgb:46,230,198;
  --accent-rgb:91,140,255;
}

html[data-theme="ember"],
html[data-theme="ember"]:has(body.beresta-v2),
html[data-theme="ember"] body,
html[data-theme="ember"] body.beresta-v2{
  color-scheme:dark;
  --bg:#160d0c;
  --panel:#241614;
  --sidebar:#1b1110;
  --text:#fdece6;
  --muted:#d4a398;
  --brand:#e07a5f;
  --accent:#f2cc8f;
  --bubble-in:#3a1d1c;
  --bubble-out:#9a3412;
  --bubble-out-text:#fff4ee;
  --button-bg:#3b1f1c;
  --button-text:#fdece6;
  --on-brand:#fff4ee;
  --field:#1f1210;
  --border:#5c322c;
  --hover-fill:#3a1d1c;
  --glow-rgb:224,122,95;
  --accent-rgb:242,204,143;
}

html[data-theme="paper"],
html[data-theme="paper"]:has(body.beresta-v2),
html[data-theme="paper"] body,
html[data-theme="paper"] body.beresta-v2{
  color-scheme:light;
  --bg:#f3ebe0;
  --panel:#fffaf3;
  --sidebar:#efe4d4;
  --text:#2a2118;
  --muted:#7a6b5c;
  --brand:#b4532a;
  --accent:#3f6b5a;
  --bubble-in:#efe4d4;
  --bubble-out:#d9b48a;
  --bubble-out-text:#2a2118;
  --button-bg:#eadccb;
  --button-text:#2a2118;
  --on-brand:#fffaf3;
  --field:#fffaf3;
  --border:#d7c4ae;
  --hover-fill:#efe4d4;
  --glow-rgb:180,83,42;
  --accent-rgb:63,107,90;
  --success:#3f7d4a;
  --danger:#b42318;
  --warn:#b45309;
  --shadow:0 8px 22px rgba(80,52,28,.12);
}

html[data-theme="nord"],
html[data-theme="nord"]:has(body.beresta-v2),
html[data-theme="nord"] body,
html[data-theme="nord"] body.beresta-v2{
  color-scheme:dark;
  --bg:#2e3440;--panel:#3b4252;--sidebar:#242933;--text:#eceff4;--muted:#a3b3c7;
  --brand:#88c0d0;--accent:#b48ead;--bubble-in:#434c5e;--bubble-out:#5e81ac;--bubble-out-text:#eceff4;
  --button-bg:#3b4252;--button-text:#eceff4;--on-brand:#2e3440;--field:#2e3440;--border:#4c566a;
  --hover-fill:#434c5e;--glow-rgb:136,192,208;--accent-rgb:180,142,173;
}
html[data-theme="sakura"],
html[data-theme="sakura"]:has(body.beresta-v2),
html[data-theme="sakura"] body,
html[data-theme="sakura"] body.beresta-v2{
  color-scheme:dark;
  --bg:#2a1c22;--panel:#3a252e;--sidebar:#22161b;--text:#fde8ef;--muted:#d9a8b8;
  --brand:#e89ab0;--accent:#c97b9a;--bubble-in:#4a2c38;--bubble-out:#b85c78;--bubble-out-text:#fff5f8;
  --button-bg:#3d2730;--button-text:#fde8ef;--on-brand:#2a1c22;--field:#24181d;--border:#5a3844;
  --hover-fill:#4a2c38;--glow-rgb:232,154,176;--accent-rgb:201,123,154;
}
html[data-theme="ocean"],
html[data-theme="ocean"]:has(body.beresta-v2),
html[data-theme="ocean"] body,
html[data-theme="ocean"] body.beresta-v2{
  color-scheme:dark;
  --bg:#041c2c;--panel:#0a2d42;--sidebar:#031824;--text:#d7f1ff;--muted:#7eb3c9;
  --brand:#3ec6e0;--accent:#1b8a9e;--bubble-in:#0d3a52;--bubble-out:#156f8a;--bubble-out-text:#e7fbff;
  --button-bg:#0c3348;--button-text:#d7f1ff;--on-brand:#041c2c;--field:#082536;--border:#1a4d66;
  --hover-fill:#0d3a52;--glow-rgb:62,198,224;--accent-rgb:27,138,158;
}
html[data-theme="amethyst"],
html[data-theme="amethyst"]:has(body.beresta-v2),
html[data-theme="amethyst"] body,
html[data-theme="amethyst"] body.beresta-v2{
  color-scheme:dark;
  --bg:#1a1228;--panel:#261a3a;--sidebar:#140e20;--text:#f3e9ff;--muted:#b9a3d4;
  --brand:#c084fc;--accent:#7c5cbf;--bubble-in:#3a2460;--bubble-out:#6d28d9;--bubble-out-text:#f8f1ff;
  --button-bg:#2a1c44;--button-text:#f3e9ff;--on-brand:#1a1228;--field:#1e1630;--border:#4a3570;
  --hover-fill:#3a2460;--glow-rgb:192,132,252;--accent-rgb:124,92,191;
}
html[data-theme="desert"],
html[data-theme="desert"]:has(body.beresta-v2),
html[data-theme="desert"] body,
html[data-theme="desert"] body.beresta-v2{
  color-scheme:dark;
  --bg:#2a2118;--panel:#3b2e20;--sidebar:#1f1812;--text:#f6ead6;--muted:#cbb48e;
  --brand:#e0b060;--accent:#c4893a;--bubble-in:#4a3826;--bubble-out:#b8860b;--bubble-out-text:#1a140e;
  --button-bg:#3d2f20;--button-text:#f6ead6;--on-brand:#1a140e;--field:#261c14;--border:#5c4a32;
  --hover-fill:#4a3826;--glow-rgb:224,176,96;--accent-rgb:196,137,58;
}
html[data-theme="ink"],
html[data-theme="ink"]:has(body.beresta-v2),
html[data-theme="ink"] body,
html[data-theme="ink"] body.beresta-v2{
  color-scheme:dark;
  --bg:#0a0a0c;--panel:#16161a;--sidebar:#050506;--text:#f2efe8;--muted:#9a958c;
  --brand:#d4af37;--accent:#8a7a4a;--bubble-in:#222226;--bubble-out:#6b5420;--bubble-out-text:#f2efe8;
  --button-bg:#1c1c20;--button-text:#f2efe8;--on-brand:#0a0a0c;--field:#121214;--border:#2e2e34;
  --hover-fill:#222226;--glow-rgb:212,175,55;--accent-rgb:138,122,74;
}
html[data-theme="cobalt"],
html[data-theme="cobalt"]:has(body.beresta-v2),
html[data-theme="cobalt"] body,
html[data-theme="cobalt"] body.beresta-v2{
  color-scheme:dark;
  --bg:#0c1428;--panel:#162040;--sidebar:#0a1020;--text:#e8eeff;--muted:#8fa0c8;
  --brand:#4d7cff;--accent:#7aa2ff;--bubble-in:#1c2c58;--bubble-out:#2a4db3;--bubble-out-text:#e8eeff;
  --button-bg:#1a2748;--button-text:#e8eeff;--on-brand:#e8eeff;--field:#101830;--border:#2a3c68;
  --hover-fill:#1c2c58;--glow-rgb:77,124,255;--accent-rgb:122,162,255;
}
html[data-theme="amber"],
html[data-theme="amber"]:has(body.beresta-v2),
html[data-theme="amber"] body,
html[data-theme="amber"] body.beresta-v2{
  color-scheme:dark;
  --bg:#1c1408;--panel:#2a1e0c;--sidebar:#161008;--text:#fff3dc;--muted:#d4b27a;
  --brand:#f0a020;--accent:#e07820;--bubble-in:#3a2a10;--bubble-out:#c47812;--bubble-out-text:#1a1408;
  --button-bg:#2e220e;--button-text:#fff3dc;--on-brand:#1a1408;--field:#22180a;--border:#5a4020;
  --hover-fill:#3a2a10;--glow-rgb:240,160,32;--accent-rgb:224,120,32;
}
html[data-theme="clay"],
html[data-theme="clay"]:has(body.beresta-v2),
html[data-theme="clay"] body,
html[data-theme="clay"] body.beresta-v2{
  color-scheme:dark;
  --bg:#241814;--panel:#33241e;--sidebar:#1c1410;--text:#f6e8e0;--muted:#c4a090;
  --brand:#d4785a;--accent:#a85a40;--bubble-in:#4a3028;--bubble-out:#b45c40;--bubble-out-text:#fff4ee;
  --button-bg:#3a2820;--button-text:#f6e8e0;--on-brand:#fff4ee;--field:#2a1c18;--border:#5c4034;
  --hover-fill:#4a3028;--glow-rgb:212,120,90;--accent-rgb:168,90,64;
}
html[data-theme="snow"],
html[data-theme="snow"]:has(body.beresta-v2),
html[data-theme="snow"] body,
html[data-theme="snow"] body.beresta-v2{
  color-scheme:light;
  --bg:#eef2f6;--panel:#ffffff;--sidebar:#e4eaf0;--text:#1c2430;--muted:#5b6778;
  --brand:#3d6d99;--accent:#5b8c6a;--bubble-in:#dce5ee;--bubble-out:#9bb8d4;--bubble-out-text:#1c2430;
  --button-bg:#d8e2ec;--button-text:#1c2430;--on-brand:#ffffff;--field:#ffffff;--border:#c5d0dc;
  --hover-fill:#e4eaf0;--glow-rgb:61,109,153;--accent-rgb:91,140,106;
  --shadow:0 8px 22px rgba(28,36,48,.1);
}
html[data-theme="matcha"],
html[data-theme="matcha"]:has(body.beresta-v2),
html[data-theme="matcha"] body,
html[data-theme="matcha"] body.beresta-v2{
  color-scheme:light;
  --bg:#e8efe4;--panel:#f6faf2;--sidebar:#dce6d6;--text:#243028;--muted:#66786a;
  --brand:#5d8a5a;--accent:#c4a35a;--bubble-in:#d4e2ce;--bubble-out:#a3c99a;--bubble-out-text:#243028;
  --button-bg:#d5e4d0;--button-text:#243028;--on-brand:#f6faf2;--field:#f6faf2;--border:#b7c8b0;
  --hover-fill:#dce6d6;--glow-rgb:93,138,90;--accent-rgb:196,163,90;
  --shadow:0 8px 22px rgba(36,48,40,.1);
}

html[data-theme] body,
html[data-theme] body.beresta-v2,
html[data-theme] .app,
html[data-theme] .sidebar,
html[data-theme] .main,
html[data-theme] .topbar,
html[data-theme] .header{
  background:var(--bg);
  color:var(--text);
}
html[data-theme] .sidebar{background:var(--sidebar) !important;border-color:var(--border) !important}
html[data-theme] .topbar,
html[data-theme] .header,
html[data-theme] .compose,
html[data-theme] body.beresta-v2 .compose{
  background:var(--panel) !important;
  border-color:var(--border) !important;
  color:var(--text);
}

html[data-theme] .main{
  background:
    radial-gradient(1200px 800px at 100% -60%, rgba(var(--glow-rgb), .14), transparent),
    radial-gradient(900px 700px at -10% 10%, rgba(var(--accent-rgb), .10), transparent),
    var(--bg) !important;
}

html[data-theme] .btn,
html[data-theme] .iconbtn,
html[data-theme] body.beresta-v2 .btn,
html[data-theme] body.beresta-v2 .iconbtn,
html[data-theme] body.beresta-v2 .modal .btn,
html[data-theme] body.beresta-v2 .auth .btn,
html[data-theme] .kfx-pill,
html[data-theme] body.beresta-v2 .kfx-pill,
html[data-theme] .compose .icon,
html[data-theme] body.beresta-v2 .compose .icon{
  background:var(--button-bg) !important;
  color:var(--button-text) !important;
  border-color:var(--border) !important;
  box-shadow:none;
}

html[data-theme] .btn:hover,
html[data-theme] .iconbtn:hover,
html[data-theme] body.beresta-v2 .btn:hover,
html[data-theme] body.beresta-v2 .iconbtn:hover,
html[data-theme] .kfx-pill:hover,
html[data-theme] body.beresta-v2 .kfx-pill:hover,
html[data-theme] .compose .icon:hover,
html[data-theme] body.beresta-v2 .compose .icon:hover,
html[data-theme] .actions-menu-item:hover:not(:disabled),
html[data-theme] .msg-menu-item:hover:not(:disabled),
html[data-theme] .folder-menu button:hover,
html[data-theme] .document-preview:hover{
  background:var(--hover-fill) !important;
  border-color:var(--brand) !important;
  color:var(--text) !important;
  box-shadow:0 0 16px rgba(var(--glow-rgb), .18) !important;
}

html[data-theme] .btn.primary,
html[data-theme] .btn.primary:hover,
html[data-theme] body.beresta-v2 .btn.primary,
html[data-theme] body.beresta-v2 .btn[style*="background:var(--brand)"],
html[data-theme] body.beresta-v2 .modal .btn[style*="background:var(--brand)"],
html[data-theme] body.beresta-v2 .modal .btn[style*="background: var(--brand)"],
html[data-theme] body.beresta-v2 .auth .btn[style*="background:var(--brand)"],
html[data-theme] body.beresta-v2 .modal .btn.btn-play,
html[data-theme] .compose button[type="submit"],
html[data-theme] body.beresta-v2 .compose button[type="submit"]{
  background:var(--brand) !important;
  border-color:transparent !important;
  color:var(--on-brand) !important;
}

html[data-theme] .btn[style*="background:var(--danger)"],
html[data-theme] .btn[style*="#dc2626"],
html[data-theme] body.beresta-v2 .modal .btn[style*="background:var(--danger)"]{
  background:var(--danger) !important;
  border-color:transparent !important;
  color:#fff !important;
}

html[data-theme] input:not([type=color]):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]),
html[data-theme] textarea,
html[data-theme] select,
html[data-theme] body.beresta-v2 .search input,
html[data-theme] body.beresta-v2 .compose textarea,
html[data-theme] body.beresta-v2 .modal input:not([type=color]):not([type=checkbox]):not([type=radio]),
html[data-theme] body.beresta-v2 .modal textarea,
html[data-theme] body.beresta-v2 .auth input{
  background:var(--field) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}
html[data-theme] input:focus,
html[data-theme] textarea:focus,
html[data-theme] select:focus,
html[data-theme] body.beresta-v2 .search input:focus,
html[data-theme] body.beresta-v2 .compose textarea:focus,
html[data-theme] #messageSearchInput:focus{
  border-color:var(--brand) !important;
  box-shadow:0 0 0 3px rgba(var(--glow-rgb), .14) !important;
}

html[data-theme] .modal .card,
html[data-theme] .auth .card,
html[data-theme] body.beresta-v2 .modal .card,
html[data-theme] body.beresta-v2 .auth .card,
html[data-theme] .actions-menu,
html[data-theme] .msg-menu,
html[data-theme] .folder-menu,
html[data-theme] .compose-media-menu,
html[data-theme] .sidebar-more-menu{
  background:var(--panel) !important;
  border-color:var(--border) !important;
  color:var(--text) !important;
  box-shadow:0 16px 40px rgba(0,0,0,.35) !important;
}
html[data-theme] .modal .card::before{opacity:.35}
html[data-theme] body.beresta-v2 .modal .card::before{display:none !important}

html[data-theme] .kfx-status,
html[data-theme] .kfx-hint,
html[data-theme] .muted{color:var(--muted)}

html[data-theme] .select-badge,
html[data-theme] .notebook-folder-item .select-badge{
  background:var(--field) !important;
  border-color:var(--border) !important;
  color:var(--text) !important;
}
html[data-theme] .chat-item.selected,
html[data-theme] .notebook-folder-item.selected{
  outline-color:var(--brand);
  background:rgba(var(--glow-rgb), .12) !important;
}
html[data-theme] .pinned-message{background:rgba(var(--glow-rgb), .1) !important}
html[data-theme] .reaction-btn{background:var(--panel) !important;border-color:var(--border) !important;color:var(--text) !important}
html[data-theme] .reaction-btn:hover,
html[data-theme] .reaction-btn.active{
  background:var(--brand) !important;
  border-color:var(--brand) !important;
  color:var(--on-brand) !important;
}

html[data-theme] .voice-message-card,
html[data-theme] body.beresta-v2 .voice-message-card{
  background:var(--field) !important;
  border-color:rgba(var(--glow-rgb), .28) !important;
}
html[data-theme] .out .bubble .voice-message-card,
html[data-theme] body.beresta-v2 .out .bubble .voice-message-card{
  background:rgba(var(--glow-rgb), .18) !important;
}
html[data-theme] .folder-chats-list,
html[data-theme] body.beresta-v2 .folder-chats-list{
  background:var(--field) !important;
  border-color:var(--border) !important;
}

html[data-theme] .auth [style*="rgba(42,171,238"],
html[data-theme] .auth [style*="#2aabee"],
html[data-theme] body.beresta-v2 .auth .card > div[style*="rgba(42,171,238"]{
  background:rgba(var(--glow-rgb), .14) !important;
  border-color:rgba(var(--glow-rgb), .35) !important;
  box-shadow:none !important;
}

html[data-theme] .btn::before,
html[data-theme] .iconbtn::before,
html[data-theme] .compose .icon::before,
html[data-theme] .compose button[type="submit"]::before{
  background:radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(var(--glow-rgb), .22) 0%, transparent 70%) !important;
}

html[data-theme="paper"] .btn:hover,
html[data-theme="paper"] .iconbtn:hover,
html[data-theme="paper"] .chat-item:hover,
html[data-theme="paper"] .kfx-pill:hover,
html[data-theme="paper"] .actions-menu-item:hover:not(:disabled),
html[data-theme="snow"] .btn:hover,
html[data-theme="snow"] .iconbtn:hover,
html[data-theme="snow"] .chat-item:hover,
html[data-theme="matcha"] .btn:hover,
html[data-theme="matcha"] .iconbtn:hover,
html[data-theme="matcha"] .chat-item:hover{
  background:var(--hover-fill) !important;
  color:var(--text) !important;
  box-shadow:none !important;
}
html[data-theme="paper"] .btn.primary,
html[data-theme="paper"] .compose button[type="submit"],
html[data-theme="snow"] .btn.primary,
html[data-theme="snow"] .compose button[type="submit"],
html[data-theme="matcha"] .btn.primary,
html[data-theme="matcha"] .compose button[type="submit"]{
  color:var(--on-brand) !important;
}

html[data-theme] .theme-select-toggle,
html[data-theme] body.beresta-v2 .theme-select-toggle{
  background:var(--field, var(--panel)) !important;
  color:var(--text) !important;
  border:1px solid var(--border) !important;
  box-shadow:none !important;
}
html[data-theme] .theme-select-option,
html[data-theme] body.beresta-v2 .theme-select-option{
  background:transparent !important;
  color:var(--text) !important;
  border:0 !important;
  box-shadow:none !important;
}
html[data-theme] .theme-select-option:hover{background:var(--hover-fill) !important}
html[data-theme] .theme-select-option.is-active{
  background:rgba(var(--glow-rgb), .14) !important;
}

/* Форма пузырей зависит от темы, не только цвета */
html[data-theme]{
  --bubble-radius:12px;
  --bubble-tail:4px;
  --bubble-pad:8px 11px 6px;
  --bubble-border:none;
  --bubble-shadow:none;
  --bubble-hover-shadow:none;
  --bubble-hover-lift:none;
  --bubble-font:14.5px;
  --msg-gap:6px;
  --bubble-media-radius:6px;
  --bubble-trans:background .15s ease, color .15s ease;
}

html[data-theme="classic"]{
  --bubble-radius:12px;
  --bubble-tail:12px;
  --bubble-pad:10px 12px;
  --bubble-border:1px solid rgba(255,255,255,.06);
  --bubble-shadow:var(--shadow), 0 0 0 rgba(var(--glow-rgb), 0);
  --bubble-hover-shadow:var(--shadow), 0 0 20px rgba(var(--glow-rgb), .16), 0 0 40px rgba(var(--glow-rgb), .08);
  --bubble-hover-lift:translateY(-1px);
  --bubble-font:15px;
  --msg-gap:10px;
  --bubble-media-radius:10px;
  --bubble-trans:box-shadow .3s cubic-bezier(.4,0,.2,1), transform .3s cubic-bezier(.4,0,.2,1);
}

html[data-theme="birch"],
html[data-theme="ember"],
html[data-theme="desert"],
html[data-theme="amber"],
html[data-theme="clay"]{
  --bubble-radius:6px;
  --bubble-tail:2px;
  --bubble-pad:6px 9px 4px;
  --bubble-border:none;
  --bubble-shadow:none;
  --bubble-hover-shadow:none;
  --bubble-hover-lift:none;
  --bubble-font:14.5px;
  --msg-gap:5px;
  --bubble-media-radius:4px;
}

html[data-theme="graphite"],
html[data-theme="ink"]{
  --bubble-radius:4px;
  --bubble-tail:4px;
  --bubble-pad:8px 10px;
  --bubble-border:1px solid var(--border);
  --bubble-shadow:none;
  --bubble-hover-shadow:none;
  --bubble-hover-lift:none;
  --bubble-font:14.5px;
  --msg-gap:8px;
  --bubble-media-radius:2px;
}

html[data-theme="nord"]{
  --bubble-radius:12px;
  --bubble-tail:3px;
  --bubble-pad:8px 11px 6px;
  --bubble-border:none;
  --bubble-shadow:none;
  --bubble-hover-shadow:none;
  --bubble-hover-lift:none;
  --bubble-font:15px;
  --msg-gap:6px;
  --bubble-media-radius:8px;
}

html[data-theme="taiga"],
html[data-theme="matcha"]{
  --bubble-radius:18px;
  --bubble-tail:8px;
  --bubble-pad:9px 13px 7px;
  --bubble-border:none;
  --bubble-shadow:0 2px 10px rgba(0,0,0,.12);
  --bubble-hover-shadow:0 2px 10px rgba(0,0,0,.12);
  --bubble-hover-lift:none;
  --bubble-font:15px;
  --msg-gap:8px;
  --bubble-media-radius:12px;
}

html[data-theme="sakura"],
html[data-theme="amethyst"]{
  --bubble-radius:22px;
  --bubble-tail:22px;
  --bubble-pad:9px 16px 8px;
  --bubble-border:none;
  --bubble-shadow:none;
  --bubble-hover-shadow:none;
  --bubble-hover-lift:none;
  --bubble-font:15px;
  --msg-gap:8px;
  --bubble-media-radius:16px;
}

html[data-theme="ocean"],
html[data-theme="aurora"],
html[data-theme="cobalt"]{
  --bubble-radius:16px;
  --bubble-tail:5px;
  --bubble-pad:9px 12px 7px;
  --bubble-border:1px solid rgba(255,255,255,.08);
  --bubble-shadow:0 6px 16px rgba(0,0,0,.22);
  --bubble-hover-shadow:0 6px 16px rgba(0,0,0,.22), 0 0 16px rgba(var(--glow-rgb), .18);
  --bubble-hover-lift:none;
  --bubble-font:15px;
  --msg-gap:8px;
  --bubble-media-radius:10px;
}

html[data-theme="paper"],
html[data-theme="snow"]{
  --bubble-radius:10px;
  --bubble-tail:3px;
  --bubble-pad:8px 11px 6px;
  --bubble-border:1px solid var(--border);
  --bubble-shadow:0 1px 2px rgba(0,0,0,.06);
  --bubble-hover-shadow:0 1px 2px rgba(0,0,0,.06);
  --bubble-hover-lift:none;
  --bubble-font:15px;
  --msg-gap:7px;
  --bubble-media-radius:6px;
}

html[data-theme] .messages,
html[data-theme] body.beresta-v2 .messages{
  gap:var(--msg-gap, 6px) !important;
}

html[data-theme] .bubble,
html[data-theme] body.beresta-v2 .bubble{
  padding:var(--bubble-pad) !important;
  border:var(--bubble-border) !important;
  box-shadow:var(--bubble-shadow) !important;
  font-size:var(--bubble-font);
  line-height:1.4;
  transition:var(--bubble-trans);
}

html[data-theme] .msg.in .bubble,
html[data-theme] body.beresta-v2 .msg.in .bubble{
  border-radius:var(--bubble-radius) var(--bubble-radius) var(--bubble-radius) var(--bubble-tail) !important;
}

html[data-theme] .msg.out .bubble,
html[data-theme] body.beresta-v2 .msg.out .bubble{
  border-radius:var(--bubble-radius) var(--bubble-radius) var(--bubble-tail) var(--bubble-radius) !important;
  color:var(--bubble-out-text);
}

html[data-theme] .bubble:hover,
html[data-theme] body.beresta-v2 .bubble:hover{
  transform:var(--bubble-hover-lift) !important;
  box-shadow:var(--bubble-hover-shadow) !important;
}

html[data-theme="classic"] .out .bubble:hover,
html[data-theme="classic"] body.beresta-v2 .out .bubble:hover{
  box-shadow:var(--shadow), 0 0 20px rgba(var(--glow-rgb), .22), 0 0 40px rgba(var(--glow-rgb), .1) !important;
}

html[data-theme] .bubble img,
html[data-theme] .bubble video,
html[data-theme] body.beresta-v2 .bubble img,
html[data-theme] body.beresta-v2 .bubble video{
  border-radius:var(--bubble-media-radius) !important;
}

html[data-theme] .reply-preview,
html[data-theme] body.beresta-v2 .reply-preview{
  border-radius:max(2px, calc(var(--bubble-radius) - 2px)) !important;
}

html[data-theme] .msg.voice-only .bubble,
html[data-theme] .msg.voice-only .bubble:hover,
html[data-theme] body.beresta-v2 .msg.voice-only .bubble,
html[data-theme] body.beresta-v2 .msg.voice-only .bubble:hover,
html[data-theme] .bubble[style*="padding:0"],
html[data-theme] .bubble[style*="padding:0"]:hover,
html[data-theme] body.beresta-v2 .bubble[style*="padding:0"],
html[data-theme] body.beresta-v2 .bubble[style*="padding:0"]:hover{
  padding:0 !important;
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
  transform:none !important;
}
