:root {
  --ink: #1B2733; --muted: #6B7280; --line: #E6E8EC; --side: #F6F7F9; --chat-bg: #F4F5F8; --them: #FFFFFF; --white: #fff;
  --ch: #3E63DD; --ok: #2E9B55; --danger: #C0392B;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-ch="repair"] { --ch: #297D6E; }
[data-ch="bot"] { --ch: #5B6475; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--ink); background: #fff; -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
a { color: var(--ch); }

.app { display: flex; height: 100vh; height: 100dvh; background: #fff; overflow: hidden; }

/* ---------- боковая панель ---------- */
.side { width: 272px; flex: 0 0 272px; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 16px; border-bottom: 1px solid var(--line); }
.brand-logo { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: #3E63DD; display: flex; align-items: center; justify-content: center; }
.brand-logo.big { width: 52px; height: 52px; flex-basis: 52px; border-radius: 12px; }
.brand-name { font-size: 15px; font-weight: 700; line-height: 1.25; }
.brand-sub { font-size: 12px; color: var(--muted); }
.tabs { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.tab { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); min-height: 52px; }
.tab:hover { background: #ECEEF2; }
.tab[aria-selected="true"] { background: var(--ch); color: #fff; }
.tab-ico { width: 22px; height: 22px; flex: 0 0 22px; display: flex; align-items: center; justify-content: center; color: #5B6168; }
.tab[aria-selected="true"] .tab-ico { color: #fff; }
.tab-txt { display: flex; flex-direction: column; min-width: 0; }
.tab-txt b { font-size: 14.5px; font-weight: 600; }
.tab-txt small { font-size: 12px; opacity: .75; }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #E5484D; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.side-foot { padding: 14px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.5; }
.install { margin-top: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }

/* ---------- чат ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.chat-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid #EEEFF2; background: #fff; }
.avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; background: var(--ch); color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.head-title { font-size: 14.5px; font-weight: 700; }
.head-status { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.head-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #B8BCC4; }
.head-status.on { color: #23824A; }
.head-status.on .dot { background: var(--ok); }
.notice { flex: 0 0 auto; display: flex; gap: 8px; align-items: flex-start; padding: 9px 24px; background: #FFF7E6; color: #6B4E00; font-size: 12.5px; line-height: 1.4; border-bottom: 1px solid #F3E4BC; }
.notice-x { margin-left: auto; border: 0; background: transparent; font-size: 18px; line-height: 1; padding: 0 4px; color: inherit; }
.name-ask { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 24px; background: #EEF2FF; border-bottom: 1px solid #DDE4FA; font-size: 13px; }
.name-ask input { flex: 1 1 160px; min-width: 0; border: 1px solid #CBD5F5; border-radius: 8px; padding: 7px 10px; background: #fff; }
.btn-small { border: 0; border-radius: 8px; padding: 8px 12px; background: var(--ch); color: #fff; font-size: 13px; font-weight: 600; }
.btn-small.ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn-small.danger { background: #fff; color: var(--danger); border: 1px solid #E8B4AE; }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px 8px; display: flex; flex-direction: column; gap: 6px; background: var(--chat-bg); overscroll-behavior: contain; }
.day { align-self: center; margin: 10px 0 4px; padding: 3px 12px; border-radius: 12px; background: #E4E7EC; color: #4B5563; font-size: 12px; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 560px); }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.them { align-self: flex-start; align-items: flex-start; }
.msg .who { font-size: 11.5px; color: var(--muted); margin: 0 6px 2px; }
.bubble { padding: 8px 12px 6px; border-radius: 16px; font-size: 14.5px; line-height: 1.42; word-break: break-word; overflow-wrap: anywhere; }
.me .bubble { background: var(--ch); color: #fff; border-bottom-right-radius: 4px; }
.me .bubble a { color: #fff; }
.them .bubble { background: var(--them); border: 1px solid #E9EBEF; border-bottom-left-radius: 4px; }
.bubble .txt { white-space: pre-wrap; }
.bubble .time { display: block; text-align: right; font-size: 10.5px; opacity: .6; margin-top: 3px; }
.sys { align-self: center; max-width: 90%; text-align: center; padding: 6px 12px; border-radius: 12px; background: #E4E7EC; color: #4B5563; font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.chip { border: 1px solid var(--ch); color: var(--ch); background: #fff; border-radius: 16px; padding: 7px 13px; font-size: 13.5px; min-height: 34px; }
.chip:hover { background: #F2F5FF; }
.chip:disabled { opacity: .5; cursor: default; }
.img-link { display: block; border-radius: 10px; overflow: hidden; margin: 2px 0 2px; }
.img-link img { display: block; max-width: min(300px, 100%); max-height: 300px; object-fit: cover; border-radius: 10px; background: #E4E7EC; }
.filechip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 190px; padding: 2px 0; }
.filechip .ficon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; background: rgba(0,0,0,.07); display: flex; align-items: center; justify-content: center; }
.me .filechip .ficon { background: rgba(255,255,255,.2); }
.filechip .fmeta { min-width: 0; display: flex; flex-direction: column; }
.filechip .fname { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.filechip .fsize { font-size: 11.5px; opacity: .7; }
.filechip.gone { opacity: .65; font-style: italic; }
.progress { height: 4px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; margin-top: 4px; min-width: 160px; }
.progress i { display: block; height: 100%; width: 0; background: #fff; transition: width .15s; }
.empty { margin: auto; text-align: center; color: var(--muted); font-size: 14px; max-width: 360px; line-height: 1.5; padding: 20px; }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; font-size: 15px; }

.toast { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); max-width: min(92%, 440px); background: #1F2937; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; z-index: 5; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

.composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #EEEFF2; background: #fff; }
.icon-btn { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; border: 0; background: #F1F2F5; color: #4B5563; display: flex; align-items: center; justify-content: center; }
.icon-btn:disabled { opacity: .4; cursor: default; }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: #F1F2F5; border-radius: 21px; padding: 11px 16px; font-size: 15px; line-height: 1.35; max-height: 140px; }
.composer textarea:focus-visible { box-shadow: 0 0 0 2px var(--ch); }
.send-btn { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; border: 0; background: var(--ch); display: flex; align-items: center; justify-content: center; }
button:focus-visible, .tab:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--ch); outline-offset: 2px; }
.dragging::after { content: "Отпустите, чтобы отправить файл"; position: absolute; inset: 0; background: rgba(62,99,221,.12); border: 2px dashed var(--ch); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--ch); z-index: 4; pointer-events: none; }

/* ---------- О нас ---------- */
.about { flex: 1; overflow-y: auto; }
.about-in { max-width: 640px; padding: 40px 48px; }
.about-top { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.about h1 { margin: 0; font-size: 20px; }
.about h2 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); margin: 2px 0 0; font-size: 13.5px; }
.facts { margin: 0; display: grid; gap: 16px; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.facts dd { margin: 0; font-size: 15px; line-height: 1.45; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.links a { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; text-decoration: none; color: var(--ink); font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }
.links a:hover { background: var(--side); }
.privacy { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: #4B5563; line-height: 1.5; }
.privacy p { margin: 0 0 12px; }

/* ---------- выбор режима отправки фото ---------- */
.pm { position: fixed; inset: 0; background: rgba(20,28,45,.5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.pm-card { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.pm-card h3 { margin: 0; font-size: 17px; }
.pm-sub { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.pm-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.pm-opt:has(input:checked) { border-color: var(--ch); background: #F4F7FF; }
.pm-opt input { margin-top: 4px; accent-color: var(--ch); }
.pm-opt b { display: block; font-size: 14.5px; }
.pm-opt span { font-size: 12.8px; color: var(--muted); line-height: 1.4; }
.pm-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.pm-btns .btn-small { min-height: 40px; padding: 0 16px; }

/* ---------- телефон ---------- */
@media (max-width: 760px) {
  .app { flex-direction: column-reverse; }
  .side { width: auto; flex: 0 0 auto; border-right: 0; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .brand, .side-foot { display: none; }
  .tabs { flex-direction: row; padding: 6px; gap: 2px; flex: 0 0 auto; overflow: visible; }
  .tab { flex: 1 1 0; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 2px; min-height: 54px; text-align: center; border-radius: 12px; }
  .tab-txt small { display: none; }
  .tab-txt b { font-size: 11.5px; font-weight: 600; }
  .tab-ico { color: #5B6168; }
  .badge { position: absolute; top: 3px; left: 50%; margin-left: 8px; min-width: 18px; height: 18px; font-size: 11px; }
  .chat-head { padding: 10px 14px; }
  .notice, .name-ask { padding-left: 14px; padding-right: 14px; }
  .messages { padding: 12px 12px 6px; }
  .msg { max-width: 88%; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .toast { bottom: 76px; }
  .about-in { padding: 24px 18px 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
