:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --text: #1c2733;
  --muted: #6b7a8a;
  --line: #dde3ea;
  --primary: #0b6bcb;
  --primary-d: #0957a6;
  --primary-l: #e3effb;
  --me: #dcf3e4;
  --danger: #c62828;
  --warn: #b26a00;
  --ok: #2e7d32;
  --radius: 12px;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --card: #ffffff;
  --card2: #f5f7fa;
  --card3: #eef1f4;
  --hover: #fafcfe;
  --primary-l2: #d3e6f9;
  --err-bg: #fdecea;
  --ok-bg: #e7f5ea;
  --warn-bg: #fff4e0;
  --banner: #fff8e1;
  --banner-line: #f3e1a6;
  --ph: #9aa7b4;
  --day: rgba(19, 40, 61, .08);
  --file: rgba(11, 107, 203, .07);
  --nav: #13283d;
  color-scheme: light;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 16px; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; }
button, a { touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.hidden { display: none !important; }

/* ---------- кнопки и поля ---------- */
.btn { border: 0; border-radius: 10px; padding: 12px 18px; background: var(--primary); color: #fff;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--primary-d); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.light { background: var(--primary-l); color: var(--primary); }
.btn.light:hover { background: var(--primary-l2); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--primary); padding: 8px 10px; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 8px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: var(--card); outline: none; font-size: 16px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.err { background: var(--err-bg); color: var(--danger); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 15px; }
.okmsg { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 15px; }

/* ---------- вход ---------- */
.auth { min-height: 100%; display: flex; }
.auth-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-brand { display: none; }
@media (min-width: 900px) {
  .auth-brand { display: flex; flex: 0 0 44%; align-items: center; justify-content: center; color: #fff; position: relative; overflow: hidden;
    background: radial-gradient(circle at 20% 15%, #1d5fa3 0, transparent 45%), radial-gradient(circle at 85% 90%, #0b6bcb 0, transparent 40%), linear-gradient(160deg, #13283d, #0b1824); }
  .auth-brand:after { content: ""; position: absolute; inset: 0; opacity: .07;
    background-image: linear-gradient(rgba(255,255,255,1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,1) 1px, transparent 1px);
    background-size: 36px 36px; }
  .auth-brand-in { position: relative; z-index: 1; text-align: center; padding: 40px; }
  .auth-brand img { width: 120px; height: 120px; border-radius: 28px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
  .auth-brand-name { font-size: 34px; font-weight: 800; margin-top: 22px; letter-spacing: .3px; }
  .auth-brand-org { opacity: .75; margin-top: 6px; font-size: 16px; }
  .auth-brand-chips { display: flex; gap: 10px; justify-content: center; margin-top: 26px; }
  .auth-brand-chips span { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); padding: 8px 14px; border-radius: 20px; font-size: 14px; }
  .auth-side .auth-card { box-shadow: none; background: transparent; }
  .auth-side .dup { display: none; }
  .auth-side h1.desk-only { text-align: left; font-size: 26px; margin: 0 0 22px; }
  .auth-side .langs { justify-content: flex-start; }
}
@media (max-width: 899px) { .desk-only { display: none; } }
.lock-ava { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-size: 28px; font-weight: 700; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 18px; padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(20, 40, 70, .1); }
.logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 12px; display: block; }
.auth h1 { text-align: center; margin: 0 0 4px; font-size: 22px; }
.auth .org { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.langs { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; }
.langs button { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.langs button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.auth .switch { text-align: center; margin-top: 14px; }

/* ---------- каркас ---------- */
.app { position: fixed; inset: 0; display: flex; overflow: hidden; }
.nav { background: var(--nav); color: #c9d6e3; display: flex; }
.nav button { background: none; border: 0; color: inherit; cursor: pointer; display: flex; align-items: center; gap: 10px;
  position: relative; }
.nav button.on { color: #fff; }
.nav .ico { font-size: 22px; line-height: 1; }
.nav .badge { position: absolute; background: #e53935; color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 6px; }
.main { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center;
  gap: 10px; min-height: 56px; }
.topbar h2 { margin: 0; font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { max-width: 900px; margin: 0 auto; padding: 16px; }

@media (max-width: 899px) {
  .app { flex-direction: column-reverse; }
  .nav { height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); justify-content: space-around; flex-shrink: 0; }
  .nav button { flex-direction: column; gap: 3px; font-size: 11.5px; padding: 8px 4px; flex: 1; }
  .nav .brand { display: none; }
  .nav .badge { top: 4px; left: 55%; }
}
@media (min-width: 900px) {
  .nav { width: 230px; flex-direction: column; padding: 16px 10px; gap: 4px; flex-shrink: 0; }
  .nav .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 6px 10px 18px; }
  .nav .brand img { width: 34px; height: 34px; border-radius: 8px; }
  .nav button { padding: 11px 12px; border-radius: 10px; font-size: 15px; }
  .nav button:hover { background: rgba(255, 255, 255, .06); }
  .nav button.on { background: rgba(255, 255, 255, .12); }
  .nav .badge { right: 10px; }
}

/* ---------- чат ---------- */
.chat { padding: 12px 12px 6px; max-width: 900px; margin: 0 auto; width: 100%; }
.day { text-align: center; margin: 14px 0 8px; }
.day span { background: var(--day); color: var(--muted); font-size: 12.5px; padding: 3px 10px; border-radius: 10px; }
.msg { display: flex; gap: 8px; margin: 6px 0; align-items: flex-end; }
.msg.me { flex-direction: row-reverse; }
.ava { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; }
.bubble { background: var(--panel); border-radius: 14px; padding: 8px 12px 6px; max-width: min(78%, 620px);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .06); position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--me); }
.bubble .who { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.bubble .who small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.bubble .tag { background: var(--primary); color: #fff; font-size: 10.5px; border-radius: 6px; padding: 1px 5px; margin-left: 6px; font-weight: 600; }
.bubble .txt { white-space: pre-wrap; line-height: 1.38; }
.bubble .meta { font-size: 11.5px; color: var(--muted); text-align: right; margin-top: 3px; display: flex; gap: 8px;
  justify-content: flex-end; align-items: center; }
.bubble .del { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0 2px; font-size: 13px; }
.bubble .del:hover { color: var(--danger); }
.bubble img.photo { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 4px 0; cursor: zoom-in; }
.file { display: flex; gap: 10px; align-items: center; background: var(--file); border-radius: 10px; padding: 8px 10px;
  margin: 4px 0; text-decoration: none; color: var(--text); }
.file .fi { font-size: 24px; }
.file small { color: var(--muted); display: block; }
.more { text-align: center; margin: 8px 0; }

.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 10px; }
.composer .inner { max-width: 900px; margin: 0 auto; }
.tools { display: flex; gap: 2px; margin-bottom: 6px; flex-wrap: wrap; }
.tools button { border: 0; background: none; width: 36px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.tools button:hover, .tools button.on { background: var(--primary-l); }
.row { display: flex; gap: 8px; align-items: flex-end; }
.editor { flex: 1; min-height: 44px; max-height: 160px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; outline: none; background: var(--card); line-height: 1.38; white-space: pre-wrap; word-break: break-word; }
.editor:empty:before { content: attr(data-ph); color: var(--ph); }
.editor:focus { border-color: var(--primary); }
.sendbtn { width: 46px; height: 46px; border-radius: 50%; padding: 0; font-size: 20px; flex-shrink: 0; }
.pending { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.pending .chip { background: var(--primary-l); border-radius: 8px; padding: 5px 8px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.pending .chip button { border: 0; background: none; cursor: pointer; color: var(--danger); }
.emoji-pop { position: absolute; bottom: 100%; left: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12); padding: 8px; display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; z-index: 20;
  max-height: 260px; overflow-y: auto; }
.emoji-pop button { border: 0; background: none; font-size: 22px; height: 36px; cursor: pointer; border-radius: 8px; }
.emoji-pop button:hover { background: var(--primary-l); }
.muted-note { color: var(--warn); font-size: 14px; padding: 8px 4px; text-align: center; }

/* ---------- KV_BOT ---------- */
.kv-card img { display: block; width: 100%; max-width: 420px; border-radius: 8px; border: 1px solid var(--line); background: #ffffff;
  cursor: zoom-in; min-height: 120px; }
.kv-card .btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.kv-panel { background: var(--panel); border-top: 1px solid var(--line); padding: 10px; }
.kv-panel .inner { max-width: 900px; margin: 0 auto; }
.years { display: flex; gap: 6px; margin-bottom: 8px; }
.years button { border: 1px solid var(--line); background: var(--card); border-radius: 18px; padding: 5px 14px; cursor: pointer; font-weight: 600; }
.years button.on { background: #13283d; color: #fff; border-color: #13283d; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; max-height: 112px; overflow-y: auto; }
.chips button { border: 1px solid var(--primary); color: var(--primary); background: var(--card); border-radius: 20px; padding: 9px 16px;
  cursor: pointer; font-weight: 600; font-size: 15px; }
.chips button:hover { background: var(--primary-l); }
.bot-ava { background: #13283d; }

/* ---------- карточки / настройки ---------- */
.card { background: var(--panel); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.card h3 { margin: 0 0 14px; font-size: 17px; }
.kvrow { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kvrow:last-child { border-bottom: 0; }
.kvrow span:first-child { color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 9px 16px; cursor: pointer; }
.seg button.on { background: var(--primary); color: #fff; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.45; }

/* ---------- админка ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 12px; }
.tabs button { border: 0; background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; white-space: nowrap; font-weight: 600; color: var(--muted); }
.tabs button.on { background: #13283d; color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters .input { width: auto; flex: 1; min-width: 180px; padding: 10px 12px; }
.filters select.input { flex: 0 1 220px; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; font-size: 14.5px; }
.tbl th { text-align: left; background: var(--card2); color: var(--muted); font-weight: 600; padding: 10px; font-size: 13px; }
.tbl td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: var(--hover); }
.tblwrap { overflow-x: auto; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.st { display: inline-block; font-size: 12px; border-radius: 6px; padding: 2px 7px; margin: 1px 2px 1px 0; font-weight: 600; }
.st.active { background: var(--ok-bg); color: var(--ok); }
.st.new, .st.code { background: var(--card3); color: var(--muted); }
.st.blocked { background: var(--err-bg); color: var(--danger); }
.st.locked, .st.muted { background: var(--warn-bg); color: var(--warn); }
.st.admin { background: var(--primary-l); color: var(--primary); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; color: var(--muted); }
.menu { position: fixed; background: var(--card); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .18); padding: 6px; z-index: 50; min-width: 240px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--primary-l); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13.5px; }
.bar { height: 8px; background: var(--card3); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--primary); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } .hide-sm { display: none; } }

/* ---------- модальные окна ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 20, 30, .45); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px; }
.modal { background: var(--card); border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 14px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.bigcode { font-size: 34px; font-weight: 800; letter-spacing: 4px; text-align: center; padding: 14px; background: var(--primary-l);
  border-radius: 12px; margin: 10px 0; color: var(--primary-d); }
.viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 200; overflow: hidden; touch-action: none;
  user-select: none; -webkit-user-select: none; cursor: grab; }
.viewer:active { cursor: grabbing; }
.viewer img { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; max-width: none; max-height: none;
  -webkit-user-drag: none; pointer-events: none; }
.viewer .vbtn { position: absolute; background: rgba(20, 30, 40, .72); box-shadow: 0 2px 10px rgba(0,0,0,.3); color: #fff; border: 0; width: 46px; height: 46px;
  border-radius: 50%; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.viewer .vbtn:active { background: rgba(20, 30, 40, .9); }
.viewer .vbtn.x { top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }
.viewer .vzoom { position: absolute; right: 12px; bottom: calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; }
.viewer .vzoom .vbtn { position: static; font-size: 28px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + var(--safe-b)); transform: translateX(-50%); background: #13283d;
  color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 300; max-width: 90%; text-align: center; font-size: 15px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2); }
.banner { background: var(--banner); border-bottom: 1px solid var(--banner-line); padding: 10px 14px; display: flex; gap: 10px; align-items: center; font-size: 14.5px; }
.banner .t { flex: 1; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--primary-l); border-top-color: var(--primary); border-radius: 50%;
  animation: sp 0.8s linear infinite; margin: 20px auto; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- PIN-код ---------- */
.pin { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 22px 16px calc(22px + var(--safe-b));
  background: var(--bg); }
.pin .langs { margin-bottom: 26px; }
.pin .logo { width: 56px; height: 56px; }
.pin-hello { font-size: 17px; color: var(--muted); margin-bottom: 4px; }
.pin-title { font-size: 21px; font-weight: 700; margin: 6px 0 20px; text-align: center; }
.dots { display: flex; gap: 20px; margin-bottom: 10px; }
.dots span { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--primary); transition: background .12s; }
.dots span.on { background: var(--primary); }
.dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.pin-err { min-height: 22px; color: var(--danger); font-size: 14.5px; text-align: center; margin-bottom: 8px; max-width: 320px; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 28px; margin-top: 6px; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--card); font-size: 30px; font-weight: 500;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); user-select: none; -webkit-user-select: none; }
.keypad button:active { background: var(--primary-l); }
.keypad button.fn { background: transparent; box-shadow: none; font-size: 26px; color: var(--muted); }
.pin-links { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pin-lock { font-size: 54px; margin: 20px 0 14px; }
.pin .err { max-width: 340px; text-align: center; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr; } }
@media (max-height: 640px) { .keypad { grid-template-columns: repeat(3, 66px); gap: 10px 24px; } .keypad button { width: 66px; height: 66px; font-size: 26px; } }

/* ---------- тёмная тема ---------- */
html[data-theme="dark"] {
  --bg: #0f1720;
  --panel: #18222d;
  --card: #1e2a36;
  --card2: #233140;
  --card3: #2a3a4a;
  --hover: #233140;
  --text: #e3e9ef;
  --muted: #8fa1b3;
  --line: #2c3b4a;
  --primary: #3b8fe0;
  --primary-d: #2f7bc6;
  --primary-l: #1d3550;
  --primary-l2: #24415f;
  --me: #1f3d2c;
  --danger: #ef6b6b;
  --warn: #f0b04a;
  --ok: #5cc27a;
  --err-bg: #3a1f22;
  --ok-bg: #1d3526;
  --warn-bg: #3a2e18;
  --banner: #2e2a1a;
  --banner-line: #4a4128;
  --ph: #6a7c8e;
  --day: rgba(255, 255, 255, .08);
  --file: rgba(59, 143, 224, .14);
  --nav: #0b121a;
  color-scheme: dark;
}
html[data-theme="dark"] .bubble { box-shadow: none; }
html[data-theme="dark"] .years button.on, html[data-theme="dark"] .tabs button.on { background: var(--primary); border-color: var(--primary); }
html[data-theme="dark"] .bot-ava { background: #2a3a4a; }
html[data-theme="dark"] .auth-card { box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .toast { background: #2a3a4a; }
html[data-theme="dark"] .keypad button { box-shadow: none; }

/* ---------- KV_BOT: строка месяцев и окно «Все» ---------- */
.chips.one { flex-wrap: nowrap; overflow-x: auto; max-height: none; scrollbar-width: none; }
.chips.one::-webkit-scrollbar { display: none; }
.chips.one button { white-space: nowrap; flex: 1 1 auto; padding: 9px 10px; font-size: 14.5px; }
.chips.one { gap: 6px; }
.chips button.all { background: var(--primary-l); border-color: var(--primary-l); }
.sheet-ov { position: fixed; inset: 0; background: rgba(10, 20, 30, .45); z-index: 120; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--panel); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 10px 16px calc(18px + var(--safe-b));
  animation: sheetUp .2s ease-out; }
@media (min-width: 900px) { .sheet-ov { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 17px; }
.mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mgrid button { border: 1px solid var(--primary); color: var(--primary); background: var(--card); border-radius: 12px; padding: 13px 0;
  font-size: 15px; font-weight: 600; cursor: pointer; }
.mgrid button:hover { background: var(--primary-l); }
.mgrid button.cur { background: var(--primary); color: #fff; }
.mgrid button.off { border-color: transparent; background: var(--card3); color: var(--muted); cursor: default; font-weight: 500; }
@media (max-width: 420px) { .chips.one button { padding: 8px 8px; font-size: 13.5px; } }

/* ---------- ответы в группе ---------- */
.quote { border-left: 3px solid var(--primary); background: var(--file); border-radius: 0 8px 8px 0; padding: 4px 8px; margin: 2px 0 5px;
  cursor: pointer; font-size: 13.5px; max-width: 100%; overflow: hidden; }
.quote b { display: block; color: var(--primary); font-size: 12.5px; }
.quote span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.replybar { display: flex; align-items: center; gap: 8px; border-left: 3px solid var(--primary); background: var(--file);
  border-radius: 0 10px 10px 0; padding: 4px 4px 4px 10px; margin-bottom: 6px; }
.replybar .rb-in { flex: 1; min-width: 0; font-size: 13.5px; }
.replybar .rb-in b { display: block; color: var(--primary); font-size: 12.5px; }
.replybar .rb-in span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.flash .bubble { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 0 transparent; } }
.bubble .meta .del { font-size: 15px; }
.bubble .rep:hover { color: var(--primary); }
