/* ==========================================================================
   АДМИНКА: дашборд учителя, редакторы блоков, WYSIWYG, кастомная модалка,
   вкладка «Тема», редактор главной.
   Подключать ПОСЛЕ pages.css.
   ========================================================================== */

/* ==========================================================================
   1. Кабинет учителя / дашборд
   ========================================================================== */
.teacher-dashboard {
  max-width: min(1400px, 94vw);
  margin: 0 auto;
  padding: var(--sp-lg) clamp(14px, 2vw, 20px);
  width: 100%;
  box-sizing: border-box;
}
.dashboard-container {
  max-width: 1200px;
  margin: clamp(20px, 3vw, 40px) auto;
  padding: 0 clamp(14px, 2vw, 20px);
  box-sizing: border-box;
}
#teacher-schedule-table, #teacher-students-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#teacher-schedule-table table,
#teacher-students-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 560px;
}
#teacher-schedule-table th, #teacher-students-table th {
  background: var(--primary);
  color: var(--surface);
  padding: 12px 14px;
  text-align: left;
  font-weight: 500;
}
#teacher-schedule-table td, #teacher-students-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
#teacher-schedule-table tr:hover, #teacher-students-table tr:hover { background-color: var(--hover-tint); }
#teacher-schedule-table tr:last-child td,
#teacher-students-table tr:last-child td { border-bottom: none; }
#teacher-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.teacher-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}
.teacher-tabs .btn {
  flex: 0 0 auto;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}
.teacher-tabs .btn:not(.active):hover {
  background: var(--primary);
  color: var(--surface);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 20%, transparent);
}
.teacher-tabs .btn.active {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 30%, transparent);
}

/* --- Карточки статистики --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.stats-grid:last-child { margin-bottom: 0; }

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 14px;
  min-width: 0;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 14%, transparent);
  border-color: color-mix(in srgb, var(--primary) 35%, transparent);
}
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--hover-tint);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-card-body { flex: 1 1 auto; min-width: 0; }
.stat-card-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 4px;
  line-height: 1.3;
}
.stat-card-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.stat-card--seo .stat-card-icon {
  background: var(--sem-info-bg);
  color: var(--sem-info-text);
}

@media (max-width: 768px) {
  .teacher-dashboard { max-width: 100vw; padding: 20px 12px; }
  .stats-grid { gap: 12px; margin-bottom: 24px; }
  .stat-card { padding: 14px 16px; gap: 12px; }
  .stat-card-icon { width: 42px; height: 42px; font-size: 17px; }
  .stat-card-value { font-size: 21px; }
}

/* ==========================================================================
   2. Админ-панель
   ========================================================================== */
.admin-dashboard {
  max-width: 1200px;
  margin: clamp(20px, 3vw, 40px) auto;
  padding: 0 clamp(14px, 2vw, 20px);
  box-sizing: border-box;
}
.admin-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.admin-tab {
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 10px 20px;
  border-radius: 30px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  transition: var(--transition);
}
.admin-tab:hover, .admin-tab.active { background: var(--primary); color: var(--surface); }
.admin-content {
  background: var(--surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2vw, 25px);
  overflow-x: auto;
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px 15px; border-bottom: 1px solid var(--divider); text-align: left; }
.admin-table th { background: var(--primary); color: var(--surface); font-weight: 500; }
.admin-table tr:hover { background-color: var(--hover-tint); }
.admin-table tr:last-child td { border-bottom: none; }
.page-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-selector label { font-weight: 500; }
.page-select {
  padding: 10px 15px;
  border: 1px solid var(--primary);
  border-radius: 30px;
  background: var(--surface);
  color: var(--primary);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}
.page-select:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* ==========================================================================
   3. Менеджер страниц
   ========================================================================== */
.pages-manager-toolbar { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.pm-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 100%;
}
.pm-table th {
  background: var(--primary);
  color: var(--surface);
  padding: 12px 15px;
  text-align: left;
  font-weight: 500;
  font-size: 14px;
}
.pm-table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
.pm-table tr:last-child td { border-bottom: none; }
.pm-table tr:hover { background: var(--hover-tint); }
.pm-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--hover-tint);
  color: var(--primary);
}
.pm-tag-warn {
  background: var(--sem-warning-bg);
  color: var(--sem-warning-text);
}
.pm-tag-muted { background: var(--tint-bg); color: var(--text-light); }
.pm-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pm-link:hover { text-decoration: underline; }
.pm-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  margin-right: 4px;
}
.pm-btn:hover { background: var(--primary-dark); }
.pm-btn-danger { background: var(--sem-error); }
.pm-btn-danger:hover { background: color-mix(in srgb, var(--sem-error) 80%, black); }
.pm-btn:disabled { background: var(--divider); cursor: not-allowed; }
@media (max-width: 800px) {
  .pm-table thead { display: none; }
  .pm-table, .pm-table tbody, .pm-table tr, .pm-table td { display: block; width: 100%; }
  .pm-table tr { border-bottom: 1px solid var(--divider); padding: 10px 12px; }
  .pm-table td { border: none; padding: 4px 0; }
}

/* ==========================================================================
   4. Настройки сайта (шапка/подвал)
   ========================================================================== */
.ss-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.ss-tab {
  padding: 10px 22px;
  border-radius: 26px;
  border: 1px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.ss-tab:hover { background: var(--hover-tint); }
.ss-tab.active { background: var(--primary); color: var(--surface); }
.ss-pane { margin-bottom: 20px; max-width: 100%; }
.ss-pane .block-editor { max-width: 100%; }
.ss-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
  margin-top: 20px;
}
.ss-file-row { display: flex; gap: 8px; align-items: stretch; }
.ss-file-row > input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--input-text);
}
.ss-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ss-list-item {
  display: grid;
  grid-template-columns: 1fr 2fr 32px;
  gap: 6px;
  align-items: stretch;
}
.ss-list-item > input {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-family: inherit;
  min-width: 0;
  background: var(--input-bg);
  color: var(--input-text);
}
.ss-list-del {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--sem-error);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  align-self: center;
  padding: 0;
}
.ss-list-del:hover { background: color-mix(in srgb, var(--sem-error) 80%, black); }
@media (max-width: 800px) {
  .ss-list-item { grid-template-columns: 1fr 1fr 32px; }
}

/* ==========================================================================
   5. Модалки SweetAlert2 — редакторы
   ========================================================================== */
.swal2-popup.editor-modal,
.swal2-popup.auth-modal { max-width: 96vw !important; }

