/* =====================================================
   GLOBAL
===================================================== */

.hidden { display: none; }

.muted {
  color: #999;
  font-size: 14px;
}

/* =====================================================
   ADMIN ROOT
===================================================== */

body.admin {
  background: var(--bg);
  color: var(--text);
}

/* =====================================================
   ADMIN LAYOUT
===================================================== */

.admin-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* =====================================================
   EDITABLE
===================================================== */

.editable {
  cursor: text;
}

body.admin .editable[contenteditable="true"]:hover {
  outline: 2px dashed #c7bfff;
}

body.admin .editable[contenteditable="true"]:focus {
  outline: 2px dashed #6c5ce7;
  background: var(--surface);
}

.editable:empty::before {
  content: '«кликните, чтобы добавить»';
  color: #999;
}

/* =====================================================
   SECTIONS (ADMIN)
===================================================== */

body.admin .recipe-section {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 18px;
}

body.admin .recipe-section:hover {
  border-color: rgba(120,120,255,0.35);
}

body.admin .section-delete {
  position: absolute;
  top: -10px;
  right: -10px;

  width: 28px;
  height: 28px;
  border-radius: 50%;

  border: 1px solid #e4e6fb;
  background: #fff;

  color: #999;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
}

body.admin .section-delete:hover {
  color: #ef4444;
  background: #fff1f0;
}

/* =====================================================
   SECTION ITEMS (ADMIN)
===================================================== */

body.admin .section-item {
  position: relative;
  padding: 16px 16px 40px;
  margin-bottom: 12px;

  border: 1px dashed var(--border);
  background: var(--surface-2);
  border-radius: 12px;

  transition: border-color .15s ease, background .15s ease;
}

body.admin .section-item:hover {
  border-color: #aab6ff;
  background: #f5f7ff;
}

body.admin .section-item.dragging {
  opacity: 0.5;
}

/* =====================================================
   ITEM DELETE (TOP RIGHT)
===================================================== */

body.admin .item-delete--floating {
  position: absolute;
  top: 8px;
  right: 8px;

  width: 24px;
  height: 24px;

  border: none;
  background: transparent;
  color: #999;

  font-size: 18px;
  cursor: pointer;

  opacity: 0;
  transition: opacity .15s ease;
}

body.admin .section-item:hover .item-delete--floating {
  opacity: 1;
}

/* =====================================================
   ITEM DRAG (BOTTOM RIGHT)
===================================================== */

body.admin .item-drag-wrap {
  position: absolute;
  right: 8px;
  bottom: 8px;

  opacity: 0;
  transition: opacity .15s ease;
}

body.admin .section-item:hover .item-drag-wrap {
  opacity: 1;
}

.item-drag-handle {
  cursor: grab;
  user-select: none;
  font-size: 18px;
  color: #999;
}

.item-drag-handle:hover {
  color: #555;
}

.item-drag-handle:active {
  cursor: grabbing;
}


body.admin .ingredient-remove {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
}

body.admin .ingredient-remove:hover {
  color: #dc2626;
}

/* =====================================================
   STEPS
===================================================== */

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

