/* RMS Auto AI — дизайн-токены: тёмно-синий / чёрный / красный */
:root {
  --bg: #07090f;            /* почти чёрный фон */
  --bg-2: #0b1220;          /* панели */
  --bg-3: #101a2e;          /* карточки */
  --bg-4: #16233d;          /* hover */
  --navy: #0f3a78;          /* фирменный тёмно-синий */
  --navy-2: #1b4f9c;
  --navy-glow: rgba(27, 79, 156, .35);
  --red: #e0181f;           /* фирменный красный */
  --red-2: #ff3b42;
  --red-soft: rgba(224, 24, 31, .14);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #e8edf6;
  --text-2: #a9b4c8;
  --text-3: #6f7d96;
  --ok: #2fbf71;
  --warn: #f5a524;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Manrope', var(--font);
  --mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --radius: 12px;
  --radius-s: 8px;
  --sidebar: 288px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: #8fb4ff; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: rgba(224, 24, 31, .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1d2a44; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2a3b5e; }
.hidden, [hidden] { display: none !important; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-s { width: 15px; height: 15px; }
.muted { color: var(--text-3); }

/* ---------- бренд ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; filter: drop-shadow(0 4px 12px rgba(27, 79, 156, .5)); }
.brand-name { font: 800 18px/1 var(--font-head); letter-spacing: .04em; }
.brand-name span { color: var(--red-2); }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; letter-spacing: .02em; }
.brand-lg .brand-mark { width: 56px; height: 56px; }
.brand-lg .brand-name { font-size: 24px; }
.brand-lg .brand-sub { font-size: 13px; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-s); background: var(--bg-3); border: 1px solid var(--line-2); color: var(--text); transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--bg-4); border-color: rgba(255,255,255,.22); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--red) 0%, #b30f16 100%); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 6px 18px rgba(224, 24, 31, .3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--red-2) 0%, #c9151c 100%); }
.btn-navy { background: linear-gradient(135deg, var(--navy-2) 0%, var(--navy) 100%); border-color: transparent; color: #fff; font-weight: 600; }
.btn-navy:hover { filter: brightness(1.15); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-icon { padding: 7px; border-radius: 8px; }
.btn-danger { color: var(--red-2); }
.btn-danger:hover { background: var(--red-soft); }

/* ---------- формы ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span:first-child { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea, .input { width: 100%; padding: 10px 12px; border-radius: var(--radius-s); background: var(--bg); border: 1px solid var(--line-2); outline: none; transition: .15s; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px var(--navy-glow); }
.pw-wrap { position: relative; display: block; }
.pw-wrap .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 4px 8px; opacity: .6; }
.pw-wrap .eye:hover { opacity: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: 20px; background: #2a3550; position: relative; transition: .2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .track { background: var(--navy-2); }
.switch input:checked + .track::after { left: 19px; }

/* ---------- логин ---------- */
.login-body { display: flex; align-items: center; justify-content: center; overflow: auto; }
.login-bg { position: fixed; inset: 0; background:
  radial-gradient(900px 500px at 15% 10%, rgba(15, 58, 120, .55), transparent 60%),
  radial-gradient(700px 400px at 90% 90%, rgba(224, 24, 31, .22), transparent 60%),
  linear-gradient(180deg, #07090f, #0b1220); z-index: -1; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px; }
.login-card { background: rgba(11, 18, 32, .85); backdrop-filter: blur(14px); border: 1px solid var(--line-2); border-radius: 18px; padding: 32px 30px 24px; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 18px; }
.login-note { color: var(--text-2); font-size: 13px; margin: 0 0 22px; padding: 10px 12px; border-left: 3px solid var(--red); background: var(--red-soft); border-radius: 0 8px 8px 0; }
.login-error { color: var(--red-2); font-size: 13px; min-height: 18px; margin: -4px 0 10px; }
.login-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 16px; }
.shake { animation: shake .4s; }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.sb-head { padding: 16px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sb-actions { padding: 0 12px 10px; display: flex; gap: 8px; }
.sb-search { position: relative; padding: 0 12px 10px; }
.sb-search input { width: 100%; padding: 8px 10px 8px 32px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); outline: none; font-size: 13px; }
.sb-search input:focus { border-color: var(--navy-2); }
.sb-search .icon { position: absolute; left: 22px; top: 9px; color: var(--text-3); }
.sb-section { padding: 10px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; }
.sb-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.chat-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 13.5px; position: relative; }
.chat-item:hover { background: var(--bg-3); color: var(--text); }
.chat-item.active { background: var(--bg-4); color: var(--text); box-shadow: inset 3px 0 0 var(--red); }
.chat-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .mode-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--navy-2); }
.chat-item .mode-dot[data-m="sql"] { background: var(--red-2); }
.chat-item .mode-dot[data-m="office"] { background: var(--ok); }
.chat-item .mode-dot[data-m="dev"] { background: var(--warn); }
.chat-item .mode-dot[data-m="web"] { background: #8fb4ff; }
.chat-item .acts { display: none; gap: 2px; }
.chat-item:hover .acts { display: flex; }
.chat-item .acts button { padding: 3px; border-radius: 6px; color: var(--text-3); }
.chat-item .acts button:hover { background: var(--bg-2); color: var(--text); }
.chat-item .snip { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .col { flex: 1; min-width: 0; }
.folder-head { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 13.5px; font-weight: 500; position: relative; }
.folder-head:hover { background: var(--bg-3); color: var(--text); }
.folder-head.drop { background: var(--navy-glow); box-shadow: inset 0 0 0 1px var(--navy-2); }
.folder-head .chev { color: var(--text-3); }
.folder-head .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-head .fcount { font-size: 11.5px; color: var(--text-3); background: var(--bg-4); padding: 1px 7px; border-radius: 10px; }
.folder-head .acts { display: none; gap: 2px; }
.folder-head:hover .acts { display: flex; }
.folder-head:hover .fcount { display: none; }
.folder-head .acts button { padding: 3px; border-radius: 6px; color: var(--text-3); }
.folder-head .acts button:hover { background: var(--bg-2); color: var(--text); }
.folder-body { margin: 0 0 4px 10px; border-left: 1px solid var(--line); padding-left: 4px; }
.drop-loose { background: rgba(255,255,255,.03); border-radius: 8px; outline: 1px dashed var(--line-2); }
.ctx-menu { position: fixed; z-index: 60; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 210px; max-height: 300px; overflow-y: auto; }
.ctx-menu .ctx-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 6px 10px 4px; }
.ctx-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text); }
.ctx-menu button:hover { background: var(--bg-3); }
.ctx-menu .chk { margin-left: auto; color: var(--ok); }
.ctx-menu .ctx-new { border-top: 1px solid var(--line); margin-top: 4px; color: var(--text-2); }
.sb-foot { border-top: 1px solid var(--line); padding: 10px 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.user-chip:hover { background: var(--bg-3); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--navy-2), var(--navy)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.user-chip .n { flex: 1; min-width: 0; }
.user-chip .n b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .n small { color: var(--text-3); font-size: 11.5px; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; position: relative; }
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(7, 9, 15, .7); backdrop-filter: blur(10px); }
.topbar .title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .title small { display: block; font-weight: 400; font-size: 12px; color: var(--text-3); }
.load-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 20px; background: var(--bg-3); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.load-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.load-pill.busy .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.load-pill.full .dot { background: var(--red-2); box-shadow: 0 0 8px var(--red-2); }
.menu-btn { display: none; }

