/* ALATAR TEAM — рабочий кабинет. Стили. */

:root {
  /* Поверхности */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f0f2f5;

  /* Текст */
  --ink: #14161a;
  --ink-2: #4d545e;
  --ink-3: #838c98;
  --ink-4: #aeb6c0;

  /* Границы */
  --line: #e4e7ec;
  --line-strong: #d3d8e0;

  /* Акцент */
  --accent: #1c1f26;
  --accent-ink: #ffffff;

  /* Статусы */
  --st-planned-bg: #eef0f3;
  --st-planned-fg: #5b636e;
  --st-progress-bg: #e6effb;
  --st-progress-fg: #21538f;
  --st-review-bg: #fdf3e2;
  --st-review-fg: #8a5a12;
  --st-done-bg: #e6f4ea;
  --st-done-fg: #1d6b38;
  --st-accepted-bg: #e8ecf8;
  --st-accepted-fg: #33418c;
  --st-closed-bg: #eef0f3;
  --st-closed-fg: #5b636e;
  --st-danger-bg: #fdecec;
  --st-danger-fg: #a52a2a;

  /* Тени */
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, .06);
  --shadow-md: 0 4px 16px rgba(20, 22, 26, .08);
  --shadow-lg: 0 18px 48px rgba(20, 22, 26, .16);

  /* Геометрия */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;

  --topbar-h: 60px;
  --content-max: 1080px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

/* ---------- Общие элементы ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: #2c313a; }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }

.btn-danger {
  background: transparent;
  color: var(--st-danger-fg);
  border-color: transparent;
}
.btn-danger:hover:not(:disabled) { background: var(--st-danger-bg); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.notif-btn.is-on::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--st-done-fg);
  box-shadow: 0 0 0 3px var(--st-done-bg);
}

.notif-btn.is-off {
  color: var(--ink-3);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus {
  outline: none;
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(20, 22, 26, .07);
}
.input-sm { width: auto; padding: 6px 10px; font-size: 13px; }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
select.input { cursor: pointer; }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-2);
}

.form-hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-3);
}

/* ---------- Экран входа ---------- */

.gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  background:
    radial-gradient(1000px 600px at 12% -8%, #eef1f5 0%, transparent 62%),
    radial-gradient(800px 500px at 92% 108%, #e9edf3 0%, transparent 58%),
    var(--bg);
}

.gate-card {
  width: 100%;
  max-width: 384px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.gate-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.gate-logo {
  flex: none;
  width: 56px;
  height: 56px;
  padding: 7px;
  border-radius: var(--r-md);
  background: var(--accent);
  object-fit: contain;
}

.gate-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.25;
}

.gate-sub {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.3;
}

.gate-error {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--st-danger-bg);
  color: var(--st-danger-fg);
  font-size: 13.5px;
}

/* ---------- Верхняя панель ---------- */

.app { min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-logo {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 4px;
  border-radius: var(--r-sm);
  background: var(--accent);
  object-fit: contain;
}

.topbar-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  padding: 7px 13px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.tab:hover { background: var(--surface-3); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface-3); color: var(--ink); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.presence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.presence .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--st-done-fg);
  box-shadow: 0 0 0 3px var(--st-done-bg);
}

.user-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 550;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 11px;
  color: var(--ink-3);
}

/* ---------- Контент ---------- */

.main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.view-title {
  margin: 0;
  font-size: 21px;
  font-weight: 620;
  letter-spacing: -.02em;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-deadline {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--st-accepted-bg);
  color: var(--st-accepted-fg);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.plan-deadline.is-overdue {
  background: var(--st-danger-bg);
  color: var(--st-danger-fg);
}

.list { display: flex; flex-direction: column; gap: 10px; }

.empty {
  margin: 40px 0;
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
}

/* ---------- Карточка ---------- */

.card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.card:hover { border-color: var(--line-strong); }

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-main { flex: 1; min-width: 0; }

.card-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.card-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.card-route {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

/* ---------- Статусы ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

.badge-planned   { background: var(--st-planned-bg);  color: var(--st-planned-fg); }
.badge-in_progress { background: var(--st-progress-bg); color: var(--st-progress-fg); }
.badge-review    { background: var(--st-review-bg);   color: var(--st-review-fg); }
.badge-done      { background: var(--st-done-bg);     color: var(--st-done-fg); }
.badge-accepted  { background: var(--st-accepted-bg); color: var(--st-accepted-fg); }
.badge-sent      { background: var(--st-progress-bg); color: var(--st-progress-fg); }
.badge-read      { background: var(--st-accepted-bg); color: var(--st-accepted-fg); }
.badge-open      { background: var(--st-progress-bg); color: var(--st-progress-fg); }
.badge-answered  { background: var(--st-done-bg);     color: var(--st-done-fg); }
.badge-closed    { background: var(--st-closed-bg);   color: var(--st-closed-fg); }
.badge-overdue   { background: var(--st-danger-bg);   color: var(--st-danger-fg); }

/* ---------- Прогресс ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
}

.progress-track {
  flex: 1;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--ink);
  transition: width .25s ease;
}

.progress-num {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  min-width: 34px;
  text-align: right;
}

/* ---------- Файлы ---------- */

.file-btn { position: relative; overflow: hidden; }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink-3);
}

