/* Telegram-native: все цвета из themeParams клиента (--tg-theme-*), фолбэки — Telegram iOS. Схема — html[data-scheme]. */
@font-face { font-family: "Golos Text"; src: url("/fonts/GolosText-400-cyrillic.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0400-04FF; }
@font-face { font-family: "Golos Text"; src: url("/fonts/GolosText-500-cyrillic.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0400-04FF; }
@font-face { font-family: "Golos Text"; src: url("/fonts/GolosText-600-cyrillic.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0400-04FF; }
@font-face { font-family: "Golos Text"; src: url("/fonts/GolosText-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/fonts/GolosText-500-latin.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/fonts/GolosText-600-latin.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Golos Text", sans-serif;
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #efeff4);
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #007aff);
  --accent: var(--tg-theme-accent-text-color, var(--link));
  --btn: var(--tg-theme-button-color, #007aff);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --header: var(--tg-theme-header-bg-color, #f7f7f7);
  --bar: var(--tg-theme-bottom-bar-bg-color, var(--header));
  --sep: var(--tg-theme-section-separator-color, #c8c7cc);
  --red: var(--tg-theme-destructive-text-color, #ff3b30);
  --section-hint: var(--tg-theme-section-header-text-color, #6d6d72);
  --green: #34c759;
  --field: color-mix(in srgb, var(--text) 7%, var(--bg));
  --b-in: var(--bg);
  --b-out: #e1fec6;
  --b-out-meta: #3ea83a;
  --b-shadow: 0 1px 1px rgb(0 0 0 / .1);
  --svc: rgb(40 70 30 / .32);
  --wall: radial-gradient(50% 35% at 20% 25%, #d2e3a8 0%, transparent 70%), radial-gradient(50% 40% at 85% 55%, #8fc1a4 0%, transparent 70%),
          radial-gradient(60% 40% at 20% 85%, #e3dc9b 0%, transparent 70%), #b9d3a0;
  --safe-t: max(env(safe-area-inset-top), var(--sa-t, 0px));
  --safe-b: max(env(safe-area-inset-bottom), var(--sa-b, 0px));
  --tap: 44px;
}
html[data-scheme="dark"] {
  --bg: var(--tg-theme-bg-color, #000000);
  --bg2: var(--tg-theme-secondary-bg-color, #1c1c1d);
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #98989e);
  --link: var(--tg-theme-link-color, #3e88f7);
  --btn: var(--tg-theme-button-color, #3e88f7);
  --header: var(--tg-theme-header-bg-color, #1a1a1a);
  --sep: var(--tg-theme-section-separator-color, #3d3d40);
  --red: var(--tg-theme-destructive-text-color, #eb5545);
  --field: color-mix(in srgb, var(--text) 11%, var(--bg));
  --b-in: #262628;
  --b-out: color-mix(in srgb, var(--btn) 78%, #000);
  --b-out-meta: rgb(255 255 255 / .62);
  --b-shadow: none;
  --svc: rgb(255 255 255 / .14);
  --wall: radial-gradient(55% 40% at 15% 20%, #1f3a2b 0%, transparent 70%), radial-gradient(50% 40% at 90% 60%, #23324a 0%, transparent 70%),
          radial-gradient(60% 40% at 25% 90%, #2b2a1c 0%, transparent 70%), #0f1712;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 17px/1.3 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; touch-action: manipulation; text-align: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
button[disabled] { opacity: .45; cursor: default; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

html, body { height: 100%; overflow: hidden; }
/* экран прибит к видимой области: высота из viewportHeight/visualViewport (клавиатура), отступы — safe-area */
.screen { position: fixed; left: 0; right: 0; top: var(--app-top, 0px); display: flex; flex-direction: column; height: 100dvh; height: var(--app-h, 100dvh); padding-top: var(--safe-t); }
.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.empty { padding: 56px 32px; text-align: center; color: var(--hint); font-size: 15px; margin: 0; }

/* ---------- список ---------- */
.s-list { background: var(--bg); }
.nav { background: var(--header); padding: 6px 0 0; border-bottom: .5px solid var(--sep); }
.nav-t { text-align: center; padding: 4px 16px 8px; }
.nav h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.search { position: relative; display: flex; align-items: center; margin: 0 16px 8px; height: 36px; border-radius: 10px; background: var(--field); color: var(--hint); padding: 0 8px; gap: 6px; }
.search .ic { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font: inherit; font-size: 17px; color: var(--text); outline: none; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--hint); }
.search:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--link) 40%, transparent); }
.seg { display: flex; gap: 22px; padding: 0 16px; }
.seg-b { position: relative; padding: 8px 2px 10px; font-size: 15px; font-weight: 500; color: var(--hint); min-height: 40px; }
.seg-b b { display: inline-block; margin-left: 5px; font-size: 12px; line-height: 18px; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--hint); color: var(--bg); text-align: center; font-weight: 600; }
.seg-b[aria-selected="true"] { color: var(--link); }
.seg-b[aria-selected="true"] b { background: var(--link); color: var(--btn-text); }
.seg-b[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--link); }
.chips { display: flex; gap: 6px; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; }
.chip { min-height: 32px; padding: 0 12px; border-radius: 15px; background: var(--field); font-size: 14px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); }
.killed { margin: 8px 16px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--red) 12%, var(--bg)); color: var(--red); font-size: 15px; }

.row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 0 0 10px; min-height: 76px; text-align: left; background: var(--bg); content-visibility: auto; contain-intrinsic-size: auto 76px; }
.row:active, .brow:active { background: color-mix(in srgb, var(--text) 8%, var(--bg)); }
.row .rb { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 16px 8px 0; border-bottom: .5px solid var(--sep); }
.rows .row:last-child .rb { border-bottom: 0; }
.r1 { display: flex; align-items: baseline; gap: 8px; }
.nm { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.tm { color: var(--hint); font-size: 14px; font-variant-numeric: tabular-nums; flex: none; }
.r2 { display: flex; align-items: flex-end; gap: 8px; }
.pv { flex: 1; min-width: 0; color: var(--hint); font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pv .dr { color: var(--red); }
.pv .esc { color: var(--text); font-weight: 500; }   /* «Нужен человек:» + суть причины, одна строка серым */
.st-draft .pv .dr { color: var(--red); }
.pv .esc { color: var(--text); font-weight: 500; }   /* «Нужен человек:» + суть причины, одна строка серым */
.cnt { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--btn); color: var(--btn-text); font-size: 14px; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; margin-bottom: 1px; }
.st-done .nm { font-weight: 500; }
.brief .rb { flex-direction: column; }
.brief .pill { flex: none; margin-right: 16px; height: 30px; padding: 0 14px; border-radius: 15px; background: var(--btn); color: var(--btn-text); font-size: 14px; font-weight: 600; }
.brief { padding-right: 0; content-visibility: visible; }
.pv.one { -webkit-line-clamp: 1; }
.brief .rb { padding-right: 8px; }

.av { flex: none; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; font-size: 21px; letter-spacing: .01em; }
.av.sm { width: 36px; height: 36px; font-size: 14px; }
.av.sun { background: linear-gradient(180deg, #72d5fd, #2a9ef1); }
.av.sun .ic { width: 30px; height: 30px; }
.g0 { background: linear-gradient(180deg, #ff885e, #ff516a); } .g1 { background: linear-gradient(180deg, #72d5fd, #2a9ef1); }
.g2 { background: linear-gradient(180deg, #a0de7e, #54cb68); } .g3 { background: linear-gradient(180deg, #e0a2f3, #d669ed); }
.g4 { background: linear-gradient(180deg, #ffcd6a, #ffa85c); } .g5 { background: linear-gradient(180deg, #53edd6, #28c9b7); }
.g6 { background: linear-gradient(180deg, #82b1ff, #665fff); }

/* ---------- шапка экранов ---------- */
.cnav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: 52px; padding: 4px 10px; background: color-mix(in srgb, var(--header) 94%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-bottom: .5px solid var(--sep); position: relative; z-index: 2; }
.cback { display: inline-flex; align-items: center; gap: 0; color: var(--link); font-size: 17px; min-height: var(--tap); justify-self: start; padding-right: 8px; margin-left: -6px; }
.cback .ic { width: 26px; height: 26px; stroke-width: 2.4; }
.ct { text-align: center; min-width: 0; max-width: 62vw; }
.ct b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.ct small { display: block; font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cav { justify-self: end; min-width: var(--tap); min-height: var(--tap); display: grid; place-items: center; border-radius: 50%; }

/* ---------- диалог: обои, пузыри ---------- */
.s-chat { background: var(--wall); background-attachment: fixed; }
.chat { position: relative; }
.feed { display: flex; flex-direction: column; padding: 8px 8px 10px; min-height: 100%; justify-content: flex-end; }
.day { align-self: center; margin: 10px 0 8px; }
.day span { display: inline-block; font-size: 13px; font-weight: 500; color: #fff; background: var(--svc); padding: 3px 9px; border-radius: 12px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.b { position: relative; max-width: min(82%, 480px); margin-top: 2px; padding: 6px 10px 7px 12px; border-radius: 17px; background: var(--b-in); box-shadow: var(--b-shadow);
  font-size: 16px; line-height: 1.32; white-space: pre-wrap; overflow-wrap: anywhere; align-self: flex-start; }
.b.out { align-self: flex-end; background: var(--b-out); padding: 6px 12px 7px 10px; }
.b.in.tail { border-bottom-left-radius: 5px; margin-bottom: 6px; margin-left: 6px; }
.b.out.tail { border-bottom-right-radius: 5px; margin-bottom: 6px; margin-right: 6px; }
.b.in:not(.tail) { margin-left: 6px; }
.b.out:not(.tail) { margin-right: 6px; }
/* хвостик как в Telegram: та же заливка, что у пузыря */
.b.tail::after { content: ""; position: absolute; bottom: 0; width: 11px; height: 17px; background: inherit;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 17'%3E%3Cpath d='M11 0v17H1.5c-.9 0-1.3-1-.7-1.6C4.6 11.5 7.4 6.7 8 0z'/%3E%3C/svg%3E") no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 17'%3E%3Cpath d='M11 0v17H1.5c-.9 0-1.3-1-.7-1.6C4.6 11.5 7.4 6.7 8 0z'/%3E%3C/svg%3E") no-repeat; }
.b.in.tail::after { left: -6px; }
.b.out.tail::after { right: -6px; transform: scaleX(-1); }
.b.cur { box-shadow: 0 0 0 2px color-mix(in srgb, var(--link) 55%, transparent), var(--b-shadow); }
.meta { float: right; position: relative; top: 7px; margin: -6px -2px 0 10px; font-size: 11px; line-height: 1.6; color: var(--hint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.out .meta { color: var(--b-out-meta); }
.b > .meta { float: none; display: block; text-align: right; top: 0; margin: 2px 0 -2px; }
.b.bare { padding: 3px; }
.b.bare > .meta { position: absolute; top: auto; right: 9px; bottom: 9px; margin: 0; padding: 1px 6px; border-radius: 9px; background: rgb(0 0 0 / .45); color: #fff; }
.media { display: block; border-radius: 14px; overflow: hidden; max-width: 100%; cursor: zoom-in; background: color-mix(in srgb, var(--text) 8%, transparent); }
.media img { display: block; max-width: 100%; max-height: 320px; object-fit: cover; }
.media img:not(.ok) { width: 240px; height: 180px; max-width: 100%; visibility: hidden; }
.media:not(.ok) { animation: m-load 1.4s ease-in-out infinite alternate; }
@keyframes m-load { from { opacity: .55; } to { opacity: 1; } }
.media.stk { background: none; border-radius: 0; cursor: default; }
.media.stk img { max-width: 160px; max-height: 160px; object-fit: contain; }
.media.stk img:not(.ok) { width: 160px; height: 160px; }
.b.bare:has(.media.stk) { background: none; box-shadow: none; }
.b.bare:has(.media.stk)::after { display: none; }
.b .media + .t { margin-top: 6px; }
.doc { display: flex; align-items: center; gap: 10px; text-align: left; padding: 2px 0; color: inherit; min-height: var(--tap); }
.doc-i { width: 44px; height: 44px; border-radius: 50%; background: var(--link); color: #fff; display: grid; place-items: center; flex: none; }
.out .doc-i { background: var(--b-out-meta); }
.doc b { display: block; font-weight: 500; font-size: 15px; }
.doc small { display: block; color: var(--hint); font-size: 13px; }
.doc.muted .doc-i { background: color-mix(in srgb, var(--hint) 60%, transparent); }
.b .doc + .t { margin-top: 4px; }
.more { align-self: center; font-size: 13px; font-weight: 500; color: #fff; background: var(--svc); border-radius: 12px; padding: 4px 12px; margin-bottom: 6px; min-height: 28px; }

/* эскалация — сервисное сообщение + inline-клавиатура */
.svc-wrap { display: flex; flex-direction: column; align-items: stretch; margin-top: 6px; }
.day.svc { position: static; max-width: 86%; text-align: center; }
.day.svc span { line-height: 1.35; padding: 4px 10px; border-radius: 13px; }
.ikb { display: flex; gap: 4px; margin: 0 6px; }
.ikb button { flex: 1; min-height: 42px; border-radius: 10px; color: #fff; font-size: 15px; font-weight: 500; text-align: center; background: var(--svc);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.ikb button:active { filter: brightness(.9); }

/* ---------- композер и плашка черновика ---------- */
.dock { background: var(--bar); border-top: .5px solid var(--sep); padding: 6px 8px calc(6px + var(--safe-b)); position: relative; z-index: 2; }
html.mb-on .dock { padding-bottom: 6px; }  /* под нативной MainButton низ закрывает панель Telegram */
.dnote { margin: 2px 8px 6px; color: var(--hint); font-size: 13px; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dnote b { color: var(--text); font-weight: 500; }
.dock.closed p { margin: 6px 8px; color: var(--hint); font-size: 14px; text-align: center; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dock.closed b { color: var(--text); font-weight: 500; }
.dock .hint { color: var(--hint); font-size: 13px; text-align: center; margin: 6px 0 2px; }
.dq { margin: 0 2px 6px; }
.dq-body { display: block; width: 100%; text-align: left; padding: 4px 10px 6px; border-left: 3px solid #af52de; border-radius: 4px 8px 8px 4px;
  background: color-mix(in srgb, #af52de 9%, var(--bar)); }
.dq-l { display: flex; align-items: center; gap: 4px; color: #af52de; font-size: 14px; font-weight: 600; }
.dq-l .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.dq-l small { margin-left: auto; color: var(--hint); font-weight: 400; font-size: 12px; }
.dq-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.3; margin-top: 1px; white-space: pre-wrap; }
.dq.open .dq-t { display: block; max-height: 38vh; overflow-y: auto; }
.dq-s { display: block; margin-top: 4px; color: var(--link); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dq-a { display: flex; gap: 6px; margin-top: 6px; }
.dq-a button { flex: 1; min-height: 40px; border-radius: 10px; background: var(--field); color: var(--link); font-size: 15px; font-weight: 500; text-align: center; }
.dq-a button.pri { background: var(--btn); color: var(--btn-text); }
.reasons { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; align-items: center; margin: 0 2px 6px; }
.reasons > span { color: var(--hint); font-size: 13px; white-space: nowrap; }
.composer { display: flex; align-items: flex-end; gap: 6px; }
.clip { width: 40px; height: 40px; display: grid; place-items: center; color: var(--hint); flex: none; }
.clip .ic { width: 26px; height: 26px; }
.field { flex: 1; min-width: 0; border: .5px solid var(--sep); background: var(--bg); border-radius: 19px; padding: 7px 14px; min-height: 38px; margin-bottom: 1px; display: flex; }
.field textarea { flex: 1; border: 0; outline: none; background: none; resize: none; font: inherit; font-size: 17px; line-height: 1.3; color: var(--text); padding: 0; height: 22px; max-height: 140px; }
.field textarea::placeholder { color: var(--hint); }
.field:focus-within { border-color: color-mix(in srgb, var(--link) 60%, transparent); }
.send { width: 38px; height: 38px; border-radius: 50%; background: var(--btn); color: var(--btn-text); display: grid; place-items: center; flex: none; margin-bottom: 1px; transition: transform .12s ease-out, opacity .12s; }
.send .ic { width: 20px; height: 20px; fill: currentColor; stroke-width: 1.4; transform: translateX(-1px); }
.send[disabled] { opacity: 1; background: var(--field); color: var(--hint); }
.send:not([disabled]):active, .dq-a button:active, .ikb button:active, .pill:active, .bsend:active { transform: scale(.96); }

/* ---------- утренний разбор: режим выбора ---------- */
.s-bulk { background: var(--bg2); }
.note { margin: 0; padding: 12px 16px 8px; font-size: 13px; line-height: 1.4; color: var(--section-hint); }
.blist { background: var(--bg); border-top: .5px solid var(--sep); border-bottom: .5px solid var(--sep); }
.brow { display: flex; align-items: center; gap: 10px; padding-left: 12px; cursor: pointer; }
.brow .av { width: 46px; height: 46px; font-size: 17px; }
.brow .rb { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 9px 16px 9px 0; border-bottom: .5px solid var(--sep); }
.blist .brow:last-child .rb { border-bottom: 0; }
.ck { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--hint) 70%, transparent); display: grid; place-items: center; flex: none; color: transparent; transition: background .12s, border-color .12s; }
.ck .ic { width: 15px; height: 15px; stroke-width: 3; }
.brow.on .ck { background: var(--btn); border-color: var(--btn); color: var(--btn-text); }
.brow.done .ck { background: var(--green); border-color: var(--green); color: #fff; }
.brow .q { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: left; color: var(--hint); font-size: 15px; line-height: 1.3; white-space: pre-wrap; }
.dp.open { display: block; color: var(--text); }
.res { font-size: 13px; }
.res:empty { display: none; }
.res.sent { color: var(--green); } .res.err { color: var(--red); }
.bfoot { padding: 10px 16px calc(10px + var(--safe-b)); }
.bsend { width: 100%; height: 50px; border-radius: 12px; background: var(--btn); color: var(--btn-text); font-size: 17px; font-weight: 600; text-align: center; }

#toast { position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); background: color-mix(in srgb, var(--text) 86%, transparent); color: var(--bg);
  padding: 10px 16px; border-radius: 14px; font-size: 15px; max-width: 90vw; z-index: 30; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .94); display: grid; place-items: center; padding: var(--safe-t) 0 var(--safe-b); }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lb-close { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; width: 44px; height: 44px; border-radius: 50%; background: rgb(255 255 255 / .16); color: #fff; display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (prefers-reduced-transparency: reduce) { .cnav, .day span, .ikb button { -webkit-backdrop-filter: none; backdrop-filter: none; } .cnav { background: var(--header); } }
.editbar { display: flex; align-items: center; gap: 8px; margin: 0 2px 6px; padding: 2px 0 2px 10px; border-left: 3px solid var(--link); }
.eb-l { flex: 1; min-width: 0; }
.eb-l b { display: block; color: var(--link); font-size: 14px; font-weight: 600; }
.eb-l small { display: block; font-size: 14px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-x { width: var(--tap); height: 36px; display: grid; place-items: center; color: var(--hint); flex: none; }
.eb-x .ic { width: 20px; height: 20px; }
.search { background: color-mix(in srgb, var(--text) 8%, var(--header)); }

/* ---------- файл ученику: превью перед отправкой ---------- */
.fsheet { position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / .4); display: flex; align-items: flex-end; }
.fs-card { width: 100%; background: var(--bg); border-radius: 14px 14px 0 0; padding: 0 16px calc(16px + var(--safe-b)); max-height: 88%; display: flex; flex-direction: column; gap: 10px; }
html.mb-on .fs-card { padding-bottom: 16px; }
.fs-h { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; }
.fs-h b { font-size: 17px; font-weight: 600; }
.fs-x { color: var(--link); min-height: var(--tap); justify-self: start; }
.fs-prev { display: grid; place-items: center; background: var(--bg2); border-radius: 12px; min-height: 120px; overflow: hidden; }
.fs-img { max-width: 100%; max-height: 46vh; object-fit: contain; display: block; }
.fs-doc { margin: 16px; }
.fs-note { margin: 0; color: var(--hint); font-size: 14px; text-align: center; }
.fs-cap { border: .5px solid var(--sep); background: var(--field); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 17px; color: var(--text); }
.fs-send { min-height: 50px; border-radius: 12px; background: var(--btn); color: var(--btn-text); font-size: 17px; font-weight: 600; text-align: center; }
.screen > .scroll:last-child { padding-bottom: var(--safe-b); }
/* полоса под вырезом — цвета шапки, а не обоев */
.screen { padding-top: 0; }
.screen > :first-child { border-top: var(--safe-t) solid var(--header); }

/* «Поправить агента» */
.fix-agent { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; min-height: 36px; color: var(--link); font-size: 15px; }
.fix-agent svg { width: 16px; height: 16px; }
.cs-ta { border: .5px solid var(--sep); background: var(--field); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 17px; color: var(--text); resize: none; min-height: 120px; }
.cs-q { margin: 0; padding: 8px 12px; background: var(--bg2); border-radius: 10px; font-size: 14px; color: var(--text); max-height: 22vh; overflow: auto; }
.cs-q small { display: block; color: var(--hint); font-size: 12px; margin-bottom: 2px; }

/* ---------- моушн (motion.js): только transform/opacity, пружины, will-change точечно ---------- */
.s-chat { background-attachment: scroll; }   /* fixed-обои перерисовывались бы каждый кадр перехода */
.screen { overflow: hidden; }
.t-top, .t-under { will-change: transform; }
.t-top { box-shadow: -1px 0 0 rgb(0 0 0 / .06), -10px 0 28px rgb(0 0 0 / .1); }
.t-dim { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; }
/* под экраном (пока iOS убирает клавиатуру) — цвет темы, не белый: в диалоге цвет панели ввода */
html, body { background: var(--bg); }
html[data-view="conv"], html[data-view="conv"] body { background: var(--bar); }
html[data-view="morning"], html[data-view="morning"] body { background: var(--bg2); }

/* появление: новый пузырь и черновик агента — короткая пружина снизу */
@keyframes m-pop { from { opacity: 0; transform: translate3d(0, 14px, 0) scale(.94); } }
@keyframes m-up { from { opacity: 0; transform: translate3d(0, 22px, 0); } }
.b.enter { animation: m-pop .5s var(--sp-pop, cubic-bezier(.34,1.4,.64,1)) both; transform-origin: 0 100%; }
.b.out.enter { transform-origin: 100% 100%; }
.dq.enter { animation: m-up .5s var(--sp-pop, cubic-bezier(.34,1.4,.64,1)) both; }

/* нажатия: мгновенно на нажатие, мягко назад; строки списка — только подсветка, как в Telegram */
:is(.dq-a button, .chip, .seg-b, .send, .clip, .cav, .cback, .fs-x, .fs-send, .bsend, .ikb button, .pill, .more, .eb-x, .doc, .lb-close, .fix-agent, .dq-body) {
  transition: transform .32s var(--sp-dock, cubic-bezier(.32,.72,0,1)), background-color .2s ease-out, opacity .2s; }
:is(.dq-a button, .chip, .seg-b, .send, .clip, .cav, .cback, .fs-x, .fs-send, .bsend, .ikb button, .pill, .more, .eb-x, .doc, .lb-close, .fix-agent):active:not([disabled]) {
  transform: scale(.97); transition-duration: .08s; }
.dq-body:active { transform: scale(.985); transition-duration: .08s; }
.dq-a button:active:not([disabled]), .chip:active { background-color: color-mix(in srgb, var(--text) 13%, var(--field)); }
.dq-a button.pri:active:not([disabled]), .fs-send:active, .bsend:active, .pill:active { background-color: color-mix(in srgb, #000 14%, var(--btn)); }
.send:not([disabled]):active { background-color: color-mix(in srgb, #000 14%, var(--btn)); transform: scale(.92); }
.clip:active, .cback:active, .fs-x:active, .eb-x:active, .cav:active { opacity: .55; }
.row, .brow { transition: background-color .25s ease-out; }
.row:active, .brow:active { transition-duration: 0s; }
.seg-b::after { transition: transform .32s var(--sp-dock, ease-out); }
.send[disabled] { transition: transform .32s var(--sp-dock, ease-out), background-color .2s, color .2s; }

/* шторки: затемнение отдельным слоем, карточка выезжает снизу; высота — видимая область (над клавиатурой) */
.fsheet { background: none; top: var(--app-top, 0px); bottom: auto; height: var(--vis-h, 100%); }
.fsheet > .scrim { position: absolute; inset: -50vh 0 -50vh 0; background: rgb(0 0 0 / .4); }
.fs-card { position: relative; box-shadow: 0 50vh 0 50vh var(--bg); }
.fs-h { touch-action: none; cursor: grab; }
.fs-card::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: color-mix(in srgb, var(--hint) 45%, transparent); }

/* фото: фон отдельным слоем, картинка летит из превью */
.lightbox { background: none; touch-action: none; }
.lightbox > .lb-bg { position: absolute; inset: 0; background: rgb(0 0 0 / .94); }
.lightbox img { position: relative; transform-origin: 50% 50%; }
.lb-close { z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  .t-top { box-shadow: none; }
  .b.enter, .dq.enter { animation: m-fade .2s ease both !important; }
  @keyframes m-fade { from { opacity: 0; } }
}

/* ---------- онбординг ---------- */
/* Слой на цвете темы (никакого белого под ним); двигается только .onb-track — один transform, без reflow. */
.nav-t { position: relative; }
.nav-more { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: var(--tap); height: var(--tap); display: grid; place-items: center; color: var(--link); margin-top: -2px; }
.nav-more .ic { stroke-width: 3.2; }
.onb { position: fixed; inset: 0; z-index: 40; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; background: var(--bg); display: flex; flex-direction: column; padding: var(--safe-t) 0 calc(12px + var(--safe-b)); animation: onb-in .22s ease-out both; }
html.mb-on .onb { padding-bottom: 12px; }
@keyframes onb-in { from { opacity: 0; } }
.onb-h { display: flex; justify-content: flex-end; min-height: 48px; padding: 2px 8px; }
.onb-skip { min-height: var(--tap); padding: 0 10px; color: var(--link); font-size: 17px; }
.onb-vp { flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y; }
.onb-track { display: flex; height: 100%; will-change: transform; }
.onb-track.anim { transition: transform .42s var(--sp-dock, cubic-bezier(.32,.72,0,1)); }
.onb-s { flex: 0 0 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 28px; text-align: center; overflow: hidden; }
.onb-s h2 { margin: 26px 0 8px; font-size: 24px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.onb-s p { margin: 0; max-width: 330px; font-size: 16px; line-height: 1.38; color: var(--hint); text-wrap: pretty; }
.onb-ill { width: 100%; max-width: 320px; pointer-events: none; user-select: none; }
.onb-dots { display: flex; justify-content: center; gap: 8px; padding: 14px 0 10px; }
.onb-dots span { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--hint) 40%, transparent); transition: background-color .2s; }
.onb-dots span.on { background: var(--btn); }
.onb-next { margin: 4px 16px 0; text-align: center; outline: none; min-height: 50px; border-radius: 12px; background: var(--btn); color: var(--btn-text); font-size: 17px; font-weight: 600; }
.onb-next:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn) 35%, transparent); }
.onb-next:active { background-color: color-mix(in srgb, #000 14%, var(--btn)); }
@media (prefers-reduced-motion: reduce) { .onb { animation: none; } .onb-track.anim { transition: none; } }
@media (max-height: 640px) { .onb-s h2 { margin-top: 16px; font-size: 21px; } .onb-ill { transform: scale(.88); transform-origin: 50% 100%; } }

/* иллюстрации: уменьшенные куски интерфейса */
.ob-card { border-radius: 22px; overflow: hidden; padding: 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: 14px; line-height: 1.3;
  box-shadow: 0 0 0 .5px color-mix(in srgb, var(--sep) 70%, transparent), 0 10px 30px rgb(0 0 0 / .08); }
.ob-list { background: var(--bg2); padding: 12px 0 4px; gap: 0; }
.ob-wall { background: var(--wall); min-height: 230px; justify-content: flex-end; }
.ob-two { background: var(--bg2); gap: 10px; }
.ob-seg { display: flex; gap: 18px; padding: 0 14px; margin-bottom: 2px; border-bottom: .5px solid var(--sep); }
.ob-seg span { position: relative; padding: 2px 2px 8px; font-size: 13px; font-weight: 500; color: var(--hint); }
.ob-seg span.on { color: var(--link); }
.ob-seg span.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.5px; border-radius: 3px 3px 0 0; background: var(--link); }
.ob-seg b { display: inline-block; margin-left: 4px; font-size: 11px; line-height: 16px; min-width: 16px; padding: 0 5px; border-radius: 8px; background: var(--link); color: var(--btn-text); text-align: center; font-weight: 600; }
.ob-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg); }
.ob-list .ob-row + .ob-row { box-shadow: inset 58px .5px 0 -58px var(--sep); }
.ob-two .ob-row { border-radius: 14px; }
.ob-rb { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ob-rb b { font-weight: 600; font-size: 14px; }
.ob-rb > span { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-rb i { font-style: normal; color: var(--text); font-weight: 500; }
.ob-cnt { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--btn); color: var(--btn-text); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.ob-b { max-width: 82%; padding: 7px 11px; border-radius: 16px; box-shadow: var(--b-shadow); }
.ob-b.in { align-self: flex-start; background: var(--b-in); border-bottom-left-radius: 5px; }
.ob-b.out { align-self: flex-end; background: var(--b-out); border-bottom-right-radius: 5px; }
.ob-ph { padding: 3px; }
.ob-img { display: block; width: 150px; height: 110px; border-radius: 13px; background: repeating-linear-gradient(0deg, #faf8f0 0 14px, #c8d2e6 14px 15px); position: relative; }
.ob-img::after { content: ""; position: absolute; left: 58px; top: 26px; width: 34px; height: 54px; border: 3px solid #333; border-top-width: 6px; border-bottom: 0; border-radius: 2px; }
.ob-dq { background: var(--bg); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--b-shadow); }
.ob-dql { display: inline-flex; align-items: center; gap: 5px; color: var(--link); font-size: 13px; font-weight: 600; }
.ob-dql .ic, .ob-fix b .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.ob-dqt { color: var(--text); }
.ob-dqa { display: flex; gap: 6px; }
.ob-dqa span { flex: 1; text-align: center; padding: 6px 0; border-radius: 9px; background: var(--field); font-size: 13px; font-weight: 500; color: var(--link); }
.ob-mb, .ob-pill { text-align: center; padding: 10px 0; border-radius: 11px; background: var(--btn); color: var(--btn-text); font-weight: 600; }
.ob-pill { padding: 5px 12px; border-radius: 14px; font-size: 13px; }
.ob-svc { align-self: center; padding: 4px 10px; border-radius: 12px; background: var(--svc); color: #fff; font-size: 13px; font-weight: 500; }
.ob-ikb { display: flex; gap: 4px; }
.ob-ikb span { flex: 1; text-align: center; padding: 9px 0; border-radius: 10px; background: var(--svc); color: #fff; font-size: 13px; font-weight: 500; }
.ob-note { align-self: center; font-size: 12px; color: #fff; background: var(--svc); padding: 3px 10px; border-radius: 10px; }
.ob-comp { display: flex; align-items: center; gap: 8px; margin: 2px -14px -14px; padding: 8px 10px; background: var(--bar); }
.ob-comp > .ic { width: 22px; height: 22px; color: var(--hint); }
.ob-field { flex: 1; padding: 6px 12px; border-radius: 16px; background: var(--bg); color: var(--hint); font-size: 13px; box-shadow: 0 0 0 .5px var(--sep); }
.ob-send { width: 30px; height: 30px; border-radius: 50%; background: var(--btn); color: var(--btn-text); display: grid; place-items: center; }
.ob-send .ic { width: 16px; height: 16px; fill: currentColor; stroke-width: 1.4; }
.ob-fix { background: var(--bg); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.ob-fix b { display: inline-flex; align-items: center; gap: 5px; color: var(--link); font-size: 13px; }
.ob-fix span { padding: 8px 10px; border-radius: 10px; background: var(--field); }
.onb:focus { outline: none; }

/* ---------- подсказки к кнопкам ---------- */
[data-tip] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.coach { position: fixed; inset: 0; z-index: 35; opacity: 0; transition: opacity .2s ease-out; }
.coach.on { opacity: 1; }
.co-hole { position: absolute; left: 0; top: 0; border-radius: 12px; box-shadow: 0 0 0 200vmax rgb(0 0 0 / .55); pointer-events: auto;
  transition: transform .34s var(--sp-dock, cubic-bezier(.32,.72,0,1)), width .34s var(--sp-dock, ease-out), height .34s var(--sp-dock, ease-out); }
.co-hole[hidden] { display: block; width: 0 !important; height: 0 !important; box-shadow: 0 0 0 200vmax rgb(0 0 0 / .55); }
.co-tip { position: absolute; left: 12px; right: 12px; max-width: 420px; margin: 0 auto; padding: 14px 16px 10px; border-radius: 16px; background: var(--bg); color: var(--text);
  box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
.co-tip::after { content: ""; position: absolute; left: var(--ax, 50%); width: 14px; height: 14px; background: var(--bg); transform: rotate(45deg); border-radius: 2px; }
.co-tip[data-arrow="up"]::after { top: -6px; }
.co-tip[data-arrow="down"]::after { bottom: -6px; }
.co-tip b { display: block; font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.co-tip p { margin: 0; font-size: 15px; line-height: 1.35; color: color-mix(in srgb, var(--text) 80%, var(--hint)); }
.co-a { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.co-a small { flex: 1; color: var(--hint); font-size: 13px; }
.co-skip, .co-next { min-height: var(--tap); padding: 0 10px; font-size: 16px; color: var(--link); }
.co-skip { color: var(--hint); }
.co-next { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .coach, .co-hole { transition: none; } }

/* ---------- обратная связь ---------- */
.onb-fb { margin-top: 14px; min-height: var(--tap); padding: 0 12px; color: var(--link); font-size: 16px; font-weight: 500; }
.fb-row { display: flex; align-items: center; gap: 10px; }
.fb-add { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--link); font-size: 16px; }
.fb-add .ic { width: 20px; height: 20px; }
.fb-shot { position: relative; }
.fb-shot img { display: block; width: 72px; height: 96px; object-fit: cover; border-radius: 10px; box-shadow: 0 0 0 .5px var(--sep); }
.fb-x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--text) 70%, var(--bg)); color: var(--bg); display: grid; place-items: center; }
.fb-x .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.fb-add[hidden], .fb-shot[hidden] { display: none; }