.swal2-popup.editor-modal {
  width: min(94vw, 1320px) !important;
  max-width: 94vw !important;
  padding: 28px 36px 24px !important;
}
.swal2-popup.editor-modal .swal2-html-container {
  overflow: visible !important;
  margin: 0 !important;
  padding: 0 !important;
}
@media (max-width: 1100px) {
  .swal2-popup.editor-modal {
    width: 96vw !important;
    max-width: 96vw !important;
    padding: 24px 24px 20px !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
  }
  .swal2-popup.editor-modal .swal2-html-container { overflow: visible !important; }
}
@media (max-width: 768px) {
  .swal2-popup.editor-modal {
    width: 96vw !important;
    max-width: 96vw !important;
    padding: 20px 18px 16px !important;
  }
}
@media (max-width: 640px) {
  .swal2-popup.editor-modal,
  .swal2-popup.auth-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
  }
}
@media (max-width: 480px) {
  .swal2-popup.editor-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 16px 14px 12px !important;
    border-radius: 0 !important;
  }
}

/* ==========================================================================
   6. Редактор блока — каркас
   ========================================================================== */
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 100%;
  height: calc(92vh - 200px);
  min-height: 420px;
}
.editor-form {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-width: thin;
}
.editor-preview {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  background: var(--tint-bg);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.editor-preview-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-light);
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
  flex: 0 0 auto;
}
.editor-preview-stage {
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--primary) 6%, transparent) 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(-45deg, color-mix(in srgb, var(--primary) 6%, transparent) 25%, transparent 25%) 0 8px/16px 16px,
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--primary) 6%, transparent) 75%) 8px -8px/16px 16px,
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--primary) 6%, transparent) 75%) -8px 0/16px 16px,
    var(--tint-bg);
  border: 1px dashed color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: 10px;
  padding: 20px;
  min-height: 0;
  flex: 1 1 auto;
  max-height: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-block {
  box-sizing: border-box;
  display: block;
  overflow: visible;
  transition: background 0.2s, border-radius 0.2s, border-color 0.2s, padding 0.2s;
  word-break: break-word;
  margin: 0 auto;
}
.preview-block-content { width: 100%; max-width: 100%; }
.preview-block-content img { max-width: 100%; height: auto; }
.preview-container {
  width: 100%;
  max-width: 100%;
  min-height: 220px;
  border-radius: 10px;
  box-sizing: border-box;
  transition: all 0.2s;
}
.preview-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  width: 100%;
  max-width: 100%;
}
.preview-helper {
  width: 100%;
  max-width: 260px;
  height: 56px;
  background: color-mix(in srgb, var(--text) 15%, transparent);
  border-radius: 10px;
  flex: 0 0 auto;
}
.preview-container .preview-helper {
  width: 56px;
  height: 56px;
  min-width: 56px;
  max-width: 56px;
  flex: 0 0 auto;
  border-radius: 8px;
}
@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: 1fr; gap: 20px; height: auto; min-height: 0; }
  .editor-form, .editor-preview { overflow: visible; max-height: none; height: auto; }
  .editor-preview { order: -1; justify-content: flex-start; }
  .editor-preview-stage { min-height: 260px; max-height: none; }
  .block-editor { padding-right: 0; }
}
@media (max-width: 768px) {
  .block-editor .form-row { grid-template-columns: 1fr; row-gap: 4px; padding: 5px 0; }
  .block-editor .form-row > label { margin-bottom: 2px; }
  .editor-preview-stage { padding: 14px; min-height: 220px; }
}
@media (max-width: 480px) {
  .block-editor h4 { font-size: 13px; margin: 14px 0 4px; }
  .block-editor .btn { width: 100%; justify-content: center; }
  .block-editor .inline-group { flex-wrap: wrap; }
  .block-editor .inline-group > .inline-group-w { flex: 1 1 80px; width: auto; }
  .preset-chip { font-size: 12px; padding: 5px 10px; }
}

/* ==========================================================================
   7. Форма редактора блока (block-editor)
   ========================================================================== */