.file-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  flex: none;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.file-meta {
  font-size: 11.5px;
  color: var(--ink-4);
}

.file-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.file-thumb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--ink-2);
  text-decoration: none;
}

.file-thumb-img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-3);
}

.file-thumb:hover .file-thumb-img {
  border-color: var(--line-strong);
}

.file-thumb-name {
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Комментарии и ответы ---------- */

.thread {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment {
  display: flex;
  gap: 10px;
}

.avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-2);
  text-transform: uppercase;
}

.comment-body { flex: 1; min-width: 0; }

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 1px;
}

.comment-author { font-size: 12.5px; font-weight: 600; }
.comment-time { font-size: 11px; color: var(--ink-4); }

.comment-text {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.reply-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.reply-form .input { flex: 1; }

/* ---------- Модальное окно ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 26, .42);
  backdrop-filter: blur(2px);
  animation: fade-in .16s ease;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in .18s cubic-bezier(.2, .8, .3, 1);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -.01em;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 20px;
}

@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(.985) }
  to   { opacity: 1; transform: none }
}

/* ---------- Тосты ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translateX(-50%);
  max-width: min(440px, calc(100vw - 40px));
  padding: 11px 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease;
}

.toast.is-error { background: var(--st-danger-fg); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px) }
  to   { opacity: 1; transform: translate(-50%, 0) }
}

/* ---------- Чат ---------- */

.chat {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.chat-side {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-item:hover { background: var(--surface-3); }
.chat-item.is-active { background: var(--surface-3); }
.chat-item:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

.chat-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-item-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-unread {
  flex: none;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.chat-item-preview {
  display: block;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-status {
  font-size: 12px;
  color: var(--ink-4);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 560px;
  max-height: calc(100dvh - 200px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.chat-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.chat-head-actions {
  flex: none;
  display: flex;
  align-items: center;
}

.chat-head-text { min-width: 0; }

.chat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.chat-members {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.chat-members-label {
  font-size: 12px;
  color: var(--ink-3);
}

.chat-member {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.6;
}

.chat-member-kick {
  border: 0;
  padding: 0 0 0 1px;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.chat-member-kick:hover { color: var(--st-danger-fg); }
.chat-member-kick:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.invite .gate-card { max-width: 420px; }

.invite-text {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.5;
}

.invite-home { margin-top: 10px; }

.chat-messages {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-2);
}

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
}
.chat-msg.is-mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg .avatar {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.chat-bubble {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.chat-msg.is-mine .chat-bubble {
  border-color: var(--st-progress-bg);
  background: var(--st-progress-bg);
}

.chat-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.chat-msg-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.chat-msg-time {
  font-size: 10.5px;
  color: var(--ink-4);
}

.chat-text {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.chat-file {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--ink-2);
  text-decoration: none;
}
.chat-file:hover .chat-file-name {
  color: var(--ink);
  text-decoration: underline;
}

.chat-image {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  object-fit: contain;
}

.chat-file-name {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.chat-form {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.chat-attach {
  flex: none;
  cursor: pointer;
}
.chat-attach span {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 120px;
  padding: 8px 10px;
  resize: none;
}

.chat-hint { grid-column: 1 / -1; }

/* ---------- Адаптив ---------- */

@media (max-width: 1024px) {
  .presence { display: none; }
  .topbar { gap: 14px; padding: 0 16px; }
}

@media (max-width: 860px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px 0;
    gap: 8px 12px;
  }
  .topbar-text { display: none; }
  .topbar-right { gap: 8px; }
  .tabs {
    order: 3;
    width: 100%;
    margin: 0 -2px;
    padding-bottom: 8px;
    gap: 2px;
  }
  .tab { padding: 7px 11px; }
  .main { padding: 20px 14px 64px; }
  .view-title { font-size: 19px; }
  .user-chip { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .gate-card { padding: 24px 20px; border-radius: var(--r-md); }
  .card { padding: 14px; }
  .card-head { gap: 8px; }
  .progress { min-width: 100%; order: 3; }
  .card-meta { gap: 8px; }
  .view-actions { width: 100%; }
  .view-actions .input-sm { flex: 1; }
  .modal { padding: 12px; align-items: flex-end; }
  .modal-card {
    max-width: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: calc(100dvh - 24px);
  }
}

/* Узкие экраны: вкладки не должны обрезаться */
@media (max-width: 380px) {
  .topbar { padding: 8px 10px 0; gap: 6px 8px; }
  .tab { padding: 6px 9px; font-size: 12.5px; }
  .main { padding: 16px 10px 56px; }
  .view-title { font-size: 18px; }
  .card { padding: 12px; }
  .card-title { font-size: 14.5px; }
  .progress-num { min-width: 30px; }
}

@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat-panel {
    height: 520px;
    max-height: calc(100dvh - 260px);
  }
  .chat-msg { max-width: 94%; }
}

@media (max-width: 560px) {
  .chat-form { gap: 6px; padding: 10px; }
  .chat-messages { padding: 12px; }
  .chat-attach span { max-width: 74px; }
}

@media (max-width: 380px) {
  .chat-form .btn { padding: 6px 9px; }
  .chat-attach span { max-width: 56px; }
}

/* ---------- Звонок ---------- */

.call {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
}

.call-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.call-head-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.call-title {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -.01em;
}

.call-sub {
  font-size: 12px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.call-timer {
  flex: none;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.call-roster {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.call-roster:empty { display: none; }

.call-roster-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
}

.call-roster-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-4);
}

.call-roster-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-roster-tag {
  flex: none;
  color: var(--st-done-fg);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.call-roster-item.is-speaking {
  border-color: var(--st-done-fg);
  background: var(--st-done-bg);
  color: var(--st-done-fg);
}

.call-roster-item.is-speaking .call-roster-dot { background: var(--st-done-fg); }

.call-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  overflow: auto;
  background: var(--bg);
}

.call-tile {
  position: relative;
  flex: 1 1 240px;
  max-width: 560px;
  min-height: 160px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
  overflow: hidden;
}

.call-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink);
}

.call-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 24px;
  font-weight: 650;
  text-transform: uppercase;
}

.call-tile.has-video .call-avatar { display: none; }

.call-name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  max-width: calc(100% - 20px);
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-mute-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-mute-btn:hover:not(:disabled) {
  color: var(--st-danger-fg);
  border-color: var(--st-danger-fg);
}
.call-mute-btn:disabled { cursor: default; opacity: .75; }
.call-mute-btn.is-done {
  color: var(--st-danger-fg);
  background: var(--st-danger-bg);
  border-color: transparent;
}

.call-tile.is-muted .call-avatar { opacity: .6; }

.call-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 20px);
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--st-done-bg);
  color: var(--st-done-fg);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.call-badge::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--st-done-fg);
}

.call-tile.is-speaking {
  border-color: var(--st-done-fg);
  box-shadow: 0 0 0 2px var(--st-done-bg);
}

.call-controls {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.call-btn:hover { border-color: var(--line-strong); }
.call-btn.is-off { color: var(--ink-3); background: var(--surface-2); }
.call-btn.is-on { background: var(--st-done-bg); border-color: transparent; color: var(--st-done-fg); }
.call-btn.is-recording {
  background: var(--st-danger-bg);
  border-color: transparent;
  color: var(--st-danger-fg);
}
.call-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.call-btn-leave {
  width: auto;
  padding: 0 20px;
  border-radius: var(--r-pill);
  border-color: transparent;
  background: var(--st-danger-bg);
  color: var(--st-danger-fg);
  font-size: 13.5px;
  font-weight: 600;
}

@media (max-width: 560px) {
  .call-head { padding: 10px 14px; }
  .call-roster { padding: 8px 14px; gap: 6px; }
  .call-stage { padding: 12px; gap: 10px; }
  .call-tile { flex-basis: 100%; min-height: 140px; }
  .call-controls { padding: 12px; gap: 8px; }
  .call-btn { width: 44px; height: 44px; }
  .call-btn-leave { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