/* ---------- лента сообщений ---------- */
.feed { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.feed-inner { max-width: 880px; margin: 0 auto; padding: 24px 20px 30px; }
.msg { display: flex; gap: 14px; margin-bottom: 22px; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.msg .av { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 700; font-size: 12px; }
.msg.user .av { background: var(--bg-4); color: var(--text-2); }
.msg.assistant .av { background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; }
.msg .body { flex: 1; min-width: 0; }
.msg .who { font-size: 12px; color: var(--text-3); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg.user .content { background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; white-space: pre-wrap; word-break: break-word; }
.msg .attach { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 8px; margin: 6px 6px 0 0; }
.md { line-height: 1.62; word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-head); margin: 18px 0 8px; line-height: 1.3; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15.5px; } .md h4 { font-size: 14.5px; color: var(--text-2); }
.md ul, .md ol { padding-left: 22px; margin: 0 0 10px; }
.md li { margin: 3px 0; }
.md blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--navy-2); color: var(--text-2); background: rgba(27, 79, 156, .1); border-radius: 0 8px 8px 0; }
.md code { font-family: var(--mono); font-size: 13px; background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 4px; }
.md pre { margin: 10px 0; background: #060810; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.md pre code { display: block; padding: 12px 14px; overflow-x: auto; background: none; font-size: 12.8px; line-height: 1.55; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px 5px 12px; background: rgba(255,255,255,.04); border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.code-head button { padding: 3px 8px; border-radius: 6px; font-size: 11.5px; text-transform: none; letter-spacing: 0; color: var(--text-2); }
.code-head button:hover { background: var(--bg-4); color: var(--text); }
.md table { border-collapse: collapse; margin: 10px 0; font-size: 13.5px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: rgba(27, 79, 156, .25); font-weight: 600; }
.md tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 14px 0; }
.md img { max-width: 100%; border-radius: 8px; }
.md a[href^="/api/files/"] { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; margin: 4px 0; background: var(--navy); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 500; }
.md a[href^="/api/files/"]::before { content: '⬇'; }
.md a[href^="/api/files/"]:hover { background: var(--navy-2); }
.cursor::after { content: '▍'; color: var(--red-2); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0 } }
.tools { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.tool-line { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; width: fit-content; max-width: 100%; }
.tool-line .spin { width: 12px; height: 12px; border: 2px solid var(--line-2); border-top-color: var(--red-2); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg) } }
.tool-line.ok .spin { border: 0; animation: none; width: auto; height: auto; }
.tool-line.ok .spin::before { content: '✓'; color: var(--ok); font-weight: 700; }
.tool-line.err .spin { border: 0; animation: none; width: auto; height: auto; }
.tool-line.err .spin::before { content: '✕'; color: var(--red-2); font-weight: 700; }
.tool-line .args { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.sqlcheck { margin: 6px 0 10px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; font-size: 13px; }
.sqlcheck .h { padding: 7px 12px; background: rgba(224, 24, 31, .12); border-bottom: 1px solid var(--line); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.sqlcheck .h.clean { background: rgba(47, 191, 113, .12); }
.sqlcheck pre { margin: 0; padding: 10px 12px; white-space: pre-wrap; font-family: var(--font); font-size: 13px; line-height: 1.5; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-3); align-items: center; }
.stats .act { display: inline-flex; gap: 2px; margin-left: auto; }
.stats .act button { padding: 4px 7px; border-radius: 6px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; }
.stats .act button:hover { background: var(--bg-3); color: var(--text); }
.err-box { background: var(--red-soft); border: 1px solid rgba(224, 24, 31, .4); color: #ffb3b6; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; }
.queue-box { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: linear-gradient(135deg, rgba(27, 79, 156, .25), rgba(15, 58, 120, .12)); border: 1px solid rgba(27, 79, 156, .5); font-size: 13.5px; }
.queue-box .big { font: 800 22px/1 var(--font-head); color: #fff; min-width: 34px; text-align: center; }
.queue-box .bar { height: 4px; background: rgba(255,255,255,.1); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.queue-box .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-2), var(--red-2)); width: 30%; animation: slide 1.4s infinite linear; }
@keyframes slide { from { transform: translateX(-100%) } to { transform: translateX(340%) } }

/* ---------- приветственный экран ---------- */
.welcome { max-width: 880px; margin: 0 auto; padding: 40px 20px 20px; animation: fadeIn .3s; }
.welcome h1 { font: 800 30px/1.2 var(--font-head); margin: 0 0 6px; }
.welcome h1 span { color: var(--red-2); }
.welcome p.lead { color: var(--text-2); margin: 0 0 26px; font-size: 15px; }
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 26px; }
.mode-card { text-align: left; padding: 16px; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--line); transition: .15s; display: flex; flex-direction: column; gap: 8px; }
.mode-card:hover { border-color: var(--navy-2); background: var(--bg-4); transform: translateY(-2px); }
.mode-card.active { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.mode-card .ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(27, 79, 156, .3); color: #9cc0ff; }
.mode-card.active .ic { background: var(--red-soft); color: var(--red-2); }
.mode-card b { font-family: var(--font-head); font-size: 15px; }
.mode-card small { color: var(--text-3); font-size: 12.5px; line-height: 1.4; }
.sugg-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; margin-bottom: 10px; }
.suggs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sugg { text-align: left; padding: 12px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; line-height: 1.4; transition: .15s; white-space: pre-line; }
.sugg:hover { border-color: var(--line-2); color: var(--text); background: var(--bg-3); }