.block-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  width: 100%;
  max-width: 100%;
}
.block-editor .form-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 4px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 2px 0;
}
.block-editor .form-row.form-row-full { grid-template-columns: minmax(0, 1fr); }
.block-editor .form-row > label {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
  overflow-wrap: break-word;
}
.block-editor .form-row > input,
.block-editor .form-row > select,
.block-editor .form-row > textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin: 0 !important;
}
.block-editor .form-row > div:not(.wysiwyg-editor):not(.format-toolbar) {
  padding: 0; border: none; background: transparent;
  min-width: 0; max-width: 100%; box-sizing: border-box;
}
.block-editor .form-row > input:focus,
.block-editor .form-row > select:focus,
.block-editor .form-row > textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.block-editor .swal2-select,
.block-editor .swal2-input,
.block-editor .swal2-textarea {
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.block-editor .form-row > input[type="color"] {
  width: 60px;
  height: 38px;
  padding: 2px;
  cursor: pointer;
  justify-self: start;
  border-radius: 6px;
}
.block-editor .form-row > input[type="range"] {
  padding: 0; height: auto; border: none; background: transparent; box-shadow: none;
}
.block-editor .form-row > textarea {
  min-height: 200px;
  resize: vertical;
  font-family: 'Montserrat', monospace;
  line-height: 1.5;
}
.block-editor .inline-group {
  display: flex; gap: 8px; align-items: stretch;
  width: 100%; max-width: 100%; min-width: 0;
}
.block-editor .inline-group > input[type="text"],
.block-editor .inline-group > select {
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  min-width: 0;
}
.block-editor .inline-group > input[type="text"]:focus,
.block-editor .inline-group > select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.block-editor .inline-group > .inline-group-w { width: 80px; flex: 0 0 80px; }
.block-editor .inline-group > .inline-group-style { flex: 1 1 auto; }
.block-editor .inline-group > .inline-group-c {
  width: 60px; height: auto; min-height: 38px; flex: 0 0 60px;
  padding: 2px; cursor: pointer;
  border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg);
}
.block-editor h4 {
  margin: 20px 0 4px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 6px;
}
.block-editor h4:first-child { margin-top: 0; }
.block-editor .btn { padding: 8px 16px; font-size: 13px; white-space: nowrap; }

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-weight: 500; font-size: 14px; cursor: pointer; user-select: none;
}
.bg-preview-thumb {
  display: flex; align-items: center; gap: 10px;
  padding: 6px; background: var(--tint-bg);
  border: 1px dashed var(--input-border); border-radius: 6px; margin-top: 4px;
}
.bg-preview-thumb img { max-width: 80px; max-height: 60px; border-radius: 4px; object-fit: cover; }
.bg-preview-thumb .bg-info {
  font-size: 12px; color: var(--text-light);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.bg-preview-thumb button {
  background: var(--sem-error); color: #fff; border: none; border-radius: 50%;
  width: 22px; height: 22px; cursor: pointer; font-size: 12px; flex-shrink: 0; padding: 0;
}

/* Пресеты блоков и шаблоны */
.template-section {
  padding: 14px; background: var(--tint-bg);
  border: 1px solid var(--divider); border-radius: 8px;
  display: flex; flex-direction: column; gap: 14px;
}
.template-block { display: flex; flex-direction: column; gap: 8px; }
.template-block-title {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-light); font-weight: 600;
}
.preset-list { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-chip {
  border: 1px solid var(--primary); background: transparent; color: var(--primary);
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; font-family: 'Montserrat', sans-serif; font-weight: 500;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.preset-chip:hover { background: var(--primary); color: var(--surface); }
.template-saved-list { display: flex; flex-direction: column; gap: 4px; }
.template-empty { font-size: 13px; color: var(--text-light); font-style: italic; padding: 6px 0; }
.saved-template-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 4px 4px 12px; background: var(--surface);
  border: 1px solid var(--divider); border-radius: 20px;
}
.saved-template-name {
  flex: 1 1 auto; font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.saved-template-apply,
.saved-template-delete {
  width: 24px; height: 24px; flex: 0 0 24px;
  border: none; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; padding: 0;
}
.saved-template-apply { background: var(--sem-success); }
.saved-template-apply:hover { background: color-mix(in srgb, var(--sem-success) 80%, black); }
.saved-template-delete { background: var(--sem-error); }
.saved-template-delete:hover { background: color-mix(in srgb, var(--sem-error) 80%, black); }
.template-save-new { display: flex; gap: 6px; align-items: stretch; }
.template-save-new > input {
  flex: 1 1 auto; min-width: 0; padding: 6px 12px;
  font-size: 13px; border: 1px solid var(--input-border); border-radius: 20px;
  background: var(--input-bg); color: var(--input-text);
  font-family: 'Montserrat', sans-serif; box-sizing: border-box;
}
.template-save-new > input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* ==========================================================================
   8. Тулбар форматирования + WYSIWYG
   ========================================================================== */
.block-editor .form-row.content-editor-row {
  grid-template-columns: minmax(0, 1fr);
  column-gap: 0;
  row-gap: 0;
  padding: 0;
  align-items: stretch;
}
.block-editor .form-row.content-editor-row > .format-toolbar,
.block-editor .form-row.content-editor-row > .wysiwyg-editor {
  grid-column: 1 / -1;
}
.format-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 8px 10px; background: var(--tint-bg);
  border: 1px solid var(--input-border); border-bottom: none;
  border-radius: 8px 8px 0 0;
  width: 100%; box-sizing: border-box; min-height: 46px;
}
.format-toolbar button {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid transparent;
  background: var(--input-bg);
  color: var(--input-text);
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex: 0 0 auto;
}
.format-toolbar button:hover { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.format-toolbar button:active { transform: scale(0.96); }
.format-toolbar button i { font-size: 12px; pointer-events: none; }
.format-toolbar button.icon-only { padding: 0; min-width: 32px; }
.format-sep { width: 1px; height: 22px; background: var(--divider); margin: 0 4px; flex: 0 0 1px; }
.format-toolbar .format-select {
  height: 32px; padding: 0 24px 0 10px;
  font-size: 13px; font-family: 'Montserrat', sans-serif;
  border: 1px solid var(--input-border); border-radius: 6px;
  background: var(--input-bg); color: var(--input-text);
  cursor: pointer; min-width: 90px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23888' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.format-toolbar .format-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.wysiwyg-editor {
  width: 100%; max-width: 100%;
  min-height: 240px; max-height: 46vh;
  overflow-y: auto;
  padding: 14px 18px;
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--input-border);
  border-radius: 0 0 8px 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px; line-height: 1.55;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  text-align: left;
}
.wysiwyg-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.wysiwyg-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--input-placeholder);
  pointer-events: none;
}
@media (max-width: 768px) {
  .format-toolbar button { min-width: 30px; height: 30px; font-size: 12px; }
  .format-toolbar .format-select { height: 30px; font-size: 12px; min-width: 80px; }
  .wysiwyg-editor { min-height: 200px; max-height: 40vh; padding: 10px 12px; }
}

/* Управление картинками в WYSIWYG */
.wysiwyg-image-selected {
  outline: 2px dashed var(--primary);
  outline-offset: 2px;
  cursor: pointer;
}
.image-controls {
  position: fixed; z-index: var(--z-prompt-modal);
  display: flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--input-border); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  align-items: center;
}
.image-controls button {
  min-width: 28px; height: 28px; padding: 0 6px;
  border: none; background: transparent; border-radius: 5px;
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Montserrat', sans-serif;
}
.image-controls button:hover { background: var(--primary); color: var(--surface); }
.image-controls button i { font-size: 11px; }
.image-controls-sep { width: 1px; align-self: stretch; background: var(--divider); margin: 4px 2px; }
.image-resize-handle {
  width: 20px; height: 20px;
  background: var(--primary);
  border: 3px solid #fff; border-radius: 5px;
  cursor: nwse-resize;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  transition: transform 0.1s, background 0.15s;
  position: fixed; z-index: var(--z-image-handle); touch-action: none;
}
.image-resize-handle::before {
  content: '⇲'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  pointer-events: none;
}
.image-resize-handle:hover { transform: scale(1.15); background: var(--primary-dark); }

/* ==========================================================================
   9. Единые стили контента (WYSIWYG / dynamic / preview / materials)
   ========================================================================== */
.wysiwyg-editor p,
.preview-block-content p,
.dynamic-block p,
.mat-detail-content p { margin: 0 0 10px !important; line-height: 1.55 !important; }
.wysiwyg-editor p:last-child,
.preview-block-content p:last-child,
.dynamic-block p:last-child,
.mat-detail-content p:last-child { margin-bottom: 0 !important; }