.step-item {
  position: relative;
  padding: 14px 16px;
  padding-right: 56px;

  border-radius: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.step-delete {
  position: absolute;
  top: 12px;
  right: 12px;

  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  opacity: 0;
}

.step-item:hover .step-delete {
  opacity: 1;
}

.step-delete:hover {
  color: #dc2626;
}

/* =====================================================
   DRAG SAFETY
===================================================== */

.dragging iframe {
  pointer-events: none !important;
}

/* =====================================================
   USER MODE – HIDE ADMIN UI
===================================================== */

body:not(.admin) .section-item {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
}

body:not(.admin) .item-delete--floating,
body:not(.admin) .item-drag-wrap,
body:not(.admin) .item-drag-handle,
body:not(.admin) .section-delete,
body:not(.admin) .text-toolbar,
body:not(.admin) .ingredient-remove,
body:not(.admin) .step-delete,
body:not(.admin) .section-drag-handle,
body:not(.admin) .section-actions,
body:not(.admin) .sections-add-wrapper,
body:not(.admin) .sections-add,
body:not(.admin) .add-section-wrapper,
body:not(.admin) .add-section-btn {
  display: none !important;
}

/* =====================================================
   ADMIN LESSONS UI
   (filters, search, add button, cards)
===================================================== */

/* Header actions row */
.admin-page .admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Search */
.admin-page .admin-search {
  flex: 1;
  min-width: 220px;
}

.admin-page .admin-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px;

  font-size: 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Filters */
.admin-page .admin-filters {
  display: flex;
  gap: 6px;
}

.admin-page .admin-filter {
  all: unset;
  cursor: pointer;

  padding: 6px 10px;
  border-radius: 8px;

  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;

  background: #f0f0f0;
  color: #000;

  transition: background .15s ease, color .15s ease;
}

.admin-page .admin-filter:hover {
  background: #e6e6e6;
}

.admin-page .admin-filter.is-active {
  background: #000;
  color: #fff;
}

/* Add lesson button */
.admin-page .admin-header-actions .btn.primary {
  height: 36px;
  padding: 0 14px;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  border-radius: 8px;
  background: #000;
  color: #fff;
  white-space: nowrap;
}

/* Lesson cards */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;

  display: flex;
  align-items: center;
  gap: 16px;

  transition: box-shadow .15s ease;
}

.admin-card:hover {
  box-shadow: 0 12px 30px rgba(0,0,0,0.06);
}

.admin-card.is-published {
  background: #f3faf6;
  border-color: #bfe3cf;
}

.admin-card__preview {
  width: 64px;
  height: 64px;
  flex-shrink: 0;

  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);

  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-card__preview-placeholder {
  font-size: 22px;
  opacity: 0.4;
}

.admin-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Status badge */
.lesson-badge {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
}

.lesson-badge.published {
  background: #e6f6ea;
  color: #217a3c;
}

.lesson-badge.draft {
  background: #f2f2f2;
  color: #666;
}

/* Actions */
.admin-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  cursor: pointer;
  border: none;
  background: none;
}

.btn.small {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.small:hover {
  background: #ececf0;
}

.btn.small.ghost {
  background: transparent;
  border: none;
  color: #555;
}

.btn.unpublish {
  background: transparent;
  border: 1px dashed #ccc;
  color: #999;
}

.btn.danger {
  background: #fff;
  color: #d33;
  border: 1px solid #f3c1c1;
}

.btn.danger:hover {
  background: #fdecec;
}

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

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.section-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;

  border-radius: 8px;
  border: 1px dashed var(--border);
  color: var(--text);
  background: var(--surface-2);


  cursor: pointer;
  transition: all 0.15s ease;
}

.section-actions button:hover {
  background: var(--surface-2);
  border-color: #aab6ff;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;

  border-radius: 8px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  color: var(--text-muted);

  cursor: pointer;

  transition: all 0.15s ease;
}

.btn-add:hover {
  background: #f3f4f8;
  border-color: #c7cbe0;
  color: #4f5563;
}

.btn-add::before {
  content: '+';
  font-weight: 600;
  color: #8b8fa3;
}

/* =====================================================
   GLOBAL
===================================================== */

.hidden { display: none; }

.muted {
  color: #999;
  font-size: 14px;
}

/* =====================================================
   ADMIN ROOT
===================================================== */

body.admin {
  background: #f6f7fb;
}

/* =====================================================
   ADMIN LAYOUT
===================================================== */

.admin-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* =====================================================
   EDITABLE
===================================================== */

.editable {
  cursor: text;
}

body.admin .editable[contenteditable="true"]:hover {
  outline: 2px dashed #c7bfff;
}

body.admin .editable[contenteditable="true"]:focus {
  outline: 2px dashed #6c5ce7;
  background: #fff;
}

.editable:empty::before {
  content: '«кликните, чтобы добавить»';
  color: #999;
}

/* =====================================================
   SECTIONS (ADMIN)
===================================================== */

body.admin .recipe-section {
  position: relative;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 18px;
}

