/* Shared modal styles — matches panel.php "Добавить устройство" design */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000; /* выше фикс-навбара (100) с запасом; dropdown'ы внутри модалок — ещё выше */
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  /* Высокая модалка прокручивается ЦЕЛИКОМ внутри оверлея (margin:auto у
     .modal-box) — шапка с крестиком всегда достижима прокруткой вверх.
     Раньше бокс резался max-height и скроллился внутри, а его верх уезжал
     за фикс-меню без шанса доскроллить. */
  overflow-y: auto;
  padding: 24px 16px;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  margin: auto; /* центр, а при переполнении — прокрутка с самого верха */
  height: fit-content;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  animation: modalFadeIn 0.2s ease;
}

.modal-box::-webkit-scrollbar {
  display: none;                  /* Chrome / Safari */
}

.modal-box.modal-wide {
  max-width: 600px;
}

.modal-box.modal-xl {
  max-width: 800px;
}

/* Для форм с сеткой из многих полей — разметка колонок загружаемого файла. */
.modal-box.modal-xxl {
  max-width: 1040px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f2937;
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: #1f2937;
}

.modal-body {
  padding: 20px 24px 24px;
}

/* Tabs */
.modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #e5e7eb;
}

.modal-tab {
  padding: 8px 16px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.modal-tab:hover {
  color: #374151;
}

.modal-tab.active {
  color: var(--accent, #005BFF);
  border-bottom-color: var(--accent, #005BFF);
}

/* Diagnose result */
.diagnose-result {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.8125rem;
  margin-top: 12px;
}

.diagnose-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}

.diagnose-row:last-child {
  border-bottom: none;
}

.diagnose-label {
  color: #64748b;
}

.diagnose-value {
  font-weight: 600;
  color: #1e293b;
}

.diagnose-ok { color: #10b981; }
.diagnose-error { color: #ef4444; }
.diagnose-warn { color: #f59e0b; }

/* Info hint banner */
.modal-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  background: #f0f4ff;
  border: 1px solid #dbe4ff;
  border-radius: 10px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #4b5e8a;
}

.modal-hint i {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent, #005BFF);
  font-size: 0.875rem;
}

/* Те же поля используются и вне диалога — например, блок «Данные школы»
   на странице школ, куда форма переехала из модального окна. Поэтому у
   каждого селектора есть двойник .rx-form: класс вешается на любой
   страничный контейнер с .form-group, и поля выглядят одинаково. */
.modal-body .form-group,
.rx-form .form-group {
  margin-bottom: 16px;
}

.modal-body .form-group label,
.rx-form .form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
}

.modal-body .form-group .required,
.rx-form .form-group .required {
  color: #ef4444;
}

.modal-body .form-group input[type="text"],
.rx-form .form-group input[type="text"],
.modal-body .form-group input[type="number"],
.rx-form .form-group input[type="number"],
.modal-body .form-group input[type="email"],
.rx-form .form-group input[type="email"],
.modal-body .form-group input[type="password"],
.rx-form .form-group input[type="password"],
.modal-body .form-group input[type="url"],
.rx-form .form-group input[type="url"],
.modal-body .form-group input[type="date"],
.rx-form .form-group input[type="date"],
.modal-body .form-group select,
.rx-form .form-group select,
.modal-body .form-group textarea,
.rx-form .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid #eef1f6;
  border-radius: 10px;
  background: #f8fafc;
  color: #1f2937;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.modal-body .form-group textarea,
.rx-form .form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-body .form-group select,
.rx-form .form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
  border-color: var(--accent, #005BFF);
}

.modal-body .form-group input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}

.modal-body .form-group input:disabled,
.modal-body .form-group select:disabled,
.modal-body .form-group textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Horizontal form row (e.g. identities modal) */
.identities-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.identities-row .form-group {
  margin-bottom: 0;
}

.radio-row {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #1f2937;
  cursor: pointer;
}

.radio-label input[type="radio"],
.radio-label input[type="checkbox"] {
  accent-color: var(--accent, #005BFF);
}

.modal-submit-btn {
  width: 100%;
  padding: 11px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent, #005BFF);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.modal-submit-btn:hover {
  filter: brightness(1.15);
}

.modal-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-danger-btn {
  width: 100%;
  padding: 11px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #ef4444;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.modal-danger-btn:hover {
  background: #dc2626;
}

.modal-cancel-btn {
  width: 100%;
  padding: 11px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: #6b7280;
  background: #f3f4f6;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

.modal-cancel-btn:hover {
  background: #e5e7eb;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.modal-actions .modal-submit-btn,
.modal-actions .modal-danger-btn,
.modal-actions .modal-cancel-btn {
  margin-top: 0;
}

.modal-text {
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ── Standalone select inside modals (outside form-group) ── */

.modal-select {
  width: 100%;
  padding: 10px 12px;
  padding-right: 36px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid #eef1f6;
  border-radius: 10px;
  background: #f8fafc;
  color: #1f2937;
  outline: none;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}

.modal-select:focus {
  border-color: var(--accent, #005BFF);
}

/* ── Table action buttons (square with rounded corners) ── */

.action-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  text-decoration: none;
}

.action-btn:hover {
  border-color: #9ca3af;
  color: #1f2937;
  background: #f9fafb;
}

.action-btn-label {
  width: auto;
  padding: 0 12px;
  gap: 6px;
  font-size: 0.8125rem;
}

.action-btn-danger {
  border-color: #fca5a5;
  color: #ef4444;
  background: #fff;
}

.action-btn-danger:hover {
  border-color: #ef4444;
  color: #dc2626;
  background: #fef2f2;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .modal-box,
  .modal-box.modal-wide,
  .modal-box.modal-xl,
  .modal-box.modal-xxl {
    max-width: 100%;
    border-radius: 12px;
  }
}

/* ── Подсказка к полю: «?» рядом с подписью ─────────────────────
   Канон портала: пояснение к полю НЕ висит плашкой под ним (она забирает
   треть окна и разрывает форму), а прячется за кружком «?» у подписи —
   всплывает по наведению и по фокусу с клавиатуры.

   Разметка:
     <label>Код группы
       <span class="field-hint">
         <button type="button" class="field-hint-btn" aria-label="Подсказка">?</button>
         <span class="field-hint-pop">Текст пояснения…</span>
       </span>
     </label>                                                        */
.field-hint {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 6px;
}
.field-hint-btn {
  width: 16px; height: 16px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #cbd5e1; border-radius: 50%;
  background: #fff; color: #64748b;
  font: 700 10px/1 inherit; cursor: help;
  transition: border-color .15s, color .15s;
}
.field-hint-btn:hover,
.field-hint-btn:focus-visible { border-color: var(--accent, #005BFF); color: var(--accent, #005BFF); }
/* Всплывает ПОД кнопкой: у верхних полей модалки над подписью места нет. */
.field-hint-pop {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 260px; max-width: 70vw; padding: 10px 12px;
  border-radius: 10px; background: #1f2937; color: #f8fafc;
  font: 400 12px/1.5 inherit; text-transform: none; letter-spacing: 0; text-align: left;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28);
  z-index: 5000; opacity: 0; visibility: hidden; transition: opacity .12s;
}
.field-hint-pop::after {
  content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: #1f2937;
}
.field-hint-pop b { color: #fff; }
.field-hint:hover .field-hint-pop,
.field-hint:focus-within .field-hint-pop { opacity: 1; visibility: visible; }

/* ══ Окно в виде чата: .modal-box.modal-chat ══════════════════════════
   Включается классом на .modal-box — разметка остаётся канонической
   (.modal-overlay > .modal-box > .modal-header + .modal-body), меняется
   только вид: шапка с иконкой и подзаголовком, круглый крестик, поля с
   заливкой, вкладки-«пилюли», кнопки-пилюли, группы полей островами. На
   телефоне окно выезжает снизу шторкой. Страницы «Мои устройства»,
   дашборды и «Моя школа» перешли на него целиком.

   Дополнительные блоки (все — внутри .modal-chat):
     .modal-ico                  — значок в шапке перед заголовком;
                                   цвет — переменные --mi (тон) и --mib (фон)
     .modal-title > h3 + .modal-sub — заголовок с подписью под ним
     .modal-section (+ .modal-section-title) — остров с группой полей
     .modal-seg > button.is-on   — выбор из двух-трёх вариантов вместо радио
     label.modal-switch > input[type=checkbox] + .modal-switch-ui + текст
     .modal-list > .modal-row (.modal-row-ico, .modal-row-main, .modal-row-sub)
     .modal-hero (+ .modal-hero-ico, .modal-hero-title, .modal-hero-sub) —
                                   крупный значок по центру (успех, удаление) */
.modal-overlay:has(> .modal-chat) {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
}
.modal-box.modal-chat {
  border-radius: 28px;
  background:
    radial-gradient(120% 70% at 0% -20%, rgba(77, 139, 255, 0.10), transparent 60%),
    #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.05), 0 32px 80px -24px rgba(15, 23, 42, 0.45);
  animation: modalChatIn 0.22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-chat .modal-header {
  gap: 12px;
  padding: 18px 18px 4px 22px;
}
.modal-chat .modal-header h3 {
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  color: #0f172a;
}
.modal-chat .modal-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.modal-chat .modal-title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-chat .modal-header > h3 { flex: 1; min-width: 0; }
.modal-chat .modal-sub {
  font-size: 12.5px; color: #64748b; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal-chat .modal-ico {
  --mi: #2563eb; --mib: rgba(37, 99, 235, 0.12);
  width: 42px; height: 42px; flex: none; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--mib); color: var(--mi); font-size: 17px;
}
.modal-chat .modal-ico.is-green  { --mi: #059669; --mib: rgba(5, 150, 105, 0.12); }
.modal-chat .modal-ico.is-red    { --mi: #dc2626; --mib: rgba(220, 38, 38, 0.10); }
.modal-chat .modal-ico.is-violet { --mi: #7c3aed; --mib: rgba(124, 58, 237, 0.12); }
.modal-chat .modal-ico.is-amber  { --mi: #d97706; --mib: rgba(217, 119, 6, 0.12); }
.modal-chat .modal-ico.is-pink   { --mi: #db2777; --mib: rgba(219, 39, 119, 0.10); }
.modal-chat .modal-close-btn {
  width: 36px; height: 36px; flex: none; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.05); color: #475569; font-size: 15px;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.modal-chat .modal-close-btn:hover { background: rgba(15, 23, 42, 0.09); color: #0f172a; }
.modal-chat .modal-close-btn:active { transform: scale(0.94); }
.modal-chat .modal-body { padding: 16px 22px 22px; }

/* Поля — заливкой, без рамки; в фокусе белые с синим ободком. */
.modal-chat .modal-body .form-group { margin-bottom: 14px; }
.modal-chat .modal-body .form-group label {
  font-size: 12.5px; color: #64748b; margin-bottom: 7px; letter-spacing: 0.01em;
}
.modal-chat .modal-body .form-group input[type="text"],
.modal-chat .modal-body .form-group input[type="number"],
.modal-chat .modal-body .form-group input[type="email"],
.modal-chat .modal-body .form-group input[type="password"],
.modal-chat .modal-body .form-group input[type="url"],
.modal-chat .modal-body .form-group input[type="date"],
.modal-chat .modal-body .form-group input[type="datetime-local"],
.modal-chat .modal-body .form-group input[type="time"],
.modal-chat .modal-body .form-group select,
.modal-chat .modal-body .form-group textarea,
.modal-chat .modal-select {
  min-height: 46px;
  padding: 11px 14px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background-color: #f1f5f9;
  font-size: 0.92rem;
  color: #0f172a;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.modal-chat .modal-body .form-group select,
.modal-chat .modal-select { padding-right: 38px; background-position: right 14px center; }
.modal-chat .modal-body .form-group textarea { min-height: 90px; }
.modal-chat .modal-body .form-group input:hover,
.modal-chat .modal-body .form-group select:hover,
.modal-chat .modal-body .form-group textarea:hover,
.modal-chat .modal-select:hover { background-color: #eaf0f7; }
.modal-chat .modal-body .form-group input:focus,
.modal-chat .modal-body .form-group select:focus,
.modal-chat .modal-body .form-group textarea:focus,
.modal-chat .modal-select:focus {
  background-color: #fff;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Вкладки — сегменты одной «пилюли», как чипы чата. */
.modal-chat .modal-tabs {
  gap: 2px; padding: 4px; margin-bottom: 18px;
  border: 0; border-radius: 14px; background: #f1f5f9;
  overflow-x: auto; scrollbar-width: none;
}
.modal-chat .modal-tabs::-webkit-scrollbar { display: none; }
.modal-chat .modal-tab {
  flex: 1 0 auto; margin: 0; padding: 8px 14px;
  border: 0; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; color: #64748b; white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.modal-chat .modal-tab:hover { color: #0f172a; }
.modal-chat .modal-tab.active {
  background: #fff; color: #0f172a; border: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.10);
}
.modal-chat .modal-tab.active i { color: #2563eb; }

/* Остров — группа полей на светлой подложке. */
.modal-chat .modal-section {
  margin: 0 0 14px; padding: 14px 16px;
  border-radius: 18px; background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}
.modal-chat .modal-section .form-group input[type="text"],
.modal-chat .modal-section .form-group input[type="number"],
.modal-chat .modal-section .form-group input[type="email"],
.modal-chat .modal-section .form-group input[type="url"],
.modal-chat .modal-section .form-group select,
.modal-chat .modal-section .form-group textarea { background-color: #fff; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.07); }
.modal-chat .modal-section .form-group:last-child { margin-bottom: 0; }
.modal-chat .modal-section-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #94a3b8;
}

/* Сегменты: «Да / Нет», «Ссылка / RTSP» и т. п. */
.modal-chat .modal-seg {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 12px; background: #f1f5f9; max-width: 100%;
}
.modal-chat .modal-section .modal-seg { background: #e9eef5; }
.modal-chat .modal-seg > button {
  -webkit-appearance: none; appearance: none;
  padding: 7px 16px; border: 0; border-radius: 9px; background: transparent;
  font: 600 13px/1.2 inherit; color: #64748b; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.modal-chat .modal-seg > button:hover { color: #0f172a; }
.modal-chat .modal-seg > button.is-on {
  background: #fff; color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.12);
}
.modal-chat .modal-seg.is-block { display: flex; }
.modal-chat .modal-seg.is-block > button { flex: 1; justify-content: center; }

/* Переключатель вместо флажка. Сам флажок остаётся в разметке (v-model,
   клавиатура, читалки) — он прозрачный поверх нарисованного. */
.modal-chat .modal-switch {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 0; margin: 0; cursor: pointer;
  font-size: 0.9rem; font-weight: 500; color: #0f172a; line-height: 1.35;
}
.modal-chat .modal-body .form-group label.modal-switch { font-size: 0.9rem; color: #0f172a; margin: 0; }
.modal-chat .modal-switch > input {
  position: absolute; left: 0; top: 50%; width: 44px; height: 26px; margin: -13px 0 0;
  opacity: 0; cursor: pointer; z-index: 1;
}
.modal-chat .modal-switch-ui {
  position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px;
  background: #cbd5e1; transition: background 0.18s;
}
.modal-chat .modal-switch-ui::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s cubic-bezier(.3, .7, .4, 1.3);
}
.modal-chat .modal-switch > input:checked + .modal-switch-ui { background: #2563eb; }
.modal-chat .modal-switch > input:checked + .modal-switch-ui::after { transform: translateX(18px); }
.modal-chat .modal-switch > input:focus-visible + .modal-switch-ui { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); }
.modal-chat .modal-switch > input:disabled + .modal-switch-ui { opacity: 0.5; }
.modal-chat .modal-switch small { display: block; font-size: 12px; font-weight: 400; color: #64748b; margin-top: 2px; }

/* Список строк — как участники в панели группы чата. */
.modal-chat .modal-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px 14px; }
.modal-chat .modal-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px;
  border-radius: 14px; transition: background 0.12s;
}
.modal-chat .modal-row:hover { background: rgba(15, 23, 42, 0.04); }
.modal-chat .modal-row.is-on { background: rgba(37, 99, 235, 0.08); }
.modal-chat .modal-row-ico {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(37, 99, 235, 0.10); color: #2563eb; font-size: 15px; overflow: hidden;
}
.modal-chat .modal-row-main { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: #0f172a;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-chat .modal-row-sub { display: block; font-size: 12.5px; font-weight: 400; color: #64748b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Крупный значок по центру: подтверждение удаления, «готово». */
.modal-chat .modal-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 6px 4px 18px; }
.modal-chat .modal-hero-ico {
  width: 72px; height: 72px; border-radius: 50%; margin-bottom: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff; background: linear-gradient(135deg, #4d8bff, #2563eb);
  box-shadow: 0 14px 30px -12px rgba(37, 99, 235, 0.6);
}
.modal-chat .modal-hero-ico.is-red { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 14px 30px -12px rgba(220, 38, 38, 0.55); }
.modal-chat .modal-hero-ico.is-green { background: linear-gradient(135deg, #34d399, #059669); box-shadow: 0 14px 30px -12px rgba(5, 150, 105, 0.55); }
.modal-chat .modal-hero-title { font-size: 18px; font-weight: 700; color: #0f172a; letter-spacing: -0.01em; }
.modal-chat .modal-hero-sub { font-size: 13.5px; color: #64748b; line-height: 1.5; max-width: 360px; }

.modal-chat .modal-hint {
  border: 0; border-radius: 14px; background: rgba(37, 99, 235, 0.07); color: #1e3a8a;
}
.modal-chat .modal-text { color: #475569; }

/* Кнопки — пилюли. */
.modal-chat .modal-actions { gap: 10px; margin-top: 8px; }
.modal-chat .modal-submit-btn,
.modal-chat .modal-danger-btn,
.modal-chat .modal-cancel-btn {
  min-height: 46px; border-radius: 14px; font-size: 0.92rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter 0.15s, transform 0.12s, background 0.15s, box-shadow 0.15s;
}
.modal-chat .modal-submit-btn {
  background: linear-gradient(135deg, #4d8bff, #2563eb);
  box-shadow: 0 10px 22px -10px rgba(37, 99, 235, 0.7);
}
.modal-chat .modal-danger-btn {
  background: linear-gradient(135deg, #f87171, #dc2626);
  box-shadow: 0 10px 22px -10px rgba(220, 38, 38, 0.6);
}
.modal-chat .modal-cancel-btn { background: #f1f5f9; color: #334155; }
.modal-chat .modal-cancel-btn:hover { background: #e2e8f0; }
.modal-chat .modal-submit-btn:active,
.modal-chat .modal-danger-btn:active,
.modal-chat .modal-cancel-btn:active { transform: scale(0.98); }
.modal-chat .action-btn { border: 0; border-radius: 50%; background: rgba(15, 23, 42, 0.05); color: #475569; }
.modal-chat .action-btn:hover { background: rgba(15, 23, 42, 0.09); color: #0f172a; }
.modal-chat .action-btn-label { border-radius: 999px; }
.modal-chat .action-btn-danger { background: rgba(220, 38, 38, 0.08); color: #dc2626; }
.modal-chat .action-btn-danger:hover { background: rgba(220, 38, 38, 0.14); color: #b91c1c; }

@keyframes modalChatIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes modalSheetIn {
  from { transform: translateY(40px); opacity: 0.4; }
  to   { transform: none; opacity: 1; }
}

/* Телефон: окно — шторка снизу, с «ручкой». */
@media (max-width: 600px) {
  .modal-overlay:has(> .modal-chat) { padding: 24px 0 0; }
  .modal-box.modal-chat,
  .modal-box.modal-chat.modal-wide,
  .modal-box.modal-chat.modal-xl,
  .modal-box.modal-chat.modal-xxl {
    margin: auto 0 0; max-width: 100%;
    border-radius: 26px 26px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    animation: modalSheetIn 0.24s cubic-bezier(.2, .9, .3, 1);
  }
  .modal-box.modal-chat::before {
    content: ''; display: block; width: 40px; height: 5px; border-radius: 3px;
    background: rgba(15, 23, 42, 0.14); margin: 8px auto 0;
  }
  .modal-chat .modal-header { padding: 10px 14px 2px 18px; }
  .modal-chat .modal-body { padding: 14px 18px 20px; }
  .modal-chat .modal-tab { padding: 8px 10px; font-size: 12.5px; }
}