.wysiwyg-editor h1, .preview-block-content h1, .dynamic-block h1, .mat-detail-content h1 {
  font-size: 1.9em !important; font-weight: 700 !important; line-height: 1.2 !important; margin: 18px 0 10px !important;
}
.wysiwyg-editor h2, .preview-block-content h2, .dynamic-block h2, .mat-detail-content h2 {
  font-size: 1.5em !important; font-weight: 700 !important; line-height: 1.25 !important; margin: 16px 0 8px !important;
}
.wysiwyg-editor h3, .preview-block-content h3, .dynamic-block h3, .mat-detail-content h3 {
  font-size: 1.25em !important; font-weight: 600 !important; line-height: 1.3 !important; margin: 14px 0 6px !important;
}
.wysiwyg-editor h4, .preview-block-content h4, .dynamic-block h4, .mat-detail-content h4 {
  font-size: 1.1em !important; font-weight: 600 !important; line-height: 1.3 !important; margin: 12px 0 6px !important;
}
.wysiwyg-editor > :first-child,
.preview-block-content > :first-child,
.dynamic-block > :first-child,
.mat-detail-content > :first-child { margin-top: 0 !important; }
.wysiwyg-editor > :last-child,
.preview-block-content > :last-child,
.dynamic-block > :last-child,
.mat-detail-content > :last-child { margin-bottom: 0 !important; }

.wysiwyg-editor ul, .preview-block-content ul, .dynamic-block ul, .mat-detail-content ul,
.wysiwyg-editor ol, .preview-block-content ol, .dynamic-block ol, .mat-detail-content ol {
  display: block !important;
  margin: 10px 0 !important;
  padding-left: 28px !important;
  list-style-position: outside !important;
  text-align: left !important;
}
.wysiwyg-editor ul, .preview-block-content ul, .dynamic-block ul, .mat-detail-content ul { list-style-type: disc !important; }
.wysiwyg-editor ol, .preview-block-content ol, .dynamic-block ol, .mat-detail-content ol { list-style-type: decimal !important; }
.wysiwyg-editor ul ul, .preview-block-content ul ul, .dynamic-block ul ul, .mat-detail-content ul ul { list-style-type: circle !important; }
.wysiwyg-editor ul ul ul, .preview-block-content ul ul ul, .dynamic-block ul ul ul, .mat-detail-content ul ul ul { list-style-type: square !important; }

.wysiwyg-editor li, .preview-block-content li, .dynamic-block li, .mat-detail-content li {
  display: list-item !important;
  list-style-position: outside !important;
  margin: 3px 0 !important;
  padding-left: 0 !important;
  text-align: left !important;
}
.wysiwyg-editor ul > li, .preview-block-content ul > li, .dynamic-block ul > li, .mat-detail-content ul > li {
  list-style-type: disc !important;
}
.wysiwyg-editor ol > li, .preview-block-content ol > li, .dynamic-block ol > li, .mat-detail-content ol > li {
  list-style-type: decimal !important;
}
.wysiwyg-editor ul li::marker, .preview-block-content ul li::marker,
.dynamic-block ul li::marker, .mat-detail-content ul li::marker {
  color: var(--primary) !important;
}
.wysiwyg-editor ol li::marker, .preview-block-content ol li::marker,
.dynamic-block ol li::marker, .mat-detail-content ol li::marker {
  color: var(--primary) !important; font-weight: 600 !important;
}

.wysiwyg-editor blockquote, .preview-block-content blockquote,
.dynamic-block blockquote, .mat-detail-content blockquote {
  margin: 12px 0 !important;
  padding: 10px 16px !important;
  border-left: 3px solid var(--primary) !important;
  background: var(--tint-bg) !important;
  font-style: italic !important;
  color: var(--text-light) !important;
  border-radius: 0 6px 6px 0 !important;
}
.wysiwyg-editor blockquote p, .preview-block-content blockquote p,
.dynamic-block blockquote p, .mat-detail-content blockquote p { margin: 0; text-align: left !important; }

.wysiwyg-editor a:not(.site-btn),
.preview-block-content a:not(.site-btn),
.dynamic-block a:not(.site-btn),
.mat-detail-content a:not(.site-btn) {
  color: var(--primary) !important;
  text-decoration: underline !important;
}
.wysiwyg-editor img, .preview-block-content img, .dynamic-block img, .mat-detail-content img {
  max-width: 100% !important; height: auto !important;
  border-radius: 6px !important; margin: 6px 0 !important;
}
.wysiwyg-editor hr, .preview-block-content hr, .dynamic-block hr {
  border: none; border-top: 1px solid var(--divider); margin: 14px 0;
}
.wysiwyg-editor code, .preview-block-content code, .dynamic-block code {
  background: var(--hover-tint); border-radius: 4px; padding: 1px 5px;
  font-family: monospace; font-size: 0.92em;
}
.wysiwyg-editor .site-btn { cursor: pointer; user-select: none; position: relative; }
.wysiwyg-editor .site-btn:hover { outline: 2px dashed var(--primary); outline-offset: 2px; }