body.admin .recipe-section:hover {
  border-color: rgba(120,120,255,0.35);
}

body.admin .section-delete {
  position: absolute;
  top: -10px;
  right: -10px;

  width: 28px;
  height: 28px;
  border-radius: 50%;

  border: 1px solid #e4e6fb;
  background: #fff;

  color: #999;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
}

body.admin .section-delete:hover {
  color: #ef4444;
  background: #fff1f0;
}

/* =====================================================
   SECTION ITEMS (ADMIN)
===================================================== */

body.admin .section-item {
  position: relative;
  padding: 16px 16px 40px;
  margin-bottom: 12px;

  border: 1px dashed #cbd5ff;
  border-radius: 12px;
  background: #fafbff;

  transition: border-color .15s ease, background .15s ease;
}

body.admin .section-item:hover {
  border-color: #aab6ff;
  background: #f5f7ff;
}

body.admin .section-item.dragging {
  opacity: 0.5;
}

/* =====================================================
   ITEM DELETE (TOP RIGHT)
===================================================== */

body.admin .item-delete--floating {
  position: absolute;
  top: 8px;
  right: 8px;

  width: 24px;
  height: 24px;

  border: none;
  background: transparent;
  color: #999;

  font-size: 18px;
  cursor: pointer;

  opacity: 0;
  transition: opacity .15s ease;
}

body.admin .section-item:hover .item-delete--floating {
  opacity: 1;
}

/* =====================================================
   ITEM DRAG (BOTTOM RIGHT)
===================================================== */

body.admin .item-drag-wrap {
  position: absolute;
  right: 8px;
  bottom: 8px;

  opacity: 0;
  transition: opacity .15s ease;
}

body.admin .section-item:hover .item-drag-wrap {
  opacity: 1;
}

.item-drag-handle {
  cursor: grab;
  user-select: none;
  font-size: 18px;
  color: #999;
}

.item-drag-handle:hover {
  color: #555;
}

.item-drag-handle:active {
  cursor: grabbing;
}


body.admin .ingredient-remove {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
}

body.admin .ingredient-remove:hover {
  color: #dc2626;
}

/* =====================================================
   STEPS
===================================================== */

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

.step-item {
  position: relative;
  padding: 14px 16px;
  padding-right: 56px;

  border-radius: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.step-delete {
  position: absolute;
  top: 12px;
  right: 12px;

  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  opacity: 0;
}

.step-item:hover .step-delete {
  opacity: 1;
}

.step-delete:hover {
  color: #dc2626;
}

/* =====================================================
   DRAG SAFETY
===================================================== */

.dragging iframe {
  pointer-events: none !important;
}

/* =====================================================
   USER MODE – HIDE ADMIN UI
===================================================== */

body:not(.admin) .section-item {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
}

body:not(.admin) .item-delete--floating,
body:not(.admin) .item-drag-wrap,
body:not(.admin) .item-drag-handle,
body:not(.admin) .section-delete,
body:not(.admin) .text-toolbar,
body:not(.admin) .ingredient-remove,
body:not(.admin) .step-delete,
body:not(.admin) .section-drag-handle,
body:not(.admin) .section-actions,
body:not(.admin) .sections-add-wrapper,
body:not(.admin) .sections-add,
body:not(.admin) .add-section-wrapper,
body:not(.admin) .add-section-btn {
  display: none !important;
}

/* =====================================================
   ADMIN LESSONS UI
   (filters, search, add button, cards)
===================================================== */

/* Header actions row */
.admin-page .admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Search */
.admin-page .admin-search {
  flex: 1;
  min-width: 220px;
}

/* Filters */
.admin-page .admin-filters {
  display: flex;
  gap: 6px;
}

.admin-page .admin-filter {
  all: unset;
  cursor: pointer;

  padding: 6px 10px;
  border-radius: 8px;

  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;

  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);

  transition: background .15s ease, color .15s ease;
}

.admin-page .admin-filter:hover {
  background: #e6e6e6;
}

.admin-page .admin-filter.is-active {
  background: #000;
  color: #fff;
}

