/* ============================================================
   admin_amo_templates.css — Админка → «Шаблоны из AmoCRM»
   (Фаза 4, ESTIMATE_TEMPLATES_MASTER_PLAN.md). Только CSS-переменные —
   тёмная тема без отдельных правил.
   ============================================================ */

.amo-tpl-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.amo-tpl-toolbar .form-control { max-width: 420px; flex: 1 1 260px; }
.amo-tpl-stat { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Группа по продукту */
.amo-tpl-group {
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  background: var(--card, var(--surface));
  margin-bottom: 8px;
  overflow: hidden;
}
.amo-tpl-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.amo-tpl-group-head:hover { background: var(--accent-l); }
.amo-tpl-group-head i { color: var(--muted); flex-shrink: 0; }
.amo-tpl-group-name { flex: 1; min-width: 0; }
.amo-tpl-group-meta { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.amo-tpl-group-body { border-top: 1px solid var(--border); }
.amo-tpl-group--collapsed .amo-tpl-group-body { display: none; }

/* Строка шаблона: [В общие] название … бейджи [Просмотр] */
.amo-tpl-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.amo-tpl-row:last-child { border-bottom: none; }
.amo-tpl-row:hover { background: var(--accent-l); }
.amo-tpl-row--imported { opacity: .85; }
.amo-tpl-row .role-check { font-size: 12px; white-space: nowrap; padding: 4px 10px; }
.amo-tpl-name {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amo-tpl-name:hover { color: var(--accent); text-decoration: underline; }
.amo-tpl-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.amo-tpl-badge { background: var(--border); color: var(--text); }
.amo-tpl-badge--warn { background: var(--yellow-l); color: var(--yellow); }
.amo-tpl-badge--ok { background: var(--green-l); color: var(--green); }

@media (max-width: 700px) {
  .amo-tpl-row { grid-template-columns: auto minmax(0, 1fr); }
  .amo-tpl-badges { grid-column: 1 / -1; justify-content: flex-start; }
  .amo-tpl-row .btn { grid-column: 1 / -1; justify-self: start; }
}

/* Модалка предпросмотра */
.amo-tpl-modal { max-width: 760px; }
.amo-tpl-modal-type { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.amo-tpl-field { display: flex; flex-direction: column; gap: 5px; }
.amo-tpl-field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.amo-tpl-sub { font-size: 13px; color: var(--muted); }
.amo-tpl-alert { background: var(--yellow-l); color: var(--text); border: 1px solid var(--yellow); }
.amo-tpl-preview-table td, .amo-tpl-preview-table th { font-size: 13px; }
.amo-tpl-preview-table td:nth-child(2), .amo-tpl-preview-table td:nth-child(4) { text-align: right; white-space: nowrap; }
.amo-tpl-skipped {
  background: var(--yellow-l);
  border-left: 3px solid var(--yellow);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
}
.amo-tpl-skipped ul { margin: 6px 0 0; padding-left: 18px; }
.amo-tpl-skip-why { color: var(--muted); }
.amo-tpl-note { font-size: 12px; color: var(--muted); white-space: pre-wrap; background: var(--bg); border-radius: 6px; padding: 8px 10px; }