.download-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--hover-tint); color: var(--primary);
  border-radius: 8px; text-decoration: none; font-weight: 500;
  border: 1px solid var(--divider);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.download-link:hover { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.download-row { margin: 8px 0; }

/* ==========================================================================
   10. Кастомная модалка (кнопки)
   ========================================================================== */
.custom-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 15, 50, 0.55);
  z-index: var(--z-custom-modal);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
  backdrop-filter: blur(2px);
  animation: cmodal-fade 0.15s ease;
}
@keyframes cmodal-fade { from { opacity: 0; } to { opacity: 1; } }
.custom-modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px 28px 20px;
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  position: relative; margin: auto;
  animation: cmodal-pop 0.2s ease;
  color: var(--text);
}
@keyframes cmodal-pop {
  from { transform: scale(0.96); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}
.custom-modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--hover-tint); color: var(--primary);
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.custom-modal-close:hover { background: var(--hover-tint); filter: brightness(0.95); }
.custom-modal-title { color: var(--primary); font-size: 20px; margin: 0 0 18px; font-weight: 700; }
.custom-modal-body { display: flex; flex-direction: column; gap: 20px; }
.custom-section { display: flex; flex-direction: column; gap: 10px; }
.custom-section-label {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-light); font-weight: 700;
}
.btn-templates-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px; background: var(--tint-bg);
  border: 1px dashed var(--divider); border-radius: 10px;
  align-items: center;
}
.btn-template-chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--divider); background: var(--surface); cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--primary);
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-template-chip:hover { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.btn-template-chip.selected {
  background: var(--primary); color: var(--surface); border-color: var(--primary);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 30%, transparent);
}
.btn-template-chip .chip-del {
  font-size: 14px; font-weight: 700; line-height: 1; opacity: 0.6; margin-left: 2px; padding: 0 2px;
}
.btn-template-chip .chip-del:hover { opacity: 1; }
.btn-template-new { border-style: dashed; color: var(--text-light); }
.btn-template-new:hover { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.custom-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
@media (max-width: 640px) { .custom-form-grid { grid-template-columns: 1fr; } }
.custom-modal .form-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 16px; row-gap: 4px;
  align-items: center; width: 100%; padding: 2px 0;
}
.custom-modal .form-row > label { font-weight: 500; font-size: 14px; color: var(--text); }
.custom-modal .form-row > input,
.custom-modal .form-row > select,
.custom-modal .form-row > textarea {
  width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  padding: 8px 12px; font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin: 0 !important;
}
.custom-modal .form-row > input:focus,
.custom-modal .form-row > select:focus,
.custom-modal .form-row > textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.custom-modal .form-row > input[type="color"] {
  width: 60px; height: 38px; padding: 2px; cursor: pointer; justify-self: start; border-radius: 6px;
}
.custom-modal .form-row > div { padding: 0; min-width: 0; }
.btn-save-template-row {
  display: flex; gap: 8px; align-items: stretch;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--divider);
}
.btn-save-template-row input {
  flex: 1 1 auto; min-width: 0; padding: 8px 12px;
  font-size: 13px; border: 1px solid var(--input-border); border-radius: 8px;
  font-family: inherit; box-sizing: border-box;
  background: var(--input-bg); color: var(--input-text);
}
.btn-save-template-row input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.btn-action-radios { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.btn-action-radios label {
  display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer;
}
.btn-preview-stage {
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--primary) 6%, transparent) 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(-45deg, color-mix(in srgb, var(--primary) 6%, transparent) 25%, transparent 25%) 0 8px/16px 16px,
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--primary) 6%, transparent) 75%) 8px -8px/16px 16px,
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--primary) 6%, transparent) 75%) -8px 0/16px 16px,
    var(--tint-bg);
  border: 1px dashed color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: 10px;
  padding: 32px 20px; min-height: 100px;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.custom-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--divider);
}
.btn-manager-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--surface);
  border: 1px solid var(--divider); border-radius: 10px;
}
.btn-manager-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-manager-actions button {
  width: 34px; height: 34px; border: none; border-radius: 8px;
  cursor: pointer; font-size: 12px; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.btn-manager-edit { background: var(--icon-btn-primary-bg); }
.btn-manager-edit:hover { background: var(--icon-btn-primary-hover); }
.btn-manager-delete { background: var(--icon-btn-danger-bg); }
.btn-manager-delete:hover { background: var(--icon-btn-danger-hover); }
.btn-manager-create { background: var(--sem-success) !important; }
.btn-manager-create:hover { background: color-mix(in srgb, var(--sem-success) 80%, black) !important; }
.btn-manager-empty {
  text-align: center; color: var(--text-light); font-style: italic;
  padding: 20px; font-size: 14px;
}

/* Выбор материала в редакторе кнопок */
.btn-material-picker { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.btn-material-picker > input[type="text"] {
  width: 100%; box-sizing: border-box; padding: 8px 12px;
  font-size: 13px; font-family: inherit;
  border: 1px solid var(--input-border); border-radius: 8px;
  background: var(--input-bg); color: var(--input-text);
}
.btn-material-picker > input[type="text"]:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.btn-material-picker > select {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--input-border); border-radius: 8px;
  font-family: inherit; font-size: 13px; padding: 4px;
  background: var(--input-bg); color: var(--input-text);
}
.btn-material-picker > select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.btn-material-picker > select option { padding: 6px 8px; }
.btn-material-picked { font-size: 12px; color: var(--primary); min-height: 16px; }
.btn-material-picked i { color: var(--sem-success); margin-right: 4px; }

/* ==========================================================================
   11. Мини-WYSIWYG для модалок материалов
   ========================================================================== */
.wysiwyg {
  border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden;
  background: var(--input-bg);
}
.wysiwyg-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px 10px; background: var(--tint-bg);
  border-bottom: 1px solid var(--divider);
}
.wysiwyg-toolbar button {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid transparent;
  background: var(--input-bg); color: var(--input-text);
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.wysiwyg-toolbar button:hover { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.wysiwyg-toolbar button i { font-size: 12px; }
.wysiwyg-sep { width: 1px; height: 22px; background: var(--divider); margin: 0 4px; align-self: center; }
.wysiwyg .wysiwyg-editor {
  padding: 14px 18px; min-height: 180px; max-height: 46vh;
  border: none; border-radius: 0;
}
.wysiwyg .wysiwyg-editor:focus { box-shadow: none; }

/* ==========================================================================
   12. Условные поля (редактор блока)
   ========================================================================== */
.conditional-fields { display: grid; gap: 2px; margin: 4px 0 6px; }
.conditional-fields .form-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 16px; row-gap: 4px; align-items: center; padding: 2px 0;
}
.conditional-fields .form-row > label { font-weight: 500; font-size: 14px; color: var(--text); }
.conditional-fields .form-row > select,
.conditional-fields .form-row > input[type="text"] {
  width: 100%; max-width: 100%; box-sizing: border-box;
  padding: 8px 12px; font-size: 14px; font-family: inherit;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  margin: 0 !important;
}
.conditional-fields .form-row > select:focus,
.conditional-fields .form-row > input[type="text"]:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.conditional-fields .form-row > input[type="color"] {
  width: 60px; height: 38px; padding: 2px; cursor: pointer; justify-self: start; border-radius: 6px;
}
.conditional-fields .form-row > input[type="range"] {
  padding: 0; height: auto; border: none; background: transparent; box-shadow: none; width: 100%;
}

/* ==========================================================================
   13. Tiny-prompt + пикер иконок
   ========================================================================== */
.tiny-prompt-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 10, 35, 0.55);
  z-index: var(--z-prompt-modal);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
  animation: tiny-prompt-fade 0.12s ease;
}
@keyframes tiny-prompt-fade { from { opacity: 0; } to { opacity: 1; } }
.tiny-prompt {
  background: var(--surface); border-radius: 14px;
  padding: 22px 24px 18px;
  width: min(440px, 96vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; gap: 10px;
  animation: tiny-prompt-pop 0.15s ease;
  color: var(--text);
}
@keyframes tiny-prompt-pop {
  from { transform: scale(0.96); opacity: 0.7; }
  to { transform: scale(1); opacity: 1; }
}
.tiny-prompt-title {
  margin: 0; font-family: 'Montserrat', sans-serif;
  font-size: 18px; font-weight: 700; color: var(--primary);
}
.tiny-prompt-label { font-size: 13px; color: var(--text-light); margin-top: 2px; }
.tiny-prompt input[type="text"] {
  width: 100%; box-sizing: border-box;
  padding: 11px 14px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px; color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: 10px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.tiny-prompt input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.tiny-prompt-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 8px; padding-top: 10px;
  border-top: 1px solid var(--divider);
}
.tiny-prompt-actions .btn {
  padding: 9px 18px; font-size: 13px; border-radius: 22px; white-space: nowrap;
}
.tiny-prompt-error {
  padding: 6px 10px; font-size: 12.5px;
  color: var(--sem-error-text);
  background: var(--sem-error-bg);
  border-radius: 8px;
}
.tiny-prompt input.has-error {
  border-color: var(--sem-error) !important;
  background: var(--sem-error-bg) !important;
  box-shadow: 0 0 0 3px var(--sem-error-soft) !important;
}

.icon-field { width: 100%; }
.icon-field-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  cursor: pointer; font-family: inherit; font-size: 14px;
  color: var(--input-text); text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.icon-field-btn:hover { border-color: var(--primary); }
.icon-field-btn:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.icon-field-btn > i:first-child {
  width: 22px; text-align: center; font-size: 16px;
  color: var(--primary); flex-shrink: 0;
}
.icon-field-btn > span {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: monospace; font-size: 12.5px; color: var(--text-light);
}
.icon-field-arrow { color: var(--text-light); font-size: 11px; flex-shrink: 0; }

.icon-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 10, 35, 0.6);
  z-index: var(--z-prompt-modal);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
  animation: ip-fade 0.12s ease;
}
@keyframes ip-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ip-pop {
  from { transform: scale(0.96); opacity: 0.7; }
  to   { transform: scale(1);    opacity: 1; }
}
.icon-picker {
  background: var(--surface); border-radius: 16px;
  padding: 20px 22px 16px;
  width: min(640px, 96vw); max-height: 90vh;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: ip-pop 0.15s ease;
  color: var(--text);
}
.icon-picker-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-picker-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--primary); }
.icon-picker-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--hover-tint); color: var(--primary);
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-picker-close:hover { background: var(--hover-tint); filter: brightness(0.9); }
.icon-picker-search {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--tint-bg);
  border: 1px solid var(--divider); border-radius: 10px;
}
.icon-picker-search i { color: var(--text-light); font-size: 14px; }
.icon-picker-search input {
  flex: 1 1 auto; border: none; background: transparent;
  outline: none; padding: 6px 0; font-family: inherit;
  font-size: 14px; color: var(--text);
}
.icon-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px; overflow-y: auto;
  padding: 12px 2px; max-height: 55vh;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}
