:root { color-scheme: light; --bg: #f7f7f8; --panel: #fff; --line: #e5e7eb; --text: #111827; --muted: #6b7280; --accent: #f59e0b; --mine: #fde9c4; --other: #fff; --sat: env(safe-area-inset-top); --sab: env(safe-area-inset-bottom); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; }
[v-cloak] { display: none; }
#app { height: 100dvh; display: flex; }
.side, .main { height: 100%; display: flex; flex-direction: column; min-width: 0; }
.side { flex: 1; } .main { flex: 1; }
#app.desktop .side { flex: 0 0 340px; border-right: 1px solid var(--line); background: var(--panel); }
#app.desktop .main { flex: 1; }
.pane { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.pad { padding: 12px; }
.grow { flex: 1; } .min { min-width: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.err { color: #b91c1c; font-size: 14px; } .ok { color: #047857; font-size: 14px; }
.accent-text { color: #b45309; }
.clickable { cursor: pointer; }
.placeholder { flex: 1; display: flex; align-items: center; justify-content: center; }

/* шапка */
.bar { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) 10px 8px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 52px; }
.bar .title { font-weight: 600; font-size: 17px; }
.bar .sub { line-height: 1.2; }
.icon { background: none; border: 0; font: inherit; font-size: 20px; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--text); line-height: 1; }
.icon.on { background: var(--line); }
.icon.send { color: #b45309; font-size: 24px; }
.btn { font: inherit; font-weight: 600; padding: 10px 14px; border: 0; border-radius: 10px; background: var(--line); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); } .btn.danger { background: #fee2e2; color: #b91c1c; width: 100%; }
.btn.small { padding: 6px 10px; font-size: 14px; } .btn.ghost { background: none; color: var(--muted); }
.btn:disabled { opacity: .5; }
.center-block { display: block; margin: 6px auto; }
input, textarea { font: inherit; color: var(--text); }
.search { padding: 8px 10px; background: var(--panel); }
.search input { width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: var(--bg); }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff7ed; border-bottom: 1px solid #fed7aa; font-size: 14px; }

/* аватары */
.avatar { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 17px; flex: 0 0 auto; position: relative; background: #9ca3af; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; } .avatar.xl { width: 88px; height: 88px; font-size: 32px; margin: 12px auto; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; background: #22c55e; border: 2px solid var(--panel); border-radius: 50%; }

/* список */
.list .row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; cursor: pointer; background: var(--panel); border-bottom: 1px solid #f0f0f1; }
.list .row.active { background: #fff7ed; }
.list .row.accent .name { color: #b45309; }
.list .row input[type=checkbox] { width: 20px; height: 20px; }
.row-top, .row-bot { display: flex; align-items: center; gap: 6px; }
.name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 12px; } .preview { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--accent); color: #111; font-size: 12px; font-weight: 700; border-radius: 12px; padding: 1px 7px; min-width: 20px; text-align: center; }
.badge.mute { background: #d1d5db; }
.section { padding: 10px 12px 4px; background: var(--bg); }
.empty { padding: 40px 20px; text-align: center; }
.card { background: var(--panel); border-radius: 14px; padding: 14px; margin: 12px 0; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card input[type=password], .card input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0; }
.card .btn { margin-top: 8px; }
.card .row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.card .search { padding: 8px 0 4px; }
.row-c { display: flex; align-items: center; gap: 8px; }
.h2-input { font-size: 20px; font-weight: 600; text-align: center; border: 0; background: transparent; width: 100%; padding: 6px; }

/* вход */
.login { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: var(--panel); border-radius: 18px; padding: 28px 22px; width: 100%; max-width: 360px; text-align: center; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; } .login h1 { font-size: 22px; margin: 10px 0 2px; }
.login input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; }
.login .btn { width: 100%; margin-top: 8px; padding: 12px; }

/* диалог */
.room { background: #ece7de; background-image: radial-gradient(#e2dccf 1px, transparent 1px); background-size: 22px 22px; position: relative; }
.pinned { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); cursor: pointer; }
.messages { padding: 10px 10px 4px; display: flex; flex-direction: column; }
.day { text-align: center; margin: 10px 0 6px; } .day span { background: rgba(0,0,0,.35); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 12px; }
.sys { text-align: center; margin: 6px 0; } .sys span { background: rgba(0,0,0,.25); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 12px; }
.msg { display: flex; align-items: flex-end; gap: 6px; margin: 1px 0; max-width: 85%; }
.msg.first { margin-top: 6px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .side-av { flex: 0 0 32px; width: 32px; height: 32px; }
.bubble { background: var(--other); border-radius: 14px; padding: 6px 10px 4px; box-shadow: 0 1px 1px rgba(0,0,0,.08); position: relative; min-width: 60px; max-width: 100%; word-wrap: break-word; }
.msg.mine .bubble { background: var(--mine); }
.msg.pending .bubble { opacity: .7; } .msg.failed .bubble { outline: 2px solid #ef4444; }
.msg.highlight .bubble { animation: hl 1.6s ease; } @keyframes hl { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.08); } }
.bubble.emoji-only { background: transparent; box-shadow: none; } .bubble.emoji-only .text { font-size: 44px; line-height: 1.1; }
.bubble.emoji-only .meta { background: rgba(0,0,0,.35); color: #fff; border-radius: 10px; padding: 1px 6px; }
.bubble.media { padding: 3px; } .bubble.media .meta { position: absolute; right: 8px; bottom: 6px; background: rgba(0,0,0,.45); color: #fff; border-radius: 10px; padding: 1px 6px; }
.sender { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.quote { border-left: 3px solid var(--accent); padding: 2px 8px; margin: 2px 0 6px; background: rgba(0,0,0,.04); border-radius: 6px; font-size: 13px; cursor: pointer; }
.quote b { color: #b45309; }
.text { white-space: pre-wrap; } .text a { color: #1d4ed8; }
.meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; display: flex; justify-content: flex-end; gap: 4px; align-items: center; }
.ticks { font-size: 11px; } .ticks.read { color: #16a34a; }
.photo { display: block; max-width: min(320px, 70vw); max-height: 320px; border-radius: 12px; cursor: pointer; object-fit: cover; }
.file { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 4px 0; }
.ficon { font-size: 28px; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 200px; padding: 4px 0; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); font-size: 15px; cursor: pointer; flex: 0 0 auto; }
.track { height: 6px; background: rgba(0,0,0,.12); border-radius: 3px; cursor: pointer; margin: 6px 0 4px; } .fill { height: 100%; background: #b45309; border-radius: 3px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.react { background: rgba(0,0,0,.06); border-radius: 12px; padding: 2px 8px; font-size: 13px; cursor: pointer; }
.react.my { background: #fde68a; }
.typing { padding: 4px 10px; }
.jump { position: absolute; right: 14px; bottom: 76px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--panel); box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 20px; cursor: pointer; }
.jump .badge { position: absolute; top: -6px; right: -6px; }

/* композер */
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--sab)); }
.composer textarea { flex: 1; resize: none; border: 0; background: var(--bg); border-radius: 18px; padding: 9px 12px; max-height: 120px; line-height: 1.3; }
.composer textarea:focus { outline: none; }
.ctx { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-left: 3px solid var(--accent); margin-bottom: 6px; font-size: 14px; }
.emoji-panel { max-height: 220px; display: flex; flex-direction: column; margin-bottom: 6px; }
.emoji-tabs { display: flex; gap: 2px; } .emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); overflow-y: auto; }
.emoji-grid button { font-size: 24px; background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 8px; } .emoji-grid button:active { background: var(--line); }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .2; } }

/* меню и оверлеи */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.overlay.dark { background: rgba(0,0,0,.92); align-items: center; }
.lb { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.sheet { background: var(--panel); border-radius: 18px 18px 0 0; padding: 10px 8px calc(10px + var(--sab)); width: 100%; max-width: 480px; }
#app.desktop .sheet { border-radius: 18px; margin-bottom: 20vh; }
.quick { display: flex; justify-content: space-around; padding: 4px 0 8px; } .quick button { font-size: 28px; background: none; border: 0; cursor: pointer; padding: 4px; border-radius: 10px; }
.sheet-grid { max-height: 200px; margin-bottom: 8px; }
.item { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; padding: 12px 10px; border-top: 1px solid #f0f0f1; cursor: pointer; color: var(--text); text-decoration: none; }
.item.danger { color: #b91c1c; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: rgba(17,24,39,.92); color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 14px; z-index: 60; }