/* Add lesson button */
.admin-page .admin-header-actions .btn.primary {
  height: 36px;
  padding: 0 14px;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  border-radius: 8px;
  background: #000;
  color: #fff;
  white-space: nowrap;
}

/* Lesson cards */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;

  display: flex;
  align-items: center;
  gap: 16px;

  transition: box-shadow .15s ease;
}

.admin-card:hover {
  box-shadow: 0 12px 30px rgba(0,0,0,0.06);
}

.admin-card.is-published {
  background: #f3faf6;
  border-color: #bfe3cf;
}

.admin-card__preview {
  width: 64px;
  height: 64px;
  flex-shrink: 0;

  border-radius: 12px;
  overflow: hidden;
  background: #f3f3f3;

  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-card__preview-placeholder {
  font-size: 22px;
  opacity: 0.4;
}

.admin-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Status badge */
.lesson-badge {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
}

.lesson-badge.published {
  background: #e6f6ea;
  color: #217a3c;
}

.lesson-badge.draft {
  background: #f2f2f2;
  color: #666;
}

/* Actions */
.admin-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  cursor: pointer;
  border: none;
  background: none;
}

.btn.small {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;

  background: #f4f4f6;
  border: 1px solid #ddd;
  color: #222;
}

.btn.small:hover {
  background: #ececf0;
}

.btn.small.ghost {
  background: transparent;
  border: none;
  color: #555;
}

.btn.unpublish {
  background: transparent;
  border: 1px dashed #ccc;
  color: #999;
}

.btn.danger {
  background: #fff;
  color: #d33;
  border: 1px solid #f3c1c1;
}

.btn.danger:hover {
  background: #fdecec;
}

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

body.admin .section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

body.admin .section-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;

  border-radius: 8px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  color: var(--text);

  cursor: pointer;
  transition: all 0.15s ease;
}

body.admin .section-actions button:hover {
  background: #f3f4f8;
  border-color: #c7cbe0;
  color: #4f5563;
}


.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;

  border-radius: 8px;
  border: 1px dashed #d8dbe8;
  background: #fafbff;

  color: #6b7280; /* спокойный серый */
  cursor: pointer;

  transition: all 0.15s ease;
}

.btn-add:hover {
  background: #f3f4f8;
  border-color: #c7cbe0;
  color: #4f5563;
}

.btn-add::before {
  content: '+';
  font-weight: 600;
  color: #8b8fa3;
}

.section-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;

  border-radius: 8px;
  border: 1px dashed #d8dbe8;
  background: #fafbff;

  color: #6b7280; /* спокойный серый */
  cursor: pointer;

  transition: all 0.15s ease;
}

.section-actions button:hover {
  background: #f3f4f8;
  border-color: #c7cbe0;
  color: #4f5563;
}

/* =========================
   ADMIN — LESSON EDIT
========================= */

.admin-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ---------- headers ---------- */

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 16px;
}

.admin-page-header h1,
.admin-page-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
}

/* =========================
   STEP CARD
========================= */

.admin-step-card {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 16px;

  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 16px;


  margin-bottom: 14px;
}

/* ---------- image ---------- */

.admin-step-image {
  width: 140px;
}

.step-image-label {
  display: block;
  width: 100%;
  height: 140px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
}

.step-image-label img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-step-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 13px;
  color: #6b7280;
  text-align: center;
  padding: 8px;
}

/* =========================
   STEP BODY
========================= */

.admin-step-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* VIEW MODE */

.step-view .admin-step-title {
  font-size: 15px;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.4;
  margin-bottom: 6px;
}

.admin-step-meta {
  font-size: 13px;
  color: #64748b;
}

/* =========================
   EDIT MODE
========================= */

.step-edit input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;

  font-size: 14px;
  margin-bottom: 10px;
}