.icon-picker-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px; border: 1px solid transparent;
  border-radius: 10px; background: var(--tint-bg);
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.icon-picker-item:hover {
  background: var(--surface); border-color: var(--primary); transform: translateY(-1px);
}
.icon-picker-item.is-selected {
  background: var(--hover-tint); border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}
.icon-picker-item > i { font-size: 22px; color: var(--primary); line-height: 1; }
.icon-picker-name {
  font-size: 10.5px; color: var(--text-light); text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%; font-family: monospace;
}
.icon-picker-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ==========================================================================
   14. Редактор главной страницы
   ========================================================================== */
.idx-edit-btn {
  position: absolute; top: 20px; right: 20px; z-index: 10;
  padding: 10px 18px; border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.2);
  color: #fff; font-family: inherit;
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  backdrop-filter: blur(6px);
  transition: background 0.2s, border-color 0.2s;
}
.idx-edit-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.9);
}
.idx-edit-btn i { font-size: 12px; }

.idx-editor { gap: 22px; }
.idx-section {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px 16px;
  background: var(--tint-bg);
  border: 1px solid var(--divider); border-radius: 12px;
}
.idx-section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--primary);
  padding-bottom: 10px; margin-bottom: 6px;
  border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; gap: 8px;
}
.idx-section-title i { font-size: 13px; }
.idx-subsection-title {
  font-size: 12px; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 1px;
  margin: 6px 0 4px;
}
.idx-card-group {
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--divider); border-radius: 10px;
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px;
}
.idx-card-title {
  font-size: 12px; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px;
}
.idx-icon-picker-row { display: flex; align-items: center; gap: 12px; }
.idx-icon-preview {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--hover-tint); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.idx-hero-bg-field { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.idx-hero-bg-preview {
  width: 100%; max-width: 420px; aspect-ratio: 16 / 7;
  border: 2px dashed var(--divider); border-radius: 10px;
  background: var(--tint-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 13px; gap: 8px; overflow: hidden;
}
.idx-hero-bg-preview i { font-size: 26px; }
.idx-hero-bg-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idx-hero-bg-preview.has-image { border-style: solid; border-color: var(--divider); background: var(--surface); }
.idx-hero-bg-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.idx-hero-bg-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.idx-link-field { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.idx-link-select { width: 100% !important; box-sizing: border-box; }
.idx-link-input {
  width: 100%; box-sizing: border-box;
  padding: 8px 12px; font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.idx-link-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.idx-editor .idx-link-select {
  height: 36px; padding: 0 10px; font-size: 13px;
  font-family: 'Montserrat', sans-serif;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  width: 100%; box-sizing: border-box;
}
.idx-editor .idx-link-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.idx-title-lines {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 4px; width: 100%;
}
.idx-line-row { display: flex; gap: 8px; align-items: stretch; }
.idx-line-row .idx-line-text {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 12px; font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
}
.idx-line-row .idx-line-text:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.idx-line-remove {
  width: 36px; flex: 0 0 36px;
  border: none; background: var(--sem-error-bg);
  color: var(--sem-error-text);
  border-radius: 6px; cursor: pointer; font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.idx-line-remove:hover { background: var(--sem-error); color: #fff; }
.idx-add-line-btn {
  align-self: flex-start; margin-top: 8px;
  font-size: 13px; padding: 7px 14px;
}

.idx-divider {
  border: none; border-top: 1px solid var(--divider);
  margin: 14px 0 12px; width: 100%;
}

.idx-typo-group { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.idx-typo-row {
  display: flex; gap: 10px;
  align-items: center;
  margin-left: 166px;
  margin-bottom: 4px;
}
.idx-typo-row--standalone {
  margin-left: 0; padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--divider); border-radius: 10px;
  margin-bottom: 8px;
}
.idx-typo-item {
  display: flex; flex-direction: column; gap: 4px;
  flex: 1 1 auto; min-width: 0;
}
.idx-typo-item--label {
  flex: 0 0 auto; min-width: 100px;
  justify-content: center;
}
.idx-typo-item > label {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.idx-typo-item > input,
.idx-typo-item > select {
  width: 100%; box-sizing: border-box;
  height: 36px; padding: 0 10px;
  font-size: 13px; font-family: 'Montserrat', sans-serif;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  line-height: 1.2; margin: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.idx-typo-item > input:focus,
.idx-typo-item > select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.idx-editor .swal2-select,
.idx-typo-item > select.swal2-select {
  height: 36px !important;
  min-height: 0 !important;
  padding: 0 10px !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  border-radius: 6px !important;
  margin: 0 !important;
  background-image: none !important;
}

.idx-range-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.idx-range-row > input[type="range"] { flex: 1 1 auto; min-width: 0; }
.idx-range-value {
  flex: 0 0 48px; text-align: right;
  font-family: monospace; font-size: 13px;
  color: var(--primary); font-weight: 600;
}

.idx-hint {
  font-size: 12px; color: var(--text-light);
  margin-top: -2px; padding-left: 2px; font-style: italic;
}

@media (max-width: 640px) {
  .idx-edit-btn {
    padding: 8px 14px; font-size: 12px;
    top: 12px; right: 12px;
  }
}
@media (max-width: 768px) {
  .idx-typo-row {
    flex-direction: column; align-items: stretch;
    margin-left: 0;
  }
  .idx-typo-item--label { min-width: 0; }
  .idx-line-row .idx-line-text { font-size: 13px; }
  .idx-hero-preview { min-height: 180px; padding: 18px 20px; }
}

/* ==========================================================================
   15. Редактор главной — предпросмотр баннера
   ========================================================================== */
.idx-hero-preview-wrap { margin-bottom: 4px; }
.idx-hero-preview-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.idx-hero-preview-tab {
  padding: 6px 14px; border-radius: 18px;
  border: 1px solid var(--divider); background: var(--surface); color: var(--primary);
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.idx-hero-preview-tab i { font-size: 11px; }
.idx-hero-preview-tab:hover { background: var(--hover-tint); }
.idx-hero-preview-tab.active {
  background: var(--primary); color: var(--surface); border-color: var(--primary);
}

.idx-hero-preview {
  --preview-x: 0.5;
  --preview-cw: 1000px;
  --preview-color: #ffffff;

  display: flex; align-items: center;
  min-height: 220px; padding: 24px 30px;
  border-radius: 12px;
  background-color: var(--primary);
  background-size: cover; background-position: center; background-repeat: no-repeat;
  position: relative; overflow: hidden;
  color: var(--preview-color);
}
.idx-hero-preview::before {
  content: ''; flex: var(--preview-x) 1 0; min-width: 0; align-self: stretch;
}
.idx-hero-preview::after {
  content: ''; flex: calc(1 - var(--preview-x)) 1 0; min-width: 0; align-self: stretch;
}
.idx-hero-preview-overlay {
  position: absolute; inset: 0;
  background: rgba(91, 42, 86, 0.5);
  pointer-events: none;
}
.idx-hero-preview-content {
  position: relative; z-index: 1;
  flex: 0 0 auto; width: fit-content;
  max-width: var(--preview-cw);
  color: var(--preview-color);
  text-align: center;
  word-break: break-word;
}
.idx-hp-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 3vw, 40px);
  line-height: 1.05; letter-spacing: 1px; margin-bottom: 8px;
}
.idx-hp-title > div { display: block; }
.idx-hp-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px; font-weight: 300;
  letter-spacing: 2px; margin-bottom: 8px;
  opacity: 0.9;
}
.idx-hp-slogan {
  font-family: 'Playfair Display', serif;
  font-style: italic; font-size: 14px; margin-bottom: 10px; opacity: 0.95;
}
.idx-hp-button {
  display: inline-block; padding: 8px 18px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.6);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   16. Вкладка «Тема» — админ
   ========================================================================== */
.theme-admin-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.theme-list { display: flex; flex-direction: column; gap: 12px; }
.theme-card {
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 16px 20px;
  transition: box-shadow 0.2s;
}
.theme-card.is-active { border-width: 2px; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 15%, transparent); }
.theme-card-head {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.theme-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.theme-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--surface);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.theme-badge-muted {
  background: var(--hover-tint);
  color: var(--primary);
}
.theme-preview-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-light);
}
.theme-preview-label { min-width: 70px; }
.theme-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.theme-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-btn {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.theme-btn:hover { background: var(--primary); color: var(--surface); }
.theme-btn-primary { background: var(--primary); color: var(--surface); }
.theme-btn-primary:hover { background: var(--primary-dark); }
.theme-btn-danger { border-color: var(--sem-error); color: var(--sem-error); }
.theme-btn-danger:hover { background: var(--sem-error); color: #fff; }

.theme-editor { text-align: left; }

.theme-editor-hint {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px;
  color: var(--text-light);
  padding: 10px 14px;
  background: var(--tint-bg);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  margin: 10px 0 4px;
  line-height: 1.5;
}
.theme-editor-hint i { color: var(--primary); margin-top: 1px; flex-shrink: 0; }

.theme-editor-name-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}
.theme-editor-name-row > label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.theme-editor-name-row > input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-editor-name-row > input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.theme-editor-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.theme-editor-col h4 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 8px;
}
.theme-editor-subtitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 14px 0 6px;
  padding-left: 2px;
}
.theme-editor-subtitle:first-of-type { margin-top: 4px; }

.theme-color-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 130px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.theme-color-row label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  min-width: 0;
  overflow-wrap: break-word;
}
.theme-color-row input[type="color"] {
  width: 48px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  cursor: pointer;
  background: var(--input-bg);
}
.theme-color-row input[type="text"] {
  padding: 8px 12px;
  font-size: 13px;
  font-family: monospace;
  font-weight: 500;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--input-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.theme-color-row input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
@media (max-width: 900px) {
  .theme-editor-columns { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 640px) {
  .theme-editor-name-row { grid-template-columns: 1fr; gap: 6px; }
  .theme-color-row { grid-template-columns: minmax(0, 1fr) 48px 110px; gap: 6px; }
}

/* ==========================================================================
   Список контактов/соцсетей в настройках сайта — компактный вид
   ========================================================================== */
.ss-list-item .ss-icon-btn {
  padding: 8px 10px;
  font-size: 14px;
}
.ss-list-item .ss-icon-btn > i:first-child {
  width: 18px;
  font-size: 15px;
}
.ss-list-item .ss-icon-btn > span {
  font-family: 'Montserrat', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  text-transform: none;
}

/* ==========================================================================
   17. Вкладка «Заполнение» (seed)
   ========================================================================== */
.seed-tab { display: flex; flex-direction: column; gap: 24px; }
.seed-section {
  background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow); padding: 20px 22px;
}
.seed-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.seed-section-head h3 {
  margin: 0; font-size: 16px; font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.seed-hint {
  font-size: 13px; color: var(--text-light);
  line-height: 1.5; margin: 0 0 12px;
  padding: 10px 12px; background: var(--tint-bg);
  border-left: 3px solid var(--primary); border-radius: 8px;
}
.seed-textarea {
  width: 100%; box-sizing: border-box;
  min-height: 320px; padding: 14px 16px;
  font-family: 'Courier New', monospace;
  font-size: 13px; line-height: 1.5;
  color: var(--input-text); background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: 10px;
  resize: vertical; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.seed-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.seed-actions {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px;
}
.seed-actions .btn {
  display: inline-flex; align-items: center; gap: 8px;
}
.seed-output {
  margin-top: 16px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--divider);
}
.seed-output--success { background: var(--sem-success-soft); }
.seed-output--error   { background: var(--sem-error-bg); }
.seed-output-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--divider);
  font-size: 13px;
}
.seed-output--success .seed-output-head { color: var(--sem-success-text); }
.seed-output--error .seed-output-head   { color: var(--sem-error-text); }
.seed-output-head > b { flex: 1 1 auto; }
.seed-output-copy {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--divider); background: transparent;
  color: var(--primary); cursor: pointer; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.seed-output-body {
  margin: 0; padding: 12px 16px;
  font-family: 'Courier New', monospace;
  font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  color: var(--text); max-height: 400px; overflow-y: auto;
}

/* README */
.seed-readme {
  max-height: 600px; overflow-y: auto;
}
.seed-readme-pre {
  margin: 0; padding: 14px 16px;
  background: var(--tint-bg); border-radius: 10px;
  font-family: 'Courier New', monospace;
  font-size: 12.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  color: var(--text);
}

/* История */
.seed-history-list { display: flex; flex-direction: column; gap: 10px; }
.seed-history-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px; align-items: center;
  padding: 12px 16px; background: var(--tint-bg);
  border-radius: 10px;
}
.seed-history-head {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 4px;
}
.seed-history-date { font-size: 13px; color: var(--text); }
.seed-history-user { font-size: 12px; color: var(--text-light); }
.seed-history-body { font-size: 12.5px; color: var(--text-light); }
.seed-history-error {
  margin-top: 6px; padding: 6px 10px;
  background: var(--sem-error-bg); color: var(--sem-error-text);
  border-radius: 6px; font-size: 12px;
  font-family: monospace;
}
.seed-badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 10px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.seed-badge--ok   { background: var(--sem-success-soft); color: var(--sem-success-text); }
.seed-badge--err  { background: var(--sem-error-bg); color: var(--sem-error-text); }
.seed-badge--muted { background: var(--surface); color: var(--text-light); border: 1px solid var(--divider); }

