/* Файлы в чатах, привязка чата к ученику и «Чаты учеников» в кабинете репетитора (docs/stage5/chat_access.md). */

/* ── скрепка, список вложений, перетаскивание ── */
.cmp-attach { width: 42px; padding: 0; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.cmp-attach[hidden] { display: none; }
.att-tray { list-style: none; margin: 0 auto 8px; padding: 0; max-width: 780px; display: flex; flex-wrap: wrap; gap: 8px; }
.att-tray[hidden], .att-note[hidden], .att-drop[hidden] { display: none; }
.att-item { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 4px 4px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
.att-thumb { width: 40px; height: 40px; flex: none; border-radius: 8px; object-fit: cover; background: var(--paper); }
.att-ext { display: inline-flex; align-items: center; justify-content: center; font: 600 11px/1 var(--mono); text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--line); }
.att-name { min-width: 0; display: grid; font-size: 13.5px; line-height: 1.25; overflow-wrap: anywhere; max-width: 220px; }
.att-name small { color: var(--ink-3); font: 500 11.5px/1.3 var(--mono); }
.att-x { flex: none; border-color: transparent; color: var(--ink-3); }
.att-note { max-width: 780px; margin: 0 auto 6px; font-size: 12.5px; color: var(--ink-3); }
.th { position: relative; }
.att-drop { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; background: rgba(243, 245, 240, 0.88); border: 2px dashed var(--marker); border-radius: 12px; pointer-events: none; font-weight: 600; color: var(--marker-ink); }

/* ── «Кто это» в панели «Заявка» ── */
.chat-link { display: grid; gap: 8px; margin-bottom: 14px; }
.chat-link .row { display: flex; gap: 8px; flex-wrap: wrap; }
.cl-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cl-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cl-links > li { display: grid; gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cl-links > li:last-child { padding-bottom: 0; border-bottom: 0; }
.cl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.cl-pick { display: grid; width: 100%; text-align: left; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; font: inherit; color: inherit; }
.cl-pick:hover, .cl-pick:focus-visible { border-color: var(--marker); background: var(--marker-soft); }
.cl-pick small { color: var(--ink-3); }

/* ── «Чаты учеников» у репетитора ── */
.tc-cols { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 14px; align-items: start; }
.tc-list { min-width: 0; }
.tc-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tc-item { display: grid; width: 100%; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; font: inherit; color: inherit; }
.tc-item:hover, .tc-item:focus-visible, .tc-item.on { border-color: var(--marker); background: var(--marker-soft); }
.tc-top { display: flex; justify-content: space-between; gap: 8px; }
.tc-top time { color: var(--ink-3); font: 500 12px/1.5 var(--mono); }
.tc-sub { color: var(--ink-3); font-size: 13px; }
.tc-last { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-last.unread { font-weight: 700; color: var(--ink); }
.tc-thread { min-width: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--paper); }
.tc-th { display: flex; flex-direction: column; height: min(72vh, 680px); }
.tc-scroll { flex: 1 1 auto; }
.tc-title { display: grid; min-width: 0; }
.tc-back { display: none; }
.tc-state { padding: 14px; }
@media (max-width: 760px) {
  .tc-cols { grid-template-columns: minmax(0, 1fr); }
  .tchats.is-open .tc-list { display: none; }
  .tchats:not(.is-open) .tc-thread { display: none; }
  .tc-back { display: inline-flex; }
}

/* ── оба чата репетитора («Группа школы», «Чаты учеников»): на всё окно, мельче и плотнее (владелец 11 нояб. 2026:
   «убери фразу и сделай чат более большим уменьши размер текста в чатах чтобы больше сообщений было видно»).
   Только .tc-tutor — экраны кабинета; чаты сотрудников и «Группы репетиторов» не меняются. Шрифт поля ввода не трогаем:
   на телефоне он не меньше 16px, иначе Safari приближает страницу. ── */
.tc-tutor { flex: 1 1 auto; min-width: 0; min-height: 340px; display: flex; flex-direction: column; padding: 10px clamp(8px, 2vw, 20px); }
.tc-tutor > .tc-thread { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.tc-tutor .tc-cols { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; gap: 10px; }
.tc-tutor .tc-cols > .tc-list { min-height: 0; overflow-y: auto; }
.tc-tutor .tc-cols > .tc-thread { min-height: 0; display: flex; flex-direction: column; }
.tc-tutor .tc-cols > .tc-thread[hidden] { display: none; }
.tc-tutor .tc-th { flex: 1 1 auto; height: auto; min-height: 0; }
.tc-tutor .th-head { padding: 6px 12px; gap: 8px; }
.tc-tutor .tc-title b { font-size: 15px; line-height: 1.3; }
.tc-tutor .tc-title .small { font-size: 12px; }
.tc-tutor .th-scroll { padding: 8px 10px 6px; }
.tc-tutor .msgs { gap: 3px; max-width: 900px; }
.tc-tutor .cmp-row, .tc-tutor .cmp-foot, .tc-tutor .tf-tools, .tc-tutor .att-tray, .tc-tutor .att-note, .tc-tutor .cc-sched,
.tc-tutor .tf-reply { max-width: 900px; margin-left: auto; margin-right: auto; }      /* поле ввода и всё над ним — по краю ленты */
.tc-tutor .day { margin: 6px 0 2px; }
.tc-tutor .bubble { padding: 4px 9px 3px; border-radius: 12px; max-width: min(82%, 640px); }
.tc-tutor .msg.in .bubble { border-bottom-left-radius: 4px; }
.tc-tutor .msg.out .bubble { border-bottom-right-radius: 4px; }
.tc-tutor .mtext { font-size: 13.5px; line-height: 1.35; }
.tc-tutor .meta { margin-top: 1px; font-size: 10px; }
.tc-tutor .tf-card, .tc-tutor .tf-quote { margin-bottom: 2px; font-size: 12px; }
.tc-tutor .tf-askline { margin-top: 4px; gap: 4px; }
.tc-tutor .mmore { width: 24px; height: 24px; }
.tc-tutor .mimg { width: 180px; height: 135px; }
.tc-tutor .composer { padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); }
.tc-tutor .cmp-ta { min-height: 36px; padding: 7px 10px; }
.tc-tutor .cmp-row .btn { min-height: 36px; }
.tc-tutor .cmp-foot { margin-top: 3px; min-height: 0; font-size: 11px; line-height: 14px; }
.tc-tutor .tc-item { padding: 7px 10px; }
.tc-tutor .tc-last { font-size: 13px; }
@media (max-width: 760px) {
  .tc-tutor:not(.is-open) .tc-cols > .tc-thread { display: none; }                /* на узком экране — список или чат */
  .tc-tutor .bubble { max-width: calc(100% - 30px); }                             /* на телефоне пузыри не уже прежнего */
}

/* «Родители в чатах» и значок «ждёт ответа» у репетитора */
.tc-wait { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; line-height: 18px; font-weight: 600; }
.tp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.tp-who { display: grid; min-width: 0; }
.tp-who b { overflow: hidden; text-overflow: ellipsis; }