.step-edit input[type="text"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.step-edit-actions {
  display: flex;
  gap: 10px;
}

/* =========================
   ACTIONS
========================= */

.admin-step-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.admin-step-actions .btn {
  white-space: nowrap;
}

/* =========================
   HELPERS
========================= */

.hidden {
  display: none !important;
}

.admin-step-card:has(.step-edit:not(.hidden)) {
  box-shadow: var(--shadow);
}

.step-image-label:hover {
  box-shadow: inset 0 0 0 2px rgba(99,102,241,.4);
}

/* =========================
   ADMIN FORM
========================= */

.admin-form {
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
}

.form-group input {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}

.form-group input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ACTIONS */

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

/* muted helper (если нет) */

.muted {
  color: #6b7280;
  font-size: 14px;
}

/* =========================
   ADMIN BACK LINK
========================= */

.admin-page-header--with-back {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  font-size: 14px;
  font-weight: 500;
  color: #2563eb;
  text-decoration: none;

  width: fit-content;
}

.admin-back-link:hover {
  text-decoration: underline;
}

.admin-back-link {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
}

.admin-recipe-card {
  cursor: grab;
}

.admin-recipe-card.dragging {
  opacity: 0.5;
}

.admin-pre {
  background: #0f172a;
  color: #e5e7eb;
  padding: 14px;
  border-radius: 10px;
  font-size: 13px;
  overflow-x: auto;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.activity-main {
  font-size: 14px;
}

.activity-meta {
  font-size: 12px;
  color: #888;
  display: flex;
  gap: 12px;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-main {
  font-size: 14px;
  font-weight: 600;
}

.activity-meta {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.activity-filter {
  padding:6px 10px;
  border-radius:10px;
  border:1px solid #e5e7eb;
  background:#f8fafc;
  font-size:13px;
  cursor:pointer;
}

.activity-filter.active {
  background:#111827;
  color:#fff;
  border-color:#111827;
}

.activity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.filter-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #334155;
  padding: 6px 14px;
  border-radius: 999px; /* pill */
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}

.filter-btn:hover {
  background: #e5e7eb;
}

.filter-btn.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.filter-btn {
  min-height: 32px;
}

.activity-list.compact {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.activity-row {
  display: grid;
  grid-template-columns: 52px 180px 1fr 140px;
  gap: 12px;
  align-items: center;

  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}

.activity-row:hover {
  background: var(--surface-2);
}

.activity-time {
  font-family: monospace;
  color: #64748b;
}

.activity-action {
  font-weight: 600;
  white-space: nowrap;
}

.activity-target {
  color: #334155;
  font-family: monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-ip {
  font-family: monospace;
  font-size: 12px;
  color: #475569;
  text-align: right;
}

.activity-scroll {
  max-height: 520px; /* ≈ 20 строк */
  overflow-y: auto;
  resize: vertical;          /* 🔥 можно тянуть мышкой */
  padding-right: 6px;
}

/* аккуратный скролл */
.activity-scroll::-webkit-scrollbar {
  width: 8px;
}

.activity-scroll::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 4px;
}

.activity-scroll::-webkit-scrollbar-thumb:hover {
  background: #cbd5f5;
}

.activity-row {
  display: grid;
  grid-template-columns: 60px 1fr 240px;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.activity-section {
  padding-bottom: 12px;
}



/* чтобы scrollbar не прыгал */
.activity-scroll::-webkit-scrollbar {
  width: 8px;
}

.activity-scroll::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 6px;
}

.activity-list.compact {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-row {
  display: grid;
  grid-template-columns: 56px 180px 1fr 140px;
  gap: 12px;
  align-items: center;

  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

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

/* время */
.activity-time {
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* действие */
.activity-action {
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
}

/* путь / цель */
.activity-target {
  color: #334155;
  font-family: monospace;
  font-size: 13px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* IP */
.activity-ip {
  text-align: right;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.activity-row:hover {
  background: #f8fafc;
}

.activity-row[data-type="page"] .activity-target {
  opacity: 0.9;
}

.activity-target:has-text("/favicon.ico") {
  display: none;
}

.editor-image img {
  max-width: 100%;
  display: block;
  margin: 12px auto;
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}

.admin-card__preview {
  cursor: pointer;
  position: relative;
}

.admin-card__preview::after {
  content: "✏️ Изменить";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  font-size: 14px;
  transition: 0.2s;
}

.admin-card__preview:hover::after {
  opacity: 1;
}

.section-heading {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 12px;
}

/* =========================
   SECTION ACTION BUTTONS
========================= */

.section-actions {
  margin: 12px 0 20px 12px; /* сверху, справа, снизу, слева */
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* =========================
   COMMON PILL BUTTON STYLE
========================= */

.section-actions button,
.text-toolbar button {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 10px;

  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;

  cursor: pointer;
  transition: all 0.15s ease;
}

.section-actions button:hover,
.text-toolbar button:hover {
  background: #e5e7eb;
}

.section-actions button:active,
.text-toolbar button:active {
  background: #d1d5db;
}

.text-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  margin-left: 12px;
}

.text-toolbar button.active {
  background: #e0e7ff;
  border-color: #c7d2fe;
}

.tg-header {
  position: relative;
}

.section-delete {
  position: absolute;
  top: 10px;
  right: 12px;

  width: 26px;
  height: 26px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 8px;
background: var(--surface-2);
  border: 1px solid var(--border);

  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.section-delete:hover {
  background: #fee2e2;
  border-color: #fecaca;
}

.lesson-title-inline {
  cursor: pointer;
  outline: none;
  transition: background 0.15s ease;
}

.lesson-title-inline[contenteditable="true"] {
  background: #f3f4f6;
  border-radius: 6px;
  padding: 2px 4px;
}

.tag-btn {
  padding: 6px 10px;
  border-radius: 8px;
 background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.tag-btn.active {
  background: #cbb6e3;
  border-color: #9f7ec9;
  color: #2b1d3b;
  font-weight: 500;
}

.bulk-ingredients-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.25s ease;
}

.bulk-ingredients-panel.active {
  max-height: 300px;
  opacity: 1;
}

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

.admin-card {
  display: flex;
  gap: 20px;
  padding: 16px 20px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  align-items: center;
  transition: all 0.2s ease;
  cursor: grab;
}

.admin-card:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.admin-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.admin-card__preview {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #f3f3f3;
}

.admin-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-card__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== ADMIN DARK THEME FIX ===== */

.admin-page {
  background: #111316;
  color: #f5f5f5;
}

.admin-card {
  background: #1a1d21;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04);
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #dcdcdc;
}

input[type="text"],
input[type="file"],
select,
textarea {
  width: 100%;
  background: #0f1114;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  color: #ffffff;
  transition: 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #7c5cff;
  box-shadow: 0 0 0 2px rgba(124,92,255,0.2);
}

.form-hint {
  font-size: 13px;
  color: #9aa0a6;
  margin-top: 6px;
}

hr {
  border: none;
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: 24px 0;
}

/* FORCE DARK STORE CARD */

.admin-page .admin-card {
  background: #171a1f !important;
  color: #ffffff !important;
}

.admin-page .admin-card h3 {
  color: #ffffff !important;
}

.admin-type-switch {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-type-btn {
  padding: 8px 14px;
  border-radius: 10px;
  background: #1f1f1f;
  color: #aaa;
  text-decoration: none;
  font-weight: 500;
}

.admin-type-btn.active {
  background: linear-gradient(135deg, #7c5cff, #b08cff);
  color: #fff;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

.paywall-status {
  font-size: 13px;
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.paywall-status.saving {
  color: #f59e0b;
  opacity: 1;
}

.paywall-status.saved {
  color: #10b981;
  opacity: 1;
}

.paywall-status.error {
  color: #ef4444;
  opacity: 1;
}

.pw-upload-btn {
  display: inline-block;
  padding: 8px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.pw-image-preview img {
  max-width: 220px;
  margin-top: 12px;
  border-radius: 12px;
}

/* ===== FEATURE IMAGE PREVIEW ===== */

.pw-feature-preview {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 8px;
  display: block;
}

.pw-feature-image-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.bullet-list li {
  margin-bottom: 10px;
}

/* =========================
   PAYWALL AUDIENCE IMAGE
========================= */

#pw-audience-preview {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 16px;
  margin-top: 12px;
}

.pw-block img {
  object-fit: cover;
}

.pw-editor-block {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 28px;
  border: 1px solid #eee;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}

.pw-block-header {
  font-weight: 600;
  margin-bottom: 16px;
}

.pw-block-body input,
.pw-block-body textarea {
  width: 100%;
  margin-bottom: 14px;
}

.pw-editor {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.pw-editor-block {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid #eee;
  box-shadow: 0 8px 25px rgba(0,0,0,0.04);
}

.pw-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-weight: 600;
}

.pw-drag {
  cursor: grab;
  opacity: 0.4;
  margin-right: 10px;
}

.pw-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  margin-left: 8px;
}

.hidden-block {
  opacity: 0.5;
  filter: grayscale(0.5);
}

.hidden-block {
  opacity: 0.4;
  filter: grayscale(0.6);
  position: relative;
}

.hidden-block::after {
  content: "Скрыт во фронте";
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 12px;
  color: #999;
}

.pw-block-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pw-block-actions button {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px;
}

.pw-block-actions button:hover {
  opacity: 1;
}

.pw-drag {
  cursor: grab;
  opacity: 0.5;
}

.pw-add-block-wrapper {
  margin-top: 20px;
  position: relative;
}

.pw-add-main {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.pw-add-menu {
  position: absolute;
  top: 45px;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 100;
}

.pw-add-menu.hidden {
  display: none;
}

.pw-add-menu button {
  background: none;
  border: none;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
}

.font-size-input {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px;
}

.paywall-template-select {
  margin-bottom: 8px;
}

.paywall-template-dropdown {
  padding: 4px 8px;
  border-radius: 6px;
}

.badge-paywall {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-paywall-missing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.lesson-badge.paywall {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
}

.lesson-badge.paywall-missing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.btn.ghost {
  opacity: 0.8;
}
.btn.ghost:hover {
  opacity: 1;
}

.lesson-variable {
  margin-top: 6px;
  font-size: 13px;
  color: #666;
}

.lesson-variable-label {
  font-weight: 500;
}

.lesson-variable-value {
  font-family: monospace;
  background: #545454;
  padding: 2px 6px;
  border-radius: 6px;
}

.lesson-variable-note {
  margin-left: 6px;
  opacity: 0.6;
}

.lesson-refresh {
  margin-left: 6px;
  cursor: pointer;
  text-decoration: none;
  opacity: 0.7;
}

.lesson-refresh:hover {
  opacity: 1;
}

.lesson-title-inline.saved {
  background: rgba(120,255,150,0.15);
}

.lesson-title-inline {
  cursor: text;
  border-bottom: 1px dashed transparent;
}

.lesson-title-inline:hover {
  border-bottom: 1px dashed #888;
}

.lesson-title-inline {
  cursor: text;
  border-bottom: 1px dashed transparent;
}

.lesson-title-inline:hover {
  border-bottom: 1px dashed #888;
}

.lesson-title-inline {
  color: var(--text);
  cursor: text;
}

/* режим редактирования */
.lesson-title-inline[contenteditable="true"] {

  background: #f2f3f5;

  color: #111;      /* тёмный текст */

  padding: 4px 8px;

  border-radius: 6px;

  outline: none;

  font-weight: 500;
}

.admin-title-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.admin-back {

  white-space: nowrap;

}

.admin-category-select{
  margin-top:6px;
  padding:4px 8px;
  border-radius:6px;
  border:1px solid #ddd;
  font-size:13px;
}

.admin-card__category select{
  width:100%;
  padding:4px 8px;
  border-radius:6px;
  border:1px solid #ddd;
  font-size:13px;
  margin-bottom:6px;
}

.steps-bulk{
  margin-top:12px;
}

.steps-bulk textarea{
  width:100%;
  min-height:140px;
  padding:10px;
  border-radius:8px;
  border:1px solid #ddd;
  font-size:14px;
}

.steps-bulk-actions{
  margin-top:8px;
  display:flex;
  gap:8px;
}

.lesson-id {
  color: #9ca3af;
  font-weight: 500;
  margin-right: 6px;
  font-size: 13px;
}

.sections-id-panel {
  position: fixed;
  right: 20px;
  top: 120px;

  width: 220px;

  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;

  padding: 12px;
  font-size: 13px;

  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.sections-id-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 8px;
}

.sections-id-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.section-id-item {
  background: #f3f4f6;
  padding: 4px 6px;
  border-radius: 6px;
  font-family: monospace;
}

.copy-btn {
  border: none;
  background: #eef2ff;
  color: #4f46e5;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.sections-id-panel{
  position: sticky;
  top: 80px;

  z-index: 5;

  margin-bottom:20px;
  padding:12px 14px;

  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:10px;

  font-size:13px;
}

.sections-id-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:8px;
}

.sections-id-list{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.section-id-item{
  background:#fff;
  border:1px solid #e5e7eb;
  padding:4px 6px;
  border-radius:6px;
  font-family:monospace;
}

.sections-bulk-create{
  margin-top:10px;
  display:flex;
  gap:6px;
}

.sections-bulk-create input{
  width:60px;
  padding:4px 6px;
}

.sections-bulk-create button{
  padding:4px 8px;
}

.ingredient-select{
width:110px;
padding:4px 6px;
border-radius:8px;
border:1px solid var(--border);
background:var(--surface);
color:var(--text);
font-size:14px;
}

.ingredient-dragging {
  opacity: .4;
}

.ingredient-drag {
  cursor: grab;
  user-select: none;
  opacity: .4;
  margin-right: 6px;
}

.ingredient-drag:active {
  cursor: grabbing;
}

.ingredient-dragging {
  opacity: .5;
}

.ingredient-drag-chosen {
  background: rgba(0,0,0,0.05);
}

.section-item[data-itemtype="ingredients"] .ingredient-view-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-item[data-itemtype="ingredients"] .ingredient-name {
  flex: 1;
  text-align: left;
}

.section-item[data-itemtype="ingredients"] .ingredient-amount {
  white-space: nowrap;
  text-align: right;
  min-width: 70px;
}

.ingredients-view .ingredient-view-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ingredient-drag {
  flex: 0 0 auto;
  width: 18px;
}

.ingredient-name {
  flex: 1;
}

.ingredient-amount {
  flex: 0 0 auto;
  min-width: 70px;
  text-align: right;
}

.recipe-title-inline {
  cursor: text;
  border-bottom: 1px dashed transparent;
}

.recipe-title-inline:hover {
  border-bottom: 1px dashed #888;
}

.recipe-title-inline[contenteditable="true"] {
  padding: 2px 4px;
  border-radius: 6px;
}

.recipe-title-inline.saved {
  background: rgba(120,255,150,.15);
}

.admin-topbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px;
}

.lesson-telegram-toggle{
display:flex;
align-items:center;
gap:8px;
margin-top:6px;
font-size:13px;
color:#555;
}

.lesson-telegram-block{
margin-top:8px;
display:flex;
flex-direction:column;
gap:6px;
}

.telegram-url-input{
padding:6px 8px;
border-radius:6px;
border:1px solid #ddd;
font-size:13px;
}


td, th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-user {
  max-width: 160px;  /* меньше, чем 240 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table {
  width: 100%;
  table-layout: auto;
}

.activity-row.parent {
  border-bottom: 1px solid #eee;
  padding: 8px 0;
}

.activity-main {
  display: flex;
  gap: 10px;
  align-items: center;
}

.activity-children {
  margin-left: 20px;
  margin-top: 6px;
  font-size: 13px;
  color: #555;
}

.activity-children.hidden {
  display: none;
}

.toggle-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
}

.mini-link {
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
  opacity: 0.8;
}

.mini-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.mini-btn {
  font-size: 12px;
  padding: 4px 6px;
  margin-top: 4px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.mini-btn.danger {
  background: #fee2e2;
  color: #991b1b;
}

.mini-btn.safe {
  background: #dcfce7;
  color: #166534;
}