.seed-rollback-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 12.5px;
}
.seed-empty {
  text-align: center; padding: 30px 20px;
  color: var(--text-light); font-style: italic;
  font-size: 13px;
}
.seed-error-text { color: var(--sem-error-text); }

@media (max-width: 640px) {
  .seed-history-row { grid-template-columns: 1fr; }
  .seed-actions { flex-direction: column; }
  .seed-actions .btn { justify-content: center; }
  .seed-actions .btn[style*="margin-left"] { margin-left: 0 !important; }
}

.seed-clear-btn { margin-left: auto; }
.seed-readme-copy { margin-bottom: 10px; }
.seed-error-text { color: var(--sem-error-text); }

/* ==========================================================================
   18. Кабинет учителя — занятия, расписание, ученики
   ========================================================================== */
.td-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.td-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.td-error { color: var(--sem-error-text); }
.td-error--full { grid-column: 1 / -1; }

/* --- Занятия (leçons tab) --- */
.td-lessons {
  display: flex;
  flex-direction: column;
  gap: 25px;
}
.td-day {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px;
  transition: background-color 0.25s ease;
}
.td-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}
.td-day-date {
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
}
.td-day-count {
  font-size: 14px;
  color: var(--text-light);
}
.td-day-body { margin-top: 15px; }