/* ---------- композер ---------- */
.composer-wrap { padding: 8px 20px 16px; background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.composer { max-width: 880px; margin: 0 auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 10px 8px; box-shadow: var(--shadow); transition: .15s; }
.composer:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px var(--navy-glow), var(--shadow); }
.composer textarea { width: 100%; resize: none; background: transparent; border: 0; outline: none; padding: 6px 8px; max-height: 260px; min-height: 44px; line-height: 1.5; font-size: 15px; }
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 6px; padding-top: 6px; }
.mode-select { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { padding: 5px 10px; border-radius: 20px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line); background: transparent; display: inline-flex; align-items: center; gap: 5px; transition: .15s; }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.active { background: var(--navy); border-color: var(--navy-2); color: #fff; }
.chip.on { border-color: rgba(47, 191, 113, .5); color: #7fe0a8; }
.send { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--red), #b30f16); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(224, 24, 31, .35); }
.send:hover { filter: brightness(1.1); }
.send:disabled { background: var(--bg-4); box-shadow: none; opacity: .6; }
.send.stop { background: var(--bg-4); }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 6px; }
.att { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 8px; }
.att button { padding: 0 2px; color: var(--text-3); }
.att button:hover { color: var(--red-2); }
.composer-hint { max-width: 880px; margin: 6px auto 0; text-align: center; font-size: 11.5px; color: var(--text-3); }
.composer-hint b { color: var(--text-2); font-weight: 500; }
.tpl-pop { position: absolute; bottom: 100%; left: 0; margin-bottom: 8px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); width: 340px; max-height: 320px; overflow-y: auto; padding: 6px; z-index: 5; }
.tpl-pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.tpl-pop button:hover { background: var(--bg-3); }
.tpl-pop button small { display: block; color: var(--text-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel { position: relative; }
.drop-over::after { content: 'Отпустите файл, чтобы приложить'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15, 58, 120, .6); border: 2px dashed var(--navy-2); border-radius: 16px; font-weight: 600; z-index: 3; }

/* ---------- модалки ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; animation: fadeIn .15s; }
.modal { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { max-width: 900px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font: 700 17px var(--font-head); }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { padding: 10px 12px; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--red); }
.tab-panel { display: none; } .tab-panel.active { display: block; }
.card { background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font: 600 14px var(--font-head); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kv .k { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.kv .v { font: 700 22px/1.2 var(--font-head); margin-top: 2px; }
.kv .v small { font-size: 12px; color: var(--text-3); font-weight: 400; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.table th { color: var(--text-3); font-weight: 500; font-size: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11.5px; background: var(--bg-4); color: var(--text-2); }
.badge.admin { background: var(--red-soft); color: var(--red-2); }
.badge.on { background: rgba(47, 191, 113, .15); color: #7fe0a8; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.hours i { flex: 1; background: var(--navy-2); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.hours i:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--bg-4); padding: 2px 6px; border-radius: 4px; font-size: 11px; white-space: nowrap; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--bg-4); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; font-size: 13.5px; animation: fadeIn .2s; }
.toast.err { border-color: rgba(224, 24, 31, .5); }
.help-list li { margin-bottom: 8px; color: var(--text-2); }
.help-list b { color: var(--text); }
.think { margin: 4px 0 8px; font-size: 12.5px; color: var(--text-3); border-left: 2px solid var(--line-2); padding-left: 10px; white-space: pre-wrap; max-height: 120px; overflow: hidden; }

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(88vw, 320px); z-index: 40; transform: translateX(-100%); transition: .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .sb-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .feed-inner, .welcome { padding-left: 12px; padding-right: 12px; }
  .composer-wrap { padding: 6px 10px 12px; }
  .load-pill span.txt { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .welcome h1 { font-size: 24px; }
  .modes { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) { .modes { grid-template-columns: 1fr; } .mode-select .chip .lbl { display: none; } }
