/* Поддержка (AI-14347): плитка в меню, экран с частыми вопросами и
   обращениями, новое обращение, переписка. Компоненты штатные (.btn, .input,
   .chip, .card, .empty-block, .app-footer), цвета — токены iiko.css. */

.menu-header-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
/* Плитка «Поддержка» в конце списка разделов: метка непрочитанного вместо шеврона слева от него. */
.menu-card .support-badge { margin-right: calc(var(--sp-2) * -1); }

.support-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full);
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.support-badge[hidden] { display: none; }

/* ── Экраны прижаты к видимой полосе: список прокручивается внутри, кнопка и
      поле ввода стоят у низа и над клавиатурой (--vvh, viewport_fit.js) ──── */
@supports (height: 100dvh) {
  #screen-support.is-active.uses-shell,
  #screen-support-new.is-active.uses-shell,
  #screen-support-chat.is-active.uses-shell {
    height: var(--vvh, 100dvh); max-height: var(--vvh, 100dvh); min-height: 0;
  }
}
.support-main-btn { width: 100%; }
.support-section > .eyebrow { margin-bottom: 8px; }
.support-section[hidden] { display: none; }
.support-footer-error { margin-bottom: var(--sp-2); overflow-wrap: anywhere; }

/* ── Частые вопросы ──────────────────────────────────────────────────────── */
.support-faq-search { margin-bottom: var(--sp-2); }
.support-faq-list {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-xl);
  overflow: hidden;
}
.support-faq-list:empty { display: none; }
.support-faq-item + .support-faq-item { border-top: 1px solid var(--hairline); }
.support-faq-q {
  width: 100%; min-height: 48px; padding: 12px var(--sp-4);
  display: flex; align-items: flex-start; gap: var(--sp-3);
  text-align: left; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--ink);
}
.support-faq-q > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.support-faq-q .ic { margin-top: 2px; color: var(--ink-faint); transition: transform var(--dur-fast) var(--ease); }
.support-faq-item.is-open .support-faq-q .ic { transform: rotate(180deg); }
.support-faq-a {
  padding: 0 var(--sp-4) var(--sp-4);
  font-size: 14px; line-height: 1.55; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.support-faq-a[hidden] { display: none; }
.support-faq-more { margin-top: var(--sp-2); width: 100%; }
.support-note { font-size: 13px; line-height: 1.5; color: var(--ink-muted); overflow-wrap: anywhere; }
.support-note[hidden] { display: none; }

/* ── Мои обращения ───────────────────────────────────────────────────────── */
.support-tickets { display: flex; flex-direction: column; gap: 10px; }
.support-ticket {
  width: 100%; text-align: left;
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-xl);
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease);
}
.support-ticket:hover { border-color: var(--ink); }
.support-ticket-top { display: flex; align-items: baseline; gap: var(--sp-3); }
.support-ticket-subject {
  flex: 1; min-width: 0; font-size: 15px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.support-ticket-time { flex-shrink: 0; font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.support-ticket-preview {
  font-size: 13px; line-height: 1.45; color: var(--ink-muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.support-ticket-bottom { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.support-status-resolved { color: var(--ink-muted); }

/* ── Новое обращение ─────────────────────────────────────────────────────── */
.support-textarea { display: block; resize: none; line-height: 1.5; min-height: 132px; }

/* ── Изображения до отправки ─────────────────────────────────────────────── */
.support-tray { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.support-tray:empty { display: none; }
.support-thumb {
  position: relative; width: 64px; height: 64px; flex-shrink: 0;
  border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-sunken); border: 1px solid var(--hairline-strong);
}
.support-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.support-thumb.is-uploading img { opacity: 0.45; }
.support-thumb-spin { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.support-thumb-spin .spinner { margin: 0; width: 16px; height: 16px; }
.support-thumb-remove {
  position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: rgb(26 26 26 / 0.72); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
/* Зона нажатия 44 px при видимом кружке 24 px. */
.support-thumb-remove::after { content: ''; position: absolute; inset: -10px; }
.support-thumb-remove .ic { width: 12px; height: 12px; }
.support-tray-count { font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.support-attach-row { display: flex; flex-direction: column; gap: var(--sp-2); }
.support-attach-btn { width: 100%; }

/* ── Переписка ───────────────────────────────────────────────────────────── */
.support-chat-head { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.support-chat-head .app-title { flex: none; line-height: 1.25; }
.support-chat-sub { font-size: 12px; line-height: 1.3; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-chat-sub:empty { display: none; }

.support-chat-scroll { position: relative; }
.support-chat-inner { padding-top: var(--sp-4); padding-bottom: var(--sp-4); }
.support-messages { display: flex; flex-direction: column; gap: var(--sp-2); }
.support-state { padding: var(--sp-8) var(--sp-4); text-align: center; font-size: 14px; line-height: 1.5; color: var(--ink-muted); display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }

.support-day, .support-system {
  align-self: center; max-width: 100%; text-align: center;
  font-size: 12px; line-height: 1.4; color: var(--ink-subtle); overflow-wrap: anywhere;
  padding: 4px 0;
}
.support-system { color: var(--ink-muted); font-weight: 600; }

.support-msg { display: flex; flex-direction: column; gap: 4px; max-width: 82%; min-width: 0; }
.support-msg.is-user { align-self: flex-end; align-items: flex-end; }
.support-msg.is-staff { align-self: flex-start; align-items: flex-start; }
.support-msg-author { font-size: 11px; font-weight: 700; letter-spacing: 0.3px; color: var(--ink-subtle); padding: 0 4px; }
.support-bubble {
  max-width: 100%; min-width: 0;
  padding: 10px 12px; border-radius: var(--r-xl);
  display: flex; flex-direction: column; gap: 6px;
  font-size: 15px; line-height: 1.45;
}
.support-msg.is-staff .support-bubble { background: var(--surface); border: 1px solid var(--hairline-strong); border-bottom-left-radius: var(--r-xs); color: var(--ink); }
.support-msg.is-user .support-bubble { background: var(--ink); color: var(--ink-inverse); border-bottom-right-radius: var(--r-xs); }
.support-msg.is-pending .support-bubble { opacity: 0.6; }
.support-msg.is-failed .support-bubble { background: var(--danger-bg); color: var(--ink); }
.support-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.support-msg-time { align-self: flex-end; font-size: 11px; line-height: 1; opacity: 0.6; font-variant-numeric: tabular-nums; }
.support-msg-failed { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-2); font-size: 13px; line-height: 1.4; color: var(--danger); overflow-wrap: anywhere; }

.support-images { display: flex; flex-wrap: wrap; gap: 4px; }
.support-image {
  position: relative; display: block; width: 200px; max-width: 100%; max-height: 260px;
  border-radius: var(--r-md); overflow: hidden; background: rgb(128 128 128 / 0.18);
}
.support-images.is-many .support-image { width: calc(50% - 2px); aspect-ratio: 1 / 1 !important; }
.support-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.support-image img[hidden] { display: none; }
.support-image-fail { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 6px; font-size: 11px; line-height: 1.3; text-align: center; }

.support-newer {
  position: sticky; bottom: var(--sp-3); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  box-shadow: var(--shadow-md); z-index: 2;
}
.support-newer[hidden] { display: none; }

/* Поле ввода: три контрола одной высоты, прижаты к нижней кромке строки. */
.support-composer-footer .app-footer-inner { display: flex; flex-direction: column; gap: var(--sp-2); }
.support-composer { display: flex; align-items: flex-end; gap: var(--sp-2); }
.support-composer .btn-icon-only { width: 44px; height: 44px; min-height: 44px; flex-shrink: 0; }
.support-composer-input {
  flex: 1; min-width: 0; display: block; resize: none;
  height: 44px; min-height: 44px; max-height: 132px; padding: 10px 14px; line-height: 21px;
  border-radius: var(--r-xl);
}
.support-composer-footer .form-error { min-height: 0; overflow-wrap: anywhere; }