.td-lesson-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--tint-bg);
  flex-wrap: wrap;
}
.td-lesson-row:last-child { border-bottom: none; }
.td-lesson-info { min-width: 0; flex: 1 1 auto; }
.td-lesson-subject {
  font-weight: 500;
  color: var(--text);
}
.td-lesson-topic {
  color: var(--text-light);
  margin-left: 10px;
}
.td-lesson-side {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}
.td-lesson-student {
  background: var(--sem-info-bg);
  color: var(--sem-info-text);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}
.td-lesson-time {
  font-weight: 600;
  color: var(--text);
}
.td-lesson-btn {
  padding: 5px 12px;
}

@media (max-width: 640px) {
  .td-lesson-row { flex-direction: column; align-items: flex-start; }
  .td-lesson-side { width: 100%; justify-content: space-between; }
}

/* --- Расписание (schedule tab) --- */
.td-schedule-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.td-schedule-table thead {
  background: var(--primary);
  color: var(--surface);
}
.td-schedule-table th {
  padding: 15px;
  text-align: left;
  font-weight: 500;
}
.td-schedule-table td {
  padding: 15px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
.td-schedule-table tr:last-child td { border-bottom: none; }
.td-schedule-table tr:hover { background: var(--hover-tint); }
.td-cell-strong { font-weight: 600; }
.td-cell-primary { color: var(--primary); }
.td-cell-muted { color: var(--text-light); }
.td-cell-date { color: var(--text-light); white-space: nowrap; }
.td-cell-empty { color: var(--text-light); opacity: 0.5; }
.td-cell-actions { white-space: nowrap; }

/* --- Ученики --- */
.td-th-id { padding: 15px; width: 50px; }
.td-th-group { width: 180px; }
.td-th-status { width: 170px; }
.td-th-actions { width: 180px; }
.td-action-btn {
  padding: 5px 10px !important;
  font-size: 12px !important;
  margin-left: 0 !important;
}
.td-action-btn + .td-action-btn { margin-left: 4px !important; }
.td-action-btn-danger {
  background: var(--sem-error) !important;
  color: #fff !important;
}

/* --- Карточка ученика в модалке --- */
.profile-card--flat { box-shadow: none; padding: 0; }
.profile-card-grid--single { grid-template-columns: 1fr; }
.profile-card-row--compact { grid-template-columns: 160px 1fr; }

/* --- Модалка удаления --- */
.td-del-p { margin: 0 0 12px; text-align: left; }
.td-del-warn {
  margin: 0 0 12px;
  padding: 10px;
  background: var(--sem-warning-bg);
  color: var(--sem-warning-text);
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
}
.td-del-hint {
  margin: 0 0 8px;
  text-align: left;
  font-size: 13px;
  color: var(--text-light);
}