/* Чат оператора: телефон в первую очередь. Цвета — как у сайта, тёмная тема по настройке устройства */
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url("/assets/fonts/golos-cyrillic.woff2") format("woff2"); unicode-range: U+0400-045F, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url("/assets/fonts/golos-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
:root {
  --ink: #2B2960; --night: #16153A; --signal: #E09230;
  --bg: #F3F4F9; --card: #fff; --line: #E1E3EE; --text: #1A193F; --muted: #6A6989; --bubble-in: #fff; --bubble-out: #2B2960; --on-out: #fff;
  --f: "Golos Text", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0F0E26; --card: #1B1A3C; --line: #2B2A52; --text: #ECECF6; --muted: #A3A2C6; --bubble-in: #232251; --bubble-out: #E09230; --on-out: #16153A; color-scheme: dark; }
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 15px/1.45 var(--f); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
button, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 58px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--night); color: #fff; }
.bar__back { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.bar__back svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bar__who { flex: 1; min-width: 0; }
.bar__title { margin: 0; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__sub { margin: 0; font-size: 12.5px; color: #A3A2C6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.empty { margin: 48px 24px; text-align: center; color: var(--muted); }

/* список диалогов */
.list { list-style: none; margin: 0; padding: 0 0 24px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; border-bottom: 1px solid var(--line); background: var(--card); }
.row:active { background: var(--bg); }
.row__ava { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; }
.row__ava--max { background: var(--signal); color: var(--night); font-size: 12px; }
.row__main { flex: 1; min-width: 0; }
.row__top { display: flex; align-items: baseline; gap: 8px; }
.row__name { flex: 1; min-width: 0; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__time { flex: none; font-size: 12px; color: var(--muted); }
.row__text { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.row__text span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.is-unread .row__text span { color: var(--text); font-weight: 600; }
.row__badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--signal); color: var(--night); font-size: 12px; line-height: 20px; text-align: center; }

/* переписка */
.thread { display: flex; flex-direction: column; gap: 6px; padding: 14px 12px 18px; }
.day { align-self: center; margin: 8px 0 4px; padding: 3px 10px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: 12px; }
.msg { max-width: 84%; }
.msg p { margin: 0; padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg small { display: block; margin: 3px 8px 0; font-size: 11.5px; color: var(--muted); }
.msg--in { align-self: flex-start; }
.msg--in p { background: var(--bubble-in); border-bottom-left-radius: 6px; box-shadow: 0 1px 0 var(--line); }
.msg--out { align-self: flex-end; }
.msg--out p { background: var(--bubble-out); color: var(--on-out); border-bottom-right-radius: 6px; }
.msg--out small { text-align: right; }
.msg--auto p { opacity: .75; font-style: italic; }
.msg.is-sending p { opacity: .55; }

.compose { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.compose textarea { flex: 1; min-height: 42px; max-height: 140px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 21px; background: var(--bg); resize: none; font-size: 16px; line-height: 1.35; }
.compose textarea:focus { outline: none; border-color: var(--ink); }
.compose button { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--signal); color: var(--night); cursor: pointer; }
.compose button:disabled { opacity: .5; }
.compose svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 20; translate: -50% 0; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: #C4453A; color: #fff; font-size: 14px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); }
.gate { margin: 40px 20px; padding: 22px; border-radius: 18px; background: var(--card); text-align: center; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; margin-top: 8px; padding: 0 22px; border-radius: 14px; background: var(--signal); color: var(--night); font-weight: 700; text-decoration: none; }
